:root {
    --night: #071b2a;
    --night-2: #0b293b;
    --paper: #f6f0e4;
    --paper-2: #fffaf0;
    --ink: #10222d;
    --muted: #5d6b70;
    --line: rgba(19, 50, 65, 0.17);
    --gold: #e4b85a;
    --gold-deep: #a96e18;
    --jade: #3dc49a;
    --coral: #f27b66;
    --white: #ffffff;
    --shadow: 0 28px 80px rgba(2, 15, 23, 0.28);
    --serif: Georgia, "Times New Roman", serif;
    --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--night); }
body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--paper);
    background:
        radial-gradient(circle at 83% 12%, rgba(49, 147, 137, 0.2), transparent 31rem),
        radial-gradient(circle at 9% 90%, rgba(228, 184, 90, 0.12), transparent 28rem),
        var(--night);
    font-family: var(--sans);
}
button, a { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 50; padding: 10px 14px; color: var(--night); background: var(--paper); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.game-topbar {
    position: relative;
    z-index: 10;
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: min(1220px, calc(100% - 40px));
    margin: 0 auto;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.game-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--paper); text-decoration: none; }
.game-brand > span:last-child { display: grid; line-height: 1; }
.game-brand strong { font-family: var(--serif); font-size: 22px; letter-spacing: 0.01em; }
.game-brand small { margin-top: 5px; color: rgba(246,240,228,0.58); font-size: 9px; font-weight: 800; letter-spacing: 0.22em; text-transform: uppercase; }
.brand-seal { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(228,184,90,0.72); border-radius: 50%; color: var(--gold); font-family: var(--serif); font-size: 21px; box-shadow: inset 0 0 0 4px var(--night), inset 0 0 0 5px rgba(228,184,90,0.26); }
.topbar-actions { display: flex; align-items: center; gap: 24px; }
.save-status { color: rgba(246,240,228,0.58); font-size: 12px; }
.save-status span { margin-right: 6px; color: var(--jade); font-size: 8px; }
.quiet-link { min-height: 44px; display: inline-flex; align-items: center; color: var(--paper); font-size: 13px; font-weight: 750; text-decoration: none; }
.quiet-link:hover { color: var(--gold); }

