:root {
  --bg: #07051B;
  --bg-deep: #07051B;
  --bg-far: #160A3B;
  --bg-elevated: rgba(255, 255, 255, 0.045);
  --bg-card: rgba(255, 255, 255, 0.035);
  --bg-inset: rgba(7, 5, 27, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --border-soft: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #FFFFFF;
  --text-muted: #D7D7E5;
  --text-faint: #9b98b8;
  --accent: #8B3DFF;
  --accent-hover: #a05dff;
  --accent-soft: rgba(139, 61, 255, 0.16);
  --accent2: #FF3F8E;
  --accent2-soft: rgba(255, 63, 142, 0.16);
  --accent3: #B86CFF;
  --grad: linear-gradient(100deg, #8B3DFF, #FF3F8E);
  --glow: rgba(255, 63, 142, 0.35);
  --glow-soft: 0 0 0 1px rgba(255,255,255,0.06), 0 8px 30px -10px rgba(139, 61, 255, 0.55);
  --good: #3ce0b0;
  --ok: #ffc857;
  --bad: #FF3F8E;
  --measure: 100%;
  --radius: 16px;
  --radius-sm: 10px;
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.4), 0 18px 46px -22px rgba(139, 61, 255, 0.45);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f2fb;
  --bg-deep: #f7f4fc;
  --bg-far: #ece4fb;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-inset: #faf8fe;
  --border: #e4dcf3;
  --border-soft: #ede7f7;
  --border-strong: rgba(26, 18, 48, 0.16);
  --text: #1a1230;
  --text-muted: #5c5378;
  --text-faint: #6f6690;
  --accent: #7628e6;
  --accent-hover: #5f1cc4;
  --accent-soft: rgba(118, 40, 230, 0.10);
  --accent2: #e01a6d;
  --accent2-soft: rgba(224, 26, 109, 0.10);
  --accent3: #8f43e0;
  --grad: linear-gradient(100deg, #7628e6, #e01a6d);
  --glow: rgba(224, 26, 109, 0.28);
  --glow-soft: 0 0 0 1px rgba(26,18,48,0.05), 0 8px 24px -12px rgba(118, 40, 230, 0.35);
  --good: #12a686;
  --ok: #d99012;
  --bad: #e01a6d;
  --shadow-card: 0 1px 2px rgba(40,20,60,0.05), 0 10px 30px -14px rgba(60,30,110,0.18);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* 112.5% => 18px root. Layout is px-based, so this scales type only. */
html { scroll-behavior: smooth; font-size: 112.5%; }

body {
  position: relative;
  background: var(--bg-deep);
  background-image:
    radial-gradient(1100px 620px at 78% -8%, rgba(139, 61, 255, 0.30), transparent 60%),
    radial-gradient(900px 560px at 8% 4%, rgba(255, 63, 142, 0.16), transparent 62%),
    linear-gradient(175deg, var(--bg-deep) 0%, var(--bg-far) 58%, var(--bg-deep) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme="light"] body {
  background-image:
    radial-gradient(1100px 620px at 78% -8%, rgba(139, 61, 255, 0.10), transparent 60%),
    radial-gradient(900px 560px at 8% 4%, rgba(255, 63, 142, 0.07), transparent 62%),
    linear-gradient(175deg, var(--bg-deep) 0%, var(--bg-far) 58%, var(--bg-deep) 100%);
}

a { color: var(--accent3); text-decoration: none; }
a:hover { color: var(--accent2); }
img, svg { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 76vw leaves a 12% gutter each side on laptop/desktop. max() keeps the old
   1180px floor so narrower screens are unaffected; min() stops ultrawide
   monitors from stretching the layout past 1459px (12% gutters at 1920). */
.container { max-width: max(1180px, min(1459px, 76vw)); margin: 0 auto; padding: 0 var(--space-5); }

.skip-link { position: absolute; left: -9999px; background: var(--grad); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: var(--space-4); top: var(--space-4); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg-deep) 78%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.logo { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: 1.1rem; color: var(--text); }
.logo .mark {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: var(--grad);
  box-shadow: 0 6px 18px -6px var(--glow);
  display: flex; align-items: center; justify-content: center;
}
.logo .mark svg { width: 17px; height: 17px; stroke: #fff; }

.main-nav ul { list-style: none; display: flex; gap: var(--space-5); }
.main-nav a { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; }
.main-nav a:hover, .main-nav a.active { color: var(--text); }

.header-actions { display: flex; align-items: center; gap: var(--space-3); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent3); box-shadow: 0 0 0 3px rgba(184,108,255,0.12), 0 6px 20px -8px var(--glow); }
.icon-btn svg { width: 18px; height: 18px; }
.nav-toggle { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: var(--space-7) 0 var(--space-5); overflow: hidden; }
.hero::before {
  content: ""; position: absolute; top: -200px; right: -140px; width: 520px; height: 520px;
  background: radial-gradient(circle at 30% 30%, rgba(139, 61, 255, 0.38), transparent 62%),
              radial-gradient(circle at 70% 70%, rgba(255, 63, 142, 0.28), transparent 62%);
  filter: blur(30px); opacity: 0.9; pointer-events: none;
}
:root[data-theme="light"] .hero::before { opacity: 0.35; }
.hero .container { position: relative; z-index: 1; }

.eyebrow {
  display: inline-flex; align-items: center; gap: var(--space-2);
  background: linear-gradient(100deg, rgba(139,61,255,0.20), rgba(255,63,142,0.20));
  border: 1px solid var(--border); color: var(--accent3);
  box-shadow: 0 6px 24px -12px var(--glow);
  border-radius: 999px; padding: 5px 14px; font-size: 0.86rem; font-weight: 600; margin-bottom: var(--space-4);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent2); box-shadow: 0 0 8px var(--accent2); }

/* Pinned in px so the root font-size bump leaves the H1 unchanged. */
/* No max-width cap: the heading is sized to sit on a single line at desktop. */
h1 { font-size: clamp(30px, 3.7vw, 45.9px); font-weight: 800; letter-spacing: -0.022em; line-height: 1.14; margin-bottom: var(--space-3); max-width: none; text-wrap: balance; }
/* Keep the gradient phrase on one line so it doesn't leave an orphan word. */
h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
/* Content blocks share one measure so copy lines up with the grids below. */
.lead { color: var(--text-muted); font-size: 1.1rem; max-width: var(--measure); margin-bottom: var(--space-5); text-wrap: pretty; }

.pill-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(100deg, rgba(139,61,255,0.16), rgba(255,63,142,0.16));
  border: 1px solid var(--border); backdrop-filter: blur(8px);
  border-radius: 999px; padding: 7px 14px; font-size: 0.88rem; font-weight: 600; color: var(--text-muted);
  transition: box-shadow 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.pill:hover { border-color: rgba(255,63,142,0.45); box-shadow: 0 8px 26px -10px var(--glow); transform: translateY(-1px); }
.pill svg { width: 15px; height: 15px; stroke: var(--accent3); }

/* ---------- Workspace ---------- */
.workspace { display: grid; grid-template-columns: minmax(0,1fr) 372px; gap: var(--space-5); align-items: start; padding-bottom: var(--space-7); }

.card {
  background: var(--bg-card); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
  backdrop-filter: blur(14px);
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-soft); flex-wrap: wrap;
}
.panel-title { display: flex; align-items: center; gap: var(--space-3); font-weight: 700; font-size: 1.1rem; }
.step-badge {
  width: 26px; height: 26px; border-radius: 8px; background: var(--grad); color: #fff;
  box-shadow: 0 6px 16px -6px var(--glow);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.85rem; font-weight: 700;
}
.hint { display: inline-flex; align-items: center; gap: 7px; font-size: 0.86rem; color: var(--text-faint); background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: 999px; padding: 5px 12px; }
.hint svg { width: 14px; height: 14px; stroke: var(--text-faint); flex-shrink: 0; }

/* Flow steps */
.flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-soft); }
.flow-step { display: flex; align-items: center; gap: var(--space-3); }
.flow-step .fi { width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.flow-step .fi svg { width: 19px; height: 19px; stroke: var(--accent3); }
.flow-step.done .fi { background: var(--accent2-soft); box-shadow: 0 0 20px -8px var(--glow); }
.flow-step.done .fi svg { stroke: var(--accent2); }
.flow-step strong { display: block; font-size: 0.96rem; font-weight: 650; line-height: 1.3; }
.flow-step span { font-size: 0.84rem; color: var(--text-faint); }
.flow-arrow { color: var(--text-faint); opacity: 0.5; font-family: var(--font-mono); font-size: 0.9rem; letter-spacing: -2px; }

/* Stage */
.stage {
  position: relative; margin: var(--space-5);
  background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-6) var(--space-5); cursor: crosshair; touch-action: none; user-select: none; overflow: hidden;
}
.stage.tracking { border-color: var(--accent2); box-shadow: inset 0 0 0 1px var(--accent2), 0 0 40px -10px var(--glow); }
.stage-canvas { position: absolute; inset: 0; pointer-events: none; }

.stage-prompt { position: relative; text-align: center; max-width: 340px; z-index: 2; }
.stage-prompt .pi { width: 54px; height: 54px; margin: 0 auto var(--space-3); border-radius: 15px; background: var(--grad); box-shadow: 0 10px 30px -10px var(--glow); display: flex; align-items: center; justify-content: center; }
.stage-prompt .pi svg { width: 26px; height: 26px; stroke: #fff; }
.stage-prompt h3 { font-size: 1.12rem; margin-bottom: 6px; }
.stage-prompt p { font-size: 0.94rem; color: var(--text-muted); }

/* Ruler */
.ruler-wrap { position: relative; width: 100%; max-width: 620px; z-index: 1; }
.ruler-caption { text-align: center; font-size: 0.92rem; color: var(--text-muted); margin-bottom: var(--space-4); }
.ruler-caption b { color: var(--text); }
.ruler { position: relative; height: 62px; border-bottom: 2px solid var(--text-faint); }
.tick { position: absolute; bottom: 0; width: 1px; background: var(--text-faint); }
.tick.major { height: 22px; width: 2px; }
.tick.minor { height: 11px; opacity: 0.55; }
.tick-label { position: absolute; bottom: 26px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-muted); }
.ruler-unit { position: absolute; right: -22px; bottom: 0; font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-faint); }
.marker { position: absolute; bottom: 24px; transform: translateX(-50%); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.marker.start { background: var(--accent); color: #fff; box-shadow: 0 4px 14px -4px rgba(139,61,255,0.6); left: 0; }
.marker.end { background: var(--accent2); color: #fff; box-shadow: 0 4px 14px -4px var(--glow); left: 100%; }
.ruler-note { margin-top: var(--space-4); text-align: center; font-size: 0.84rem; color: var(--text-faint); display: flex; align-items: flex-start; gap: 7px; justify-content: center; }
.ruler-note svg { width: 14px; height: 14px; stroke: var(--ok); flex-shrink: 0; margin-top: 3px; }

.live-strip { display: flex; justify-content: center; gap: var(--space-5); margin-top: var(--space-4); font-family: var(--font-mono); font-size: 0.92rem; color: var(--text-muted); z-index: 2; position: relative; }
.live-strip[hidden] { display: none; }
.live-strip b { color: var(--text); font-variant-numeric: tabular-nums; }

/* Controls */
.controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); padding: 0 var(--space-5) var(--space-5); }
.ctl-label { display: flex; align-items: center; gap: 6px; font-size: 0.88rem; font-weight: 650; color: var(--text-muted); margin-bottom: var(--space-2); }
.ctl-label svg { width: 14px; height: 14px; stroke: var(--text-faint); }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  min-height: 44px; padding: 0 14px; border-radius: 9px; cursor: pointer;
  background: var(--bg-inset); border: 1px solid var(--border); color: var(--text-muted);
  font-family: var(--font-mono); font-size: 0.92rem; font-weight: 600;
}
.seg button { transition: border-color 150ms ease, box-shadow 150ms ease, color 150ms ease; }
.seg button:hover { color: var(--text); border-color: var(--accent3); box-shadow: 0 0 18px -6px var(--glow); }
.seg button[aria-pressed="true"] { background: var(--grad); border: none; color: #fff; box-shadow: 0 6px 20px -8px var(--glow); }

/* Smaller variant — used beside a full-size primary action button so the
   two button groups (options vs. the action) read as visually distinct. */
.seg-sm button { min-height: 36px; padding: 0 12px; font-size: 0.82rem; border-radius: 8px; }

.input, select.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--bg-inset); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font-family: var(--font-mono); font-size: 0.98rem;
}
.input:focus { outline: 2px solid var(--accent3); outline-offset: 1px; box-shadow: 0 0 20px -6px var(--glow); }
.ctl-help { font-size: 0.82rem; color: var(--text-faint); margin-top: 6px; }

