/*
 * styles.css — all styling for Prison Match.
 * Set dressing follows C:\Repo\Dev\MemoryPoker (itself after The Devil's Plan):
 * a lit concrete cell wall, dark slabs with a gold hairline, purple game
 * furniture, gold for anything you act on, engraved Cinzel caps and Zilla Slab.
 *
 * used_by: index.html
 * related: offline.html (carries its own minimal copy of the palette);
 *          ui.js (SVG gradients and the lattice pattern use the same purples)
 * rules:
 *   - Mobile-first at ~380px. Every tappable control is at least 44px.
 *   - Colour has one meaning each: gold = you / act now, purple = game
 *     furniture, red = bullet or eliminated, green = empty or safe. Red and
 *     green are the one departure from MemoryPoker's purple-and-gold-only rule,
 *     because here they carry the game's central fact.
 *   - Text straight on the wall is dark ink; text on a slab is cream or gold.
 *   - Fonts are local files in fonts/. No url() to another origin, ever.
 *   - Anything not needed right now is display:none, not greyed out (the
 *     action panel off-turn, the notebook hint after first use).
 *   - #toast is pointer-events:none so it can never block a tap.
 *   - The drum and the letters rotate with the same duration and easing, in
 *     opposite directions, so letters stay upright mid-turn.
 * message: --red and --green are read by tests/game.spec.js; keep the names.
 * wiki: PRD.md
 */

@font-face { font-family: "Cinzel"; font-weight: 400 700; font-style: normal; font-display: swap; src: url("fonts/cinzel-latin.woff2") format("woff2"); }
@font-face { font-family: "Zilla Slab"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/zilla-slab-400.woff2") format("woff2"); }
@font-face { font-family: "Zilla Slab"; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/zilla-slab-600.woff2") format("woff2"); }
@font-face { font-family: "Zilla Slab"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/zilla-slab-700.woff2") format("woff2"); }

:root {
  /* Concrete */
  --wall-lit: #a5a39e;
  --wall-mid: #7e7c78;
  --wall-dark: #5a5855;
  --wall-deep: #3e3d3b;

  /* Ink on the wall */
  --ink: #221e1b;
  --ink-soft: #3d3732;
  --ink-faint: #524c46;

  /* Slabs laid on the wall */
  --slab: #25211e;
  --slab-deep: #1a1816;
  --slab-bg: linear-gradient(180deg, rgba(48, 44, 41, 0.94), rgba(26, 24, 22, 0.96));
  --line: rgba(240, 220, 164, 0.2);
  --line-soft: rgba(240, 220, 164, 0.1);
  --cream: #d6cec2;
  --mute: #9c948a;
  --stock: #fbf9f4;

  /* Purple: the game furniture */
  --purple-900: #2d1245;
  --purple-700: #4a1d73;
  --purple-600: #5f2a94;
  --purple-500: #7634b4;
  --purple-400: #8a46c9;
  --purple-300: #ad7ae0;
  --purple-100: #e4d4f5;

  /* Gold: you, and anything you act on */
  --gold-600: #9c7628;
  --gold-500: #c6992f;
  --gold-400: #d9b254;
  --gold-200: #f0dca4;

  /* The game's one fact */
  --red: #e5594a;
  --red-deep: #9c2a21;
  --red-dim: #4a1a16;
  --green: #5cc487;
  --green-deep: #1f6a43;
  --green-dim: #173a28;

  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --body: "Zilla Slab", Rockwell, Georgia, serif;
  --turn: 0.75s;
  --ease: cubic-bezier(0.22, 0.61, 0.24, 1);
  --ease-snap: cubic-bezier(0.34, 1.46, 0.5, 1);
  --shadow-slab: 0 10px 24px -14px rgba(0, 0, 0, 0.9);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { color-scheme: dark; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.4;
  color: var(--cream);
  background-color: var(--wall-dark);
  /* One overhead light on a concrete wall. */
  background-image: radial-gradient(120% 88% at 50% 12%, var(--wall-lit) 0%, var(--wall-mid) 42%, var(--wall-dark) 74%, var(--wall-deep) 100%);
  background-attachment: fixed;
  touch-action: manipulation;
  overflow-x: hidden;
}

/* Concrete grain */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 8s steps(6) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); }
  75% { transform: translate(2%, 1%); }
}

button, input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

.shell {
  position: relative;
  z-index: 1;
  width: min(100%, 460px);
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------------- masthead ---------------- */

.masthead { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }

/* The purple ribbon with notched ends that every title hangs from. */
.eyebrow, .log-round span {
  display: inline-block;
  padding: 3px 16px;
  font-family: var(--display);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--gold-200);
  background: linear-gradient(180deg, var(--purple-700), var(--purple-900));
  box-shadow: inset 0 0 0 1px var(--gold-600), inset 0 1px 0 rgba(240, 220, 164, 0.3);
  clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%, 9px 50%);
}

