/* ============================================================================
   KEDGE — design system · Manrope · Hitachi-inspired light/dark · Lucide icons
   Self-contained: local fonts, inline SVG, zero external assets.
   ========================================================================== */

@font-face { font-family: "Manrope"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/manrope-400.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/manrope-500.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/manrope-600.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/manrope-700.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 800; font-style: normal; font-display: swap; src: url("../fonts/manrope-800.woff2") format("woff2"); }

/* ---------------- Theme tokens ---------------- */
:root, [data-theme="light"] {
  --bg-0: #e9ecf1; --bg-1: #f5f6f9; --bg-2: #ffffff;
  --surface: #ffffff; --surface-2: #eef1f5; --hairline: #e2e6ec; --hairline-2: #cdd4de;
  --ink: #11151b; --ink-muted: #50606f; --ink-dim: #8895a3;
  --accent: #e60027; --accent-2: #ff3a59; --accent-ink: #ffffff;
  --accent-tint: rgba(230, 0, 39, 0.07); --accent-line: rgba(230, 0, 39, 0.28);
  --grid: rgba(17, 21, 27, 0.10);
  --doc-bg: #f4f6f9; --doc-ink: #2a313b;
  --cyan: #1577c2; --teal: #00897e; --green: #12996b; --amber: #b8730a; --violet: #6b4eff; --red: #e60027;
  --topbar-bg: rgba(255, 255, 255, 0.82);
  --shadow: 0 18px 44px -24px rgba(20, 30, 50, 0.28);
  --glow: radial-gradient(1100px 620px at 82% -12%, rgba(230, 0, 39, 0.07), transparent 60%),
          radial-gradient(820px 560px at 8% 112%, rgba(21, 119, 194, 0.06), transparent 55%);
}
[data-theme="dark"] {
  --bg-0: #0a0c10; --bg-1: #11141a; --bg-2: #181c24;
  --surface: rgba(255, 255, 255, 0.045); --surface-2: rgba(255, 255, 255, 0.08);
  --hairline: rgba(255, 255, 255, 0.10); --hairline-2: rgba(255, 255, 255, 0.18);
  --ink: #eef2f7; --ink-muted: #9aa7b6; --ink-dim: #5f6c7c;
  --accent: #ff2a44; --accent-2: #ff5c70; --accent-ink: #ffffff;
  --accent-tint: rgba(255, 42, 68, 0.12); --accent-line: rgba(255, 42, 68, 0.38);
  --grid: rgba(255, 255, 255, 0.09);
  --doc-bg: #0b0f15; --doc-ink: #c8d2de;
  --cyan: #4cc4f0; --teal: #2bd4cf; --green: #2dd29c; --amber: #f5b945; --violet: #9d8df1; --red: #ff5c5c;
  --topbar-bg: rgba(10, 12, 16, 0.78);
  --shadow: 0 24px 60px -26px rgba(0, 0, 0, 0.7);
  --glow: radial-gradient(1100px 620px at 82% -12%, rgba(255, 42, 68, 0.12), transparent 60%),
          radial-gradient(820px 560px at 8% 112%, rgba(76, 196, 240, 0.08), transparent 55%);
}

/* legacy aliases so accent flows everywhere */
:root { --brass: var(--accent); --brass-soft: var(--accent-2); --r-sm: 10px; --r-md: 16px; --r-lg: 22px;
  --maxw: 1180px; --font: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink);
  background: var(--glow), linear-gradient(168deg, var(--bg-1), var(--bg-0));
  background-attachment: fixed; -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100dvh; letter-spacing: 0.1px;
  transition: background 0.4s, color 0.3s;
}
.ic { display: inline-block; vertical-align: middle; flex: none; }

/* ---------------- Top bar ---------------- */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; padding: 0.8rem 1.6rem;
  border-bottom: 1px solid var(--hairline); background: var(--topbar-bg);
  backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; user-select: none; }
.brand-anchor { color: var(--accent); display: flex; }
.brand-word { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.2px; }
.brand-sub { font-size: 0.66rem; color: var(--ink-dim); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; align-self: center; }

.stagenav { display: flex; gap: 0.2rem; margin: 0 auto; flex-wrap: wrap; justify-content: center; }
.stagenav button {
  font: inherit; font-size: 0.73rem; font-weight: 600; color: var(--ink-muted);
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  padding: 0.35rem 0.7rem; cursor: pointer; transition: all 0.18s; white-space: nowrap;
}
.stagenav button:hover { color: var(--ink); background: var(--surface-2); }
.stagenav button.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 700; }

