/* ==========================================================================
   AES (Koi) Quest CTF — styles
   House palette inherited from Onboarder/public/discovery-lab.html
   ========================================================================== */

/* ------------------------------------------------------------- tokens */
:root {
  --bg: #0b1020; --bg-2: #0f172a; --bg-3: #131c33;
  --panel: #0f172a; --panel-2: #1a2439;
  --border: #1e293b; --border-2: #2a3852;
  --text: #e2e8f0; --text-dim: #94a3b8; --text-muted: #64748b;
  --heading: #f8fafc;
  --teal: #14b8a6; --teal-soft: rgba(20,184,166,0.12); --teal-line: rgba(20,184,166,0.4);
  --emerald: #10b981; --emerald-soft: rgba(16,185,129,0.14);
  --amber: #f59e0b; --amber-soft: rgba(245,158,11,0.13);
  --red: #ef4444; --red-soft: rgba(239,68,68,0.14);
  --blue: #3b82f6; --blue-soft: rgba(59,130,246,0.14);
  --purple: #8b5cf6; --purple-soft: rgba(139,92,246,0.14);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.4);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.3);
  --radius: 14px; --radius-sm: 9px;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: 'Cabinet Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --body: 'Satoshi', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;
  --focus: 0 0 0 3px rgba(20,184,166,0.45);
}
html[data-theme='light'] {
  --bg: #f6f8fc; --bg-2: #ffffff; --bg-3: #eef2f9;
  --panel: #ffffff; --panel-2: #f2f5fa;
  --border: #dde4ee; --border-2: #c8d3e3;
  --text: #1b2537; --text-dim: #4c5a70; --text-muted: #6b7a91;
  --heading: #0d1526;
  --teal: #0d9488; --teal-soft: rgba(13,148,136,0.1); --teal-line: rgba(13,148,136,0.35);
  --emerald: #059669; --emerald-soft: rgba(5,150,105,0.1);
  --amber: #b45309; --amber-soft: rgba(180,83,9,0.1);
  --red: #dc2626; --red-soft: rgba(220,38,38,0.1);
  --blue: #2563eb; --blue-soft: rgba(37,99,235,0.1);
  --purple: #7c3aed; --purple-soft: rgba(124,58,237,0.1);
  --shadow-lg: 0 18px 44px rgba(21,33,54,0.12);
  --shadow-md: 0 6px 18px rgba(21,33,54,0.08);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--body);
  background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.6; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}
h1, h2, h3, h4 { font-family: var(--display); color: var(--heading); letter-spacing: -0.02em; line-height: 1.15; font-weight: 700; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; font-size: 1rem; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select { font-family: inherit; font-size: 15px; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-ligatures: none; }
.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;
}
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; box-shadow: var(--focus); border-radius: 6px; }
.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 200;
  background: var(--panel); color: var(--text); padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border-2);
}
.skip-link:focus { left: 12px; }

/* ------------------------------------------------------------- layout */
.stage { max-width: 1180px; margin: 0 auto; padding: var(--sp-10) var(--sp-10) var(--sp-16); }
.stage-narrow { max-width: 900px; }
@media (max-width: 780px) { .stage { padding: var(--sp-6) var(--sp-5) var(--sp-12); } }
.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.35s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px var(--sp-10);
  display: flex; align-items: center; gap: var(--sp-6);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--teal); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { display: flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.brand-title { font-family: var(--display); font-size: 18px; font-weight: 800; color: var(--heading); letter-spacing: -0.01em; }
.brand-ctf { color: var(--teal); }
.brand-sub { font-family: var(--mono); font-size: 9.5px; color: var(--text-muted); letter-spacing: 0.13em; text-transform: uppercase; }
.topnav { display: flex; gap: 2px; flex: 1 1 auto; min-width: 0; justify-content: center; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav-btn {
  padding: 7px 10px; border-radius: 999px; font-size: 12.7px; font-weight: 500;
  color: var(--text-muted); white-space: nowrap; transition: all 0.18s ease;
  border: 1px solid transparent; flex: none;
}
.topnav-btn:hover { color: var(--text); background: var(--panel-2); }
.topnav-btn[aria-current='true'] { color: var(--teal); background: var(--teal-soft); border-color: var(--teal-line); }
.topbar-actions { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  font-size: 11px; color: var(--text-muted); border: 1px solid var(--border); background: var(--panel);
  white-space: nowrap;
}
.pill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.ghost-btn, .icon-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px;
  border-radius: 999px; font-size: 12.5px; color: var(--text-dim);
  border: 1px solid var(--border); background: var(--panel); transition: all 0.18s ease;
}
.ghost-btn:hover, .icon-btn:hover { color: var(--teal); border-color: var(--teal-line); }
.icon-btn { padding: 7px; }
.icon-sun { display: none; }
html[data-theme='light'] .icon-sun { display: block; }
html[data-theme='light'] .icon-moon { display: none; }

.event-strip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  max-width: 1180px; margin: 0 auto; padding: 7px var(--sp-10);
  font-size: 12px; color: var(--text-dim); border-top: 1px solid var(--border);
}
.event-strip .mono { color: var(--teal); font-size: 12px; }
.strip-sep { color: var(--text-muted); }
.strip-status {
  margin-left: auto; padding: 3px 9px; border-radius: 999px; font-size: 11px;
  background: var(--teal-soft); color: var(--teal); border: 1px solid var(--teal-line); text-transform: uppercase;
  letter-spacing: 0.07em; font-family: var(--mono);
}
@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; padding: 10px var(--sp-5); gap: var(--sp-3); }
  .topnav {
    order: 3; flex-basis: 100%; justify-content: flex-start;
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 88%, transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 88%, transparent 100%);
  }
  .event-strip { padding: 7px var(--sp-5); }
  .brand-sub { display: none; }
}

/* ------------------------------------------------------------- hero */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); }
.hero-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent 75%);
}
.hero-inner { position: relative; padding-top: var(--sp-16); padding-bottom: var(--sp-12); text-align: center; }
.eyebrow {
  display: inline-block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--teal); padding: 5px 12px; border-radius: 999px;
  background: var(--teal-soft); border: 1px solid var(--teal-line); margin-bottom: var(--sp-5);
}
.hero-title {
  font-size: clamp(34px, 5.4vw, 62px); font-weight: 800; line-height: 1.03;
  letter-spacing: -0.035em; margin-bottom: var(--sp-5); max-width: 17ch; margin-inline: auto;
}
.hero-title .accent { color: var(--teal); }
.hero-lead { font-size: clamp(15px, 1.5vw, 18px); color: var(--text-dim); max-width: 66ch; margin: 0 auto var(--sp-8); }
.hero-cta { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; margin-bottom: var(--sp-8); }
.hero-facts {
  display: flex; gap: var(--sp-6); justify-content: center; flex-wrap: wrap;
  font-size: 13px; color: var(--text-dim);
}
.hero-facts li { display: flex; align-items: baseline; gap: 7px; }
.hero-fact-num { font-size: 20px; font-weight: 600; color: var(--heading); }
.demo-note { font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); letter-spacing: 0.03em; margin-top: var(--sp-5); }

