:root {
  --ink: #e8eee9;
  --muted: #a5b1ad;
  --paper: #202c32;
  --line: #3a484d;
  --teal: #49b8ad;
  --teal-dark: #8ce0d0;
  --coral: #f07b68;
  --yellow: #e8c261;
  --shadow: 0 20px 50px rgba(23, 35, 41, 0.11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: #111b21;
  background-image: linear-gradient(135deg, rgba(55,79,84,.28), transparent 50%), repeating-linear-gradient(0deg, rgba(177,212,201,.035) 0, rgba(177,212,201,.035) 1px, transparent 1px, transparent 8px);
  font-family: "Nunito Sans", sans-serif;
}

.game-shell { max-width: 1180px; margin: 0 auto; padding: 28px 28px 36px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 70px; }
.brand { color: var(--ink); display: inline-flex; align-items: center; gap: 11px; font-size: 15px; letter-spacing: .08em; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; color: #102027; background: var(--teal); border-radius: 50%; font-family: "DM Mono", monospace; font-size: 17px; font-weight: 500; }
.brand strong { font-weight: 900; }
.topbar-details { display: flex; align-items: center; gap: 24px; }
.case-tag { color: var(--muted); font-family: "DM Mono", monospace; font-size: 11px; letter-spacing: .08em; }
.case-tag b { color: var(--coral); font-weight: 500; }
.score-display { display: flex; align-items: center; gap: 9px; padding: 8px 11px; color: var(--teal); background: #1e3b3d; border: 1px solid #346a69; font-family: "DM Mono", monospace; font-size: 10px; letter-spacing: .08em; }
.score-display strong { color: var(--ink); font-size: 15px; letter-spacing: 0; }
.intro { display: flex; justify-content: space-between; gap: 40px; align-items: end; margin-bottom: 46px; }
.intro-copy { max-width: 730px; }
.eyebrow, .section-kicker { margin: 0 0 13px; color: var(--teal); font-family: "DM Mono", monospace; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
h1, h2 { margin: 0; font-weight: 900; letter-spacing: -.045em; }
h1 { max-width: 670px; font-size: clamp(2.8rem, 6vw, 5.6rem); line-height: .93; }
h1 span { color: var(--coral); }
.lede { max-width: 580px; margin: 22px 0 0; color: var(--muted); font-size: 16px; line-height: 1.55; }
.case-stamp { display: flex; align-items: center; gap: 9px; color: var(--coral); font-family: "DM Mono", monospace; font-size: 10px; letter-spacing: .1em; line-height: 1.3; transform: rotate(-6deg); }
.case-stamp strong { font-size: 17px; }
.stamp-dot { width: 18px; height: 18px; border: 4px solid var(--coral); border-radius: 50%; }
.case-progress { display: flex; align-items: center; gap: 20px; margin-bottom: 34px; padding: 12px 16px; background: #18242a; border: 1px solid #33454a; }
.progress-label { margin: 0; color: var(--yellow); font-family: "DM Mono", monospace; font-size: 10px; letter-spacing: .1em; white-space: nowrap; }
.progress-list { display: flex; flex-wrap: wrap; gap: 8px; }
.progress-case { padding: 8px 11px; color: var(--muted); background: transparent; border: 1px solid #3b4c51; font: 500 11px "DM Mono", monospace; }
.progress-case.current { color: var(--yellow); border-color: var(--yellow); }
.progress-case.complete { color: var(--teal); border-color: #438b87; }
.progress-case:not(:disabled):hover { color: var(--ink); background: #2b3a3e; transform: none; }
.progress-case:disabled { color: #647174; background: #202b30; cursor: not-allowed; }
.case-evidence { margin-bottom: 34px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 16px; }
.section-heading h2 { font-size: 25px; }
.evidence-count { color: var(--coral); font-family: "DM Mono", monospace; font-size: 10px; letter-spacing: .1em; }
.evidence-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.evidence-card { display: flex; gap: 15px; min-height: 126px; padding: 20px; background: var(--paper); border: 1px solid rgba(201,226,216,.13); border-top: 3px solid var(--yellow); box-shadow: 0 8px 22px rgba(0,0,0,.24); cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.evidence-card:hover, .evidence-card:focus { outline: none; background: #293a40; border-color: var(--teal); transform: translateY(-2px); }
.evidence-card.open { background: #263d40; border-top-color: var(--teal); }
.evidence-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; color: var(--teal); border: 1px solid #438b87; border-radius: 50%; font-family: "DM Mono", monospace; font-size: 10px; }
.evidence-card h3 { margin: 1px 0 8px; font-size: 14px; }
.evidence-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.evidence-detail { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #506165; color: #dce8e2; font-size: 12px; line-height: 1.5; }
.evidence-panel { overflow: hidden; background: var(--paper); border: 1px solid rgba(201,226,216,.13); box-shadow: var(--shadow); }
.panel-heading, .panel-footer { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 25px 30px; }
h2 { font-size: 25px; }
.selection-note { display: flex; align-items: center; gap: 9px; margin: 0; color: var(--muted); font-size: 12px; }
.selection-indicator { width: 8px; height: 8px; background: var(--yellow); border-radius: 50%; }
.case-dossier { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #1a252b; }
.dossier-item { display: flex; flex-direction: column; gap: 6px; padding: 15px 30px; border-right: 1px solid var(--line); }
.dossier-item:last-child { border-right: 0; }
.dossier-label { color: #8a9896; font-family: "DM Mono", monospace; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.dossier-item strong { color: var(--ink); font-size: 12px; font-weight: 800; }
.dossier-status { flex-direction: row; align-items: center; gap: 9px; }
.dossier-status strong { display: block; color: var(--teal-dark); }
.status-light { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px #28494a; }
.status-light.solved { background: var(--yellow); box-shadow: 0 0 0 4px #5a4a2f; }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.table-title { margin: 0; padding: 15px 30px; color: var(--ink); background: #29373d; border-left: 4px solid var(--coral); font-family: "DM Mono", monospace; font-size: 11px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }
table { width: 100%; min-width: 750px; border-collapse: collapse; text-align: left; }
th { padding: 15px 20px; background: #18242a; color: var(--muted); font-family: "DM Mono", monospace; font-size: 10px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; }
th:first-child, td:first-child { padding-left: 30px; }
th:last-child, td:last-child { padding-right: 30px; }
td { padding: 17px 20px; border-top: 1px solid var(--line); color: #415159; font-size: 13px; }
td:nth-child(1), td:nth-child(3), td:nth-child(4) { color: #f4f7f3; }
.evidence-date { white-space: nowrap; }
.evidence-number { display: inline-block; width: 24px; margin-right: 11px; color: #9aa7a4; font-family: "DM Mono", monospace; font-size: 10px; }
.evidence-date::before { display: inline-block; width: 6px; height: 6px; margin-right: 8px; border: 1px solid #b7c4c1; border-radius: 50%; content: ""; vertical-align: 1px; }
tbody tr { cursor: pointer; transition: background .16s ease, box-shadow .16s ease; }
tbody tr:hover, tbody tr:focus { outline: none; background: #3a3730; }
tbody tr:focus { box-shadow: inset 4px 0 var(--yellow); }
tbody tr.selected { background: #234a4b; box-shadow: inset 4px 0 var(--teal); }
tbody tr.selected .evidence-date::before { border-color: var(--teal); background: var(--teal); box-shadow: 0 0 0 3px #c5e5de; }
tbody tr.selected td { color: var(--ink); }
.ref { color: var(--teal); font-family: "DM Mono", monospace; font-size: 12px; }
.amount { color: var(--ink); font-family: "DM Mono", monospace; font-size: 12px; text-align: right; white-space: nowrap; }
.debit, .credit { display: inline-block; min-width: 25px; margin-left: 7px; padding: 3px 4px; border-radius: 3px; font-size: 9px; text-align: center; }
.debit { color: #ffb1a2; background: #553238; }
.credit { color: #9be8da; background: #234d4d; }
.panel-footer { align-items: center; }
.action-buttons { display: flex; align-items: center; gap: 10px; }
.reset-button { color: var(--teal); background: transparent; border: 1px solid #4f696b; }
.reset-button:hover { color: var(--ink); background: #2b3a3e; transform: translateY(-2px); }
.next-case-button { background: var(--coral); }
.next-case-button:hover:not(:disabled) { background: #c45e50; }
.results-screen { padding: 48px 30px; background: var(--paper); border: 1px solid rgba(201,226,216,.13); box-shadow: var(--shadow); text-align: center; }
.game-shell.results-mode .case-tag, .game-shell.results-mode .score-display { display: none; }
.game-shell.results-mode > .intro, .game-shell.results-mode > .case-progress, .game-shell.results-mode > .case-evidence, .game-shell.results-mode > .evidence-panel { display: none; }
.results-screen h2 { color: var(--coral); font-size: clamp(2.4rem, 6vw, 4.8rem); }
.results-intro { margin: 12px 0 28px; color: var(--muted); font-size: 15px; }
.results-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); text-align: left; }
.result-stat { display: flex; flex-direction: column; gap: 9px; min-height: 100px; padding: 18px; border-right: 1px solid var(--line); background: #1a252b; }
.result-stat:last-child { border-right: 0; }
.result-stat span, .ranking-banner span { color: var(--muted); font-family: "DM Mono", monospace; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.result-stat strong { color: var(--ink); font-size: 19px; line-height: 1.1; }
.result-stat-large { background: #234a4b; }
.result-stat-large strong { color: var(--teal); font-size: 29px; }
.ranking-banner { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 14px 0 25px; padding: 18px; background: #18242a; border-left: 4px solid var(--yellow); text-align: left; }
.ranking-banner strong { color: var(--yellow); font-family: "DM Mono", monospace; font-size: 13px; letter-spacing: .04em; text-align: right; }
.play-again-button { background: var(--coral); }
.play-again-button:hover:not(:disabled) { background: #c45e50; }
.hint { margin: 0; color: var(--muted); font-size: 12px; }
.hint span { margin-right: 7px; color: var(--coral); font-family: "DM Mono", monospace; font-size: 10px; font-weight: 500; }
button { border: 0; padding: 14px 18px; color: white; background: var(--teal); font: 800 13px "Nunito Sans", sans-serif; cursor: pointer; transition: background .16s ease, transform .16s ease; }
button span { margin-left: 10px; font-size: 18px; vertical-align: -1px; }
button:hover:not(:disabled) { background: var(--teal-dark); transform: translateY(-2px); }
button:disabled { color: #83908d; background: #354247; cursor: not-allowed; }
.result { margin: 0 30px 25px; padding: 15px 18px; border-left: 4px solid var(--teal); background: #1b4241; color: #a7ebdf; font-size: 14px; font-weight: 700; }
.result.incorrect { border-color: var(--coral); background: #4b2d31; color: #ffb1a2; }
footer { padding-top: 25px; color: #8a9896; font-family: "DM Mono", monospace; font-size: 9px; letter-spacing: .12em; text-align: center; }
.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; }

@media (max-width: 650px) {
  .game-shell { padding: 22px 16px 28px; }
  .topbar { margin-bottom: 48px; }
  .topbar-details { align-items: end; flex-direction: column; gap: 10px; }
  .intro { align-items: start; flex-direction: column; margin-bottom: 34px; gap: 24px; }
  h1 { font-size: 3.2rem; }
  .case-stamp { align-self: end; }
  .case-progress { align-items: start; flex-direction: column; gap: 11px; }
  .section-heading { align-items: start; flex-direction: column; gap: 8px; }
  .evidence-cards { grid-template-columns: 1fr; }
  .results-screen { padding: 35px 18px; }
  .results-grid { grid-template-columns: repeat(2, 1fr); }
  .result-stat:nth-child(2) { border-right: 0; }
  .result-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .ranking-banner { align-items: start; flex-direction: column; }
  .ranking-banner strong { text-align: left; }
  .panel-heading, .panel-footer { align-items: start; flex-direction: column; padding: 22px 18px; }
  .case-dossier { grid-template-columns: repeat(2, 1fr); }
  .dossier-item { padding: 14px 18px; }
  .dossier-item:nth-child(2) { border-right: 0; }
  .dossier-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  h2 { font-size: 22px; }
  th:first-child, td:first-child { padding-left: 18px; }
  th:last-child, td:last-child { padding-right: 18px; }
  .panel-footer button { width: 100%; }
  .action-buttons { width: 100%; flex-direction: column-reverse; }
  .result { margin: 0 18px 20px; }
}