.topbar-right { display: flex; align-items: center; gap: 0.6rem; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--hairline-2); color: var(--ink-muted);
  cursor: pointer; transition: all 0.16s;
}
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.ai-toggle { display: flex; align-items: center; gap: 0.45rem; cursor: pointer; user-select: none; }
.ai-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.ai-toggle-track { width: 38px; height: 22px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--hairline-2); position: relative; transition: background 0.2s; }
.ai-toggle-dot { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-dim); transition: transform 0.2s, background 0.2s; }
.ai-toggle input:checked + .ai-toggle-track { background: var(--accent-tint); }
.ai-toggle input:checked + .ai-toggle-track .ai-toggle-dot { transform: translateX(16px); background: var(--accent); }
.ai-toggle-label { font-size: 0.74rem; color: var(--ink-muted); font-weight: 600; }
.ai-badge { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; padding: 0.25rem 0.55rem; border-radius: 999px; border: 1px solid var(--hairline-2); color: var(--ink-muted); }
.ai-badge[data-mode="live"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-tint); }
.ai-badge[data-mode="thinking"] { color: var(--amber); border-color: rgba(184, 115, 10, 0.4); }

/* ---------------- Stage host ---------------- */
#stagehost { flex: 1; width: 100%; }
.stage { max-width: var(--maxw); margin: 0 auto; padding: 2.6rem 1.6rem 3rem; animation: stageIn 0.45s cubic-bezier(0.22, 0.61, 0.36, 1); }
@keyframes stageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.stage-head { margin-bottom: 1.8rem; }
.stage-tag { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.stage-tag .ic { color: var(--accent); }
.stage-head h2 { font-size: 2rem; font-weight: 800; margin: 0.55rem 0 0.6rem; line-height: 1.14; letter-spacing: -0.5px; }
.stage-head h2 em { color: var(--accent); font-style: normal; }
.stage-lede { font-size: 1rem; color: var(--ink-muted); max-width: 64ch; line-height: 1.55; margin: 0; }
.stage-actions { margin-top: 2rem; display: flex; gap: 0.8rem; flex-wrap: wrap; }

/* ---------------- Buttons ---------------- */
.btn { font: inherit; font-weight: 700; font-size: 0.92rem; cursor: pointer; border-radius: var(--r-sm); padding: 0.72rem 1.25rem; border: 1px solid transparent; transition: transform 0.12s, box-shadow 0.18s, background 0.18s; display: inline-flex; align-items: center; gap: 0.5rem; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 24px -10px var(--accent-line); }
.btn-primary:hover { background: var(--accent-2); box-shadow: 0 14px 28px -8px var(--accent-line); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--hairline-2); }
.btn-ghost:hover { background: var(--surface-2); }

