:root {
  --bg:#0A0C12; --surface:#10131C; --surfaceAlt:#171B27; --surfaceHover:#1C2130;
  --border:#242A3A; --border-hairline:#1B2030;
  --text:#E8EBF4; --muted:#8B93A9; --muted-dim:#5C6479;

  --code-200:#3ED598; --code-200-wash:rgba(62,213,152,.13); --code-200-edge:rgba(62,213,152,.42);
  --code-3xx:#7C8CFF; --code-3xx-wash:rgba(124,140,255,.14); --code-3xx-edge:rgba(124,140,255,.46);
  --code-404:#FF5C6E; --code-404-wash:rgba(255,92,110,.13); --code-404-edge:rgba(255,92,110,.44);
  --code-rw:#F5B33F;  --code-rw-wash:rgba(245,179,63,.13);  --code-rw-edge:rgba(245,179,63,.42);
  --accent:var(--code-3xx); --on-accent:#0A0C12;

  --grad-signal:linear-gradient(135deg,#7C8CFF 0%,#A78BFF 52%,#63E6BE 118%);
  --glow-ambient:radial-gradient(120% 80% at 50% -12%,rgba(124,140,255,.10),transparent 62%);

  --font-sans:"Inter","Inter var",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --font-mono:"JetBrains Mono","SFMono-Regular",ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  --t-xs:.6875rem; --t-sm:.8125rem; --t-base:.9375rem; --t-md:1.0625rem;
  --t-lg:1.25rem; --t-xl:1.625rem; --t-2xl:2.25rem; --t-3xl:3rem;

  --r-xs:4px; --r-sm:6px; --r-md:10px; --r-lg:14px; --r-xl:20px; --r-full:9999px;
  --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:24px; --sp-6:32px; --sp-7:48px; --sp-8:64px;
  --maxw:1120px;

  --sh-sm:0 1px 2px rgba(0,0,0,.5);
  --sh-md:0 6px 20px -6px rgba(0,0,0,.55),0 1px 0 rgba(255,255,255,.03) inset;
  --sh-lg:0 18px 44px -12px rgba(0,0,0,.6),0 1px 0 rgba(255,255,255,.04) inset;
  --sh-xl:0 32px 80px -20px rgba(0,0,0,.7),0 1px 0 rgba(255,255,255,.05) inset;
  --sh-focus:0 0 0 3px rgba(124,140,255,.32);
  --glow-winner:0 0 0 1px rgba(124,140,255,.55),0 0 28px -6px rgba(124,140,255,.45);
  --glow-200:0 0 0 1px rgba(62,213,152,.5),0 0 22px -6px rgba(62,213,152,.35);
  --glow-danger:0 0 0 1px rgba(255,92,110,.5),0 0 22px -6px rgba(255,92,110,.3);

  --ease-std:cubic-bezier(.2,.7,.2,1); --ease-emph:cubic-bezier(.16,1,.3,1);
  --d-hover:130ms; --d-state:180ms; --d-panel:240ms;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: var(--t-base); line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 70vh;
  background: var(--glow-ambient); pointer-events: none; z-index: 0;
}
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.12; letter-spacing: -0.01em; }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-lg); }
p { margin: 0; }
code {
  font-family: var(--font-mono); font-size: 0.9em;
  background: var(--surfaceAlt); border: 1px solid var(--border-hairline);
  border-radius: var(--r-xs); padding: 0.06em 0.36em; color: var(--text);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.micro { font-size: var(--t-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.eyebrow { margin-bottom: var(--sp-2); }
:focus-visible { outline: none; box-shadow: var(--sh-focus); border-radius: var(--r-sm); }

header, main, footer { position: relative; z-index: 1; }
main { display: block; }
.hero, .problem, .console-section, .agent-section, .tools-section, .ribbon-wrap {
  max-width: var(--maxw); margin: 0 auto; padding: var(--sp-7) var(--sp-5);
}
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-5); flex-wrap: wrap; }
.section-sub { color: var(--muted); max-width: 60ch; margin-top: var(--sp-2); font-size: var(--t-sm); }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--sp-5);
  padding: var(--sp-3) var(--sp-5);
  background: rgba(10,12,18,0.82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-hairline);
}
.brand { display: flex; align-items: center; gap: var(--sp-2); text-decoration: none; }
.brand-mark { display: grid; place-items: center; }
.brand-name { font-family: var(--font-mono); font-weight: 600; font-size: var(--t-md); color: var(--text); letter-spacing: -0.02em; }
.topnav { display: flex; gap: var(--sp-4); margin-right: auto; }
.topnav a { color: var(--muted); font-size: var(--t-sm); }
.topnav a:hover { color: var(--text); text-decoration: none; }
.topbar-controls { display: flex; align-items: center; gap: var(--sp-3); margin-left: auto; }
.platform-picker { display: flex; align-items: center; gap: var(--sp-2); }
.platform-picker select, select.sim-input {
  background: var(--surfaceAlt); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 0.4rem 0.55rem; font-family: var(--font-mono); font-size: var(--t-sm);
}
.status-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 0.35rem 0.7rem; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surfaceAlt);
  font-size: var(--t-xs); font-weight: 600; white-space: nowrap;
}
.status-pill .dot, .dot-inline { width: 0.55rem; height: 0.55rem; border-radius: var(--r-full); background: var(--muted-dim); display: inline-block; }
.status-on .dot, #hero-dot.on { background: var(--code-200); box-shadow: 0 0 0 4px var(--code-200-wash); animation: pulse 2.4s var(--ease-std) infinite; }
.status-on { color: var(--code-200); }
.status-off .dot { background: var(--code-rw); }
.status-off { color: var(--code-rw); }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px var(--code-200-wash); } 50% { box-shadow: 0 0 0 6px transparent; } }
/* ---- Buttons ---- */
.btn {
  font-family: var(--font-sans); font-size: var(--t-sm); font-weight: 500;
  color: var(--text); background: var(--surfaceAlt); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 0.5rem 0.85rem; cursor: pointer;
  transition: background var(--d-hover) var(--ease-std), border-color var(--d-hover), transform 90ms;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surfaceHover); border-color: var(--muted-dim); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 600; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--code-404); }

