/* =============================================================================
   Pool — kandabatata.com
   Day is the default palette; night is one attribute away on <html>.
   ============================================================================= */

:root {
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-ui: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* day */
  --paper: #f3ece0;
  --paper-2: #ece2d2;
  --panel: #fffdf8;
  --panel-2: #f8f2e6;
  --ink: #221a13;
  --muted: #6c5b4a;
  --muted-2: #937f69;
  --line: rgba(62, 44, 28, .14);
  --line-strong: rgba(62, 44, 28, .24);

  --berry: #b8305a;
  --berry-dark: #8c1f43;
  --amber: #d9872b;
  --green: #1f5440;
  --green-2: #2b6d54;
  --chalk: #eef3ef;

  --felt: #1f5440;
  --felt-2: #2a6a51;
  --felt-light: #35806a;
  --wood: #6b4227;
  --wood-2: #4a2b17;
  --wood-light: #8a5a37;

  --shadow: 0 30px 60px -40px rgba(48, 32, 18, .75), 0 2px 6px -2px rgba(48, 32, 18, .12);
  --shadow-sm: 0 12px 26px -22px rgba(48, 32, 18, .8);

  --radius: 18px;
  --radius-sm: 12px;
}

html[data-theme="night"] {
  --paper: #0d1420;
  --paper-2: #0a1017;
  --panel: #141e2b;
  --panel-2: #17232f;
  --ink: #f1ece3;
  --muted: #a4b2c2;
  --muted-2: #7e8d9e;
  --line: rgba(190, 214, 235, .14);
  --line-strong: rgba(190, 214, 235, .26);

  --berry: #ef6f92;
  --berry-dark: #c74f72;
  --amber: #e6a44d;
  --green: #2c6e57;
  --chalk: #dfeae8;

  --felt: #14372c;
  --felt-2: #1b4a3a;
  --felt-light: #23614c;
  --wood: #3a2417;
  --wood-2: #22140c;
  --wood-light: #4d3220;

  --shadow: 0 34px 60px -40px rgba(0, 0, 0, .9), 0 2px 8px -2px rgba(0, 0, 0, .5);
  --shadow-sm: 0 14px 28px -22px rgba(0, 0, 0, .95);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.015em; margin: 0; }
p { margin: 0; }
a { color: var(--berry); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .kbd {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: .86em; padding: .1em .38em; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line);
}

/* ------------------------------------------------------------------ backdrop */

.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg-felt { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--ink); opacity: .05; }
html[data-theme="night"] .bg-felt { opacity: .07; }
.bg-glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; }
.bg-glow--berry { width: 44vw; height: 44vw; top: -12vw; left: -8vw; background: radial-gradient(circle, rgba(184, 48, 90, .35), transparent 70%); }
.bg-glow--amber { width: 40vw; height: 40vw; bottom: -14vw; right: -10vw; background: radial-gradient(circle, rgba(217, 135, 43, .3), transparent 70%); }
html[data-theme="night"] .bg-glow { opacity: .3; }

.bg-balls { position: absolute; inset: 0; }
.bg-ball { position: absolute; display: block; opacity: .1; filter: blur(.3px); }
.bg-ball .ball, .bg-ball svg { display: block; }
.bg-ball--1 { top: 12%; right: 8%; transform: rotate(-12deg); }
.bg-ball--2 { bottom: 14%; left: 6%; transform: rotate(9deg); }
.bg-ball--3 { top: 46%; left: 3%; }
.bg-ball--4 { bottom: 30%; right: 4%; transform: rotate(18deg); }
html[data-theme="night"] .bg-ball { opacity: .07; }

.bg-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 0%, transparent 45%, rgba(48, 32, 18, .12) 100%);
}
html[data-theme="night"] .bg-vignette {
  background: radial-gradient(120% 90% at 50% 0%, transparent 40%, rgba(0, 0, 0, .55) 100%);
}

/* ------------------------------------------------------------------ top bar */