/* ---------------- Cover ---------------- */
.stage-cover { position: relative; text-align: center; max-width: 920px; padding-top: 3.6rem; }
.cover-grid { position: fixed; inset: 0; z-index: -1; opacity: 0.7; background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 48px 48px; -webkit-mask-image: radial-gradient(circle at 50% 28%, black, transparent 72%); mask-image: radial-gradient(circle at 50% 28%, black, transparent 72%); }
.kicker { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.74rem; letter-spacing: 3px; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.cover-anchor { width: 60px; height: 60px; color: var(--accent); margin: 1.4rem auto 0.7rem; display: flex; justify-content: center; animation: drop 1s cubic-bezier(0.22, 0.61, 0.36, 1); }
.cover-anchor .ic { width: 60px; height: 60px; }
@keyframes drop { from { transform: translateY(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
.cover-title { font-size: 5rem; font-weight: 800; margin: 0.2rem 0 0; letter-spacing: -2px; }
.cover-title .word { background: linear-gradient(135deg, var(--ink) 30%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cover-tagline { font-size: 1.08rem; color: var(--ink); max-width: 60ch; margin: 1.2rem auto 0; line-height: 1.6; }
.cover-tagline em { color: var(--accent); font-style: italic; font-weight: 600; }
.cover-lede { font-size: 0.98rem; color: var(--ink-muted); max-width: 56ch; margin: 0.8rem auto 0; line-height: 1.55; }
.cover-cta { margin-top: 2rem; display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.cover-foot { margin-top: 1.6rem; font-size: 0.72rem; color: var(--ink-dim); letter-spacing: 0.4px; }

/* ---------------- 1 · Problem ---------------- */
.problem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.board-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 1.3rem; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.board-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); opacity: 0.75; }
.board-rank { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); font-weight: 700; }
.board-card h3 { margin: 0.5rem 0 0.2rem; font-size: 1.05rem; font-weight: 700; }
.board-card .ttl { font-size: 0.82rem; color: var(--ink-muted); }
.board-meta { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.9rem; }
.tag { font-size: 0.68rem; padding: 0.22rem 0.55rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--hairline); color: var(--ink-muted); font-weight: 600; }
.tag.warn { color: var(--accent); border-color: var(--accent-line); background: var(--accent-tint); }
.problem-callout { margin-top: 1.5rem; padding: 1.2rem 1.4rem; border-radius: var(--r-md); background: var(--accent-tint); border: 1px solid var(--accent-line); color: var(--ink); font-size: 0.95rem; line-height: 1.55; }
.problem-callout strong { color: var(--accent); }

/* ---------------- 2 · Anonymization ---------------- */
.anon-wrap { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.4rem; align-items: start; }
.anon-doc { background: var(--doc-bg); border: 1px solid var(--hairline-2); border-radius: var(--r-md); padding: 1.6rem 1.7rem; font-size: 1rem; line-height: 1.95; min-height: 260px; font-family: var(--mono); color: var(--doc-ink); }
.tok { transition: all 0.4s; }
.tok-redactable { background: var(--surface-2); border-radius: 4px; padding: 0 3px; }
.tok-redacted { border-radius: 4px; padding: 0.05em 0.35em; font-weight: 700; font-family: var(--font); font-size: 0.85rem; box-shadow: inset 0 0 0 1px currentColor; background: var(--surface-2); }
.cls-name.tok-redacted, .cls-pronoun.tok-redacted { color: var(--cyan); }
.cls-pedigree.tok-redacted { color: var(--violet); }
.cls-tenure.tok-redacted { color: var(--amber); }
.cls-role.tok-redacted { color: var(--teal); }
.anon-side { display: flex; flex-direction: column; gap: 1.1rem; }
.anon-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.82rem; color: var(--ink-muted); }
.anon-legend li { display: flex; align-items: center; gap: 0.55rem; }
.chip { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.chip-name { background: var(--cyan); } .chip-pedigree { background: var(--violet); }
.chip-tenure { background: var(--amber); } .chip-role { background: var(--teal); }
.anon-meter { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 1rem; box-shadow: var(--shadow); }
.anon-meter-row { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--ink-muted); margin-bottom: 0.5rem; }
.anon-meter-row strong { color: var(--green); font-size: 1.1rem; }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--green)); transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1); }
.anon-note { font-size: 0.76rem; color: var(--ink-dim); line-height: 1.5; margin: 0; }

/* ---------------- 3 · Roster ---------------- */
.roster-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.cand-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 1.1rem; cursor: pointer; transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; position: relative; box-shadow: var(--shadow); }
.cand-card:hover { transform: translateY(-3px); border-color: var(--accent-line); }
.cand-avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 0.95rem; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.cand-code { font-size: 0.92rem; font-weight: 700; margin: 0.7rem 0 0.1rem; }
.cand-ttl { font-size: 0.72rem; color: var(--ink-muted); line-height: 1.4; min-height: 2.5em; }
.cand-fit { display: flex; align-items: baseline; gap: 0.3rem; margin-top: 0.8rem; }
.cand-fit b { font-size: 1.6rem; font-weight: 800; color: var(--accent); }
.cand-fit span { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-dim); font-weight: 600; }
.cand-arche { margin-top: 0.5rem; font-size: 0.68rem; color: var(--ink-muted); }
.cand-arche b { color: var(--teal); font-weight: 700; }
.cand-flag { position: absolute; top: 0.9rem; right: 0.9rem; font-size: 0.58rem; padding: 0.2rem 0.45rem; border-radius: 999px; font-weight: 700; letter-spacing: 0.5px; }
.cand-flag.board { background: var(--accent-tint); color: var(--accent); border: 1px solid var(--accent-line); }