/* ---- Hero ---- */
.hero { padding-top: var(--sp-8); padding-bottom: var(--sp-6); }
.hero-inner { max-width: 62ch; }
.hero-title {
  font-family: var(--font-mono); font-weight: 600; letter-spacing: -0.02em;
  font-size: clamp(2rem, 6vw, var(--t-3xl)); line-height: 1.05; margin: var(--sp-2) 0 var(--sp-4);
}
.hero-sub { color: var(--muted); font-size: var(--t-md); line-height: 1.55; margin-bottom: var(--sp-5); }
.hero-sub code { font-size: 0.85em; }
.bug-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  background: var(--code-404-wash); border: 1px solid var(--code-404-edge);
  color: var(--text); border-radius: var(--r-full); padding: 0.4rem 0.8rem 0.4rem 0.5rem;
  font-size: var(--t-sm); margin-bottom: var(--sp-5);
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.hero-ctas .btn { padding: 0.6rem 1.05rem; }
.hero-agent { display: flex; align-items: center; gap: var(--sp-2); color: var(--muted); font-size: var(--t-sm); }

/* ---- Status-line ribbon ---- */
.ribbon-wrap { padding-top: 0; padding-bottom: var(--sp-3); }
.status-ribbon {
  font-family: var(--font-mono); font-size: var(--t-md); font-variant-numeric: tabular-nums;
  padding: var(--sp-4) var(--sp-5); border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-sm);
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  transition: border-color var(--d-state), box-shadow var(--d-state);
}
.status-ribbon .rb-code { font-weight: 600; }
.status-ribbon.is-404 { border-color: var(--code-404-edge); box-shadow: var(--glow-danger); }
.status-ribbon.is-404 .rb-code { color: var(--code-404); }
.status-ribbon.is-ok { border-color: var(--code-200-edge); box-shadow: var(--glow-200); }
.status-ribbon.is-ok .rb-code { color: var(--code-200); }
.status-ribbon .rb-note { color: var(--muted); }