/* Engraved into the wall */
.wordmark {
  font-family: var(--display);
  font-size: 1.42rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.05em;
  white-space: nowrap;
  text-transform: uppercase;
  color: #171412;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.16), 0 -1px 1px rgba(0, 0, 0, 0.5);
}

.tools { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tools .btn { padding: 8px 12px; }

/* ---------------- buttons ---------------- */

.btn {
  appearance: none;
  min-height: 46px;
  min-width: 46px;
  padding: 8px 12px;
  border: 1px solid var(--purple-700);
  border-radius: 2px;
  background: linear-gradient(180deg, var(--purple-500), var(--purple-900));
  box-shadow: inset 0 1px 0 rgba(240, 220, 164, 0.22), 0 8px 18px -10px rgba(0, 0, 0, 0.95);
  font-family: var(--display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-200);
  cursor: pointer;
  transition: transform 0.16s var(--ease-snap), filter 0.2s ease, box-shadow 0.25s ease, border-color 0.2s;
}
.btn:hover:not(:disabled) { filter: brightness(1.18); transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0); filter: brightness(0.95); }
.btn:focus-visible, .toggle:focus-within, summary:focus-visible { outline: 2px solid var(--gold-200); outline-offset: 2px; }
.btn:disabled { opacity: 0.38; cursor: not-allowed; box-shadow: none; }

.btn-ghost { background: rgba(24, 20, 18, 0.62); border-color: rgba(240, 220, 164, 0.28); box-shadow: none; }
.btn-ghost:hover:not(:disabled) { background: rgba(45, 18, 69, 0.7); border-color: rgba(240, 220, 164, 0.45); filter: none; }
.btn-danger { border-color: var(--red) !important; color: var(--red) !important; }
/* Gold: the one button that moves the game on. */
.btn-primary { background: linear-gradient(180deg, var(--gold-200), var(--gold-500)); border-color: var(--gold-600); color: #1d1608; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 8px 18px -10px rgba(0, 0, 0, 0.95); }
.btn-wide { width: 100%; min-height: 54px; font-size: 0.8rem; letter-spacing: 0.22em; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 46px;
  padding: 0 4px;
  font-family: var(--display);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { position: relative; width: 36px; height: 20px; border-radius: 2px; background: rgba(24, 20, 18, 0.72); border: 1px solid rgba(240, 220, 164, 0.3); }
.toggle-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; background: var(--mute); transform: rotate(45deg) scale(0.8); transition: transform 0.18s var(--ease-snap), background 0.15s; }
.toggle input:checked + .toggle-track { background: var(--purple-900); border-color: var(--gold-500); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px) rotate(45deg) scale(0.8); background: var(--gold-400); }

/* ---------------- status strip ---------------- */