/* ------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 20px; border-radius: 999px; font-size: 14px; font-weight: 600;
  border: 1px solid transparent; transition: transform 0.15s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  text-align: center; line-height: 1.2;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary { background: var(--teal); color: #04211f; }
.btn-primary:hover:not(:disabled) { background: #17c9b6; }
html[data-theme='light'] .btn-primary { color: #ffffff; }
.btn-secondary { background: var(--panel-2); color: var(--text); border-color: var(--border-2); }
.btn-secondary:hover:not(:disabled) { border-color: var(--teal-line); color: var(--teal); }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--border-2); }
.btn-ghost:hover:not(:disabled) { color: var(--teal); border-color: var(--teal-line); }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.link-btn {
  font-size: 12.5px; color: var(--teal); border-bottom: 1px dotted var(--teal-line); padding-bottom: 1px;
}
.link-btn:hover { color: var(--heading); }

/* ------------------------------------------------------------- panels */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-6); box-shadow: var(--shadow-md);
}
.panel + .panel { margin-top: var(--sp-5); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.panel-title { font-size: 17px; margin-bottom: var(--sp-2); }
.panel-head .panel-title { margin-bottom: 0; }
.panel-lead { font-size: 14px; color: var(--text-dim); margin-bottom: var(--sp-4); }
.section-title {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--teal); margin: var(--sp-12) 0 var(--sp-3);
}
.section-lead { font-size: 14.5px; color: var(--text-dim); max-width: 70ch; margin-bottom: var(--sp-5); }
.screen-title { font-size: clamp(28px, 3.6vw, 40px); margin-bottom: var(--sp-3); }
.screen-lead { font-size: 15.5px; color: var(--text-dim); max-width: 72ch; margin-bottom: var(--sp-8); }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase;
  background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--border-2); white-space: nowrap;
}
.chip-teal { background: var(--teal-soft); color: var(--teal); border-color: var(--teal-line); }
.chip-red { background: var(--red-soft); color: var(--red); border-color: rgba(239,68,68,0.35); }
.chip-amber { background: var(--amber-soft); color: var(--amber); border-color: rgba(245,158,11,0.35); }
.chip-blue { background: var(--blue-soft); color: var(--blue); border-color: rgba(59,130,246,0.35); }
.chip-emerald { background: var(--emerald-soft); color: var(--emerald); border-color: rgba(16,185,129,0.35); }
.chip-purple { background: var(--purple-soft); color: var(--purple); border-color: rgba(139,92,246,0.35); }
.empty-state { font-size: 13.5px; color: var(--text-muted); padding: var(--sp-4) 0; }

/* flow steps */
.flow-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-bottom: var(--sp-12); }
.flow-step { padding: var(--sp-5); border: 1px solid var(--border); background: var(--panel); }
.flow-step + .flow-step { border-left: none; }
.flow-step:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.flow-step:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.flow-step-num { font-family: var(--mono); font-size: 11px; color: var(--teal); margin-bottom: 6px; }
.flow-step-name { font-weight: 600; color: var(--heading); font-size: 15px; margin-bottom: 4px; }
.flow-step-desc { font-size: 12.8px; color: var(--text-dim); line-height: 1.55; }
@media (max-width: 900px) {
  .flow-steps { grid-template-columns: 1fr 1fr; }
  .flow-step { border-radius: 0 !important; border-left: 1px solid var(--border) !important; }
  .flow-step:nth-child(n+3) { border-top: none; }
  .flow-step:nth-child(2), .flow-step:nth-child(4) { border-left: none !important; }
  .flow-step:first-child { border-radius: var(--radius) 0 0 0 !important; }
  .flow-step:last-child { border-radius: 0 0 var(--radius) 0 !important; }
}
@media (max-width: 560px) {
  .flow-steps { grid-template-columns: 1fr; }
  .flow-step { border-left: 1px solid var(--border) !important; border-top: none; }
  .flow-step:first-child { border-top: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0 !important; }
  .flow-step:last-child { border-radius: 0 0 var(--radius) var(--radius) !important; }
}

/* live lab */
.livelab { border-color: var(--teal-line); background: linear-gradient(180deg, var(--teal-soft), transparent 60%), var(--panel); }
.livelab-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.livelab-head .panel-title { margin-bottom: 0; }
.steps { display: grid; gap: var(--sp-4); }
.steps li { display: flex; gap: var(--sp-4); align-items: flex-start; }
.step-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
  background: var(--teal-soft); color: var(--teal); border: 1px solid var(--teal-line);
}
.step-title { font-weight: 600; color: var(--heading); font-size: 14.5px; margin-bottom: 3px; }
.step-desc { font-size: 13.5px; color: var(--text-dim); margin-bottom: var(--sp-3); }
.step-url { font-size: 11px; color: var(--text-muted); margin-top: var(--sp-3); overflow-wrap: anywhere; }
.steps-compact { gap: var(--sp-3); }

/* value grid */
.value-grid, .pillar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: var(--sp-4); }
@media (min-width: 1080px) { .value-grid, .pillar-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.value-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-5); display: flex; flex-direction: column; gap: 9px;
}
.value-card:hover { border-color: var(--border-2); }
.value-ico { width: 30px; height: 30px; color: var(--teal); }
.value-name { font-size: 15.5px; font-weight: 700; color: var(--heading); font-family: var(--display); }
.value-desc { font-size: 13.2px; color: var(--text-dim); }
.value-metric { font-family: var(--mono); font-size: 11.5px; color: var(--teal); margin-top: auto; padding-top: 6px; }
.value-play { font-size: 12.2px; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 9px; }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp-4); }
@media (min-width: 900px) { .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .kpi-wide { grid-column: span 2; } }
.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-5);
}
.kpi-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.kpi-value { font-family: var(--display); font-size: clamp(24px, 2.6vw, 32px); font-weight: 800; color: var(--heading); line-height: 1; letter-spacing: -0.03em; }
.kpi-sub { font-size: 12.3px; color: var(--text-dim); margin-top: 8px; }
.kpi.tone-red .kpi-value { color: var(--red); }
.kpi.tone-amber .kpi-value { color: var(--amber); }
.kpi.tone-teal .kpi-value { color: var(--teal); }
.kpi.tone-emerald .kpi-value { color: var(--emerald); }
.bar { height: 6px; border-radius: 999px; background: var(--bg-3); overflow: hidden; margin-top: 10px; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--teal); transition: width 0.6s ease; }
.bar.red > span { background: var(--red); } .bar.amber > span { background: var(--amber); }
.bar.blue > span { background: var(--blue); } .bar.emerald > span { background: var(--emerald); }
.stack-rows { display: grid; gap: 10px; margin-top: var(--sp-2); }
.stack-row { display: grid; grid-template-columns: 108px 1fr auto; gap: var(--sp-3); align-items: center; font-size: 12.8px; }
.stack-row .stack-label { color: var(--text-dim); }
.stack-row .stack-value { font-family: var(--mono); font-size: 12px; color: var(--heading); }

/* category grid */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--sp-3); }
.cat-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-4);
  background: var(--panel); display: flex; flex-direction: column; gap: 7px;
}
.cat-name { font-size: 13.6px; font-weight: 600; color: var(--heading); line-height: 1.35; }
.cat-meta { font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); }
.sev-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.sev-critical { background: var(--red); } .sev-high { background: var(--amber); }
.sev-medium { background: var(--blue); } .sev-low { background: var(--emerald); }

/* packs */
.packs-panel { margin-top: var(--sp-5); }
.pack-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-4); }
.pack-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-4); background: var(--bg-3); }
.pack-name { font-weight: 700; color: var(--heading); font-size: 15px; margin-bottom: 4px; font-family: var(--display); }
.pack-tag { font-size: 12.8px; color: var(--text-dim); margin-bottom: 9px; }
.pack-count { font-family: var(--mono); font-size: 10.8px; color: var(--teal); }