/* Candidate detail drawer */
.drawer-back { position: fixed; inset: 0; background: rgba(3, 8, 16, 0.5); backdrop-filter: blur(4px); z-index: 60; display: none; }
.drawer-back.open { display: block; }
.drawer { position: fixed; top: 0; right: 0; height: 100dvh; width: min(440px, 92vw); z-index: 61; background: var(--bg-2); border-left: 1px solid var(--hairline-2); box-shadow: -30px 0 60px -20px rgba(0, 0, 0, 0.35); padding: 1.8rem; overflow-y: auto; transform: translateX(100%); transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1); }
.drawer.open { transform: none; }
.drawer-close { position: absolute; top: 1.2rem; right: 1.2rem; background: var(--surface); border: 1px solid var(--hairline); color: var(--ink); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; display: grid; place-items: center; }
.drawer h3 { margin: 0.4rem 0 0.2rem; font-size: 1.3rem; font-weight: 800; }
.drawer .ttl { color: var(--ink-muted); font-size: 0.85rem; }
.score-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: 0.7rem 0; }
.score-row .lbl { font-size: 0.8rem; color: var(--ink-muted); min-width: 120px; }
.score-row .bar { flex: 1; }
.score-row .val { font-size: 0.85rem; font-weight: 700; min-width: 28px; text-align: right; }
.drawer h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); margin: 1.4rem 0 0.5rem; }
.drawer ul { margin: 0; padding-left: 1.1rem; font-size: 0.85rem; color: var(--ink-muted); line-height: 1.55; }
.drawer ul li { margin-bottom: 0.4rem; }

/* ---------------- 4 · Crisis simulation ---------------- */
.sim { max-width: 760px; }
.sim-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 1.6rem 1.7rem; box-shadow: var(--shadow); }
.sim-clock { font-family: var(--mono); font-size: 0.78rem; color: var(--accent); letter-spacing: 1px; font-weight: 600; }
.sim-mail { display: flex; gap: 0.7rem; align-items: flex-start; margin: 1rem 0 0.4rem; }
.sim-from { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-dim); font-weight: 600; }
.sim-subject { font-size: 1.12rem; font-weight: 700; line-height: 1.35; margin-top: 0.2rem; }
.sim-prompt { font-size: 0.92rem; color: var(--ink-muted); margin: 0.9rem 0 1.1rem; }
.sim-opts { display: flex; flex-direction: column; gap: 0.7rem; }
.sim-opt { text-align: left; font: inherit; font-size: 0.9rem; color: var(--ink); cursor: pointer; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 0.85rem 1rem; transition: all 0.15s; line-height: 1.4; }
.sim-opt:hover { border-color: var(--accent); background: var(--accent-tint); }
.sim-opt .tag-line { display: block; font-size: 0.76rem; color: var(--ink-dim); margin-top: 0.4rem; opacity: 0; max-height: 0; overflow: hidden; transition: all 0.3s; }
.sim-opt.chosen { border-color: var(--accent); background: var(--accent-tint); }
.sim-opt.chosen .tag-line { opacity: 1; max-height: 60px; color: var(--ink-muted); }
.sim-opt.dim { opacity: 0.4; }
.sim-progress { display: flex; gap: 0.4rem; margin-bottom: 1.2rem; }
.sim-pip { height: 4px; flex: 1; border-radius: 999px; background: var(--surface-2); }
.sim-pip.done { background: var(--accent); }
.sim-result { text-align: center; }
.sim-gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1.6rem 0; }
.gauge { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 1.2rem 0.8rem; }
.gauge .num { font-size: 2.4rem; font-weight: 800; line-height: 1; }
.gauge .lbl { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-muted); margin-top: 0.4rem; font-weight: 600; }
.sim-band { font-size: 1.3rem; font-weight: 800; margin-top: 0.5rem; }
.sim-vs { margin-top: 1.4rem; font-size: 0.88rem; color: var(--ink-muted); line-height: 1.55; }
.sim-vs b { color: var(--accent); }

