:root {
  color-scheme: light;
  --brand: #aa1f24;
  --brand-dark: #86171d;
  --ink: #1b1b1b;
  --muted: #5c606a;
  --line: #e5e6e9;
  --input-line: #b9bdc4;
  --surface: #fff;
  --page: #f9fafc;
  --blush: #fcf3f3;
  font-family: Arial, "Source Han Sans CN", "Microsoft YaHei", "PingFang SC", sans-serif;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  z-index: 1;
  top: 10px;
  left: 12px;
  padding: 10px 16px;
  background: var(--surface);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.shell { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.site-header { background: var(--surface); }
.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 20px; }
.brand a { display: block; }
.brand img { display: block; width: 139px; height: auto; }
.brand > span {
  border-left: 1px solid var(--line);
  padding-left: 20px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}
.official-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.official-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.hero {
  color: white;
  background: #29232f;
  background-image: linear-gradient(90deg, rgba(30, 18, 25, .94), rgba(37, 24, 33, .70) 41%, rgba(31, 21, 30, .17) 82%), url("./lab-banner.webp");
  background-position: center, center 65%;
  background-size: cover;
  border-bottom: 3px solid var(--brand);
}
.hero-inner { padding-block: 47px 49px; }
.hero h1 { font-size: clamp(2rem, 4.3vw, 3rem); line-height: 1.25; letter-spacing: .035em; }
.hero-en { margin-top: 8px; color: #f3d7d8; font-size: 18px; letter-spacing: .025em; }
.hero-summary { margin-top: 17px; color: #f2edf1; font-size: 15px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  margin-block: 32px 52px;
}
.calculator, .guide { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.calculator { padding: 27px 28px 25px; }
h2 { font-size: 20px; line-height: 1.4; }
.target { min-width: 0; padding: 0; margin: 19px 0 22px; border: 0; }
.target legend { padding: 0; margin-bottom: 8px; color: var(--muted); font-size: 14px; }
.target-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.target-option { position: relative; }
.target-option label {
  display: grid;
  place-items: center;
  min-height: 44px;
  padding: 8px 4px;
  border: 1px solid var(--input-line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  text-align: center;
}
.target-option label:hover { border-color: var(--brand); }
.target-option input:checked + label { border-color: var(--brand); color: var(--brand-dark); background: var(--blush); font-weight: 700; }
.target-option input:focus-visible + label { outline: 2px solid var(--brand); outline-offset: 3px; }

.parameter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 18px; }
.parameter > label { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; font-size: 14px; font-weight: 700; }
.parameter-symbol { color: var(--muted); font-size: 14px; font-weight: 400; }
.parameter-symbol sub { line-height: 0; }
.measurement { display: flex; border: 1px solid var(--input-line); border-radius: 6px; }
.measurement:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px #aa1f2422; }
.measurement input {
  min-width: 0;
  width: 100%;
  height: 44px;
  padding-inline: 12px;
  border: 0;
  border-radius: 6px 0 0 6px;
  background: transparent;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.measurement input::placeholder { color: var(--muted); font-size: 14px; }
.measurement input:focus-visible { outline: none; }
.measurement select, .fixed-unit {
  flex: 0 0 79px;
  min-width: 0;
  padding-inline: 9px;
  border: 0;
  border-left: 1px solid var(--input-line);
  border-radius: 0 6px 6px 0;
  background: var(--page);
  color: var(--ink);
  font-size: 14px;
}
.measurement select:focus-visible { outline-offset: -2px; }
.fixed-unit { display: grid; place-items: center; }
.parameter[data-target] .measurement { border-color: #d9a5a6; background: var(--blush); }
.parameter[data-target] input { color: var(--brand-dark); font-weight: 700; }
.parameter[data-target] input::placeholder { color: var(--brand-dark); font-weight: 400; }
.parameter:has([aria-invalid="true"]) .measurement { border-color: var(--brand); }
.field-error, .form-error { margin-top: 6px; color: var(--brand-dark); font-size: 14px; }
.form-error { margin-top: 12px; }

.form-actions { display: flex; gap: 10px; margin-top: 21px; }
.button {
  min-height: 44px;
  padding: 7px 25px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
}
.button-primary { min-width: 112px; color: white; background: var(--brand); }
.button-primary:hover { background: var(--brand-dark); }
.button-secondary { color: var(--muted); background: var(--surface); border-color: var(--input-line); }
.button-secondary:hover { color: var(--ink); background: var(--page); }

.result {
  margin-top: 22px;
  padding: 15px 18px 17px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 6px;
  background: var(--page);
}
.result-bar { display: flex; min-height: 28px; align-items: center; justify-content: space-between; gap: 10px; }
.result h3 { font-size: 16px; }
.result-live { margin-top: 4px; }
.result-placeholder { color: var(--muted); font-size: 14px; }
.result-primary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.result-name { font-size: 15px; }
.result-value { color: var(--brand-dark); font-size: 28px; font-variant-numeric: tabular-nums; font-weight: 700; overflow-wrap: anywhere; }
.result-details { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 4px; color: var(--muted); font-size: 14px; }
.copy-button, .example-button {
  min-height: 44px;
  color: var(--brand-dark);
  background: var(--surface);
  border: 1px solid #c78184;
  border-radius: 6px;
  padding: 5px 13px;
  font-size: 14px;
  font-weight: 700;
}
.copy-button:hover, .example-button:hover { border-color: var(--brand); background: var(--blush); }

.guide { overflow: hidden; }
.formula { padding: 23px 24px; background: var(--blush); }
.equation {
  margin-block: 13px 16px;
  color: var(--brand-dark);
  font-size: clamp(1.43rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
}
.equation sub { font-size: .56em; }
.formula-key { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 10px; }
.formula-key > div { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.formula-key dt { min-width: 20px; color: var(--brand-dark); font-weight: 700; }
.formula-key dt sub { line-height: 0; }
.formula-key dd { color: var(--muted); }
.example { padding: 22px 24px 24px; }
.example p { margin-block: 8px 15px; color: var(--muted); font-size: 15px; line-height: 1.75; }
.quantity { color: var(--ink); font-weight: 700; white-space: nowrap; }

.site-footer { padding-block: 22px; color: #e1e1e1; background: #0d0d0d; font-size: 13px; }
.site-footer .shell { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; }
.site-footer a { text-underline-offset: 3px; }
.site-footer a:focus-visible { outline-color: currentColor; }

@media (max-width: 820px) {
  .shell { width: calc(100% - 40px); }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 18px; margin-block: 24px 38px; }
  .guide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { min-height: 64px; }
  .brand { gap: 10px; }
  .brand img { width: 105px; }
  .brand > span { padding-left: 10px; font-size: 13px; }
  .official-link { gap: 4px; font-size: 13px; }
  .hero { background-position: center, 65% center; }
  .hero-inner { padding-block: 35px 34px; }
  .hero-en { font-size: 16px; }
  .hero-summary { margin-top: 12px; font-size: 14px; }
  .calculator { padding: 19px 15px; }
  .target { margin-block: 15px 18px; }
  .target-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .parameter-grid { gap: 13px 10px; }
  .measurement input { padding-inline: 8px; }
  .measurement select, .fixed-unit { flex-basis: 60px; padding-inline: 4px; font-size: 13px; }
  .measurement input::placeholder { font-size: 12px; }
  .guide { grid-template-columns: minmax(0, 1fr); }
  .formula, .example { padding-inline: 19px; }
}

@media (max-width: 350px) {
  .parameter-grid { grid-template-columns: minmax(0, 1fr); }
}