/* ------------------------------------------------------------- forms */
.field { margin-bottom: var(--sp-5); }
.field label, .field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; }
.field input {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--bg-3); border: 1px solid var(--border-2); color: var(--text);
}
.field input::placeholder { color: var(--text-muted); }
.field input:focus { border-color: var(--teal); }
.field-help { font-size: 12.2px; color: var(--text-muted); margin-top: 7px; }
.form-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-5); }
.form-error { color: var(--red); font-size: 13px; margin-top: var(--sp-3); }
.segmented { display: inline-flex; background: var(--bg-3); border: 1px solid var(--border-2); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg {
  padding: 7px 15px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--text-dim);
  transition: all 0.16s ease;
}
.seg:hover { color: var(--text); }
.seg.active { background: var(--teal); color: #04211f; }
html[data-theme='light'] .seg.active { color: #fff; }
.pack-picker { display: grid; gap: var(--sp-2); }
.pack-opt {
  display: flex; gap: var(--sp-3); align-items: flex-start; text-align: left; width: 100%;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--bg-3); transition: all 0.16s ease;
}
.pack-opt:hover { border-color: var(--teal-line); }
.pack-opt.active { border-color: var(--teal); background: var(--teal-soft); }
.pack-opt-radio {
  flex-shrink: 0; width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--border-2); margin-top: 3px;
}
.pack-opt.active .pack-opt-radio { border-color: var(--teal); background: radial-gradient(circle, var(--teal) 45%, transparent 48%); }
.pack-opt > span:not(.pack-opt-radio) { display: block; min-width: 0; }
.pack-opt-body { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.pack-opt-name { display: block; font-size: 14px; font-weight: 600; color: var(--heading); overflow-wrap: anywhere; }
.pack-opt-tag { display: block; font-size: 12.3px; color: var(--text-dim); line-height: 1.45; overflow-wrap: anywhere; }
.team-picker { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.team-opt {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border-2); background: var(--bg-3); font-size: 13px; color: var(--text-dim);
}
.team-opt .swatch { width: 10px; height: 10px; border-radius: 50%; }
.team-opt.active { border-color: currentColor; color: var(--heading); background: var(--panel-2); }

/* ------------------------------------------------------------- host */
.host-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--sp-5); align-items: start; }
@media (max-width: 1000px) { .host-layout { grid-template-columns: 1fr; } }
.host-side > .panel:first-child { margin-top: 0; }
.code-panel { text-align: left; }
.code-display {
  font-family: var(--mono); font-size: clamp(26px, 4vw, 38px); font-weight: 600; color: var(--teal);
  letter-spacing: 0.08em; margin: var(--sp-2) 0;
}
.code-meta { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-4); }
.control-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.control-grid-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.control-grid .btn { padding: 10px 8px; font-size: 13px; }
.control-links { display: flex; gap: var(--sp-4); flex-wrap: wrap; margin-top: var(--sp-4); }
.player-list { display: grid; gap: 7px; max-height: 340px; overflow-y: auto; }
.player-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center;
  padding: 9px 12px; border-radius: var(--radius-sm); background: var(--bg-3); border: 1px solid var(--border);
  animation: pop 0.3s ease both;
}
.player-row.is-local { border-color: var(--teal-line); background: var(--teal-soft); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; font-weight: 600; color: #04211f; flex-shrink: 0;
}
html[data-theme='light'] .avatar { color: #fff; }
.player-row > span:not(.avatar) { display: block; min-width: 0; }
.player-name { display: block; font-size: 13.5px; font-weight: 600; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-meta { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); line-height: 1.5; }
.player-score { font-family: var(--mono); font-size: 13px; color: var(--teal); text-align: right; }
.log-list { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.log-item { font-size: 12.4px; color: var(--text-dim); display: flex; gap: 8px; align-items: baseline; }
.log-time { font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); flex-shrink: 0; }
.log-item.tone-teal { color: var(--teal); } .log-item.tone-emerald { color: var(--emerald); }
.log-item.tone-amber { color: var(--amber); } .log-item.tone-muted { color: var(--text-muted); }
.log-item.tone-blue { color: var(--blue); }

/* ------------------------------------------------------------- join */
.join-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
@media (max-width: 900px) { .join-layout { grid-template-columns: 1fr; } }
.onboard-list { display: grid; gap: var(--sp-4); counter-reset: ob; }
.onboard-list li { display: flex; gap: var(--sp-3); }
.onboard-list li::before {
  counter-increment: ob; content: counter(ob); flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 50%; background: var(--teal-soft); color: var(--teal);
  border: 1px solid var(--teal-line); display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 11px; margin-top: 2px;
}
.onboard-title { font-size: 14px; font-weight: 600; color: var(--heading); }
.onboard-body { font-size: 13px; color: var(--text-dim); }
.score-table { margin-top: var(--sp-5); border-top: 1px solid var(--border); padding-top: var(--sp-4); display: grid; gap: 8px; }
.score-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: var(--sp-4); font-size: 13px; }
.score-row span:first-child { color: var(--text-dim); }
.score-row span:last-child { font-family: var(--mono); font-size: 12.4px; color: var(--heading); text-align: right; overflow-wrap: anywhere; }
@media (max-width: 620px) {
  .score-table { gap: var(--sp-3); }
  .score-row { grid-template-columns: minmax(0, 1fr); row-gap: 1px; }
  .score-row span:last-child { text-align: left; }
}

/* ------------------------------------------------------------- arena */
.arena-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--sp-5); flex-wrap: wrap; margin-bottom: var(--sp-6); }
.arena-head-right { display: flex; align-items: center; gap: var(--sp-3); }
.timer { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.timer-ring { transform: rotate(-90deg); }
.timer-track { fill: none; stroke: var(--border-2); stroke-width: 4; }
.timer-progress {
  fill: none; stroke: var(--teal); stroke-width: 4; stroke-linecap: round;
  stroke-dasharray: 119.4; stroke-dashoffset: 0; transition: stroke-dashoffset 0.25s linear, stroke 0.3s ease;
}
.timer.warn .timer-progress { stroke: var(--amber); }
.timer.danger .timer-progress { stroke: var(--red); }
.timer-text {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--heading);
}
.arena-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.85fr); gap: var(--sp-5); align-items: start; }
@media (max-width: 1040px) { .arena-layout { grid-template-columns: 1fr; } }
.arena-side > .panel:first-child { margin-top: 0; }
.scenario-head { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.scenario-title { font-size: clamp(20px, 2.4vw, 26px); margin-bottom: var(--sp-3); }
.scenario-narrative { font-size: 14.6px; color: var(--text-dim); margin-bottom: var(--sp-5); }
.evidence {
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-3);
  padding: var(--sp-4); display: grid; gap: 9px; margin-bottom: var(--sp-4);
}
.evidence-head { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); }
.ev-row { display: grid; grid-template-columns: minmax(120px, 0.6fr) minmax(0, 1.4fr); gap: var(--sp-3); font-size: 13px; align-items: baseline; }
.ev-label { color: var(--text-muted); }
.ev-value { color: var(--text); overflow-wrap: anywhere; }
.ev-value.mono { font-family: var(--mono); font-size: 12px; }
.ev-value.tone-red { color: var(--red); } .ev-value.tone-amber { color: var(--amber); }
.ev-value.tone-emerald { color: var(--emerald); } .ev-value.tone-blue { color: var(--blue); }
@media (max-width: 620px) { .ev-row { grid-template-columns: 1fr; gap: 2px; } }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4); }
.meta-cell { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--panel-2); }
.meta-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.meta-value { font-size: 13.4px; color: var(--heading); font-weight: 600; overflow-wrap: anywhere; }
.behavior { font-size: 13.6px; color: var(--text-dim); border-left: 2px solid var(--teal-line); padding-left: var(--sp-4); margin-bottom: var(--sp-4); }
.hint-box, .verify-box {
  border-radius: var(--radius-sm); padding: var(--sp-4); font-size: 13.2px; margin-top: var(--sp-3);
  border: 1px dashed var(--border-2); color: var(--text-dim);
}
.hint-box { border-color: rgba(245,158,11,0.4); background: var(--amber-soft); color: var(--amber); }
.verify-box { border-color: var(--teal-line); background: var(--teal-soft); color: var(--text-dim); }
.verify-box strong { color: var(--teal); }

