/* The Game Night — one stylesheet for all pages.
   Palette: indigo night, cardstock panels, meeple colors for people. */

@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wdth,wght@12..96,75..100,300..800&display=swap");

:root {
  --night: #0d0f1c;
  --night-raised: #1a1d33;
  --night-line: #2d3252;
  --card: #f1e9d6;
  --card-2: #e4d9bf;
  --card-line: #c9bc9b;
  --ink: #1b1a20;
  --ink-soft: #5d586c;
  --ink-faint: #8d879c;
  --yellow: #f2c14e;
  --yellow-deep: #d9a633;
  --red: #d6503c;
  --teal: #4fb0a0;
  --blue: #4c6fd1;
  --green: #6aa84f;
  --shadow: 4px 4px 0 #000;
  --radius: 6px;
  --font: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --maxw: 680px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--night);
  background-image:
    radial-gradient(ellipse 120% 60% at 50% 0%, rgba(13,15,28,.55), rgba(13,15,28,0) 70%),
    url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%22360%22 height=%22360%22 viewBox=%220 0 360 360%22%3E%3Cg transform=%22translate(40 48) rotate(-12)%22 opacity=%22.19%22%3E%3Cpath d=%22M0-14c-3.5 0-6 2.6-6 6 0 1.6.6 3 1.5 4.1L-12 0c-2 1.3-2.6 3.8-1.4 6l1 1.8 7.4-2.8V15h10V5l7.4 2.8 1-1.8c1.2-2.2.6-4.7-1.4-6L4.5-3.9C5.4-5 6-6.4 6-8c0-3.4-2.5-6-6-6z%22 fill=%22%23f2c14e%22/%3E%3C/g%3E%3Cg transform=%22translate(150 30) rotate(18)%22 opacity=%22.19%22%3E%3Crect x=%22-11%22 y=%22-11%22 width=%2222%22 height=%2222%22 rx=%224%22 fill=%22%23d6503c%22/%3E%3Cg fill=%22%230d0f1c%22%3E%3Ccircle cx=%22-5%22 cy=%22-5%22 r=%222.2%22/%3E%3Ccircle cx=%225%22 cy=%225%22 r=%222.2%22/%3E%3Ccircle cx=%225%22 cy=%22-5%22 r=%222.2%22/%3E%3Ccircle cx=%22-5%22 cy=%225%22 r=%222.2%22/%3E%3Ccircle cx=%220%22 cy=%220%22 r=%222.2%22/%3E%3C/g%3E%3C/g%3E%3Cg transform=%22translate(270 60) rotate(-25)%22 opacity=%22.19%22%3E%3Crect x=%22-8%22 y=%22-12%22 width=%2216%22 height=%2224%22 rx=%222.5%22 fill=%22%234fb0a0%22/%3E%3Crect x=%22-5%22 y=%22-9%22 width=%2210%22 height=%2218%22 rx=%221.5%22 fill=%22none%22 stroke=%22%230d0f1c%22 stroke-width=%221.5%22/%3E%3C/g%3E%3Cg transform=%22translate(330 150) rotate(10)%22 opacity=%22.19%22%3E%3Cpolygon points=%220,-13 11,-6.5 11,6.5 0,13 -11,6.5 -11,-6.5%22 fill=%22%234c6fd1%22/%3E%3C/g%3E%3Cg transform=%22translate(80 150) rotate(8)%22 opacity=%22.19%22%3E%3Cpath d=%22M0-15a5 5 0 1 0 0 10a5 5 0 0 0 0-10zM-4-4h8l2 10h-12zM-9 8h18v5h-18z%22 fill=%22%236aa84f%22/%3E%3C/g%3E%3Cg transform=%22translate(200 120) rotate(0)%22 opacity=%22.19%22%3E%3Ccircle r=%2211%22 fill=%22%23b86bd1%22/%3E%3Ccircle r=%226.5%22 fill=%22none%22 stroke=%22%230d0f1c%22 stroke-width=%222%22/%3E%3C/g%3E%3Cg transform=%22translate(30 250) rotate(15)%22 opacity=%22.19%22%3E%3Cpath d=%22M0-14c-3.5 0-6 2.6-6 6 0 1.6.6 3 1.5 4.1L-12 0c-2 1.3-2.6 3.8-1.4 6l1 1.8 7.4-2.8V15h10V5l7.4 2.8 1-1.8c1.2-2.2.6-4.7-1.4-6L4.5-3.9C5.4-5 6-6.4 6-8c0-3.4-2.5-6-6-6z%22 fill=%22%23e08a3c%22/%3E%3C/g%3E%3Cg transform=%22translate(120 240) rotate(22)%22 opacity=%22.19%22%3E%3Crect x=%22-8%22 y=%22-12%22 width=%2216%22 height=%2224%22 rx=%222.5%22 fill=%22%234c6fd1%22/%3E%3Crect x=%22-5%22 y=%22-9%22 width=%2210%22 height=%2218%22 rx=%221.5%22 fill=%22none%22 stroke=%22%230d0f1c%22 stroke-width=%221.5%22/%3E%3C/g%3E%3Cg transform=%22translate(230 220) rotate(-20)%22 opacity=%22.19%22%3E%3Crect x=%22-11%22 y=%22-11%22 width=%2222%22 height=%2222%22 rx=%224%22 fill=%22%234fb0a0%22/%3E%3Cg fill=%22%230d0f1c%22%3E%3Ccircle cx=%22-5%22 cy=%22-5%22 r=%222.2%22/%3E%3Ccircle cx=%225%22 cy=%225%22 r=%222.2%22/%3E%3Ccircle cx=%225%22 cy=%22-5%22 r=%222.2%22/%3E%3Ccircle cx=%22-5%22 cy=%225%22 r=%222.2%22/%3E%3Ccircle cx=%220%22 cy=%220%22 r=%222.2%22/%3E%3C/g%3E%3C/g%3E%3Cg transform=%22translate(320 290) rotate(-8)%22 opacity=%22.19%22%3E%3Cpath d=%22M0-14c-3.5 0-6 2.6-6 6 0 1.6.6 3 1.5 4.1L-12 0c-2 1.3-2.6 3.8-1.4 6l1 1.8 7.4-2.8V15h10V5l7.4 2.8 1-1.8c1.2-2.2.6-4.7-1.4-6L4.5-3.9C5.4-5 6-6.4 6-8c0-3.4-2.5-6-6-6z%22 fill=%22%23d6503c%22/%3E%3C/g%3E%3Cg transform=%22translate(180 320) rotate(30)%22 opacity=%22.19%22%3E%3Cpolygon points=%220,-13 11,-6.5 11,6.5 0,13 -11,6.5 -11,-6.5%22 fill=%22%23f2c14e%22/%3E%3C/g%3E%3Cg transform=%22translate(270 330) rotate(-15)%22 opacity=%22.19%22%3E%3Cpath d=%22M0-15a5 5 0 1 0 0 10a5 5 0 0 0 0-10zM-4-4h8l2 10h-12zM-9 8h18v5h-18z%22 fill=%22%23b86bd1%22/%3E%3C/g%3E%3Cg transform=%22translate(350 40) rotate(0)%22 opacity=%22.19%22%3E%3Ccircle r=%2211%22 fill=%22%236aa84f%22/%3E%3Ccircle r=%226.5%22 fill=%22none%22 stroke=%22%230d0f1c%22 stroke-width=%222%22/%3E%3C/g%3E%3Cg transform=%22translate(10 330) rotate(12)%22 opacity=%22.19%22%3E%3Crect x=%22-11%22 y=%22-11%22 width=%2222%22 height=%2222%22 rx=%224%22 fill=%22%23f2c14e%22/%3E%3Cg fill=%22%230d0f1c%22%3E%3Ccircle cx=%22-5%22 cy=%22-5%22 r=%222.2%22/%3E%3Ccircle cx=%225%22 cy=%225%22 r=%222.2%22/%3E%3Ccircle cx=%225%22 cy=%22-5%22 r=%222.2%22/%3E%3Ccircle cx=%22-5%22 cy=%225%22 r=%222.2%22/%3E%3Ccircle cx=%220%22 cy=%220%22 r=%222.2%22/%3E%3C/g%3E%3C/g%3E%3Cg transform=%22translate(100 330) rotate(-30)%22 opacity=%22.19%22%3E%3Crect x=%22-8%22 y=%22-12%22 width=%2216%22 height=%2224%22 rx=%222.5%22 fill=%22%23d6503c%22/%3E%3Crect x=%22-5%22 y=%22-9%22 width=%2210%22 height=%2218%22 rx=%221.5%22 fill=%22none%22 stroke=%22%230d0f1c%22 stroke-width=%221.5%22/%3E%3C/g%3E%3C/svg%3E");
  background-size: auto, 360px 360px;
  background-attachment: fixed, fixed;
  color: var(--card);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  font-variation-settings: "opsz" 14, "wdth" 100;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 18px 80px; }

