/* ============================================================
   diginaized Games — Five Dice (v2)
   Elegant dark · emerald · gold aesthetic
   ============================================================ */

:root {
  --ink:        #f6efd9;
  --ink-soft:   #d9cfb1;
  --ink-dim:    #9a8f72;
  --gold:       #d6b06b;
  --gold-hi:    #f1d28a;
  --gold-lo:    #8a6a30;
  --emerald:    #0d3a30;
  --emerald-dp: #06201a;
  --emerald-hi: #14584a;
  --crimson:    #8a2424;
  --bg:         radial-gradient(ellipse at top, #1a1410 0%, #08060a 60%, #000 100%);
  --shadow:     0 24px 60px -20px rgba(0,0,0,.65), 0 4px 18px -6px rgba(0,0,0,.45);
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans:  "Inter", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100%;
}

.skip-link {
  position: absolute; left: -9999px;
  background: var(--gold); color: #1a0d04; padding: 6px 10px; border-radius: 4px;
}
.skip-link:focus { left: 12px; top: 12px; z-index: 1000; }

a { color: var(--gold-hi); text-decoration: none; }
a:hover { color: var(--gold); }

/* ============ Header / Footer ============ */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(214,176,107,.12);
  background: rgba(8,6,10,.65);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50;
  transition: background .25s, border-color .25s;
}
.site-header.is-scrolled { background: rgba(8,6,10,.92); }

.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--serif);
  font-style: italic; font-weight: 600;
  font-size: 22px;
  color: var(--gold-hi);
  letter-spacing: -0.5px;
}
.brand-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(214,176,107,.6);
}
.brand-product {
  font-family: var(--sans);
  font-style: normal; font-weight: 500;
  font-size: 11px; letter-spacing: .35em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.site-nav { display: flex; gap: 22px; }
.site-nav a {
  font-size: 12px; letter-spacing: .22em;
  text-transform: uppercase; font-weight: 500;
  color: var(--ink-soft);
}
.site-nav a:hover { color: var(--gold-hi); }

.site-footer {
  display: grid; grid-template-columns: 1fr auto; gap: 22px;
  padding: 30px 28px 40px;
  border-top: 1px solid rgba(214,176,107,.12);
  background: rgba(0,0,0,.4);
  margin-top: 60px;
  font-size: 13px; color: var(--ink-dim);
}
.site-footer p { max-width: 460px; margin: 8px 0 0; line-height: 1.5; }
.site-footer nav { display: flex; gap: 18px; align-items: center; }
.site-footer nav a { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; }

/* ============ Buttons ============ */
.btn {
  appearance: none;
  border: 1px solid rgba(214,176,107,.3);
  background: linear-gradient(180deg, rgba(40,30,20,.6), rgba(20,14,10,.7));
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 14px 22px;
  border-radius: 12px;
  cursor: pointer;
  transition: all .18s ease;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}
.btn:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold-hi);
  transform: translateY(-1px);
}
.btn:disabled { opacity: .35; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(180deg, #c89556, #8a5a25);
  border-color: #f1d28a;
  color: #1a0d04;
  font-weight: 700;
  box-shadow: 0 4px 18px -6px rgba(214,176,107,.6), inset 0 1px 0 rgba(255,230,170,.5);
}
.btn.primary:hover:not(:disabled) {
  color: #1a0d04;
  background: linear-gradient(180deg, #e0ab68, #a06a2a);
}
.btn.ghost {
  background: transparent;
  border-color: rgba(214,176,107,.25);
}

.eyebrow {
  font-size: 11px; letter-spacing: .35em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 14px;
}

.kicker {
  font-size: 9.5px; letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0;
}

/* ============ LANDING PAGE ============ */
.landing-hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 60px;
  padding: 80px 8% 60px;
  align-items: center;
}
.hero-copy h1 {
  font-family: var(--serif);
  font-size: clamp(48px, 6vw, 78px);
  font-weight: 600;
  line-height: 1.02;
  margin: 0 0 22px;
  color: var(--ink);
}
.hero-copy h1 em {
  font-style: italic;
  color: var(--gold-hi);
}
.hero-copy .lead {
  font-size: 17px; line-height: 1.6;
  color: var(--ink-soft);
  max-width: 520px;
  margin: 0 0 32px;
}
.hero-actions {
  display: flex; gap: 14px; margin-bottom: 36px;
  flex-wrap: wrap;
}
.hero-meta {
  display: flex; gap: 28px; flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: .15em;
  text-transform: uppercase;
}
.hero-meta strong {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--gold-hi);
  letter-spacing: 0;
  text-transform: none;
  margin-right: 6px;
}

.hero-stage {
  position: relative;
  aspect-ratio: 1.1 / 1;
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 50% 30%, #143a30 0%, #0a2820 50%, #050d0a 100%);
  border: 1px solid rgba(214,176,107,.22);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 30px;
}
.stage-glow {
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 25%, rgba(255,230,170,.18), transparent 55%);
  pointer-events: none;
}
.stage-table {
  position: relative;
  width: 85%; height: 70%;
  background: radial-gradient(ellipse, #1a5044 0%, #0d3a30 60%, #062018 100%);
  border-radius: 14px;
  border: 4px solid #2a1a10;
  outline: 1.5px solid var(--gold);
  outline-offset: -2px;
  box-shadow: inset 0 0 60px rgba(0,0,0,.5);
  display: grid;
  place-items: center;
}
.stage-watermark {
  position: absolute;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(36px, 7vw, 70px);
  color: rgba(214,176,107,0.08);
  letter-spacing: -2px;
  pointer-events: none;
}
.stage-die {
  position: absolute;
  width: 52px; height: 52px;
  background: linear-gradient(135deg, #fff8ea, #ebdfc4);
  border-radius: 9px;
  box-shadow: 0 6px 14px rgba(0,0,0,.4), inset 0 0 0 1px rgba(180,140,80,.2);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 7px;
  gap: 2px;
}
.stage-die i {
  align-self: center; justify-self: center;
  width: 7px; height: 7px;
  background: radial-gradient(circle, #1a1208 30%, #3a2818 100%);
  border-radius: 50%;
}
.stage-die.d1 { top: 22%; left: 18%; transform: rotate(-12deg); }
.stage-die.d1 i:nth-child(1) { grid-area: 1/1; }
.stage-die.d1 i:nth-child(2) { grid-area: 1/3; }
.stage-die.d1 i:nth-child(3) { grid-area: 2/2; }
.stage-die.d1 i:nth-child(4) { grid-area: 3/1; }
.stage-die.d1 i:nth-child(5) { grid-area: 3/3; }

.stage-die.d2 { top: 45%; left: 28%; transform: rotate(8deg); }
.stage-die.d2 i:nth-child(1) { grid-area: 1/1; }
.stage-die.d2 i:nth-child(2) { grid-area: 2/2; }
.stage-die.d2 i:nth-child(3) { grid-area: 3/3; }

.stage-die.d3 { top: 32%; right: 26%; transform: rotate(-6deg); }
.stage-die.d3 i { grid-area: 2/2; }

.stage-die.d4 { bottom: 18%; left: 38%; transform: rotate(15deg); }
.stage-die.d4 i:nth-child(1) { grid-area: 1/1; }
.stage-die.d4 i:nth-child(2) { grid-area: 3/3; }

.stage-die.d5 { top: 55%; right: 18%; transform: rotate(-18deg); }
.stage-die.d5 i:nth-child(1) { grid-area: 1/1; }
.stage-die.d5 i:nth-child(2) { grid-area: 1/3; }
.stage-die.d5 i:nth-child(3) { grid-area: 3/1; }
.stage-die.d5 i:nth-child(4) { grid-area: 3/3; }

.stage-chip {
  position: absolute;
  padding: 10px 16px;
  background: rgba(8,6,10,.8);
  border: 1px solid rgba(214,176,107,.3);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  display: flex; gap: 8px; align-items: baseline;
}
.stage-chip span {
  font-size: 9px; letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.stage-chip strong {
  font-family: var(--serif);
  font-size: 20px; font-weight: 600;
  color: var(--gold-hi);
}
.stage-chip.total { top: 28px; right: 28px; }
.stage-chip.room  { bottom: 28px; left: 28px; }

/* Feature strip */
.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(214,176,107,.12);
  border-top: 1px solid rgba(214,176,107,.12);
  border-bottom: 1px solid rgba(214,176,107,.12);
  margin: 40px 0;
}
.feature-strip article {
  background: linear-gradient(180deg, #0c0a0e 0%, #060508 100%);
  padding: 38px 34px;
  display: flex; flex-direction: column; gap: 12px;
}
.feature-index {
  font-family: var(--serif);
  font-size: 26px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 2px;
}
.feature-strip h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}
.feature-strip p {
  margin: 0; color: var(--ink-soft);
  font-size: 14.5px; line-height: 1.55;
}

.cta-band {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 30px;
  align-items: center;
  margin: 0 8% 60px;
  padding: 50px 50px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(20,16,12,.85), rgba(10,8,6,.6));
  border: 1px solid rgba(214,176,107,.22);
}
.cta-band h2 {
  font-family: var(--serif);
  font-size: 38px; font-weight: 600;
  margin: 0 0 10px;
  color: var(--gold-hi);
}
.cta-band p { margin: 0; color: var(--ink-soft); }

/* ============ Rules / Generic narrow pages ============ */
.section.narrow,
.section.rules-page {
  max-width: 920px;
  margin: 60px auto;
  padding: 0 28px;
}
.section.narrow h1,
.section.rules-page h1 {
  font-family: var(--serif);
  font-size: 52px;
  font-weight: 600;
  margin: 0 0 22px;
  color: var(--gold-hi);
}
.section.narrow .lead,
.section.rules-page .lead {
  font-size: 17px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 32px;
}
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 32px 0;
}
.rules-grid article {
  padding: 22px;
  background: rgba(20,16,12,.55);
  border: 1px solid rgba(214,176,107,.15);
  border-radius: 14px;
}
.rules-grid h2 {
  font-family: var(--serif);
  font-size: 22px;
  margin: 0 0 8px;
  color: var(--gold-hi);
}
.rules-grid p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.55; }

.rules-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}
.rules-table th,
.rules-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(214,176,107,.12);
  font-size: 14px;
}
.rules-table th {
  font-size: 11px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.callout {
  padding: 18px 22px;
  border: 1px solid rgba(214,176,107,.25);
  border-radius: 12px;
  background: rgba(20,16,12,.45);
  margin: 18px 0;
  color: var(--ink-soft);
}

/* =====================================================
   GAME PAGE — preserves the original elegant 3D layout
   ===================================================== */
.game-shell {
  display: grid;
  grid-template-columns: 1fr 380px;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "topbar  side"
    "stage   side"
    "actions side";
  gap: 14px;
  padding: 14px;
  height: calc(100vh - 70px);     /* leave room for site header */
  max-height: calc(100vh - 70px);
  overflow: hidden;
}

/* Top bar */
.game-shell .topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: linear-gradient(180deg, rgba(20,16,12,.85), rgba(10,8,6,.6));
  border: 1px solid rgba(214,176,107,.18);
  border-radius: 18px;
  backdrop-filter: blur(12px);
  gap: 20px;
  flex-wrap: wrap;
}
.game-shell .title {
  display: flex; align-items: baseline; gap: 14px;
}
.game-shell .title h1 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 30px;
  letter-spacing: .5px;
  margin: 0;
  color: var(--gold-hi);
}
.game-shell .title .sub {
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.game-shell .stats {
  display: flex; gap: 26px; align-items: center;
}
.game-shell .stat {
  display: flex; flex-direction: column; align-items: flex-start; line-height: 1;
}
.game-shell .stat label {
  font-size: 9.5px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 6px;
}
.game-shell .stat .v {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
}
.game-shell .stat .v.gold { color: var(--gold-hi); }
.game-shell .stat .v small { opacity: .4; font-size: .6em; }
.game-shell .stat .room-code {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .25em;
  color: var(--gold);
}

.topbar-actions {
  display: flex; gap: 8px;
}
.icon-btn {
  background: rgba(20,16,12,.6);
  border: 1px solid rgba(214,176,107,.25);
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .15s;
  font-family: var(--sans);
}
.icon-btn:hover {
  border-color: var(--gold);
  color: var(--gold-hi);
}
#audioToggle .audio-on  { display: none; }
#audioToggle .audio-off { display: inline; }
#audioToggle.on .audio-on  { display: inline; color: var(--gold-hi); }
#audioToggle.on .audio-off { display: none; }
#audioToggle.on { border-color: var(--gold); }

/* Stage */
.game-shell .stage {
  grid-area: stage;
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(214,176,107,.28);
  box-shadow: var(--shadow);
  background: #0d0a08;
  touch-action: none;
  user-select: none;
}
#c3d {
  display: block;
  width: 100%; height: 100%;
  cursor: grab;
}
#c3d.dragging { cursor: grabbing; }
/* Subtle vignette: keeps the cinematic edge without blacking out the felt. */
.game-shell .stage .vignette {
  pointer-events: none;
  position: absolute; inset: 0;
  box-shadow:
    inset 0 0 60px 0 rgba(0,0,0,.28),
    inset 0 0 14px 0 rgba(0,0,0,.18);
  border-radius: inherit;
}

.hint {
  position: absolute;
  left: 18px; bottom: 16px;
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(8,8,6,.55);
  border: 1px solid rgba(214,176,107,.18);
  border-radius: 999px;
  padding: 7px 14px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.hint strong { color: var(--gold-hi); font-weight: 600; }

.charge {
  position: absolute;
  right: 18px; bottom: 16px;
  width: 140px; height: 6px;
  background: rgba(255,255,255,.08);
  border-radius: 4px;
  overflow: hidden;
  opacity: 0;
  transition: opacity .15s;
}
.charge.on { opacity: 1; }
.charge > i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--crimson));
  transition: width .04s linear;
}

.announce {
  position: absolute;
  top: 22px; left: 50%;
  transform: translate(-50%, -8px);
  padding: 11px 22px;
  background: rgba(8,8,6,.78);
  border: 1px solid rgba(214,176,107,.35);
  border-radius: 999px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--gold-hi);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s, transform .35s;
  white-space: nowrap;
  z-index: 5;
}
.announce.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.roll-dots {
  position: absolute;
  top: 18px; left: 18px;
  display: flex; gap: 8px;
  padding: 7px 10px;
  background: rgba(8,8,6,.6);
  border: 1px solid rgba(214,176,107,.22);
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.roll-dots .d {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(214,176,107,.4);
}
.roll-dots .d.used {
  background: var(--gold);
  border-color: var(--gold-hi);
  box-shadow: 0 0 8px rgba(241,210,138,.6);
}

/* Audience indicator */
.audience-indicator {
  position: absolute;
  top: 18px; right: 18px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: rgba(8,8,6,.6);
  border: 1px solid rgba(214,176,107,.22);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  font-size: 10.5px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.audience-indicator .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-dim);
  box-shadow: 0 0 0 0 transparent;
  transition: background .3s, box-shadow .3s;
}
.audience-indicator[data-mood="warm"] .dot { background: var(--gold); box-shadow: 0 0 10px rgba(214,176,107,.4); }
.audience-indicator[data-mood="hot"]  .dot {
  background: var(--crimson);
  box-shadow: 0 0 12px rgba(180,40,40,.7);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.4); }
}

.turn-banner {
  position: absolute;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 18px;
  background: rgba(8,8,6,.78);
  border: 1px solid rgba(214,176,107,.3);
  border-radius: 12px;
  backdrop-filter: blur(8px);
}
.turn-banner .t-kicker {
  font-size: 9px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.turn-banner .t-name {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--gold-hi);
}
.turn-banner.mine {
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(241,210,138,.3);
}
.turn-banner.mine .t-name::after {
  content: ' · your turn';
  color: var(--ink-soft);
  font-style: normal;
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
}

/* Actions row */
.game-shell .actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(20,16,12,.85), rgba(10,8,6,.6));
  border: 1px solid rgba(214,176,107,.18);
  border-radius: 18px;
  backdrop-filter: blur(12px);
}
.game-shell .actions .btn {
  padding: 14px 16px;
}

/* Side */
.game-shell .side {
  grid-area: side;
  background: linear-gradient(180deg, rgba(20,16,12,.85), rgba(10,8,6,.6));
  border: 1px solid rgba(214,176,107,.18);
  border-radius: 18px;
  padding: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(12px);
}
.game-shell .side h2 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  color: var(--gold-hi);
}
.summary {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 8px;
  padding: 12px;
  background: rgba(0,0,0,.3);
  border-radius: 10px;
  border: 1px solid rgba(214,176,107,.12);
}
.summary > div { text-align: center; }
.summary span {
  display: block;
  font-size: 9px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 4px;
}
.summary strong {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}

.scorelist {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  margin-right: -4px;
  display: flex; flex-direction: column; gap: 4px;
  min-height: 0;
}
.scorelist::-webkit-scrollbar { width: 6px; }
.scorelist::-webkit-scrollbar-track { background: transparent; }
.scorelist::-webkit-scrollbar-thumb { background: rgba(214,176,107,.2); border-radius: 3px; }

.row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255,255,255,.02);
  cursor: pointer;
  transition: all .15s;
}
.row:hover:not(.locked):not(.disabled) {
  background: rgba(214,176,107,.08);
  border-color: rgba(214,176,107,.3);
}
.row.locked { cursor: default; opacity: .55; }
.row.disabled { cursor: default; }
.row.candidate {
  background: rgba(214,176,107,.12);
  border-color: rgba(241,210,138,.5);
  box-shadow: inset 0 0 0 1px rgba(241,210,138,.15);
}
.row.upper-divider {
  border-top: 1px dashed rgba(214,176,107,.2);
  margin-top: 6px;
  padding-top: 14px;
}
.row .label { display: flex; flex-direction: column; gap: 2px; }
.row .name { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.row .rule {
  font-size: 9.5px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--ink-dim);
}
.row .val {
  font-family: var(--serif);
  font-size: 18px; font-weight: 600;
  color: var(--ink);
  min-width: 28px;
  text-align: right;
}
.row.locked .val { color: var(--gold); }
.row.candidate .val { color: var(--gold-hi); }
.row .val.zero { color: var(--ink-dim); }

.seat-strip {
  border-top: 1px dashed rgba(214,176,107,.2);
  padding-top: 12px;
}
.seats {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 8px;
}
.seat {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(214,176,107,.12);
  border-radius: 8px;
  font-size: 12px;
}
.seat.current {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(241,210,138,.2);
}
.seat.me .seat-name em {
  font-style: normal;
  font-size: 10px;
  color: var(--gold-hi);
  letter-spacing: .15em;
  text-transform: uppercase;
}
.seat-score {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--gold-hi);
}