.game-main { width: min(1220px, calc(100% - 40px)); margin: 0 auto; padding: clamp(34px, 7vh, 76px) 0 60px; }
.start-screen { display: grid; min-height: calc(100vh - 170px); grid-template-columns: minmax(0, 1fr) minmax(420px, 0.82fr); align-items: center; gap: clamp(42px, 7vw, 96px); }
.case-kicker { margin: 0 0 18px; color: var(--gold); font-size: 11px; font-weight: 900; letter-spacing: 0.2em; text-transform: uppercase; }
.case-kicker span { margin-inline: 8px; opacity: 0.5; }
.opening-copy h1 { max-width: 740px; margin: 0; font-family: var(--serif); font-size: clamp(52px, 7vw, 96px); font-weight: 500; letter-spacing: -0.055em; line-height: 0.93; text-wrap: balance; }
.opening-deck { max-width: 660px; margin: 26px 0 28px; color: rgba(246,240,228,0.75); font-family: var(--serif); font-size: clamp(19px, 2vw, 25px); line-height: 1.45; }
.briefing-card { display: grid; max-width: 680px; grid-template-columns: 48px 1fr; gap: 16px; padding: 18px 20px; border: 1px solid rgba(228,184,90,0.25); border-radius: 6px; background: rgba(255,255,255,0.045); }
.briefing-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; color: var(--night); background: var(--gold); font-family: var(--serif); font-size: 24px; }
.briefing-card p { margin: 0; color: rgba(246,240,228,0.72); font-size: 13px; line-height: 1.55; }
.briefing-card .briefing-label { margin-bottom: 3px; color: var(--paper); font-size: 10px; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; }
.instinct-picker { display: flex; max-width: 680px; flex-wrap: wrap; gap: 8px; padding: 0; margin: 24px 0 0; border: 0; }
.instinct-picker legend { width: 100%; margin-bottom: 7px; color: rgba(246,240,228,0.62); font-size: 10px; font-weight: 900; letter-spacing: 0.13em; text-transform: uppercase; }
.instinct-picker label { flex: 1 1 150px; cursor: pointer; }
.instinct-picker input { position: absolute; opacity: 0; pointer-events: none; }
.instinct-picker label > span { display: grid; min-height: 64px; align-content: center; padding: 10px 13px; border: 1px solid rgba(255,255,255,0.12); border-radius: 4px; background: rgba(255,255,255,0.035); }
.instinct-picker strong { color: var(--paper); font-family: var(--serif); font-size: 15px; font-weight: 500; }
.instinct-picker small { margin-top: 3px; color: rgba(246,240,228,0.49); font-size: 10px; }
.instinct-picker input:checked + span { border-color: var(--gold); background: rgba(228,184,90,0.12); box-shadow: inset 0 0 0 1px rgba(228,184,90,0.18); }
.instinct-picker input:focus-visible + span { outline: 3px solid var(--jade); outline-offset: 3px; }
.opening-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.primary-action, .secondary-action { min-height: 52px; border: 0; border-radius: 4px; cursor: pointer; font-weight: 850; }
.primary-action { display: inline-flex; min-width: 210px; align-items: center; justify-content: space-between; gap: 22px; padding: 0 20px; color: var(--night); background: var(--gold); box-shadow: 0 14px 32px rgba(228,184,90,0.18); }
.primary-action:hover { background: #f0c971; transform: translateY(-1px); }
.primary-action:focus-visible, .secondary-action:focus-visible, .answer-button:focus-visible, .quiet-link:focus-visible { outline: 3px solid var(--jade); outline-offset: 3px; }
.secondary-action { padding: 0 20px; color: var(--paper); border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.04); }
.secondary-action:hover { border-color: rgba(228,184,90,0.6); color: var(--gold); }
.game-signals { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.game-signals span { padding: 7px 10px; border: 1px solid rgba(255,255,255,0.1); border-radius: 999px; color: rgba(246,240,228,0.57); font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }

.case-visual { position: relative; min-width: 0; }
.visual-glow { position: absolute; inset: 10% -8% -6% 8%; border-radius: 50%; background: rgba(61,196,154,0.18); filter: blur(55px); }
.case-art { position: relative; display: grid; aspect-ratio: 0.87; overflow: hidden; place-items: center; border: 1px solid rgba(228,184,90,0.36); border-radius: 4px 4px 0 0; color: rgba(246,240,228,0.48); background: linear-gradient(145deg, rgba(255,255,255,0.09), rgba(255,255,255,0.02)); box-shadow: var(--shadow); text-align: center; }
.case-art::before { position: absolute; inset: 18px; border: 1px solid rgba(255,255,255,0.08); content: ""; }
.case-art img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.case-stamp { position: absolute; top: 38px; right: 34px; padding: 10px 14px; border: 2px solid rgba(242,123,102,0.76); color: var(--coral); font-size: 9px; font-weight: 900; letter-spacing: 0.14em; line-height: 1.45; text-transform: uppercase; transform: rotate(3deg); }
.case-caption { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid rgba(228,184,90,0.36); border-top: 0; background: var(--paper); box-shadow: var(--shadow); }
.case-caption > div { min-width: 0; padding: 14px 16px; color: var(--ink); }
.case-caption > div + div { border-left: 1px solid var(--line); }
.case-caption small, .case-caption strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-caption small { margin-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
.case-caption strong { font-family: var(--serif); font-size: 14px; }

.game-screen { animation: reveal 420ms ease both; }
.case-hud { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.scene-label, .doctrine-tag { margin: 0 0 8px; color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: 0.18em; text-transform: uppercase; }
.case-hud h2 { margin: 0; font-family: var(--serif); font-size: clamp(32px, 4vw, 52px); font-weight: 500; }
.hud-meters { display: flex; gap: 28px; }
.hud-meters div { display: grid; gap: 4px; text-align: right; }
.hud-meters span { color: rgba(246,240,228,0.52); font-size: 9px; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; }
.hud-meters strong { font-family: var(--serif); color: var(--gold); font-size: 22px; font-weight: 500; }
.case-menu { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid rgba(255,255,255,0.14); border-radius: 50%; color: rgba(246,240,228,0.7); background: transparent; cursor: pointer; font-size: 24px; }
.case-menu:hover { border-color: var(--gold); color: var(--gold); }
.progress-track { height: 3px; margin: 20px 0 34px; overflow: hidden; background: rgba(255,255,255,0.09); }
.progress-track span { display: block; width: 14%; height: 100%; background: linear-gradient(90deg, var(--gold), var(--jade)); transition: width 500ms ease; }
.trial-layout { display: grid; grid-template-columns: minmax(260px, 0.38fr) minmax(0, 1fr); overflow: hidden; border: 1px solid rgba(228,184,90,0.25); border-radius: 8px; background: var(--paper); box-shadow: var(--shadow); }
.speaker-card { min-height: 560px; padding: 34px; color: var(--paper); background: var(--night-2); }
.speaker-portrait { display: grid; width: 108px; height: 108px; place-items: center; margin-bottom: 26px; border: 1px solid rgba(228,184,90,0.5); border-radius: 50%; color: var(--gold); background: rgba(255,255,255,0.04); font-family: var(--serif); font-size: 30px; }
.speaker-card > p { margin: 0 0 5px; color: var(--jade); font-size: 9px; font-weight: 900; letter-spacing: 0.15em; text-transform: uppercase; }
.speaker-card h3 { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 500; }
.speaker-card blockquote { margin: 80px 0 0; color: rgba(246,240,228,0.75); font-family: var(--serif); font-size: 21px; font-style: italic; line-height: 1.45; }
.decision-panel { min-width: 0; padding: clamp(28px, 5vw, 62px); color: var(--ink); background: var(--paper); }
.decision-panel h3 { max-width: 720px; margin: 0; font-family: var(--serif); font-size: clamp(28px, 4vw, 44px); font-weight: 500; letter-spacing: -0.025em; line-height: 1.08; }
.fact-pattern { max-width: 760px; margin: 22px 0 26px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.hint-button { display: inline-flex; min-height: 42px; align-items: center; gap: 8px; padding: 0 12px; margin: -8px 0 18px; border: 1px dashed rgba(169,110,24,0.38); border-radius: 4px; color: var(--gold-deep); background: rgba(255,255,255,0.35); cursor: pointer; font-size: 11px; font-weight: 850; }
.hint-button:hover { background: var(--paper-2); }
.hint-button:disabled { cursor: default; opacity: 0.55; }
.hint-text { margin: -6px 0 18px; padding: 12px 14px; border-left: 3px solid var(--gold); color: var(--muted); background: rgba(228,184,90,0.1); font-size: 13px; line-height: 1.55; }
.answer-list { display: grid; gap: 10px; }
.answer-button { display: grid; width: 100%; min-height: 60px; grid-template-columns: 28px 1fr; align-items: center; gap: 12px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: rgba(255,255,255,0.56); cursor: pointer; text-align: left; }
.answer-button:hover { border-color: var(--gold-deep); background: var(--paper-2); transform: translateX(2px); }
.answer-key { display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--gold-deep); font-family: var(--serif); }
.feedback { margin-top: 18px; padding: 18px; border-left: 4px solid var(--jade); color: var(--ink); background: rgba(61,196,154,0.1); line-height: 1.6; }
.feedback.is-wrong { border-color: var(--coral); background: rgba(242,123,102,0.1); }
.feedback strong { display: block; margin-bottom: 4px; font-family: var(--serif); font-size: 19px; }
.answer-button:disabled { cursor: default; transform: none; }
.answer-button.is-correct { border-color: #1a8b69; background: rgba(61,196,154,0.13); }
.answer-button.is-wrong { border-color: #cb5c49; background: rgba(242,123,102,0.1); }
.continue-button { margin-top: 18px; }
.evidence-board { display: flex; align-items: center; gap: 20px; min-height: 70px; padding: 12px 18px; border: 1px solid rgba(228,184,90,0.25); border-top: 0; color: rgba(246,240,228,0.72); background: rgba(255,255,255,0.035); }
.evidence-board > div:first-child { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; color: var(--gold); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.evidence-board > div:last-child { display: flex; flex-wrap: wrap; gap: 7px; }
.evidence-chip { padding: 6px 9px; border: 1px solid rgba(255,255,255,0.12); border-radius: 999px; color: var(--paper); background: rgba(255,255,255,0.05); font-size: 10px; font-weight: 750; animation: chip-in 300ms ease both; }
.empty-evidence { color: rgba(246,240,228,0.42); font-size: 11px; font-style: italic; }

.results-screen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 0.45fr); gap: 22px; animation: reveal 420ms ease both; }
.verdict-card, .review-docket { border: 1px solid rgba(228,184,90,0.3); border-radius: 8px; box-shadow: var(--shadow); }
.verdict-card { position: relative; overflow: hidden; padding: clamp(34px, 6vw, 78px); color: var(--ink); background: var(--paper); }
.verdict-card::after { position: absolute; right: -80px; bottom: -100px; width: 300px; height: 300px; border: 58px solid rgba(61,196,154,0.08); border-radius: 50%; content: ""; }
.verdict-card .case-kicker { color: var(--gold-deep); }
.verdict-grade { position: absolute; top: 34px; right: 38px; display: grid; width: 82px; height: 82px; place-items: center; border: 2px solid var(--gold-deep); border-radius: 50%; color: var(--gold-deep); font-family: var(--serif); font-size: 44px; transform: rotate(5deg); }
.verdict-card h2 { max-width: 690px; margin: 0; padding-right: 80px; font-family: var(--serif); font-size: clamp(42px, 6vw, 78px); font-weight: 500; letter-spacing: -0.045em; line-height: 0.98; }
.verdict-copy { max-width: 680px; margin: 24px 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.verdict-card blockquote { max-width: 680px; margin: 28px 0; padding: 18px 22px; border-left: 4px solid var(--jade); color: var(--ink); background: rgba(61,196,154,0.1); font-family: var(--serif); font-size: 20px; font-style: italic; line-height: 1.5; }
.verdict-stats { position: relative; z-index: 1; display: grid; max-width: 620px; grid-template-columns: repeat(3, 1fr); margin-top: 34px; border-block: 1px solid var(--line); }
.verdict-stats div { display: grid; gap: 4px; padding: 18px 12px 18px 0; }
.verdict-stats strong { font-family: var(--serif); font-size: 32px; font-weight: 500; }
.verdict-stats span { color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: 0.12em; text-transform: uppercase; }
.verdict-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.action-link { display: inline-flex; align-items: center; text-decoration: none; }
.verdict-card .secondary-action { color: var(--ink); border-color: var(--line); background: rgba(255,255,255,0.5); }
.review-docket { padding: clamp(26px, 4vw, 42px); color: var(--paper); background: var(--night-2); }
.review-docket h3 { margin: 0; font-family: var(--serif); font-size: 32px; font-weight: 500; }
.review-docket > p:not(.doctrine-tag):not(.local-note) { color: rgba(246,240,228,0.57); font-size: 13px; line-height: 1.55; }
.review-list { display: grid; gap: 8px; margin-top: 24px; }
.review-item { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; min-height: 50px; padding: 9px 10px; border: 1px solid rgba(255,255,255,0.1); border-radius: 4px; color: var(--paper); text-decoration: none; }
.review-item:hover { border-color: rgba(228,184,90,0.5); }
.review-item .review-status { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: var(--night); background: var(--jade); font-size: 12px; font-weight: 900; }
.review-item.missed .review-status { background: var(--coral); }
.review-item strong { font-size: 11px; }
.review-item small { color: rgba(246,240,228,0.44); font-size: 10px; }
.local-note { margin-top: 26px; color: rgba(246,240,228,0.42); font-size: 10px; line-height: 1.5; }
.game-footer { display: flex; width: min(1220px, calc(100% - 40px)); align-items: center; justify-content: space-between; gap: 20px; padding: 22px 0 28px; margin: 0 auto; border-top: 1px solid rgba(255,255,255,0.08); color: rgba(246,240,228,0.42); font-size: 10px; }
.game-footer p { margin: 0; }
.game-footer nav { display: flex; gap: 18px; }
.game-footer a { min-height: 36px; display: inline-flex; align-items: center; color: rgba(246,240,228,0.58); text-decoration: none; }
.game-footer a:hover { color: var(--gold); }

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(1,10,16,0.8); backdrop-filter: blur(10px); }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: min(620px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: clamp(28px, 5vw, 48px); border: 1px solid rgba(228,184,90,0.48); border-radius: 8px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); }
.modal-card h2 { margin: 0 0 22px; font-family: var(--serif); font-size: clamp(31px, 5vw, 45px); font-weight: 500; line-height: 1.05; }
.modal-card ol { display: grid; gap: 14px; padding-left: 24px; color: var(--muted); line-height: 1.55; }
.modal-close { position: absolute; top: 12px; right: 14px; width: 44px; height: 44px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 30px; }
.modal-card .secondary-action { margin-top: 12px; color: var(--ink); border-color: var(--line); background: rgba(255,255,255,0.55); }

[hidden] { display: none !important; }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } }
@keyframes chip-in { from { opacity: 0; transform: scale(0.85); } }
@media (max-width: 900px) {
    .start-screen { grid-template-columns: 1fr; }
    .case-visual { width: min(580px, 100%); }
    .trial-layout { grid-template-columns: 1fr; }
    .speaker-card { min-height: auto; }
    .speaker-card blockquote { margin-top: 28px; }
    .results-screen { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .game-topbar, .game-main { width: min(100% - 28px, 1220px); }
    .game-topbar { min-height: 66px; }
    .save-status { display: none; }
    .quiet-link { font-size: 12px; }
    .game-main { padding-top: 32px; }
    .start-screen { min-height: auto; gap: 44px; }
    .opening-copy h1 { font-size: clamp(47px, 16vw, 68px); }
    .briefing-card { grid-template-columns: 38px 1fr; padding: 14px; }
    .briefing-mark { width: 34px; height: 34px; }
    .opening-actions, .opening-actions button { width: 100%; }
    .primary-action { width: 100%; }
    .case-caption { grid-template-columns: 1fr; }
    .case-caption > div + div { border-top: 1px solid var(--line); border-left: 0; }
    .case-hud { align-items: flex-start; }
    .hud-meters { gap: 12px; }
    .hud-meters div:first-child { display: none; }
    .speaker-card, .decision-panel { padding: 24px; }
    .speaker-portrait { width: 78px; height: 78px; }
    .speaker-card blockquote { font-size: 18px; }
    .evidence-board { align-items: flex-start; flex-direction: column; gap: 8px; }
    .verdict-grade { position: static; width: 66px; height: 66px; margin-bottom: 24px; font-size: 34px; }
    .verdict-card h2 { padding-right: 0; }
    .verdict-stats strong { font-size: 25px; }
    .game-footer { width: min(100% - 28px, 1220px); align-items: flex-start; flex-direction: column; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