.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
@media (max-width: 520px) { .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.action-btn {
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: var(--sp-4);
  background: var(--bg-3); text-align: left; transition: all 0.16s ease; display: grid; gap: 5px;
}
.action-btn:hover:not(:disabled) { border-color: var(--teal-line); transform: translateY(-2px); }
.action-name { font-size: 14.4px; font-weight: 700; color: var(--heading); font-family: var(--display); }
.action-hint { font-size: 11.8px; color: var(--text-muted); line-height: 1.45; }
.action-btn.selected { border-color: var(--teal); background: var(--teal-soft); }
.action-btn.is-correct { border-color: var(--emerald); background: var(--emerald-soft); }
.action-btn.is-danger { border-color: var(--red); background: var(--red-soft); }
.action-btn[data-tone='red'] .action-name { color: var(--red); }
.action-btn[data-tone='purple'] .action-name { color: var(--purple); }
.action-btn[data-tone='blue'] .action-name { color: var(--blue); }
.action-btn[data-tone='emerald'] .action-name { color: var(--emerald); }
.action-btn[data-tone='amber'] .action-name { color: var(--amber); }

.feedback { margin-top: var(--sp-5); border-radius: var(--radius-sm); border: 1px solid var(--border-2); padding: var(--sp-5); background: var(--bg-3); }
.feedback.correct { border-color: rgba(16,185,129,0.45); background: var(--emerald-soft); }
.feedback.partial { border-color: rgba(59,130,246,0.45); background: var(--blue-soft); }
.feedback.dangerous { border-color: rgba(239,68,68,0.45); background: var(--red-soft); }
.feedback.incorrect { border-color: rgba(245,158,11,0.4); background: var(--amber-soft); }
.fb-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.fb-verdict { font-family: var(--display); font-size: 17px; font-weight: 700; color: var(--heading); }
.fb-points { font-family: var(--mono); font-size: 13px; color: var(--teal); }
.fb-why { font-size: 13.8px; color: var(--text); margin-bottom: var(--sp-3); }
.fb-breakdown { display: flex; gap: var(--sp-4); flex-wrap: wrap; font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); }
.fb-value { margin-top: var(--sp-3); font-size: 12.6px; color: var(--teal); font-family: var(--mono); }
.flag-form { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-3); }
.flag-form input { flex: 1; min-width: 180px; padding: 11px 14px; border-radius: var(--radius-sm); background: var(--bg-3); border: 1px solid var(--border-2); color: var(--text); }
.flag-msg { font-size: 12.6px; margin-top: var(--sp-3); font-family: var(--mono); }
.flag-msg.ok { color: var(--emerald); } .flag-msg.bad { color: var(--red); }
.mini-board { display: grid; gap: 6px; }
.mini-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: var(--sp-3); align-items: center; font-size: 13px; padding: 6px 8px; border-radius: 7px; }
.mini-row.is-local { background: var(--teal-soft); }
.mini-rank { font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.mini-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.mini-score { font-family: var(--mono); font-size: 12.4px; color: var(--teal); }
.verdict-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-left: 6px; }
.vd-correct { background: var(--emerald); } .vd-partial { background: var(--blue); }
.vd-incorrect { background: var(--amber); } .vd-dangerous { background: var(--red); }
.vd-locked { background: var(--text-muted); }

/* skeleton */
.skeleton-card { display: grid; gap: var(--sp-3); }
.sk { background: linear-gradient(90deg, var(--bg-3) 25%, var(--panel-2) 50%, var(--bg-3) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; border-radius: 6px; }
.sk-line { height: 14px; } .sk-line.w40 { width: 40%; } .sk-line.w60 { width: 60%; } .sk-line.w70 { width: 70%; }
.sk-block { height: 130px; border-radius: var(--radius-sm); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ------------------------------------------------------------- leaderboard */
.lb-table { display: grid; gap: var(--sp-2); }
.lb-row {
  display: grid; grid-template-columns: 38px 28px minmax(0, 1fr) minmax(0, 260px) 78px;
  gap: var(--sp-3); align-items: center; padding: 12px var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel);
}
.lb-row.head { background: transparent; border-color: transparent; padding-block: 4px; }
.lb-row.head span { font-family: var(--mono); font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); }
.lb-row.is-local { border-color: var(--teal-line); background: var(--teal-soft); }
.lb-row.rank-1 { border-color: rgba(245,158,11,0.5); }
.lb-rank { font-family: var(--display); font-size: 18px; font-weight: 800; color: var(--text-muted); }
.lb-row.rank-1 .lb-rank { color: var(--amber); }
.lb-name { display: block; font-size: 14px; font-weight: 600; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub { display: block; font-family: var(--mono); font-size: 10.4px; color: var(--text-muted); line-height: 1.5; }
.lb-namebox { display: block; min-width: 0; text-align: left; }
.lb-stat-group { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.lb-stat { font-family: var(--mono); font-size: 12.4px; color: var(--text-dim); text-align: right; }
.lb-points { font-family: var(--mono); font-size: 16px; color: var(--teal); text-align: right; }
@media (max-width: 900px) {
  .lb-row { grid-template-columns: 30px 28px minmax(0, 1fr) 66px; row-gap: 8px; }
  .lb-row .lb-namebox { grid-column: 3 / -1; }
  .lb-row .lb-points { grid-column: 1 / -1; text-align: left; }
  .lb-row .lb-stat { text-align: left; font-size: 11.5px; }
  .lb-row.head { display: none; }
  .lb-stat-group { grid-column: 1 / -1; display: flex; gap: var(--sp-4); flex-wrap: wrap; }
}
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--sp-4); }
@media (min-width: 900px) { .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.team-card { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-5); background: var(--panel); }
.team-card-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.team-dot { width: 12px; height: 12px; border-radius: 50%; }
.team-name { font-family: var(--display); font-size: 17px; font-weight: 700; color: var(--heading); }
.team-score { margin-left: auto; font-family: var(--mono); font-size: 17px; color: var(--teal); }
.contrib { display: grid; gap: 8px; }
.contrib-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-3); align-items: baseline; font-size: 12.8px; }
.contrib-val { font-family: var(--mono); font-size: 12px; color: var(--text-dim); white-space: nowrap; text-align: right; }
.contrib-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
.contrib-bar { grid-column: 1 / -1; }
.celebrate {
  border: 1px solid var(--teal-line); background: var(--teal-soft); border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-5); display: flex; align-items: center; gap: var(--sp-4);
  animation: pop 0.35s ease both; flex-wrap: wrap;
}
.celebrate-title { font-family: var(--display); font-size: 16px; font-weight: 700; color: var(--heading); }
.celebrate-sub { font-size: 13px; color: var(--text-dim); }
.spark { display: flex; gap: 4px; }
.spark i { width: 6px; height: 18px; border-radius: 3px; background: var(--teal); display: block; animation: bounce 1s infinite ease-in-out; }
.spark i:nth-child(2) { animation-delay: 0.12s; background: var(--emerald); }
.spark i:nth-child(3) { animation-delay: 0.24s; background: var(--amber); }
.spark i:nth-child(4) { animation-delay: 0.36s; background: var(--purple); }
@keyframes bounce { 0%, 100% { transform: scaleY(0.5); opacity: 0.6; } 50% { transform: scaleY(1); opacity: 1; } }

/* ------------------------------------------------------------- outcomes */
.outcome-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-8); }
@media (min-width: 900px) { .outcome-hero { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.outcome-table { display: grid; gap: var(--sp-2); margin-top: var(--sp-2); }
.oc-row {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 92px 92px;
  gap: var(--sp-3); align-items: center; padding: 11px var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); font-size: 13px;
}
.oc-row.head { border-color: transparent; background: transparent; padding-block: 2px; }
.oc-row.head span { font-family: var(--mono); font-size: 10px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); }
.oc-item { color: var(--heading); font-weight: 600; overflow-wrap: anywhere; }
.oc-cat { color: var(--text-dim); font-size: 12.4px; }
.oc-verdict { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.oc-verdict.correct { color: var(--emerald); } .oc-verdict.partial { color: var(--blue); }
.oc-verdict.incorrect { color: var(--amber); } .oc-verdict.dangerous { color: var(--red); }
.oc-verdict.skipped { color: var(--text-muted); }
@media (max-width: 780px) {
  .oc-row { grid-template-columns: 1fr 1fr; }
  .oc-row.head { display: none; }
  .oc-item { grid-column: 1 / -1; }
}
.moment-list { display: grid; gap: var(--sp-2); }
.moment {
  display: flex; gap: var(--sp-3); align-items: flex-start; font-size: 13.6px; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px var(--sp-4); background: var(--panel);
}
.moment svg { flex-shrink: 0; color: var(--emerald); margin-top: 2px; }
.value-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: var(--sp-4); }
.talk-track { display: grid; gap: var(--sp-3); }
.talk-track li { display: flex; gap: var(--sp-3); font-size: 13.8px; color: var(--text-dim); }
.talk-track .tt-num { font-family: var(--mono); font-size: 11px; color: var(--teal); flex-shrink: 0; padding-top: 3px; }