.switch-row { display: flex; align-items: center; gap: var(--space-3); }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
/* Hit area is deliberately taller than the visual track to clear 44px on touch. */
.switch input { position: absolute; opacity: 0; left: 0; width: 100%; height: 44px; top: 50%; transform: translateY(-50%); margin: 0; cursor: pointer; z-index: 2; }
.switch .track { position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background 160ms ease; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text-faint); transition: transform 160ms ease, background 160ms ease; }
.switch input:checked ~ .track { background: var(--grad); box-shadow: 0 0 16px -4px var(--glow); }
.switch input:checked ~ .thumb { transform: translateX(20px); background: #fff; }
.switch input:focus-visible ~ .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text { font-size: 0.88rem; color: var(--text-muted); }

/* ---------- Result panel ---------- */
.result-panel { position: sticky; top: 90px; }
.result-head { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-soft); font-weight: 700; }
.result-head svg { width: 18px; height: 18px; stroke: var(--accent3); }
.result-body { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }

.result-hero { text-align: center; background: radial-gradient(120% 100% at 50% 0%, rgba(139,61,255,0.16), transparent 70%), var(--bg-inset); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-5) var(--space-4); }
.result-hero .big { font-family: var(--font-mono); font-size: 3.1rem; font-weight: 700; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-hero .unit { font-size: 1.06rem; color: var(--text-muted); font-weight: 600; margin-left: 5px; }
.result-hero .sub { margin-top: 6px; font-size: 0.88rem; color: var(--text-faint); }

.verdict { display: inline-flex; align-items: center; gap: 7px; margin-top: var(--space-3); padding: 6px 14px; border-radius: 999px; font-size: 0.89rem; font-weight: 650; }
.verdict svg { width: 15px; height: 15px; }
.verdict[data-state="none"] { background: var(--bg-card); color: var(--text-faint); }
.verdict[data-state="good"] { background: rgba(60,224,176,0.14); color: var(--good); }
.verdict[data-state="ok"] { background: rgba(255,200,87,0.14); color: var(--ok); }
.verdict[data-state="bad"] { background: rgba(255,63,142,0.16); color: var(--bad); }
.deviation { margin-top: var(--space-2); font-size: 0.9rem; color: var(--text-muted); font-family: var(--font-mono); }

.tolerance { padding-top: var(--space-1); }
.tol-bar { position: relative; height: 8px; border-radius: 999px; overflow: hidden; display: flex; }
.tol-bar i { display: block; height: 100%; }
.tol-bar .z1 { width: 25%; background: var(--good); }
.tol-bar .z2 { width: 35%; background: var(--ok); }
.tol-bar .z3 { width: 40%; background: var(--bad); }
.tol-marker { position: absolute; top: -4px; width: 4px; height: 16px; border-radius: 2px; background: var(--text); transform: translateX(-50%); transition: left 220ms ease; box-shadow: 0 0 0 2px var(--bg-card); }
.tol-scale { display: flex; justify-content: space-between; margin-top: 7px; font-size: 0.78rem; color: var(--text-faint); }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.stat { background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); }
.stat .k { display: flex; align-items: center; gap: 6px; font-size: 0.79rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); margin-bottom: 2px; }
.stat .k svg { width: 13px; height: 13px; stroke: var(--text-faint); }
.stat .v { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 var(--space-4); border-radius: var(--radius-sm);
  font-weight: 650; font-size: 0.95rem; border: 1px solid transparent; cursor: pointer;
  font-family: var(--font-ui); transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, filter 150ms ease, transform 110ms ease;
}
.btn:active { transform: scale(0.985); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--grad); border: none; color: #fff; box-shadow: 0 8px 24px -10px var(--glow); }
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 10px 32px -8px var(--glow); }
.btn-secondary { background: var(--bg-inset); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent3); color: var(--accent3); box-shadow: 0 8px 24px -12px var(--glow); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }

