@layer reset, base, components, sections, utilities;

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    scroll-behavior: smooth;
    scroll-padding-top: 92px;
    text-size-adjust: 100%;
  }

  body,
  h1,
  h2,
  h3,
  p,
  figure,
  dl,
  dd,
  ol,
  ul {
    margin: 0;
  }

  button,
  input,
  select {
    font: inherit;
  }

  button,
  [role="button"] {
    -webkit-tap-highlight-color: transparent;
  }

  img,
  svg {
    display: block;
    max-width: 100%;
  }

  a {
    color: inherit;
  }

  [hidden] {
    display: none !important;
  }
}

@layer base {
  :root {
    color-scheme: light;
    --paper: #f4f0e7;
    --paper-raised: #fffdf7;
    --paper-quiet: #ebe6da;
    --ink: #171914;
    --ink-soft: #55584f;
    --ink-faint: #76796e;
    --line: #d8d2c5;
    --line-strong: #b9b2a4;
    --instrument: #151713;
    --instrument-raised: #1d201a;
    --instrument-soft: #242820;
    --instrument-line: #3b4036;
    --instrument-text: #f4f4ec;
    --instrument-muted: #a8ab9f;
    --laser: #d7ff45;
    --laser-soft: rgba(215, 255, 69, 0.14);
    --laser-ink: #111308;
    --warning: #a6531a;
    --warning-soft: #fff0df;
    --danger: #a7352c;
    --danger-soft: #ffe8e4;
    --success: #387452;
    --success-soft: #e6f3eb;
    --focus: #1769dd;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --shadow-bench: 0 24px 72px rgba(33, 29, 18, 0.12);
    --header-height: 72px;
    --content-width: 1180px;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  }

  :root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #10120f;
    --paper-raised: #181b16;
    --paper-quiet: #20241d;
    --ink: #f0f1e9;
    --ink-soft: #b3b7ab;
    --ink-faint: #8e9287;
    --line: #34382f;
    --line-strong: #53584c;
    --warning: #ffb573;
    --warning-soft: #3b2719;
    --danger: #ff978c;
    --danger-soft: #3c211f;
    --success: #89d1a8;
    --success-soft: #1c3325;
    --focus: #8ab4ff;
    --shadow-bench: 0 26px 80px rgba(0, 0, 0, 0.34);
  }

  @media (prefers-color-scheme: dark) {
    :root[data-theme="auto"] {
      color-scheme: dark;
      --paper: #10120f;
      --paper-raised: #181b16;
      --paper-quiet: #20241d;
      --ink: #f0f1e9;
      --ink-soft: #b3b7ab;
      --ink-faint: #8e9287;
      --line: #34382f;
      --line-strong: #53584c;
      --warning: #ffb573;
      --warning-soft: #3b2719;
      --danger: #ff978c;
      --danger-soft: #3c211f;
      --success: #89d1a8;
      --success-soft: #1c3325;
      --focus: #8ab4ff;
      --shadow-bench: 0 26px 80px rgba(0, 0, 0, 0.34);
    }
  }

  body {
    min-width: 320px;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
  }

  ::selection {
    background: var(--laser);
    color: var(--laser-ink);
  }

  :focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
  }

  button,
  input,
  select,
  summary {
    border-radius: var(--radius-sm);
  }

  button {
    cursor: pointer;
  }

  button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
  }

  h1,
  h2,
  h3 {
    color: var(--ink);
    line-height: 1.08;
    text-wrap: balance;
  }

  h1 {
    font-size: clamp(2.25rem, 5vw, 4.35rem);
    letter-spacing: -0.055em;
  }

  h2 {
    font-size: clamp(1.8rem, 3vw, 3rem);
    letter-spacing: -0.04em;
  }

  h3 {
    font-size: 1.08rem;
    letter-spacing: -0.015em;
  }

  p {
    color: var(--ink-soft);
  }

  strong,
  b {
    color: inherit;
  }

  code,
  kbd,
  samp,
  .numeric {
    font-family: var(--font-mono);
  }
}

@layer components {
  .skip-link {
    position: fixed;
    z-index: 1000;
    top: 10px;
    left: 10px;
    padding: 10px 14px;
    transform: translateY(-150%);
    border-radius: var(--radius-sm);
    background: var(--laser);
    color: var(--laser-ink);
    font-weight: 750;
    text-decoration: none;
  }

  .skip-link:focus {
    transform: translateY(0);
  }

  .site-header {
    position: sticky;
    z-index: 100;
    top: 0;
    height: var(--header-height);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
    background: color-mix(in srgb, var(--paper) 94%, transparent);
  }

  .header-inner {
    display: flex;
    width: min(calc(100% - 40px), 1280px);
    height: 100%;
    margin-inline: auto;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }

  .brand {
    display: inline-flex;
    min-height: 44px;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2.15;
  }

  .brand-copy {
    display: grid;
    line-height: 1.05;
  }

  .brand-copy strong {
    font-size: 0.95rem;
    letter-spacing: -0.02em;
  }

  .brand-copy span {
    color: var(--ink-soft);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .header-nav > a,
  .header-action {
    display: inline-flex;
    min-height: 44px;
    padding: 9px 12px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    font-size: 0.88rem;
    font-weight: 680;
    text-decoration: none;
  }

  .header-nav > a:hover,
  .header-action:hover {
    background: var(--paper-quiet);
    color: var(--ink);
  }

  .header-action svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
  }

  .print-header {
    margin-left: 4px;
    background: var(--ink);
    color: var(--paper-raised);
  }

  .print-header:hover {
    background: var(--laser);
    color: var(--laser-ink);
  }

  .eyebrow,
  .micro-label {
    font-weight: 780;
    letter-spacing: 0.105em;
    text-transform: uppercase;
  }

  .eyebrow {
    color: var(--ink-soft);
    font-size: 0.74rem;
  }

  .micro-label {
    color: var(--instrument-muted);
    font-size: 0.66rem;
  }

  .button {
    display: inline-flex;
    min-height: 46px;
    padding: 10px 16px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 760;
    line-height: 1.1;
    text-decoration: none;
    transition: transform 100ms ease, background-color 140ms ease, border-color 140ms ease, color 140ms ease;
  }

  .button:active:not(:disabled) {
    transform: translateY(1px);
  }

  .button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }

  .button-primary {
    background: var(--laser);
    color: var(--laser-ink);
  }

  .button-primary:hover {
    background: #e2ff78;
  }

  .button-secondary {
    border-color: var(--line-strong);
    background: var(--paper-raised);
    color: var(--ink);
  }

  .button-secondary:hover {
    border-color: var(--ink);
  }

  .button-quiet {
    border-color: transparent;
    background: var(--paper-quiet);
    color: var(--ink);
  }

  .button-quiet:hover {
    background: var(--line);
  }

  .button-danger-quiet {
    border-color: transparent;
    background: var(--danger-soft);
    color: var(--danger);
  }

  .button-instrument {
    border-color: var(--instrument-line);
    background: var(--instrument-soft);
    color: var(--instrument-text);
  }

  .button-instrument:hover {
    border-color: var(--laser);
    color: var(--laser);
  }

  .icon-button {
    display: inline-grid;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--instrument-line);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--instrument-muted);
  }

  .icon-button:hover {
    border-color: var(--laser);
    color: var(--laser);
  }

  .icon-button svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
  }

  .segmented-control {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--instrument-line);
    border-radius: 10px;
    background: var(--instrument-raised);
  }

  .segmented-control button {
    min-height: 40px;
    padding: 6px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--instrument-muted);
    font-size: 0.78rem;
    font-weight: 760;
  }

  .segmented-control button[aria-pressed="true"] {
    background: var(--laser);
    color: var(--laser-ink);
  }

  .segmented-subtle button[aria-pressed="true"] {
    background: var(--instrument-text);
    color: var(--instrument);
  }

  .text-button,
  .source-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: inherit;
    font-weight: 760;
    text-underline-offset: 4px;
  }

  .source-link svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }

  .field-message {
    margin-top: 9px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
  }

  .field-message[data-type="error"] {
    background: var(--danger-soft);
    color: var(--danger);
  }

  .field-message[data-type="choice"] {
    background: rgba(215, 255, 69, 0.12);
    color: var(--instrument-text);
  }

  .choice-list {
    display: grid;
    margin-top: 9px;
    gap: 8px;
  }

  .choice-button {
    display: grid;
    min-height: 50px;
    padding: 10px 12px;
    justify-items: start;
    border: 1px solid var(--instrument-line);
    border-radius: var(--radius-sm);
    background: var(--instrument-raised);
    color: var(--instrument-text);
    text-align: left;
  }

  .choice-button:hover {
    border-color: var(--laser);
  }

  .choice-button strong {
    font-family: var(--font-mono);
  }

  .choice-button span {
    color: var(--instrument-muted);
    font-size: 0.78rem;
  }

  .toast {
    position: fixed;
    z-index: 1000;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    max-width: min(360px, calc(100vw - 36px));
    padding: 11px 15px;
    transform: translateY(18px);
    border: 1px solid var(--instrument-line);
    border-radius: var(--radius-sm);
    background: var(--instrument);
    color: var(--instrument-text);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    font-size: 0.88rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 140ms ease, transform 140ms ease;
  }

  .toast.is-visible {
    transform: translateY(0);
    opacity: 1;
  }
}