/* ---------------- 5 · Matrix (radar) ---------------- */
.matrix-wrap { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 1.6rem; align-items: start; }
.radar-panel, .archetype-panel { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 1.4rem; box-shadow: var(--shadow); }
#radar svg { width: 100%; height: auto; display: block; }
.radar-legend { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 0.8rem; }
.legend-pill { font-size: 0.74rem; padding: 0.3rem 0.7rem; border-radius: 999px; border: 1px solid var(--hairline-2); cursor: pointer; display: flex; align-items: center; gap: 0.4rem; transition: all 0.15s; color: var(--ink-muted); font-weight: 600; }
.legend-pill.on { color: var(--ink); background: var(--surface-2); }
.legend-pill .dot { width: 9px; height: 9px; border-radius: 50%; }
.archetype-panel h4 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); margin: 0 0 0.3rem; display: flex; align-items: center; gap: 0.4rem; }
.arche-need { font-size: 0.84rem; color: var(--ink-muted); line-height: 1.5; margin-bottom: 1.1rem; }
.arche-row { margin: 0.9rem 0; }
.arche-row .top { display: flex; justify-content: space-between; font-size: 0.84rem; margin-bottom: 0.35rem; }
.arche-row .top .name { font-weight: 700; }
.arche-row .top .pct { color: var(--ink-muted); }
.arche-bar { height: 9px; background: var(--surface-2); border-radius: 999px; overflow: hidden; position: relative; }
.arche-bar > i { display: block; height: 100%; border-radius: 999px; transition: width 0.7s; }
.arche-need-mark { position: absolute; top: -3px; width: 2px; height: 15px; background: var(--ink); opacity: 0.85; }

/* ---------------- 6 · Reveal ---------------- */
.reveal-wrap { display: grid; grid-template-columns: 1.2fr 0.9fr; gap: 1.6rem; align-items: start; }
.reveal-rank { list-style: none; margin: 0; padding: 0; }
.reveal-item { display: grid; grid-template-columns: 36px 1fr auto auto; gap: 0.9rem; align-items: center; padding: 0.85rem 1rem; border-radius: var(--r-md); margin-bottom: 0.55rem; background: var(--surface); border: 1px solid var(--hairline); box-shadow: var(--shadow); animation: revealIn 0.5s both; }
@keyframes revealIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
.reveal-item.is-dark { border-color: var(--accent); background: var(--accent-tint); box-shadow: 0 0 0 1px var(--accent-line), var(--shadow); }
.reveal-pos { font-size: 1.3rem; font-weight: 800; color: var(--ink-dim); text-align: center; }
.reveal-item.is-dark .reveal-pos { color: var(--accent); }
.reveal-name { font-weight: 700; font-size: 0.95rem; }
.reveal-name small { display: block; font-weight: 500; color: var(--ink-muted); font-size: 0.74rem; }
.reveal-board { font-size: 0.68rem; padding: 0.22rem 0.55rem; border-radius: 999px; border: 1px solid var(--hairline-2); color: var(--ink-muted); white-space: nowrap; font-weight: 600; }
.reveal-board.up { color: var(--green); border-color: rgba(18, 153, 107, 0.4); }
.reveal-board.down { color: var(--accent); border-color: var(--accent-line); }
.reveal-fit { font-size: 1.25rem; font-weight: 800; color: var(--accent); }
.darkhorse { background: linear-gradient(160deg, var(--accent-tint), var(--surface)); border: 1px solid var(--accent-line); border-radius: var(--r-lg); padding: 1.5rem; box-shadow: var(--shadow); }
.darkhorse .dh-tag { display: flex; align-items: center; gap: 0.5rem; font-size: 0.7rem; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.darkhorse h3 { font-size: 1.5rem; margin: 0.5rem 0 0.1rem; font-weight: 800; }
.darkhorse .dh-ttl { color: var(--ink-muted); font-size: 0.85rem; }
.darkhorse p { font-size: 0.88rem; color: var(--ink); line-height: 1.6; margin: 1rem 0 0; }
.darkhorse .dh-stats { display: flex; gap: 1.2rem; margin-top: 1.2rem; }
.dh-stat .n { font-size: 1.9rem; font-weight: 800; color: var(--accent); }
.dh-stat .l { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-muted); font-weight: 600; }