.runs { border-top: 1px solid var(--border-soft); padding-top: var(--space-4); }
.runs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-2); }
.runs-head h4 { font-size: 0.9rem; font-weight: 650; color: var(--text-muted); }
.runs-head button { background: none; border: none; color: var(--text-faint); font-size: 0.84rem; cursor: pointer; font-family: var(--font-ui); padding: 14px 10px; margin: -14px -10px; border-radius: 8px; }
.runs-head button:hover { color: var(--accent2); }
.runs-list { display: flex; flex-direction: column; gap: 6px; max-height: 148px; overflow-y: auto; }
.run-item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); background: var(--bg-inset); border: 1px solid var(--border-soft); border-radius: 8px; padding: 7px 12px; font-size: 0.89rem; }
.run-item .rv { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.run-item .rt { color: var(--text-faint); font-size: 0.82rem; }
.run-empty { text-align: center; color: var(--text-faint); font-size: 0.88rem; padding: var(--space-4) 0; }

.privacy-note { display: flex; align-items: center; gap: 9px; margin-top: var(--space-4); padding: var(--space-3) var(--space-4); background: var(--bg-card); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); font-size: 0.86rem; color: var(--text-faint); }
.privacy-note svg { width: 15px; height: 15px; stroke: var(--accent3); flex-shrink: 0; }
.privacy-note b { color: var(--text-muted); }