.topbar {
  position: relative; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.15rem clamp(1rem, 4vw, 2.6rem) 1rem;
  max-width: 1320px; margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: .7rem; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(150deg, var(--green-2), var(--green));
  color: #f6f1e6;
  box-shadow: 0 10px 22px -14px rgba(31, 84, 64, .95), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-display); font-size: 1.16rem; font-weight: 700; letter-spacing: -.01em; }
.brand-sub {
  font-family: var(--font-ui); font-size: .66rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2);
}

.topnav { display: flex; align-items: center; gap: .5rem; }
.topnav-link, .icon-btn, .theme-toggle {
  font-family: var(--font-ui); font-size: .84rem; font-weight: 500; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: .5rem .85rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .42rem;
  transition: transform .16s ease, border-color .16s ease, color .16s ease, background .16s ease;
}
.topnav-link:hover, .icon-btn:hover, .theme-toggle:hover {
  color: var(--ink); border-color: var(--line-strong); transform: translateY(-1px);
  text-decoration: none;
}
.icon-btn svg, .theme-toggle svg { width: 17px; height: 17px; }
.icon-btn .sound-off { display: none; }
.icon-btn.is-muted .sound-on { display: none; }
.icon-btn.is-muted .sound-off { display: block; }
.theme-icon--sun { display: none; }
html[data-theme="night"] .theme-icon--sun { display: block; }
html[data-theme="night"] .theme-icon--moon { display: none; }
.topnav-sep { width: 1px; height: 22px; background: var(--line); margin: 0 .15rem; }
.kanda {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--font-ui); font-size: .8rem; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: .45rem .8rem;
  background: var(--panel);
}
.kanda:hover { color: var(--ink); text-decoration: none; border-color: var(--line-strong); }
.kanda-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--berry); box-shadow: 0 0 0 3px rgba(184, 48, 90, .16); }

/* ------------------------------------------------------------------ layout */

.wrap { position: relative; z-index: 2; max-width: 1320px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2.6rem); }
.home { max-width: 1180px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ------------------------------------------------------------------ home hero */

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: 3rem;
  align-items: center;
}
.hero { padding: 2.6rem 0 2rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-ui); font-size: .74rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); background: var(--panel);
  border: 1px solid var(--line); border-radius: 999px; padding: .4rem .8rem;
}
.eyebrow-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green-2); }
.hero-title {
  margin-top: 1.1rem;
  font-size: clamp(2.3rem, 5.4vw, 4rem);
  line-height: 1.02;
  letter-spacing: -.025em;
}
.hero-title-accent {
  background-image: linear-gradient(96deg, var(--berry) 0%, #d4486f 45%, var(--amber) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-title--sm { font-size: clamp(1.9rem, 4vw, 2.8rem); }
.hero-sub { margin-top: 1.1rem; color: var(--muted); font-size: 1rem; line-height: 1.72; max-width: 62ch; }
.hero-hint { margin-top: 1.1rem; color: var(--muted-2); font-size: .84rem; line-height: 1.6; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.6rem; align-items: center; }
.hero-actions--tight { margin-top: 1.2rem; justify-content: center; }
.inline-form { display: contents; }

.name-row { margin-top: 1.6rem; max-width: 380px; }
.field-label {
  display: block; font-family: var(--font-ui); font-size: .72rem; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase; color: var(--muted-2); margin-bottom: .45rem;
}
.text-input {
  width: 100%; font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: .8rem .9rem; transition: border-color .16s ease, box-shadow .16s ease;
}
.text-input::placeholder { color: var(--muted-2); }
.text-input:focus { outline: none; border-color: var(--berry); box-shadow: 0 0 0 4px rgba(184, 48, 90, .14); }
.text-input--code { font-family: ui-monospace, Menlo, monospace; letter-spacing: .18em; font-size: 1.15rem; }
.field-help { margin-top: .5rem; font-size: .8rem; color: var(--muted-2); line-height: 1.5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-ui); font-size: .92rem; font-weight: 600;
  border-radius: 999px; padding: .72rem 1.25rem; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink);
  transition: transform .16s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease, opacity .2s;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn .icon { width: 17px; height: 17px; }
.btn--lg { padding: .82rem 1.5rem; font-size: .98rem; }
.btn--primary {
  background: linear-gradient(150deg, var(--berry), var(--berry-dark));
  border-color: transparent; color: #fff5f7;
  box-shadow: 0 16px 30px -18px rgba(184, 48, 90, .85), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn--primary:hover { box-shadow: 0 20px 36px -18px rgba(184, 48, 90, .95), inset 0 1px 0 rgba(255, 255, 255, .28); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--panel-2); }

/* hero rack */
.hero-table-wrap { position: relative; }
.hero-table-card {
  padding: 1rem 1rem .85rem;
  border-radius: 20px;
  background: linear-gradient(165deg, var(--felt-2), var(--felt));
  border: 6px solid var(--wood);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, .06);
  transform: rotate(-1deg);
  transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}