/* ---------------- header ---------------- */
.top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 18px 0 10px;
}
.brand {
  text-decoration: none; font-weight: 800; letter-spacing: -0.01em; font-size: 20px;
  font-variation-settings: "opsz" 96, "wdth" 85;
}
.brand .dot { color: var(--yellow); }
.nav { display: flex; gap: 16px; font-size: 15px; }
.nav a { color: var(--card); opacity: .75; text-decoration: none; }
.nav a[aria-current="page"], .nav a:hover { opacity: 1; text-decoration: underline; text-decoration-color: var(--yellow); text-underline-offset: 4px; }

/* ---------------- hero ---------------- */
.hero { padding: 26px 0 10px; }
.hero .kicker { color: var(--yellow); font-weight: 600; margin: 0 0 6px; font-size: 16px; }
.hero .date {
  margin: 0; font-weight: 800; line-height: .92; letter-spacing: -0.03em;
  font-size: clamp(56px, 15vw, 112px);
  font-variation-settings: "opsz" 96, "wdth" 78;
}
.hero .date small { display: block; font-size: .36em; font-weight: 600; letter-spacing: 0; line-height: 1.2; margin-top: 10px; font-variation-settings: "opsz" 40, "wdth" 95; color: var(--card); opacity: .9; }
.hero .title { font-size: 22px; font-weight: 600; margin: 18px 0 4px; }
.hero .host { margin: 0; opacity: .75; }
.hero .notes { margin: 14px 0 0; max-width: 56ch; opacity: .9; }