/* ---------- Quick links ---------- */
.quick-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin-top: var(--space-5); }
.qlink { display: flex; gap: var(--space-3); padding: var(--space-4); background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color 150ms ease, transform 150ms ease; }
.qlink:hover { border-color: rgba(255,63,142,0.35); transform: translateY(-2px); box-shadow: 0 14px 40px -18px var(--glow); }
.qlink .qi { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--accent-soft); }
.qlink .qi svg { width: 20px; height: 20px; stroke: var(--accent3); }
.qlink.alt .qi { background: var(--accent2-soft); }
.qlink.alt .qi svg { stroke: var(--accent2); }
.qlink h3 { font-size: 1.02rem; margin-bottom: 2px; color: var(--text); }
.qlink p { font-size: 0.945rem; color: var(--text-muted); line-height: 1.6; }
.qlink .go { display: inline-block; margin-top: 7px; font-size: 0.86rem; font-weight: 650; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Content sections ---------- */
section.block { padding: var(--space-8) 0; border-top: 1px solid var(--border-soft); }
/* Same measure as the hero copy so every section intro aligns to one block. */
.section-head { max-width: var(--measure); margin-bottom: var(--space-6); }
.section-head p { text-wrap: pretty; }
.kicker { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; width: fit-content; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: var(--space-2); }
h2 { font-size: clamp(1.62rem, 3.2vw, 2.05rem); font-weight: 800; letter-spacing: -0.015em; margin-bottom: var(--space-3); text-wrap: balance; }
h3 { font-size: 1.22rem; font-weight: 700; margin-bottom: var(--space-2); text-wrap: balance; }
p { color: var(--text-muted); line-height: 1.68; }
/* Looser leading for reading copy only — scoped to content blocks so the
   tool panel's compact UI text keeps its current rhythm and card heights. */
section.block p, section.block li, .lead, .callout p { line-height: 1.8; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.step { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-5); }
.step .n { width: 32px; height: 32px; border-radius: 9px; background: var(--grad); color: #fff; box-shadow: 0 8px 20px -8px var(--glow); font-family: var(--font-mono); font-weight: 700; display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-3); }
.step p { font-size: 1rem; }

/* Two-column row: text on the left, supporting image on the right */
.split-row { display: grid; grid-template-columns: minmax(0,1fr) 469px; gap: var(--space-6); align-items: center; }
.split-row .bullets { max-width: none; }
.split-media {
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-card); box-shadow: var(--shadow-card);
  overflow: hidden; backdrop-filter: blur(14px);
}
.split-media img { width: 100%; height: auto; display: block; cursor: zoom-in; transition: filter 150ms ease; }
.split-media img:hover, .split-media img:focus-visible { filter: brightness(1.06); }
.split-media img:focus-visible { outline: 2px solid var(--accent3); outline-offset: -2px; }

/* ---------- Image lightbox ---------- */
.img-lightbox {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: var(--space-6); background: rgba(8,6,16,0.86); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity 200ms ease;
}
.img-lightbox.open { opacity: 1; visibility: visible; }
.img-lightbox img { max-width: min(92vw, 960px); max-height: 86vh; width: auto; border-radius: var(--radius); box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6); }
.img-lightbox-close {
  position: absolute; top: var(--space-5); right: var(--space-5); width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}