/* ------------------------------------------------------------- modal + toast */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 120; background: rgba(3,7,18,0.72);
  display: flex; align-items: center; justify-content: center; padding: var(--sp-5);
  backdrop-filter: blur(4px);
}
.modal {
  width: min(560px, 100%); background: var(--panel); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: var(--sp-6); box-shadow: var(--shadow-lg);
  max-height: 86vh; overflow-y: auto; animation: pop 0.24s ease both;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.modal-head h2 { font-size: 19px; }
.toast-stack { position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: 140; display: grid; gap: 8px; max-width: min(340px, calc(100vw - 40px)); }
.toast {
  background: var(--panel); border: 1px solid var(--border-2); border-left: 3px solid var(--teal);
  border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; color: var(--text);
  box-shadow: var(--shadow-md); animation: pop 0.22s ease both;
}
.toast.tone-emerald { border-left-color: var(--emerald); }
.toast.tone-red { border-left-color: var(--red); }
.toast.tone-amber { border-left-color: var(--amber); }

/* ------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-2); }
.footer-inner { padding-block: var(--sp-8); display: grid; gap: 6px; font-size: 12.8px; color: var(--text-muted); }

/* ------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important; scroll-behavior: auto !important;
  }
  .btn:hover:not(:disabled), .action-btn:hover:not(:disabled) { transform: none; }
}

/* ==========================================================================
   SOLO ARCADE REWORK — attacker campaign, intro cards, ranks, badges,
   combo, boss stages, run summary, brag card, leaderboard flair
   ========================================================================== */

/* ---------------------------------------------------------- shared bits */
.btn-lg { padding: 13px 22px; font-size: 15px; }
.topnav-btn-quiet { opacity: 0.7; }
.play-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-5); align-items: start; }
@media (max-width: 900px) { .play-layout { grid-template-columns: 1fr; } }
.pack-opt-meta { display: block; font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.cat-badge { font-family: var(--mono); font-size: 10.5px; color: var(--teal); margin-top: 6px; letter-spacing: 0.04em; }

/* ------------------------------------------------------ attacker campaign */
.attacker-panel { border-color: rgba(239,68,68,0.32); background: linear-gradient(180deg, rgba(239,68,68,0.06), transparent 60%), var(--panel); }
.attacker-panel.is-critical { border-color: rgba(239,68,68,0.6); animation: atkPulse 1.6s ease-in-out infinite; }
@keyframes atkPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.0); } 50% { box-shadow: 0 0 0 4px rgba(239,68,68,0.12); } }
.attacker-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); }
.attacker-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--red); }
.attacker-name { font-family: var(--mono); font-size: 17px; font-weight: 600; color: var(--heading); letter-spacing: 0.02em; margin-top: 2px; }
.attacker-objective { font-size: 13.4px; color: var(--text-dim); margin-top: var(--sp-2); }
.attacker-meter { margin-top: var(--sp-4); }
.attacker-meter-head { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.atk-bar { height: 10px; border-radius: 999px; background: var(--bg-3); overflow: hidden; margin-top: 7px; border: 1px solid var(--border); }
.atk-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--amber), var(--red)); transition: width 0.25s linear; }
.attacker-note { font-size: 11.8px; color: var(--text-muted); margin-top: 7px; }
.atk-feed {
  margin-top: var(--sp-4); background: #05080f; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: var(--sp-3); max-height: 168px; overflow: hidden; display: grid; gap: 3px;
}
html[data-theme='light'] .atk-feed { background: #0d1526; }
.atk-line { font-family: var(--mono); font-size: 11.7px; line-height: 1.5; display: flex; gap: 8px; color: #93a3bb; }
.atk-line .atk-prompt { color: var(--red); flex: none; }
.atk-line.tone-sys { color: #7c8aa3; } .atk-line.tone-sys .atk-prompt { color: var(--blue); }
.atk-line.tone-good { color: var(--emerald); } .atk-line.tone-good .atk-prompt { color: var(--emerald); }
.atk-line.tone-warn { color: var(--amber); } .atk-line.tone-warn .atk-prompt { color: var(--amber); }
.atk-line.tone-bad { color: #fca5a5; }
.atk-line:first-child { animation: atkIn 0.28s ease; }
@keyframes atkIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- combo badge */
.combo-badge { display: grid; gap: 1px; text-align: right; padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
.combo-badge .combo-x { font-family: var(--mono); font-size: 17px; font-weight: 600; color: var(--text-dim); }
.combo-badge .combo-label { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.combo-badge.hot { border-color: var(--teal-line); background: var(--teal-soft); }
.combo-badge.hot .combo-x { color: var(--teal); }
.combo-badge.max { border-color: var(--purple); background: var(--purple-soft); }
.combo-badge.max .combo-x { color: var(--purple); }

/* --------------------------------------------------------- tutorial / boss */
.tutorial-banner, .boss-banner {
  font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: var(--sp-4);
  border: 1px dashed var(--teal-line); background: var(--teal-soft); color: var(--text);
}
.boss-banner { border-style: solid; border-color: var(--purple); background: var(--purple-soft); font-family: var(--mono); font-size: 12px; letter-spacing: 0.05em; }
.stage-box { margin-top: var(--sp-4); padding: var(--sp-4); border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--panel-2); }
.stage-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--purple); }
.stage-prompt { font-size: 14.2px; color: var(--text); margin-top: 6px; }
.stage-history { display: grid; gap: 5px; margin-top: var(--sp-3); }
.stage-hist-row { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: 12.3px; color: var(--text-dim); }
.stage-hist-row .shr-verdict { font-family: var(--mono); font-size: 11.5px; }
.stage-hist-row.correct .shr-verdict { color: var(--emerald); }
.stage-hist-row.partial .shr-verdict { color: var(--amber); }
.stage-hist-row.incorrect .shr-verdict, .stage-hist-row.dangerous .shr-verdict { color: var(--red); }

/* --------------------------------------------------------- knowledge check */
.knowledge { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.knowledge-q { font-size: 13.6px; font-weight: 600; color: var(--heading); }
.knowledge-opts { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.kc-btn { font-size: 12.6px; padding: 7px 13px; border: 1px solid var(--border-2); border-radius: 999px; color: var(--text-dim); background: var(--panel-2); transition: border-color 0.16s ease, color 0.16s ease; }
.kc-btn:hover:not(:disabled) { border-color: var(--teal-line); color: var(--heading); }
.kc-btn.is-correct { border-color: var(--emerald); color: var(--emerald); background: var(--emerald-soft); }
.kc-btn.is-wrong { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.knowledge-msg { font-size: 12.4px; margin-top: var(--sp-3); color: var(--text-muted); }
.knowledge-msg.ok { color: var(--emerald); } .knowledge-msg.bad { color: var(--amber); }
.round-advance { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-4); }

/* ------------------------------------------------------------ feedback add */
.fb-timeout { font-size: 12.6px; color: var(--amber); margin-top: var(--sp-2); }
.fb-stages { display: grid; gap: 5px; margin-top: var(--sp-3); }
.fb-stage-row { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: 12.4px; color: var(--text-dim); }
.fb-stage-row.correct { color: var(--emerald); } .fb-stage-row.partial { color: var(--amber); }
.fb-stage-row.incorrect, .fb-stage-row.dangerous { color: var(--red); }
.fb-combo { font-size: 12.5px; color: var(--purple); margin-top: var(--sp-2); }
.fb-combo-break { font-size: 12.5px; color: var(--amber); margin-top: var(--sp-2); }

/* ------------------------------------------------------------- score rail */
.rail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.rail-cell { padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
.rail-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.rail-value { font-size: 17px; font-weight: 700; color: var(--heading); margin-top: 3px; }
.rail-progress { margin-top: var(--sp-4); }
.rail-rounds { display: flex; gap: 5px; flex-wrap: wrap; margin-top: var(--sp-4); }
.pip { width: 15px; height: 8px; border-radius: 3px; background: var(--bg-3); border: 1px solid var(--border-2); display: block; }
.pip-live { border-color: var(--teal); background: var(--teal-soft); animation: atkPulse 1.4s ease-in-out infinite; }
.pip-correct { background: var(--emerald); border-color: var(--emerald); }
.pip-partial { background: var(--amber); border-color: var(--amber); }
.pip-incorrect, .pip-dangerous { background: var(--red); border-color: var(--red); }
.pip-boss { width: 22px; }

/* ---------------------------------------------------------------- badges */
.badge-wrap { display: grid; gap: var(--sp-2); }
.badge { display: flex; gap: var(--sp-3); align-items: flex-start; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
.badge-ico { color: var(--emerald); flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--emerald-soft); }
.badge-ico svg { width: 13px; height: 13px; }
.badge-text { display: grid; gap: 1px; min-width: 0; }
.badge-name { font-size: 13.2px; font-weight: 600; color: var(--heading); }
.badge-desc { font-size: 11.9px; color: var(--text-dim); }

/* ------------------------------------------------------------- ranks */
.rank-panel .rank-track { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--sp-4); margin-top: var(--sp-4); }
.rank-step { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
.rank-num { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: var(--teal); background: var(--teal-soft); border: 1px solid var(--teal-line); }
.rank-title { font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--heading); }
.rank-req { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rank-blurb { font-size: 12.4px; color: var(--text-dim); margin-top: 6px; }

/* -------------------------------------------------------- intro overlay */
.intro-overlay {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: var(--sp-5);
  background: rgba(4,8,17,0.78); backdrop-filter: blur(6px);
}
.intro-shell { width: min(560px, 100%); }
.intro-card {
  background: var(--panel); border: 1px solid var(--border-2); border-radius: var(--radius);
  padding: var(--sp-8); box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px);
}
.intro-card.in { animation: introIn 0.32s cubic-bezier(0.22,0.8,0.28,1) forwards; }
@keyframes introIn { to { opacity: 1; transform: none; } }
.intro-eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal); }
.intro-title { font-size: clamp(22px, 3vw, 28px); margin-top: var(--sp-3); }
.intro-body { font-size: 14.6px; color: var(--text-dim); margin-top: var(--sp-4); line-height: 1.66; }
.intro-foot { font-size: 12.4px; color: var(--text-muted); margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.intro-dots { display: flex; gap: 6px; justify-content: center; margin-top: var(--sp-5); }
.intro-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-2); display: block; }
.intro-dot.on { background: var(--teal); }
.intro-actions { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4); }

/* --------------------------------------------------------- run summary */
.summary-hero { border-color: var(--teal-line); background: linear-gradient(180deg, var(--teal-soft), transparent 55%), var(--panel); }
.summary-hero-top { display: flex; justify-content: space-between; gap: var(--sp-6); flex-wrap: wrap; }
.summary-score { font-family: var(--mono); font-size: clamp(34px, 5vw, 52px); font-weight: 700; color: var(--teal); line-height: 1.05; margin-top: var(--sp-2); }
.summary-rank { font-family: var(--display); font-size: 18px; font-weight: 700; color: var(--heading); margin-top: 2px; }
.summary-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-content: flex-start; max-width: 340px; }
.summary-post { font-size: 12.6px; color: var(--text-muted); margin-top: var(--sp-4); }
.pillar-tags { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-4); }
.pillar-tag { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); display: grid; gap: 2px; opacity: 0.6; }
.pillar-tag.on { opacity: 1; border-color: var(--teal-line); background: var(--teal-soft); }
.pillar-tag-name { font-size: 13px; font-weight: 600; color: var(--heading); }
.pillar-tag-count { font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.value-moment-list { margin-top: var(--sp-4); display: grid; gap: 6px; padding-left: 18px; }
.value-moment-list li { font-size: 13px; color: var(--text-dim); }
.outcome-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 92px 190px 54px; gap: var(--sp-3); align-items: center; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
@media (max-width: 820px) { .outcome-row { grid-template-columns: 26px minmax(0, 1fr) 80px; } .outcome-row .or-action { display: none; } }
.or-num { font-size: 11px; color: var(--text-muted); }
.or-namebox { display: grid; gap: 1px; min-width: 0; }
.or-item { font-size: 13.2px; font-weight: 600; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.or-label { font-size: 11.6px; color: var(--text-muted); }
.or-verdict { font-family: var(--mono); font-size: 11.4px; text-transform: uppercase; letter-spacing: 0.05em; }
.or-action, .or-contain { font-size: 11.6px; color: var(--text-muted); }
.outcome-row.correct { border-color: rgba(16,185,129,0.35); } .outcome-row.correct .or-verdict { color: var(--emerald); }
.outcome-row.partial { border-color: rgba(245,158,11,0.35); } .outcome-row.partial .or-verdict { color: var(--amber); }
.outcome-row.incorrect .or-verdict, .outcome-row.dangerous .or-verdict { color: var(--red); }
.outcome-row.dangerous { border-color: rgba(239,68,68,0.4); }

/* ---------------------------------------------------------- brag card */
.brag { display: grid; gap: var(--sp-3); justify-items: start; margin-top: var(--sp-4); }
.brag-canvas { width: 100%; max-width: 640px; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border-2); }
.brag-fallback { width: 100%; max-width: 640px; padding: var(--sp-8); border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: linear-gradient(135deg, var(--teal-soft), var(--purple-soft)); }
.brag-eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--teal); }
.brag-handle { font-family: var(--display); font-size: 30px; font-weight: 800; color: var(--heading); margin-top: var(--sp-3); }
.brag-title { font-size: 15px; color: var(--purple); font-weight: 600; }
.brag-score { font-family: var(--mono); font-size: 46px; font-weight: 700; color: var(--teal); margin-top: var(--sp-3); }
.brag-stats { font-size: 12.6px; color: var(--text-dim); margin-top: var(--sp-2); }

