/* ALIBI — lamp-lit neo-noir. Tokens first; every surface uses them. */
:root {
  color-scheme: dark;
  --ink: #100e0c;
  --ink-2: #171410;
  --paper: #221e1a;
  --paper-2: #2b261f;
  --line: #3e362c;
  --line-strong: #6e6254;
  --text: #f3eadc;
  --muted: #b3a794;
  --amber: #e4b15a;
  --amber-2: #f0d7a8;
  --amber-ink: #1c1308;
  --red: #e7b0aa;
  --red-ink: #8e2f2a;
  --green: #9dceb4;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  --radius: 16px;
  --font: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, sans-serif;
  --mono: Consolas, "Cascadia Mono", "Segoe UI Mono", ui-monospace, monospace;
  --max: 1180px;
  --focus: 2px solid var(--amber);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-padding-top: 76px; scrollbar-color: #4a4034 var(--ink); }
body {
  min-height: 100vh;
  color: var(--text);
  font: 16px/1.5 var(--sans);
  background-color: var(--ink);
  background-image:
    radial-gradient(ellipse 90% 46% at 50% -12%, rgba(228, 150, 64, 0.2), transparent 58%),
    radial-gradient(ellipse 42% 36% at 100% 100%, rgba(92, 32, 26, 0.18), transparent 62%),
    radial-gradient(ellipse 36% 28% at 0% 86%, rgba(48, 36, 22, 0.45), transparent 70%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 160px 160px;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, transparent 62%, rgba(0, 0, 0, 0.28) 100%);
}
::selection { background: rgba(228, 177, 90, 0.32); color: #fff8ee; }
a { color: var(--amber); }
button, summary { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- chrome ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 6px 12px 4px;
  padding-top: calc(6px + env(safe-area-inset-top));
  background: rgba(12, 10, 9, 0.9);
  border-bottom: 1px solid rgba(228, 177, 90, 0.22);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}
.brand {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: 44px;
  padding: 4px 2px 4px 16px;
  color: var(--amber-2);
  font-family: var(--font);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.24em;
  text-decoration: none;
}
.brand::before {
  content: "";
  position: absolute;
  top: 15px;
  left: 0;
  width: 7px;
  height: 7px;
  background: var(--amber);
  transform: rotate(45deg);
}
.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.topnav { display: flex; flex: 1 1 220px; flex-wrap: wrap; align-items: center; }
.topnav a, .topnav button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}
.topnav a:hover, .topnav button:hover { color: var(--text); background: rgba(243, 234, 220, 0.04); }
.topnav a.active {
  color: var(--amber-2);
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--amber);
}
.topnav .up { color: var(--muted); }

main { max-width: var(--max); margin: 0 auto; padding: 18px 12px 40px; }
.kicker {
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
h1, h2, .stamp, .name, .timer, .stat b, .fact b { font-family: var(--font); font-weight: 500; }

/* ---------- home ---------- */
.hero { max-width: 740px; padding: 28px 0 12px; }
.hero h1 {
  margin: 8px 0 14px;
  font-size: clamp(34px, 7vw, 62px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.04;
}
.hero h1::after {
  content: "";
  display: block;
  width: 76px;
  height: 2px;
  margin-top: 16px;
  background: linear-gradient(90deg, var(--amber), transparent);
}
.hero p { margin: 0 0 18px; color: var(--muted); font-size: 18px; }
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin-top: 8px; }
.mode {
  position: relative;
  display: block;
  padding: 18px 18px 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(228, 177, 90, 0.07), transparent 42%),
    var(--paper);
  color: var(--text);
  text-align: left;
  text-decoration: none;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 236, 210, 0.05);
}
.mode::before {
  content: "";
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
}
.mode h2 { margin: 6px 0; color: var(--text); font-size: 24px; }
.mode p { margin: 0; color: var(--muted); font-size: 14.5px; }
.mode .tag { color: var(--amber); font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.status-line { margin: 12px 0 0; color: var(--muted); font-size: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper-2);
  color: var(--text);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 236, 210, 0.04);
}
.btn:hover { border-color: var(--amber); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  border-color: #f0d7a8;
  background: linear-gradient(180deg, #f0c57a, #d79a3e);
  color: var(--amber-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 1px 0 rgba(0, 0, 0, 0.35);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 44px; padding: 8px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.25); }
.witness:disabled { opacity: 1; filter: none; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tiers { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tiers button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--text);
}
.tiers button[aria-pressed="true"] {
  border-color: var(--amber);
  background: var(--amber);
  color: var(--amber-ink);
}

/* ---------- case ---------- */
.case-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 16px; align-items: flex-end; margin-bottom: 12px; }
.case-title { min-width: 0; flex: 1 1 240px; }
.case-title h1 {
  max-width: 40rem;
  margin: 4px 0 0;
  font-size: clamp(21px, 4.6vw, 30px);
  font-style: italic;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.22;
  overflow-wrap: break-word;
}
.case-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.case-meta .timer {
  min-width: 4.6em;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 14, 12, 0.65);
  color: var(--amber-2);
  font-size: 20px;
  text-align: center;
}
.progress { font-size: 13px; }
.progress b { color: var(--text); }