@layer sections {
  .hero,
  .content-section,
  .site-footer {
    width: min(calc(100% - 48px), var(--content-width));
    margin-inline: auto;
  }

  .hero {
    padding-block: clamp(34px, 5vw, 64px) 70px;
  }

  .hero-copy {
    display: grid;
    max-width: 940px;
    margin-bottom: 30px;
    gap: 12px;
  }

  .hero-copy h1 {
    max-width: 920px;
  }

  .hero-copy > p:last-child {
    max-width: 720px;
    font-size: clamp(1rem, 1.6vw, 1.2rem);
  }

  .instrument {
    display: grid;
    grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
    overflow: clip;
    border: 1px solid #2d3129;
    border-radius: var(--radius-lg);
    background: var(--instrument);
    box-shadow: var(--shadow-bench);
    color: var(--instrument-text);
  }

  .instrument h2,
  .instrument h3,
  .instrument strong,
  .instrument label {
    color: var(--instrument-text);
  }

  .instrument-controls {
    min-width: 0;
    padding: clamp(24px, 4vw, 42px);
    border-right: 1px solid var(--instrument-line);
  }

  .size-form > label,
  .compare-form > label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.83rem;
    font-weight: 720;
  }

  .input-row,
  .compact-input-row {
    display: flex;
    gap: 9px;
  }

  .input-frame {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
  }

  .input-frame svg {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 22px;
    height: 22px;
    transform: translateY(-50%);
    fill: none;
    stroke: var(--instrument-muted);
    stroke-linecap: round;
    stroke-width: 1.6;
    pointer-events: none;
  }

  .input-frame input,
  .compact-input-row input {
    width: 100%;
    border: 1px solid var(--instrument-line);
    background: #0f110e;
    color: var(--instrument-text);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
  }

  .input-frame input {
    height: 54px;
    padding: 10px 15px 10px 46px;
    font-size: clamp(1.05rem, 2vw, 1.35rem);
  }

  .compact-input-row input {
    min-width: 0;
    height: 46px;
    padding: 9px 12px;
  }

  .input-frame input::placeholder,
  .compact-input-row input::placeholder {
    color: #6f7468;
  }

  .input-frame input:focus,
  .compact-input-row input:focus {
    border-color: var(--laser);
    outline: 2px solid var(--laser);
    outline-offset: 1px;
  }

  .input-frame input[aria-invalid="true"],
  .compact-input-row input[aria-invalid="true"] {
    border-color: #ff978c;
  }

  .field-help {
    margin-top: 8px;
    color: var(--instrument-muted);
    font-size: 0.76rem;
  }

  .quick-size-wrap {
    margin-top: 22px;
  }

  .quick-size-rail {
    display: flex;
    overflow-x: auto;
    margin-top: 8px;
    padding: 2px 2px 7px;
    gap: 7px;
    scrollbar-width: thin;
    scrollbar-color: var(--instrument-line) transparent;
  }

  .quick-size {
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
    padding: 7px 11px;
    border: 1px solid var(--instrument-line);
    border-radius: 999px;
    background: transparent;
    color: var(--instrument-muted);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 700;
  }

  .quick-size:hover,
  .quick-size:focus-visible {
    border-color: var(--laser);
    color: var(--laser);
  }

  .measurement-result {
    margin-top: 25px;
    padding-top: 22px;
    border-top: 1px solid var(--instrument-line);
  }

  .result-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
  }

  .result-heading h2 {
    margin-top: 3px;
    color: var(--laser);
    font-family: var(--font-mono);
    font-size: clamp(2.5rem, 5vw, 4.3rem);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.08em;
    line-height: 0.95;
  }

  .result-actions {
    display: flex;
    gap: 7px;
  }

  .readout-grid {
    display: grid;
    margin-top: 22px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 22px;
  }

  .readout {
    min-width: 0;
    padding-block: 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--instrument-line) 72%, transparent);
  }

  .readout-primary {
    grid-column: 1 / -1;
    padding-top: 0;
  }

  .readout dt,
  .comparison-grid dt {
    color: var(--instrument-muted);
    font-size: 0.68rem;
    font-weight: 740;
    letter-spacing: 0.07em;
    text-transform: uppercase;
  }

  .readout dd,
  .comparison-grid dd {
    overflow-wrap: anywhere;
    color: var(--instrument-text);
    font-family: var(--font-mono);
    font-size: 0.94rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.35;
  }

  .readout-primary dd {
    color: var(--laser);
    font-size: clamp(1.25rem, 3vw, 1.8rem);
  }

  .result-note {
    margin-top: 14px;
    padding: 11px 13px;
    border-left: 3px solid var(--instrument-line);
    background: var(--instrument-raised);
    color: var(--instrument-muted);
    font-size: 0.82rem;
  }

  .result-note.is-warning {
    border-left-color: #ffb573;
    color: #f3d2b5;
  }

  .result-neighbors {
    margin-top: 10px;
    color: var(--instrument-muted);
    font-size: 0.75rem;
  }

  .compare-toggle {
    display: flex;
    width: 100%;
    min-height: 48px;
    margin-top: 20px;
    padding: 10px 0;
    align-items: center;
    justify-content: space-between;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--instrument-text);
    font-weight: 750;
    text-align: left;
  }

  .compare-toggle > span {
    display: inline-flex;
    align-items: center;
    gap: 9px;
  }

  .compare-toggle svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
  }

  .compare-toggle .chevron {
    width: 18px;
    transition: transform 140ms ease;
  }

  .compare-toggle[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
  }

  .compare-panel {
    padding: 16px;
    border: 1px solid var(--instrument-line);
    border-radius: var(--radius-md);
    background: var(--instrument-raised);
  }

  .compare-form .field-message[data-type="choice"] {
    background: rgba(215, 255, 69, 0.08);
  }

  .compare-identification {
    display: flex;
    margin-top: 16px;
    padding-top: 13px;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px 12px;
    border-top: 1px solid var(--instrument-line);
  }

  .compare-identification strong {
    margin-right: auto;
    color: var(--laser);
    font-family: var(--font-mono);
    font-size: 1.25rem;
  }

  .compare-identification span {
    color: var(--instrument-muted);
    font-family: var(--font-mono);
    font-size: 0.78rem;
  }

  .comparison-grid {
    display: grid;
    margin-top: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
  }

  .comparison-grid dd {
    color: var(--laser);
    font-size: 1.02rem;
  }

  .compare-panel > p {
    margin-top: 13px;
    color: var(--instrument-muted);
    font-size: 0.78rem;
  }

  .visualizer {
    display: flex;
    min-width: 0;
    padding: clamp(24px, 4vw, 42px);
    flex-direction: column;
  }

  .visualizer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
  }

  .visualizer-header h2 {
    margin-top: 4px;
    color: var(--instrument-text);
    font-size: clamp(1.45rem, 2.5vw, 2.1rem);
  }

  .visualizer-scroll {
    position: relative;
    overflow: auto;
    height: clamp(330px, 43vw, 470px);
    min-height: 330px;
    margin-top: 20px;
    border: 1px solid var(--instrument-line);
    border-radius: var(--radius-md);
    background-color: #10120f;
    background-image:
      linear-gradient(rgba(215, 255, 69, 0.035) 1px, transparent 1px),
      linear-gradient(90deg, rgba(215, 255, 69, 0.035) 1px, transparent 1px),
      linear-gradient(rgba(215, 255, 69, 0.07) 1px, transparent 1px),
      linear-gradient(90deg, rgba(215, 255, 69, 0.07) 1px, transparent 1px);
    background-position: center;
    background-size: 10px 10px, 10px 10px, 50px 50px, 50px 50px;
    overscroll-behavior: contain;
    scrollbar-color: var(--instrument-line) #10120f;
  }

  .visualizer-scroll::after {
    position: sticky;
    right: 10px;
    bottom: 8px;
    display: none;
    width: max-content;
    margin-left: auto;
    padding: 4px 7px;
    border-radius: 5px;
    background: rgba(15, 17, 14, 0.88);
    color: var(--instrument-muted);
    content: "scroll to inspect";
    font-size: 0.66rem;
  }

  .visualizer-scroll.can-scroll::after {
    display: block;
  }

  .stage-canvas {
    position: relative;
    min-width: 100%;
    min-height: 100%;
    transition: width 140ms ease, height 140ms ease;
  }

  .crosshair {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    background: rgba(168, 171, 159, 0.22);
    pointer-events: none;
  }

  .crosshair-horizontal {
    width: min(180px, 52%);
    height: 1px;
    transform: translate(-50%, -0.5px);
  }

  .crosshair-vertical {
    width: 1px;
    height: min(180px, 52%);
    transform: translate(-0.5px, -50%);
  }

  .gauge-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: var(--ring-diameter, 160px);
    height: var(--ring-diameter, 160px);
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    border-radius: 50%;
    transition: width 140ms linear, height 140ms linear, border-width 140ms linear, background-color 140ms ease;
  }

  .gauge-ring[data-style="tunnel"] {
    border: var(--ring-rim, 8px) solid var(--laser);
    background: radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.22), transparent 42%);
    box-shadow:
      inset 0 0 0 1px rgba(0, 0, 0, 0.48),
      0 0 0 1px rgba(215, 255, 69, 0.25);
  }

  .gauge-ring[data-style="plug"] {
    border: max(1px, calc(var(--ring-rim, 8px) * 0.18)) solid color-mix(in srgb, var(--laser) 76%, white);
    background:
      radial-gradient(circle at 35% 27%, rgba(255, 255, 255, 0.27), transparent 23%),
      radial-gradient(circle at 56% 64%, color-mix(in srgb, var(--laser) 68%, #6f7f22), var(--laser));
    box-shadow: inset -8px -10px 18px rgba(0, 0, 0, 0.2);
  }

  .gauge-ring-comparison[data-style="tunnel"] {
    border-color: #e6e8df;
    border-style: dashed;
    background: transparent;
    box-shadow: none;
  }

  .gauge-ring-comparison[data-style="plug"] {
    border-style: dashed;
    border-color: #e6e8df;
    background: rgba(230, 232, 223, 0.13);
    box-shadow: none;
  }

  .stage-meta {
    display: grid;
    margin-top: 11px;
    gap: 8px;
  }

  .scale-chip {
    width: max-content;
    max-width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--instrument-line);
    border-radius: 999px;
    color: var(--instrument-muted);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    overflow-wrap: anywhere;
  }

  .ring-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 18px;
    color: var(--instrument-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
  }

  .ring-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
  }

  .legend-line {
    display: inline-block;
    width: 18px;
    height: 0;
    border-top: 2px solid var(--laser);
  }

  .legend-comparison {
    border-top-color: #e6e8df;
    border-top-style: dashed;
  }

  .visual-controls {
    display: flex;
    margin-top: 19px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }

  .calibration-strip {
    display: grid;
    margin-top: 17px;
    padding-top: 16px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    border-top: 1px solid var(--instrument-line);
  }

  .calibration-status-mark {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ffb573;
    box-shadow: 0 0 0 4px rgba(255, 181, 115, 0.12);
  }

  .calibration-strip:has(#calibrationStatus[data-mode="calibrated"]) .calibration-status-mark {
    background: var(--laser);
    box-shadow: 0 0 0 4px var(--laser-soft);
  }

  .calibration-strip p {
    color: var(--instrument-muted);
    font-size: 0.75rem;
    line-height: 1.35;
  }

  .calibration-strip .text-button {
    min-height: 44px;
    padding-block: 8px;
    color: var(--instrument-text);
    font-size: 0.75rem;
    white-space: nowrap;
  }

  .instrument-trust {
    display: grid;
    padding: 13px clamp(24px, 4vw, 42px);
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    border-top: 1px solid var(--instrument-line);
    background: #10120f;
  }

  .instrument-trust span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--instrument-muted);
    font-size: 0.72rem;
    text-align: center;
  }

  .instrument-trust svg {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--laser);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.6;
  }

  .noscript-note {
    margin-top: 16px;
    padding: 12px 15px;
    border-left: 3px solid var(--warning);
    background: var(--warning-soft);
    color: var(--warning);
  }

  .content-section {
    padding-block: clamp(68px, 9vw, 116px);
    border-top: 1px solid var(--line);
  }

  .section-heading {
    max-width: 790px;
  }

  .section-heading .eyebrow {
    margin-bottom: 12px;
  }

  .section-heading > p:not(.eyebrow, .review-stamp),
  .section-heading > div > p:not(.eyebrow) {
    max-width: 730px;
    margin-top: 17px;
    font-size: 1.02rem;
  }

  .split-heading {
    display: flex;
    max-width: none;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
  }

  .split-heading > div:first-child {
    max-width: 770px;
  }

  .print-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 9px;
  }

  .chart-toolbar {
    display: grid;
    margin-top: 36px;
    padding: 18px;
    grid-template-columns: minmax(220px, 1fr) minmax(170px, 220px) auto;
    align-items: end;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--paper-raised);
  }

  .search-field,
  .select-field {
    display: grid;
    gap: 7px;
    color: var(--ink-soft);
    font-size: 0.75rem;
    font-weight: 730;
  }

  .search-field > div {
    position: relative;
  }

  .search-field svg {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 19px;
    height: 19px;
    transform: translateY(-50%);
    fill: none;
    stroke: var(--ink-faint);
    stroke-linecap: round;
    stroke-width: 1.7;
    pointer-events: none;
  }

  .search-field input,
  .select-field select {
    width: 100%;
    height: 46px;
    border: 1px solid var(--line-strong);
    background: var(--paper);
    color: var(--ink);
  }

  .search-field input {
    padding: 9px 12px 9px 40px;
  }

  .select-field select {
    padding: 9px 34px 9px 12px;
  }

  .match-count {
    padding-bottom: 11px;
    color: var(--ink-faint);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .table-scroll {
    overflow-x: auto;
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--paper-raised);
    scrollbar-color: var(--line-strong) var(--paper-raised);
  }

  .size-chart {
    width: 100%;
    min-width: 960px;
    border-collapse: collapse;
    font-size: 0.84rem;
    font-variant-numeric: tabular-nums;
  }

  .size-chart caption {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .size-chart th,
  .size-chart td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
  }

  .size-chart thead th {
    position: sticky;
    z-index: 2;
    top: 0;
    background: var(--paper-quiet);
    color: var(--ink-soft);
    font-size: 0.68rem;
    letter-spacing: 0.065em;
    text-transform: uppercase;
  }

  .size-chart tbody th {
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.96rem;
  }

  .size-chart tbody td:nth-child(2),
  .size-chart tbody td:nth-child(3),
  .size-chart tbody td:nth-child(4) {
    font-family: var(--font-mono);
  }

  .size-chart tbody tr:last-child th,
  .size-chart tbody tr:last-child td {
    border-bottom: 0;
  }

  .size-chart tbody tr:hover {
    background: color-mix(in srgb, var(--paper-quiet) 72%, transparent);
  }

  .size-chart .attention-row {
    background: color-mix(in srgb, var(--warning-soft) 58%, transparent);
  }

  .size-chart button {
    min-width: 54px;
    min-height: 40px;
    border: 1px solid var(--line-strong);
    background: transparent;
    color: var(--ink);
    font-size: 0.74rem;
    font-weight: 740;
  }

  .size-chart button:hover {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--paper-raised);
  }

  .chart-footnote {
    max-width: 920px;
    margin-top: 17px;
    font-size: 0.86rem;
  }

  .measure-layout {
    display: grid;
    margin-top: 44px;
    grid-template-columns: minmax(0, 0.9fr) minmax(380px, 1.1fr);
    align-items: center;
    gap: clamp(36px, 7vw, 88px);
  }

  .measure-steps {
    display: grid;
    padding: 0;
    list-style: none;
  }

  .measure-steps li {
    display: grid;
    padding-block: 23px;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 17px;
    border-top: 1px solid var(--line);
  }

  .measure-steps li:last-child {
    border-bottom: 1px solid var(--line);
  }

  .step-number {
    color: var(--ink-faint);
    font-family: var(--font-mono);
    font-size: 0.78rem;
  }

  .measure-steps h3 {
    margin-bottom: 7px;
  }

  .measure-steps p {
    font-size: 0.92rem;
  }

  .caliper-figure svg {
    width: 100%;
    border-radius: var(--radius-lg);
  }

  .figure-grid {
    fill: var(--instrument);
  }

  .caliper-body {
    fill: #878c80;
    stroke: #c8ccbf;
    stroke-width: 3;
  }

  .caliper-jaw {
    fill: #b7bbaf;
    stroke: #e2e4dc;
    stroke-width: 3;
  }

  .caliper-screen {
    fill: #11150d;
    stroke: var(--laser);
    stroke-width: 2;
  }

  .caliper-reading,
  .measure-label,
  .flare-label {
    fill: var(--laser);
    font-family: var(--font-mono);
    font-size: 18px;
  }

  .tunnel-drawing {
    fill: none;
    stroke: var(--laser);
    stroke-width: 8;
  }

  .measure-arrow,
  .flare-marker {
    fill: none;
    stroke: #e2e4dc;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
  }

  .flare-label {
    fill: #d2d5ca;
    font-size: 15px;
  }

  .caliper-figure figcaption {
    margin-top: 11px;
    color: var(--ink-faint);
    font-size: 0.78rem;
  }

  .precision-layout {
    display: grid;
    margin-top: 44px;
    grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr);
    gap: clamp(28px, 6vw, 78px);
  }

  .formula-panel {
    align-self: start;
    padding: clamp(24px, 4vw, 38px);
    border-radius: var(--radius-lg);
    background: var(--instrument);
    color: var(--instrument-text);
  }

  .formula-panel .micro-label {
    margin-bottom: 18px;
  }

  .formula {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    color: var(--instrument-text);
    font-family: var(--font-mono);
  }

  .formula span {
    display: grid;
    min-height: 88px;
    place-items: center;
    border: 1px solid var(--instrument-line);
    border-radius: var(--radius-md);
    color: var(--laser);
    font-size: clamp(1.2rem, 3vw, 2.1rem);
  }

  .formula strong {
    color: var(--instrument-muted);
  }

  .formula-panel > p:last-child {
    margin-top: 20px;
    color: var(--instrument-muted);
    font-size: 0.88rem;
  }

  .precision-examples {
    display: grid;
  }

  .precision-examples article {
    padding-block: 22px;
    border-top: 1px solid var(--line);
  }

  .precision-examples article:last-child {
    border-bottom: 1px solid var(--line);
  }

  .example-values {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 9px;
    font-family: var(--font-mono);
  }

  .example-values strong {
    color: var(--ink);
    font-size: clamp(1.15rem, 2vw, 1.45rem);
  }

  .example-values span {
    color: var(--ink-faint);
    font-size: 0.8rem;
  }

  .precision-examples p {
    max-width: 680px;
    margin-top: 9px;
  }

  .geometry-section {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
    align-items: center;
    gap: clamp(40px, 8vw, 100px);
  }

  .geometry-copy .eyebrow {
    margin-bottom: 12px;
  }

  .geometry-copy > p:not(.eyebrow) {
    max-width: 680px;
    margin-top: 18px;
  }

  .safety-inline {
    padding-left: 16px;
    border-left: 3px solid var(--warning);
  }

  .geometry-demo {
    padding: clamp(24px, 4vw, 38px);
    border-radius: var(--radius-lg);
    background: var(--paper-raised);
    box-shadow: var(--shadow-bench);
  }

  .geometry-rings {
    position: relative;
    height: 230px;
  }

  .demo-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
  }

  .demo-ring-large {
    width: 210px;
    height: 210px;
    border: 20px solid var(--ink);
  }

  .demo-ring-small {
    width: 168px;
    height: 168px;
    border: 16px solid var(--laser);
  }

  .geometry-demo dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .geometry-demo dl > div {
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  .geometry-demo dt {
    color: var(--ink-faint);
    font-size: 0.7rem;
    font-weight: 720;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .geometry-demo dd {
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.92rem;
  }

  .geometry-demo .geometry-emphasis dd {
    font-size: 1.45rem;
    font-weight: 760;
  }

  .safety-section {
    display: grid;
    padding-inline: clamp(24px, 5vw, 58px);
    grid-template-columns: 96px minmax(0, 1fr);
    gap: clamp(24px, 5vw, 56px);
    border: 0;
    border-radius: var(--radius-lg);
    background: var(--warning-soft);
  }

  .safety-mark svg {
    width: 80px;
    fill: none;
    stroke: var(--warning);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3.5;
  }

  .safety-section .eyebrow,
  .safety-section h2 {
    color: var(--warning);
  }

  .safety-section h2 {
    max-width: 820px;
    margin-top: 11px;
  }

  .safety-section p {
    max-width: 900px;
    margin-top: 17px;
  }

  .safety-section .source-link {
    margin-top: 22px;
    color: var(--warning);
  }

  .details-list {
    margin-top: 38px;
  }

  .details-list details {
    border-top: 1px solid var(--line);
  }

  .details-list details:last-child {
    border-bottom: 1px solid var(--line);
  }

  .details-list summary {
    position: relative;
    padding: 22px 48px 22px 0;
    color: var(--ink);
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    font-weight: 730;
    list-style: none;
    cursor: pointer;
  }

  .details-list summary::-webkit-details-marker {
    display: none;
  }

  .details-list summary::before,
  .details-list summary::after {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 16px;
    height: 2px;
    background: var(--ink);
    content: "";
    transition: transform 140ms ease;
  }

  .details-list summary::after {
    transform: rotate(90deg);
  }

  .details-list details[open] summary::after {
    transform: rotate(0deg);
  }

  .details-list details > div {
    max-width: 820px;
    padding: 0 48px 22px 0;
  }

  .method-section .review-stamp {
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: 0.72rem;
  }

  .method-grid {
    display: grid;
    margin-top: 40px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(32px, 7vw, 90px);
  }

  .method-grid > div {
    padding-block: 22px;
    border-top: 1px solid var(--line);
  }

  .method-grid p {
    margin-top: 9px;
  }

  .sources-block {
    margin-top: 42px;
    padding: clamp(24px, 4vw, 38px);
    border-radius: var(--radius-lg);
    background: var(--paper-raised);
  }

  .sources-block ul {
    display: grid;
    margin-top: 18px;
    padding: 0;
    list-style: none;
  }

  .sources-block li {
    display: grid;
    padding-block: 13px;
    grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.15fr);
    gap: 20px;
    border-top: 1px solid var(--line);
  }

  .sources-block li:last-child {
    border-bottom: 1px solid var(--line);
  }

  .sources-block a {
    color: var(--ink);
    font-weight: 720;
    text-underline-offset: 3px;
  }

  .sources-block li span {
    color: var(--ink-soft);
    font-size: 0.86rem;
  }

  .sources-block > p {
    margin-top: 17px;
    font-size: 0.82rem;
  }

  .site-footer {
    display: grid;
    padding-block: 50px 34px;
    grid-template-columns: minmax(230px, 1fr) auto;
    gap: 34px;
    border-top: 1px solid var(--line);
  }

  .footer-brand {
    margin-bottom: 14px;
  }

  .site-footer > div > p {
    max-width: 420px;
    font-size: 0.86rem;
  }

  .site-footer nav {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 20px;
  }

  .site-footer nav a {
    color: var(--ink-soft);
    font-size: 0.84rem;
    font-weight: 650;
    text-underline-offset: 4px;
  }

  .copyright {
    grid-column: 1 / -1;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    color: var(--ink-faint);
    font-size: 0.76rem;
  }

  .site-dialog {
    width: min(760px, calc(100% - 32px));
    max-height: min(88vh, 900px);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--paper-raised);
    color: var(--ink);
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.35);
  }

  .site-dialog::backdrop {
    background: rgba(7, 8, 6, 0.74);
  }

  .dialog-shell {
    overflow-y: auto;
    max-height: min(88vh, 900px);
    padding: clamp(22px, 4vw, 36px);
  }

  .dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
  }

  .dialog-header h2 {
    margin-top: 7px;
    font-size: clamp(1.65rem, 4vw, 2.5rem);
  }

  .dialog-close {
    display: grid;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
  }

  .dialog-close:hover {
    border-color: var(--ink);
  }

  .dialog-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 1.8;
  }

  .calibration-dialog .dialog-shell > p {
    max-width: 640px;
    margin-top: 16px;
  }

  .calibration-workbench {
    margin-top: 25px;
    padding: 20px;
    border-radius: var(--radius-md);
    background: var(--instrument);
    color: var(--instrument-text);
  }

  .calibration-card-wrap {
    display: grid;
    overflow-x: auto;
    min-height: 245px;
    place-items: center;
  }

  .calibration-card {
    position: relative;
    display: grid;
    width: 324px;
    max-width: none;
    aspect-ratio: 85.6 / 53.98;
    padding: 18px;
    align-content: end;
    border: 2px solid var(--laser);
    border-radius: 14px;
    background:
      linear-gradient(135deg, rgba(215, 255, 69, 0.09), transparent 55%),
      #20241c;
    color: var(--laser);
    box-shadow: inset 0 0 0 1px rgba(215, 255, 69, 0.16);
    font-family: var(--font-mono);
  }

  .calibration-card::after {
    position: absolute;
    inset: 8px;
    border: 1px dashed rgba(215, 255, 69, 0.3);
    border-radius: 9px;
    content: "";
    pointer-events: none;
  }

  .calibration-card > span {
    position: relative;
    z-index: 1;
    font-weight: 760;
  }

  .calibration-card > small {
    position: relative;
    z-index: 1;
    color: var(--instrument-muted);
    font-size: 0.68rem;
  }

  .card-chip {
    position: absolute;
    z-index: 1;
    top: 24%;
    left: 10%;
    width: 15%;
    aspect-ratio: 1.2;
    border: 1px solid var(--laser);
    border-radius: 5px;
    opacity: 0.6;
  }

  .range-field {
    display: grid;
    margin-top: 18px;
    gap: 8px;
    color: var(--instrument-text);
    font-size: 0.78rem;
    font-weight: 700;
  }

  .range-field input {
    width: 100%;
    accent-color: var(--laser);
  }

  .calibration-fine-controls {
    display: grid;
    margin-top: 10px;
    grid-template-columns: auto minmax(130px, 1fr) auto;
    align-items: center;
    gap: 9px;
  }

  .calibration-fine-controls button {
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--instrument-line);
    background: var(--instrument-raised);
    color: var(--instrument-text);
  }

  .calibration-fine-controls output,
  .scale-output {
    color: var(--instrument-muted);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    text-align: center;
  }

  .scale-output {
    display: block;
    margin-top: 8px;
  }

  .calibration-help {
    display: grid;
    margin-top: 18px;
    gap: 8px;
  }

  .calibration-help p {
    font-size: 0.82rem;
  }

  .dialog-actions {
    display: flex;
    margin-top: 26px;
    padding-top: 20px;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    border-top: 1px solid var(--line);
  }

  .split-actions {
    justify-content: space-between;
  }

  .split-actions > div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .terms-dialog {
    width: min(840px, calc(100% - 32px));
  }

  .legal-shell {
    padding-top: 0;
  }

  .sticky-dialog-header {
    position: sticky;
    z-index: 2;
    top: 0;
    margin-inline: calc(clamp(22px, 4vw, 36px) * -1);
    padding: clamp(22px, 4vw, 36px);
    border-bottom: 1px solid var(--line);
    background: var(--paper-raised);
  }

  .legal-content {
    max-width: 700px;
    margin-inline: auto;
    padding-top: 20px;
  }

  .legal-updated {
    font-family: var(--font-mono);
    font-size: 0.76rem;
  }

  .legal-content section {
    padding-block: 20px;
    border-top: 1px solid var(--line);
  }

  .legal-content section:first-of-type {
    margin-top: 18px;
  }

  .legal-content section p {
    margin-top: 8px;
  }

  .legal-actions {
    position: sticky;
    bottom: 0;
    margin-inline: calc(clamp(22px, 4vw, 36px) * -1);
    padding-inline: clamp(22px, 4vw, 36px);
    background: var(--paper-raised);
  }

  .error-page {
    display: grid;
    width: min(calc(100% - 32px), 760px);
    min-height: 100vh;
    margin-inline: auto;
    padding-block: 42px;
    align-content: center;
    justify-items: start;
    gap: 17px;
  }

  .error-page .brand {
    margin-bottom: 16px;
  }

  .error-page h1 {
    max-width: 650px;
  }

  .error-page > p:not(.eyebrow) {
    max-width: 610px;
  }

  .error-ring {
    display: grid;
    width: 170px;
    height: 170px;
    margin-bottom: 8px;
    place-items: center;
    border: 24px solid var(--ink);
    border-radius: 50%;
    background: var(--paper);
  }

  .error-ring span {
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 760;
  }

  .print-sheet {
    display: none;
  }
}