.status { display: grid; grid-template-columns: auto auto 1fr; border: 1px solid var(--line); background: var(--slab-bg); box-shadow: var(--shadow-slab); }
.stat { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 14px; min-width: 0; }
.stat + .stat { border-left: 1px solid var(--line-soft); }
.stat-wide { align-items: flex-start; }
.stat-label { display: block; font-family: var(--display); font-size: 0.46rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-200); white-space: nowrap; }
.stat-value { font-size: 1.35rem; font-weight: 700; line-height: 1.05; color: var(--stock); font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
#credits { color: var(--gold-400); }
.stat-turn { max-width: 100%; font-size: 0.92rem; font-weight: 600; line-height: 1.55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-turn.is-you { color: var(--gold-400); }

/* ---------------- barrel ---------------- */

.barrel-wrap { display: flex; flex-direction: column; gap: 4px; }
#barrel { display: block; width: 100%; height: auto; max-height: 62svh; user-select: none; -webkit-user-select: none; }
#barrel text { text-anchor: middle; dominant-baseline: middle; pointer-events: none; }

.track { fill: none; stroke: rgba(34, 30, 27, 0.3); stroke-width: 1; stroke-dasharray: 2 5; }

.seat { filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.45)); }
.seat-plate { fill: var(--slab); stroke: rgba(240, 220, 164, 0.32); stroke-width: 1; transition: stroke 0.2s, fill 0.2s; }
.rivet { display: none; }
.seat-id { font-family: var(--display); font-size: 14px; font-weight: 700; fill: var(--stock); letter-spacing: 0.06em; }
.seat-name { font-family: var(--body); font-size: 8.6px; font-weight: 600; fill: var(--mute); letter-spacing: 0.08em; }
.seat-flag { font-family: var(--display); font-size: 8px; font-weight: 700; fill: var(--red); letter-spacing: 0.14em; paint-order: stroke; stroke: var(--slab-deep); stroke-width: 3.5px; stroke-linejoin: round; }

