/* ==========================================================================
   HeightCompare — Design System
   Single stylesheet, no framework, tuned for Core Web Vitals.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;

  --bg: #ffffff;
  --bg-soft: #f6f7fb;
  --bg-sunken: #eef0f7;
  --surface: #ffffff;
  --surface-2: #fafbfe;
  --border: #e3e6f0;
  --border-strong: #cdd2e3;

  --text: #0e1122;
  --text-soft: #454b63;
  --text-muted: #6c7290;

  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-ink: #ffffff;
  --brand-soft: #eef0ff;
  --brand-border: #c9cafd;

  --accent: #0ea5a4;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;

  --board-bg: #ffffff;
  --board-grid: #eef0f7;
  --board-base: #c7cbe0;

  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-xs: 0 1px 2px rgba(14, 17, 34, .05);
  --shadow-sm: 0 2px 8px rgba(14, 17, 34, .06), 0 1px 2px rgba(14, 17, 34, .04);
  --shadow-md: 0 10px 28px rgba(14, 17, 34, .09), 0 2px 6px rgba(14, 17, 34, .04);
  --shadow-lg: 0 26px 60px rgba(14, 17, 34, .14);

  --header-h: 62px;
  --container: 1180px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

html[data-theme="dark"] {
  --bg: #0a0c16;
  --bg-soft: #111527;
  --bg-sunken: #0d1020;
  --surface: #141930;
  --surface-2: #181d38;
  --border: #262c4a;
  --border-strong: #363d63;

  --text: #eef0fa;
  --text-soft: #c0c6de;
  --text-muted: #9299b8;

  --brand: #7c7cff;
  --brand-2: #a78bfa;
  --brand-ink: #0a0c16;
  --brand-soft: #1b1f3d;
  --brand-border: #3a3f77;

  --accent: #2dd4bf;

  --board-bg: #0f1428;
  --board-grid: #1c2240;
  --board-base: #495080;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .4);
  --shadow-md: 0 12px 34px rgba(0, 0, 0, .5);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, .6);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 14px); }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { margin: 0 0 .5em; line-height: 1.18; letter-spacing: -.018em; font-weight: 800; }
h1 { font-size: clamp(1.85rem, 4.4vw, 2.9rem); }
h2 { font-size: clamp(1.4rem, 2.9vw, 2.05rem); }
h3 { font-size: clamp(1.12rem, 1.9vw, 1.34rem); font-weight: 750; }
h4 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin-bottom: .4em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--brand); color: var(--brand-ink); padding: .7rem 1.1rem; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ---------- 3. Layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 20px; }
.section { padding: 4.25rem 0; }
.section--tight { padding: 2.75rem 0; }
.section--soft { background: var(--bg-soft); }
.section-head { max-width: 720px; margin-bottom: 2.25rem; }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head p { color: var(--text-soft); font-size: 1.05rem; margin-bottom: 0; }
.eyebrow {
  display: inline-block; font-size: .74rem; font-weight: 750; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brand); margin-bottom: .7rem;
}
.grid { display: grid; gap: 1.15rem; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.stack > * + * { margin-top: 1rem; }

/* ---------- 4. Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 1rem; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 850; font-size: 1.06rem; color: var(--text); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; flex: none; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #fff; font-size: .82rem; font-weight: 850;
  box-shadow: var(--shadow-sm);
}
.brand-sub { font-size: .62rem; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); display: block; margin-top: -3px; }

.nav { display: flex; align-items: center; gap: .15rem; margin-left: auto; }
.nav > a, .nav-btn {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .5rem .72rem; border-radius: var(--radius-sm);
  font-size: .91rem; font-weight: 600; color: var(--text-soft);
  background: none; border: 0; cursor: pointer; white-space: nowrap;
}
.nav > a:hover, .nav-btn:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav > a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
.nav-drop { position: relative; }
.drop-panel {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(-6px);
  min-width: 480px; padding: .75rem; display: grid; grid-template-columns: 1fr 1fr; gap: .15rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transition: .18s var(--ease);
}
.nav-drop[data-open="true"] .drop-panel { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.drop-panel a { padding: .5rem .6rem; border-radius: var(--radius-xs); font-size: .875rem; font-weight: 600; color: var(--text-soft); }
.drop-panel a:hover { background: var(--bg-soft); color: var(--brand); text-decoration: none; }
.drop-panel a small { display: block; font-weight: 500; font-size: .76rem; color: var(--text-muted); }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.theme-toggle {
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-soft);
}
.theme-toggle:hover { color: var(--brand); border-color: var(--brand-border); }
.nav-toggle { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html:not([data-theme="dark"]) .icon-moon { display: none; }

/* ---------- 5. Buttons & chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .62rem 1.05rem; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: .92rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: .16s var(--ease); text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { box-shadow: var(--shadow-md); color: #fff; }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn-sm { padding: .42rem .75rem; font-size: .83rem; }
.btn-xs { padding: .24rem .58rem; font-size: .75rem; border-radius: var(--radius-xs); }
.btn-block { width: 100%; }
.btn-danger-ghost { background: transparent; border-color: var(--border); color: var(--danger); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .34rem .72rem; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border);
  font-size: .8rem; font-weight: 600; color: var(--text-soft); cursor: pointer;
  transition: .14s var(--ease);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand); }
.chip--tag { cursor: default; }
.chip--tag:hover { border-color: var(--border); color: var(--text-soft); }

/* ---------- 6. Hero ---------- */
.hero { padding: 2.1rem 0 .9rem; text-align: center; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40% 30% auto; height: 460px; z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--brand) 20%, transparent), transparent);
  pointer-events: none;
}
.hero h1 { max-width: 820px; margin-inline: auto; font-size: clamp(1.65rem, 3.6vw, 2.3rem); }
.hero .lede { max-width: 630px; margin: 0 auto 1.05rem; font-size: 1rem; color: var(--text-soft); }
.hero-cta { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-bottom: .95rem; }
.trust-row { display: flex; flex-wrap: wrap; gap: .4rem .55rem; justify-content: center; font-size: .78rem; color: var(--text-muted); font-weight: 600; }
.trust-row span {
  background: var(--surface); border: 1px solid var(--border);
  padding: .26rem .6rem; border-radius: var(--radius-pill);
}
.trust-row span { display: inline-flex; align-items: center; gap: .38rem; }
.trust-row svg { color: var(--success); flex: none; }