/* Modals */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal.show { display: flex; }
.modal .card {
  background: linear-gradient(180deg, #1a1410, #0a0806);
  border: 1px solid rgba(214,176,107,.4);
  border-radius: 22px;
  padding: 36px 42px;
  text-align: center;
  box-shadow: 0 30px 80px -10px rgba(0,0,0,.8);
  max-width: 440px;
  width: 100%;
  position: relative;
}
.modal .card .kicker { color: var(--ink-dim); margin-bottom: 6px; }
.modal .card h2 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 32px;
  color: var(--gold-hi);
  margin: 6px 0 22px;
}
.modal .card .final {
  font-family: var(--serif);
  font-size: 68px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 8px;
}
.modal .card .label {
  font-size: 10px; letter-spacing: .35em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 28px;
}
.modal .card button { width: 100%; }
.close-x {
  position: absolute; top: 14px; right: 16px;
  background: transparent; border: none;
  color: var(--ink-dim);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.close-x:hover { color: var(--gold-hi); }

/* Account form */
.auth-tabs {
  display: flex; gap: 6px;
  margin-bottom: 22px;
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(214,176,107,.12);
  border-radius: 10px;
  padding: 4px;
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  padding: 10px;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-weight: 500;
  cursor: pointer;
  border-radius: 7px;
  font-family: var(--sans);
}
.auth-tab.active {
  background: rgba(214,176,107,.15);
  color: var(--gold-hi);
}
.auth-form {
  display: flex; flex-direction: column;
  gap: 14px; text-align: left;
  margin-bottom: 18px;
}
.auth-form label {
  font-size: 10px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--ink-dim);
  display: flex; flex-direction: column; gap: 6px;
}
.auth-form input {
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(214,176,107,.2);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(214,176,107,.18);
}
.auth-form button { margin-top: 6px; }
.auth-guest {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 14px;
}
.auth-msg {
  display: block;
  margin-top: 10px;
  color: var(--ink-dim);
  font-size: 12px;
}
.auth-msg.error { color: #e08585; }

/* Room modal */
.room-card .room-lead {
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 22px;
}
.room-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  text-align: left;
}
.room-col { display: flex; flex-direction: column; gap: 10px; }
.room-col h3 {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  margin: 0;
  color: var(--gold-hi);
}
.room-divider {
  display: flex; align-items: center;
  color: var(--ink-dim);
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
}
.room-col input {
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(214,176,107,.25);
  border-radius: 8px;
  padding: 12px;
  color: var(--gold-hi);
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  letter-spacing: .35em;
  text-transform: uppercase;
}
.room-col input:focus {
  outline: none;
  border-color: var(--gold);
}
.room-col small {
  color: var(--ink-dim);
  font-size: 11px;
  letter-spacing: .1em;
}
.room-current {
  margin-top: 22px;
  padding: 22px;
  background: rgba(20,16,12,.45);
  border: 1px solid rgba(214,176,107,.2);
  border-radius: 12px;
}
.room-code-big {
  font-family: var(--serif);
  font-style: italic;
  font-size: 56px;
  font-weight: 600;
  letter-spacing: .3em;
  color: var(--gold-hi);
  margin: 12px 0 16px;
}


/* Mobile responsive — landing-page only (game-shell mobile layout lives
   in the dedicated mobile section at the end of this file). */
@media (max-width: 980px) {
  .landing-hero { grid-template-columns: 1fr; padding: 40px 6%; gap: 30px; }
  .hero-stage   { max-width: 480px; margin: 0 auto; width: 100%; }
  .feature-strip { grid-template-columns: 1fr; }
  .cta-band     { grid-template-columns: 1fr; padding: 30px; margin: 0 4% 40px; }
  .room-grid    { grid-template-columns: 1fr; }
  .room-divider { justify-content: center; }
}

/* Pricing roadmap (premium page) */
.pricing-roadmap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 30px 0;
}
.pricing-roadmap article {
  padding: 26px;
  background: rgba(20,16,12,.55);
  border: 1px solid rgba(214,176,107,.18);
  border-radius: 14px;
}
.pricing-roadmap h2 {
  font-family: var(--serif);
  font-size: 26px;
  margin: 0 0 10px;
  color: var(--gold-hi);
}
.pricing-roadmap p { margin: 0; color: var(--ink-soft); }

@media (max-width: 700px) {
  .pricing-roadmap { grid-template-columns: 1fr; }
  .site-footer { grid-template-columns: 1fr; }
  .site-header { padding: 14px 18px; }
  .site-nav { gap: 12px; }
  .site-nav a { font-size: 11px; letter-spacing: .15em; }
}


/* ============================================================
   v3.0.4 — UNIFIED DESIGN SYSTEM
   One coherent layer, replacing the previous polish passes.
   ============================================================ */

:root {
  --theme-accent: #d4b06a;
  --ease-out: cubic-bezier(.22,.61,.36,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --shadow-lg: 0 24px 60px -12px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4);
  --shadow-md: 0 10px 28px -6px rgba(0,0,0,.45);
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
}

/* ============================================================
   GLOBAL POLISH
   ============================================================ */
* { -webkit-tap-highlight-color: transparent; }
button { font-family: var(--sans); }
::selection { background: rgba(214,176,107,.35); color: #fff; }
.btn, .icon-btn, .menu-item, .auth-tab, .tab-btn {
  font-feature-settings: 'kern' 1, 'liga' 1;
}

/* ============================================================
   BUTTONS — proper press/hover/disabled/focus states
   ============================================================ */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, rgba(40,30,20,.6), rgba(20,14,9,.6));
  border: 1px solid rgba(214,176,107,.25);
  color: var(--ink-soft);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .15s var(--ease-out),
              border-color .15s var(--ease-out),
              color .15s var(--ease-out),
              transform .12s var(--ease-out),
              box-shadow .15s var(--ease-out);
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 2px 6px rgba(0,0,0,.3);
}
.btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(50,38,24,.7), rgba(28,20,12,.7));
  border-color: rgba(214,176,107,.5);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 4px 14px rgba(0,0,0,.4);
}
.btn:active:not(:disabled) { transform: translateY(1px); transition-duration: .05s; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn .btn-ico { font-size: 14px; opacity: .85; letter-spacing: 0; }
.btn .btn-sub {
  display: block;
  font-size: 9px;
  letter-spacing: .15em;
  opacity: .55;
  margin-top: 2px;
  text-transform: uppercase;
}
.btn.primary {
  background: linear-gradient(180deg, #c8923e, #8d6020);
  border-color: rgba(247,217,122,.5);
  color: #1a0f04;
  text-shadow: 0 1px 0 rgba(255,255,255,.18);
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset,
              0 0 0 1px rgba(0,0,0,.2),
              0 6px 18px rgba(140,94,32,.35);
}
.btn.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #d8a04a, #9a6a26);
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset,
              0 0 0 1px rgba(0,0,0,.2),
              0 8px 24px rgba(140,94,32,.5);
  color: #1a0f04;
}
.btn.ghost {
  background: transparent;
  border-color: rgba(214,176,107,.22);
  color: var(--ink-soft);
  box-shadow: none;
}
.btn.ghost:hover:not(:disabled) {
  background: rgba(214,176,107,.06);
  border-color: rgba(214,176,107,.45);
  color: var(--ink);
}
.btn.block { width: 100%; display: flex; }
.btn-sm { padding: 7px 12px; font-size: 11px; letter-spacing: .12em; }
.btn-gold {
  background: linear-gradient(180deg, #f7d97a, #b88528);
  border-color: rgba(247,217,122,.6);
  color: #1a1004; font-weight: 700;
}
.btn:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }

/* Icon button (topbar) */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(20,16,12,.55);
  border: 1px solid rgba(214,176,107,.22);
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  cursor: pointer;
  min-height: 36px;
  transition: background .15s var(--ease-out),
              border-color .15s var(--ease-out),
              color .15s var(--ease-out),
              transform .12s var(--ease-out);
}
.icon-btn:hover { background: rgba(40,30,20,.6); border-color: rgba(214,176,107,.45); color: var(--gold-hi); }
.icon-btn:active { transform: translateY(1px); transition-duration: .05s; }
.icon-btn:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }

.icon-btn.audio-btn { width: 36px; padding: 8px; font-size: 16px; line-height: 1; }
#audioToggle .audio-on  { display: none; }
#audioToggle .audio-off { display: inline; color: var(--ink-dim); }
#audioToggle.on .audio-on  { display: inline; color: var(--gold-hi); }
#audioToggle.on .audio-off { display: none; }
#audioToggle.on { border-color: rgba(214,176,107,.45); background: rgba(214,176,107,.08); }

/* Pill button avatar */
.pill-btn { padding-left: 6px; padding-right: 14px; gap: 8px; }
.pb-avatar {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,.4);
  border: 1.5px solid var(--c, var(--gold));
  font-size: 14px; line-height: 1;
  flex-shrink: 0;
}

/* Premium pill badge */
.premium-pill {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #f7d97a, #b88528);
  color: #1a1004; font-weight: 700; font-size: 14px;
  box-shadow: 0 2px 8px rgba(247,217,122,.3), 0 0 0 1.5px rgba(247,217,122,.5);
}

/* Room button badge */
.room-btn-badge {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px;
  background: var(--gold);
  color: #1a0d04;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  margin-left: 4px;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.game-shell .topbar {
  padding: 14px 22px;
  gap: 18px;
  border-radius: var(--radius-lg);
  align-items: center;
}
.topbar-actions {
  display: flex; align-items: center; gap: 6px; flex-wrap: nowrap;
}
.topbar-divider {
  width: 1px; height: 22px;
  background: linear-gradient(180deg, transparent, rgba(214,176,107,.25), transparent);
  margin: 0 4px;
}
.now-playing {
  font-size: 11px; color: var(--ink-dim); letter-spacing: .04em;
  max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-style: italic; opacity: .7;
}
.now-playing:empty { display: none; }

/* Title subtitle that toggles between default and turn info */
.game-shell .title .sub {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 14px;
}
.sub-default { color: var(--ink-dim); }
.sub-turn { display: inline-flex; align-items: center; gap: 8px; }
.sub-turn .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold-hi);
  box-shadow: 0 0 0 0 rgba(247,217,122,.5);
}
.sub-turn .dot.pulse { animation: dotPulse 1.6s ease-in-out infinite; }
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(247,217,122,.6); }
  50%      { box-shadow: 0 0 0 8px rgba(247,217,122,0); }
}
.sub-turn .t-kicker {
  font-size: 10px; letter-spacing: .25em; text-transform: uppercase;
  color: var(--ink-dim);
}
.sub-turn .t-name {
  font-family: var(--serif); font-style: italic;
  font-size: 14px; color: var(--ink); font-weight: 500;
}
.sub-turn .t-clock {
  font-family: var(--sans);
  padding: 1px 7px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,.05);
  border-radius: 999px;
  border: 1px solid rgba(214,176,107,.15);
  color: var(--ink-soft);
}
.sub-turn .t-clock.warn { color: #ffb050; border-color: #ffb05080; }
.sub-turn .t-clock.out  { color: #ff6a4a; border-color: #ff6a4a80; animation: clockPulse 1s infinite; }
@keyframes clockPulse { 50% { background: rgba(255,106,74,.15); } }
.is-my-turn .sub-turn .t-name { color: var(--gold-hi); }

/* Floating skip-turn button - only the host sees this when timer expires */
.skip-turn-fab {
  position: absolute; top: 14px; right: 14px;
  z-index: 12;
  padding: 8px 14px;
  font-size: 11px;
  background: linear-gradient(180deg, #c8923e, #8d6020);
  border-color: rgba(247,217,122,.5);
  color: #1a0f04;
  animation: fabIn .25s var(--ease-spring);
}
@keyframes fabIn {
  from { opacity: 0; transform: translateY(-8px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* "More" menu */
.topbar-menu { position: relative; }
.topbar-menu summary { list-style: none; cursor: pointer; }
.topbar-menu summary::-webkit-details-marker { display: none; }
.menu-summary {
  font-size: 18px; padding: 6px 12px; min-width: 38px; letter-spacing: 0;
}
.topbar-menu[open] .menu-summary {
  background: rgba(214,176,107,.15);
  border-color: rgba(214,176,107,.45);
  color: var(--gold-hi);
}
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  z-index: 250;
  min-width: 240px;
  padding: 8px;
  background: linear-gradient(180deg, #1d1410, #100a07);
  border: 1px solid rgba(214,176,107,.3);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  animation: menuPop .18s var(--ease-spring);
  display: flex; flex-direction: column;
}
@keyframes menuPop {
  from { opacity: 0; transform: translateY(-8px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.menu-item {
  display: flex; align-items: center; gap: 12px;
  background: transparent; border: 0; color: var(--ink-soft);
  text-align: left; padding: 10px 12px;
  border-radius: 8px; font-size: 13px;
  cursor: pointer; transition: background .12s var(--ease-out);
  letter-spacing: 0; text-transform: none; font-weight: 500;
}
.menu-item:hover { background: rgba(214,176,107,.1); color: var(--ink); }
.menu-item.gold { color: #f7d97a; font-weight: 600; }
.menu-item .mi-ico { width: 22px; text-align: center; font-size: 15px; opacity: .9; }
.menu-sep { height: 1px; background: rgba(214,176,107,.15); margin: 6px 6px; }

/* ============================================================
   STAGE HUD
   ============================================================ */
.stage-hud-top {
  position: absolute; top: 14px; left: 14px; right: 14px;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none;
}
.stage-hud-top > * { pointer-events: auto; }
.roll-dots {
  display: flex; gap: 8px;
  padding: 7px 12px;
  background: rgba(10,8,6,.7);
  border: 1px solid rgba(214,176,107,.2);
  border-radius: 999px;
  backdrop-filter: blur(8px);
}
.roll-dots .d {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--gold);
  transition: background .25s var(--ease-out), opacity .25s var(--ease-out);
  box-shadow: 0 0 6px rgba(214,176,107,.6);
}
.roll-dots .d.used { background: transparent; border: 1px solid rgba(214,176,107,.25); box-shadow: none; }

.audience-indicator {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px;
  background: rgba(10,8,6,.7);
  border: 1px solid rgba(214,176,107,.2);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  font-size: 10px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--ink-soft);
}
.audience-indicator .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-dim);
  transition: background .3s var(--ease-out), box-shadow .3s var(--ease-out);
}
.audience-indicator.is-warm .dot { background: #ffb050; box-shadow: 0 0 12px #ffb05080; }
.audience-indicator.is-hot  .dot { background: #ff6a4a; box-shadow: 0 0 14px #ff6a4a80; }

.hint {
  position: absolute; left: 14px; bottom: 14px;
  padding: 8px 14px;
  background: rgba(10,8,6,.75);
  border: 1px solid rgba(214,176,107,.2);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: .04em;
  max-width: calc(100% - 28px);
  transition: opacity .25s var(--ease-out);
}
.hint strong { color: var(--gold-hi); font-weight: 600; }

.announce {
  position: absolute; left: 50%; top: 14px;
  transform: translateX(-50%) translateY(-6px);
  padding: 10px 22px;
  background: linear-gradient(180deg, rgba(20,15,10,.92), rgba(10,8,6,.92));
  border: 1px solid rgba(247,217,122,.4);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  font-family: var(--serif); font-style: italic;
  font-size: 16px;
  color: var(--gold-hi);
  opacity: 0;
  transition: opacity .25s var(--ease-out), transform .25s var(--ease-spring);
  box-shadow: 0 12px 28px rgba(0,0,0,.5);
  z-index: 11;
  pointer-events: none;
}
.announce.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.charge {
  position: absolute; right: 14px; bottom: 14px;
  width: 110px; height: 6px;
  background: rgba(0,0,0,.5);
  border: 1px solid rgba(214,176,107,.18);
  border-radius: 999px;
  opacity: 0;
  transition: opacity .15s;
  overflow: hidden;
}
.charge.on { opacity: 1; }
.charge i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #c8923e, #f7d97a);
  border-radius: 999px;
  transition: width .05s linear;
}

/* ============================================================
   SCORECARD DRAWER
   ============================================================ */
/* Drawer handle on the right edge of the stage */
.drawer-handle {
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 8px;
  background: linear-gradient(180deg, rgba(40,30,20,.92), rgba(20,14,9,.92));
  border: 1px solid rgba(214,176,107,.3);
  border-right: 0;
  border-radius: 14px 0 0 14px;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 10px; letter-spacing: .25em; text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transition: all .2s var(--ease-out);
  box-shadow: var(--shadow-md);
}
.drawer-handle:hover {
  background: linear-gradient(180deg, rgba(60,42,24,.95), rgba(28,20,12,.95));
  border-color: rgba(214,176,107,.5);
  color: var(--ink);
  padding-right: 12px;
}
.drawer-handle .dh-count {
  color: var(--gold-hi); font-weight: 600;
  writing-mode: horizontal-tb;
}
.drawer-handle .dh-arrow {
  font-size: 18px; line-height: 1;
  writing-mode: horizontal-tb;
  color: var(--ink-dim);
  transition: transform .25s var(--ease-spring);
}
.drawer-handle:hover .dh-arrow { color: var(--gold-hi); }

/* Side panel: ALWAYS visible on desktop (the v2.1 way) */
/* The drawer/peek behavior only activates on mobile via media queries below */
.game-shell .side {
  /* Use the original v2.1 placement */
  background: linear-gradient(180deg, #1a130d, #0a0805);
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(214,176,107,.18);
  padding: 22px 20px;
  overflow-y: auto;
  transition: none;
}
/* Hide the drawer handle on desktop — it's a mobile affordance */
.drawer-handle { display: none; }
/* Hide the in-drawer close button on desktop too */
.drawer-close { display: none; }
.side-head { margin-bottom: 14px; }

/* Scorecard list rows: polished, clear scoreable state */
.scorelist {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 14px;
}
.scorelist .row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(214,176,107,.06);
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s var(--ease-out);
}
.scorelist .row.upper-divider { margin-top: 10px; }
.scorelist .row:hover:not(.locked):not(.disabled) {
  background: rgba(214,176,107,.08);
  border-color: rgba(214,176,107,.25);
  transform: translateX(-2px);
}
.scorelist .row.candidate {
  border-color: rgba(247,217,122,.35);
  background: rgba(214,176,107,.06);
}
.scorelist .row.candidate:hover {
  border-color: rgba(247,217,122,.6);
  box-shadow: 0 0 0 1px rgba(247,217,122,.3), 0 4px 14px rgba(0,0,0,.3);
}
.scorelist .row.locked {
  cursor: default;
  opacity: .55;
}
.scorelist .row.disabled {
  cursor: default; opacity: .35;
}
.scorelist .row .label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.scorelist .row .name {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.scorelist .row .rule {
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.scorelist .row .val {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  min-width: 38px;
  text-align: right;
}
.scorelist .row .val.zero { color: var(--ink-dim); }
.scorelist .row.locked .val { color: var(--ink-soft); }

/* Best-candidate pulse highlight */
.scorelist .row.best-candidate {
  animation: bestPulse 1.4s ease-in-out 2;
}
@keyframes bestPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(247,217,122,.3); }
  50%      { box-shadow: 0 0 0 1px rgba(247,217,122,.6), 0 0 24px rgba(247,217,122,.35); }
}

/* ============================================================
   ACTION DOCK
   ============================================================ */
.game-shell .actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 14px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(20,16,12,.9), rgba(10,8,6,.75));
  border: 1px solid rgba(214,176,107,.2);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
}
.throw-btn {
  flex-direction: column;
  padding: 16px 20px;
  font-size: 16px;
  letter-spacing: .22em;
  border-radius: var(--radius-md);
}
.throw-btn .btn-ico { font-size: 22px; }
.throw-btn .btn-label { display: block; }
.actions-secondary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.actions-secondary .btn { letter-spacing: .14em; }

/* ============================================================
   MODALS
   ============================================================ */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
  overflow-y: auto;
  animation: modalBg .2s var(--ease-out);
}
@keyframes modalBg {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal.show { display: flex; }
.modal .card {
  position: relative;
  background: linear-gradient(180deg, #1c150f, #0b0805);
  border: 1px solid rgba(214,176,107,.3);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  overflow: hidden;
  text-align: left;
  animation: cardIn .28s var(--ease-spring);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal .card .kicker {
  padding: 26px 30px 0;
  font-size: 10px; letter-spacing: .32em; text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0;
}
.modal .card h2 {
  padding: 4px 30px 18px;
  margin: 0;
  font-family: var(--serif); font-style: italic;
  font-size: 26px; font-weight: 500;
  color: var(--gold-hi);
  border-bottom: 1px solid rgba(214,176,107,.12);
  margin-bottom: 18px;
}
/* Body content area inside card */
.modal .card > :not(.kicker):not(h2):not(.close-x) {
  padding-left: 30px; padding-right: 30px;
}
.modal .card > :last-child:not(.close-x) { padding-bottom: 26px; }

#modal .card { max-width: 380px; text-align: center; padding: 0; }
#modal .card h2 { text-align: center; }
#modal .card > * { padding-left: 30px; padding-right: 30px; }
#modal .card .final {
  font-family: var(--serif);
  font-size: 64px; font-weight: 600;
  color: var(--ink); line-height: 1;
  margin: 6px 0 6px;
}
#modal .card .label {
  font-size: 10px; letter-spacing: .35em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 22px;
}
#modal .card button { margin-bottom: 26px; }

.close-x {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(0,0,0,.5);
  border: 1px solid rgba(214,176,107,.2);
  color: var(--ink-soft);
  font-size: 22px; line-height: 1;
  cursor: pointer;
  transition: all .15s var(--ease-out);
  z-index: 5;
}
.close-x:hover { background: rgba(214,176,107,.18); color: var(--gold-hi); border-color: var(--gold); transform: scale(1.05); }
.close-x:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Modal form elements */
.modal input[type="text"],
.modal input[type="email"],
.modal input[type="password"],
.modal input[type="number"],
.modal select,
.modal textarea {
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(214,176,107,.2);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.modal textarea { resize: vertical; min-height: 64px; }
.modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(214,176,107,.18);
}

.form-msg {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-dim);
  min-height: 16px;
  letter-spacing: 0;
}
.form-msg.error { color: #e08585; }
.form-msg.ok    { color: #8de0a4; }

/* Auth tabs */
.auth-tabs {
  display: flex; gap: 4px;
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(214,176,107,.1);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--ink-dim);
  padding: 10px;
  font-size: 11px; letter-spacing: .22em;
  text-transform: uppercase; font-weight: 500;
  cursor: pointer;
  border-radius: 7px;
  transition: all .15s var(--ease-out);
}
.auth-tab:hover { color: var(--ink); }
.auth-tab.active {
  background: rgba(214,176,107,.15);
  color: var(--gold-hi);
}

.auth-form {
  display: flex; flex-direction: column;
  gap: 12px; text-align: left;
}
.auth-form label {
  font-size: 10px; letter-spacing: .25em;
  text-transform: uppercase; color: var(--ink-dim);
  display: flex; flex-direction: column; gap: 6px;
}
.auth-form button { margin-top: 4px; }
.auth-foot {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(214,176,107,.1);
}

/* ============================================================
   ROOM MODAL — guided journey
   ============================================================ */
.room-card { max-width: 480px; }
.room-state[hidden] { display: none; }
.room-pane { display: flex; flex-direction: column; gap: 14px; }
.room-pane[hidden] { display: none; }
.room-pane .room-lead {
  font-size: 13px; color: var(--ink-dim);
  margin: 0 0 4px; line-height: 1.5;
}
#joinCodeInput {
  text-align: center;
  font-family: var(--serif);
  font-size: 34px; font-weight: 600;
  letter-spacing: .35em;
  padding: 18px 10px;
  text-transform: uppercase;
}
.room-opts {
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(214,176,107,.1);
  border-radius: 12px;
  padding: 4px 14px;
}
.room-opts .opt-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid rgba(214,176,107,.08);
  font-size: 13px; gap: 12px;
  letter-spacing: 0; text-transform: none;
}
.room-opts .opt-row:last-child { border-bottom: none; }
.room-opts .opt-row > span { color: var(--ink-soft); font-weight: 500; }
.room-opts .opt-row select {
  width: auto; min-width: 150px; flex: 0 0 auto;
  padding: 7px 10px; font-size: 12px;
}

/* In-room state */
.room-share-card {
  background: linear-gradient(180deg, rgba(214,176,107,.12), rgba(214,176,107,.02));
  border: 1px solid rgba(214,176,107,.3);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 18px;
  text-align: center;
}
.room-share-card .kicker { padding: 0 !important; }
.room-code-big {
  font-family: var(--serif);
  font-size: 44px; font-weight: 600;
  letter-spacing: .25em;
  color: var(--gold-hi);
  margin: 10px 0 14px;
  padding: 14px;
  background: rgba(0,0,0,.4);
  border-radius: 12px;
  cursor: pointer;
  user-select: all;
  transition: background .15s;
}
.room-code-big:hover { background: rgba(0,0,0,.55); }
.room-share-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}

.room-roster { margin-bottom: 18px; }
.room-roster .kicker { padding: 0 !important; margin-bottom: 8px; }
#rosterCount { color: var(--gold-hi); font-weight: 700; }
.roster-sep { opacity: .5; margin: 0 2px; }
.roster-list {
  display: flex; flex-direction: column; gap: 6px;
}
.roster-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px; align-items: center;
  padding: 9px 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(214,176,107,.08);
  border-radius: 10px;
  border-left: 3px solid var(--c, var(--gold));
}
.roster-row.me { background: rgba(214,176,107,.08); border-color: rgba(214,176,107,.2); }
.roster-row .r-avatar {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0,0,0,.4);
  border: 1.5px solid var(--c, var(--gold));
  font-size: 15px;
}
.roster-row .r-name {
  font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.roster-row .r-tag {
  font-size: 9px; letter-spacing: .15em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(214,176,107,.15);
  color: var(--gold-hi);
}
.roster-row .r-status { font-size: 18px; line-height: 1; }
.roster-empty {
  padding: 16px; text-align: center;
  font-size: 12px; font-style: italic; color: var(--ink-dim);
}

/* ============================================================
   PROFILE MODAL
   ============================================================ */
.profile-card { max-width: 540px; }
.profile-card .pf-identity {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(214,176,107,.1), rgba(214,176,107,.02));
  border: 1px solid rgba(214,176,107,.22);
  border-radius: 14px;
  margin-bottom: 18px;
}
.pf-id-avatar {
  display: grid; place-items: center;
  width: 58px; height: 58px; border-radius: 50%;
  background: rgba(0,0,0,.5);
  border: 2.5px solid var(--gold);
  font-size: 28px;
  flex-shrink: 0;
}
.pf-id-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pf-id-name {
  font-family: var(--serif); font-style: italic;
  font-size: 22px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pf-id-meta {
  font-size: 10px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-dim);
}