.img-lightbox-close:hover { border-color: var(--accent3); color: var(--accent3); }
.img-lightbox-close svg { width: 18px; height: 18px; }

/* Bullet list for explainer copy */
.bullets { list-style: none; display: grid; gap: var(--space-2); max-width: var(--measure); }
.bullets li { position: relative; padding-left: 26px; color: var(--text-muted); font-size: 1rem; line-height: 1.8; text-wrap: pretty; }
.bullets li::before {
  content: ""; position: absolute; left: 4px; top: 0.62em;
  width: 8px; height: 8px; border-radius: 50%; background: var(--grad);
  box-shadow: 0 0 10px -1px var(--glow);
}
.bullets li b, .bullets li strong { color: var(--text); font-weight: 650; }

/* Sub-heading above a nested step list */
.sub-head { margin-top: var(--space-6); margin-bottom: var(--space-3); max-width: var(--measure); }
.sub-head h3 { margin-bottom: 4px; }
.sub-head p { font-size: 0.945rem; text-wrap: pretty; }
.sub-note { max-width: var(--measure); margin-top: var(--space-4); font-size: 0.945rem; color: var(--text-faint); text-wrap: pretty; }

kbd {
  display: inline-block; padding: 1px 7px; margin: 0 1px;
  background: var(--bg-inset); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 6px;
  font-family: var(--font-mono); font-size: 0.86em; font-weight: 600; color: var(--text);
  white-space: nowrap;
}