/* -------------------------------------------------------- leaderboard */
.lb-actions { display: flex; gap: var(--sp-3); align-items: center; }
.lb-crown { color: var(--amber); display: inline-grid; place-items: center; margin-right: 4px; vertical-align: -2px; }
.notice-panel { border-color: rgba(245,158,11,0.4); background: linear-gradient(180deg, var(--amber-soft), transparent 60%), var(--panel); }
.notice-title { font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--heading); }
.notice-body { font-size: 13px; color: var(--text-dim); margin-top: 6px; }

/* -------------------------------------------------------- facilitator */
/* Explicit placement, not auto-fit: the four panels have very different
   heights, and auto-fit wrapped the last one into a lone half-empty column
   with a tall gap above it. Controls and the how-to run full width; the two
   similar-height panels share the middle row. */
.fac-layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--sp-5);
  align-items: start;
}
.fac-layout > .fac-controls,
.fac-layout > .fac-howto { grid-column: 1 / -1; }
.fac-layout > .fac-packs { grid-column: span 6; }
.fac-layout > .fac-notes-panel { grid-column: span 6; }
.fac-controls .control-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 720px; }
.fac-howto .onboard-list { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.fac-howto > .btn { margin-top: var(--sp-4); }
@media (max-width: 900px) {
  .fac-layout > .fac-packs,
  .fac-layout > .fac-notes-panel { grid-column: 1 / -1; }
  .fac-controls .control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.fac-notes { display: grid; gap: var(--sp-3); padding-left: 18px; margin-top: var(--sp-2); }
.fac-notes li { font-size: 13.2px; color: var(--text-dim); }
.fac-layout .pack-card { display: flex; flex-direction: column; }
.fac-layout .pack-card .btn { margin-top: auto; align-self: flex-start; }
.fac-layout .pack-card .pack-count { margin-bottom: var(--sp-3); }

/* ====================================================================== */
/*  NEW LOOP: job line, live rounds, verdict stamp, flags, ladder        */
/* ====================================================================== */

/* --------------------------------------------------- persistent job line */
.job-line {
  margin: var(--sp-5) 0 var(--sp-3);
  padding: 11px 14px;
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: linear-gradient(90deg, var(--teal-soft), transparent 78%);
  font-size: 14px; font-weight: 600; color: var(--heading); line-height: 1.5;
}
.job-line-live { border-left-color: var(--purple); background: linear-gradient(90deg, var(--purple-soft), transparent 78%); }

/* ------------------------------------------------- help ("?") button */
.icon-btn.help-btn {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  border: 1px solid var(--border-2); background: var(--panel-2);
  font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--text-dim);
}
.icon-btn.help-btn:hover { border-color: var(--teal-line); color: var(--teal); }

/* ---------------------------------------------- incoming campaign banner */
.campaign-banner {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  margin: 0 0 var(--sp-4); padding: 12px 16px;
  border: 1px solid rgba(239,68,68,0.45); border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--red-soft), transparent 70%), var(--panel);
  opacity: 0;
}
.campaign-banner.is-in { animation: cbIn 1s ease-out forwards; }
@keyframes cbIn {
  0% { opacity: 0; transform: translateY(-8px) scale(0.99); }
  14% { opacity: 1; transform: none; }
  78% { opacity: 1; }
  100% { opacity: 0; }
}
.cb-label { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--red); }
.cb-name { font-size: 16px; font-weight: 700; color: var(--heading); letter-spacing: 0.04em; }
.cb-sub { font-size: 12.6px; color: var(--text-dim); }