/* ---- Problem strip ---- */
.problem-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); align-items: center; }
.problem-copy h2 { margin-bottom: var(--sp-3); }
.problem-copy p { color: var(--muted); }
.facts { list-style: none; margin: var(--sp-4) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.facts li { position: relative; padding-left: 1.3rem; font-size: var(--t-sm); color: var(--text); }
.facts li::before { content: "›"; position: absolute; left: 0; color: var(--accent); font-family: var(--font-mono); }
.problem-config {
  margin: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-md); padding: var(--sp-4); font-family: var(--font-mono); font-size: var(--t-sm);
}
.pc-line { display: grid; grid-template-columns: 1.4rem 1fr; gap: var(--sp-2); padding: 0.3rem 0.4rem; border-radius: var(--r-xs); }
.pc-line .pc-gutter { color: var(--muted-dim); text-align: right; }
.pc-line.shadowed { background: var(--code-404-wash); }
.pc-line.shadowed .pc-gutter { color: var(--code-404); }
.pc-line.shadowed .pc-body { text-decoration: line-through; text-decoration-color: var(--code-404-edge); }
.pc-caption { margin-top: var(--sp-3); color: var(--muted); font-family: var(--font-sans); font-size: var(--t-sm); }
/* ---- Console workspace ---- */
.workspace { display: grid; grid-template-columns: 1.35fr 1fr; gap: var(--sp-4); align-items: start; }
.onboarding {
  margin-bottom: var(--sp-4); padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border); border-left: 3px solid var(--code-rw);
  border-radius: var(--r-md); background: var(--code-rw-wash); color: var(--muted); font-size: var(--t-sm);
}
.onboarding strong { color: var(--text); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-md); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border-hairline); background: var(--surfaceAlt); }
.panel-head-sub { border-top: 1px solid var(--border-hairline); }
.panel-head h2 { font-size: var(--t-base); }
.panel-head h3 { font-size: var(--t-sm); color: var(--muted); font-weight: 600; }
.count { color: var(--muted); font-weight: 500; font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
.panel-actions { display: flex; gap: var(--sp-2); }

.rule-list { list-style: none; margin: 0; padding: var(--sp-2); display: flex; flex-direction: column; gap: var(--sp-2); }
.rule-list:empty::after { content: "No rules yet. Import a config or add one to begin."; display: block; padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--muted); font-size: var(--t-sm); }
.rule {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  background: var(--surfaceAlt); border: 1px solid var(--border); border-radius: var(--r-md);
  transition: transform var(--d-hover) var(--ease-std), border-color var(--d-hover), box-shadow var(--d-state);
}
.rule::before { content: ""; position: absolute; left: 0; top: 8%; bottom: 8%; width: 3px; border-radius: 3px; background: var(--muted-dim); }
.rule.rail-3xx::before { background: var(--code-3xx); }
.rule.rail-rw::before { background: var(--code-rw); }
.rule.rail-404::before { background: var(--code-404); }
.rule:hover { transform: translateY(-1px); border-color: var(--muted-dim); box-shadow: var(--sh-md); }
.rule.is-winner { border-color: var(--code-3xx-edge); box-shadow: var(--glow-winner); }
.rule.is-spotlit { box-shadow: var(--glow-winner); z-index: 60; }
.rule.shadowed::before { background: repeating-linear-gradient(180deg, var(--code-404) 0 4px, transparent 4px 7px); }
@keyframes flash { 0% { background: var(--code-3xx-wash); } 100% { background: var(--surfaceAlt); } }
.rule.rule-flash { animation: flash 900ms var(--ease-std); }
.rule-grip { cursor: grab; color: var(--muted-dim); user-select: none; }
.rule-body { min-width: 0; font-family: var(--font-mono); font-size: var(--t-sm); overflow-wrap: anywhere; }
.rule-from { color: var(--text); }
.rule-arrow { color: var(--muted-dim); margin: 0 var(--sp-2); }
.rule-to { color: var(--code-3xx); }
.rule-meta { display: flex; align-items: center; gap: var(--sp-1); }
.rule-meta .btn { padding: 0.3rem 0.5rem; }