code {
  padding: 2px 8px; border-radius: 6px;
  background: var(--bg-inset); border: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 0.86em; color: var(--accent3);
  overflow-wrap: break-word;
}

/* Numbered variant for step-by-step lists */
.bullets.numbered { counter-reset: step; gap: var(--space-3); }
.bullets.numbered li { padding-left: 46px; counter-increment: step; }
.bullets.numbered li::before {
  content: counter(step);
  left: 0; top: -0.05em; width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  /* Purple end only — white reads poorly against the pink end of --grad. */
  background: linear-gradient(140deg, #9a55ff, #7a2bf0);
  font-family: var(--font-mono); font-size: 1rem; font-weight: 700; line-height: 1; color: #fff;
  box-shadow: 0 6px 16px -6px var(--glow);
}

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.info-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-5); }
.info-card .iw { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(100deg, rgba(139,61,255,0.22), rgba(255,63,142,0.22)); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-4); }
.info-card .iw svg { width: 21px; height: 21px; stroke: var(--accent3); }
.info-card p { font-size: 1rem; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border-strong); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 580px; }
th, td { text-align: left; padding: 13px 16px; font-size: 0.94rem; border-bottom: 1px solid var(--border); }
th { background: var(--bg-card); color: var(--text-muted); font-weight: 650; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
td { color: var(--text); }
tr:last-child td { border-bottom: none; }
td.mono, th.mono { font-family: var(--font-mono); }

.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.tool-tile { display: block; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-5); transition: border-color 150ms ease, transform 150ms ease; }
.tool-tile:hover { border-color: rgba(255,63,142,0.35); transform: translateY(-2px); box-shadow: 0 14px 40px -18px var(--glow); }
.tool-tile .iw { width: 40px; height: 40px; border-radius: 11px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-3); }
.tool-tile .iw svg { width: 20px; height: 20px; stroke: var(--accent3); }
.tool-tile h3 { font-size: 1.06rem; margin-bottom: 3px; color: var(--text); }
.tool-tile p { font-size: 0.945rem; margin: 0; }
.tool-tile .tag { display: inline-block; margin-top: var(--space-3); font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }

.faq-item { border-bottom: 1px solid var(--border-soft); }
.faq-item:first-child { border-top: 1px solid var(--border-soft); }
.faq-q { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) 0; cursor: pointer; font-size: 1.06rem; font-weight: 650; color: var(--text); list-style: none; min-height: 44px; }
.faq-q::-webkit-details-marker { display: none; }
.faq-q svg { flex-shrink: 0; width: 18px; height: 18px; stroke: var(--text-faint); transition: transform 200ms ease; }
.faq-item[open] .faq-q svg { transform: rotate(45deg); }
.faq-a { padding-bottom: var(--space-4); font-size: 1rem; line-height: 1.8; }
.faq-a a { text-decoration: underline; }

.callout { display: flex; gap: var(--space-3); background: color-mix(in srgb, var(--ok) 9%, var(--bg-card)); border: 1px solid color-mix(in srgb, var(--ok) 32%, transparent); border-radius: var(--radius); padding: var(--space-4) var(--space-5); }
.callout svg { flex-shrink: 0; width: 21px; height: 21px; stroke: var(--ok); margin-top: 3px; }
.callout strong { color: var(--text); }
.callout p { font-size: 1rem; margin: 0; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border-soft); padding: var(--space-7) 0 var(--space-5); margin-top: var(--space-6); }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: var(--space-6); margin-bottom: var(--space-5); }
.footer-col h4 { font-size: 0.84rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: var(--space-3); }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.footer-col a { color: var(--text-muted); font-size: 0.95rem; }
.footer-col a:hover { color: var(--accent2); }
.footer-col p { font-size: 0.945rem; max-width: 300px; }
.footer-bottom { display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding-top: var(--space-4); border-top: 1px solid var(--border-soft); font-size: 0.89rem; color: var(--text-faint); }

/* ---------- eDPI calculator ---------- */
.calc-body { padding: var(--space-5); display: grid; gap: var(--space-5); }
.seg.seg-wrap { flex-wrap: wrap; }
.seg.seg-wrap button { font-family: var(--font-ui); }

.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); }
.field.is-derived .input { color: var(--accent3); border-color: var(--accent3); background: var(--accent-soft); }

.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: var(--space-2); }
.chip-row button {
  min-height: 34px; padding: 0 12px; border-radius: 8px; cursor: pointer;
  background: var(--bg-inset); border: 1px solid var(--border-soft); color: var(--text-faint);
  font-family: var(--font-mono); font-size: 0.85rem;
  transition: color 150ms ease, border-color 150ms ease;
}
.chip-row button:hover { color: var(--text); border-color: var(--accent3); }
.chip-row button[aria-pressed="true"] { color: var(--text); border-color: var(--accent3); box-shadow: inset 0 0 0 1px var(--accent3); }

.slider { width: 100%; height: 28px; margin-top: var(--space-2); accent-color: var(--accent); cursor: pointer; }

.calc-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  flex-wrap: wrap; padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-soft); background: var(--bg-inset);
  border-radius: 0 0 var(--radius) var(--radius);
}
.calc-foot .ctl-help { margin: 0; }

/* Range bar reuses the tolerance bar, with competitive-range zones. */
.tol-bar.range .z1 { width: 32%; background: var(--accent3); }
.tol-bar.range .z2 { width: 36%; background: var(--good); }
.tol-bar.range .z3 { width: 32%; background: var(--accent2); }

.turn-note { font-size: 0.86rem; color: var(--text-faint); text-align: center; }

/* ---------- Polling rate test: interval distribution bars ---------- */
.hz-bars { display: flex; flex-direction: column; gap: 6px; }
.hz-row { display: grid; grid-template-columns: 58px 1fr 40px; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 0.8rem; }
.hz-row .hz-label { color: var(--text-faint); }
.hz-row .hz-track { position: relative; height: 8px; border-radius: 999px; background: var(--bg-inset); border: 1px solid var(--border-soft); overflow: hidden; }
.hz-row .hz-fill { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--grad); border-radius: 999px; transition: width 260ms ease; }
.hz-row .hz-pct { text-align: right; color: var(--text-muted); }