/* ---------- 7. Tool board ---------- */
.tool {
  display: grid; grid-template-columns: 320px minmax(0, 1fr);
  gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-md); overflow: hidden;
}
.tool-panel {
  border-right: 1px solid var(--border); background: var(--surface-2);
  display: flex; flex-direction: column; max-height: 720px;
}
.panel-tabs { display: flex; border-bottom: 1px solid var(--border); }
.panel-tab {
  flex: 1; padding: .72rem .5rem; border: 0; background: none; cursor: pointer;
  font-size: .84rem; font-weight: 700; color: var(--text-muted); border-bottom: 2px solid transparent;
}
.panel-tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); background: var(--surface); }
.panel-body { padding: .9rem; overflow-y: auto; flex: 1; }
.panel-pane[hidden] { display: none; }
.panel-hint {
  display: flex; gap: .45rem; align-items: flex-start;
  font-size: .76rem; line-height: 1.45; color: var(--text-muted);
  background: var(--bg-sunken); border-radius: var(--radius-xs);
  padding: .5rem .6rem; margin-bottom: .85rem;
}
.panel-hint svg { width: 14px; height: 14px; flex: none; margin-top: .15rem; color: var(--brand); }
.panel-foot { margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--border); }

.field { margin-bottom: .8rem; }
.field > label { display: block; font-size: .78rem; font-weight: 700; color: var(--text-muted); margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .05em; }
.field-row { display: flex; gap: .5rem; }
.field-row > * { min-width: 0; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%; padding: .55rem .68rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: .15s var(--ease);
}
input[type="text"]:focus, input[type="number"]:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}
input[type="color"] { width: 100%; height: 30px; padding: 2px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 5px; }
input[type="range"] { width: 100%; accent-color: var(--brand); }
/* Fixed column count so all swatches always sit on one row inside the panel. */
.swatch-row { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: .3rem; }
.swatch {
  width: 100%; aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
}
.swatch[aria-pressed="true"] { border-color: var(--text); }

.library-group { margin-bottom: 1rem; }
.library-group > h4 { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: .5rem; }
.library-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.lib-chip {
  padding: .3rem .6rem; border-radius: var(--radius-pill); font-size: .78rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-soft); cursor: pointer; transition: .14s var(--ease);
}
.lib-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

.board-col { display: flex; flex-direction: column; min-width: 0; background: var(--board-bg); }
.board-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem;
  padding: .45rem .55rem; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.tb-group { display: inline-flex; align-items: center; gap: .28rem; }
.tb-sep { width: 1px; align-self: stretch; min-height: 26px; background: var(--border); margin: .1rem .2rem; }
.tb-spacer { flex: 1 1 auto; min-width: 0; }

.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button {
  padding: .36rem .6rem; border: 0; background: var(--surface); cursor: pointer;
  font-size: .78rem; font-weight: 700; color: var(--text-muted); border-right: 1px solid var(--border);
  white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--text); background: var(--bg-soft); }