.chip { font-family: var(--font-mono); font-size: var(--t-xs); font-weight: 600; font-variant-numeric: tabular-nums; padding: 0.14rem 0.42rem; border-radius: var(--r-xs); border: 1px solid transparent; }
.chip-200 { color: var(--code-200); background: var(--code-200-wash); border-color: var(--code-200-edge); }
.chip-3xx { color: var(--code-3xx); background: var(--code-3xx-wash); border-color: var(--code-3xx-edge); }
.chip-404 { color: var(--code-404); background: var(--code-404-wash); border-color: var(--code-404-edge); }
.chip-rewrite { color: var(--code-rw); background: var(--code-rw-wash); border-color: var(--code-rw-edge); }
.chip-muted { color: var(--muted); background: var(--surfaceHover); border-color: var(--border); }

.sim-form { display: flex; gap: var(--sp-2); padding: var(--sp-4); }
.sim-input { flex: 1; min-width: 0; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0.55rem 0.7rem; font-family: var(--font-mono); font-size: var(--t-sm); }
.sim-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--sh-focus); }
.sim-result { padding: 0 var(--sp-4) var(--sp-3); font-family: var(--font-mono); font-size: var(--t-sm); }
.sim-result .trace-line { padding: 0.3rem 0; border-top: 1px dashed var(--border-hairline); color: var(--muted); overflow-wrap: anywhere; }
.sim-result .verdict { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) 0 0; font-weight: 600; flex-wrap: wrap; }
.sim-result .verdict-dest { color: var(--muted); font-weight: 400; }
.audit-findings { list-style: none; margin: 0; padding: var(--sp-2) var(--sp-4) var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); }
.audit-findings:empty::after { content: "No audit run yet."; color: var(--muted); font-size: var(--t-sm); }
.finding { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--surfaceAlt); border: 1px solid var(--border); font-size: var(--t-sm); cursor: pointer; }
.finding[data-sev="error"] { border-left: 3px solid var(--code-404); }
.finding[data-sev="warn"] { border-left: 3px solid var(--code-rw); }
.finding[data-sev="ok"] { border-left: 3px solid var(--code-200); }
.finding-icon { font-family: var(--font-mono); font-weight: 700; }
.finding[data-sev="error"] .finding-icon { color: var(--code-404); }
.finding[data-sev="warn"] .finding-icon { color: var(--code-rw); }
.finding[data-sev="ok"] .finding-icon { color: var(--code-200); }
.export-card { margin: 0 var(--sp-4) var(--sp-4); }
.export-card pre { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--sp-3); font-family: var(--font-mono); font-size: var(--t-sm); overflow: auto; margin: var(--sp-2) 0 0; }
/* ---- Agent section ---- */
.agent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); align-items: start; }
.agent-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-md); padding: var(--sp-5); }
.agent-card.connected { border-color: var(--code-200-edge); }
.agent-card h3 { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.agent-card p { color: var(--muted); font-size: var(--t-sm); margin-bottom: var(--sp-3); }
.agent-card ol { color: var(--muted); font-size: var(--t-sm); padding-left: 1.2rem; margin: 0 0 var(--sp-3); }
.prompt-block { display: flex; gap: var(--sp-2); align-items: stretch; }
.prompt-block code { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--sp-3); font-size: var(--t-sm); line-height: 1.5; }
.transcript { list-style: none; margin: 0; padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); max-height: 420px; overflow: auto; }
.transcript-empty { color: var(--muted); font-size: var(--t-sm); }
.tag-honest { color: var(--muted-dim); text-transform: none; letter-spacing: 0; }
.tr-row { border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surfaceAlt); padding: var(--sp-2) var(--sp-3); font-family: var(--font-mono); font-size: var(--t-xs); }
.tr-row.active { border-color: var(--code-3xx-edge); box-shadow: var(--glow-winner); }
.tr-call { color: var(--accent); }
.tr-out { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; margin-top: var(--sp-1); display: block; }

