:root {
  --paper: #f0eee7;
  --surface: #fbfaf5;
  --ink: #11171a;
  --muted: #626766;
  --line: rgba(17, 23, 26, .18);
  --aria: #1d55ce;
  --stella: #76528f;
  --nox: #14604d;
  --red: #a53c3c;
  --font: Helvetica, "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "BIZ UDPMincho", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--paper); font-family: var(--font); }
button { font: inherit; }
[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 20; top: -5rem; left: 1rem; padding: .75rem 1rem; color: #fff; background: var(--ink); }
.skip-link:focus { top: 1rem; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(1rem, 5vw, 5rem); border-bottom: 1px solid var(--line); }
.brand, .status, .eyebrow, .role small, .job-code small, .job-code span, .hud small { font-family: Helvetica, sans-serif; letter-spacing: .13em; }
.brand, .status { display: flex; align-items: center; gap: .8rem; margin: 0; font-size: .72rem; }
.brand { color: inherit; text-decoration: none; }
.brand-mark { display: block; width: 40px; height: 40px; object-fit: cover; border-radius: 10px; }
.status span { width: 8px; height: 8px; border-radius: 50%; background: #34a57b; box-shadow: 0 0 0 6px rgba(52,165,123,.1); }
main { max-width: 1500px; margin: 0 auto; }
.screen { min-height: calc(100vh - 136px); padding: clamp(2.5rem, 6vw, 6rem) clamp(1rem, 5vw, 5rem); }
.intro-screen { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(2rem, 6vw, 7rem); align-items: center; }
.eyebrow { color: var(--aria); font-size: .7rem; font-weight: 700; }
.intro-copy h1 { margin: 1rem 0 1.4rem; font-size: clamp(3.2rem, 7vw, 7.5rem); font-weight: 500; line-height: 1; letter-spacing: -.065em; }
.intro-copy h1 em { color: var(--aria); font-style: normal; }
.lead { max-width: 640px; font-size: clamp(1rem, 1.3vw, 1.2rem); line-height: 2; }
button { min-height: 50px; border: 1px solid var(--ink); border-radius: 0; padding: .85rem 1.1rem; background: transparent; color: var(--ink); cursor: pointer; }
button:hover { transform: translateY(-1px); }
button:focus-visible { outline: 3px solid rgba(29,85,206,.35); outline-offset: 3px; }
button:disabled { opacity: .52; cursor: default; transform: none; }
.primary-button { min-width: 230px; margin-top: 1.4rem; background: var(--ink); color: #fff; }
.primary-button span { margin-left: 1rem; opacity: .65; font-family: Helvetica, sans-serif; font-size: .7rem; }
.role-lanes { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 1px; padding: 1px; background: var(--line); }
.role { min-width: 0; min-height: 340px; display: flex; flex-direction: column; justify-content: flex-end; padding: 1.7rem; color: #fff; }
.role-aria { background: var(--aria); }
.role-stella { min-height: 300px; background: var(--stella); }
.role-nox { min-height: 260px; background: var(--nox); }
.role small { opacity: .7; font-size: .62rem; }
.role h2 { margin: 1rem 0 .7rem; font-family: Helvetica, sans-serif; font-size: clamp(1.4rem, 2.6vw, 2.8rem); letter-spacing: -.04em; }
.role p { margin: 0; font-size: .9rem; line-height: 1.8; }
.instructions { grid-column: 1 / -1; margin: 0; text-align: center; color: var(--muted); }
kbd { min-width: 1.8rem; display: inline-block; padding: .1rem .4rem; border: 1px solid var(--line); background: var(--surface); font-family: Helvetica, sans-serif; }
.play-screen { padding-top: clamp(1.5rem, 4vw, 4rem); }
.hud { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 1.2rem; border-block: 1px solid var(--line); }
.hud p { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0; padding: 1rem 1.2rem; border-right: 1px solid var(--line); }
.hud p:last-child { border-right: 0; }
.hud small { font-size: .62rem; }
.hud strong { font-family: Helvetica, sans-serif; font-size: clamp(1.25rem, 2.8vw, 2.3rem); }
.urgent { color: var(--red); }
.job-card { display: grid; grid-template-columns: minmax(230px, .35fr) 1fr; min-height: 380px; border: 1px solid var(--line); background: var(--surface); }
.job-code { display: flex; flex-direction: column; justify-content: space-between; padding: 2rem; background: var(--ink); color: #fff; }
.job-code small { font-size: .62rem; opacity: .65; }
.job-code strong { font-family: Helvetica, sans-serif; font-size: clamp(1rem, 1.6vw, 1.4rem); line-height: 1.5; }
.job-code span { font-size: clamp(3rem, 6vw, 6rem); color: rgba(255,255,255,.25); }
.job-copy { padding: clamp(2rem, 4.5vw, 4.5rem); }
.job-copy h1 { margin: 0 0 1.3rem; font-size: clamp(2.2rem, 4.5vw, 4.6rem); font-weight: 500; line-height: 1.25; }
.job-copy > p { max-width: 850px; font-size: clamp(1rem, 1.4vw, 1.25rem); line-height: 1.95; }
.job-copy ul { display: flex; flex-wrap: wrap; gap: .6rem; list-style: none; padding: 0; margin: 2rem 0 0; }
.job-copy li { padding: .45rem .75rem; border: 1px solid var(--line); background: #fff; font-size: .82rem; }
.dispatch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 1.2rem 0 0; padding: 0; border: 0; background: var(--line); }
.dispatch-grid legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dispatch-grid button { min-height: 130px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-content: center; gap: .3rem .8rem; text-align: left; border: 0; background: var(--surface); }
.dispatch-grid button > span { grid-row: 1 / 3; align-self: center; font-family: Helvetica, sans-serif; font-size: 1.8rem; }
.dispatch-grid button b { font-family: Helvetica, sans-serif; font-size: 1.4rem; letter-spacing: .04em; }
.dispatch-grid button small { color: var(--muted); }
.dispatch-grid button[data-agent="aria"] > span { color: var(--aria); }
.dispatch-grid button[data-agent="stella"] > span { color: var(--stella); }
.dispatch-grid button[data-agent="nox"] > span { color: var(--nox); }
.dispatch-grid button:hover { color: #fff; background: var(--ink); }
.dispatch-grid button:hover small { color: rgba(255,255,255,.7); }
.feedback { margin-top: 1.2rem; padding: clamp(1.4rem, 3vw, 2.5rem); border: 1px solid var(--line); background: #dfe4dd; }
.feedback > p:first-child { margin: 0; font-family: Helvetica, sans-serif; font-size: .68rem; letter-spacing: .12em; font-weight: 700; }
.feedback .correct { color: var(--nox); }
.feedback .incorrect { color: var(--red); }
.feedback h2 { margin: .6rem 0; font-size: clamp(1.6rem, 3vw, 2.8rem); font-weight: 500; }
.feedback p { line-height: 1.8; }
#next-button { background: var(--ink); color: #fff; }
.result-screen { max-width: 1250px; margin: 0 auto; }
.result-hero { display: grid; grid-template-columns: auto 1fr; gap: clamp(1.5rem, 4vw, 4rem); align-items: center; padding: 2rem 0 3rem; border-bottom: 1px solid var(--line); }
.result-hero > strong { font-family: Helvetica, sans-serif; font-size: clamp(7rem, 16vw, 14rem); line-height: .8; color: var(--aria); }
.result-hero h1 { margin: 0 0 .7rem; font-size: clamp(2rem, 4vw, 4rem); font-weight: 500; }
.result-hero p { line-height: 1.8; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.result-stats p { display: grid; gap: .5rem; margin: 0; padding: 1.4rem; border-right: 1px solid var(--line); }
.result-stats p:last-child { border-right: 0; }
.result-stats span { color: var(--muted); }
.result-stats strong { font-family: Helvetica, sans-serif; font-size: 1.8rem; }
.learning, .mistakes { margin-top: 2.5rem; }
.learning h2, .mistakes h2 { font-size: clamp(1.8rem, 3vw, 3rem); font-weight: 500; }
.learning > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; padding: 1px; background: var(--line); }
.learning article { min-height: 160px; padding: 1.4rem; background: var(--surface); }
.learning article b { font-size: 1.1rem; }
.learning article p, .boundary-note { line-height: 1.8; color: var(--muted); }
.boundary-note { padding: 1rem 0; }
#mistake-list { display: grid; gap: 1px; padding: 1px; background: var(--line); }
#mistake-list article { padding: 1.4rem; background: var(--surface); }
#mistake-list h3 { margin: 0 0 .7rem; font-size: 1.05rem; }
#mistake-list p { margin: .35rem 0; line-height: 1.7; }
.result-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.result-actions .primary-button { margin-top: 0; }
footer { min-height: 64px; display: flex; justify-content: space-between; gap: 2rem; align-items: center; padding: 1rem clamp(1rem, 5vw, 5rem); border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }

@media (max-width: 900px) {
  .intro-screen { grid-template-columns: 1fr; }
  .role { min-height: 220px; }
  .job-card { grid-template-columns: 1fr; }
  .job-code { min-height: 150px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .job-code strong { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .topbar { min-height: 58px; padding: 0 1rem; }
  .brand b, .status { font-size: 0; }
  .status span { display: block; }
  .screen { min-height: calc(100vh - 116px); padding: 2.5rem 1rem; }
  .intro-copy h1 { font-size: clamp(3.4rem, 18vw, 5.8rem); }
  .role-lanes { grid-template-columns: 1fr; }
  .role, .role-stella, .role-nox { min-height: 0; padding: 1.15rem; }
  .role h2 { margin: .45rem 0; }
  .hud p { min-height: 60px; display: grid; padding: .65rem; }
  .job-code { min-height: 135px; padding: 1.2rem; }
  .job-copy { padding: 1.5rem 1rem; }
  .job-copy h1 { font-size: 2rem; }
  .dispatch-grid { grid-template-columns: 1fr; }
  .dispatch-grid button { min-height: 86px; }
  .result-hero { grid-template-columns: 1fr; }
  .result-hero > strong { font-size: 8rem; }
  .result-stats { grid-template-columns: 1fr 1fr; }
  .result-stats p:nth-child(2) { border-right: 0; }
  .learning > div { grid-template-columns: 1fr; }
  .result-actions button { flex: 1 1 100%; }
  footer { flex-direction: column; align-items: flex-start; padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  button:hover { transform: none; }
}

.tools-return{display:inline-flex;align-items:center;gap:.35rem;color:inherit;font-size:.78rem;font-weight:700;text-decoration:none}
.tools-return:hover,.tools-return:focus-visible{text-decoration:underline}
.ai-secretary-note{max-width:46rem;margin-top:1rem;padding:.8rem 1rem;border-left:3px solid currentColor;font-size:.84rem;line-height:1.7;opacity:.8}
.related-exit{display:grid;gap:.7rem;margin-top:1.5rem;padding:1.2rem;border:1px solid currentColor}
.related-exit[hidden]{display:none!important}
.related-exit p{margin:0;font-weight:700}
.related-exit a{color:inherit;font-weight:700;text-underline-offset:.25em}
@media(max-width:620px){.tools-return{font-size:.72rem}.related-exit{padding:1rem}}