.seg button[aria-pressed="true"] { background: var(--brand); color: #fff; }
.seg button[aria-pressed="true"]:hover { background: var(--brand); color: #fff; }

.icon-btn {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center; cursor: pointer;
  border-radius: var(--radius-xs); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-soft); transition: .14s var(--ease);
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; border-color: var(--border); color: var(--text-muted); background: var(--surface); }
.icon-btn svg { width: 15px; height: 15px; }

.zoom-readout {
  min-width: 48px; padding: .34rem .1rem; border: 0; background: none; cursor: pointer;
  font-size: .76rem; font-weight: 750; color: var(--text-muted);
  font-variant-numeric: tabular-nums; border-radius: var(--radius-xs);
}
.zoom-readout:hover { color: var(--brand); background: var(--bg-soft); }

.count-pill {
  font-size: .73rem; font-weight: 750; color: var(--text-muted);
  background: var(--bg-sunken); border-radius: var(--radius-pill);
  padding: .2rem .58rem; white-space: nowrap;
}

/* Small popover menu (sort, and anything else that needs one) */
.menu { position: relative; }
.menu-panel {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 206px;
  padding: .3rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: .15s var(--ease);
}
.menu[data-open="true"] .menu-panel { opacity: 1; visibility: visible; transform: translateY(0); }
.menu-panel button {
  display: flex; align-items: center; gap: .45rem; width: 100%; text-align: left;
  padding: .5rem .6rem; border: 0; background: none; cursor: pointer;
  border-radius: var(--radius-xs); font-size: .83rem; font-weight: 650; color: var(--text-soft);
}
.menu-panel button:hover { background: var(--bg-soft); color: var(--text); }
.menu-panel button[aria-checked="true"] { color: var(--brand); background: var(--brand-soft); }
.menu-panel button[aria-checked="true"]::after { content: "✓"; margin-left: auto; font-weight: 800; }

/* One-tap starters at the top of the Add panel */
.quick-add { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; margin-bottom: .95rem; }
.quick-add button {
  display: flex; flex-direction: column; align-items: center; gap: .22rem;
  padding: .5rem .25rem; cursor: pointer; transition: .14s var(--ease);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); font-size: .73rem; font-weight: 700; color: var(--text-soft);
}
.quick-add button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.quick-add svg { width: 17px; height: 17px; color: var(--brand); }

.board-viewport {
  position: relative; flex: 1; display: flex; min-height: 430px; overflow: hidden;
  background-image: linear-gradient(var(--board-grid) 1px, transparent 1px), linear-gradient(90deg, var(--board-grid) 1px, transparent 1px);
  background-size: 20px 20px;
}
.board-inner {
  position: relative; flex: 1 1 auto; min-width: 0;
  padding: 0;
  overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-x: contain;
}
#stage {
  position: relative; display: flex; align-items: flex-end; justify-content: center;
  gap: 0; padding: 50px 30px 0;      /* top padding leaves room for the hover actions */
  border-bottom: 3px solid var(--board-base);
}
#stage.is-overflow { justify-content: flex-start; }

/* Fade the right edge only while the board can actually scroll that way. */
.board-viewport::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 38px; z-index: 3;
  pointer-events: none; opacity: 0; transition: opacity .2s var(--ease);
  background: linear-gradient(to left, var(--board-bg), transparent);
}
.board-viewport[data-overflow="true"]::after { opacity: 1; }

.figure {
  position: relative; flex: none; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-end; transition: transform .18s var(--ease);
}
.figure[data-dragging="true"] { opacity: .5; }
.figure-body { cursor: grab; }
.figure-body:active { cursor: grabbing; }
.figure-body { position: relative; }
.figure-body::after {
  content: ""; position: absolute; left: 50%; bottom: -3px; transform: translateX(-50%);
  width: 74%; height: 7px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(15, 18, 40, .22), transparent);
}
html[data-theme="dark"] .figure-body::after {
  background: radial-gradient(closest-side, rgba(0, 0, 0, .55), transparent);
}
.figure-label {
  margin-top: 7px; text-align: center; font-size: .72rem; font-weight: 700; line-height: 1.25;
  max-width: 116px; word-break: break-word;
  padding: .24rem .42rem; border-radius: 7px;
  background: color-mix(in srgb, var(--board-bg) 78%, transparent);
  border: 1px solid var(--border);
}
.figure-label b { display: block; font-size: .73rem; }
.figure-label span { color: var(--text-muted); font-weight: 650; font-size: .67rem; font-variant-numeric: tabular-nums; }
/* The height readout that sits directly over each figure's head. */
.figure-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 19px; margin-bottom: 5px; padding: .1rem .45rem;
  border-radius: var(--radius-pill); white-space: nowrap;
  font-size: .7rem; font-weight: 800; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--board-bg) 84%, transparent);
  border: 1.5px solid currentColor;
}

/* Edit / remove, revealed on hover or keyboard focus. */
.figure-actions {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  display: flex; gap: .3rem; opacity: 0; transition: .15s var(--ease);
}
.figure:hover .figure-actions, .figure:focus-within .figure-actions { opacity: 1; }
.figure-actions button {
  width: 20px; height: 20px; display: grid; place-items: center; padding: 0;
  border-radius: 50%; cursor: pointer; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-muted); transition: .14s var(--ease);
}
.figure-actions button svg { width: 11px; height: 11px; }
.figure-actions button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.figure-actions button[data-act="remove"]:hover {
  border-color: var(--danger); color: #fff; background: var(--danger);
}

/* The ruler is a real flex column beside the scrolling board, not an overlay.
   As an overlay it used to hide whichever figure had scrolled underneath it. */
.ruler {
  position: relative; flex: 0 0 62px; align-self: flex-start;
  z-index: 2; pointer-events: none;
  background: var(--board-bg);
  border-right: 1px solid var(--border);
}
.ruler-tick { position: absolute; right: 0; height: 1px; background: var(--board-base); }
.ruler-tick--major { width: 13px; background: var(--text-muted); }
.ruler-tick--minor { width: 7px; }
.ruler-label {
  position: absolute; right: 17px; transform: translateY(-50%);
  font-size: .64rem; font-weight: 700; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap;
}

.board-empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.board-empty p { color: var(--text-muted); font-size: .92rem; max-width: 260px; }
.board-empty.is-hidden { display: none; }