@layer utilities {
  .visually-hidden {
    position: absolute !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }
}

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

  .instrument-controls {
    border-right: 0;
    border-bottom: 1px solid var(--instrument-line);
  }

  .visualizer-scroll {
    height: 410px;
  }

  .measure-layout,
  .precision-layout,
  .geometry-section {
    grid-template-columns: minmax(0, 1fr);
  }

  .measure-layout {
    gap: 44px;
  }

  .caliper-figure {
    max-width: 700px;
  }

  .geometry-demo {
    width: min(100%, 600px);
  }
}

@media (max-width: 820px) {
  :root {
    --header-height: 64px;
  }

  .header-nav > a {
    display: none;
  }

  .hero,
  .content-section,
  .site-footer {
    width: min(calc(100% - 32px), var(--content-width));
  }

  .split-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .print-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .chart-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(160px, 0.5fr);
  }

  .match-count {
    grid-column: 1 / -1;
    padding-bottom: 0;
  }

  .safety-section {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .safety-mark svg {
    width: 60px;
  }

  .method-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sources-block li {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .site-footer {
    grid-template-columns: minmax(0, 1fr);
  }

  .site-footer nav {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  html {
    scroll-padding-top: 74px;
  }

  .header-inner {
    width: calc(100% - 24px);
  }

  .brand-copy span {
    display: none;
  }

  .header-action {
    min-width: 42px;
    padding-inline: 10px;
  }

  .theme-toggle span,
  .print-header span {
    display: none;
  }

  .hero {
    padding-block: 28px 54px;
  }

  .hero-copy {
    margin-bottom: 22px;
  }

  .hero-copy h1 {
    font-size: clamp(2.12rem, 11vw, 3.2rem);
  }

  .instrument {
    margin-inline: -4px;
    border-radius: 16px;
  }

  .instrument-controls,
  .visualizer {
    padding: 22px 18px;
  }

  .input-row {
    align-items: stretch;
    flex-direction: column;
  }

  .input-row .button {
    width: 100%;
  }

  .readout-grid {
    column-gap: 14px;
  }

  .readout dd {
    font-size: 0.82rem;
  }

  .result-heading h2 {
    font-size: 3rem;
  }

  .compare-panel {
    padding: 14px;
  }

  .compact-input-row {
    flex-direction: column;
  }

  .comparison-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .visualizer-header {
    align-items: stretch;
    flex-direction: column;
  }

  .visualizer-header .segmented-control {
    align-self: flex-start;
  }

  .visualizer-scroll {
    height: 330px;
    min-height: 330px;
  }

  .visual-controls,
  .calibration-strip {
    align-items: flex-start;
  }

  .visual-controls {
    flex-direction: column;
  }

  .calibration-strip {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .calibration-strip .text-button {
    grid-column: 2;
  }

  .instrument-trust {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .instrument-trust span {
    justify-content: flex-start;
  }

  .content-section {
    padding-block: 64px;
  }

  .chart-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .match-count {
    grid-column: auto;
  }

  .print-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .print-actions .button {
    width: 100%;
  }

  .measure-steps li {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .formula {
    gap: 8px;
  }

  .formula span {
    min-height: 70px;
    font-size: 1.1rem;
  }

  .geometry-rings {
    height: 190px;
  }

  .demo-ring-large {
    width: 172px;
    height: 172px;
    border-width: 17px;
  }

  .demo-ring-small {
    width: 138px;
    height: 138px;
    border-width: 14px;
  }

  .safety-section {
    padding-block: 42px;
    grid-template-columns: minmax(0, 1fr);
  }

  .safety-mark {
    display: none;
  }

  .details-list summary {
    padding-right: 38px;
  }

  .site-dialog {
    width: calc(100% - 16px);
    max-height: 94vh;
  }

  .dialog-shell {
    max-height: 94vh;
    padding: 20px 16px;
  }

  .calibration-workbench {
    margin-inline: -6px;
    padding: 14px;
  }

  .calibration-card-wrap {
    min-height: 225px;
  }

  .split-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .split-actions > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-actions > div:last-child .button-primary {
    grid-column: 1 / -1;
  }

  .sticky-dialog-header,
  .legal-actions {
    margin-inline: -16px;
    padding-inline: 16px;
  }
}

@media (max-width: 390px) {
  .hero,
  .content-section,
  .site-footer {
    width: calc(100% - 24px);
  }

  .readout-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .readout-primary {
    grid-column: auto;
  }

  .geometry-demo dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .calibration-fine-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calibration-fine-controls output {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .instrument,
  .visualizer-scroll,
  .calibration-workbench,
  .formula-panel {
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
    forced-color-adjust: none;
  }

  .gauge-ring,
  .demo-ring {
    background: transparent !important;
    box-shadow: none !important;
  }

  .gauge-ring-primary,
  .demo-ring-small {
    border-color: Highlight !important;
  }

  .gauge-ring-comparison,
  .demo-ring-large {
    border-color: CanvasText !important;
  }
}

/* Visual Fitting Board v2 — pictorial on-ear and jewelry-first hero. */
.hero {
  width: min(calc(100% - 40px), 1320px);
  padding-top: clamp(30px, 4vw, 52px);
}

.hero-copy {
  max-width: 1040px;
  margin-bottom: 24px;
}

.hero-copy h1 {
  max-width: 1040px;
  font-size: clamp(2.35rem, 4.7vw, 4.7rem);
}

.hero-copy > p:last-child {
  max-width: 800px;
}

.visual-fitting-board {
  --instrument: #dff1ec;
  --instrument-raised: #fffaf2;
  --instrument-soft: #edf8f4;
  --instrument-line: #a8cbc1;
  --instrument-text: #15332d;
  --instrument-muted: #59756d;
  --laser: #0b8f75;
  --laser-soft: rgba(11, 143, 117, 0.14);
  --laser-ink: #ffffff;
  display: grid;
  grid-template-columns: minmax(360px, 0.78fr) minmax(0, 1.22fr);
  overflow: hidden;
  border-color: #9fc7bc;
  background: #dff1ec;
  box-shadow: 0 28px 80px rgba(35, 85, 74, 0.16);
  color: var(--instrument-text);
}

.visual-fitting-board .instrument-controls {
  padding: clamp(26px, 3.4vw, 40px);
  border-right-color: #b6d5cd;
  background:
    radial-gradient(circle at 12% 2%, rgba(255, 255, 255, 0.92), transparent 34%),
    #fffaf2;
}

.visual-fitting-board .visualizer {
  padding: clamp(24px, 3.2vw, 36px);
  background:
    linear-gradient(rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.04)),
    #dff1ec;
}

.visual-fitting-board .input-frame input,
.visual-fitting-board .compact-input-row input {
  border-color: #9fc7bc;
  background: rgba(255, 255, 255, 0.76);
  color: #15332d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.visual-fitting-board .input-frame input::placeholder,
.visual-fitting-board .compact-input-row input::placeholder {
  color: #78928b;
}

.visual-fitting-board .field-help,
.visual-fitting-board .result-neighbors,
.visual-fitting-board .compare-panel > p {
  color: #678078;
}

.visual-fitting-board .quick-size {
  border-color: #a8cbc1;
  background: rgba(255, 255, 255, 0.52);
  color: #4f7168;
}

.visual-fitting-board .quick-size:hover,
.visual-fitting-board .quick-size:focus-visible {
  border-color: #0b8f75;
  background: #ffffff;
  color: #086d5a;
}

.visual-fitting-board .measurement-result {
  border-top-color: #c8ded8;
}

.visual-fitting-board .result-heading h2,
.visual-fitting-board .readout-primary dd,
.visual-fitting-board .comparison-grid dd,
.visual-fitting-board .compare-identification strong {
  color: #0b7d68;
}

.visual-fitting-board .readout {
  border-bottom-color: #d2e5df;
}

.visual-fitting-board .readout dt,
.visual-fitting-board .comparison-grid dt {
  color: #6a827b;
}

.visual-fitting-board .readout dd,
.visual-fitting-board .comparison-grid dd {
  color: #173b33;
}

.visual-fitting-board .result-note {
  border-left-color: #a8cbc1;
  background: rgba(223, 241, 236, 0.72);
  color: #4d6b63;
}

.visual-fitting-board .result-note.is-warning {
  border-left-color: #c96f43;
  background: #fff0e7;
  color: #8d4829;
}

.visual-fitting-board .compare-toggle {
  color: #173b33;
}

.visual-fitting-board .compare-panel {
  border-color: #a8cbc1;
  background: rgba(255, 255, 255, 0.64);
}

.visual-fitting-board .button-instrument {
  border-color: #8fbdb1;
  background: #e5f3ef;
  color: #17463b;
}

.visual-fitting-board .button-instrument:hover {
  border-color: #0b8f75;
  color: #086d5a;
}

.visual-fitting-board .icon-button {
  border-color: #a8cbc1;
  background: rgba(255, 255, 255, 0.5);
  color: #59756d;
}

.visual-fitting-board .choice-button {
  border-color: #9fc7bc;
  background: #f5fbf8;
  color: #15332d;
}

.visual-fitting-board .choice-button span {
  color: #627b74;
}

.visual-fitting-board .field-message[data-type="choice"] {
  background: #d7eee7;
  color: #17463b;
}

.visual-fitting-board .segmented-control {
  border-color: #94bfb4;
  background: rgba(255, 255, 255, 0.58);
}

.visual-fitting-board .segmented-control button {
  color: #57746c;
}

.visual-fitting-board .segmented-control button[aria-pressed="true"] {
  background: #0b8f75;
  color: #ffffff;
}

.visual-fitting-board .segmented-subtle button[aria-pressed="true"] {
  background: #15332d;
  color: #ffffff;
}

.visualizer-header {
  align-items: center;
}

.visualizer-size-badge {
  display: inline-flex;
  min-height: 38px;
  padding: 8px 12px;
  align-items: center;
  border: 1px solid #8fbdb1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #0a6f5c;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wear-scene {
  display: grid;
  margin-top: 16px;
  grid-template-columns: minmax(0, 1.08fr) minmax(220px, 0.92fr);
  gap: 14px;
}

.ear-preview,
.specimen-preview {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 340px;
  padding: 18px 16px 15px;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #a8cbc1;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.9), transparent 46%),
    linear-gradient(145deg, #edf8f4, #cce8e1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 12px 30px rgba(49, 107, 94, 0.09);
}

.specimen-preview {
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.94), transparent 43%),
    linear-gradient(145deg, #f6fbf8, #d4ebe5);
}

.scene-kicker {
  position: absolute;
  z-index: 5;
  top: 12px;
  left: 13px;
  padding: 5px 8px;
  border: 1px solid rgba(98, 143, 132, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #55766d;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.ear-model {
  width: min(100%, 310px);
  height: 274px;
  margin: 10px auto 0;
  overflow: visible;
}

.ear-rim,
.ear-fold,
.ear-concha,
.ear-tragus {
  fill: none;
  stroke: #a95845;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ear-rim {
  stroke-width: 6;
  opacity: 0.58;
}

.ear-fold {
  stroke-width: 5;
  opacity: 0.52;
}

.ear-fold-secondary {
  stroke-width: 4;
  opacity: 0.42;
}

.ear-concha {
  fill: rgba(148, 68, 51, 0.08);
  stroke-width: 5;
  opacity: 0.56;
}

.ear-tragus {
  stroke-width: 5;
  opacity: 0.55;
}

.ear-gauge-halo,
.ear-gauge-outer,
.ear-gauge-inner,
.ear-gauge-compare,
.ear-gauge-glint {
  transform-box: fill-box;
  transform-origin: center;
  transition: r 160ms ease-out, opacity 140ms ease, fill 140ms ease, stroke-width 160ms ease-out;
}

.ear-gauge-halo {
  fill: rgba(11, 143, 117, 0.12);
}

.ear-gauge-outer {
  fill: url(#earMetalGradient);
  stroke: #557d75;
  stroke-width: 2.5;
  filter: drop-shadow(0 5px 5px rgba(40, 76, 68, 0.25));
}

.ear-preview[data-style="plug"] .ear-gauge-outer,
.ear-preview[data-style="taper"] .ear-gauge-outer {
  fill: url(#earPlugGradient);
}

.ear-preview[data-style="taper"] .ear-gauge-outer {
  stroke-width: 3.2;
}

.ear-gauge-inner {
  fill: #153d34;
  stroke: rgba(255, 255, 255, 0.68);
  stroke-width: 2;
}

.ear-gauge-glint {
  fill: rgba(255, 255, 255, 0.88);
  transform: rotate(-22deg);
}

.ear-gauge-compare {
  fill: none;
  stroke: #0b8f75;
  stroke-width: 3;
  stroke-dasharray: 7 6;
  opacity: 0.82;
}

.ear-preview figcaption,
.specimen-preview figcaption {
  display: grid;
  min-width: 0;
  padding-top: 10px;
  gap: 2px;
  border-top: 1px solid rgba(111, 154, 144, 0.34);
}

.ear-preview figcaption strong,
.specimen-preview figcaption strong {
  overflow-wrap: anywhere;
  color: #15332d;
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.ear-preview figcaption span,
.specimen-preview figcaption span {
  color: #607a73;
  font-size: 0.68rem;
  line-height: 1.35;
}

.specimen-stage {
  position: relative;
  display: grid;
  min-height: 270px;
  place-items: center;
  overflow: hidden;
}

.specimen-grid {
  position: absolute;
  inset: 16px 8px 26px;
  border-radius: 14px;
  background-image:
    linear-gradient(rgba(39, 107, 92, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(39, 107, 92, 0.055) 1px, transparent 1px);
  background-size: 16px 16px;
}

.jewelry-specimen {
  --specimen-diameter: 90px;
  position: relative;
  z-index: 2;
  width: 150px;
  height: 220px;
}

.specimen-object {
  position: absolute;
  inset: 0;
  display: none;
}

.jewelry-specimen[data-style="tunnel"] .specimen-tunnel,
.jewelry-specimen[data-style="plug"] .specimen-plug,
.jewelry-specimen[data-style="taper"] .specimen-taper {
  display: block;
}

.specimen-flare,
.specimen-barrel,
.specimen-channel,
.specimen-plug-cap,
.specimen-plug-body,
.specimen-o-ring,
.specimen-plug-foot,
.specimen-taper-body,
.specimen-taper-foot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  transition: width 160ms ease-out, border-radius 160ms ease-out;
}

.specimen-tunnel .specimen-barrel {
  bottom: 54px;
  width: var(--specimen-diameter);
  height: 116px;
  border: 1px solid rgba(86, 123, 118, 0.48);
  border-radius: 28px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.94), rgba(187, 216, 212, 0.52) 30%, rgba(105, 145, 139, 0.42) 66%, rgba(255, 255, 255, 0.9)),
    rgba(224, 242, 238, 0.68);
  box-shadow:
    inset 8px 0 10px rgba(255, 255, 255, 0.64),
    inset -9px 0 10px rgba(75, 110, 104, 0.18),
    0 11px 18px rgba(35, 77, 68, 0.16);
}

.specimen-tunnel .specimen-flare {
  z-index: 3;
  width: calc(var(--specimen-diameter) + 18px);
  height: 20px;
  border: 1px solid rgba(71, 111, 104, 0.5);
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #a9c7c3 54%, #f8fffd);
  box-shadow: 0 4px 8px rgba(48, 85, 78, 0.16);
}

.specimen-flare-top {
  top: 43px;
}

.specimen-flare-bottom {
  bottom: 45px;
}

.specimen-channel {
  z-index: 4;
  top: 58px;
  width: max(8px, calc(var(--specimen-diameter) - 23px));
  height: 107px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #365f57, #193f36 42%, #6c948c 75%, #244d44);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.34);
}

.specimen-plug-cap {
  top: 32px;
  width: calc(var(--specimen-diameter) + 10px);
  height: 44px;
  border: 1px solid rgba(92, 131, 124, 0.45);
  border-radius: 60% 60% 42% 42%;
  background:
    radial-gradient(circle at 35% 22%, rgba(255, 255, 255, 0.98), transparent 30%),
    linear-gradient(90deg, #f9fffe, #bad5d2 45%, #789b96 78%, #f8fffd);
  box-shadow: 0 8px 12px rgba(40, 78, 70, 0.16);
}

.specimen-plug-body {
  top: 62px;
  width: var(--specimen-diameter);
  height: 116px;
  border: 1px solid rgba(92, 131, 124, 0.4);
  border-radius: 16px 16px 12px 12px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.94), rgba(205, 228, 224, 0.6) 34%, rgba(104, 145, 138, 0.52) 72%, rgba(248, 255, 253, 0.92));
  box-shadow:
    inset 8px 0 12px rgba(255, 255, 255, 0.64),
    inset -9px 0 12px rgba(63, 104, 96, 0.18),
    0 13px 19px rgba(35, 77, 68, 0.14);
}

.specimen-o-ring {
  z-index: 5;
  top: 74px;
  width: calc(var(--specimen-diameter) + 13px);
  height: 8px;
  border-radius: 999px;
  background: #273431;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.26);
}

.specimen-plug-foot,
.specimen-taper-foot {
  bottom: 34px;
  width: calc(var(--specimen-diameter) + 12px);
  height: 20px;
  border: 1px solid rgba(72, 111, 104, 0.46);
  border-radius: 50%;
  background: linear-gradient(180deg, #f8fffd, #9bbcb7 55%, #ffffff);
}

.specimen-taper-body {
  top: 25px;
  width: var(--specimen-diameter);
  height: 166px;
  clip-path: polygon(46% 0, 54% 0, 63% 16%, 100% 91%, 88% 100%, 12% 100%, 0 91%, 37% 16%);
  background:
    linear-gradient(90deg, #ffffff 4%, #d5e9e6 31%, #759c96 64%, #fafffe 94%);
  filter: drop-shadow(0 12px 10px rgba(38, 76, 68, 0.2));
}

.specimen-o-ring-taper {
  top: auto;
  bottom: 48px;
  width: calc(var(--specimen-diameter) + 8px);
}

.specimen-compare-ghost {
  --compare-diameter: 96px;
  position: absolute;
  z-index: 1;
  bottom: 49px;
  left: 50%;
  width: var(--compare-diameter);
  height: 150px;
  transform: translateX(-50%);
  border: 2px dashed rgba(11, 143, 117, 0.68);
  border-radius: 50% 50% 20% 20%;
  background: rgba(11, 143, 117, 0.03);
  transition: width 160ms ease-out;
}

.specimen-dimension {
  --dimension-width: 90px;
  position: absolute;
  z-index: 5;
  right: 50%;
  bottom: 8px;
  display: grid;
  width: min(calc(var(--dimension-width) + 46px), 92%);
  transform: translateX(50%);
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  color: #175c4d;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
}

.specimen-dimension i {
  position: relative;
  display: block;
  height: 1px;
  background: #3f8172;
}

.specimen-dimension i:first-child::before,
.specimen-dimension i:last-child::after {
  position: absolute;
  top: 50%;
  width: 6px;
  height: 6px;
  transform: translateY(-50%) rotate(45deg);
  border: solid #3f8172;
  content: "";
}

.specimen-dimension i:first-child::before {
  left: 0;
  border-width: 0 0 1px 1px;
}

.specimen-dimension i:last-child::after {
  right: 0;
  border-width: 1px 1px 0 0;
}

.diameter-lab {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid #a8cbc1;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.56);
}

.diameter-lab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.diameter-lab-header > div:first-child {
  display: grid;
  gap: 2px;
}

.diameter-lab-header strong {
  color: #15332d;
  font-size: 0.84rem;
}

.diameter-lab .micro-label,
.visual-fitting-board .visual-controls .micro-label,
.visual-journey .micro-label {
  color: #607b73;
}

.visual-fitting-board .visualizer-scroll {
  height: 170px;
  min-height: 160px;
  margin-top: 11px;
  border-color: #a8cbc1;
  background-color: rgba(255, 255, 255, 0.66);
  background-image:
    linear-gradient(rgba(11, 143, 117, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 143, 117, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(11, 143, 117, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 143, 117, 0.09) 1px, transparent 1px);
  background-size: 10px 10px, 10px 10px, 50px 50px, 50px 50px;
  scrollbar-color: #8fbdb1 #eef8f5;
}

.visual-fitting-board .visualizer-scroll::after {
  background: rgba(21, 51, 45, 0.88);
  color: #eef8f5;
}

.visual-fitting-board .crosshair {
  background: rgba(41, 105, 91, 0.22);
}

.gauge-ring[data-style="taper"] {
  border: max(1px, calc(var(--ring-rim, 8px) * 0.22)) solid #5f8a82;
  background:
    radial-gradient(circle at 34% 27%, rgba(255, 255, 255, 0.9), transparent 24%),
    radial-gradient(circle at 58% 68%, #8fb7b0, #e8f6f3 58%, #6c948c);
  box-shadow: inset -7px -8px 15px rgba(45, 80, 73, 0.18);
}

.gauge-ring-comparison[data-style="taper"] {
  border-style: dashed;
  border-color: #55756e;
  background: rgba(11, 143, 117, 0.06);
  box-shadow: none;
}

.visual-fitting-board .scale-chip {
  border-color: #9fc7bc;
  background: rgba(255, 255, 255, 0.46);
  color: #527067;
}

.visual-fitting-board .ring-legend {
  color: #527067;
}

.visual-fitting-board .legend-comparison {
  border-top-color: #527067;
}

.visual-fitting-board .visual-controls {
  margin-top: 14px;
}

.visual-fitting-board .calibration-strip {
  margin-top: 13px;
  padding-top: 13px;
  border-top-color: #abcac2;
}

.visual-fitting-board .calibration-strip p {
  color: #59756d;
}

.visual-fitting-board .calibration-strip .text-button {
  color: #0a725e;
}

.visual-fitting-board .calibration-status-mark {
  background: #c96f43;
  box-shadow: 0 0 0 4px rgba(201, 111, 67, 0.13);
}

.visual-fitting-board .calibration-strip:has(#calibrationStatus[data-mode="calibrated"]) .calibration-status-mark {
  background: #0b8f75;
  box-shadow: 0 0 0 4px rgba(11, 143, 117, 0.13);
}

.visual-journey {
  display: grid;
  padding: 24px clamp(24px, 3.4vw, 42px) 26px;
  grid-column: 1 / -1;
  gap: 16px;
  border-top: 1px solid #a8cbc1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 62%),
    #cce8e1;
}

.journey-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.journey-heading > div {
  max-width: 720px;
}

.journey-heading h2 {
  margin-top: 4px;
  color: #15332d;
  font-size: clamp(1.2rem, 2.2vw, 1.85rem);
  letter-spacing: -0.035em;
}

.journey-heading p:last-child {
  margin-top: 7px;
  color: #58766e;
  font-size: 0.78rem;
}

.journey-current {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid #8fbdb1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: #075f4f;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.journey-controller {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.journey-stepper {
  display: inline-flex;
  min-height: 42px;
  padding: 8px 11px;
  align-items: center;
  gap: 6px;
  border: 1px solid #8fbdb1;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  color: #17463b;
  font-size: 0.74rem;
  font-weight: 780;
}

.journey-stepper:hover:not(:disabled) {
  border-color: #0b8f75;
  background: #ffffff;
  color: #086d5a;
}

.journey-stepper svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.journey-range-label {
  display: flex;
  min-height: 42px;
  padding-inline: 4px;
  align-items: center;
}

#sizeJourneyRange {
  width: 100%;
  height: 44px;
  margin: 0;
  accent-color: #0b8f75;
  cursor: ew-resize;
}

#sizeJourneyRange::-webkit-slider-runnable-track {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0b8f75, #78b8aa);
  box-shadow: inset 0 0 0 1px rgba(13, 89, 73, 0.18);
}

#sizeJourneyRange::-webkit-slider-thumb {
  width: 23px;
  height: 23px;
  margin-top: -8px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  appearance: none;
  background: #0b8f75;
  box-shadow: 0 3px 9px rgba(18, 82, 68, 0.32);
}

#sizeJourneyRange::-moz-range-track {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #0b8f75, #78b8aa);
}

#sizeJourneyRange::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #0b8f75;
  box-shadow: 0 3px 9px rgba(18, 82, 68, 0.32);
}

.visual-size-track {
  display: flex;
  overflow-x: auto;
  padding: 5px 4px 11px;
  gap: 8px;
  scroll-padding-inline: 4px;
  scroll-snap-type: x proximity;
  scrollbar-color: #8fbdb1 transparent;
}

.visual-size-step {
  position: relative;
  display: grid;
  flex: 0 0 88px;
  min-height: 170px;
  padding: 10px 7px 9px;
  grid-template-rows: 64px 48px auto auto;
  align-items: end;
  justify-items: center;
  scroll-snap-align: center;
  border: 1px solid rgba(105, 151, 140, 0.5);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.34);
  color: #244c42;
  transition: transform 130ms ease, border-color 130ms ease, background-color 130ms ease, box-shadow 130ms ease;
}

.visual-size-step:hover,
.visual-size-step:focus-visible {
  border-color: #0b8f75;
  background: rgba(255, 255, 255, 0.72);
}

.visual-size-step.is-active {
  transform: translateY(-4px);
  border-color: #0b8f75;
  background: #fffaf2;
  box-shadow: 0 12px 23px rgba(32, 93, 80, 0.16);
}

.visual-size-step.is-active::before {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0b8f75;
  box-shadow: 0 0 0 4px rgba(11, 143, 117, 0.12);
  content: "";
}

.journey-ear {
  position: relative;
  display: block;
  width: 47px;
  height: 59px;
  align-self: center;
  transform: rotate(-5deg);
  border: 1px solid rgba(153, 81, 62, 0.28);
  border-radius: 58% 45% 47% 56% / 42% 39% 62% 62%;
  background:
    radial-gradient(circle at 32% 24%, #ffe7d8 0 10%, transparent 34%),
    linear-gradient(145deg, #ffd2bb, #df8f70 72%, #ba684f);
  box-shadow: 0 5px 9px rgba(116, 68, 54, 0.16);
}

.journey-ear::before {
  position: absolute;
  top: 10px;
  right: 7px;
  width: 24px;
  height: 34px;
  transform: rotate(7deg);
  border: 2px solid rgba(153, 75, 57, 0.42);
  border-left-color: transparent;
  border-radius: 50%;
  content: "";
}

.journey-ear::after {
  position: absolute;
  right: 10px;
  bottom: 5px;
  width: max(5px, var(--journey-diameter));
  height: max(5px, var(--journey-diameter));
  border: 1px solid #587f77;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 24%, #ffffff, #c6dedb 46%, #6f9891);
  box-shadow: 0 2px 4px rgba(43, 76, 69, 0.26);
  content: "";
}

.journey-ear i {
  position: absolute;
  top: 24px;
  right: 13px;
  width: 14px;
  height: 17px;
  transform: rotate(9deg);
  border: 2px solid rgba(155, 76, 58, 0.34);
  border-left-color: transparent;
  border-radius: 50%;
}

.journey-jewelry {
  position: relative;
  display: block;
  width: max(12px, calc(var(--journey-diameter) + 8px));
  height: 43px;
  align-self: center;
  border: 1px solid rgba(74, 111, 105, 0.42);
  border-radius: 999px 999px 9px 9px;
  background:
    linear-gradient(90deg, #ffffff, #c6ddda 45%, #749b95 75%, #f9fffe);
  box-shadow:
    inset 3px 0 4px rgba(255, 255, 255, 0.7),
    0 5px 8px rgba(43, 78, 70, 0.16);
}

.journey-jewelry::before {
  position: absolute;
  top: -3px;
  left: 50%;
  width: calc(100% + 7px);
  height: 9px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(#ffffff, #94b7b1);
  content: "";
}

.journey-jewelry::after {
  position: absolute;
  top: 10px;
  left: 50%;
  width: calc(100% + 8px);
  height: 5px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #273431;
  content: "";
}

.journey-jewelry i {
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: calc(100% + 8px);
  height: 9px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(#9dbcb7, #ffffff);
}

.visual-size-step strong {
  margin-top: 4px;
  color: #15332d;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1;
}

.visual-size-step small {
  color: #607a73;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  line-height: 1;
}

.visual-fitting-board .instrument-trust {
  border-top-color: #a8cbc1;
  background: #b9ddd4;
}

.visual-fitting-board .instrument-trust span {
  color: #45675e;
}

.visual-fitting-board .instrument-trust svg {
  stroke: #0b7d68;
}

@media (max-width: 1080px) {
  .visual-fitting-board {
    grid-template-columns: minmax(330px, 0.86fr) minmax(0, 1.14fr);
  }

  .wear-scene {
    grid-template-columns: minmax(0, 1fr);
  }

  .ear-preview,
  .specimen-preview {
    min-height: 320px;
  }
}

@media (max-width: 980px) {
  .visual-fitting-board {
    display: flex;
    flex-direction: column;
  }

  .visual-fitting-board .instrument-controls,
  .visual-fitting-board .visualizer {
    display: contents;
  }

  .visual-fitting-board .size-form {
    order: 1;
    padding: 28px clamp(22px, 4vw, 34px) 0;
    background:
      radial-gradient(circle at 12% 2%, rgba(255, 255, 255, 0.92), transparent 42%),
      #fffaf2;
  }

  .visual-fitting-board .quick-size-wrap {
    order: 2;
    margin-top: 0;
    padding: 18px clamp(22px, 4vw, 34px) 24px;
    border-bottom: 1px solid #b6d5cd;
    background: #fffaf2;
  }

  .visual-fitting-board .visual-journey {
    order: 3;
    border-top: 0;
    border-bottom: 1px solid #a8cbc1;
  }

  .visual-fitting-board .visualizer-header {
    order: 4;
    padding: 24px clamp(22px, 4vw, 34px) 0;
  }

  .visual-fitting-board .wear-scene {
    order: 5;
    margin: 16px clamp(22px, 4vw, 34px) 0;
    grid-template-columns: minmax(0, 1.05fr) minmax(230px, 0.95fr);
  }

  .visual-fitting-board .measurement-result {
    order: 6;
    margin-top: 24px;
    padding: 26px clamp(22px, 4vw, 34px) 0;
    border-top: 1px solid #b6d5cd;
    background: #fffaf2;
  }

  .visual-fitting-board .compare-toggle {
    order: 7;
    margin-top: 0;
    padding: 18px clamp(22px, 4vw, 34px);
    background: #fffaf2;
  }

  .visual-fitting-board .compare-panel {
    order: 8;
    margin: 0 clamp(22px, 4vw, 34px) 28px;
  }

  .visual-fitting-board .diameter-lab {
    order: 9;
    margin: 24px clamp(22px, 4vw, 34px) 0;
  }

  .visual-fitting-board .visual-controls {
    order: 10;
    margin: 18px clamp(22px, 4vw, 34px) 0;
  }

  .visual-fitting-board .calibration-strip {
    order: 11;
    margin: 17px clamp(22px, 4vw, 34px) 26px;
  }

  .visual-fitting-board .instrument-trust {
    order: 12;
  }
}

@media (max-width: 720px) {
  .hero {
    width: min(calc(100% - 24px), 1320px);
  }

  .hero-copy h1 {
    font-size: clamp(2.08rem, 10.7vw, 3.35rem);
  }

  .visual-fitting-board .size-form {
    padding: 21px 16px 0;
  }

  .visual-fitting-board .input-row {
    align-items: stretch;
    flex-direction: row;
  }

  .visual-fitting-board .input-row .button {
    width: auto;
    min-width: 88px;
    padding-inline: 12px;
  }

  .visual-fitting-board .quick-size-wrap {
    display: none;
  }

  .visual-fitting-board .visualizer-header {
    padding: 20px 16px 0;
  }

  .visualizer-header {
    align-items: flex-start;
    flex-direction: row;
  }

  .visualizer-size-badge {
    max-width: 45%;
    white-space: normal;
    text-align: right;
  }

  .visual-fitting-board .wear-scene {
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-auto-columns: minmax(270px, 86vw);
    overflow-x: auto;
    margin: 14px 16px 0;
    padding-bottom: 7px;
    scroll-padding-inline: 1px;
    scroll-snap-type: x mandatory;
    scrollbar-color: #8fbdb1 transparent;
  }

  .ear-preview,
  .specimen-preview {
    min-height: 310px;
    scroll-snap-align: start;
  }

  .visual-fitting-board .measurement-result {
    margin-top: 18px;
    padding: 23px 16px 0;
  }

  .visual-fitting-board .compare-toggle {
    padding: 17px 16px;
  }

  .visual-fitting-board .compare-panel {
    margin: 0 16px 22px;
  }

  .visual-fitting-board .diameter-lab {
    margin: 20px 16px 0;
  }

  .visual-fitting-board .visual-controls {
    margin: 17px 16px 0;
  }

  .visual-fitting-board .calibration-strip {
    margin: 16px 16px 22px;
  }

  .ear-model {
    height: 264px;
  }

  .diameter-lab-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .diameter-lab-header .segmented-control {
    align-self: stretch;
  }

  .diameter-lab-header .segmented-control button {
    flex: 1 1 0;
  }

  .visual-fitting-board .visual-controls {
    align-items: stretch;
  }

  .visual-fitting-board .visual-controls .segmented-control {
    width: 100%;
  }

  .visual-fitting-board .visual-controls .segmented-control button {
    flex: 1 1 0;
  }

  .visual-journey {
    padding: 21px 16px 23px;
  }

  .journey-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .journey-current {
    align-self: flex-start;
  }

  .journey-controller {
    grid-template-columns: 42px minmax(120px, 1fr) 42px;
    gap: 7px;
  }

  .journey-stepper {
    width: 42px;
    padding: 0;
    justify-content: center;
  }

  .journey-stepper span {
    display: none;
  }

  .visual-size-step {
    flex-basis: 82px;
    min-height: 165px;
  }
}

@media (max-width: 390px) {
  .visualizer-header {
    flex-direction: column;
  }

  .visualizer-size-badge {
    max-width: 100%;
    text-align: left;
  }

  .ear-preview,
  .specimen-preview {
    min-height: 295px;
    padding-inline: 12px;
  }

  .ear-model {
    height: 230px;
  }

  .specimen-stage {
    min-height: 235px;
  }

  .jewelry-specimen {
    transform: scale(0.9);
  }

  .visual-fitting-board .visualizer-scroll {
    height: 155px;
    min-height: 150px;
  }

  .visual-size-step {
    flex-basis: 78px;
    min-height: 160px;
    padding-inline: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ear-gauge-halo,
  .ear-gauge-outer,
  .ear-gauge-inner,
  .ear-gauge-compare,
  .ear-gauge-glint,
  .specimen-flare,
  .specimen-barrel,
  .specimen-channel,
  .specimen-plug-cap,
  .specimen-plug-body,
  .specimen-o-ring,
  .specimen-plug-foot,
  .specimen-taper-body,
  .specimen-taper-foot,
  .specimen-compare-ghost,
  .visual-size-step {
    transition: none !important;
  }
}

@media (forced-colors: active) {
  .ear-preview,
  .specimen-preview,
  .diameter-lab,
  .visual-journey,
  .visual-size-step {
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
    forced-color-adjust: none;
  }

  .ear-shell,
  .ear-soft-light,
  .ear-gauge-halo,
  .ear-gauge-outer,
  .ear-gauge-inner,
  .journey-ear,
  .journey-jewelry,
  .specimen-object,
  .specimen-grid {
    background: Canvas !important;
    fill: Canvas !important;
    box-shadow: none !important;
    filter: none !important;
  }

  .ear-rim,
  .ear-fold,
  .ear-concha,
  .ear-tragus,
  .ear-gauge-outer,
  .ear-gauge-inner,
  .ear-gauge-compare {
    stroke: CanvasText !important;
  }

  .visual-size-step.is-active,
  .journey-stepper,
  .visualizer-size-badge,
  .journey-current {
    border-color: Highlight !important;
  }
}