/* ------------------------------------------------------- verdict stamp */
.verdict-stamp {
  position: relative; margin-top: var(--sp-4); padding: 14px 18px;
  border: 2px solid var(--emerald); border-radius: var(--radius-sm);
  display: grid; gap: 3px; text-align: center; overflow: hidden;
  background: var(--emerald-soft);
  transform: scale(1) rotate(-1.5deg); opacity: 0;
}
.verdict-stamp.is-bad { border-color: var(--red); background: var(--red-soft); }
.verdict-stamp.is-in { animation: stampSlam 0.42s cubic-bezier(0.2,1.5,0.4,1) forwards; }
.verdict-stamp.is-out { animation: stampOut 0.5s ease forwards; }
@keyframes stampSlam {
  0% { transform: scale(1.6) rotate(-6deg); opacity: 0; filter: blur(3px); }
  55% { transform: scale(0.97) rotate(-1.5deg); opacity: 1; filter: none; }
  75% { transform: scale(1.03) rotate(-1.5deg); }
  100% { transform: scale(1) rotate(-1.5deg); opacity: 1; }
}
@keyframes stampOut { to { opacity: 0.92; transform: scale(0.99) rotate(-1.5deg); } }
.stamp-text { font-family: var(--display); font-size: clamp(19px, 3.4vw, 30px); font-weight: 800; letter-spacing: 0.03em; color: var(--emerald); text-transform: uppercase; }
.verdict-stamp.is-bad .stamp-text { color: var(--red); }
.stamp-sub { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); letter-spacing: 0.05em; }

/* meter freeze: screech-stop colour flash */
.attacker-panel.is-frozen { animation: none; }
.attacker-panel.is-frozen .atk-bar { transition: none !important; }
.attacker-panel.freeze-good { animation: freezeGood 0.6s ease-out 1; }
.attacker-panel.freeze-bad { animation: freezeBad 0.6s ease-out 1; }
@keyframes freezeGood {
  0% { box-shadow: inset 0 0 0 2px var(--emerald); background-color: rgba(16,185,129,0.20); }
  100% { box-shadow: none; }
}
@keyframes freezeBad {
  0% { box-shadow: inset 0 0 0 2px var(--red); background-color: rgba(239,68,68,0.22); }
  40% { box-shadow: inset 0 0 0 2px var(--red); }
  100% { box-shadow: none; }
}

/* --------------------------------------------------- teaching verdict card */
.teach { display: grid; gap: var(--sp-3); margin-top: var(--sp-4); }
.teach-row { padding: 11px 13px; border: 1px solid var(--border); border-left: 3px solid var(--border-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--panel-2); }
.teach-row:nth-child(1) { border-left-color: var(--blue, #38bdf8); }
.teach-row:nth-child(2) { border-left-color: var(--amber); }
.teach-real, .teach-talk { border-left-color: var(--teal) !important; background: linear-gradient(90deg, var(--teal-soft), transparent 70%), var(--panel-2); }
.teach-label { font-family: var(--mono); font-size: 10.4px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.teach-body { font-size: 13.6px; color: var(--text); line-height: 1.62; margin-top: 5px; }
.teach-talk .teach-body { font-weight: 600; color: var(--heading); }
.fb-followup { font-size: 12.6px; color: var(--text-muted); margin-top: var(--sp-2); }

/* trophy flag chip inside the verdict card */
.fb-trophy { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-4); padding: 10px 12px; border: 1px dashed var(--border-2); border-radius: var(--radius-sm); background: var(--panel-2); opacity: 0.72; }
.fb-trophy.is-won { opacity: 1; border-style: solid; border-color: var(--emerald); background: var(--emerald-soft); }
.fb-trophy-ico { color: var(--text-muted); display: grid; place-items: center; }
.fb-trophy.is-won .fb-trophy-ico { color: var(--emerald); }
.fb-trophy-flag { font-size: 12.8px; font-weight: 700; color: var(--heading); }
.fb-trophy-note { font-size: 11.8px; color: var(--text-muted); }

/* ------------------------------------------------------- flags strip */
.flag-strip { display: grid; gap: 6px; margin-top: var(--sp-3); }
.flag-chip { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border: 1px solid rgba(16,185,129,0.35); border-radius: var(--radius-sm); background: var(--emerald-soft); }
.flag-chip-ico { color: var(--emerald); display: grid; place-items: center; flex: none; }
.flag-chip-text { display: grid; gap: 1px; min-width: 0; }
.flag-chip-flag { font-size: 11.8px; font-weight: 700; color: var(--heading); overflow: hidden; text-overflow: ellipsis; }
.flag-chip-item { font-size: 11.2px; color: var(--text-muted); }

/* ---------------------------------------------------- Act 2 live rounds */
.live-banner { padding: 10px 12px; border: 1px solid var(--purple); border-radius: var(--radius-sm); background: var(--purple-soft); font-family: var(--mono); font-size: 11.6px; letter-spacing: 0.05em; color: var(--heading); text-transform: uppercase; }
.live-steps { display: grid; gap: 8px; margin-top: var(--sp-4); padding-left: 20px; }
.live-steps li { font-size: 13.4px; color: var(--text); line-height: 1.58; }
.live-steps li::marker { font-family: var(--mono); color: var(--teal); font-weight: 700; }
.live-launch { margin-top: var(--sp-4); display: inline-flex; }
.evidence-shot { border-style: dashed; }
.live-answer { display: grid; gap: var(--sp-3); }
.live-answer-q { font-size: 14.4px; font-weight: 600; color: var(--heading); }
.live-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp-3); }
.live-opt { display: flex; align-items: center; gap: 9px; padding: 12px 13px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--panel-2); text-align: left; }
.live-opt:hover:not(:disabled) { border-color: var(--teal-line); background: var(--teal-soft); }
.live-opt-key { flex: none; width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; font-size: 10.5px; color: var(--text-muted); background: var(--bg-3); border: 1px solid var(--border-2); }
.live-opt-label { font-size: 14px; font-weight: 600; color: var(--heading); }
.live-opt.is-correct { border-color: var(--emerald); background: var(--emerald-soft); }
.live-opt.is-wrong { border-color: var(--red); background: var(--red-soft); }
.live-answer-msg { font-size: 12.6px; color: var(--text-muted); }
.live-answer-msg.ok { color: var(--emerald); }
.live-answer-msg.bad { color: var(--red); }
.timer.is-untimed { opacity: 0.5; }
.timer.is-untimed .timer-progress { stroke: var(--border-2); }
.pip-tenant { border-color: var(--purple); background: var(--purple-soft); }