.diff-bar {
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: stretch;
  padding: .5rem .55rem; border-top: 1px solid var(--border); background: var(--surface-2);
}
.stat {
  display: flex; flex-direction: column; gap: .06rem; min-width: 0;
  padding: .34rem .66rem; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
}
.stat-label {
  font-size: .62rem; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-muted); white-space: nowrap;
}
.stat-value {
  font-size: .86rem; font-weight: 750; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.stat--primary { border-color: var(--brand-border); background: var(--brand-soft); }
.stat--primary .stat-value { color: var(--brand); }
.diff-bar .stat--push { margin-left: auto; }

.board-legend {
  display: flex; flex-wrap: wrap; gap: .3rem .5rem; align-items: center;
  padding: .45rem .55rem; border-top: 1px solid var(--border); background: var(--surface-2);
}
.board-legend[hidden] { display: none; }
.legend-item {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .75rem; font-weight: 650; color: var(--text-soft);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: .16rem .55rem .16rem .4rem;
}
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ---------- 8. Cards / features ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.3rem; box-shadow: var(--shadow-xs); transition: .18s var(--ease);
}
.card--hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand-border); }
.card h3 { margin-bottom: .4rem; }
.card p:last-child { margin-bottom: 0; }
.card p { color: var(--text-soft); font-size: .93rem; }
.card-icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; margin-bottom: .85rem;
  background: var(--brand-soft); color: var(--brand);
}
.card-icon svg { width: 20px; height: 20px; }
.card-num {
  font-family: var(--font-mono); font-size: .72rem; font-weight: 700; color: var(--brand);
  background: var(--brand-soft); border-radius: var(--radius-pill); padding: .12rem .5rem; display: inline-block; margin-bottom: .6rem;
}
.card-link { display: inline-flex; align-items: center; gap: .32rem; font-size: .86rem; font-weight: 700; margin-top: .6rem; }

.step-card { display: flex; gap: .95rem; align-items: flex-start; }
.step-index {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 800; font-size: .88rem;
}
.step-card h3 { font-size: 1.03rem; margin-bottom: .22rem; }
.step-card p { margin: 0; font-size: .9rem; color: var(--text-soft); }

/* ---------- 9. Answer box (GEO / AI-search) ---------- */
.answer-box {
  border: 1px solid var(--brand-border); background: var(--brand-soft);
  border-radius: var(--radius); padding: 1.15rem 1.25rem;
}
.answer-box > :first-child { margin-top: 0; }
.answer-box > :last-child { margin-bottom: 0; }
.answer-box h2, .answer-box h3 { font-size: 1.06rem; }
.answer-box p { margin-bottom: .6rem; }

/* ---------- 10. FAQ ---------- */
.faq { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.faq details { border-bottom: 1px solid var(--border); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  cursor: pointer; padding: 1rem 1.15rem; font-weight: 700; font-size: .97rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 9px; height: 9px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg); transition: .2s var(--ease); margin-top: -4px;
}
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: 3px; }
.faq details[open] summary { color: var(--brand); }
.faq .faq-body { padding: 0 1.15rem 1.1rem; color: var(--text-soft); font-size: .93rem; }
.faq .faq-body > :last-child { margin-bottom: 0; }