/* ---------------- 7 · Audit ---------------- */
.audit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.audit-card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 1.5rem; box-shadow: var(--shadow); }
.audit-card h3 { font-size: 1rem; margin: 0 0 0.3rem; font-weight: 700; }
.audit-card .sub { font-size: 0.78rem; color: var(--ink-muted); margin-bottom: 1.2rem; }
.hub-row { display: grid; grid-template-columns: 130px 1fr 1fr; gap: 0.8rem; align-items: center; margin: 0.7rem 0; font-size: 0.8rem; }
.hub-row .hub-name { color: var(--ink-muted); }
.minibar { height: 22px; background: var(--surface-2); border-radius: 6px; position: relative; overflow: hidden; }
.minibar > i { display: block; height: 100%; transition: width 0.7s; }
.minibar.before > i { background: var(--accent); opacity: 0.75; }
.minibar.after > i { background: var(--green); }
.minibar span { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 0.68rem; font-weight: 700; color: var(--ink); }
.air-stat { text-align: center; padding: 1rem 0; }
.air-stat .big { font-size: 3rem; font-weight: 800; }
.air-stat .lbl { font-size: 0.78rem; color: var(--ink-muted); }
.air-flag { margin-top: 0.8rem; font-size: 0.82rem; padding: 0.7rem 0.9rem; border-radius: var(--r-sm); line-height: 1.5; }
.air-flag.ok { background: rgba(18, 153, 107, 0.1); border: 1px solid rgba(18, 153, 107, 0.35); color: var(--green); }
.air-flag.warn { background: var(--accent-tint); border: 1px solid var(--accent-line); color: var(--accent); }
.safeguard { margin-top: 1.5rem; padding: 1.3rem 1.5rem; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--hairline-2); box-shadow: var(--shadow); }
.safeguard h4 { margin: 0 0 0.5rem; font-size: 0.95rem; color: var(--accent); display: flex; align-items: center; gap: 0.5rem; }
.safeguard p { margin: 0; font-size: 0.9rem; line-height: 1.6; color: var(--ink); }

/* ---------------- Footer / progress ---------------- */
.footbar { position: sticky; bottom: 0; z-index: 30; display: flex; align-items: center; gap: 1rem; justify-content: center; padding: 0.65rem 1.6rem; border-top: 1px solid var(--hairline); background: var(--topbar-bg); backdrop-filter: blur(14px); }
.navbtn { width: 36px; height: 36px; border-radius: 10px; background: var(--surface); border: 1px solid var(--hairline-2); color: var(--ink); cursor: pointer; transition: background 0.15s; display: grid; place-items: center; }
.navbtn:hover { background: var(--surface-2); }
.navbtn:disabled { opacity: 0.3; cursor: default; }
.progress { display: flex; gap: 0.5rem; }
.progress .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--hairline-2); cursor: pointer; transition: all 0.2s; }
.progress .dot.active { background: var(--accent); border-color: var(--accent); transform: scale(1.25); }
.progress .dot.seen { background: var(--ink-dim); }

