:root {
  --bg: #140e10;
  --bg-2: #23161a;
  --panel: #2a1c20;
  --ink: #f6efe6;
  --muted: #cbb8ae;
  --line: #5a3d42;
  --accent: #e07a5f;
  --accent-2: #f2cc8f;
  --felt: #1b3a34;
  --felt-2: #24564b;
  --danger: #ffb4a8;
  --ok: #b7e4c7;
  --gold: #e3b23c;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(ellipse at 20% -10%, #3a2428 0%, transparent 45%),
    var(--bg);
  color: var(--ink);
  font: 17px/1.5 "Iowan Old Style", Palatino, Georgia, serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.eyebrow {
  margin: 0 0 8px;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-family: system-ui, sans-serif;
  font-size: .74rem;
  color: var(--accent-2);
}
h1, h2, h3 { font-weight: 600; letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.05; margin: 0 0 12px; }
h2 { font-size: 1.25rem; margin: 0 0 8px; }
p { margin: 0 0 12px; }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}
.gate-card, .panel, .home-card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 40%), var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 26px;
}
.gate-card { max-width: 640px; }
.gate-card p { color: var(--muted); }
.field { margin: 16px 0; }
.field label, .check { display: block; font-family: system-ui, sans-serif; font-size: .92rem; margin-bottom: 6px; }
.field select[disabled], .field input[disabled] { opacity: .55; }
.field input, .field select, .field textarea {
  width: 100%;
  background: #140e10;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
}
.gate-actions, .row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  background: var(--accent);
  color: #1a0d0d;
  font-family: system-ui, sans-serif;
  font-weight: 700;
}
.btn:hover { background: #f0947c; }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--gold); background: transparent; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid #8f4a42; }
.banner {
  min-height: 0;
  margin: 12px 0 0;
  padding: 0;
  border-radius: 12px;
  font-family: system-ui, sans-serif;
}
.banner.show {
  padding: 12px 14px;
  background: #3a2424;
  color: var(--danger);
  border: 1px solid #8f4a42;
}
.banner.show.ok { background: #1c3328; color: var(--ok); border-color: #2f6b49; }
.noscript { padding: 24px; }

.app { max-width: 1180px; margin: 0 auto; padding: 22px 16px 48px; }
.top { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 16px; }
.top h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); }
.muted { color: var(--muted); }
.sans { font-family: system-ui, sans-serif; }
.home-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
.layout { display: grid; grid-template-columns: minmax(320px, 1.25fr) minmax(300px, .85fr); gap: 16px; align-items: start; }
.board-wrap { background: #070707; border-radius: 18px; border: 1px solid #2f6a5c; padding: 10px; }
.board-viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  background: #070707;
  touch-action: none;
  cursor: grab;
}
.board-viewport.is-panning { cursor: grabbing; }
.board-photo { width: 100%; height: 100%; }
.board-photo svg { width: 100%; height: 100%; display: block; }
.board-zoom { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.board-zoom .btn { padding: 8px 14px; }
.board-hit { fill: transparent; stroke: transparent; stroke-width: 18; cursor: pointer; }
.board-hit.is-lit { stroke: #f2cc8f; }
.board-hit.is-here { stroke: #e3b23c; }
.board-square { fill: transparent; stroke: transparent; }
.board-square.is-lit { fill: rgba(242, 204, 143, 0.5); stroke: #f2cc8f; stroke-width: 6; cursor: pointer; }
.board-square.is-here { stroke: #e3b23c; stroke-width: 8; }
.seat-name { font-weight: 700; }
.seat-name-0 { color: #f2cc8f; }
.seat-name-1 { color: #e07a5f; }
.seat-name-2 { color: #81b29a; }
.seat-name-3 { color: #7eb6d6; }
.seat-name-4 { color: #c9a0dc; }
.seat-name-5 { color: #f4a261; }
.turn-seat-0 { box-shadow: inset 5px 0 0 #f2cc8f; }
.turn-seat-1 { box-shadow: inset 5px 0 0 #e07a5f; }
.turn-seat-2 { box-shadow: inset 5px 0 0 #81b29a; }
.turn-seat-3 { box-shadow: inset 5px 0 0 #7eb6d6; }
.turn-seat-4 { box-shadow: inset 5px 0 0 #c9a0dc; }
.turn-seat-5 { box-shadow: inset 5px 0 0 #f4a261; }
.players li.is-turn { border-radius: 8px; padding-left: 8px; }
.seat-row-0.is-turn { box-shadow: inset 5px 0 0 #f2cc8f; }
.seat-row-1.is-turn { box-shadow: inset 5px 0 0 #e07a5f; }
.seat-row-2.is-turn { box-shadow: inset 5px 0 0 #81b29a; }
.seat-row-3.is-turn { box-shadow: inset 5px 0 0 #7eb6d6; }
.seat-row-4.is-turn { box-shadow: inset 5px 0 0 #c9a0dc; }
.seat-row-5.is-turn { box-shadow: inset 5px 0 0 #f4a261; }
.card.faced {
  width: min(220px, 100%);
  min-height: 0;
  padding: 0;
  background: transparent;
  border: none;
  overflow: visible;
}
.faced-card {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}
.reveal-card, .result-card { width: min(220px, 100%); }
.result-cards { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.score-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.zoomable, .card.faced:not(.show-card) { cursor: zoom-in; }
.zoom-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .78);
}
.zoom-card {
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
}
.score-thumb { width: 44px; height: auto; flex: none; border-radius: 4px; }
.score-portrait { width: 48px; height: 64px; object-fit: cover; object-position: center 18%; border-radius: 6px; }
.side { display: flex; flex-direction: column; gap: 12px; }
.panel p:last-child { margin-bottom: 0; }
.code {
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 2rem;
  letter-spacing: .18em;
  margin: 4px 0 8px;
}
.players { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.players li, .log li, .chat li {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.pawn {
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  display: inline-grid; place-items: center;
  color: #1a0d0d; font-family: system-ui, sans-serif; font-size: .72rem; font-weight: 800;
  margin-right: 8px;
}
.pawn-0 { background: #f2cc8f; }
.pawn-1 { background: #e07a5f; }
.pawn-2 { background: #81b29a; }
.pawn-3 { background: #7eb6d6; }
.pawn-4 { background: #c9a0dc; }
.pawn-5 { background: #f4a261; }
#board [data-room] { cursor: pointer; }
.tag { font-family: system-ui, sans-serif; font-size: .75rem; color: var(--accent-2); }
.computer-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: system-ui, sans-serif;
  font-size: .68rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-2);
  vertical-align: 1px;
}
.computer-tag::before {
  content: '';
  display: inline-block;
  width: .45rem;
  height: .45rem;
  margin-right: 4px;
  border-radius: 2px;
  background: var(--accent-2);
  vertical-align: 1px;
}
.out { color: var(--danger); }
.hand { display: flex; flex-wrap: wrap; gap: 8px; }
.card {
  width: 108px;
  min-height: 84px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #f3e6d4;
  color: #2a1c16;
  padding: 8px;
}
.card small { display: block; font-family: system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; font-size: .68rem; color: #7a5344; }
.card strong { display: block; margin-top: 6px; font-size: .98rem; }
.card.pick { border-color: #8f2d3c; box-shadow: inset 0 0 0 2px #8f2d3c; }
.log, .chat { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow: auto; }
.log li, .chat li { display: block; font-family: system-ui, sans-serif; font-size: .92rem; }
.private { color: var(--accent-2); }
.whereabouts { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 8px 6px 2px; margin: 0; list-style: none; font-family: system-ui, sans-serif; font-size: .82rem; color: #d5e6df; }
.back { color: var(--muted); font-family: system-ui, sans-serif; font-size: .9rem; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--accent-2); }
.score-toggle { display: none; }
.score-cols, .score-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px 12px;
  align-items: center;
}
.score-cols {
  font-family: system-ui, sans-serif;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: none;
  color: var(--accent-2);
  padding-bottom: 4px;
}
.score-flag { text-align: center; min-width: 4.6rem; }
.disclaimer {
  font-family: system-ui, sans-serif;
  font-size: .82rem;
  color: var(--muted);
}
.score-head {
  margin: 14px 0 4px;
  font-family: system-ui, sans-serif;
  font-size: .95rem;
  letter-spacing: .04em;
  color: var(--accent-2);
}
.score-row {
  min-height: 44px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.score-row label { font-family: system-ui, sans-serif; font-size: .95rem; }
.score-check { width: 1.35rem; height: 1.35rem; accent-color: var(--gold); justify-self: center; }

.lid {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background:
    linear-gradient(180deg, rgba(8, 4, 6, 0.72), rgba(8, 4, 6, 0.88)),
    url('/consent/art/scenes/voyeur-lounge.webp') center / cover no-repeat;
}
.lid-card {
  width: min(720px, 100%);
  padding: 42px 40px 36px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(28, 16, 18, 0.92), rgba(12, 8, 10, 0.94));
  border: 1px solid #e3b23c;
  box-shadow: inset 0 0 0 6px #1a1012, inset 0 0 0 7px #8a6230, 0 24px 60px rgba(0, 0, 0, 0.45);
  border-radius: 8px;
}
.lid-card h1 {
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  letter-spacing: 0.08em;
  line-height: 0.95;
  margin: 0 0 14px;
  color: #f6efe6;
}
.tagline {
  margin: 0 0 18px;
  font-style: italic;
  color: #f2cc8f;
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
}
.lid-count {
  font-family: system-ui, sans-serif;
  letter-spacing: 0.04em;
  color: #f2cc8f;
}
.lid-card .btn { margin-top: 8px; padding: 14px 28px; }
.lid-foot { margin: 14px 0 0; }
.lid-foot .btn, .edu-jump .btn { text-decoration: none; display: inline-block; }
.edu-jump { margin: 22px 0 0; text-align: center; }
.edu {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px 64px;
}
.edu-banner {
  height: 168px;
  border: 1px solid #e3b23c;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(180deg, rgba(8, 4, 6, 0.2), rgba(8, 4, 6, 0.55)),
    url('art/scenes/voyeur-lounge.webp') center / cover no-repeat;
}
.edu-card {
  padding: 32px 32px 36px;
  background:
    linear-gradient(180deg, rgba(28, 16, 18, 0.96), rgba(12, 8, 10, 0.98));
  border: 1px solid #e3b23c;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  box-shadow: inset 0 0 0 6px #1a1012, inset 0 0 0 7px #8a6230, 0 24px 60px rgba(0, 0, 0, 0.45);
}
.edu h1 {
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  letter-spacing: 0.01em;
  line-height: 1.15;
}
.edu h2 { margin: 28px 0 10px; color: #f2cc8f; font-size: 1.45rem; }
.edu h3 { margin: 18px 0 8px; font-size: 1.12rem; }
.edu .lede, .edu .close { font-style: italic; color: #f2cc8f; }
.edu ul { margin: 0 0 12px; padding-left: 1.25rem; }
.edu li { margin: 0 0 8px; }
.edu a { color: #f2cc8f; }
.edu a:hover { color: #fff; }

.cut {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.82)),
    url('/consent/art/scenes/impact.webp') center / cover no-repeat;
  color: #f6efe6;
}
.cut-stage {
  position: relative;
  min-height: 42vh;
  display: grid;
  place-items: center;
  padding: 64px 16px 12px;
}
.iron-door {
  width: min(210px, 40vw);
  height: min(380px, 46vh);
  border-radius: 6px 6px 2px 2px;
  background:
    linear-gradient(90deg, #241814 0%, #5a463c 16%, #1a120f 46%, #3d302a 72%, #100c0b 100%);
  box-shadow:
    0 0 48px 10px rgba(180, 24, 16, 0.55),
    inset 0 0 0 10px #120e0c,
    inset 0 0 40px rgba(255, 50, 24, 0.28);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1.5s ease, transform 1.5s ease, filter 0.6s ease;
  position: relative;
}
.iron-door span {
  position: absolute;
  inset: 18px 16px;
  border: 2px solid rgba(232, 196, 140, 0.35);
  border-radius: 2px;
  background:
    radial-gradient(circle at 20% 18%, #c9a27a 0 4px, transparent 5px),
    radial-gradient(circle at 80% 18%, #c9a27a 0 4px, transparent 5px),
    radial-gradient(circle at 20% 50%, #c9a27a 0 4px, transparent 5px),
    radial-gradient(circle at 80% 50%, #c9a27a 0 4px, transparent 5px),
    radial-gradient(circle at 20% 82%, #c9a27a 0 4px, transparent 5px),
    radial-gradient(circle at 80% 82%, #c9a27a 0 4px, transparent 5px);
}
.iron-door::after {
  content: '';
  position: absolute;
  right: 22px;
  top: 48%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e3b23c;
  box-shadow: 0 0 12px 4px rgba(227, 40, 24, 0.85);
}
.cut-stage.is-door .iron-door { opacity: 1; transform: none; }
.cut-stage.is-quiet .iron-door { filter: brightness(0.45); }
.cut-flicker {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: transparent;
}
.cut-stage.is-flicker .cut-flicker { animation: cut-flicker 0.9s linear 1; }
@keyframes cut-flicker {
  0%, 100% { background: transparent; }
  18% { background: rgba(0, 0, 0, 0.62); }
  36% { background: transparent; }
  52% { background: rgba(0, 0, 0, 0.78); }
  70% { background: rgba(255, 36, 16, 0.16); }
  84% { background: rgba(0, 0, 0, 0.4); }
}
.cut-copy {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 8px 28px 48px;
}
.cut-line { font-size: 1.15rem; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8); }
.cut-skip {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2;
  background: transparent;
  border: 0;
  padding: 8px;
  color: #f2cc8f;
  font-family: system-ui, sans-serif;
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  .iron-door { transition: none; }
  .cut-stage.is-flicker .cut-flicker { animation: none; }
}
@media (max-width: 860px) {
  .home-grid, .layout, .top { grid-template-columns: 1fr; display: grid; }
  .top { display: block; }
  .card.faced { width: calc(50% - 6px); }
  .reveal-card, .result-card { width: min(200px, 72vw); }
  .score-thumb { width: 36px; }
  .score-portrait { width: 40px; height: 54px; }
  .score-title { display: none; }
  .score-toggle { display: block; width: 100%; margin: 0; }
  .score-card:not(.is-open) .score-body { display: none; }
  .lid { padding: 18px 12px; }
  .lid-card { padding: 28px 18px 24px; }
  .lid-card .btn, .cut-copy .btn, .edu-jump .btn { width: 100%; }
  .edu { padding: 16px 12px 48px; }
  .edu-card { padding: 22px 16px 28px; }
  .edu-banner { height: 120px; }
  .edu h2 { font-size: 1.28rem; }
  .iron-door { width: min(160px, 46vw); height: min(280px, 42vh); }
  .cut-copy { padding: 8px 16px 28px; }
  .cut-line { font-size: 1.02rem; }
}
.ending-title {
  text-align: center;
  color: #f2cc8f;
  letter-spacing: .04em;
  margin: 0 0 18px;
}
.cut.ending-win {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .5), rgba(0, 0, 0, .78)),
    url('/consent/art/scenes/voyeur-lounge.webp') center / cover no-repeat;
}
.cut.ending-win .iron-door {
  box-shadow:
    0 0 48px 10px rgba(227, 178, 60, .55),
    inset 0 0 0 10px #120e0c,
    inset 0 0 40px rgba(227, 178, 60, .35);
}
.cut-copy .btn { margin-top: 8px; }