/* ---------- 11. Prose / article ---------- */
.prose { max-width: 780px; }
.prose h2 { margin-top: 2.4rem; scroll-margin-top: calc(var(--header-h) + 16px); }
.prose h3 { margin-top: 1.7rem; scroll-margin-top: calc(var(--header-h) + 16px); }
.prose p, .prose li { color: var(--text-soft); }
.prose strong { color: var(--text); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.35rem 0; font-size: .9rem; }
.prose th, .prose td { padding: .6rem .7rem; border-bottom: 1px solid var(--border); text-align: left; }
.prose thead th { background: var(--bg-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.prose tbody tr:hover { background: var(--bg-soft); }
.prose td:first-child { font-weight: 650; color: var(--text); }
.prose blockquote {
  margin: 1.3rem 0; padding: .85rem 1.15rem; border-left: 3px solid var(--brand);
  background: var(--bg-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-soft);
}
.prose code { font-family: var(--font-mono); font-size: .87em; background: var(--bg-sunken); padding: .12em .38em; border-radius: 4px; }
.prose figure { margin: 1.5rem 0; }
.prose figcaption { font-size: .82rem; color: var(--text-muted); text-align: center; margin-top: .5rem; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.key-takeaway { list-style: none; padding: 0; }
.key-takeaway li { position: relative; padding-left: 1.6rem; }
.key-takeaway li::before {
  content: "✓"; position: absolute; left: 0; top: 0; color: var(--success); font-weight: 800;
}

/* ---------- 12. Breadcrumbs ---------- */
.breadcrumbs { font-size: .82rem; color: var(--text-muted); padding: 1rem 0 .25rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; }
.breadcrumbs li { display: flex; align-items: center; gap: .35rem; margin: 0; }
.breadcrumbs li + li::before { content: "/"; color: var(--border-strong); }
.breadcrumbs a { color: var(--text-muted); font-weight: 600; }
.breadcrumbs a:hover { color: var(--brand); }
.breadcrumbs [aria-current="page"] { color: var(--text-soft); }

/* ---------- 13. Page hero (sub pages) ---------- */
.page-hero { padding: 1.4rem 0 2.25rem; border-bottom: 1px solid var(--border); background: var(--bg-soft); }
.page-hero h1 { max-width: 820px; }
.page-hero .lede { max-width: 720px; color: var(--text-soft); font-size: 1.05rem; margin-bottom: 0; }
.meta-line { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .82rem; color: var(--text-muted); margin-top: .9rem; }

/* ---------- 14. CTA band ---------- */
.cta-band {
  border-radius: var(--radius-lg); padding: 2.6rem 1.6rem; text-align: center;
  background: linear-gradient(135deg, #1e1b4b, #4c1d95 55%, #5b21b6);
  color: #fff; position: relative; overflow: hidden;
}
html[data-theme="dark"] .cta-band { background: linear-gradient(135deg, #171436, #3b1d78 55%, #4c1d95); }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .82); max-width: 560px; margin-inline: auto; }
.cta-band .btn-outline { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .35); color: #fff; }
.cta-band .btn-light { background: #fff; color: #3b1d78; }
.cta-actions { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; margin-top: 1.35rem; }
.cta-note { font-size: .82rem; color: rgba(255,255,255,.65); margin-top: .9rem; }

/* ---------- 15. Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); padding: 3rem 0 1.5rem; margin-top: 3rem; }
.footer-grid { display: grid; grid-template-columns: minmax(210px, 1.5fr) repeat(auto-fit, minmax(150px, 1fr)); gap: 2rem; }
.footer-brand p { color: var(--text-muted); font-size: .875rem; max-width: 300px; margin-top: .8rem; }
.footer-col h3 { font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: .85rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: .45rem; }
.footer-col a { font-size: .875rem; color: var(--text-soft); font-weight: 500; }
.footer-col a:hover { color: var(--brand); }
.footer-bottom {
  margin-top: 2.5rem; padding-top: 1.4rem; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between;
  font-size: .82rem; color: var(--text-muted);
}
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: .35rem 1rem; }
.footer-bottom a { color: var(--text-muted); }

/* ---------- 16. Utilities ---------- */
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.text-center { text-align: center; }
.muted { color: var(--text-muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(14px);
  background: var(--text); color: var(--bg); padding: .6rem 1.05rem; border-radius: var(--radius-pill);
  font-size: .86rem; font-weight: 650; box-shadow: var(--shadow-lg); z-index: 300;
  opacity: 0; visibility: hidden; transition: .24s var(--ease);
}
.toast[data-show="true"] { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ---------- 17. Responsive ---------- */
@media (max-width: 980px) {
  .tool { grid-template-columns: 1fr; }
  .tool-panel { max-height: none; border-right: 0; border-bottom: 1px solid var(--border); }
  .board-viewport { min-height: 380px; }
  .nav-drop .drop-panel { min-width: 320px; grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .nav-toggle {
    display: grid; place-items: center; width: 36px; height: 36px; cursor: pointer;
    background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-soft); margin-left: auto;
  }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--border); padding: .6rem;
    box-shadow: var(--shadow-lg); max-height: calc(100vh - var(--header-h)); overflow-y: auto;
    display: none; margin-left: 0;
  }
  .nav[data-open="true"] { display: flex; }
  .nav > a, .nav-btn { justify-content: space-between; padding: .72rem .8rem; font-size: .96rem; }
  .nav-drop .drop-panel {
    position: static; transform: none; min-width: 0; box-shadow: none; border: 0;
    background: var(--bg-soft); padding: .3rem; opacity: 1; visibility: visible; display: none;
  }
  .nav-drop[data-open="true"] .drop-panel { display: grid; }
  .header-actions .btn { display: none; }
  .section { padding: 3rem 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.6rem; }
}
@media (max-width: 980px) {
  /* Stacked layout: keep the control panel from pushing the board off-screen. */
  .panel-body { max-height: 380px; }
}

@media (max-width: 640px) {
  .board-toolbar { gap: .3rem; padding: .45rem; }
  .tb-sep { display: none; }
  .tb-spacer { display: none; }
  .tb-group:first-of-type { width: 100%; }
  .tb-group:first-of-type .seg { width: 100%; }
  .tb-group:first-of-type .seg button { flex: 1; }
  #subjectCount { order: 8; }
  #shareBtn, #exportPng { flex: 1 1 auto; }
}

@media (max-width: 560px) {
  .hero { padding: 1.6rem 0 .7rem; }
  .ruler { flex-basis: 46px; }
  .ruler-label { right: 12px; font-size: .58rem; }
  .footer-grid { grid-template-columns: 1fr; }
  .figure-label { max-width: 88px; font-size: .66rem; padding: .18rem .3rem; }
  .stat { padding: .3rem .5rem; }
  .stat-label { font-size: .58rem; }
  .stat-value { font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

@media print {
  .site-header, .site-footer, .cta-band, .tool-panel, .board-toolbar, .diff-bar { display: none !important; }
  .tool { border: 0; box-shadow: none; }
}

/* ---------- 18. Premium interaction layer ---------- */
:root {
  --ink-strong: #11152d;
  --brand-glow: rgba(79, 70, 229, .22);
  --surface-raised: color-mix(in srgb, var(--surface) 92%, var(--brand-soft));
  --shadow-float: 0 24px 55px rgba(38, 35, 96, .13), 0 5px 14px rgba(14, 17, 34, .07);
}
html[data-theme="dark"] {
  --ink-strong: #f8f9ff;
  --brand-glow: rgba(124, 124, 255, .25);
  --surface-raised: color-mix(in srgb, var(--surface) 88%, var(--brand-soft));
  --shadow-float: 0 26px 65px rgba(0, 0, 0, .42), 0 6px 18px rgba(0, 0, 0, .28);
}

body {
  background:
    radial-gradient(circle at 88% -8%, color-mix(in srgb, var(--brand) 8%, transparent), transparent 28rem),
    var(--bg);
}
.site-header {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--brand) 7%, var(--border));
}
.brand-mark {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #4f46e5 0%, #6366f1 42%, #8b5cf6 100%);
  box-shadow: 0 8px 18px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,.34);
}
.brand-mark::after {
  content: ""; position: absolute; inset: 1px 1px auto; height: 42%;
  background: linear-gradient(180deg, rgba(255,255,255,.25), transparent);
  border-radius: inherit; pointer-events: none;
}
.nav > a, .nav-btn { transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease); }
.nav > a:hover, .nav-btn:hover { transform: translateY(-1px); }
.btn { min-height: 42px; box-shadow: 0 1px 0 rgba(255,255,255,.2) inset; }
.btn-primary {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 46%, #7c3aed 100%);
  box-shadow: 0 10px 22px var(--brand-glow), 0 1px 0 rgba(255,255,255,.28) inset;
}
.btn-primary::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-110%);
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.2), transparent);
  transition: transform .55s var(--ease); pointer-events: none;
}
.btn-primary:hover::after { transform: translateX(110%); }
.btn-primary:hover { box-shadow: 0 14px 28px var(--brand-glow), 0 1px 0 rgba(255,255,255,.28) inset; }

/* Homepage hero: modern editorial layout + realistic scale preview */
.hero {
  padding: clamp(3.2rem, 6.5vw, 5.2rem) 0 2.6rem;
  text-align: left;
  background:
    radial-gradient(circle at 75% 20%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 26rem),
    radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 22rem);
  position: relative;
  overflow: hidden;
}
.hero::before { display: none; }
.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
  gap: clamp(2.5rem, 5vw, 5.5rem);
  align-items: center;
}
.hero-copy { max-width: 650px; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .85rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 85%, var(--surface)), var(--surface));
  border: 1px solid var(--brand-border);
  font-size: .8rem;
  font-weight: 750;
  color: var(--brand);
  margin-bottom: 1.15rem;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 12%, transparent);
}
.hero-eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent);
}
.hero h1 {
  font-size: clamp(2.2rem, 4.4vw, 3.6rem);
  font-weight: 850;
  letter-spacing: -.035em;
  line-height: 1.12;
  margin-bottom: 1.1rem;
  color: var(--text);
}
.hero-gradient-text {
  background: linear-gradient(135deg, var(--brand), #7c3aed, #0ea5a4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline;
}
.hero .lede {
  font-size: clamp(1rem, 1.35vw, 1.14rem);
  line-height: 1.68;
  color: var(--text-soft);
  margin-bottom: 1.65rem;
  max-width: 580px;
}
.hero-cta {
  display: flex;
  align-items: center;
  gap: .85rem;
  flex-wrap: wrap;
  margin-bottom: 1.8rem;
}
.btn-lg {
  padding: .75rem 1.6rem;
  font-size: 1rem;
  font-weight: 750;
  border-radius: 12px;
}
.btn-primary.btn-lg {
  box-shadow: 0 4px 18px color-mix(in srgb, var(--brand) 35%, transparent);
}
.btn-primary.btn-lg:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px color-mix(in srgb, var(--brand) 45%, transparent);
}
.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
}
.trust-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-soft);
  padding: .32rem .75rem;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.trust-pill svg { color: var(--success); }