/* Folded-paper figure on each plate: one sheet, creased down the middle. */
.fig-skin { fill: #e8c9a8; }
.fig-skin-shade { fill: #d2ab86; }
.fig-hair { fill: #231c26; }
.fig-body { fill: var(--purple-400); }
.fig-body-shade { fill: var(--purple-600); }
.seat-you .fig-hair { fill: #6b4a2f; }
.seat-you .fig-body { fill: var(--gold-400); }
.seat-you .fig-body-shade { fill: var(--gold-600); }

.seat-you .seat-plate { stroke: var(--gold-400); stroke-width: 1.6; fill: var(--purple-900); }
.seat-you .seat-name { fill: var(--gold-200); font-family: var(--display); font-size: 8.5px; font-weight: 700; letter-spacing: 0.3em; }
.seat-active .seat-plate { stroke: var(--gold-200); stroke-width: 2.4; filter: drop-shadow(0 0 7px rgba(240, 220, 164, 0.9)); animation: pulse 1.1s ease-in-out infinite; }
.seat-zero .seat-id, .seat-zero .seat-name { fill: #6f6861; }
.seat-zero .seat-plate { stroke-dasharray: 4 3; }
.seat-zero .fig { opacity: 0.4; }
.seat-safe .seat-plate { stroke: var(--green); fill: var(--green-dim); }
.seat-safe .seat-flag { fill: var(--green); }
.seat-dead .seat-plate { stroke: var(--red); fill: var(--red-dim); }
.seat-dead .seat-flag { fill: var(--red); }
.seat-dead .fig { opacity: 0.35; }

@keyframes pulse { 50% { filter: drop-shadow(0 0 2px rgba(240, 220, 164, 0.4)); } }

.pointer { fill: var(--ink-soft); }
.pointer-you { fill: var(--gold-400); stroke: var(--ink); stroke-width: 1; }

/* The drum is a card back: purple filigree lattice inside a gold rule. */
.drum { transform-origin: 190px 190px; transition: transform var(--turn) var(--ease); }
.drum-shadow { fill: rgba(0, 0, 0, 0.35); filter: blur(6px); }
.drum-body { fill: url(#drum-metal); stroke: var(--purple-900); stroke-width: 2; }
.drum-lattice { fill: url(#lattice); }
.drum-lip { fill: none; stroke: var(--gold-500); stroke-width: 1.4; opacity: 0.85; }
.flute { fill: var(--wall-dark); stroke: var(--purple-900); stroke-width: 2; }
.hub { fill: var(--purple-900); stroke: var(--gold-600); stroke-width: 1.2; }
.hub-pin { fill: url(#crest); stroke: rgba(45, 18, 69, 0.6); stroke-width: 1; }

/* No focus rectangle or tap flash on chambers: the note colours are the feedback.
   Keyboard focus is shown by a glow on the round rim instead. */
.chamber { cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; }
.chamber:focus { outline: none; }
.chamber:focus-visible .chamber-rim { filter: drop-shadow(0 0 5px var(--gold-200)); }
.upright { transform-origin: 0 0; transition: transform var(--turn) var(--ease); }
/* Each chamber is the cream badge from the card back, carrying its letter. */
.chamber-rim { fill: var(--purple-900); stroke: var(--purple-300); stroke-width: 1.2; transition: stroke 0.15s, fill 0.15s; }
.chamber-bore { fill: url(#bore); stroke: var(--purple-700); stroke-width: 1; transition: fill 0.2s; }
.chamber-letter { font-family: var(--display); font-size: 21px; font-weight: 700; fill: var(--purple-900); }
.chamber-mark { font-family: var(--body); font-size: 15px; font-weight: 700; paint-order: stroke; stroke: var(--purple-900); stroke-width: 4px; stroke-linejoin: round; }
.chamber-mine .chamber-rim { stroke: var(--gold-400); stroke-width: 2.6; }

.chamber[data-note="empty"] .chamber-rim { stroke: var(--green); stroke-width: 3.4; }
.chamber[data-note="empty"] .chamber-bore { fill: #cfeeda; }
.chamber[data-note="empty"] .chamber-letter { fill: var(--green-deep); }
.chamber[data-note="empty"] .chamber-mark { fill: var(--green); }
.chamber[data-note="bullet"] .chamber-rim { stroke: var(--red); stroke-width: 3.4; }
.chamber[data-note="bullet"] .chamber-bore { fill: #f6cfc9; }
.chamber[data-note="bullet"] .chamber-letter { fill: var(--red-deep); }
.chamber[data-note="bullet"] .chamber-mark { fill: var(--red); }
.chamber[data-note="unsure"] .chamber-rim { stroke: var(--gold-400); stroke-width: 3.4; stroke-dasharray: 5 4; }
.chamber[data-note="unsure"] .chamber-bore { fill: #f3e6bd; }
.chamber[data-note="unsure"] .chamber-mark { fill: var(--gold-200); }

.picking .chamber-rim { stroke: var(--gold-200); stroke-dasharray: 3 3; }
.chamber-picked .chamber-rim { stroke: var(--gold-200); stroke-width: 4.5; stroke-dasharray: none; fill: var(--gold-600); }
.chamber-picked .chamber-bore { fill: var(--gold-200) !important; }

/* Truth, shown only at game over. */
.chamber-bullet .chamber-bore { fill: #c8382c !important; }
.chamber-bullet .chamber-letter { fill: #fff !important; }
.chamber-bullet .chamber-rim { stroke: var(--red); stroke-width: 3.4; }
.chamber-empty .chamber-bore { fill: #cfeeda !important; }
.chamber-empty .chamber-letter { fill: var(--green-deep) !important; }
.chamber-empty .chamber-rim { stroke: var(--green); stroke-width: 2.4; }

.hint { font-size: 0.8rem; text-align: center; color: var(--ink-soft); }

/* ---------------- pop-up announcement ---------------- */

.toast {
  position: fixed;
  z-index: 50;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  width: min(calc(100% - 20px), 440px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast-bottom { top: auto; bottom: max(10px, env(safe-area-inset-bottom)); }
.toast-bottom .toast-card { animation-name: toast-up; }
.toast-card {
  position: relative;
  overflow: hidden;
  padding: 10px 14px 13px;
  border: 1px solid rgba(240, 220, 164, 0.45);
  border-left: 5px solid var(--gold-400);
  background: linear-gradient(180deg, rgba(48, 44, 41, 0.98), rgba(22, 20, 18, 0.98));
  box-shadow: 0 18px 40px -8px rgba(0, 0, 0, 0.9);
  animation: toast-in 0.42s var(--ease) both;
}
.toast-head { font-family: var(--display); font-size: 0.54rem; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-200); }
.toast-line { margin-top: 3px; font-size: 1.04rem; font-weight: 600; line-height: 1.25; color: var(--stock); }
.toast-private { border-color: var(--purple-300); border-left-color: var(--purple-300); background: linear-gradient(180deg, #40206a, #24123a); }
.toast-line-private { color: var(--gold-200); }
.toast-end { border-color: var(--red); border-left-color: var(--red); }
.toast-end .toast-head { color: var(--red); }
.toast-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--gold-400); transform-origin: left; animation: toast-drain linear both; }
@keyframes toast-in { from { transform: translateY(-130%) scale(0.94); opacity: 0; } 60% { transform: translateY(4px) scale(1.01); opacity: 1; } }
@keyframes toast-up { from { transform: translateY(130%) scale(0.94); opacity: 0; } 60% { transform: translateY(-4px) scale(1.01); opacity: 1; } }
@keyframes toast-drain { to { transform: scaleX(0); } }

/* ---------------- action panel ---------------- */

.panel-in { animation: panel-in 0.32s var(--ease) both; }
@keyframes panel-in { from { transform: translateY(14px); opacity: 0; } }

.panel { display: flex; flex-direction: column; gap: 9px; padding: 11px; border: 1px solid var(--line); background: var(--slab-bg); box-shadow: var(--shadow-slab); }
.panel-title { font-family: var(--display); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--cream); }
.panel-alert { color: var(--gold-400); }
.panel-help { font-size: 0.86rem; color: var(--cream); }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.action { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 52px; padding: 8px 9px 8px 11px; text-align: left; font-size: 0.56rem; letter-spacing: 0.1em; line-height: 1.35; }
.action[data-action="tamper"] { grid-column: 1 / -1; }
.cost { flex: none; min-width: 30px; padding: 2px 6px; border-radius: 1px; background: linear-gradient(170deg, var(--gold-200), var(--gold-500)); color: #1d1608; font-family: var(--body); font-size: 0.95rem; font-weight: 700; letter-spacing: 0; text-align: center; font-variant-numeric: tabular-nums; }

.pick-grid, .tamper-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 58px; padding: 6px 4px; }
.pick-pair { font-size: 1rem; letter-spacing: 0.06em; color: var(--stock); }
.pick-seats { font-family: var(--body); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: none; color: var(--gold-200); }

.swap-row { display: flex; align-items: center; gap: 8px; }
.swap-slot { display: grid; place-items: center; width: 46px; height: 46px; border: 1px dashed var(--mute); border-radius: 50%; font-family: var(--display); font-size: 1.2rem; font-weight: 700; color: var(--mute); }
.swap-slot.filled { border: 2px solid var(--gold-400); color: var(--purple-900); background: linear-gradient(170deg, #fff, var(--stock)); }
.swap-arrow { color: var(--gold-200); font-size: 1.1rem; }
.swap-row .btn { margin-left: auto; }

/* Investigation findings, wherever they are printed. */
.found-bullet { color: var(--red); font-weight: 700; }
.found-empty { color: var(--green); font-weight: 700; text-transform: uppercase; }

/* ---------------- log ---------------- */

/* Section titles sit straight on the wall, engraved like the wordmark. */
.section-title { margin-bottom: 5px; font-family: var(--display); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase; color: var(--ink); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.14); }

.log { list-style: none; margin: 0; padding: 0; min-height: 70px; max-height: 124px; scroll-behavior: smooth; overflow-y: auto; border: 1px solid var(--line); background: var(--slab-bg); box-shadow: var(--shadow-slab); font-size: 0.88rem; overscroll-behavior: contain; }
.log li { padding: 6px 10px; border-bottom: 1px solid var(--line-soft); }
.log .log-round { position: sticky; top: 0; z-index: 1; padding: 5px 10px; text-align: center; background: var(--slab-deep); border-bottom: 1px solid var(--line); }
.log-mine { color: var(--gold-200); }
.log-end { color: var(--red); font-weight: 700; }
/* The newest line: a gold marker that slides in, then keeps a slow pulse. */
.log .log-latest { position: relative; padding-left: 24px; background-color: rgba(217, 178, 84, 0.14); box-shadow: inset 3px 0 0 var(--gold-400); animation: log-flash 0.9s ease-out both; }
.log .log-latest::before { content: ""; position: absolute; left: 9px; top: 0.82em; width: 6px; height: 6px; background: var(--gold-400); transform: rotate(45deg); animation: log-nudge 1.1s ease-in-out infinite; }
@keyframes log-flash { from { background-color: rgba(240, 220, 164, 0.6); transform: translateX(-10px); } }
@keyframes log-nudge { 50% { transform: rotate(45deg) scale(0.55); opacity: 0.5; } }
.log-private { display: flex; gap: 8px; align-items: baseline; color: var(--gold-200); background-image: repeating-linear-gradient(45deg, rgba(228, 212, 245, 0.07) 0 1px, transparent 1px 6px), repeating-linear-gradient(-45deg, rgba(228, 212, 245, 0.07) 0 1px, transparent 1px 6px), linear-gradient(168deg, #40206a, #24123a); }
.tag { flex: none; padding: 1px 6px; background: linear-gradient(170deg, var(--gold-200), var(--gold-500)); color: #1d1608; font-family: var(--display); font-size: 0.48rem; font-weight: 700; letter-spacing: 0.16em; }

/* ---------------- game over ---------------- */

.gameover { display: flex; flex-direction: column; gap: 10px; }
.gameover .section-title { margin: 6px 0 0; }

.verdict { padding: 16px 12px 14px; text-align: center; border: 1px solid; background: var(--slab-bg); box-shadow: var(--shadow-slab); animation: slam 0.45s var(--ease) both; }
.verdict-word { font-family: var(--display); font-size: 2.1rem; font-weight: 700; letter-spacing: 0.12em; line-height: 1; }
.verdict-sub { margin-top: 7px; font-size: 0.92rem; color: var(--cream); }
.verdict-safe { border-color: var(--green); }
.verdict-safe .verdict-word { color: var(--green); text-shadow: 0 0 24px rgba(92, 196, 135, 0.35); }
.verdict-dead { border-color: var(--red); }
.verdict-dead .verdict-word { color: var(--red); text-shadow: 0 0 24px rgba(229, 89, 74, 0.35); }
@keyframes slam { from { transform: scale(1.25); opacity: 0; } }

.bullets { display: flex; align-items: center; justify-content: space-around; gap: 8px; padding: 10px; border: 1px solid var(--line); background: var(--slab-bg); box-shadow: var(--shadow-slab); }
.bullets > div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bullets-val { font-family: var(--display); font-size: 1.3rem; font-weight: 700; color: var(--red); letter-spacing: 0.1em; }
.bullets-arrow { color: var(--gold-400); font-size: 1.2rem; }

.fates { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); background: var(--slab-bg); box-shadow: var(--shadow-slab); font-size: 0.86rem; }
.fates li { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; align-items: center; padding: 6px 10px; border-left: 3px solid; }
.fates li + li { border-top: 1px solid var(--line-soft); }
.fate-who { grid-column: 1; grid-row: 1; font-weight: 600; color: var(--stock); }
.fate-chamber { grid-column: 1; grid-row: 2; font-size: 0.78rem; color: var(--mute); }
.fate-credits { grid-column: 2; grid-row: 2; font-size: 0.78rem; color: var(--mute); text-align: right; }
.fate-verdict { grid-column: 2; grid-row: 1; text-align: right; font-family: var(--display); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.fate-safe { border-left-color: var(--green) !important; }
.fate-safe .fate-verdict { color: var(--green); }
.fate-dead { border-left-color: var(--red) !important; }
.fate-dead .fate-verdict { color: var(--red); }

.replay-scroll { max-height: 420px; overflow-y: auto; overflow-x: hidden; border: 1px solid var(--line); background: var(--slab); box-shadow: var(--shadow-slab); }
.replay { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 0.8rem; overflow-wrap: anywhere; }
.replay th:nth-child(1) { width: 30px; }
.replay th:nth-child(2) { width: 80px; }
.replay th:nth-child(4) { width: 32px; }
.replay th { position: sticky; top: 0; background: var(--purple-900); color: var(--gold-200); font-family: var(--display); font-size: 0.48rem; letter-spacing: 0.16em; text-transform: uppercase; text-align: left; }
.replay th, .replay td { padding: 5px 7px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.replay td:first-child, .replay td:last-child { color: var(--mute); text-align: right; font-variant-numeric: tabular-nums; }
.replay td:nth-child(2) { color: var(--mute); }
.replay-mine td { color: var(--gold-200) !important; }
.replay-swap td:nth-child(3) { color: var(--purple-300); }

/* ---------------- stats ---------------- */

.record { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; font-family: var(--body); font-size: 0.9rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--stock); background: rgba(24, 20, 18, 0.72); border-color: var(--line); box-shadow: var(--shadow-slab); }
.record-more { flex: none; font-family: var(--display); font-size: 0.56rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-400); }

.sheet-overlay { place-items: center; padding: 10px; }
.sheet { display: flex; flex-direction: column; width: min(100%, 440px); max-height: min(92svh, 760px); padding: 0; animation: panel-in 0.28s var(--ease) both; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--line); }
.sheet-head .modal-title { margin: 0; }
.sheet-foot { display: flex; justify-content: flex-end; padding: 8px; border-top: 1px solid var(--line); }
.stats-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; overflow-y: auto; overscroll-behavior: contain; }
.stats-body .section-title { margin: 8px 0 0; color: var(--gold-200); text-shadow: none; }
.stats-empty { padding: 28px 8px; text-align: center; color: var(--cream); }
.stats-note { font-size: 0.74rem; color: var(--mute); }

.stats-hero { padding: 12px; border: 1px solid var(--line); border-left: 5px solid var(--mute); background: var(--slab-deep); }
.stats-hero-rate { font-size: 2.5rem; font-weight: 700; line-height: 1; color: var(--stock); font-variant-numeric: tabular-nums; }
.stats-hero-sub { margin-top: 4px; font-size: 0.92rem; }
.stats-hero-gap { margin-top: 2px; font-size: 0.92rem; font-weight: 700; }
.stats-hero-call { margin-top: 8px; font-size: 0.8rem; color: var(--mute); }
.stats-above { border-left-color: var(--green); }
.stats-above .stats-hero-rate, .stats-above .stats-hero-gap { color: var(--green); }
.stats-below { border-left-color: var(--red); }
.stats-below .stats-hero-rate, .stats-below .stats-hero-gap { color: var(--red); }
.stats-unclear { border-left-color: var(--gold-400); }
.stats-unclear .stats-hero-gap { color: var(--gold-400); }

.board { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); background: var(--slab-deep); }
.board-row { display: grid; grid-template-columns: 1fr auto 58px; gap: 3px 10px; align-items: baseline; padding: 7px 10px 9px; font-size: 0.9rem; }
.board-row + .board-row { border-top: 1px solid var(--line-soft); }
.board-name { font-weight: 600; color: var(--stock); }
.board-count { color: var(--mute); font-variant-numeric: tabular-nums; }
.board-rate { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.board-you { background: linear-gradient(168deg, #40206a, #24123a); }
.board-you .board-name { color: var(--gold-200); }
.bar { position: relative; grid-column: 1 / -1; height: 6px; background: rgba(240, 220, 164, 0.12); }
.bar i { display: block; height: 100%; background: var(--red); }
.bar-up i { background: var(--green); }
.bar::after { content: ""; position: absolute; top: -3px; bottom: -3px; left: 66.7%; width: 2px; background: var(--gold-200); }

.facts { display: grid; grid-template-columns: 1fr 1fr; margin: 0; border: 1px solid var(--line); background: var(--slab-deep); }
.fact { padding: 7px 10px; min-width: 0; border-bottom: 1px solid var(--line-soft); }
.fact:nth-child(odd) { border-right: 1px solid var(--line-soft); }
.fact dt { font-family: var(--display); font-size: 0.46rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-200); }
.fact dd { margin: 2px 0 0; font-size: 0.94rem; font-weight: 600; color: var(--stock); }

.seat-chips { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); border: 1px solid var(--line); background: var(--slab-deep); }
.seat-chips li { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; font-size: 0.8rem; color: var(--stock); }
.seat-chips li + li { border-left: 1px solid var(--line-soft); }
.seat-chips b { font-family: var(--display); font-size: 0.6rem; color: var(--gold-400); }
.chip-rate { color: var(--mute); font-size: 0.66rem; }
.chip-empty { color: #6f6861 !important; }

/* ---------------- rules, footer ---------------- */

.rules { border: 1px solid var(--line); background: var(--slab-bg); box-shadow: var(--shadow-slab); }
.rules summary { min-height: 46px; padding: 14px 12px; font-family: var(--display); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.26em; text-transform: uppercase; color: var(--gold-200); cursor: pointer; }
.rules[open] summary { border-bottom: 1px solid var(--line); }
.rules-body { display: grid; gap: 9px; padding: 12px; font-size: 0.88rem; color: var(--cream); }
.rules-body strong { color: var(--gold-200); }
.rules-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.rules-table th, .rules-table td { padding: 5px 6px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.rules-table th { font-family: var(--display); font-size: 0.48rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-200); }
.rules-table td:nth-child(2) { color: var(--gold-400); font-weight: 700; white-space: nowrap; }

.site-footer { display: flex; justify-content: space-between; padding-top: 4px; font-size: 0.78rem; color: var(--ink-soft); }
.site-footer a { color: inherit; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--purple-900); }

/* ---------------- modals (install prompt, stats) ---------------- */

.modal-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: end center; padding: 16px; background: rgba(12, 10, 9, 0.72); }
.modal { width: min(100%, 420px); padding: 18px; border: 1px solid rgba(240, 220, 164, 0.4); background: linear-gradient(180deg, #302c29, #1a1816); box-shadow: 0 36px 70px -20px #000; outline: none; }
.modal-title { margin: 0 0 8px; font-family: var(--display); font-size: 0.86rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-200); }
.modal-body { margin: 0 0 16px; font-size: 0.92rem; color: var(--cream); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 359px) {
  .wordmark { font-size: 1.2rem; }
  .toggle span:last-child { display: none; }
}

@media (min-width: 900px) {
  .shell { padding-top: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .drum, .upright { transition: none; }
  .grain, .seat-active .seat-plate, .verdict, .toast-card, .panel-in, .sheet, .log .log-latest, .log .log-latest::before { animation: none; }
  .toast-bar { display: none; }
}