.hero-table-card:hover { transform: rotate(0) translateY(-3px); }
.hero-table-head, .hero-table-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 .2rem .55rem; color: rgba(255, 255, 255, .82);
}
.hero-table-foot { padding: .6rem .2rem 0; }
.hero-table-name { font-family: var(--font-ui); font-size: .78rem; font-weight: 700; }
.hero-table-tag {
  font-family: var(--font-ui); font-size: .62rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255, 255, 255, .55);
}
.hero-table-turn { display: inline-flex; align-items: center; gap: .35rem; font-family: var(--font-ui); font-size: .7rem; font-weight: 600; color: #ffe7a8; }
.hero-table-turn .dot { width: 6px; height: 6px; border-radius: 50%; background: #ffe7a8; box-shadow: 0 0 0 3px rgba(255, 231, 168, .2); animation: livePulse 2400ms ease infinite; }
.hero-rack { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 1.1rem .4rem 1.3rem; }
.hero-rack-row { display: flex; gap: 2px; }
.hero-rack-row:nth-child(1) { margin-left: 0; }
.hero-rack-row:nth-child(2) { margin-left: 22px; }
.hero-rack-row:nth-child(3) { margin-left: 44px; }
.hero-rack-row:nth-child(4) { margin-left: 66px; }
.hero-rack-row:nth-child(5) { margin-left: 88px; }
.hero-rack-slot { display: block; filter: drop-shadow(0 6px 5px rgba(0, 0, 0, .35)); }
.hero-table-note {
  margin-top: 1rem; padding: .7rem .9rem; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: .8rem; line-height: 1.5; color: var(--muted);
}
.hero-table-note strong { color: var(--berry); font-family: var(--font-ui); }

/* steps + rules */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.6rem; }
.step { padding: 1.4rem 1.35rem 1.5rem; }
.step-num { font-family: var(--font-ui); font-size: .78rem; font-weight: 700; letter-spacing: .18em; color: var(--berry); }
.step-title { margin-top: .45rem; font-size: 1.22rem; }
.step-text { margin-top: .45rem; color: var(--muted); font-size: .89rem; line-height: 1.62; }

.rules-strip { margin-top: 1rem; padding: 1.4rem 1.45rem 1.5rem; }
.rules-title { font-size: 1.1rem; }
.rules-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; margin: .9rem 0 0; }
.rules-grid dt {
  font-family: var(--font-ui); font-size: .7rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--berry); margin-bottom: .3rem;
}
.rules-grid dd { margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.55; }

.form-card { margin-top: 1.6rem; padding: 1.5rem; max-width: 520px; display: grid; gap: .25rem; }
.form-card .field-label:not(:first-child) { margin-top: 1rem; }
.alert {
  margin-top: 1.3rem; padding: .85rem 1rem; border-radius: var(--radius-sm);
  background: rgba(184, 48, 90, .1); border: 1px solid rgba(184, 48, 90, .3);
  color: var(--berry); font-size: .9rem; max-width: 520px;
}