.hero-preview {
  position: relative;
  min-height: 420px;
  display: grid;
  place-items: center;
}
.hero-orbit {
  position: absolute;
  width: min(100%, 520px);
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--brand) 18%, transparent);
  border-radius: 50%;
  transform: rotate(-10deg);
  pointer-events: none;
}
.hero-orbit::before, .hero-orbit::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 13%, transparent), 0 0 24px color-mix(in srgb, var(--accent) 40%, transparent);
}
.hero-orbit::before { top: 7%; right: 17%; }
.hero-orbit::after { bottom: 12%; left: 12%; background: var(--brand-2); box-shadow: 0 0 0 8px color-mix(in srgb, var(--brand-2) 13%, transparent); }

.hero-card {
  position: relative;
  width: min(100%, 460px);
  padding: 1.15rem;
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--border));
  border-radius: 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 22px 55px -10px color-mix(in srgb, var(--brand) 20%, rgba(0,0,0,.15)), var(--shadow-md);
  backdrop-filter: blur(14px);
  transform: rotate(1deg);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.hero-card:hover {
  transform: translateY(-4px) rotate(0deg);
  box-shadow: 0 28px 65px -12px color-mix(in srgb, var(--brand) 28%, rgba(0,0,0,.2)), var(--shadow-lg);
}
.hero-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .2rem .3rem .85rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .85rem;
}
.hero-card-badge {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--text);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .22);
}
.hero-unit-tag {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .2rem .55rem;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-border);
}
.hero-scale {
  position: relative;
  height: 295px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2.2rem;
  padding: 1.4rem 1.2rem .4rem 3.6rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand-soft) 45%, var(--surface)), var(--surface));
  overflow: hidden;
}
.hero-scale::after {
  content: "";
  position: absolute;
  left: 48px;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--board-base);
}