/* ------------------------------------------------ how-to-play overlay */
.howto-shell { width: min(660px, 100%); }
.howto-list { display: grid; gap: var(--sp-3); margin-top: var(--sp-5); padding: 0; list-style: none; }
.howto-step { display: flex; gap: var(--sp-3); align-items: flex-start; padding: 11px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
.howto-ico { flex: none; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); border: 1px solid var(--teal-line); }
.howto-ico svg { width: 17px; height: 17px; }
.howto-text { display: grid; gap: 2px; min-width: 0; }
.howto-num { font-size: 10.4px; letter-spacing: 0.12em; color: var(--text-muted); }
.howto-title { font-size: 14px; font-weight: 700; color: var(--heading); }
.howto-body { font-size: 12.8px; color: var(--text-dim); line-height: 1.56; }

/* -------------------------------------------------------- field missions */
.field-head { display: grid; gap: var(--sp-3); justify-items: start; }
.field-head-eyebrow { font-size: 11.6px; letter-spacing: 0.06em; color: var(--teal); }
.field-head-note { font-size: 13.4px; color: var(--text-dim); }
.field-grid { display: grid; gap: var(--sp-5); margin-top: var(--sp-5); }
.field-card { display: grid; gap: var(--sp-3); }
.field-card.is-done { border-color: rgba(16,185,129,0.4); background: linear-gradient(180deg, var(--emerald-soft), transparent 55%), var(--panel); }
.field-brief { font-size: 13.6px; color: var(--text-dim); line-height: 1.6; }
.field-where { font-size: 11.4px; color: var(--text-muted); }
.field-foot { margin-top: var(--sp-5); display: grid; gap: var(--sp-3); justify-items: start; }

/* ------------------------------------------- "what you now know" ladder */
.ladder-panel { border-color: var(--purple-line, rgba(139,92,246,0.35)); background: linear-gradient(180deg, var(--purple-soft), transparent 55%), var(--panel); }
.ladder { display: grid; gap: var(--sp-3); margin-top: var(--sp-5); padding: 0; list-style: none; }
.ladder-rung { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-2); }
.ladder-rung.is-learned { border-color: rgba(16,185,129,0.4); }
.ladder-rung.is-missed { opacity: 0.72; }
.ladder-top { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.ladder-ico { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 6px; color: var(--teal); background: var(--teal-soft); }
.ladder-ico svg { width: 15px; height: 15px; }
.ladder-num { font-size: 10.6px; color: var(--text-muted); }
.ladder-name { font-family: var(--display); font-size: 15.5px; font-weight: 700; color: var(--heading); margin-right: auto; }
.ladder-learn { font-size: 13.2px; color: var(--text-dim); line-height: 1.6; margin-top: var(--sp-3); }
.ladder-story { font-size: 13.6px; font-weight: 600; color: var(--heading); margin-top: 7px; padding-left: 11px; border-left: 2px solid var(--teal); }
.ladder-gap { font-size: 12px; color: var(--amber); margin-top: 6px; }
.score-row.is-missed { opacity: 0.7; }

@media (prefers-reduced-motion: reduce) {
  .attacker-panel.is-critical, .pip-live { animation: none; }
  .atk-line:first-child, .intro-card.in { animation: none; opacity: 1; transform: none; }
  .verdict-stamp { opacity: 1; transform: none; }
  .verdict-stamp.is-in, .verdict-stamp.is-out { animation: none; opacity: 1; transform: none; }
  .campaign-banner { opacity: 1; }
  .campaign-banner.is-in { animation: none; opacity: 1; }
  .attacker-panel.freeze-good, .attacker-panel.freeze-bad { animation: none; }
}


/* Play-again affordance under your own leaderboard row */
.lb-again {
  display: flex;
  justify-content: flex-end;
  padding: 6px 12px 10px;
  border-bottom: 1px solid var(--line);
}

/* ==========================================================================
   Mobile / touch polish — layout + tap-target only, no change to the
   visual identity (same palette, type, radii, borders).
   ========================================================================== */

/* ---- overlays: always scrollable, actions always reachable on short screens */
.intro-overlay {
  align-items: center; justify-content: center;
  overflow-y: auto; overscroll-behavior: contain;
  padding: max(var(--sp-5), env(safe-area-inset-top)) var(--sp-5) max(var(--sp-5), env(safe-area-inset-bottom));
}
.intro-shell { display: flex; flex-direction: column; min-height: 0; max-height: 100%; }
.intro-card { overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.intro-actions { flex: none; }
.modal-backdrop {
  overflow-y: auto; overscroll-behavior: contain;
  padding: max(var(--sp-5), env(safe-area-inset-top)) var(--sp-5) max(var(--sp-5), env(safe-area-inset-bottom));
}
.modal { max-height: none; }
@media (max-width: 560px) {
  .intro-overlay, .modal-backdrop { padding-left: var(--sp-3); padding-right: var(--sp-3); }
  .intro-card { padding: var(--sp-5); }
  .modal { padding: var(--sp-5); }
  .intro-title { font-size: 21px; }
}

/* ---- long mono strings must wrap inside their card, never overflow it */
.demo-note.mono, .field-help.mono, .step-url, .pack-opt-meta, .pack-count,
.event-strip .mono, .fb-line, .live-answer-msg, .knowledge-msg, .log-list li {
  overflow-wrap: anywhere;
}

/* ---- horizontal nav scroller: reachable last item + snap, no clipped tabs */
@media (max-width: 900px) {
  .topnav { gap: 4px; padding-bottom: 2px; scroll-snap-type: x proximity; scroll-padding-left: 4px; }
  .topnav::after { content: ''; flex: none; width: var(--sp-5); }
  .topnav-btn { scroll-snap-align: start; }
}

/* ---- comfortable tap targets (>=44px) on touch and narrow viewports */
@media (max-width: 900px), (hover: none) {
  .btn, .btn-sm, .seg, .topnav-btn, .ghost-btn, .icon-btn, .team-opt, .lb-again .btn {
    min-height: 44px;
  }
  .topnav-btn, .ghost-btn, .seg { display: inline-flex; align-items: center; justify-content: center; }
  .brand { min-height: 44px; }
  .icon-btn { min-width: 44px; justify-content: center; }
  .segmented { width: 100%; }
  .seg { flex: 1 1 auto; }
}

/* ---- safe-area gutters on notched phones */
@media (max-width: 900px) {
  .topbar-inner, .event-strip, .footer-inner, .stage {
    padding-left: max(var(--sp-5), env(safe-area-inset-left));
    padding-right: max(var(--sp-5), env(safe-area-inset-right));
  }
  .toast-stack {
    right: max(var(--sp-5), env(safe-area-inset-right));
    bottom: max(var(--sp-5), env(safe-area-inset-bottom));
  }
}

/* ---- compact sticky header on phones: brand + actions on one row, nav below */
@media (max-width: 900px) {
  .topbar-actions { margin-left: auto; }
}
@media (max-width: 520px) {
  .topbar-inner { gap: var(--sp-2) var(--sp-3); }
  .brand { gap: 8px; }
  .brand-mark svg { width: 28px; height: 28px; }
  .brand-title { font-size: 16px; }
  .pill-demo { padding: 6px; gap: 0; }
  .pill-text, .ghost-label { display: none; }
  #liveLabBtn { padding: 7px; min-width: 44px; justify-content: center; }
  .event-strip { font-size: 11.4px; padding-top: 6px; padding-bottom: 6px; }
}

/* ---- sticky header must never cover scrolled-to content */
html { scroll-padding-top: 120px; }
.screen, .panel, [id^='screen-'] { scroll-margin-top: 120px; }

/* ---- run-length chips: even 3-up row instead of a ragged 2+1 wrap */
@media (max-width: 560px) {
  #lengthGroup { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  #lengthGroup .seg { width: 100%; font-size: 12px; padding-left: 6px; padding-right: 6px; text-align: center; }
}