.pf-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(214,176,107,.1); }
.pf-section:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.profile-card h3 {
  margin: 0 0 12px;
  font-family: var(--serif); font-style: italic;
  font-size: 18px; color: var(--gold-hi); font-weight: 500;
}

.pf-stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
}
.pf-stat {
  padding: 12px 6px; text-align: center;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(214,176,107,.08);
  border-radius: 10px;
  transition: transform .15s var(--ease-out);
}
.pf-stat:hover { transform: translateY(-1px); border-color: rgba(214,176,107,.2); }
.pf-stat label {
  display: block;
  font-size: 9px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 5px;
}
.pf-stat strong {
  font-family: var(--serif);
  font-size: 22px; font-weight: 600; color: var(--ink);
}

.pf-section-label {
  display: block;
  font-size: 10px; letter-spacing: .22em;
  text-transform: uppercase; color: var(--ink-dim);
  margin: 14px 0 8px;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
  max-height: 168px; overflow-y: auto;
  padding: 8px;
  background: rgba(0,0,0,.25);
  border-radius: 10px;
  border: 1px solid rgba(214,176,107,.08);
}
.avatar-btn {
  aspect-ratio: 1; width: 100%; height: auto;
  border-radius: 10px;
  font-size: 22px;
  background: rgba(255,255,255,.04);
  border: 1.5px solid transparent;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all .12s var(--ease-out);
}
.avatar-btn:hover { background: rgba(214,176,107,.12); transform: scale(1.05); }
.avatar-btn.selected {
  border-color: var(--gold);
  background: rgba(214,176,107,.18);
  box-shadow: 0 0 0 3px rgba(214,176,107,.15);
}

.color-picker { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; }
.color-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer;
  transition: transform .12s var(--ease-out);
}
.color-btn:hover { transform: scale(1.1); }
.color-btn.selected {
  border-color: white;
  box-shadow: 0 0 0 2px var(--gold);
}

.pf-premium-card .prem-on {
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(247,217,122,.18), rgba(184,133,40,.05));
  border: 1px solid rgba(247,217,122,.4);
  border-radius: 12px;
  color: #f7d97a; font-weight: 600; font-size: 14px;
  text-align: center;
}
#pfUpgradeBtn { width: 100%; }

/* ============================================================
   CHAT PANEL
   ============================================================ */
.chat-panel {
  position: fixed; right: 16px; bottom: 96px;
  z-index: 80;
  display: none;
  flex-direction: column; align-items: flex-end;
}
.chat-panel.on { display: flex; }
.chat-toggle {
  position: relative;
  width: 54px; height: 54px; border-radius: 50%;
  border: 0;
  background: linear-gradient(180deg, #2a1e16, #16100b);
  color: var(--ink); font-size: 24px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.5), inset 0 0 0 1px rgba(214,176,107,.3);
  transition: transform .15s var(--ease-spring);
}
.chat-toggle:hover { transform: scale(1.08); }
.chat-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px;
  background: #ff6a4a; color: white;
  font-size: 11px; line-height: 20px; font-weight: 700;
  letter-spacing: 0;
}
.chat-inner {
  display: none; margin-bottom: 12px;
  width: 340px; max-width: calc(100vw - 32px);
  background: linear-gradient(180deg, #1c150f, #100a07);
  border: 1px solid rgba(214,176,107,.3);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: chatIn .25s var(--ease-spring);
}
@keyframes chatIn {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-panel.open .chat-inner { display: flex; flex-direction: column; }
.chat-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  background: rgba(214,176,107,.08);
  border-bottom: 1px solid rgba(214,176,107,.18);
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
}
.chat-header .close-x {
  position: static; width: 28px; height: 28px; font-size: 18px;
}
.chat-messages {
  height: 300px; overflow-y: auto;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-msg { display: flex; gap: 8px; font-size: 13px; align-items: flex-start; }
.chat-msg.mine { flex-direction: row-reverse; }
.chat-msg.system {
  justify-content: center; opacity: .6;
  font-style: italic; font-size: 11px;
  letter-spacing: .04em;
}
.chat-msg.emote { justify-content: center; gap: 10px; align-items: center; }
.chat-msg.emote .ct-emote { font-size: 30px; animation: emotePop .4s var(--ease-spring); }
.chat-msg.emote .ct-author { font-size: 11px; opacity: .6; }
@keyframes emotePop {
  from { transform: scale(.3); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.ct-avatar {
  display: grid; place-items: center;
  min-width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.5);
  border: 1.5px solid var(--c, var(--gold));
  font-size: 14px;
}
.ct-bubble {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(214,176,107,.08);
  padding: 7px 11px;
  border-radius: 12px;
  max-width: 220px;
}
.chat-msg.mine .ct-bubble {
  background: rgba(214,176,107,.15);
  border-color: rgba(214,176,107,.25);
}
.ct-author {
  display: block; font-size: 10px;
  color: var(--ink-dim); margin-bottom: 2px;
  letter-spacing: .08em;
}
.ct-body { white-space: pre-wrap; word-wrap: break-word; color: var(--ink); }

.emote-bar {
  display: flex; gap: 4px; flex-wrap: wrap;
  padding: 8px 10px;
  border-top: 1px solid rgba(214,176,107,.1);
}
.emote-btn {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(214,176,107,.12);
  border-radius: 8px;
  font-size: 18px;
  padding: 5px 9px;
  cursor: pointer;
  transition: all .12s var(--ease-out);
}
.emote-btn:hover {
  background: rgba(214,176,107,.15);
  transform: translateY(-1px) scale(1.05);
}

.chat-form {
  display: flex; gap: 6px;
  padding: 10px;
  border-top: 1px solid rgba(214,176,107,.12);
}
.chat-form input {
  flex: 1;
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(214,176,107,.2);
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
}
.chat-form input:focus { outline: none; border-color: var(--gold); }

/* ============================================================
   COSMETICS / LEADERBOARD / FRIENDS / SETTINGS / UPGRADE
   ============================================================ */
.cosmetics-card, .leaderboard-card, .friends-card,
.settings-card, .upgrade-card { max-width: 580px; }
.upgrade-card { max-width: 640px; }

.cos-note { font-size: 12px; color: var(--ink-dim); margin: 4px 0 14px; line-height: 1.5; }
.cos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px; margin: 4px 0 18px;
}
.cos-card {
  position: relative;
  padding: 14px 10px;
  background: rgba(255,255,255,.03);
  border: 1.5px solid rgba(214,176,107,.08);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: all .15s var(--ease-out);
}
.cos-card:hover { background: rgba(214,176,107,.08); transform: translateY(-2px); }
.cos-card.selected {
  border-color: var(--gold);
  background: rgba(214,176,107,.12);
  box-shadow: 0 0 0 3px rgba(214,176,107,.15);
}
.cos-card.locked { opacity: .6; }
.cos-card.locked:hover { opacity: .9; }
.cos-swatch {
  width: 56px; height: 56px; border-radius: 12px; position: relative;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.4);
}
.cos-pip {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 10px; height: 10px; border-radius: 50%;
}
.cos-felt { width: 80px; height: 56px; border-radius: 8px; }
.cos-name { font-size: 12px; color: var(--ink-soft); font-weight: 500; letter-spacing: 0; text-transform: none; }
.cos-prem { color: #f7d97a; font-weight: 700; }
.cos-lock { position: absolute; top: 8px; right: 8px; font-size: 14px; }

.tabs { display: flex; gap: 6px; margin: 4px 0 16px; }
.tab-btn {
  flex: 1; background: rgba(255,255,255,.04);
  border: 1px solid rgba(214,176,107,.15);
  color: var(--ink-soft); padding: 8px 10px;
  border-radius: 9px; cursor: pointer;
  font-size: 11px; letter-spacing: .12em; font-weight: 500;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  background: rgba(214,176,107,.2);
  border-color: var(--gold);
  color: var(--gold-hi);
}

.lb-list { display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: grid;
  grid-template-columns: 36px 36px 1fr auto;
  gap: 12px; align-items: center;
  padding: 9px 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(214,176,107,.06);
  border-radius: 10px;
  transition: all .15s var(--ease-out);
}
.lb-row.top { background: linear-gradient(90deg, rgba(247,217,122,.12), transparent 70%); }
.lb-row.me  { box-shadow: 0 0 0 1px var(--gold); }
.lb-row:hover { transform: translateX(-2px); }
.lb-rank { font-weight: 700; text-align: center; font-size: 15px; color: var(--ink); }
.lb-row.top:nth-child(1) .lb-rank { font-size: 20px; }
.lb-avatar {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.5);
  border: 1.5px solid var(--c, var(--gold)); font-size: 16px;
}
.lb-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.lb-prem { color: #f7d97a; }
.lb-score {
  font-family: var(--serif); font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 18px; color: var(--gold-hi);
}
.lb-empty { text-align: center; opacity: .55; padding: 32px; font-style: italic; }

.fr-section { margin-bottom: 18px; }
.fr-section:last-child { margin-bottom: 0; }
.fr-section h3 {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-dim); margin: 0 0 8px;
  font-family: var(--sans); font-style: normal; font-weight: 600;
}
.fr-search { display: flex; gap: 6px; margin-bottom: 8px; }
.fr-search input { flex: 1; }
.fr-list { display: flex; flex-direction: column; gap: 6px; }
.fr-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(214,176,107,.06);
  border-radius: 10px;
}
.fr-avatar {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(0,0,0,.5);
  border: 1.5px solid var(--c, var(--gold));
  font-size: 14px;
}
.fr-name { flex: 1; font-size: 13px; color: var(--ink); }
.fr-prem { color: #f7d97a; }
.fr-empty { opacity: .55; font-style: italic; font-size: 12px; padding: 12px; text-align: center; }

.set-row {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 18px;
}
.set-row > label {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-dim); font-weight: 500;
}
.set-row input[type="range"] { width: 100%; accent-color: var(--gold); }
.set-check { display: flex; align-items: center; gap: 10px; cursor: pointer; }