/* ------------------------------------------------------------------ foot */

.foot { position: relative; z-index: 2; max-width: 1320px; margin: 3rem auto 0; padding: 1.4rem clamp(1rem, 4vw, 2.6rem) 2rem; }
.foot-line { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line); padding-top: 1.1rem; font-size: .8rem; color: var(--muted-2); }
.foot-brand a { color: var(--berry); font-weight: 600; }

/* ------------------------------------------------------------------ game: status bar */

.play { padding-bottom: 1rem; }
.statusbar { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; padding: .2rem 0 1rem; }
.statusbar-left, .statusbar-right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.codepill, .role-chip {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  font-family: var(--font-ui); background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px; padding: .5rem .85rem;
  transition: border-color .16s ease, transform .16s ease;
}
.codepill:hover, .role-chip:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.codepill-label { font-size: .64rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); }
.codepill-code { font-family: ui-monospace, Menlo, monospace; font-size: .92rem; letter-spacing: .12em; font-weight: 600; }
.codepill-icon { width: 15px; height: 15px; color: var(--muted-2); }
.role-chip { padding-left: .7rem; }
.role-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-2); box-shadow: 0 0 0 3px rgba(43, 109, 84, .16); }
.role-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.role-name { font-size: .84rem; font-weight: 600; }
.role-sub { font-size: .64rem; color: var(--muted-2); letter-spacing: .04em; }
.role-pencil { width: 14px; height: 14px; color: var(--muted-2); }
.live { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--font-ui); font-size: .76rem; color: var(--muted); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #3aa07a; box-shadow: 0 0 0 3px rgba(58, 160, 122, .18); }
.live.is-stale .live-dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(217, 135, 43, .2); }
.live.is-stale { color: var(--amber); }
.phase-chip {
  font-family: var(--font-ui); font-size: .7rem; font-weight: 700; letter-spacing: .13em;
  text-transform: uppercase; padding: .45rem .75rem; border-radius: 999px;
  color: var(--green); background: rgba(43, 109, 84, .12); border: 1px solid rgba(43, 109, 84, .25);
}
html[data-theme="night"] .phase-chip { color: #8fd6bb; border-color: rgba(143, 214, 187, .3); background: rgba(143, 214, 187, .1); }
.phase-chip.is-waiting { color: var(--amber); background: rgba(217, 135, 43, .12); border-color: rgba(217, 135, 43, .3); }
.phase-chip.is-over { color: var(--berry); background: rgba(184, 48, 90, .12); border-color: rgba(184, 48, 90, .28); }

/* ------------------------------------------------------------------ waiting room */

.wait-card { max-width: 660px; margin: .6rem auto 0; padding: 2.2rem 1.9rem 2rem; text-align: center; }
.wait-kicker { font-family: var(--font-ui); font-size: .68rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--berry); }
.wait-title { margin-top: .5rem; font-size: clamp(1.8rem, 3.6vw, 2.5rem); }
.wait-sub { margin: 1rem auto 0; max-width: 46ch; color: var(--muted); font-size: .94rem; line-height: 1.7; }
.wait-code {
  margin: 1.6rem auto 0; max-width: 460px; padding: 1.15rem 1rem 1rem;
  border-radius: var(--radius-sm); border: 1px dashed var(--line-strong);
  background: linear-gradient(180deg, var(--panel-2), transparent);
}
.wait-code-label { display: block; font-family: var(--font-ui); font-size: .66rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--muted-2); }
.wait-code-value { display: block; margin-top: .3rem; font-family: var(--font-display); font-size: clamp(1.5rem, 4.4vw, 2.1rem); letter-spacing: .12em; }
.wait-code-actions { display: flex; gap: .5rem; justify-content: center; margin-top: .8rem; flex-wrap: wrap; }
.wait-code-help { margin: .9rem auto 0; max-width: 40ch; font-size: .78rem; color: var(--muted-2); line-height: 1.6; }
.wait-rack { display: flex; flex-direction: column; align-items: center; gap: 3px; margin: 1.5rem auto .6rem; }
.wait-rack-row { display: flex; gap: 3px; }
.wait-rack-row:nth-child(2) { margin-left: 21px; }
.wait-rack-row:nth-child(3) { margin-left: 42px; }
.wait-rack-row:nth-child(4) { margin-left: 63px; }
.wait-rack-slot { animation: rackIn .6s cubic-bezier(.2, .8, .3, 1) both; animation-delay: var(--d, 0ms); }
@keyframes rackIn { from { opacity: 0; transform: translateY(-8px) scale(.8); } to { opacity: 1; transform: none; } }
.wait-status { list-style: none; margin: 1rem auto 0; padding: 0; display: grid; gap: .5rem; max-width: 320px; text-align: left; }
.wait-status li { display: flex; align-items: center; gap: .6rem; font-size: .84rem; color: var(--muted-2); }
.wait-mark { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; }
.wait-status li.is-done { color: var(--ink); }
.wait-status li.is-done .wait-mark { background: var(--green-2); border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(43, 109, 84, .15); }
.wait-status li.is-now .wait-mark { border-color: var(--berry); animation: livePulse 1.6s ease infinite; }