/* Ruler along the left side of hero card */
.hero-ruler-marks {
  position: absolute;
  left: 0;
  top: 15px;
  bottom: 25px;
  width: 50px;
  border-right: 1.5px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0 6px 0 0;
  text-align: right;
  pointer-events: none;
}
.hero-ruler-tick {
  font-size: .62rem;
  font-weight: 750;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  position: relative;
}
.hero-ruler-tick::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 6px;
  height: 1px;
  background: var(--border-strong);
}

/* Difference callout badge in hero */
.hero-diff-callout {
  position: absolute;
  top: 28px;
  left: 56px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
}
.hero-diff-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .24rem .7rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: .74rem;
  font-weight: 800;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 35%, transparent);
}

/* Realistic human silhouettes in hero */
.hero-fig {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  z-index: 2;
}
.hero-fig-badge {
  font-size: .68rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: .12rem .5rem;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
  white-space: nowrap;
}
.hero-fig--woman .hero-fig-badge {
  background: color-mix(in srgb, #0ea5a4 14%, var(--surface));
  color: #0ea5a4;
  border: 1.5px solid #0ea5a4;
}
.hero-fig--man .hero-fig-badge {
  background: color-mix(in srgb, #4f46e5 14%, var(--surface));
  color: #4f46e5;
  border: 1.5px solid #4f46e5;
}
.hero-fig-svg {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.hero-fig--woman .hero-fig-svg svg {
  color: #0ea5a4;
  filter: drop-shadow(0 8px 12px rgba(14, 165, 164, .25));
}
.hero-fig--man .hero-fig-svg svg {
  color: #4f46e5;
  filter: drop-shadow(0 8px 12px rgba(79, 70, 229, .25));
}
.hero-fig-label {
  font-size: .74rem;
  font-weight: 750;
  color: var(--text);
  margin-top: 5px;
}

/* Footer stats in hero card */
.hero-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem .35rem 0;
  gap: .8rem;
  font-size: .78rem;
  color: var(--text-soft);
}
.hero-footer-stat {
  display: flex;
  align-items: center;
  gap: .42rem;
}
.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.hero-dot--teal { background: #0ea5a4; }
.hero-dot--indigo { background: #4f46e5; }


.tool-search-wrap { max-width: 760px; margin: 0 auto 1.8rem; }
.tool-search-label { display: block; margin-bottom: .55rem; font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.tool-search { position: relative; display: flex; align-items: center; gap: .6rem; padding: .42rem .45rem .42rem .9rem; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-md); }
.tool-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent), var(--shadow-md); }
.tool-search svg { flex: none; color: var(--brand); }
.tool-search input { min-width: 0; flex: 1; padding: .65rem 0; border: 0; outline: 0; background: transparent; }
.tool-search button { width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--bg-soft); color: var(--text-muted); cursor: pointer; }
.tool-search button:hover { color: var(--brand); background: var(--brand-soft); }
.tool-search-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; margin-top: .65rem; }
.tool-search-item { display: flex; flex-direction: column; gap: .15rem; min-height: 76px; padding: .72rem .8rem; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease); }
.tool-search-item:hover { transform: translateY(-2px); border-color: var(--brand-border); box-shadow: var(--shadow-sm); text-decoration: none; }
.tool-search-item strong { font-size: .88rem; }
.tool-search-item small { color: var(--text-muted); font-size: .74rem; }
.tool-search-empty { margin: .8rem 0 0; color: var(--text-muted); font-size: .86rem; text-align: center; }
.tool-search-empty[hidden], .tool-search-item[hidden] { display: none; }