.upg-lead { font-size: 14px; color: var(--ink-soft); line-height: 1.55; margin: 4px 0 18px; }
.upg-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin: 16px 0;
}
.upg-card {
  position: relative;
  padding: 18px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(214,176,107,.2);
  border-radius: 16px;
  display: flex; flex-direction: column;
}
.upg-card.upg-best {
  background: linear-gradient(155deg, rgba(247,217,122,.12), rgba(184,133,40,.04));
  border-color: rgba(247,217,122,.5);
}
.upg-tag {
  position: absolute; top: -10px; right: 14px;
  background: linear-gradient(135deg, #f7d97a, #b88528);
  color: #1a1004; padding: 4px 12px;
  border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase;
}
.upg-card h3 { margin: 0 0 8px; font-size: 18px; color: var(--gold-hi); }
.upg-price {
  font-family: var(--serif);
  font-size: 32px; font-weight: 600; color: var(--ink);
  margin-bottom: 14px;
}
.upg-price span { font-size: 13px; font-weight: 400; opacity: .55; margin-left: 4px; }
.upg-card ul { list-style: none; margin: 0 0 16px; padding: 0; font-size: 13px; }
.upg-card ul li { padding: 5px 0; color: var(--ink-soft); }
.upg-card ul li::before { content: '✦'; color: var(--gold); margin-right: 8px; }
.upg-note { display: block; font-size: 11px; color: var(--ink-dim); line-height: 1.5; margin-top: 12px; }
.upg-note code {
  background: rgba(214,176,107,.12);
  padding: 1px 6px; border-radius: 4px;
  font-size: 11px;
}

/* ============================================================
   SEATS in scorecard side panel
   ============================================================ */
.seat-strip { margin-top: 18px; padding-top: 18px; border-top: 1px solid rgba(214,176,107,.12); }
.seat-strip .kicker { padding: 0 !important; margin-bottom: 8px; }
.seats { display: flex; flex-direction: column; gap: 5px; }
.seat {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 8px; align-items: center;
  padding: 7px 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid transparent;
  border-radius: 9px;
  border-left: 3px solid var(--seat-color, var(--gold));
}
.seat.current {
  background: rgba(214,176,107,.1);
  border-color: rgba(214,176,107,.3);
}
.seat.finished { opacity: .55; }
.seat-avatar {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(0,0,0,.4);
  border: 1.5px solid var(--seat-color, var(--gold));
  font-size: 14px;
}
.seat-name { font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-name em { font-style: normal; opacity: .55; font-size: 10px; }
.seat-name .seat-host { color: #f7d97a; }
.seat-score {
  font-family: var(--serif); font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: 15px; color: var(--gold-hi);
}
.seat-flag { color: #6fcf97; font-weight: 700; }
.seat-kick { background: transparent; border: 0; color: #c87878;
  font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.seat-kick:hover { color: #ff6a4a; }

/* ============================================================
   TOAST + AUDIENCE FLASH + CONFETTI
   ============================================================ */
.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #1c150f, #0b0805);
  border: 1px solid rgba(214,176,107,.3);
  border-radius: 999px;
  padding: 12px 22px; font-size: 13px;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  animation: toastIn .25s var(--ease-spring);
}
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Stage flash for audience reactions */
.stage::after {
  content: ""; position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(247,217,122,.18) 0%, transparent 60%);
  opacity: 0; transition: opacity .4s;
  z-index: 5;
}
.stage.hot::after { opacity: 1; animation: stageHotFlash 1.2s var(--ease-out); }
@keyframes stageHotFlash {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  100% { opacity: 0; }
}

/* Confetti container */
.confetti-burst {
  position: absolute; inset: 0; pointer-events: none; z-index: 50;
  overflow: hidden;
}
.confetti-piece {
  position: absolute; left: 50%; top: 35%;
  width: 9px; height: 14px; border-radius: 2px;
  animation: confettiFall 1.6s var(--ease-out) forwards;
}
@keyframes confettiFall {
  0%   { transform: translate(-50%, -50%) rotate(0) scale(0); opacity: 0; }
  10%  { opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--dx, 0)), calc(60vh + var(--dy, 0)))
               rotate(var(--rot, 720deg)) scale(1);
    opacity: 0;
  }
}

/* ============================================================
   MISC / OVERRIDES
   ============================================================ */
.game-shell .stat-room[hidden] { display: none !important; }

/* ============================================================
   v3.0.6 — TABLE PROMINENCE, COMPACT SCORECARD, SLIMMER ACTIONS
   ============================================================ */

/* 1. SLIMMER ACTION DOCK (two-row: throw big on top, secondary small below) */
.game-shell .actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
}
.throw-btn {
  flex-direction: row;
  padding: 13px 18px;
  font-size: 14px;
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-height: 50px;
}
.throw-btn .btn-ico { font-size: 18px; }
.throw-btn .btn-label { display: inline; }
.throw-btn .btn-sub {
  display: inline;
  font-size: 9px;
  opacity: .5;
  margin-top: 0;
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid rgba(0,0,0,.25);
}
.actions-secondary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.actions-secondary .btn {
  padding: 8px 10px;
  font-size: 10px;
  min-height: 0;
  letter-spacing: .12em;
}
.actions-secondary .btn .btn-ico { font-size: 12px; }

/* 2. COMPACT SCORECARD — tighter rows, inline summary at bottom, no scroll on 1080p */
.game-shell .side {
  display: flex;
  flex-direction: column;
  padding: 14px 14px 12px;
}
.side-head { margin-bottom: 8px; padding-right: 0; }
.side-head h2 { font-size: 22px; margin: 0; }
.side-head .kicker {
  font-size: 9px;
  letter-spacing: .25em;
  margin: 0 0 1px;
}

/* Move summary (Upper/Bonus/Rows/Total) to BOTTOM of side panel */
.game-shell .side .summary {
  order: 99;                 /* push to bottom of flex */
  margin: 8px 0 0;
  padding: 10px 12px;
  background: rgba(0,0,0,.3);
  border-radius: 10px;
  border: 1px solid rgba(214,176,107,.1);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.game-shell .side .summary div {
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
  min-width: 0;
}
.game-shell .side .summary span {
  font-size: 9px; letter-spacing: .2em;
  text-transform: uppercase; color: var(--ink-dim);
}
.game-shell .side .summary strong {
  font-family: var(--serif);
  font-size: 18px; font-weight: 600;
  color: var(--ink);
  line-height: 1;
}
/* The Total tile gets the headline gold treatment */
.game-shell .side .summary .summary-total {
  position: relative;
}
.game-shell .side .summary .summary-total strong {
  color: var(--gold-hi);
  font-size: 22px;
}
.game-shell .side .summary .summary-total span {
  color: var(--gold);
}

.scorelist {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  overflow: hidden;          /* keep scroll out — rows must fit */
}
.scorelist .row {
  padding: 6px 11px;         /* down from 10px 14px */
  gap: 8px;
  min-height: 0;
  border-radius: 8px;
}
.scorelist .row .name {
  font-size: 12px;
  font-weight: 500;
}
.scorelist .row .rule {
  font-size: 8.5px;
  letter-spacing: .1em;
}
.scorelist .row .val {
  font-size: 17px;
  min-width: 30px;
}

/* 3. BIGGER TABLE — make the stage breathe, remove fixed min-height */
.game-shell .stage {
  min-height: 0 !important;
  flex: 1 1 auto;
}
/* Topbar slimmer so more vertical room for the table */
.game-shell .topbar {
  padding: 10px 18px;
  min-height: 0;
}
.game-shell .title h1 { font-size: 28px; line-height: 1; }
.game-shell .title .sub { font-size: 11px; }
.game-shell .stats { gap: 22px; }
.game-shell .stat label {
  font-size: 9px;
  letter-spacing: .22em;
  margin-bottom: 1px;
}
.game-shell .stat .v {
  font-size: 24px;
  line-height: 1;
}

/* 4. SLIGHTLY tighter shell padding so the table can grow */
.game-shell {
  gap: 10px;
  padding: 10px;
}

/* 5. ENSURE THE SCORECARD FITS — cap row height progression on tall screens */
@media (min-height: 850px) {
  .scorelist .row { padding: 8px 12px; }
  .scorelist .row .name { font-size: 13px; }
  .scorelist .row .val { font-size: 19px; }
}

/* 6. ULTRAWIDE — give scorecard a touch more room */
@media (min-width: 1600px) {
  .game-shell { grid-template-columns: 1fr 420px; }
  .scorelist .row { padding: 8px 14px; }
  .scorelist .row .name { font-size: 13px; }
  .scorelist .row .val { font-size: 20px; }
}

/* ============================================================
   v3.0.6 — MODAL DEEPENING (more functional, more polish)
   ============================================================ */

/* Modal cards a bit bigger to fit deeper content */
.modal .card { max-width: 520px; }
.profile-card { max-width: 600px; }
.room-card    { max-width: 500px; }
.settings-card{ max-width: 540px; }
.upgrade-card { max-width: 700px; }

/* Add a "section grid" pattern used across modals for richer layouts */
.modal-section {
  padding: 14px 0;
  border-top: 1px solid rgba(214,176,107,.1);
}
.modal-section:first-of-type { border-top: 0; padding-top: 0; }
.modal-section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px;
}
.modal-section-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-family: var(--sans); font-style: normal;
}

/* Quick-stat tiles used in profile + account */
.quick-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 480px) { .quick-tiles { grid-template-columns: repeat(2, 1fr); } }
.quick-tile {
  padding: 12px 8px; text-align: center;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(214,176,107,.1);
  border-radius: 10px;
  transition: border-color .15s, transform .15s var(--ease-out);
}
.quick-tile:hover { border-color: rgba(214,176,107,.3); transform: translateY(-1px); }
.quick-tile .qt-val {
  display: block;
  font-family: var(--serif); font-size: 22px; font-weight: 600;
  color: var(--gold-hi); line-height: 1.1;
}
.quick-tile .qt-lab {
  display: block; font-size: 9px;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-dim); margin-top: 4px;
}

/* Recent activity feed (account & profile) */
.activity-feed { display: flex; flex-direction: column; gap: 4px; }
.activity-row {
  display: grid; grid-template-columns: 30px 1fr auto;
  gap: 10px; align-items: center;
  padding: 8px 12px;
  background: rgba(255,255,255,.025);
  border-radius: 9px;
  font-size: 12px;
}
.activity-row .act-ico {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(214,176,107,.12);
  color: var(--gold-hi);
  font-size: 13px;
}
.activity-row .act-time {
  font-size: 10px; color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
.activity-empty {
  padding: 16px; text-align: center;
  font-size: 12px; font-style: italic;
  color: var(--ink-dim);
}

/* ============================================================
   v3.0.6 — IMMERSION FX
   ============================================================ */

/* Stage ambient light when "warming up" */
.game-shell .stage::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 35%, rgba(247,217,122,.06) 0%, transparent 55%);
  pointer-events: none;
  z-index: 1;
  transition: opacity .6s ease;
}

/* Dice held-glow pulse (canvas can't do CSS but the wrapper overlay can) */
.held-tag {
  position: absolute;
  padding: 2px 8px;
  background: linear-gradient(180deg, #f7d97a, #b88528);
  color: #1a1004;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .15em;
  border-radius: 999px;
  transform: translate(-50%, 0);
  pointer-events: none;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(247,217,122,.4);
  animation: heldPulse 1.6s ease-in-out infinite;
}
@keyframes heldPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(247,217,122,.4); }
  50%      { box-shadow: 0 4px 18px rgba(247,217,122,.7); }
}

/* Score-row "scored!" splash when committed */
.scorelist .row.just-scored {
  animation: justScored .9s var(--ease-out);
}
@keyframes justScored {
  0%   { background: rgba(247,217,122,.45); border-color: var(--gold-hi); transform: translateX(0); }
  40%  { background: rgba(247,217,122,.25); }
  100% { background: rgba(255,255,255,.02); border-color: rgba(214,176,107,.06); }
}

/* Audience indicator gets a "wave" when reactions fire */
.audience-indicator.is-cheer .audience-label {
  animation: cheerBounce .7s var(--ease-spring);
}
@keyframes cheerBounce {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(-3px); }
  60% { transform: translateY(0); }
  75% { transform: translateY(-1px); }
}

/* New-roll ripple at click point */
.click-ripple {
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: rgba(247,217,122,.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: clickRipple .6s ease-out forwards;
}
@keyframes clickRipple {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(.4); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(8); }
}

/* Score commit "float-up" number on stage */
.stage-float-num {
  position: absolute;
  left: 50%; top: 60%;
  transform: translate(-50%, 0);
  font-family: var(--serif);
  font-size: 52px;
  font-weight: 700;
  color: var(--gold-hi);
  text-shadow: 0 4px 24px rgba(247,217,122,.6), 0 0 30px rgba(247,217,122,.3);
  pointer-events: none;
  animation: floatScore 1.6s var(--ease-out) forwards;
  z-index: 30;
  letter-spacing: -.02em;
}
@keyframes floatScore {
  0%   { opacity: 0; transform: translate(-50%, 30px) scale(.6); }
  20%  { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -80px) scale(1.2); }
}
.stage-float-num.bigwin {
  font-size: 70px;
  color: #ffe89a;
  text-shadow: 0 4px 30px rgba(247,217,122,.9), 0 0 40px rgba(247,217,122,.4);
}

/* "Your turn" pulse banner in multiplayer */
.turn-flash {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 18px 36px;
  background: linear-gradient(135deg, #f7d97a, #b88528);
  color: #1a0f04;
  border-radius: 14px;
  font-family: var(--serif); font-style: italic;
  font-size: 28px; font-weight: 700;
  z-index: 30;
  pointer-events: none;
  box-shadow: 0 18px 40px rgba(0,0,0,.4), 0 0 0 1px rgba(247,217,122,.4);
  animation: turnFlash 1.8s var(--ease-out) forwards;
}
@keyframes turnFlash {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.7); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  75%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(.95); }
}

/* Dice container "knock" shake when settling violently */
.stage.knock canvas { animation: knockShake .25s ease-out; }
@keyframes knockShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(2px, -1px); }
  60% { transform: translate(-1px, 1px); }
  80% { transform: translate(1px, 0); }
}


/* ============================================================
   v3.0.8 — Animated audience meter (no more cryptic "QUIET" pill)
   ============================================================ */
.audience-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  background: rgba(10, 7, 5, .78);
  border: 1px solid rgba(214, 176, 107, .18);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: border-color .3s var(--ease-out), background .3s var(--ease-out);
}
/* Mini bar meter — 5 vertical bars that animate based on intensity */
.audience-indicator .aud-meter {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  width: 22px;
}
.audience-indicator .aud-meter i {
  display: inline-block;
  width: 3px;
  background: rgba(214, 176, 107, .35);
  border-radius: 1px;
  transform-origin: bottom;
  transition: background .25s var(--ease-out), height .25s var(--ease-out);
}
.audience-indicator .aud-meter i:nth-child(1) { height: 30%; }
.audience-indicator .aud-meter i:nth-child(2) { height: 50%; }
.audience-indicator .aud-meter i:nth-child(3) { height: 70%; }
.audience-indicator .aud-meter i:nth-child(4) { height: 50%; }
.audience-indicator .aud-meter i:nth-child(5) { height: 30%; }
/* Levels: idle, warm, hot, cheer */
.audience-indicator.is-warm .aud-meter i { background: #d4b06a; }
.audience-indicator.is-warm .aud-meter i:nth-child(2),
.audience-indicator.is-warm .aud-meter i:nth-child(4) { height: 80%; }
.audience-indicator.is-warm .aud-meter i:nth-child(3) { height: 100%; }
.audience-indicator.is-hot   .aud-meter i,
.audience-indicator.is-cheer .aud-meter i { background: #f7d97a; }
.audience-indicator.is-hot   .aud-meter i,
.audience-indicator.is-cheer .aud-meter i { animation: audPulse .55s ease-in-out infinite alternate; }
.audience-indicator.is-hot   .aud-meter i:nth-child(1),
.audience-indicator.is-cheer .aud-meter i:nth-child(1) { animation-delay: 0s; }
.audience-indicator.is-hot   .aud-meter i:nth-child(2),
.audience-indicator.is-cheer .aud-meter i:nth-child(2) { animation-delay: 0.06s; }
.audience-indicator.is-hot   .aud-meter i:nth-child(3),
.audience-indicator.is-cheer .aud-meter i:nth-child(3) { animation-delay: 0.12s; }
.audience-indicator.is-hot   .aud-meter i:nth-child(4),
.audience-indicator.is-cheer .aud-meter i:nth-child(4) { animation-delay: 0.18s; }
.audience-indicator.is-hot   .aud-meter i:nth-child(5),
.audience-indicator.is-cheer .aud-meter i:nth-child(5) { animation-delay: 0.24s; }
@keyframes audPulse {
  from { height: 30%; opacity: .55; }
  to   { height: 100%; opacity: 1; }
}
/* Label color shifts as mood escalates */
.audience-indicator.is-warm  { border-color: rgba(214, 176, 107, .35); }
.audience-indicator.is-hot,
.audience-indicator.is-cheer { border-color: rgba(247, 217, 122, .6); background: rgba(34, 22, 8, .85); }
.audience-indicator.is-cheer .audience-label { color: var(--gold-hi); }
.audience-indicator .audience-label { font-weight: 600; }

/* ============================================================
   v3.0.8 — Round-start overlay + tutorial nudge
   ============================================================ */
.stage-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 25;
}
.start-curtain {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  color: var(--gold-hi);
  text-align: center;
  text-shadow: 0 6px 30px rgba(0,0,0,.7), 0 0 40px rgba(247,217,122,.35);
  animation: curtainIn 2.4s var(--ease-out) forwards;
}
.start-curtain .sc-kicker {
  display: block;
  font-family: var(--sans);
  font-style: normal;
  font-size: 11px;
  letter-spacing: .4em;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-bottom: 8px;
  opacity: 0;
  animation: kickerIn .8s var(--ease-out) .2s forwards;
}
.start-curtain .sc-title {
  display: block;
  font-size: 64px;
  line-height: 1;
  letter-spacing: -.02em;
}
.start-curtain .sc-sub {
  display: block;
  margin-top: 12px;
  font-family: var(--sans);
  font-style: normal;
  font-size: 13px;
  letter-spacing: .25em;
  color: var(--ink-soft);
  text-transform: uppercase;
  opacity: 0;
  animation: kickerIn .8s var(--ease-out) .8s forwards;
}
@keyframes curtainIn {
  0%   { opacity: 0; transform: scale(.85) translateY(20px); }
  25%  { opacity: 1; transform: scale(1) translateY(0); }
  75%  { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(1.02) translateY(-12px); }
}
@keyframes kickerIn {
  to { opacity: 1; }
}

/* Tutorial nudge — an animated demo of the drag-to-throw gesture.
   A pointer icon (finger on touch, cursor arrow on desktop) travels up a
   dashed arc from the bottom of the stage, looping continuously. Below the
   animation is a label describing the gesture. Auto-fades out when the
   player makes their first throw. */
.throw-nudge {
  position: absolute;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 26;
  opacity: 0;
  animation: nudgeFadeIn .4s ease-out .15s forwards;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.4));
}
.throw-nudge.fading {
  animation: nudgeFadeOut .3s ease-in forwards;
}
@keyframes nudgeFadeIn  { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes nudgeFadeOut { from { opacity: 1; } to { opacity: 0; transform: translate(-50%, -8px); } }

.throw-nudge .nudge-anim {
  width: 84px;
  height: 56px;
  overflow: visible;
}
/* The dashed trail of the drag motion */
.throw-nudge .nudge-trail {
  fill: none;
  stroke: rgba(247,217,122,.5);
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
  stroke-linecap: round;
  /* Subtle dash-march so the trail itself feels alive */
  animation: nudgeDashMarch 1.6s linear infinite;
}
@keyframes nudgeDashMarch {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -14; }
}
/* The pointer travels along the path: start at bottom (60,70), end at top (60,14) */
.throw-nudge .nudge-pointer {
  transform-origin: 0 0;
  animation: nudgePointer 1.6s cubic-bezier(.4, 0, .25, 1) infinite;
}
@keyframes nudgePointer {
  0%   { transform: translate(60px, 70px) scale(.9); opacity: 0; }
  10%  { opacity: 1; }
  70%  { transform: translate(60px, 14px) scale(1.05); opacity: 1; }
  80%  { transform: translate(60px, 14px) scale(1.15); opacity: .7; }
  100% { transform: translate(60px, 14px) scale(1.3); opacity: 0; }
}
/* Touch finger pad: glowing dot + outer ring */
.throw-nudge .nudge-ring {
  fill: none;
  stroke: var(--gold-hi);
  stroke-width: 1.8;
  opacity: .65;
}
.throw-nudge .nudge-dot {
  fill: var(--gold-hi);
}
/* Mouse cursor arrow */
.throw-nudge .nudge-cursor {
  fill: var(--gold-hi);
  stroke: rgba(0,0,0,.5);
  stroke-width: .8;
  stroke-linejoin: round;
}