.case { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.board {
  position: relative;
  min-width: 0;
  min-height: 240px;
  padding: 10px;
  overflow: visible;
  border: 1px solid #4a3e30;
  border-radius: 18px;
  background-color: #1a1612;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(228, 177, 90, 0.09), transparent 52%),
    radial-gradient(circle, rgba(255, 214, 170, 0.045) 1px, transparent 1.15px);
  background-size: auto, 18px 18px;
  box-shadow: var(--shadow), inset 0 0 70px rgba(0, 0, 0, 0.28);
}
.strings { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
.strings line {
  stroke: var(--amber-2);
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-dasharray: 1.5 7;
  opacity: 0.9;
  filter: drop-shadow(0 0 1px rgba(228, 177, 90, 0.35));
}
.witnesses {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  perspective: 900px;
}

.witness {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto;
  justify-items: center;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: 16px 4px 8px;
  border: 4px solid #978976;
  border-radius: 12px;
  background: linear-gradient(180deg, #2c2823 0%, #231f1b 100%);
  box-shadow: inset 0 1px 0 rgba(255, 236, 210, 0.05), 0 8px 16px rgba(0, 0, 0, 0.32);
  touch-action: manipulation;
  user-select: none;
}
.witness .portrait {
  display: block;
  width: 58px;
  height: 58px;
  border-radius: 9px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45), 0 8px 14px rgba(0, 0, 0, 0.35);
}
.witness span:has(.portrait) { position: relative; display: block; }
.witness span:has(.portrait)::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  z-index: 2;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6e4, #e4b15a 38%, #8a5a28 70%, #3a2612);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
  transform: translateX(-50%);
}
.witness .name {
  max-width: 100%;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  line-height: 1.15;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.witness .seat {
  position: absolute;
  top: 4px;
  left: 5px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.witness .badge {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
}
.witness .badge .ico { font-family: "Segoe UI Symbol", "Segoe UI", sans-serif; font-size: 12px; font-weight: 800; }
.witness .word { overflow: hidden; text-overflow: ellipsis; }

/* Status is icon + word + border style, not hue alone. */
.witness[data-status="unknown"] { border-style: solid; border-color: #978976; }
.witness[data-status="unknown"] .badge { border-style: solid; border-radius: 4px; }
.witness[data-status="honest"] { border-style: double; border-color: var(--green); }
.witness[data-status="honest"] .badge {
  border-style: solid;
  border-radius: 999px;
  border-color: var(--green);
  background: rgba(157, 206, 180, 0.1);
  color: var(--green);
}
.witness[data-status="lying"] { border-style: dashed; border-color: var(--red); }
.witness[data-status="lying"] .badge {
  border-style: dashed;
  border-radius: 4px;
  border-color: var(--red);
  background: rgba(231, 176, 170, 0.08);
  color: var(--red);
}
.witness.lit { box-shadow: 0 0 0 2px var(--amber), 0 10px 18px rgba(0, 0, 0, 0.35); }
.witness.flip { animation: flip 0.26s ease; }
@keyframes flip {
  0% { transform: rotateY(0); }
  45% { transform: rotateY(90deg); }
  100% { transform: rotateY(0); }
}
.witness.shake { animation: shake 0.32s ease; }
@keyframes shake {
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

.claims { position: relative; z-index: 1; display: grid; gap: 8px; margin-top: 12px; }
.claim {
  border: 1px solid #463e34;
  border-left: 3px solid var(--amber);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(243, 234, 220, 0.045);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}
.claim:hover, .claim:focus-within, .claim.lit { background: rgba(228, 177, 90, 0.1); }
.claim.lit { box-shadow: inset 0 0 0 1px rgba(228, 177, 90, 0.55), 0 6px 14px rgba(0, 0, 0, 0.18); }
.claim.conflict {
  border-style: dashed;
  border-color: rgba(231, 176, 170, 0.55);
  border-left-style: dashed;
  border-left-width: 3px;
  border-left-color: var(--red);
  background-color: rgba(142, 47, 42, 0.08);
  background-image: repeating-linear-gradient(-45deg, transparent, transparent 6px, rgba(231, 176, 170, 0.09) 6px, rgba(231, 176, 170, 0.09) 7px);
}
.claim.conflict.lit {
  background-color: rgba(228, 177, 90, 0.12);
  background-image: repeating-linear-gradient(-45deg, transparent, transparent 6px, rgba(231, 176, 170, 0.1) 6px, rgba(231, 176, 170, 0.1) 7px);
}
.claim .who {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.claim .who .warn { letter-spacing: 0; text-transform: none; font-weight: 600; }
.claim .warn:not(:empty) { color: var(--red); text-decoration: underline dotted; text-underline-offset: 2px; }
.claim p { margin: 4px 0 0; color: var(--text); font-family: var(--font); font-size: 16.5px; font-style: italic; line-height: 1.4; }
.claim .ref { color: var(--amber-2); font-style: italic; }

.tools { display: grid; gap: 12px; min-width: 0; }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(28, 24, 21, 0.94);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 236, 210, 0.04);
}
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .wide { grid-column: 1 / -1; }
.actions .btn { width: 100%; }
.hintbox { min-height: 20px; font-size: 14.5px; line-height: 1.45; }
.hintbox .label, .label {
  margin-bottom: 4px;
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hintbox .small { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hintbox .btn { min-height: 44px; }
.message { min-height: 0; color: var(--muted); font-size: 14px; }
.message:not(:empty) { min-height: 1.35em; }
.message.bad { color: var(--red); }
.message.ok { color: var(--green); }
.notebook summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  letter-spacing: 0.02em;
}
.notebook summary::marker { color: var(--amber); }
.notebook textarea {
  width: 100%;
  min-height: 112px;
  margin-top: 8px;
  padding: 4px 10px 8px;
  resize: vertical;
  border: 1px solid #cbbfa6;
  border-radius: 8px;
  background-color: #f4efe4;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 27px, rgba(176, 132, 72, 0.38) 28px);
  background-attachment: local;
  background-position: 0 2px;
  color: #2a2218;
  font: 16px/28px Georgia, "Iowan Old Style", Palatino, serif;
  caret-color: #6e3a22;
}
.notebook textarea::placeholder { color: #5c4e3c; }
.notebook .log {
  margin: 10px 0 0;
  padding-left: 16px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.legend { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.legend b { color: var(--text); }

/* The action panel pins to the viewport until the desk layout takes over. */
.tools > .panel:has(> .actions) {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  border: 0;
  border-top: 1px solid rgba(228, 177, 90, 0.35);
  border-radius: 16px 16px 0 0;
  background: rgba(16, 13, 11, 0.96);
  box-shadow: 0 -14px 36px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(12px);
}
.tools > .panel:has(> .actions) .message:not(:empty) { order: -1; margin-bottom: 6px; }
body:has(.case) footer { padding-bottom: calc(220px + env(safe-area-inset-bottom)); }
@media (max-width: 1179px) {
  html:has(.case) { scroll-padding-bottom: 230px; }
  .topnav { flex-basis: 100%; }
}

/* ---------- case closed ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse at 50% 40%, rgba(48, 28, 18, 0.35), rgba(6, 5, 4, 0.88) 70%);
  animation: fade 0.22s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.closed {
  position: relative;
  width: min(540px, 100%);
  padding: 26px 22px 22px;
  border: 1px solid rgba(228, 177, 90, 0.38);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(228, 177, 90, 0.12), transparent 46%),
    linear-gradient(180deg, #2a241e, #1b1815);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 28px 70px rgba(0, 0, 0, 0.55);
  animation: rise 0.28s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.closed .stamp {
  display: inline-block;
  margin: 2px 0 12px;
  padding: 7px 12px 6px;
  border: 3px solid var(--red-ink);
  border-radius: 3px;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(142, 47, 42, 0.05) 4px),
    #f3e6d2;
  color: var(--red-ink);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1;
  text-indent: 0.18em;
  box-shadow: inset 0 0 0 1px #f3e6d2, inset 0 0 0 2px rgba(142, 47, 42, 0.85);
  transform: rotate(-7deg);
  animation: stampIn 0.34s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes stampIn {
  from { opacity: 0; transform: rotate(-14deg) scale(1.12); }
  to { opacity: 1; transform: rotate(-7deg) scale(1); }
}
.closed h2 { margin: 2px 0 6px; font-size: clamp(26px, 5vw, 32px); }
.closed .legend { color: var(--text); }
.closed .facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.closed .fact {
  padding: 10px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(16, 14, 12, 0.35);
  text-align: center;
}
.closed .fact b { display: block; font-size: 22px; color: var(--amber-2); }
.closed .fact span { color: var(--muted); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.closed pre {
  margin: 0 0 12px;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #14110e;
  color: var(--text);
  font: 13px/1.55 var(--mono);
  white-space: pre-wrap;
}
.closed .close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
}
.closed .close:hover { background: rgba(243, 234, 220, 0.06); color: var(--text); }
.closed .row { margin-top: 4px; }

/* ---------- record ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0 20px; }
.stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(228, 177, 90, 0.06), transparent 40%), var(--paper);
  box-shadow: inset 0 1px 0 rgba(255, 236, 210, 0.04);
}
.stat b { display: block; font-size: 30px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
table.tiers-table { width: 100%; max-width: 560px; border-collapse: collapse; }
table.tiers-table td, table.tiers-table th { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.tiers-table th { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
table.tiers-table td { font-variant-numeric: tabular-nums; }

/* ---------- tutorial ---------- */
.coach {
  border-left: 3px solid var(--amber);
  background: linear-gradient(90deg, rgba(228, 177, 90, 0.08), transparent 46%), var(--paper);
}
.coach p { margin: 0 0 10px; font-size: 15px; }
.coach .steps { margin-bottom: 6px; color: var(--amber); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }

footer { border-top: 1px solid var(--line); padding: 18px 16px 28px; color: var(--muted); font-size: 14px; }
footer .inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; max-width: var(--max); margin: 0 auto; }
footer a { display: inline-flex; align-items: center; min-height: 44px; margin-right: 8px; color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.prose { max-width: 68ch; }
.prose h1 { margin: 8px 0 12px; font-size: clamp(32px, 6vw, 52px); letter-spacing: -0.02em; line-height: 1.08; }
.prose h2 { margin: 28px 0 8px; font-size: 26px; }
.prose p, .prose li { color: #e7dece; }
.prose a { text-underline-offset: 3px; }
.prose li::marker { color: var(--amber); }
.prose ul, .prose ol { padding-left: 1.25em; }

@media (min-width: 560px) {
  .witnesses { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; }
  .witness .portrait { width: 68px; height: 68px; }
  .witness .name { font-size: 16px; }
}
@media (min-width: 720px) {
  main { padding: 22px 20px 48px; }
  .topbar { padding-right: 18px; padding-left: 18px; }
  .board { padding: 16px; }
  .witness { padding: 12px 8px 10px; }
  .claim p { font-size: 17px; }
}
@media (min-width: 1180px) {
  .topnav { flex: 0 1 auto; margin-left: auto; flex-wrap: nowrap; }
  .topnav .up { margin-left: 4px; padding-left: 14px; border-left: 1px solid var(--line); border-radius: 0; }
  .case { grid-template-columns: minmax(0, 1fr) 332px; gap: 20px; }
  .tools { position: sticky; top: 78px; }
  .tools > .panel:has(> .actions) {
    position: static;
    display: block;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(28, 24, 21, 0.94);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 236, 210, 0.04);
    backdrop-filter: none;
  }
  .tools > .panel:has(> .actions) .message:not(:empty) { margin-bottom: 0; margin-top: 8px; }
  body:has(.case) footer { padding-bottom: 28px; }
  html:has(.case) { scroll-padding-bottom: 24px; }
  .witnesses { grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 12px; }
  .witness .portrait { width: 76px; height: 76px; }
  .witness .badge { font-size: 11px; }
  .witness .name { font-size: 17px; }
}

@media (hover: hover) and (pointer: fine) {
  .mode, .witness, .btn { transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease; }
  .mode:hover { transform: translateY(-2px); border-color: var(--amber); }
  .witness:hover:not(:disabled) { transform: translateY(-2px); }
}
@media (forced-colors: active) {
  :focus-visible { outline: 2px solid Highlight; }
  .witness[data-status="honest"] { border-style: double; }
  .witness[data-status="lying"] { border-style: dashed; }
  .witness[data-status="unknown"] { border-style: solid; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after {
  animation: none !important;
  transition: none !important;
}

/* Compact top bar on phones: brand and nav share one row; the nav scrolls sideways instead of wrapping. */
@media (max-width: 719px) {
  .topbar { flex-wrap: nowrap; gap: 8px; padding: 4px 0 4px 10px; padding-top: calc(4px + env(safe-area-inset-top)); }
  .brand { flex: 0 0 auto; min-height: 40px; padding-left: 14px; font-size: 17px; letter-spacing: 0.2em; }
  .brand::before { top: 13px; width: 6px; height: 6px; }
  .brand small { display: none; }
  .topnav {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    min-width: 0;
    padding-right: 20px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a, .topnav button { flex: 0 0 auto; min-height: 40px; padding: 0 8px; font-size: 13px; white-space: nowrap; }
  .topnav .up { margin-left: 2px; padding-left: 10px; border-left: 1px solid var(--line); border-radius: 0; }
  html { scroll-padding-top: 58px; }
}

/* Static description under the app: readable without JavaScript, out of the way with it. */
.about-game { max-width: 68ch; margin: 36px auto 24px; padding: 0 16px; }
.about-game h2 { font-size: clamp(24px, 4vw, 34px); margin: 6px 0 10px; }
.about-game h3 { font-size: 18px; margin: 20px 0 6px; }