.tool { border-color: color-mix(in srgb, var(--brand) 15%, var(--border)); box-shadow: var(--shadow-float); }
.tool-panel { background: linear-gradient(180deg, var(--surface-raised), var(--surface-2)); }
.panel-tabs { background: color-mix(in srgb, var(--surface) 72%, transparent); }
.panel-tab { min-height: 48px; }
.board-col { background: linear-gradient(180deg, var(--board-bg), color-mix(in srgb, var(--board-bg) 88%, var(--brand-soft))); }
.board-toolbar { padding: .65rem .75rem; background: color-mix(in srgb, var(--surface-2) 86%, transparent); }
.board-viewport { min-height: 470px; }
.board-empty p { padding: 1rem 1.25rem; border: 1px dashed var(--border-strong); border-radius: 16px; background: color-mix(in srgb, var(--surface) 76%, transparent); }
.figure { transition: transform .2s var(--ease), filter .2s var(--ease); }
.figure:hover { transform: translateY(-3px); filter: drop-shadow(0 12px 12px color-mix(in srgb, var(--brand) 11%, transparent)); }
.figure-actions { z-index: 4; }
.figure-actions button { width: 28px; height: 28px; box-shadow: var(--shadow-sm); }
.figure-label { box-shadow: var(--shadow-xs); }
.card { position: relative; overflow: hidden; border-color: color-mix(in srgb, var(--brand) 8%, var(--border)); background: linear-gradient(145deg, var(--surface), var(--surface-raised)); box-shadow: var(--shadow-sm); }
.card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,.24), transparent 35%); pointer-events: none; }
.card--hover { transform-style: preserve-3d; }
.card--hover:hover { transform: translateY(-6px) rotateX(1deg); box-shadow: var(--shadow-float); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.card-icon { box-shadow: 0 8px 18px color-mix(in srgb, var(--brand) 16%, transparent); }
.answer-box { box-shadow: var(--shadow-sm); }
.page-hero { position: relative; overflow: hidden; background: radial-gradient(circle at 85% 20%, color-mix(in srgb, var(--brand) 13%, transparent), transparent 25rem), var(--bg-soft); }
.page-hero::after { content: ""; position: absolute; right: 6%; top: 24%; width: 160px; height: 160px; border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent); border-radius: 50%; opacity: .7; }
.site-footer { background: linear-gradient(180deg, var(--bg-soft), color-mix(in srgb, var(--bg-soft) 74%, var(--brand-soft))); }

@media (hover: none) {
  .figure-actions { opacity: 1; top: -34px; }
  .figure-actions button { width: 32px; height: 32px; }
  .card--hover:hover { transform: none; }
}
@media (max-width: 900px) {
  .hero-layout { grid-template-columns: 1fr; }
  .hero-copy { max-width: 760px; margin-inline: auto; text-align: center; }
  .hero .lede { margin-inline: auto; }
  .hero-cta, .trust-row { justify-content: center; }
  .hero-preview { min-height: 330px; }
}
@media (max-width: 640px) {
  .hero { padding-top: 2.5rem; }
  .hero h1 { font-size: clamp(1.9rem, 7.5vw, 2.6rem); }
  .hero-preview { min-height: 290px; }
  .hero-card { transform: none; padding: .85rem; }
  .hero-scale { height: 250px; gap: 1.2rem; padding: 1.2rem .8rem .3rem 2.8rem; }
  .hero-fig--woman .hero-fig-svg svg { height: 145px; width: auto; }
  .hero-fig--man .hero-fig-svg svg { height: 157px; width: auto; }
  .tool-search-results { grid-template-columns: 1fr 1fr; }
  .tool-search-item { min-height: 70px; }
}
@media (max-width: 430px) {
  .tool-search-results { grid-template-columns: 1fr; }
  .hero-cta .btn { width: 100%; }
  .hero-scale { gap: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-card, .card--hover:hover, .figure:hover { transform: none; }
  .hero-orbit { display: none; }
}

/* ---------- 13. Stage Guidelines & Head-to-Head Styles ---------- */
.stage-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
.stage-guide {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  opacity: 0.55;
  border-bottom: 1px dashed color-mix(in srgb, var(--brand) 28%, var(--border-strong));
}
.stage-guide .guide-val {
  position: absolute;
  right: 12px;
  top: -9px;
  font-size: .62rem;
  font-weight: 700;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--board-bg) 88%, transparent);
  padding: 0 4px;
  border-radius: 4px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.figure {
  z-index: 2;
}

/* Head-to-Head Versus Card */
.h2h-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .65rem 1rem;
  width: 100%;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand-soft) 80%, var(--surface)), var(--surface));
  border: 1px solid var(--brand-border);
  box-shadow: var(--shadow-xs);
}
.h2h-matchup {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.h2h-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .55rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
}
.h2h-badge-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}
.h2h-vs {
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .08em;
  color: var(--brand);
  padding: .15rem .45rem;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--brand) 12%, transparent);
}
.h2h-summary {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-soft);
}
.h2h-summary strong {
  color: var(--brand);
}
.h2h-gap-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .28rem .75rem;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 800;
  font-size: .8rem;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 28%, transparent);
}

/* Trending Matchups Presets */
.matchups-section {
  margin: 1.8rem 0 2rem;
}
.matchup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: .85rem;
}
.matchup-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.05rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: transform .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
  box-shadow: var(--shadow-xs);
}
.matchup-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}
.matchup-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .45rem;
}
.matchup-tag {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .15rem .45rem;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand);
}
.matchup-card h4 {
  font-size: .98rem;
  margin: 0 0 .3rem;
  color: var(--text);
}
.matchup-card p {
  font-size: .78rem;
  color: var(--text-soft);
  margin: 0 0 .8rem;
  line-height: 1.45;
}
.matchup-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  font-size: .78rem;
  font-weight: 750;
  color: var(--brand);
  padding: .38rem .7rem;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  margin-top: auto;
  transition: .15s var(--ease);
}
.matchup-card:hover .matchup-btn {
  background: var(--brand);
  color: #fff;
}
.field-hint {
  display: inline-block;
  margin-top: .3rem;
  font-size: .75rem;
  font-weight: 700;
  color: var(--brand);
}