.throw-nudge .nudge-text {
  display: inline-block;
  padding: 7px 16px;
  background: rgba(0,0,0,.78);
  border: 1px solid rgba(247,217,122,.45);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--gold-hi);
  text-transform: uppercase;
  white-space: nowrap;
  animation: nudgeTextPulse 2.4s ease-in-out infinite;
}
@keyframes nudgeTextPulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(247,217,122, .45); }
  50%      { box-shadow: 0 0 0 12px rgba(247,217,122, 0);  }
}

/* Honor reduced-motion preference: static hint, no looping animation */
@media (prefers-reduced-motion: reduce) {
  .throw-nudge,
  .throw-nudge .nudge-anim,
  .throw-nudge .nudge-trail,
  .throw-nudge .nudge-pointer,
  .throw-nudge .nudge-text {
    animation: none;
  }
  .throw-nudge { opacity: 1; }
  .throw-nudge .nudge-pointer { transform: translate(60px, 40px); }
}

/* Mobile: nudge sits a bit higher (action dock is closer to stage bottom) */
@media (max-width: 680px) {
  .throw-nudge { bottom: 14%; }
  .throw-nudge .nudge-anim { width: 72px; height: 50px; }
  .throw-nudge .nudge-text { font-size: 10px; padding: 6px 13px; letter-spacing: .12em; }
}

/* ============================================================
   v3.0.8 — Held die badge (shows "HOLD" floating above held dice)
   ============================================================ */
.die-status-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 14;
}

/* ============================================================
   v3.0.8 — Inline toast for when an action is blocked
   ============================================================ */
.action-block-toast {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%) translateY(8px);
  padding: 9px 16px;
  background: rgba(140, 36, 24, .92);
  border: 1px solid rgba(255, 130, 100, .5);
  color: #ffd0c4;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease-spring);
}
.action-block-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* ============================================================
   v3.0.9 — IMMERSIVE PAGE, BOOT CURTAIN, MISC FIXES
   ============================================================ */

/* Immersive mode hides the site chrome and removes container constraints */
body.immersive-page {
  margin: 0;
}
body.immersive-page main#main {
  margin: 0; padding: 0; max-width: none;
}
body.immersive-page .game-shell {
  height: 100vh; height: 100dvh;
  max-height: 100vh; max-height: 100dvh;
  border-radius: 0;
}

/* ============================================================
   v3.0.9 — Loading curtain
   ============================================================ */
.boot-curtain {
  position: fixed; inset: 0;
  z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1c150f 0%, #050302 75%);
  transition: opacity .55s var(--ease-out), visibility .55s var(--ease-out);
}
.boot-curtain.gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.boot-inner {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  text-align: center;
  animation: bootFadeIn .6s var(--ease-out);
}
@keyframes bootFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.boot-brand {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; letter-spacing: .25em;
  color: var(--ink-soft);
  text-transform: lowercase;
  opacity: .8;
}
.boot-brand .brand-word {
  font-family: var(--serif); font-style: italic;
  font-size: 18px; letter-spacing: 0;
  color: var(--gold-hi);
}
.boot-brand .brand-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--gold);
  display: inline-block;
}
.boot-brand .brand-product {
  font-size: 12px;
  letter-spacing: .35em;
  text-transform: uppercase;
}
.boot-die-stack {
  display: flex; gap: 10px;
  margin: 4px 0;
  font-size: 38px;
  color: var(--gold-hi);
  text-shadow: 0 8px 20px rgba(0,0,0,.6);
}
.boot-die {
  display: inline-block;
  animation: bootDieRoll 1.4s ease-in-out infinite alternate;
}
.boot-die-1 { animation-delay: 0s; }
.boot-die-2 { animation-delay: 0.1s; }
.boot-die-3 { animation-delay: 0.2s; }
.boot-die-4 { animation-delay: 0.3s; }
.boot-die-5 { animation-delay: 0.4s; }
@keyframes bootDieRoll {
  0%   { transform: translateY(0)    rotate(0); }
  50%  { transform: translateY(-12px) rotate(120deg); }
  100% { transform: translateY(0)    rotate(360deg); }
}
.boot-title {
  font-family: var(--serif); font-style: italic;
  font-size: 54px; font-weight: 600;
  color: var(--gold-hi);
  text-shadow: 0 6px 28px rgba(247,217,122,.3);
  line-height: 1;
}
.boot-sub {
  font-size: 11px; letter-spacing: .35em; text-transform: uppercase;
  color: var(--ink-soft);
  min-height: 16px;
}
.boot-progress {
  width: 220px; height: 3px;
  background: rgba(214,176,107,.15);
  border-radius: 2px;
  overflow: hidden;
}
.boot-progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #c8923e, #f7d97a);
  transition: width .3s linear;
}

/* ============================================================
   v3.0.9 — Live in-game leaderboard rail (multiplayer)
   ============================================================ */
.live-board {
  position: absolute;
  top: 56px; left: 14px;
  z-index: 11;
  display: none;
  flex-direction: column; gap: 4px;
  padding: 8px 10px;
  background: rgba(10, 7, 5, .82);
  border: 1px solid rgba(214,176,107,.18);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  font-family: var(--sans);
  min-width: 150px;
  max-width: 200px;
}
.live-board.on { display: flex; }
.live-board-head {
  font-size: 9px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-dim);
  padding-bottom: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(214,176,107,.1);
}
.live-row {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 6px; align-items: center;
  padding: 3px 4px;
  border-radius: 6px;
  font-size: 11px;
  transition: background .2s;
}
.live-row.current { background: rgba(214,176,107,.12); }
/* Turn label in the live board — make whose-turn unmistakable */
.live-turn {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase;
  padding: 5px 8px; margin: 4px 0 6px;
  border-radius: 7px; text-align: center;
}
.live-turn.you {
  background: linear-gradient(135deg, rgba(120,200,120,.25), rgba(80,180,100,.15));
  color: #b8f0c0;
  border: 1px solid rgba(120,200,120,.45);
  animation: live-turn-pulse 1.6s ease-in-out infinite;
}
.live-turn.them {
  background: rgba(255,255,255,.04);
  color: var(--ink-dim);
  border: 1px solid rgba(214,176,107,.12);
}
@keyframes live-turn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(120,200,120,0); }
  50%      { box-shadow: 0 0 0 3px rgba(120,200,120,.18), 0 0 14px rgba(120,200,120,.25); }
}
/* The active player's row gets a moving accent bar */
.live-row.current {
  border-left: 3px solid var(--c, #d6b06b);
  animation: live-row-glow 1.6s ease-in-out infinite;
}
@keyframes live-row-glow {
  0%, 100% { background: rgba(214,176,107,.10); }
  50%      { background: rgba(214,176,107,.20); }
}
.live-row .lr-pip {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--c, var(--gold));
}
.live-row .lr-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}
.live-row .lr-name.me { color: var(--gold-hi); font-weight: 600; }
.live-row .lr-score {
  font-family: var(--serif);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
  color: var(--gold-hi);
}

/* On phones: keep the live board but smaller, anchor at the top under the topbar */
@media (max-width: 680px) {
  .live-board {
    top: 6px;
    left: 6px;
    font-size: 10px;
    min-width: 110px;
    max-width: 150px;
    padding: 6px 8px;
  }
  .live-row { font-size: 10px; padding: 2px 3px; }
  .live-row .lr-score { font-size: 11px; }
}



/* ============================================================
   v3.2.0 — CLEAN FINAL LAYER (rewrites the old v3.0.5–v3.1.2 fix stack)
   ------------------------------------------------------------
   Everything below replaces the layered bug-fix sections that had grown
   into 12+ contradictory rules per concern. This block owns:
     1. The `[hidden]` attribute (highest priority).
     2. The "now-playing" track slot (no reflow on audio toggle).
     3. The More-menu pop (escapes parent stacking contexts via JS-
        teleport to body + position:fixed — see five-dice-v301.js).
     4. Modal scrolling (cards don't clip overflow anymore).
     5. The mobile layout (one grid: topbar / stage / side / actions),
        no fixed-position drawers, no `transform` collisions.
   ============================================================ */

/* 1. [hidden] attribute must always beat any display:* rule.
      This is HTML's contract — restore it. */
[hidden] { display: none !important; }

/* 2. NOW-PLAYING TRACK SLOT
      Reserve a fixed-width slot in the topbar so toggling audio
      NEVER reflows the row. JS only writes text into the inner span;
      it never touches the wrapper's `hidden` attribute anymore. */
.topbar-actions .now-playing {
  display: inline-flex;
  align-items: center;
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  flex: 0 0 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-style: italic;
  color: var(--ink-dim);
  opacity: .7;
  padding: 0;
  margin: 0;
  line-height: 1.2;
}
.topbar-actions .now-playing #nowPlayingTrack {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
/* Below 900px, the slot disappears entirely — every pixel matters on phones
   and tablets, and the audio button alone communicates state. */
@media (max-width: 900px) {
  .topbar-actions .now-playing,
  .topbar-divider { display: none !important; }
}

/* 3. MORE-MENU POP
      The JS in setupMoreMenu() teleports #menuPop to <body> while open
      and assigns position:fixed inline. These rules style the pop in BOTH
      its original DOM location (inside .topbar-menu, when closed/hidden)
      AND when teleported to body. */
.topbar-menu { position: relative; display: inline-flex; }
.menu-summary {
  color: var(--ink);
  font-weight: 600;
  font-size: 18px;
  line-height: 1;
  padding: 6px 12px;
  min-width: 38px;
  letter-spacing: 0;
}
.menu-summary::-webkit-details-marker { display: none; }
.topbar-menu.open .menu-summary {
  background: rgba(214,176,107,.15);
  border-color: rgba(214,176,107,.45);
  color: var(--gold-hi);
}
.menu-pop {
  z-index: 10000;
  min-width: 240px;
  padding: 8px;
  background: linear-gradient(180deg, #1d1410, #100a07);
  border: 1px solid rgba(214,176,107,.3);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: menuPop .18s var(--ease-spring);
}
.menu-pop[hidden] { display: none !important; }
.menu-pop .menu-item { display: flex; }
.menu-pop .menu-item[hidden] { display: none !important; }

/* 4. MODALS
      Old rule: `.modal .card { overflow: hidden }` — that's what cut the
      account/profile/cosmetics menus. The card itself owns scrolling, and
      the close-x sits in a sticky strip at the top so it's always reachable
      no matter how far the user scrolls. */
.modal .card {
  overflow-y: auto;
  overflow-x: hidden;
  padding-top: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.modal .card::-webkit-scrollbar { width: 8px; }
.modal .card::-webkit-scrollbar-track { background: transparent; }
.modal .card::-webkit-scrollbar-thumb {
  background: rgba(214,176,107,.2);
  border-radius: 4px;
}
/* The close-x is the FIRST child of every card and is absolutely positioned
   to the card. Because the card itself scrolls, we anchor it sticky-style
   by giving it `position: sticky` so it stays pinned to the card's top edge
   as the user scrolls down. align-self pushes it to the right. */
.modal .card > .close-x {
  position: sticky;
  top: 10px;
  align-self: flex-end;
  margin: 10px 10px -34px auto;   /* negative bottom margin: don't push kicker down */
  z-index: 5;
  flex-shrink: 0;
}
.modal .card > .kicker { padding: 14px 30px 0; }
.modal .card > h2      { padding: 4px 30px 18px; }
.modal .card button { width: auto; }
.modal .card button.block,
.modal .card .btn.block { width: 100%; }
#modal .card button#modalNew { width: 100%; }

/* Account card sizing + ellipsis on long names/emails */
.account-card { max-width: 480px; }
.account-card .pf-identity   { padding: 14px 16px; }
.account-card .pf-id-info    { min-width: 0; flex: 1; }
.account-card .pf-id-name,
.account-card .pf-id-meta {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
@media (max-width: 520px) {
  .account-card  { max-width: 100%; }
  .quick-tiles   { grid-template-columns: repeat(2, 1fr); }
}

/* 5. MOBILE LAYOUT (one block, one grid, no drawer)
      Design goals (after v3.2.0 user feedback):
        • Topbar buttons icon-only so all five fit + still tappable
        • Scorecard rows readable single-line (rule text hidden, name only)
        • Summary shows TOTAL plus Upper/Bonus/Rows so the score is visible
        • Side panel gets a touch more vertical room since the rows are taller */
@media (max-width: 680px) {
  .game-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(34vh, 1fr) minmax(220px, 38vh) auto;
    grid-template-areas:
      "topbar"
      "stage"
      "side"
      "actions";
    gap: 6px;
    padding: 6px;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
  }

  /* TOPBAR — single non-wrapping row */
  .game-shell .topbar {
    grid-area: topbar;
    flex-wrap: nowrap;
    align-items: center;
    padding: 6px 8px;
    gap: 6px;
    min-height: 0;
    border-radius: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .game-shell .topbar::-webkit-scrollbar { display: none; }
  .game-shell .title { display: none; }

  /* Stats: keep all three (Round / Rolls / Total) — compact column tiles */
  .game-shell .stats {
    flex: 1 1 auto;
    gap: 8px;
    margin-right: 4px;
    justify-content: flex-start;
  }
  .game-shell .stat {
    flex-direction: column;
    align-items: center;
    padding: 0;
    min-width: 0;
  }
  .game-shell .stat label {
    font-size: 7.5px;
    letter-spacing: .12em;
    margin: 0 0 1px;
  }
  .game-shell .stat .v { font-size: 14px; line-height: 1.1; }
  .game-shell .stat.stat-room { display: none; }

  /* TOPBAR ACTIONS — ALL icon-only square buttons. No text labels on phone.
     The user identifies each by its emoji/glyph. Tap → opens the modal. */
  .topbar-actions {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 3px;
    display: flex;
    align-items: center;
  }
  /* Every topbar icon-button is a uniform 32×32 square */
  .topbar-actions > .icon-btn,
  .topbar-actions .menu-summary {
    padding: 0;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    border-radius: 8px;
    font-size: 14px;
    letter-spacing: 0;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Important: kill text-content readout for Account/Room/Profile labels —
       we replace each with a CSS-injected glyph below. */
  }
  /* Audio button: keep the ♪ glyph, slightly larger */
  .topbar-actions .icon-btn.audio-btn { font-size: 15px; }
  /* Account button → person icon */
  .topbar-actions .icon-btn#accountBtn {
    font-size: 0;                       /* hide the "Account" text */
    color: var(--ink-soft);
  }
  .topbar-actions .icon-btn#accountBtn::before {
    content: "👤";
    font-size: 14px;
    line-height: 1;
  }
  /* Room button → group icon (keep the badge visible) */
  .topbar-actions .icon-btn#roomBtn {
    font-size: 0;
    color: var(--ink-soft);
    gap: 0;
  }
  .topbar-actions .icon-btn#roomBtn .room-btn-label { display: none; }
  .topbar-actions .icon-btn#roomBtn::before {
    content: "👥";
    font-size: 14px;
    line-height: 1;
  }
  .topbar-actions .icon-btn#roomBtn .room-btn-badge {
    position: absolute;
    top: -2px; right: -2px;
    width: 14px; height: 14px;
    font-size: 9px;
    margin: 0;
    padding: 0;
    line-height: 14px;
    border-radius: 50%;
  }
  .topbar-actions .icon-btn#roomBtn { position: relative; }
  /* Profile button → show ONLY the avatar (no Profile text) */
  .topbar-actions .icon-btn#profileBtn,
  .topbar-actions .icon-btn.pill-btn {
    padding: 0;
    gap: 0;
  }
  .topbar-actions .icon-btn.pill-btn .pb-label { display: none; }
  .topbar-actions .icon-btn.pill-btn .pb-avatar {
    width: 24px; height: 24px;
    font-size: 13px;
    border-width: 1.5px;
  }
  /* More menu trigger */
  .topbar-actions .menu-summary { font-size: 17px; }
  /* Premium pill ✦ — same square footprint when it's shown */
  .premium-pill { width: 24px; height: 24px; font-size: 12px; }
  /* Divider (already hidden at <900px by an earlier rule) */
  .topbar-divider { display: none; }

  /* STAGE */
  .game-shell .stage {
    grid-area: stage;
    min-height: 0;
    position: relative;
    border-radius: 12px;
  }
  .stage-hud-top { top: 6px; left: 6px; right: 6px; }
  .roll-dots     { padding: 4px 8px; gap: 5px; }
  .roll-dots .d  { width: 6px; height: 6px; }
  .audience-indicator { padding: 4px 8px; font-size: 8.5px; }
  .audience-indicator .aud-meter { width: 18px; height: 11px; gap: 1px; }
  .audience-indicator .aud-meter i { width: 2px; }
  .hint     { font-size: 9px; padding: 5px 9px; bottom: 6px; left: 6px; max-width: calc(100% - 12px); }
  .announce { font-size: 13px; padding: 6px 14px; top: 6px; }
  .charge   { right: 6px; bottom: 6px; width: 80px; }

  /* SCORECARD — real grid row, NOT a fixed/transformed drawer */
  .game-shell .side {
    grid-area: side;
    position: relative;
    inset: auto;
    transform: none;
    width: 100%;
    max-width: none;
    height: 100%;
    margin: 0;
    z-index: auto;
    box-shadow: none;
    border-radius: 12px;
    border: 1px solid rgba(214,176,107,.16);
    background: linear-gradient(180deg, #15100b, #08060a);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .game-shell.drawer-open .side,
  .game-shell.drawer-peek .side,
  .game-shell.sheet-open .side {
    transform: none;
    box-shadow: none;
  }
  .drawer-handle,
  .drawer-close { display: none; }

  .game-shell .side .side-head {
    flex: 0 0 auto;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 0 0 6px;
    padding: 0;
  }
  .game-shell .side .side-head .kicker {
    font-size: 8.5px;
    letter-spacing: .22em;
    margin: 0;
    padding: 0;
  }
  .game-shell .side .side-head h2 {
    font-size: 15px;
    margin: 0;
    padding: 0;
    border: 0;
  }

  /* Scrollable score list — taller, single-line readable rows. We hide the
     long `.rule` description text on phones; the `.name` ("Three of a kind",
     "Full House", etc) is descriptive enough by itself. This eliminates the
     overlap that occurred when 13 stacked two-line labels tried to fit into
     a small viewport. */
  .game-shell .side .scorelist {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;                     /* let rows breathe wider */
    padding: 0 4px;
    gap: 3px;
    display: flex;
    flex-direction: column;
  }
  .game-shell .side .scorelist .row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 7px 11px;
    min-height: 30px;                   /* explicit min-height prevents collapse */
    border-radius: 7px;
    background: rgba(255,255,255,.025);
    border: 1px solid rgba(214,176,107,.08);
    transition: background .15s var(--ease-out);
  }
  .game-shell .side .scorelist .row.upper-divider {
    margin-top: 6px;
    border-top: 1px dashed rgba(214,176,107,.18);
    padding-top: 8px;
  }
  /* The .label is the first grid cell. Force-collapse to a single line: only
     the name is shown, the rule is hidden. */
  .game-shell .side .scorelist .row .label {
    display: block;
    min-width: 0;
    overflow: hidden;
  }
  .game-shell .side .scorelist .row .name {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .game-shell .side .scorelist .row .rule {
    display: none;                      /* hide the long rule text on phone */
  }
  .game-shell .side .scorelist .row .val {
    font-size: 16px;
    font-weight: 600;
    min-width: 28px;
    text-align: right;
    line-height: 1;
  }

  /* Summary at the bottom of the side panel: now FOUR tiles
     (Upper / Bonus / Rows / Total). The TOTAL tile gets gold styling so it
     reads as the headline. */
  .game-shell .side .summary {
    order: 99;
    flex: 0 0 auto;
    margin: 6px 0 0;
    padding: 7px 8px;
    gap: 4px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: rgba(0,0,0,.3);
    border-radius: 8px;
    border: 1px solid rgba(214,176,107,.08);
  }
  .game-shell .side .summary > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 0;
  }
  .game-shell .side .summary span {
    font-size: 7.5px;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--ink-dim);
    line-height: 1;
  }
  .game-shell .side .summary strong {
    font-size: 13px;
    font-family: var(--serif);
    font-weight: 600;
    color: var(--ink);
    line-height: 1;
  }
  .game-shell .side .summary .summary-total strong {
    color: var(--gold-hi);
    font-size: 15px;
  }
  .game-shell .side .summary .summary-total span {
    color: var(--gold);
  }

  /* ACTION DOCK */
  .game-shell .actions {
    grid-area: actions;
    padding: 5px;
    padding-bottom: calc(5px + env(safe-area-inset-bottom, 0));
    gap: 4px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
  }
  .game-shell .actions .throw-btn {
    padding: 10px 12px;
    font-size: 12px;
    min-height: 38px;
    letter-spacing: .14em;
    flex-direction: row;
    gap: 6px;
    width: 100%;
  }
  .game-shell .actions .throw-btn .btn-ico { font-size: 14px; }
  .game-shell .actions .throw-btn .btn-sub { display: none; }
  .game-shell .actions .actions-secondary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
  }
  .game-shell .actions .actions-secondary .btn {
    padding: 6px 4px;
    font-size: 9px;
    letter-spacing: .04em;
    min-height: 30px;
  }
  .game-shell .actions .actions-secondary .btn .btn-ico { font-size: 11px; }

  /* MODALS on phone: bottom sheet */
  .modal { padding: 0; align-items: flex-end; }
  .modal .card {
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
    max-height: 92dvh;
    max-width: none;
    width: 100%;
    animation: sheetUp .3s var(--ease-out);
  }
  @keyframes sheetUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .modal .card > .kicker { padding: 18px 22px 0; }
  .modal .card > h2      { padding: 4px 22px 14px; font-size: 22px; margin-bottom: 14px; }
  .modal .card > .close-x { margin-right: 14px; top: 14px; }

  /* Chat panel above safe area */
  .chat-panel { right: 8px; bottom: calc(72px + env(safe-area-inset-bottom, 0)); }
  .chat-toggle { width: 44px; height: 44px; font-size: 20px; }
  .chat-inner { width: calc(100vw - 16px); max-height: 60vh; }
  .chat-messages { max-height: 38vh; height: auto; }

  /* Live multiplayer board */
  .live-board {
    top: 4px; left: 4px;
    font-size: 9px;
    min-width: 0;
    max-width: 130px;
    padding: 5px 7px;
  }
  .live-row { font-size: 9.5px; padding: 2px 3px; }
  .live-row .lr-score { font-size: 11px; }
}