/* ---------------- Settings modal ---------------- */
.modal-back { position: fixed; inset: 0; z-index: 70; background: rgba(3, 8, 16, 0.55); backdrop-filter: blur(5px); display: grid; place-items: center; padding: 1.2rem; animation: fadeIn 0.2s; }
.modal-back[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { position: relative; width: min(520px, 96vw); max-height: 92dvh; overflow-y: auto; background: var(--bg-2); border: 1px solid var(--hairline-2); border-radius: var(--r-lg); padding: 1.7rem; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 0.5rem; font-size: 1.25rem; font-weight: 800; display: flex; align-items: center; gap: 0.5rem; }
.modal h3 .ic { color: var(--accent); }
.modal-sub { font-size: 0.84rem; color: var(--ink-muted); line-height: 1.55; margin: 0 0 1.2rem; }
.modal-sub strong { color: var(--ink); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-bottom: 1.2rem; }
.seg button { font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 0.15rem; align-items: flex-start; text-align: left; font-size: 0.82rem; font-weight: 700; color: var(--ink); background: var(--surface); border: 1px solid var(--hairline-2); border-radius: var(--r-sm); padding: 0.7rem 0.8rem; transition: all 0.15s; }
.seg button small { font-weight: 500; font-size: 0.64rem; color: var(--ink-dim); }
.seg button:hover { border-color: var(--accent-line); }
.seg button.active { border-color: var(--accent); background: var(--accent-tint); color: var(--accent); }
.seg button.active small { color: var(--accent); }
.field { margin-bottom: 0.4rem; }
.field label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-muted); margin: 0.8rem 0 0.4rem; }
.field input { width: 100%; font: inherit; font-size: 0.9rem; color: var(--ink); background: var(--surface); border: 1px solid var(--hairline-2); border-radius: var(--r-sm); padding: 0.65rem 0.8rem; transition: border-color 0.15s; }
.field input:focus { outline: none; border-color: var(--accent); }
.field-note { font-size: 0.82rem; color: var(--ink-muted); line-height: 1.55; margin: 0.4rem 0; }
.field-note code, .modal-sub code { font-family: var(--mono); font-size: 0.82em; background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 5px; }
.field-link { display: inline-block; margin-top: 0.7rem; font-size: 0.78rem; color: var(--accent); text-decoration: none; font-weight: 600; }
.field-link:hover { text-decoration: underline; }
.modal-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.3rem; }
.test-out { margin-top: 1.1rem; padding: 1rem 1.1rem; border-radius: var(--r-md); font-size: 0.85rem; line-height: 1.55; border: 1px solid var(--hairline-2); background: var(--surface); }
.test-out[hidden] { display: none; }
.test-out.ok { border-color: rgba(18, 153, 107, 0.4); background: rgba(18, 153, 107, 0.08); }
.test-out.err { border-color: var(--accent-line); background: var(--accent-tint); }
.test-out .to-head { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.test-out.ok .to-head { color: var(--green); } .test-out.err .to-head { color: var(--accent); }
.test-out .to-score { font-size: 2rem; font-weight: 800; color: var(--accent); line-height: 1; margin: 0.3rem 0; }
.test-out .to-meta { color: var(--ink-muted); font-size: 0.78rem; }
.test-out code { font-family: var(--mono); font-size: 0.78rem; word-break: break-word; }
.spin { animation: spin 0.8s linear infinite; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- AI busy / thinking states ---------------- */
body.ai-busy .ai-badge { color: var(--accent); border-color: var(--accent-line); background: var(--accent-tint); animation: badgePulse 1.1s ease-in-out infinite; }
@keyframes badgePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.radar-panel { position: relative; }
.radar-panel::after {
  content: "Model is reasoning…"; position: absolute; top: 1rem; left: 50%; transform: translateX(-50%);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.4px; color: var(--accent);
  background: var(--accent-tint); border: 1px solid var(--accent-line); border-radius: 999px;
  padding: 0.3rem 0.8rem; opacity: 0; transition: opacity 0.25s; pointer-events: none;
  animation: badgePulse 1.1s ease-in-out infinite;
}
body.ai-busy .radar-panel::after { opacity: 1; }
#radar.radar-pulse svg { animation: radarPulse 0.7s cubic-bezier(0.22, 0.61, 0.36, 1); }
@keyframes radarPulse { 0% { opacity: 0.35; transform: scale(0.97); } 100% { opacity: 1; transform: scale(1); } }

.sim-grade-note { margin-top: 0.4rem; display: flex; flex-direction: column; gap: 0.5rem; text-align: left; }
.sim-grade-note .sg-row { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.84rem; line-height: 1.5; color: var(--ink-muted); padding: 0.6rem 0.8rem; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--hairline); }
.sim-grade-note .sg-row b { color: var(--ink); }
.sim-grade-note .sg-good { border-color: rgba(18, 153, 107, 0.3); } .sim-grade-note .sg-good .ic { color: var(--green); }
.sim-grade-note .sg-bad { border-color: var(--accent-line); } .sim-grade-note .sg-bad .ic { color: var(--accent); }

/* ---------------- Toast ---------------- */
.toast { position: fixed; bottom: 5rem; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--bg-2); color: var(--ink); border: 1px solid var(--hairline-2); border-radius: var(--r-sm); padding: 0.7rem 1.1rem; font-size: 0.85rem; box-shadow: var(--shadow); z-index: 80; opacity: 0; transition: opacity 0.25s, transform 0.25s; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.live { border-color: var(--accent-line); }

/* ---------------- Responsive ---------------- */
@media (max-width: 920px) {
  .stagenav { display: none; }
  .problem-grid, .roster-grid { grid-template-columns: 1fr 1fr; }
  .anon-wrap, .matrix-wrap, .reveal-wrap, .audit-grid { grid-template-columns: 1fr; }
  .cover-title { font-size: 3.4rem; }
  .stage-head h2 { font-size: 1.6rem; }
}
@media (max-width: 560px) {
  .problem-grid, .roster-grid { grid-template-columns: 1fr; }
  .sim-gauges { grid-template-columns: 1fr 1fr; }
  .stage { padding: 1.8rem 1.1rem 2.4rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