/* ---------- Sensitivity converter: From / To panels ---------- */
.conv-group-label {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.78rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent3);
  margin-bottom: var(--space-3);
}
.conv-group-label .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--grad); }
.conv-divider { display: flex; align-items: center; gap: var(--space-3); margin: 2px 0; }
.conv-divider::before, .conv-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.conv-swap {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-inset); border: 1px solid var(--border); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, transform 200ms ease, box-shadow 150ms ease;
}
.conv-swap:hover { color: var(--accent3); border-color: var(--accent3); box-shadow: 0 0 20px -8px var(--glow); transform: rotate(180deg); }
.conv-swap svg { width: 17px; height: 17px; }

.run-item .run-x {
  background: none; border: none; color: var(--text-faint); cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 8px; margin: -8px -4px -8px 0; border-radius: 6px;
}
.run-item .run-x:hover { color: var(--accent2); }
.run-item .rv .rt { font-weight: 400; }

/* ---------- Double-click test: click target + flags ---------- */
.click-target {
  position: relative; z-index: 2; width: 164px; height: 164px; border-radius: 50%;
  border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; background: var(--grad); color: #fff; box-shadow: 0 14px 40px -12px var(--glow);
  font-family: var(--font-mono); user-select: none; -webkit-user-select: none;
  transition: transform 90ms ease;
}
.click-target:active { transform: scale(0.95); }
.click-target:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.click-target .ct-big { font-size: 2.15rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.click-target .ct-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.85; }
.click-target[hidden] { display: none; }
.click-target.flash { animation: ctFlash 240ms ease; }
.click-target.chatter-flash { animation: ctChatter 420ms ease; }
@keyframes ctFlash {
  0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.35), 0 14px 40px -12px var(--glow); }
  100% { box-shadow: 0 0 0 20px rgba(255,255,255,0), 0 14px 40px -12px var(--glow); }
}
@keyframes ctChatter {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.07); box-shadow: 0 0 0 0 rgba(255,63,142,0.7), 0 14px 40px -12px var(--glow); }
  70% { transform: scale(0.95); }
}
.hz-row.flagged .hz-label { color: var(--bad); }
.hz-row.flagged .hz-fill { background: var(--bad); }
.mode-note {
  display: flex; gap: 9px; align-items: flex-start; margin-top: var(--space-3);
  padding: var(--space-3); background: color-mix(in srgb, var(--bad) 10%, var(--bg-inset));
  border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--border-soft));
  border-radius: var(--radius-sm); font-size: 0.84rem; color: var(--text-muted);
}
.mode-note svg { width: 16px; height: 16px; flex-shrink: 0; stroke: var(--bad); margin-top: 1px; }
.mode-note[hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1060px) {
  .workspace { grid-template-columns: 1fr; }
  .result-panel { position: static; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
  .main-nav { display: none; }
  .nav-toggle { display: flex; }
  .flow { grid-template-columns: 1fr; gap: var(--space-3); }
  .flow-arrow { display: none; }
  .controls { grid-template-columns: 1fr; gap: var(--space-4); }
  .steps, .card-grid, .tools-grid, .quick-links { grid-template-columns: 1fr 1fr; }
  .calc-grid { grid-template-columns: 1fr; gap: var(--space-4); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .split-row { grid-template-columns: 1fr; }
  .split-media { order: -1; max-width: 552px; }
}
@media (max-width: 620px) {
  .steps, .card-grid, .tools-grid, .quick-links, .footer-grid, .stat-grid, .btn-row { grid-template-columns: 1fr; }
  .stage { margin: var(--space-4); padding: var(--space-5) var(--space-4); }
  h1 span { white-space: normal; }
  .ruler-unit { display: none; }
  .live-strip { flex-direction: column; align-items: center; gap: 4px; }
  .click-target { width: 132px; height: 132px; }
  .click-target .ct-big { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