/* 6. LANDSCAPE PHONE */
@media (max-height: 480px) and (orientation: landscape) {
  .game-shell {
    grid-template-columns: 1fr 240px;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "topbar  topbar"
      "stage   side"
      "actions side";
    gap: 5px;
    padding: 5px;
  }
  .game-shell .topbar { min-height: 36px; padding: 4px 10px; }
  .game-shell .title h1 { font-size: 18px; }
  .game-shell .title .sub { display: none; }
  .game-shell .stat .v { font-size: 13px; }
  .game-shell .side { border-radius: 10px; }
  .game-shell .actions { padding: 4px; }
  .throw-btn { min-height: 32px; padding: 6px 8px; font-size: 10px; }
  .actions-secondary .btn { padding: 5px 3px; font-size: 8px; min-height: 28px; }
}

/* 7. TABLET portrait (681–900px) */
@media (min-width: 681px) and (max-width: 900px) {
  .game-shell { grid-template-columns: 1fr 320px; gap: 10px; }
  .game-shell .title .sub-default { display: none; }
  .game-shell .stats { gap: 14px; }
  .game-shell .actions { grid-template-columns: 1fr; }
  .game-shell .side { padding: 14px 12px; }
  .scorelist .row .val { font-size: 18px; }
  .drawer-handle,
  .drawer-close { display: none; }
}

/* 8. DESKTOP — hide mobile drawer affordances */
@media (min-width: 901px) {
  .drawer-handle,
  .drawer-close { display: none; }
}

/* 9. Drag-handle pseudo only on phone (defined inside the 680px block above);
      explicitly forbid it on desktop. */
@media (min-width: 681px) {
  .modal .card::before { display: none !important; content: none !important; }
}

/* 10. Boot curtain transition (smooth fade between rapid reloads) */
.boot-curtain { transition: opacity .55s var(--ease-out), visibility .55s; }

/* ============================================================
   FRIENDS TABS + NOTIFICATION BADGE  (added in 3.2.2 → 3.3.0)
   ============================================================ */