/* ---- Tool grid ---- */
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
.tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-4); box-shadow: var(--sh-sm); }
.tool-card .tool-name { font-family: var(--font-mono); font-weight: 600; font-size: var(--t-sm); color: var(--text); }
.tool-card p { color: var(--muted); font-size: var(--t-xs); margin: var(--sp-2) 0; line-height: 1.5; }
.tool-badge { font-size: 0.625rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.1rem 0.4rem; border-radius: var(--r-xs); }
.tool-badge.ro { color: var(--code-200); background: var(--code-200-wash); }
.tool-badge.rw { color: var(--code-rw); background: var(--code-rw-wash); }

/* ---- Footer ---- */
.footer { max-width: var(--maxw); margin: var(--sp-6) auto 0; padding: var(--sp-5); border-top: 1px solid var(--border-hairline); display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; color: var(--muted); font-size: var(--t-sm); }

/* ---- Editor dialog ---- */
dialog.editor { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 0; width: min(560px, 92vw); box-shadow: var(--sh-xl); }
dialog.editor::backdrop { background: rgba(6,8,14,0.7); }
.editor-form { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-5); }
.editor-form label { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--t-xs); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.editor-text { width: 100%; min-height: 240px; resize: vertical; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--sp-3); font-family: var(--font-mono); font-size: var(--t-sm); line-height: 1.5; }
.editor-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-1); }
/* ---- Scrim + story dock ---- */
.scrim { position: fixed; inset: 0; background: rgba(10,12,18,0.62); z-index: 50; opacity: 0; animation: fadein var(--d-panel) forwards; }
@keyframes fadein { to { opacity: 1; } }
.story-dock {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: var(--sp-5);
  width: min(660px, 92vw); z-index: 70;
  background: var(--surface); border: 1px solid var(--code-3xx-edge); border-radius: var(--r-xl);
  box-shadow: var(--sh-xl); padding: var(--sp-4) var(--sp-5);
}
.story-dots { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.story-dots span { width: 26px; height: 4px; border-radius: 2px; background: var(--border); transition: background var(--d-state); }
.story-dots span.done { background: var(--code-3xx); opacity: 0.5; }
.story-dots span.active { background: var(--accent); }
.story-body h3 { margin: var(--sp-1) 0; }
.story-body p { color: var(--muted); font-size: var(--t-sm); }
.story-chip { display: inline-block; margin-top: var(--sp-2); color: var(--accent); background: var(--code-3xx-wash); border: 1px solid var(--code-3xx-edge); border-radius: var(--r-xs); padding: 0.15rem 0.5rem; font-size: var(--t-xs); }
.story-progress { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin: var(--sp-3) 0; }
.story-progress span { display: block; height: 100%; width: 0; background: var(--accent); }
.story-controls { display: flex; gap: var(--sp-2); justify-content: flex-end; }

/* ---- Responsive ---- */
@media (max-width: 1023px) {
  .workspace, .agent-grid, .problem-grid { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) { .topnav { display: none; } }
@media (max-width: 640px) {
  .hero, .problem, .console-section, .agent-section, .tools-section { padding: var(--sp-6) var(--sp-4); }
  .topbar { flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-2) var(--sp-4); }
  .topbar-controls { width: 100%; justify-content: space-between; flex-wrap: wrap; row-gap: var(--sp-2); }
  .status-pill { flex-shrink: 0; }
  #play-story { flex: 1; }
  .rule { grid-template-columns: auto 1fr; }
  .rule-meta { grid-column: 1 / -1; justify-content: flex-end; }
  .rule-meta .btn { min-height: 40px; min-width: 40px; }
  .tool-grid { grid-template-columns: 1fr; }
  .story-dock { left: 0; right: 0; bottom: 0; transform: none; width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .prompt-block { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Story spotlight applies to any target (rule row, sim result, finding, export card). */
.is-spotlit { position: relative; z-index: 60; box-shadow: var(--glow-winner); border-radius: var(--r-md); }