.empty-hero { padding: 40px 0 20px; }
.empty-hero h1 { font-size: clamp(40px, 10vw, 72px); line-height: 1; margin: 0 0 12px; font-variation-settings: "opsz" 96, "wdth" 80; }

/* ---------------- cardstock panels ---------------- */
.panel {
  background: var(--card); color: var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 18px; margin: 26px 0 0;
}
.panel h2 { margin: 0 0 4px; font-size: 24px; font-weight: 700; letter-spacing: -0.015em; font-variation-settings: "opsz" 60, "wdth" 90; }
.panel .sub { margin: 0 0 16px; color: var(--ink-soft); }
.panel hr { border: 0; border-top: 1px dashed var(--card-line); margin: 18px 0; }

/* ---------------- forms ---------------- */
.field { display: grid; gap: 6px; margin: 0 0 14px; }
.field label { font-weight: 600; font-size: 15px; }
.field .hint { color: var(--ink-soft); font-size: 14px; }
.input, textarea.input {
  width: 100%; padding: 11px 12px; border: 2px solid var(--ink); border-radius: 4px;
  background: #fffdf7; color: var(--ink);
}
textarea.input { min-height: 72px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; }
.seg span { display: block; text-align: center; padding: 11px 6px; font-weight: 600; cursor: pointer; background: #fffdf7; border-right: 2px solid var(--ink); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--ink); color: var(--card); }
.seg input:focus-visible + span { outline: 3px solid var(--yellow); outline-offset: -3px; }
.seg input[value="in"]:checked + span { background: var(--teal); color: var(--ink); }
.seg input[value="maybe"]:checked + span { background: var(--yellow); color: var(--ink); }
.seg input[value="out"]:checked + span { background: var(--red); color: #fff; }

.btn {
  display: inline-block; cursor: pointer; border: 2px solid var(--ink); border-radius: 4px;
  background: var(--yellow); color: var(--ink); font-weight: 700; padding: 11px 18px;
  box-shadow: 3px 3px 0 var(--ink); transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.quiet { background: #fffdf7; font-weight: 600; }
.btn.danger { background: var(--red); color: #fff; }
.btn.small { padding: 7px 12px; font-size: 14px; box-shadow: 2px 2px 0 var(--ink); }
.btn[disabled] { opacity: .5; cursor: default; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.msg { margin: 12px 0 0; font-weight: 600; }
.msg.ok { color: #2d6a4f; }
.msg.err { color: #a63a2a; }
.address { background: #fffdf7; border: 2px dashed var(--card-line); border-radius: 4px; padding: 10px 12px; margin-top: 14px; }

/* ---------------- the table (who's in) ---------------- */
.table-wrap { position: relative; margin: 10px auto 0; width: 100%; max-width: 420px; aspect-ratio: 1.35; }
.table-oval {
  position: absolute; left: 20%; top: 24%; width: 60%; height: 52%;
  border-radius: 50%; background: #171a2e; border: 3px solid var(--night-line);
  display: grid; place-items: center; text-align: center; color: var(--card); padding: 10px;
}
.table-oval strong { display: block; font-size: 36px; line-height: 1; font-weight: 800; font-variation-settings: "opsz" 96, "wdth" 80; }
.table-oval span { font-size: 14px; opacity: .8; }
.seat {
  position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 16px; color: var(--ink);
  border: 3px solid var(--ink); box-shadow: 2px 2px 0 var(--ink);
}
.seat.maybe { background: var(--card) !important; border-style: dashed; }
.seat .tip {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 4px;
  font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--ink); background: var(--card);
  padding: 1px 6px; border-radius: 3px; border: 1px solid var(--card-line);
}
.couch { margin: 14px 0 0; font-size: 15px; color: var(--ink-soft); }
.guest-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.guest-list li { display: flex; gap: 10px; align-items: baseline; }
.guest-list .pip { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); flex: none; transform: translateY(1px); }
.guest-list .who { font-weight: 600; }
.guest-list .what { color: var(--ink-soft); }

/* ---------------- potluck ---------------- */
.dish-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.dish-list li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--card-line); padding: 6px 0; }
.dish-list .by { color: var(--ink-soft); }
.gaps { margin-top: 12px; color: var(--ink-soft); font-size: 15px; }

/* ---------------- ballot ---------------- */
.ballot { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ballot li { position: relative; display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: start; padding: 10px 0 12px; border-bottom: 1px dashed var(--card-line); }
.ballot li:last-child { border-bottom: 0; }
.ballot input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--ink); cursor: pointer; }
.ballot .g-name { font-weight: 700; font-size: 18px; margin: 0; }
.ballot .g-meta { color: var(--ink-soft); font-size: 14px; margin: 2px 0 0; }
.ballot .g-note { font-size: 15px; margin: 4px 0 0; }
.ballot .g-warn { color: #a63a2a; font-weight: 600; }
.ballot .count { font-weight: 800; font-size: 20px; min-width: 32px; text-align: right; font-variation-settings: "opsz" 96, "wdth" 85; }
.ballot .bar { grid-column: 2 / -1; height: 8px; background: var(--card-2); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.ballot .bar i { display: block; height: 100%; background: var(--yellow-deep); width: 0; transition: width .35s ease; }
.ballot li.leading .bar i { background: var(--ink); }
.ballot-foot { margin-top: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; color: var(--ink-soft); font-size: 15px; }

/* ---------------- run of show ---------------- */
.show { list-style: none; margin: 0; padding: 0; }
.show li { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--card-line); }
.show li:last-child { border-bottom: 0; }
.show time { font-weight: 800; font-variation-settings: "opsz" 96, "wdth" 85; }

/* ---------------- history ---------------- */
.night { padding: 18px 0; border-bottom: 1px solid var(--night-line); }
.night h3 { margin: 0; font-size: 22px; font-variation-settings: "opsz" 60, "wdth" 88; }
.night .when { opacity: .7; margin: 2px 0 10px; }
.played { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.played li { display: flex; gap: 10px; flex-wrap: wrap; }
.played .win { color: var(--yellow); font-weight: 600; }
.board { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.board li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--card-line); align-items: baseline; }
.board li::before { counter-increment: rank; content: counter(rank); font-weight: 800; font-size: 20px; font-variation-settings: "opsz" 96, "wdth" 85; }
.board .wins { font-weight: 800; }

/* ---------------- admin ---------------- */
.admin-grid { display: grid; gap: 18px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 20px 0 0; }
.tabs button { border: 2px solid var(--card); background: transparent; color: var(--card); border-radius: 4px; padding: 8px 12px; cursor: pointer; font-weight: 600; }
.tabs button[aria-selected="true"] { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--card-line); flex-wrap: wrap; }
.list .meta { color: var(--ink-soft); font-size: 14px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
@media (max-width: 480px) { .checks { grid-template-columns: 1fr; } }
.checks label { display: flex; gap: 8px; align-items: baseline; font-size: 15px; }
.filterbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filterbar .input { width: auto; flex: 1; min-width: 120px; }
.demo-banner { background: var(--yellow); color: var(--ink); padding: 8px 14px; font-size: 14px; font-weight: 600; text-align: center; }
.demo-banner a { color: inherit; }

.foot { margin-top: 48px; opacity: .55; font-size: 14px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------- slots + lock ---------------- */
.hero .lockline { margin: 14px 0 0; color: var(--yellow); font-weight: 600; font-size: 15px; }
.slot-title { margin: 18px 0 4px; font-size: 15px; font-weight: 700; color: var(--ink-soft); padding-bottom: 4px; border-bottom: 2px solid var(--ink); }
.ballot li.winner .g-name::after { content: " Playing"; font-size: 12px; font-weight: 800; background: var(--ink); color: var(--yellow); padding: 2px 7px; border-radius: 3px; margin-left: 8px; vertical-align: 2px; }
.ballot input[type=radio] { accent-color: var(--ink); }
.checks { grid-template-columns: 1fr; }
.pick-row { display: grid; grid-template-columns: 1fr 170px; gap: 8px; align-items: center; }
.pick-row .slot-input { padding: 6px 8px; font-size: 14px; }
@media (max-width: 480px) { .pick-row { grid-template-columns: 1fr; } }

.ballot .g-video { display: inline-block; margin-top: 6px; font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--yellow-deep); }
.ballot .g-video:hover { border-bottom-color: var(--ink); }
.ballot .g-video::before { content: "▶ "; font-size: 11px; }

/* ---------------- floating pieces (click them) ---------------- */
.drift-layer { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.floater {
  position: absolute; left: var(--x); top: var(--y); margin: -22px 0 0 -22px;
  width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.45));
  animation: drift var(--dur) ease-in-out var(--delay) infinite alternate;
  transition: transform .2s;
}
.floater svg { display: block; transform: rotate(var(--rot)); }
.floater:hover { transform: scale(1.15); }
.floater:focus-visible { outline: 3px solid var(--yellow); outline-offset: 4px; border-radius: 50%; }
.floater.pop { animation: drift var(--dur) ease-in-out var(--delay) infinite alternate, pop .45s ease-out; }
.floater.rolling svg { animation: tumble .14s linear infinite; }
.floater.flipping svg { animation: flip .6s ease-in-out; }
@keyframes drift {
  0%   { translate: 0 0; }
  25%  { translate: calc(var(--amp) * .8) calc(var(--amp) * -1.2); }
  50%  { translate: calc(var(--amp) * -.6) calc(var(--amp) * -2); }
  75%  { translate: var(--amp) calc(var(--amp) * -1); }
  100% { translate: calc(var(--amp) * -.4) calc(var(--amp) * .5); }
}
.drift-layer.hidden { display: none; }
.piece-shelf { display: flex; justify-content: center; gap: 22px; padding: 10px 0 0; }
.piece-shelf .floater { position: static; margin: 0; animation-name: bob; }
@keyframes bob { 0% { translate: 0 0; } 50% { translate: 0 calc(var(--amp) * -1); } 100% { translate: 0 0; } }
@keyframes pop { 0% { scale: 1; } 40% { scale: 1.5; } 100% { scale: 1; } }
@keyframes tumble { to { rotate: 360deg; } }
@keyframes flip { 0% { scale: 1 1; } 50% { scale: 0 1.2; } 100% { scale: 1 1; } }

.spark {
  position: fixed; z-index: 60; pointer-events: none; margin: -8px 0 0 -8px;
  animation: spark var(--t) cubic-bezier(.2,.7,.3,1) forwards;
}
.spark svg { display: block; }
@keyframes spark {
  0%   { transform: translate(0,0) rotate(0) scale(1); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(var(--dx), calc(var(--dy) + 140px)) rotate(var(--spin)) scale(.6); opacity: 0; }
}

.piece-toast {
  position: fixed; z-index: 70; transform: translate(-50%, 0); pointer-events: none;
  background: var(--card); color: var(--ink); font-weight: 800; font-size: 15px;
  padding: 8px 14px; border-radius: 6px; box-shadow: 3px 3px 0 #000; border: 2px solid var(--ink);
  animation: toast-in .25s ease-out; max-width: 260px; text-align: center;
  font-variation-settings: "opsz" 40, "wdth" 92;
}
.piece-toast.out { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px) scale(.9); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .floater, .floater.pop { animation: none; }
  .floater.rolling svg, .floater.flipping svg { animation: none; }
}


/* ---------------- the board (password gate) ---------------- */
body.gated { overflow: hidden; }
.gate {
  position: fixed; inset: 0; z-index: 100; overflow: auto;
  background: radial-gradient(ellipse at 50% 30%, #1d2a1f 0%, #0b1210 70%);
  display: grid; place-items: center; padding: 20px;
  animation: gate-in .4s ease-out;
}
.gate.open { animation: gate-out .7s ease-in forwards; }
.gate.shake .gate-inner { animation: shake .4s; }
.gate-inner { width: min(680px, 100%); text-align: center; color: var(--card); }
.gate-kicker { margin: 0 0 6px; font-size: 14px; opacity: .7; font-style: italic; }
.gate-title { margin: 0 0 14px; font-size: clamp(34px, 7vw, 56px); font-weight: 800; letter-spacing: -0.02em; line-height: 1; font-variation-settings: "opsz" 96, "wdth" 80; }
.gate-title span { color: var(--yellow); }
.board { width: 100%; height: auto; display: block; filter: drop-shadow(0 20px 30px rgba(0,0,0,.6)); }
.board .tile rect { fill: #e9d8a6; stroke: #7a4f22; stroke-width: 2; }
.board .tile text { font-family: var(--font); font-weight: 800; font-size: 16px; fill: #3b2415; }
.board .tile .num { opacity: .5; font-size: 14px; }
.board .tile.start rect { fill: #4fb0a0; }
.board .tile.start text { fill: #0d0f1c; font-size: 12px; letter-spacing: .04em; }
.board .tile.trap rect { fill: #d6503c; }
.board .tile .warn { fill: #0d0f1c; opacity: .7; }
.board .tile.end rect { fill: #f2c14e; }
.board .gem { fill: #4c6fd1; stroke: #0d0f1c; stroke-width: 3; }
.board .tile.lit rect { fill: #fff3c4; stroke: #f2c14e; stroke-width: 3; }
.board .pawn { transition: transform .09s linear; }
.gate-form { margin: 16px auto 0; max-width: 420px; text-align: left; }
.gate-form label { display: block; font-weight: 600; margin-bottom: 6px; }
.gate-row { display: flex; gap: 8px; }
.gate-row .input { flex: 1; background: #fffdf7; }
.gate-msg { min-height: 1.4em; margin: 10px 0 0; font-weight: 600; color: var(--yellow); }
@keyframes gate-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes gate-out { to { opacity: 0; transform: scale(1.06); } }
@keyframes shake { 0%,100% { translate: 0 0; } 20% { translate: -10px 0; } 40% { translate: 10px 0; } 60% { translate: -6px 0; } 80% { translate: 6px 0; } }
@media (prefers-reduced-motion: reduce) { .gate, .gate.open, .gate.shake .gate-inner { animation: none; } .board .pawn { transition: none; } }