.fr-badge {
  display: inline-block; min-width: 18px; height: 18px;
  padding: 0 6px; margin-left: 8px;
  background: linear-gradient(135deg, #ff5577, #c8265f);
  color: #fff; font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center; border-radius: 9px;
  box-shadow: 0 0 0 2px rgba(0,0,0,.4), 0 2px 8px rgba(200,38,95,.5);
  animation: fr-badge-pulse 2s ease-in-out infinite;
}
@keyframes fr-badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.fr-tabs {
  display: flex; gap: 4px; margin: 16px 0 18px;
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(214,176,107,.12);
  border-radius: 12px; padding: 4px;
}
.fr-tab {
  flex: 1; background: transparent; border: 0;
  color: var(--ink-dim); padding: 10px 12px;
  font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  font-weight: 500; cursor: pointer; border-radius: 8px;
  font-family: var(--sans); transition: background .2s, color .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.fr-tab.active { background: rgba(214,176,107,.18); color: var(--gold-hi); }
.fr-tab:hover:not(.active) { color: var(--ink); }
.fr-tab-count {
  display: inline-block; min-width: 16px; padding: 0 5px;
  background: rgba(255,85,119,.85); color: #fff;
  font-size: 10px; line-height: 16px; border-radius: 8px; font-weight: 700;
}

/* ============================================================
   DM (direct messages) UI
   ============================================================ */
.dm-shell { display: flex; flex-direction: column; min-height: 360px; }
.dm-threads { display: flex; flex-direction: column; gap: 6px; }
.dm-thread-row {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 10px;
  align-items: center; padding: 10px 12px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(214,176,107,.08);
  border-radius: 10px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.dm-thread-row:hover { background: rgba(255,255,255,.06); border-color: rgba(214,176,107,.2); }
.dm-thread-row.has-unread { border-color: rgba(255,85,119,.4); background: rgba(255,85,119,.04); }
.dm-thread-row .dm-av {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0,0,0,.5);
  border: 1.5px solid var(--c, var(--gold));
  font-size: 15px;
}
.dm-thread-body { min-width: 0; }
.dm-thread-name { font-size: 13px; color: var(--ink); font-weight: 500; }
.dm-thread-snip {
  font-size: 11px; color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.dm-thread-meta { font-size: 10px; color: var(--ink-dim); letter-spacing: .04em; text-align: right; }
.dm-thread-unread {
  display: inline-block; min-width: 18px; padding: 0 6px;
  background: linear-gradient(135deg, #ff5577, #c8265f); color: #fff;
  font-size: 10px; line-height: 18px; border-radius: 9px;
  font-weight: 700; margin-top: 4px;
}

.dm-chat { display: flex; flex-direction: column; min-height: 360px; height: 60vh; max-height: 540px; }
.dm-chat-head {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid rgba(214,176,107,.15);
}
.dm-back {
  background: transparent; border: 1px solid rgba(214,176,107,.25);
  color: var(--gold); padding: 5px 10px; border-radius: 7px;
  font-size: 11px; cursor: pointer; font-family: var(--sans);
}
.dm-back:hover { background: rgba(214,176,107,.1); }
.dm-chat-who {
  font-family: var(--serif); font-style: italic; font-size: 18px;
  color: var(--gold-hi); flex: 1;
}
.dm-messages {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
  padding: 4px 4px 12px;
}
.dm-msg {
  max-width: 78%; padding: 8px 12px; border-radius: 14px;
  font-size: 13px; line-height: 1.45;
  word-wrap: break-word; overflow-wrap: anywhere;
  animation: dm-msg-in .25s var(--ease-out);
}
@keyframes dm-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dm-msg.them {
  background: rgba(214,176,107,.12); color: var(--ink);
  align-self: flex-start; border-bottom-left-radius: 4px;
  border: 1px solid rgba(214,176,107,.18);
}
.dm-msg.me {
  background: linear-gradient(135deg, rgba(247,217,122,.18), rgba(214,176,107,.22));
  color: var(--ink); align-self: flex-end;
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(214,176,107,.35);
}
.dm-msg-time { font-size: 9px; opacity: .55; margin-top: 3px; letter-spacing: .04em; }
.dm-compose {
  display: flex; gap: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(214,176,107,.15);
}
.dm-compose input {
  flex: 1; background: rgba(0,0,0,.4);
  border: 1px solid rgba(214,176,107,.2); border-radius: 8px;
  padding: 10px 12px; color: var(--ink); font-family: var(--sans);
}
.dm-compose input:focus { outline: none; border-color: var(--gold); }
.dm-day-divider {
  text-align: center; font-size: 10px; letter-spacing: .14em;
  color: var(--ink-dim); text-transform: uppercase; margin: 8px 0 2px;
  position: relative;
}
.dm-day-divider::before, .dm-day-divider::after {
  content: ""; position: absolute; top: 50%;
  width: 30%; height: 1px; background: rgba(214,176,107,.15);
}
.dm-day-divider::before { left: 0; }
.dm-day-divider::after  { right: 0; }

/* ============================================================
   ANIMATION POLISH (added 3.3.0)
   Reusable beats: turn pulse, score-pop, Yahtzee burst, opponent reaction
   ============================================================ */

/* "Your turn" pulse — apply to .your-turn anywhere */
.your-turn {
  animation: turn-pulse 1.8s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(247,217,122,0);
}
@keyframes turn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(247,217,122,0); }
  50%      { box-shadow: 0 0 0 6px rgba(247,217,122,.15), 0 0 18px rgba(247,217,122,.25); }
}

/* Score popup — element fades up and out */
.score-pop {
  position: absolute; pointer-events: none;
  font-family: var(--serif); font-style: italic;
  color: var(--gold-hi); font-size: 28px; font-weight: 600;
  text-shadow: 0 2px 16px rgba(247,217,122,.5);
  animation: score-pop 1.4s var(--ease-out) forwards;
  z-index: 10;
}
@keyframes score-pop {
  0%   { transform: translateY(0)   scale(.8); opacity: 0; }
  20%  { transform: translateY(-12px) scale(1.1); opacity: 1; }
  100% { transform: translateY(-60px) scale(1);   opacity: 0; }
}

/* Yahtzee golden burst — overlay element */
.yahtzee-burst {
  position: fixed; inset: 0; pointer-events: none;
  display: grid; place-items: center;
  z-index: 9999;
  animation: yahtzee-bg 1.6s var(--ease-out) forwards;
}
.yahtzee-burst .yahtzee-label {
  font-family: var(--serif); font-style: italic; font-weight: 700;
  font-size: clamp(48px, 12vw, 120px);
  color: transparent;
  background: linear-gradient(135deg, #ffe082, #d6b06b 40%, #fff4c8 60%, #d6b06b 80%);
  -webkit-background-clip: text; background-clip: text;
  text-shadow: 0 4px 40px rgba(247,217,122,.6);
  letter-spacing: .04em;
  animation: yahtzee-zoom 1.6s var(--ease-out) forwards;
}
@keyframes yahtzee-bg {
  0%   { background: radial-gradient(circle at center, rgba(247,217,122,0) 0%, rgba(0,0,0,0) 60%); }
  30%  { background: radial-gradient(circle at center, rgba(247,217,122,.18) 0%, rgba(0,0,0,0) 60%); }
  100% { background: radial-gradient(circle at center, rgba(247,217,122,0) 0%, rgba(0,0,0,0) 60%); }
}
@keyframes yahtzee-zoom {
  0%   { transform: scale(.6) rotate(-4deg); opacity: 0; }
  18%  { transform: scale(1.1) rotate(2deg); opacity: 1; }
  35%  { transform: scale(1)   rotate(0);    opacity: 1; }
  85%  { transform: scale(1)   rotate(0);    opacity: 1; }
  100% { transform: scale(1.05) rotate(0);   opacity: 0; }
}

/* Opponent reaction emoji bubble (fades up from avatar) */
.opp-react {
  position: absolute; pointer-events: none;
  font-size: 28px; line-height: 1;
  animation: opp-react 1.2s var(--ease-out) forwards;
  z-index: 8;
}
@keyframes opp-react {
  0%   { transform: translateY(0)   scale(.6); opacity: 0; }
  18%  { transform: translateY(-18px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-56px) scale(1);   opacity: 0; }
}

/* Scorecard cell flip-in on score */
.score-cell-flip { animation: cell-flip .55s var(--ease-out); }
@keyframes cell-flip {
  0%   { transform: rotateX(0);   background: transparent; }
  40%  { transform: rotateX(90deg); background: rgba(247,217,122,.25); }
  100% { transform: rotateX(0);    background: transparent; }
}

/* ============================================================
   TABLETOP THEMES (added 3.3.0)
   3 themes total: emerald (default), midnight (mahogany+candle), parchment (warm cream).
   Apply via [data-table-theme="midnight"] etc. on <html>.
   ============================================================ */

/* Default emerald is unchanged. */

/* Midnight: dark mahogany surface, warm amber rim light, like a backroom card table */
html[data-table-theme="midnight"] {
  --table-felt-1: #1a0c08;
  --table-felt-2: #2c1410;
  --table-rim:    #d6863a;
  --table-glow:   rgba(247,180,80,.18);
}
html[data-table-theme="midnight"] body {
  background:
    radial-gradient(ellipse at top, #2a1610 0%, #0e0604 60%, #050202 100%);
}
html[data-table-theme="midnight"] .table-surface,
html[data-table-theme="midnight"] .play-area,
html[data-table-theme="midnight"] .scene-floor {
  background:
    radial-gradient(circle at 30% 20%, rgba(247,180,80,.08) 0%, transparent 50%),
    linear-gradient(135deg, #2c1410, #1a0c08 70%);
}

/* Parchment: warm cream felt, charcoal rim, soft daylight feel */
html[data-table-theme="parchment"] {
  --table-felt-1: #d8c89c;
  --table-felt-2: #c4b078;
  --table-rim:    #5a3a20;
  --table-glow:   rgba(90,58,32,.15);
  --ink: #2a1a0c;
  --ink-dim: rgba(42,26,12,.6);
}
html[data-table-theme="parchment"] body {
  background:
    radial-gradient(ellipse at top, #ece0bd 0%, #d6c597 60%, #b89a5e 100%);
  color: var(--ink);
}
html[data-table-theme="parchment"] .table-surface,
html[data-table-theme="parchment"] .play-area,
html[data-table-theme="parchment"] .scene-floor {
  background:
    radial-gradient(circle at 30% 20%, rgba(255,250,220,.4) 0%, transparent 50%),
    linear-gradient(135deg, #d8c89c, #c4b078 70%);
}

/* Theme picker in settings (used by setTheme select) */
.theme-picker {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 6px;
}
.theme-swatch {
  cursor: pointer;
  padding: 10px; border-radius: 10px;
  border: 2px solid rgba(214,176,107,.18);
  background: rgba(0,0,0,.3);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: border-color .2s;
}
.theme-swatch.active { border-color: var(--gold); }
.theme-swatch .theme-preview {
  width: 100%; height: 36px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.05);
}
.theme-swatch[data-theme="emerald"] .theme-preview {
  background: radial-gradient(circle at 30% 20%, rgba(180,140,80,.18) 0%, transparent 60%), linear-gradient(135deg, #0d3a30, #0b2b22 70%);
}
.theme-swatch[data-theme="midnight"] .theme-preview {
  background: radial-gradient(circle at 30% 20%, rgba(247,180,80,.18) 0%, transparent 60%), linear-gradient(135deg, #2c1410, #1a0c08 70%);
}
.theme-swatch[data-theme="parchment"] .theme-preview {
  background: radial-gradient(circle at 30% 20%, rgba(255,250,220,.5) 0%, transparent 60%), linear-gradient(135deg, #d8c89c, #c4b078 70%);
}
.theme-swatch .theme-label {
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-dim);
}
.theme-swatch.active .theme-label { color: var(--gold-hi); }

/* ============================================================
   AMBIENT ENVIRONMENT (added 3.3.0+)
   Layered scene behind the table:
     1. Deep radial gradient on body (theme-aware)
     2. Floating particle motes (8 elements, CSS keyframe drift)
     3. Soft rim halo around the stage card
     4. Theme-aware accent colors

   Inserted into the DOM via tiny JS bootstrap (see five-dice-v301.js).
   Pure CSS animation — no per-frame JS cost.
   ============================================================ */

/* The body needs a layered background that doesn't fight the existing themes */
html[data-immersive] body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(247,217,122,.10) 0%, transparent 60%),
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(0,0,0,.55) 0%, transparent 70%);
  transition: background 1s ease;
}
/* Make sure the game-shell sits above the ambient layer */
html[data-immersive] .game-shell { position: relative; z-index: 1; }
html[data-immersive] .modal { z-index: 200; }

/* Theme-specific atmospheric color shifts */
html[data-immersive][data-table-theme="midnight"] body::before {
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(247,180,80,.16) 0%, transparent 60%),
    radial-gradient(ellipse 100% 85% at 50% 100%, rgba(0,0,0,.75) 0%, transparent 70%),
    radial-gradient(ellipse 30% 30% at 12% 80%, rgba(247,180,80,.08) 0%, transparent 70%),
    radial-gradient(ellipse 30% 30% at 88% 80%, rgba(247,180,80,.08) 0%, transparent 70%);
}
html[data-immersive][data-table-theme="parchment"] body::before {
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(255,240,200,.35) 0%, transparent 60%),
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(180,140,80,.18) 0%, transparent 70%);
}

/* Floating motes — 8 particle layer */
.ambient-motes {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.ambient-mote {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(247,217,122,.7) 0%, rgba(247,217,122,0) 70%);
  filter: blur(.5px);
  opacity: 0;
  animation: mote-drift 22s linear infinite;
}
.ambient-mote:nth-child(1) { left:  8%; width: 3px; height: 3px; animation-duration: 28s; animation-delay:  0s; }
.ambient-mote:nth-child(2) { left: 22%; width: 5px; height: 5px; animation-duration: 24s; animation-delay: -5s; }
.ambient-mote:nth-child(3) { left: 38%; width: 2px; height: 2px; animation-duration: 32s; animation-delay: -2s; }
.ambient-mote:nth-child(4) { left: 50%; width: 4px; height: 4px; animation-duration: 26s; animation-delay: -9s; }
.ambient-mote:nth-child(5) { left: 64%; width: 3px; height: 3px; animation-duration: 30s; animation-delay: -14s; }
.ambient-mote:nth-child(6) { left: 76%; width: 5px; height: 5px; animation-duration: 23s; animation-delay: -7s; }
.ambient-mote:nth-child(7) { left: 88%; width: 3px; height: 3px; animation-duration: 27s; animation-delay: -18s; }
.ambient-mote:nth-child(8) { left: 95%; width: 2px; height: 2px; animation-duration: 34s; animation-delay: -22s; }

@keyframes mote-drift {
  0%   { transform: translateY(105vh) translateX(0) scale(.6); opacity: 0; }
  8%   { opacity: .6; }
  50%  { transform: translateY(50vh) translateX(20px) scale(1); opacity: .9; }
  92%  { opacity: .4; }
  100% { transform: translateY(-10vh) translateX(-12px) scale(.7); opacity: 0; }
}

/* Theme-specific mote colors */
html[data-table-theme="emerald"] .ambient-mote {
  background: radial-gradient(circle, rgba(120,255,180,.6) 0%, rgba(120,255,180,0) 70%);
}
html[data-table-theme="midnight"] .ambient-mote {
  /* Ember orange — like sparks rising from a fireplace */
  background: radial-gradient(circle, rgba(255,160,60,.8) 0%, rgba(255,160,60,0) 70%);
  filter: blur(.3px);
}
html[data-table-theme="parchment"] .ambient-mote {
  /* Dust motes in daylight */
  background: radial-gradient(circle, rgba(255,240,200,.65) 0%, rgba(255,240,200,0) 70%);
  filter: blur(.8px);
}

/* Soft pulsing rim halo on the stage card */
.game-shell .stage {
  position: relative;
}
.game-shell .stage::after {
  content: "";
  position: absolute; inset: -2px;
  pointer-events: none;
  border-radius: 22px;
  box-shadow: 0 0 0 0 rgba(247,217,122,0);
  animation: stage-halo 7s ease-in-out infinite;
}
@keyframes stage-halo {
  0%, 100% { box-shadow: 0 0 0  0 rgba(247,217,122, 0),    0 0 30px  0px rgba(247,217,122, 0); }
  50%      { box-shadow: 0 0 0  1px rgba(247,217,122,.14), 0 0 45px  4px rgba(247,217,122,.10); }
}
html[data-table-theme="midnight"] .game-shell .stage::after {
  animation-name: stage-halo-midnight;
}
@keyframes stage-halo-midnight {
  0%, 100% { box-shadow: 0 0 0  0 rgba(247,180,80, 0),    0 0 35px  0px rgba(247,180,80, 0); }
  50%      { box-shadow: 0 0 0  1px rgba(247,180,80,.20), 0 0 55px  6px rgba(247,180,80,.14); }
}
html[data-table-theme="parchment"] .game-shell .stage::after {
  animation-name: stage-halo-parchment;
}
@keyframes stage-halo-parchment {
  0%, 100% { box-shadow: 0 0 0  0 rgba(90,58,32, 0),    0 0 35px  0px rgba(90,58,32, 0); }
  50%      { box-shadow: 0 0 0  1px rgba(90,58,32,.12), 0 0 45px  4px rgba(90,58,32, .08); }
}

/* Gentle horizon haze at the bottom of the page */
html[data-immersive] body::after {
  content: "";
  position: fixed; left: 0; right: 0; bottom: 0; height: 30vh;
  z-index: 0; pointer-events: none;
  background:
    linear-gradient(to top,
      rgba(0,0,0,.4) 0%,
      rgba(0,0,0,.15) 30%,
      transparent 100%);
}
html[data-immersive][data-table-theme="parchment"] body::after {
  background:
    linear-gradient(to top,
      rgba(180,140,80,.25) 0%,
      rgba(180,140,80,.08) 30%,
      transparent 100%);
}

/* Respect prefers-reduced-motion: kill drifting particles + halo pulse */
@media (prefers-reduced-motion: reduce) {
  .ambient-mote { animation: none !important; opacity: .3; }
  .game-shell .stage::after { animation: none !important; }
}

/* ============================================================
   PUBLIC ROOMS BROWSE LIST
   ============================================================ */
.public-rooms { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; max-height: 360px; overflow-y: auto; }
.public-room-row {
  display: grid; grid-template-columns: 36px 1fr auto auto; gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(214,176,107,.12);
  border-radius: 11px;
  transition: border-color .15s, background .15s;
}
.public-room-row:hover { background: rgba(255,255,255,.06); border-color: rgba(214,176,107,.28); }
.public-room-row .dm-av {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.55);
  border: 1.5px solid var(--c, var(--gold));
  font-size: 15px;
}
.public-room-row .pr-body { min-width: 0; }
.public-room-row .pr-host { font-size: 13px; color: var(--ink); font-weight: 500; }
.public-room-row .pr-meta { font-size: 11px; color: var(--ink-dim); margin-top: 2px; }
.public-room-row .pr-code {
  font-family: var(--serif); font-style: italic; font-size: 16px;
  color: var(--gold-hi); letter-spacing: .14em;
}
.public-room-row .btn-sm { padding: 6px 12px; font-size: 11px; }

.room-tab-count {
  display: inline-block; min-width: 18px; padding: 0 6px;
  background: rgba(247,217,122,.85); color: #1a0d04;
  font-size: 10px; line-height: 18px; border-radius: 9px;
  font-weight: 700; margin-left: 4px;
}


/* ============================================================
   AMBIENT SCENES (v3.3.2)
   Three layered atmospheric scenes — pure CSS gradients, no SVG art.
   I tried SVG silhouettes; they looked terrible. Gradients honest about
   what they are read better than bad illustrations.
   ============================================================ */

/* Container — sits behind everything, full-viewport, no scroll */
.scene-bg {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.scene-layer {
  position: absolute; inset: 0;
  background-repeat: no-repeat;
}
.scene-far     { z-index: 1; }
.scene-mid     { z-index: 2; }
.scene-near    { z-index: 3; mix-blend-mode: screen; }
.scene-overlay { z-index: 4; pointer-events: none; }

html[data-immersive] .game-shell { position: relative; z-index: 10; }
html[data-immersive] .modal      { z-index: 200; }
html[data-immersive] .menu-pop   { z-index: 60; }

/* ============================================================
   SALON  (emerald theme)
   Real photo (Unsplash, Anastasia Meraki) layered with warm overlays
   ============================================================ */
html[data-table-theme="emerald"] body { background: #0a0806; }
html[data-table-theme="emerald"] .scene-far {
  /* Background photo of a dim library room with chandelier.
     Gradient below acts as a graceful fallback if the photo fails. */
  background-color: #0a0806;
  background-image:
    linear-gradient(to bottom,
      rgba(5,3,2,0.78) 0%,
      rgba(12,8,5,0.55) 35%,
      rgba(20,16,10,0.55) 65%,
      rgba(10,6,3,0.85) 100%),
    url("https://images.unsplash.com/photo-1728506972831-193841eb2961?w=1600&q=70&auto=format&fit=crop");
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}
/* Twin candle pools — soft warm circles on top of the photo */
html[data-table-theme="emerald"] .scene-mid {
  background:
    radial-gradient(circle 260px at 12% 35%, rgba(255,170,80,.18), transparent 65%),
    radial-gradient(circle 260px at 88% 35%, rgba(255,170,80,.18), transparent 65%),
    radial-gradient(circle 100px at 12% 32%, rgba(255,200,120,.32), transparent 60%),
    radial-gradient(circle 100px at 88% 32%, rgba(255,200,120,.32), transparent 60%);
  animation: candle-flicker 5s ease-in-out infinite;
}
/* Two bright candle flame cores */
html[data-table-theme="emerald"] .scene-near {
  background:
    radial-gradient(circle 14px at 12% 32%, rgba(255,235,180,.85), transparent 80%),
    radial-gradient(circle 14px at 88% 32%, rgba(255,235,180,.85), transparent 80%);
  animation: candle-flicker 3.2s ease-in-out infinite;
}
@keyframes candle-flicker {
  0%   { opacity: .92; transform: translateY(0);    }
  18%  { opacity: 1;   transform: translateY(-.6px); }
  37%  { opacity: .85; transform: translateY(.3px); }
  56%  { opacity: .98; transform: translateY(-.2px); }
  74%  { opacity: .9;  transform: translateY(0);    }
  100% { opacity: .94; transform: translateY(0);    }
}

/* ============================================================
   CASINO  (midnight theme)
   Real photo (Unsplash, John) — multicolored casino interior
   ============================================================ */
html[data-table-theme="midnight"] body { background: #100404; }
html[data-table-theme="midnight"] .scene-far {
  background-color: #100404;
  background-image:
    linear-gradient(to bottom,
      rgba(26,6,6,0.68) 0%,
      rgba(43,8,8,0.45) 35%,
      rgba(31,6,6,0.55) 65%,
      rgba(13,2,2,0.85) 100%),
    url("https://images.unsplash.com/photo-1491644386567-d98960637850?w=1600&q=70&auto=format&fit=crop");
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}
/* Chandelier light pool — large soft amber from above center */
html[data-table-theme="midnight"] .scene-mid {
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(255,180,90,.15), transparent 65%),
    radial-gradient(circle 380px at 50% 15%, rgba(255,200,120,.18), transparent 70%);
}
/* Drifting smoke + crystal sparkle */
html[data-table-theme="midnight"] .scene-near {
  background:
    radial-gradient(circle 8px at 50% 18%, rgba(255,240,210,.7), transparent 70%),
    radial-gradient(ellipse 800px 300px at 30% 90%, rgba(255,140,70,.08), transparent 70%),
    radial-gradient(ellipse 700px 250px at 70% 90%, rgba(255,120,60,.06), transparent 70%);
  animation: smoke-drift 18s ease-in-out infinite alternate;
}
@keyframes smoke-drift {
  0%   { transform: translateX(-30px); opacity: .85; }
  100% { transform: translateX( 25px); opacity: 1;   }
}

/* ============================================================
   GARDEN  (parchment theme)
   Real photo (Unsplash, Robin Wersich) — brown wooden garden table
   ============================================================ */
html[data-table-theme="parchment"] body { background: #d4c188; }
html[data-table-theme="parchment"] .scene-far {
  background-color: #d4c188;
  background-image:
    linear-gradient(to bottom,
      rgba(232,216,168,0.55) 0%,
      rgba(216,200,156,0.35) 30%,
      rgba(196,176,120,0.40) 55%,
      rgba(168,144,88,0.55) 85%,
      rgba(138,117,72,0.75) 100%),
    url("https://images.unsplash.com/photo-1601654253194-260e0b6984f9?w=1600&q=70&auto=format&fit=crop");
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}
/* Sun angle from upper-left + green grass-glow at bottom */
html[data-table-theme="parchment"] .scene-mid {
  background:
    linear-gradient(125deg, rgba(255,250,225,.25) 0%, transparent 50%),
    radial-gradient(circle 300px at 18% 12%, rgba(255,245,200,.40), transparent 65%),
    radial-gradient(ellipse 80% 25% at 50% 100%, rgba(140,160,80,.20), transparent 70%);
  animation: sun-shift 22s ease-in-out infinite alternate;
}
/* Subtle bright haze around the table area */
html[data-table-theme="parchment"] .scene-near {
  background:
    radial-gradient(ellipse 40% 30% at 50% 55%, rgba(255,250,220,.15), transparent 70%);
}
@keyframes sun-shift {
  0%   { opacity: .85; }
  100% { opacity: 1;   }
}

/* Atmospheric vignette to focus the table */
.scene-overlay {
  background:
    radial-gradient(ellipse 65% 60% at 50% 50%,
      transparent 0%, transparent 45%,
      rgba(0,0,0,.22) 80%, rgba(0,0,0,.45) 100%);
}
html[data-table-theme="parchment"] .scene-overlay {
  background:
    radial-gradient(ellipse 70% 65% at 50% 50%,
      transparent 0%, transparent 50%,
      rgba(80,55,20,.18) 80%, rgba(80,55,20,.32) 100%);
}

/* Performance + reduced motion */
@media (prefers-reduced-motion: reduce) {
  .scene-near, .scene-mid { animation: none !important; }
}
@media (max-width: 600px) {
  /* Slightly dim auxiliary layers on phones to save GPU */
  .scene-mid { opacity: .85; }
}

/* Disable the OLD particle motes if scene-bg is present */
html[data-immersive]:has(.scene-bg) .ambient-motes { display: none; }


/* Photo attribution — small credit text at bottom-right of the viewport.
   Required best-practice for Unsplash hotlinks. */
.scene-credit {
  position: fixed; right: 12px; bottom: 8px;
  z-index: 5;
  font-size: 9px; letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  font-family: var(--sans);
  text-transform: uppercase;
  pointer-events: auto;
}
.scene-credit a {
  color: rgba(255,255,255,.5);
  text-decoration: none;
}
.scene-credit a:hover { color: rgba(255,255,255,.85); }
html[data-table-theme="parchment"] .scene-credit { color: rgba(40,28,12,.45); }
html[data-table-theme="parchment"] .scene-credit a { color: rgba(40,28,12,.6); }
html[data-table-theme="parchment"] .scene-credit a:hover { color: rgba(40,28,12,.9); }


/* ============================================================
   LEVEL PILL + STREAK CHIP + XP TOAST  (v3.4.0)
   ============================================================ */

/* Level pill — shows current level + progress bar to next level */
.level-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 6px;
  background: linear-gradient(135deg, rgba(247,217,122,.18), rgba(214,176,107,.12));
  border: 1px solid rgba(247,217,122,.30);
  border-radius: 999px;
  font-family: var(--sans); font-size: 11px;
  color: var(--gold-hi);
  white-space: nowrap;
  cursor: default;
}
.level-pill .lvl-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, #f7d97a, #d6b06b);
  color: #1a0d04;
  font-weight: 700; font-size: 11px;
  box-shadow: 0 1px 4px rgba(247,217,122,.4);
}
.level-pill .lvl-bar {
  position: relative;
  width: 50px; height: 5px;
  background: rgba(255,255,255,.08);
  border-radius: 999px; overflow: hidden;
}
.level-pill .lvl-bar-fill {
  display: block; height: 100%;
  background: linear-gradient(90deg, #f7d97a, #ffe9a8);
  border-radius: 999px;
  transition: width .6s cubic-bezier(.2,.7,.3,1);
}

/* Streak chip — flame + day count */
.streak-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; margin-right: 4px;
  background: linear-gradient(135deg, rgba(255,120,40,.18), rgba(255,180,80,.10));
  border: 1px solid rgba(255,140,40,.32);
  border-radius: 999px;
  font-family: var(--sans); font-size: 11px;
  color: #ffc88a;
  white-space: nowrap;
  cursor: default;
}
.streak-chip .streak-flame {
  font-size: 12px;
  animation: flame-flicker 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 4px rgba(255,140,40,.6));
}
.streak-chip .streak-num { font-weight: 700; }
@keyframes flame-flicker {
  0%, 100% { transform: scale(1)    rotate(-2deg); opacity: .95; }
  25%      { transform: scale(1.08) rotate(2deg);  opacity: 1; }
  50%      { transform: scale(0.96) rotate(-1deg); opacity: .9; }
  75%      { transform: scale(1.04) rotate(1deg);  opacity: 1; }
}
/* Long-streak pulse (7+ days) */
.streak-chip.long {
  border-color: rgba(255,160,60,.55);
  box-shadow: 0 0 0 0 rgba(255,140,40,0);
  animation: streak-pulse 2.5s ease-in-out infinite;
}
@keyframes streak-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,140,40,0); }
  50%      { box-shadow: 0 0 0 4px rgba(255,140,40,.15), 0 0 16px rgba(255,140,40,.25); }
}