/* ------------------------------------------------------------------ play layout */

.play-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: .6rem;
  align-items: start;
  max-width: 1240px;
  margin: 0 auto;
}
.felt-column { display: grid; gap: .55rem; min-width: 0; }

.seat {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  padding: .45rem .8rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  font-family: var(--font-ui); font-size: .82rem;
}
.seat.is-active { border-color: rgba(43, 109, 84, .45); box-shadow: 0 0 0 3px rgba(43, 109, 84, .1); }
.seat-who { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; }
.seat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.seat.is-active .seat-dot { background: #3aa07a; box-shadow: 0 0 0 3px rgba(58, 160, 122, .2); animation: livePulse 2s ease infinite; }
.seat-name { font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.seat-group {
  font-size: .64rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted-2); border: 1px solid var(--line); border-radius: 999px; padding: .18rem .5rem;
  white-space: nowrap;
}
.seat-group.is-solids { color: #b8860b; border-color: rgba(184, 134, 11, .35); }
html[data-theme="night"] .seat-group.is-solids { color: #e8c46a; }
.seat-group.is-stripes { color: #1f63ae; border-color: rgba(31, 99, 174, .35); }
html[data-theme="night"] .seat-group.is-stripes { color: #7fb6f0; }
.seat-tray { display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }

.felt-card {
  position: relative;
  border-radius: 20px;
  padding: 0;
  background:
    radial-gradient(120% 80% at 50% 8%, rgba(255, 255, 255, .55), transparent 60%),
    linear-gradient(168deg, var(--panel-2), var(--paper-2));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .09);
  overflow: hidden;
  border: 1px solid var(--line);
}
html[data-theme="night"] .felt-card {
  background:
    radial-gradient(120% 80% at 50% 6%, rgba(120, 170, 200, .1), transparent 62%),
    linear-gradient(168deg, #131e2b, #0b131c);
}
#table { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
body[data-turn="them"] #table { cursor: default; }
.felt-overlay { position: absolute; inset: 0; display: grid; place-items: end center; pointer-events: none; padding: .8rem; }
.felt-hint {
  font-family: var(--font-ui); font-size: .78rem; font-weight: 600; color: #f4ead3;
  background: rgba(16, 32, 26, .72); border: 1px solid rgba(244, 234, 211, .22);
  border-radius: 999px; padding: .35rem .8rem; backdrop-filter: blur(6px);
}
.felt-hint.is-warn { background: rgba(120, 24, 40, .78); border-color: rgba(255, 200, 210, .3); }

/* control bar under the table */
.control-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, .85fr) auto;
  gap: .6rem;
  align-items: stretch;
}
.turn-card { padding: .9rem 1rem .95rem; border-left: 3px solid var(--green-2); display: flex; flex-direction: column; justify-content: center; }
.turn-card.is-yours { border-left-color: var(--berry); }
.turn-card.is-theirs { border-left-color: var(--line-strong); }
.turn-kicker { font-family: var(--font-ui); font-size: .64rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); }
.turn-card.is-yours .turn-kicker { color: var(--berry); }
.turn-title { display: block; margin-top: .25rem; font-family: var(--font-display); font-size: 1.22rem; line-height: 1.15; }
.turn-sub { margin-top: .3rem; font-size: .78rem; color: var(--muted); line-height: 1.5; }

.shot-card { padding: .8rem .95rem .7rem; }
.shot-top { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .9rem; align-items: center; }
.power-block { min-width: 0; }
.shot-head { display: flex; align-items: baseline; justify-content: space-between; }
.shot-label { font-family: var(--font-ui); font-size: .64rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); }
.shot-value { font-family: var(--font-ui); font-size: .8rem; font-weight: 600; color: var(--ink); }
.power-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 9px; margin: .5rem 0 .1rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(43, 109, 84, .35), rgba(217, 135, 43, .55), rgba(184, 48, 90, .8));
  outline: none; cursor: pointer;
}
.power-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--berry); box-shadow: 0 3px 8px -2px rgba(0, 0, 0, .4);
}
.power-range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--panel);
  border: 2px solid var(--berry); box-shadow: 0 3px 8px -2px rgba(0, 0, 0, .4);
}
.spin-row { display: flex; align-items: center; gap: .55rem; }
.spin-widget {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 34% 30%, #ffffff, #ddd2bd 62%, #b6a68c);
  border: 1px solid var(--line-strong); position: relative; cursor: pointer;
  box-shadow: inset 0 -4px 10px rgba(90, 70, 40, .18);
  touch-action: none;
}
html[data-theme="night"] .spin-widget { background: radial-gradient(circle at 34% 30%, #f4efe4, #c9c1b0 62%, #8d8471); }
.spin-ball { position: absolute; inset: 0; display: grid; place-items: center; }
.spin-dot {
  position: absolute; width: 11px; height: 11px; border-radius: 50%;
  background: var(--berry); box-shadow: 0 0 0 2px rgba(255, 255, 255, .55);
  transition: transform .08s linear;
}
.spin-copy { display: grid; gap: 0; line-height: 1.3; }
.spin-label { font-family: var(--font-ui); font-size: .62rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted-2); }
.spin-value { font-family: var(--font-ui); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.link-btn {
  justify-self: start; background: none; border: none; padding: 0; cursor: pointer;
  font-family: var(--font-ui); font-size: .7rem; color: var(--berry); text-decoration: underline;
}
.shoot-btn { padding: .8rem 1.4rem; white-space: nowrap; }
.shot-help { margin-top: .45rem; font-size: .68rem; color: var(--muted-2); }

.log-card { padding: .7rem .85rem .8rem; min-width: 0; display: flex; flex-direction: column; }
.log-head { display: flex; align-items: center; justify-content: space-between; }
.log-title { font-family: var(--font-ui); font-size: .68rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); }
.log-count { font-family: var(--font-ui); font-size: .72rem; color: var(--muted-2); }
.log-list { list-style: none; margin: .45rem 0 0; padding: 0; display: grid; gap: .25rem; max-height: 88px; overflow-y: auto; }
.log-list li {
  display: flex; gap: .4rem; align-items: baseline; font-size: .74rem; color: var(--muted);
  padding: .24rem .45rem; border-radius: 7px; background: var(--panel-2); line-height: 1.4;
}
.log-list li.log-you { border-left: 2px solid var(--berry); }
.log-list li.log-them { border-left: 2px solid var(--line-strong); }
.log-list li.log-foul { background: rgba(184, 48, 90, .09); }
.log-n { font-family: var(--font-ui); font-size: .66rem; font-weight: 700; color: var(--muted-2); flex: none; min-width: 1.3em; }
.log-text { flex: 1; }
.log-empty { color: var(--muted-2); font-style: italic; background: none !important; padding-left: 0 !important; }
.actions-card { display: flex; align-items: center; }
.actions-card .btn { padding: .7rem 1.1rem; }

/* ------------------------------------------------------------------ result */

.over-screen {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 1.2rem;
  background: rgba(243, 236, 224, .7);
  backdrop-filter: blur(4px) saturate(105%);
  -webkit-backdrop-filter: blur(4px) saturate(105%);
  animation: fadeIn .25s ease both; overflow-y: auto;
}
html[data-theme="night"] .over-screen { background: rgba(8, 13, 20, .74); }
.over-screen[hidden] { display: none; }
.over-card { max-width: 660px; width: 100%; padding: 2.2rem 1.9rem 2.1rem; text-align: center; box-shadow: var(--shadow); }
.over-screen.is-active .over-card { animation: cardRise .34s cubic-bezier(.2, .7, .3, 1) both; }
@keyframes cardRise { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.tag {
  display: inline-block; font-family: var(--font-ui); font-size: .68rem; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; color: var(--berry);
}
.over-title {
  margin-top: .6rem; font-size: clamp(2rem, 5vw, 2.9rem);
  background-image: linear-gradient(96deg, var(--berry), #d4486f 50%, var(--amber));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.over-sub { margin-top: .7rem; color: var(--muted); font-size: .95rem; }
.over-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: 1.4rem; }
.over-stat { padding: .7rem .4rem; border-radius: var(--radius-sm); background: var(--panel-2); border: 1px solid var(--line); }
.over-stat strong { display: block; font-family: var(--font-display); font-size: 1.25rem; }
.over-stat span { font-family: var(--font-ui); font-size: .62rem; font-weight: 600; letter-spacing: .11em; text-transform: uppercase; color: var(--muted-2); }

.toast {
  position: fixed; left: 50%; bottom: 1.6rem; transform: translate(-50%, 1.4rem);
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 999px;
  padding: .55rem 1rem; font-family: var(--font-ui); font-size: .82rem; color: var(--ink);
  box-shadow: var(--shadow-sm); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .24s ease; z-index: 90;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@keyframes livePulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .4; transform: scale(.82); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.screen[hidden], .play-layout[hidden] { display: none !important; }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 1080px) {
  .home-hero { grid-template-columns: minmax(0, 1fr) 320px; gap: 2rem; }
  .rules-grid { grid-template-columns: repeat(2, 1fr); }
  .control-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; }
  .log-card { display: none; }
}

@media (max-width: 920px) {
  .home-hero { grid-template-columns: 1fr; }
  .hero-table-wrap { display: none; }
  .steps { grid-template-columns: 1fr; }
  .rules-grid { grid-template-columns: 1fr; }
  .control-bar { grid-template-columns: 1fr; }
  .log-card { display: flex; }
  .actions-card .btn { width: 100%; }
}

@media (max-width: 620px) {
  .topbar { padding-top: .9rem; }
  .brand-sub, .topnav-sep, .kanda, .icon-btn-label, .theme-toggle-label { display: none; }
  .topnav { gap: .35rem; }
  .topnav-link, .icon-btn, .theme-toggle { padding: .5rem .7rem; }
  .statusbar { gap: .45rem; padding-bottom: .8rem; }
  .statusbar-left, .statusbar-right { width: 100%; justify-content: space-between; }
  .codepill-label { display: none; }
  .codepill-code { font-size: .84rem; }
  .wait-card { padding: 1.6rem 1.1rem 1.7rem; }
  .seat { font-size: .76rem; padding: .4rem .6rem; }
  .seat-name { max-width: 40vw; }
  .log-list { max-height: 96px; }
  .over-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: clamp(2rem, 9vw, 2.6rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