/* XP gain toast — slides in from bottom-right after a game */
.xp-toast {
  position: fixed;
  right: 18px; bottom: 18px;
  z-index: 9000;
  min-width: 260px; max-width: 340px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(20,12,8,.96), rgba(35,22,12,.96));
  border: 1px solid rgba(247,217,122,.4);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.5), 0 0 20px rgba(247,217,122,.18);
  color: var(--ink);
  font-family: var(--sans);
  transform: translateX(380px);
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.xp-toast.show { transform: translateX(0); }
.xp-toast .xpt-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.xp-toast .xpt-title {
  font-family: var(--serif); font-style: italic; font-size: 16px;
  color: var(--gold-hi);
}
.xp-toast .xpt-gain {
  font-weight: 700; font-size: 18px; color: #f7d97a;
  text-shadow: 0 0 8px rgba(247,217,122,.5);
}
.xp-toast .xpt-bd {
  display: flex; flex-direction: column; gap: 3px;
  font-size: 11px; color: var(--ink-dim);
  border-top: 1px solid rgba(214,176,107,.12);
  padding-top: 8px;
}
.xp-toast .xpt-row { display: flex; justify-content: space-between; }
.xp-toast .xpt-row strong { color: var(--ink); font-weight: 500; }
.xp-toast .xpt-mult {
  margin-top: 4px; padding-top: 6px;
  border-top: 1px dashed rgba(214,176,107,.18);
  color: #ffc88a;
}
.xp-toast .xpt-levelup {
  margin-top: 8px;
  padding: 8px 10px;
  background: linear-gradient(135deg, rgba(247,217,122,.18), rgba(214,176,107,.10));
  border-radius: 8px;
  text-align: center;
  font-family: var(--serif); font-style: italic;
  color: var(--gold-hi);
  font-size: 14px;
  animation: levelup-glow 1.6s ease-in-out infinite;
}
@keyframes levelup-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(247,217,122,0); }
  50%      { box-shadow: 0 0 0 3px rgba(247,217,122,.18), 0 0 14px rgba(247,217,122,.3); }
}
@media (max-width: 600px) {
  .xp-toast { left: 12px; right: 12px; min-width: 0; }
  .level-pill .lvl-bar { width: 36px; }
}


/* ============================================================
   VISIBLE AUDIENCE STRIP  (v3.4.1)
   5 small face avatars at the top of the stage. Subtle bob.
   Pop reaction emojis on events.
   ============================================================ */
.audience-strip {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  pointer-events: none;
  z-index: 4;
  opacity: .9;
}
.aud-member {
  position: relative;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, rgba(214,176,107,.18), rgba(0,0,0,.6));
  border: 1px solid rgba(214,176,107,.25);
  border-radius: 50%;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.4));
  animation: aud-bob 4s ease-in-out infinite;
}
.aud-member:nth-child(1) { animation-delay: 0s;    }
.aud-member:nth-child(2) { animation-delay: -.7s;  }
.aud-member:nth-child(3) { animation-delay: -1.4s; }
.aud-member:nth-child(4) { animation-delay: -2.1s; }
.aud-member:nth-child(5) { animation-delay: -2.8s; }
.aud-face { font-size: 16px; line-height: 1; filter: grayscale(.3); }
@keyframes aud-bob {
  0%, 100% { transform: translateY(0)   scale(1); }
  50%      { transform: translateY(-3px) scale(1.02); }
}

/* Mood-driven animation speed */
.audience-strip[data-mood="warm"] .aud-member { animation-duration: 2.5s; }
.audience-strip[data-mood="hot"]  .aud-member { animation-duration: 1.4s; filter: drop-shadow(0 0 10px rgba(255,180,80,.4)); }

/* Reaction emoji that pops out of a member */
.aud-react {
  position: absolute;
  font-size: 22px; line-height: 1;
  pointer-events: none;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  animation: aud-react 1.4s cubic-bezier(.2,.7,.3,1) forwards;
  z-index: 10;
}
@keyframes aud-react {
  0%   { opacity: 0; transform: translate(-50%, 6px) scale(.4); }
  20%  { opacity: 1; transform: translate(-50%, -8px) scale(1.2); }
  60%  { opacity: 1; transform: translate(-50%, -28px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -48px) scale(.9); }
}

/* Hide audience on very small screens */
@media (max-width: 480px) {
  .audience-strip { top: 50px; gap: 8px; }
  .aud-member { width: 26px; height: 26px; }
  .aud-face { font-size: 13px; }
}

/* ============================================================
   FLOATING SCORE POP-UPS  (over the dice when scoring)
   ============================================================ */
.stage-float-num {
  position: absolute;
  font-family: var(--serif); font-style: italic;
  font-weight: 700;
  color: #fff8d0;
  text-shadow: 0 2px 14px rgba(247,217,122,.7), 0 0 4px rgba(0,0,0,.5);
  pointer-events: none;
  z-index: 12;
  animation: float-pop 1.4s cubic-bezier(.2,.7,.3,1) forwards;
  white-space: nowrap;
}
.stage-float-num.big { font-size: 48px; }
.stage-float-num.med { font-size: 36px; }
.stage-float-num.sml { font-size: 24px; color: #e8d4a0; }
.stage-float-num.zero { font-size: 24px; color: #e08585; }
@keyframes float-pop {
  0%   { opacity: 0; transform: translate(-50%, 10px) scale(.7); }
  15%  { opacity: 1; transform: translate(-50%, -8px) scale(1.15); }
  30%  { opacity: 1; transform: translate(-50%, -16px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -90px) scale(.95); }
}

/* ============================================================
   YAHTZEE GOLDEN BURST  (full-screen)
   Already had a placeholder; this is the real wiring.
   ============================================================ */
.yahtzee-burst {
  position: fixed; inset: 0;
  z-index: 9999;
  display: grid; place-items: center;
  pointer-events: none;
}
.yahtzee-burst::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at center,
    rgba(247,217,122,.45) 0%,
    rgba(247,217,122,.15) 30%,
    transparent 65%);
  animation: yz-flash 2s ease-out forwards;
}
.yahtzee-burst .yz-text {
  position: relative;
  font-family: var(--serif); font-style: italic;
  font-size: clamp(40px, 10vw, 120px);
  font-weight: 700;
  letter-spacing: .08em;
  background: linear-gradient(180deg, #fffaeb, #f7d97a 40%, #c8923e 80%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(247,217,122,.7);
  animation: yz-text 2s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes yz-flash {
  0%   { opacity: 0; transform: scale(.7); }
  20%  { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.4); }
}
@keyframes yz-text {
  0%   { opacity: 0; transform: scale(.4) rotate(-8deg); }
  20%  { opacity: 1; transform: scale(1.15) rotate(2deg); }
  35%  { transform: scale(1) rotate(0); }
  85%  { opacity: 1; transform: scale(1.05) rotate(0); }
  100% { opacity: 0; transform: scale(1.25) rotate(0); }
}

/* ============================================================
   SCORE-CELL FLIP  (when a scorecard line gets filled)
   ============================================================ */
.scorelist .row.just-scored {
  animation: cell-fill 0.7s cubic-bezier(.2,.7,.3,1);
}
@keyframes cell-fill {
  0%   { background: rgba(247,217,122,0);   transform: scale(1); }
  35%  { background: rgba(247,217,122,.35); transform: scale(1.03); }
  100% { background: rgba(247,217,122,0);   transform: scale(1); }
}


/* ============================================================
   MOBILE UI POLISH (v3.4.2)
   - Top bar wraps cleanly on phones; new XP/streak chips don't squeeze score
   - Modal padding tightens; full-height drawer feel on phones
   - 44px minimum touch targets (Apple HIG)
   - DM chat takes the full modal on phones (was cramped)
   ============================================================ */

/* Tablet and below */
@media (max-width: 900px) {
  /* Top bar wraps in two rows on tablet+phone — title row, then actions */
  .game-shell .topbar {
    flex-wrap: wrap;
    row-gap: 8px;
    padding: 12px 14px;
    gap: 10px;
  }
  .topbar-actions { flex-wrap: wrap; gap: 6px; }
  .now-playing { display: none; } /* save space */
  .topbar-divider { display: none; }
  /* Make sure the level pill and streak chip don't blow up small viewports */
  .level-pill { padding: 3px 8px 3px 5px; gap: 6px; font-size: 10px; }
  .level-pill .lvl-num { width: 20px; height: 20px; font-size: 10px; }
  .level-pill .lvl-bar { width: 36px; height: 4px; }
  .streak-chip { font-size: 10px; padding: 3px 7px; }
}

/* Phone */
@media (max-width: 600px) {
  /* Generic 44px touch targets on inline icon buttons */
  .icon-btn { min-height: 40px; padding: 8px 10px; }
  .pill-btn .pb-label { font-size: 12px; }

  /* Modals: less padding, tighter card so content fits on small screens */
  .modal .card {
    padding: 18px 16px 20px;
    border-radius: 16px;
  }
  .modal .close-x {
    width: 36px; height: 36px;
    top: 10px; right: 10px;
    font-size: 22px;
  }
  .modal h2 { font-size: 22px; line-height: 1.2; }
  .modal .kicker { font-size: 10px; }

  /* DM chat — was cramped in 60vh; on phones give it the whole modal */
  .dm-chat {
    min-height: calc(100vh - 220px);
    height: auto;
    max-height: calc(100vh - 200px);
  }
  .dm-messages { max-height: none; }
  .dm-thread-row { padding: 12px; gap: 8px; }
  .dm-thread-row .dm-av { width: 36px; height: 36px; }
  .dm-thread-name { font-size: 14px; }
  .dm-compose input { padding: 12px 14px; font-size: 14px; }

  /* Friend modal tabs scroll horizontally rather than wrap awkwardly */
  .fr-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .fr-tabs::-webkit-scrollbar { display: none; }
  .fr-tab { white-space: nowrap; flex: 0 0 auto; padding: 10px 14px; min-height: 36px; }

  /* Game over modal: bigger close target, less cramped */
  #modal .card { padding: 22px 18px; }

  /* Score panel on phone: stop the numbers being mushed */
  .scorelist .row { padding: 6px 10px; min-height: 36px; }
  .scorelist .row .name { font-size: 12px; }
  .scorelist .row .val  { font-size: 14px; min-width: 28px; text-align: right; }

  /* Bottom-anchored "drawer" feel for big modals */
  .modal.show .card { animation: modal-slide-up .3s var(--ease-out); }
  @keyframes modal-slide-up {
    from { transform: translateY(20px); opacity: .8; }
    to   { transform: translateY(0);     opacity: 1; }
  }

  /* Public rooms rows tighten — no awkward wraps */
  .public-room-row {
    grid-template-columns: 32px 1fr auto;
    gap: 10px;
    padding: 10px 12px;
  }
  .public-room-row .pr-code { display: none; } /* code shown in tooltip / on tap */
  .public-room-row .pr-host { font-size: 13px; }
  .public-room-row .pr-meta { font-size: 10px; }
  .public-room-row .btn-sm { padding: 8px 12px; font-size: 11px; min-height: 36px; }

  /* XP toast becomes a top-anchored thin banner on phones */
  .xp-toast {
    left: 10px; right: 10px; bottom: auto;
    top: 70px;
    min-width: 0; padding: 12px 14px;
    transform: translateY(-200px);
  }
  .xp-toast.show { transform: translateY(0); }

  /* Audience strip already mobile-sized, but on very small phones, drop it
     so it doesn't compete with the dice */
}
@media (max-width: 420px) {
  .audience-strip { display: none; }
}

/* Safe-area awareness for notches / home indicators */
@supports (padding: env(safe-area-inset-bottom)) {
  .game-shell { padding-bottom: env(safe-area-inset-bottom); }
  .modal .card { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}


/* ============================================================
   STAGE PRESENTATION (v3.4.3)
   Earlier builds wrapped the table in a CSS "wooden frame" that
   landed flat (the felt ended up looking like a panel in a brown
   box). Cleaner: let the felt sit directly on the scene photo with
   only a gold hairline + soft outer shadow to define the edge.
   ============================================================ */
.game-shell .stage {
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(214,176,107,.35);
  box-shadow:
    0 30px 50px -20px rgba(0,0,0,.6),
    0 10px 24px rgba(0,0,0,.35),
    0 0 0 1px rgba(214,176,107,.1);
  background: transparent;
  /* CRITICAL: no padding so the dice canvas fills the stage fully */
  padding: 0;
}
/* Felt inner shadow gives depth without a wooden frame */
.game-shell .stage #c3d {
  border-radius: 22px;
  box-shadow:
    inset 0 0 0 1px rgba(214,176,107,.18),
    inset 0 6px 18px rgba(0,0,0,.4),
    inset 0 -4px 14px rgba(0,0,0,.25);
}
/* Reset HUD positions back to the standard inside-stage placement */
.stage-hud-top { top: 16px; padding: 0 18px; }
.audience-strip { top: 50px; }
.hint { left: 22px; bottom: 22px; }
/* Mobile: tighter inner shadow, otherwise unchanged */
@media (max-width: 600px) {
  .game-shell .stage { border-radius: 16px; }
  .game-shell .stage #c3d { border-radius: 16px; }
  .stage-hud-top { top: 12px; padding: 0 12px; }
  .audience-strip { top: 42px; }
  .hint { left: 14px; bottom: 14px; }
}


/* ============================================================
   STAGE FLOOR — ground the table visually in the scene
   ============================================================ */
.stage-floor {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 30vh;
  z-index: 0;
  pointer-events: none;
  background:
    /* Floor shadow under the table */
    radial-gradient(ellipse 50% 15% at 50% 25%, rgba(0,0,0,.55) 0%, transparent 70%),
    /* Floorboards going to perspective */
    linear-gradient(to bottom,
      rgba(0,0,0,0) 0%,
      rgba(20,12,8,.55) 35%,
      rgba(10,6,4,.85) 100%);
}
/* Theme tints */
html[data-table-theme="parchment"] .stage-floor {
  background:
    radial-gradient(ellipse 50% 15% at 50% 25%, rgba(80,55,20,.4) 0%, transparent 70%),
    linear-gradient(to bottom,
      rgba(0,0,0,0) 0%,
      rgba(140,100,60,.35) 35%,
      rgba(90,60,30,.6) 100%);
}


/* Inline join-error message inside a public room row */
.public-room-row .pr-msg {
  font-size: 10px; margin-top: 3px;
  color: var(--ink-dim); letter-spacing: .03em;
}
.public-room-row .pr-msg.error {
  color: #ff8580;
}
.public-room-row button:disabled {
  opacity: .55; cursor: wait;
}

/* Public-lobby banner inside the in-room share card */
.room-vis-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  margin: 0 0 14px;
  background: linear-gradient(135deg, rgba(80,180,120,.12), rgba(120,200,150,.06));
  border: 1px solid rgba(120,200,150,.32);
  border-radius: 10px;
  font-size: 12px;
  color: #cae9d2;
}
.room-vis-banner .rvb-ico { font-size: 16px; flex: 0 0 auto; }
.room-vis-banner strong { color: #e7f5ec; font-weight: 600; }

/* Chat message timestamps */
.chat-msg .ct-time {
  font-size: 9px;
  color: var(--ink-dim);
  opacity: .6;
  margin-left: 6px;
  font-weight: 400;
  letter-spacing: .02em;
}
.chat-msg.system { display: flex; align-items: center; justify-content: center; gap: 8px; }
.chat-msg.system .ct-time { opacity: .4; }
.chat-msg .ct-author .ct-time { font-weight: 400; }

/* ============================================================
   SCORECARD CONSOLIDATION (v3.6.1)
   Many edits left overlapping .scorelist / .summary rules across
   several media queries, causing overflow on desktop and an
   invisible card on mobile. This block is the single source of
   truth — it sits last so it wins the cascade.
   ============================================================ */

/* --- Side panel is always a normal grid cell, never hidden --- */
.game-shell .side {
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* --- Score list: scrolls, fills available height --- */
.game-shell .side .scorelist {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}

/* --- Each row: two columns (label | value), no overflow --- */
.game-shell .side .scorelist .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  min-height: 38px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(214,176,107,.08);
  border-radius: 9px;
  box-sizing: border-box;
}
.game-shell .side .scorelist .row .label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;            /* allow ellipsis */
}
.game-shell .side .scorelist .row .name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-shell .side .scorelist .row .rule {
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-shell .side .scorelist .row .val {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--gold-hi);
  line-height: 1;
  min-width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.game-shell .side .scorelist .row .val.zero { color: var(--ink-dim); }
.game-shell .side .scorelist .row.locked  { opacity: .55; cursor: default; }
.game-shell .side .scorelist .row.disabled{ opacity: .4;  cursor: default; }

/* --- Summary: 4 tiles in a clean grid (Upper/Bonus/Rows/Total) --- */
.game-shell .side .summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 12px;
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(214,176,107,.12);
  border-radius: 10px;
  flex: 0 0 auto;
  margin-top: 10px;
}
.game-shell .side .summary > div {
  display: flex; flex-direction: column;
  align-items: center; gap: 2px; min-width: 0;
  text-align: center;
}
.game-shell .side .summary span {
  font-size: 8.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-dim);
  white-space: nowrap;
}
.game-shell .side .summary strong {
  font-family: var(--serif); font-size: 17px; font-weight: 600;
  color: var(--ink); line-height: 1;
}
.game-shell .side .summary .summary-total strong { color: var(--gold-hi); font-size: 19px; }

/* --- MOBILE (≤680px): scorecard is a visible grid row, rule text hidden --- */
@media (max-width: 680px) {
  .game-shell {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto minmax(30vh, 1fr) minmax(34vh, 40vh) auto !important;
    grid-template-areas: "topbar" "stage" "side" "actions" !important;
  }
  .game-shell .side {
    grid-area: side;
    position: relative !important;
    transform: none !important;
    inset: auto !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    padding: 12px 14px;
    border-radius: 14px;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 1;
  }
  .drawer-handle, .drawer-close { display: none !important; }
  .game-shell .side .scorelist .row { padding: 8px 11px; min-height: 34px; gap: 8px; }
  .game-shell .side .scorelist .row .name { font-size: 12.5px; }
  .game-shell .side .scorelist .row .rule { display: none; }  /* name is enough on phone */
  .game-shell .side .scorelist .row .val { font-size: 16px; min-width: 28px; }
  .game-shell .side .summary { gap: 5px; padding: 8px; }
  .game-shell .side .summary strong { font-size: 15px; }
  .game-shell .side .summary span { font-size: 7.5px; letter-spacing: .1em; }
}

/* --- Tiny phones: even tighter --- */
@media (max-width: 380px) {
  .game-shell .side .scorelist .row .name { font-size: 11.5px; }
  .game-shell .side .summary span { font-size: 7px; }
}
