/* Roundabout: the TV heads-up display over the 3D board (js/roundabout-tv.js) and the phone
   controller (js/roundabout-phone.js). Look: dark glass panels with a hairline, gold for anything
   "home", each player's jewel tone (--seat, --seat-glow) for whatever is theirs. TV sizes are in
   rem, which the receiver scales with the screen. */

:root {
  --rb-gold: #e6c983;
  --rb-gold-deep: #b98d3e;
  --rb-ivory: #f3ede1;
  --rb-glass: rgb(10 12 26 / 0.72);
  --rb-hair: rgb(255 255 255 / 0.12);
}

/* ---------- Shared pieces ---------- */

.rb-pips { display: inline-flex; gap: 0.3em; align-items: center; }
.rb-pips i { width: 0.75em; height: 0.75em; border-radius: 50%; display: block; }
.rb-pips i.home { background: radial-gradient(circle at 35% 30%, #fff3c9, var(--rb-gold) 45%, var(--rb-gold-deep)); box-shadow: 0 0 0.5em rgb(230 201 131 / 0.6); }
.rb-pips i.out { background: radial-gradient(circle at 35% 30%, var(--seat-50w, #fff), var(--seat, #fff) 60%); }
.rb-pips i.nest { border: 0.12em solid rgb(255 255 255 / 0.35); }

.rb-crown { width: 3rem; filter: drop-shadow(0 0.2rem 0.4rem rgb(0 0 0 / 0.4)); animation: rb-float 2.4s ease-in-out infinite alternate; }
@keyframes rb-float { from { transform: translateY(-0.15rem); } to { transform: translateY(0.15rem); } }

.rb-standings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
.rb-standing {
  text-align: left; display: grid; grid-template-columns: 2.6rem auto 1fr auto auto; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.9rem; border-radius: 1rem; background: var(--rb-glass); border: 1px solid var(--rb-hair);
  border-left: 0.3rem solid var(--seat);
  animation: rb-rise 0.6s var(--spring) both;
}
.rb-standing:nth-child(2) { animation-delay: 0.12s; }
.rb-standing:nth-child(3) { animation-delay: 0.24s; }
.rb-standing:nth-child(4) { animation-delay: 0.36s; }
.rb-standing.me { box-shadow: 0 0 0 2px var(--seat) inset; }
.rb-place { font: 800 1.1rem var(--display); color: var(--rb-gold); }
.rb-standing-name { font: 800 1.15rem var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-standing-bumps { font: 700 0.9rem var(--body); color: var(--muted); }
@keyframes rb-rise { from { opacity: 0; transform: translateY(1rem); } }

.rb-final-hero { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.6rem; text-align: center; }

/* ---------- TV: the 3D layer ---------- */

body.rb-on .bg { display: none; }
body.rb-on .stage { z-index: 1; }
.rb-layer { position: fixed; inset: 0; z-index: 0; background: #07060a; }
.rb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.rb-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* A soft vignette ties the board to the room and keeps HUD text readable */
.rb-layer::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgb(4 3 8 / 0.75)),
    linear-gradient(180deg, rgb(4 3 8 / 0.5), transparent 16%, transparent 86%, rgb(4 3 8 / 0.5));
}

/* The player's avatar on their nest's corner of the board */
.rb-nest-tag { position: absolute; left: 0; top: 0; z-index: 1; }
.rb-nest-mark {
  display: block; padding: 0.2rem; border-radius: 50%;
  background: rgb(8 10 22 / 0.82); box-shadow: 0 0 0 0.16rem var(--seat), 0 0.4rem 1rem rgb(0 0 0 / 0.4);
  transition: box-shadow 0.3s, transform 0.4s var(--spring);
}
.rb-nest-mark .avatar { --size: 2.6rem; box-shadow: none; display: block; }
.rb-nest-tag.active .rb-nest-mark { transform: scale(1.3); box-shadow: 0 0 0 0.18rem var(--seat-glow), 0 0 0 0.34rem var(--rb-gold), 0 0 2rem var(--glow-a75); }

.rb-badge {
  position: absolute; left: 0; top: 0; z-index: 2;
  width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: 50%;
  font: 800 1.7rem/1 var(--display); color: #fff;
  background: radial-gradient(circle at 35% 30%, var(--seat-55w), var(--seat) 65%);
  border: 0.18rem solid var(--rb-ivory);
  box-shadow: 0 0.35rem 0.9rem rgb(0 0 0 / 0.45);
  animation: rb-badge-in 0.45s var(--spring) both;
}
.rb-badge::after { content: ''; position: absolute; left: 50%; bottom: -0.6rem; width: 0; height: 0; transform: translateX(-50%); border: 0.38rem solid transparent; border-top-color: var(--rb-ivory); }
.rb-badge.bump { border-color: #ff8a7a; }
@keyframes rb-badge-in { from { opacity: 0; scale: 0.4; } }

/* ---------- TV: heads-up display ----------
   The board is the middle of a grid and each player's panel sits beside their own corner of it:
   seat 0 front-left, 1 back-left, 2 back-right, 3 front-right. Wide and 16:9 screens put the panels
   in side columns; near-square or tall screens stack them above and below the board. The 3D camera
   fits the whole board into .rb-slot, whatever size the grid leaves it. */

.rb-hud {
  --rb-side: 16.5rem;
  position: relative; height: 100%; display: grid; gap: 1rem 1.2rem;
  grid-template-columns: var(--rb-side) minmax(0, 1fr) var(--rb-side);
  grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: 'brand turn lead' 'c1 board c2' 'c0 board c3';
  pointer-events: none; text-shadow: 0 0.12rem 0.6rem rgb(0 0 0 / 0.55);
}
@media (min-aspect-ratio: 2/1) { .rb-hud { --rb-side: 21rem; } }
/* 4:3-ish: slimmer panels leave the board more width */
@media (max-aspect-ratio: 3/2) { .rb-hud { --rb-side: 14.5rem; } }
@media (max-aspect-ratio: 5/4) {
  .rb-hud {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: 'brand lead' 'turn turn' 'c1 c2' 'board board' 'c0 c3';
  }
}

.rb-slot, .rb-banner { grid-area: board; min-height: 0; }

.rb-brand { grid-area: brand; align-self: center; display: flex; flex-direction: column; gap: 0.35rem; }
.rb-wordmark, .rb-moment-big, .rb-final .rb-title {
  /* Gradient-filled text: a text-shadow would show through the clear glyphs */
  text-shadow: none;
}
.rb-wordmark {
  font: 800 1.7rem/1 var(--display); letter-spacing: 0.3em; text-transform: uppercase;
  background: linear-gradient(180deg, #fff6dc, var(--rb-gold) 60%, var(--rb-gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rb-wordmark::after { content: ''; display: block; width: 3.2rem; height: 0.14rem; margin-top: 0.55rem; background: var(--rb-gold); border-radius: 1rem; }
.rb-turn-count { font: 700 1.05rem var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

/* Whose turn: the biggest thing on screen after the board */
.rb-turn {
  grid-area: turn; justify-self: center; align-self: center;
  display: flex; align-items: center; gap: 1.1rem; width: 100%; max-width: 44rem;
  padding: 0.8rem 1rem 0.8rem 0.9rem; border-radius: 1.5rem;
  background: linear-gradient(135deg, var(--seat-panel), rgb(10 12 26 / 0.84));
  border: 1px solid var(--rb-hair); border-left: 0.4rem solid var(--seat);
  box-shadow: 0 1rem 2.6rem rgb(0 0 0 / 0.4), 0 0 2.6rem var(--glow-a26);
}
.rb-turn.enter { animation: rb-turn-in 0.55s var(--spring) both; }
@keyframes rb-turn-in { from { opacity: 0; transform: translateY(-1.2rem) scale(0.96); } }
.rb-turn .avatar { --size: 4.4rem; flex: none; }
.rb-turn-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.rb-turn-kicker { font: 800 0.95rem var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--glow-70w); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-turn-text strong { font: 800 2.3rem/1.05 var(--display); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-turn-sub { font: 700 1.3rem var(--body); color: var(--glow-35ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-turn-die {
  flex: none; width: 4.3rem; height: 4.3rem; display: grid; place-items: center; border-radius: 1rem;
  font: 800 3rem/1 var(--display); color: #1b1d29; text-shadow: 0 0.04em 0 rgb(255 255 255 / 0.8);
  background: radial-gradient(circle at 30% 25%, #fffdf6, var(--rb-ivory) 55%, #d9cfbb);
  box-shadow: inset 0 0 0.6rem rgb(0 0 0 / 0.2), 0 0.4rem 1.2rem rgb(0 0 0 / 0.45), 0 0 0 0.16rem var(--glow-a70);
  animation: rb-die-in 0.6s var(--spring) both;
}
.rb-turn-die.six { color: #b42318; text-decoration: underline 0.07em; text-underline-offset: 0.08em; }
@keyframes rb-die-in { from { opacity: 0; transform: rotate(-120deg) scale(0.4); } }
.rb-turn .timer-ring { width: 4rem; height: 4rem; flex: none; }
.rb-turn .timer-ring .timer-fill { stroke: var(--seat-glow); }
.rb-turn .timer-ring .timer-num { font-size: 1.25rem; }

/* Who's ahead */
.rb-lead { grid-area: lead; justify-self: end; align-self: center; display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; text-align: right; min-width: 0; max-width: 100%; }
.rb-lead-kicker { font: 800 1rem var(--body); letter-spacing: 0.18em; text-transform: uppercase; color: var(--rb-gold); }
.rb-lead-who { display: flex; align-items: center; gap: 0.5rem; min-width: 0; max-width: 100%; }
.rb-lead-who .avatar { --size: 2.6rem; flex: none; }
.rb-lead-who .avatar + .avatar { margin-left: -1rem; }
.rb-lead-name { font: 800 1.6rem/1.1 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-lead.solo .rb-lead-name { color: var(--glow-55w); }
.rb-lead-crown { width: 2rem; flex: none; filter: drop-shadow(0 0.2rem 0.4rem rgb(0 0 0 / 0.4)); animation: rb-float 2.4s ease-in-out infinite alternate; }

/* A player's panel */
.rb-player {
  position: relative; display: flex; flex-direction: column; gap: 0.75rem; min-width: 0;
  padding: 0.95rem 1.1rem 1rem; border-radius: 1.4rem;
  background: var(--rb-glass); border: 1px solid var(--rb-hair);
  box-shadow: inset 0 0.3rem 0 var(--seat), 0 0.8rem 2rem rgb(0 0 0 / 0.35);
  transition: transform 0.45s var(--spring), box-shadow 0.4s, background 0.4s, opacity 0.4s;
}
.rb-player[data-corner='0'] { grid-area: c0; align-self: end; }
.rb-player[data-corner='1'] { grid-area: c1; align-self: start; }
.rb-player[data-corner='2'] { grid-area: c2; align-self: start; }
.rb-player[data-corner='3'] { grid-area: c3; align-self: end; }
.rb-player.active {
  transform: scale(1.04);
  background: linear-gradient(160deg, var(--seat-panel-on), rgb(10 12 26 / 0.86));
  box-shadow: inset 0 0.3rem 0 var(--seat), 0 0 0 0.16rem var(--seat-glow), 0 0 2.6rem var(--glow-a45);
}
.rb-player.active::after {
  content: 'Up now'; position: absolute; top: -0.85rem; right: 1rem;
  font: 800 0.9rem var(--body); letter-spacing: 0.1em; text-transform: uppercase; text-shadow: none;
  color: #12131c; background: var(--seat-glow); padding: 0.2rem 0.65rem; border-radius: 999px;
  animation: rb-up-now 1.6s ease-in-out infinite;
}
@keyframes rb-up-now { 50% { transform: translateY(-0.15rem); } }
.rb-player.away { opacity: 0.55; }
.rb-player.away .avatar { filter: grayscale(0.8); }
.rb-player-tag { position: absolute; top: -0.75rem; left: 1rem; font: 800 0.8rem var(--body); letter-spacing: 0.08em; text-transform: uppercase; text-shadow: none; color: var(--coral); background: rgb(30 10 12 / 0.92); padding: 0.18rem 0.55rem; border-radius: 999px; }

.rb-player-head { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.rb-player-face { position: relative; flex: none; }
.rb-player-face .avatar { --size: 4rem; }
.rb-player-rank {
  position: absolute; right: -0.55rem; bottom: -0.35rem; min-width: 2.3rem; padding: 0.12rem 0.4rem; border-radius: 999px;
  font: 800 1.05rem/1.2 var(--display); text-align: center; text-shadow: none;
  color: #15161f; background: var(--rb-ivory); box-shadow: 0 0.2rem 0.5rem rgb(0 0 0 / 0.45);
}
.rb-player.leader .rb-player-rank { background: linear-gradient(180deg, #fff3c9, var(--rb-gold) 55%, var(--rb-gold-deep)); box-shadow: 0 0 0.9rem rgb(230 201 131 / 0.7); }
.rb-player-rank.up { animation: rb-rank-up 0.7s var(--spring); }
@keyframes rb-rank-up { 0% { transform: scale(0.5); } 45% { transform: scale(1.35); } }
.rb-player-id { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.rb-player-name { font: 800 1.65rem/1.05 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-player-seat { font: 700 0.92rem var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--glow-55muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Four pegs by number: hollow in the nest, their color on the loop, gold once home */
.rb-pegs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; }
.rb-peg {
  aspect-ratio: 1; max-width: 3.2rem; width: 100%; justify-self: center; display: grid; place-items: center; border-radius: 50%;
  font: 800 1.35rem/1 var(--display); text-shadow: none;
  color: rgb(255 255 255 / 0.5); border: 0.18rem solid var(--seat-ring);
  background: rgb(255 255 255 / 0.04);
  transition: background 0.4s, border-color 0.4s, color 0.4s, box-shadow 0.4s;
}
.rb-peg[data-state='out'] {
  color: #fff; border-color: var(--glow-70w);
  background: radial-gradient(circle at 35% 30%, var(--glow-70w), var(--seat) 60%, var(--seat-deep));
  box-shadow: 0 0 0.9rem var(--glow-a45);
}
.rb-peg[data-state='home'] {
  color: #3a2a08; border-color: #fff1c4;
  background: radial-gradient(circle at 35% 30%, #fff3c9, var(--rb-gold) 50%, var(--rb-gold-deep));
  box-shadow: 0 0 1rem rgb(230 201 131 / 0.6);
}
.rb-peg.arrive { animation: rb-peg-arrive 0.8s var(--spring); }
@keyframes rb-peg-arrive { 0% { transform: scale(0.4); } 50% { transform: scale(1.3); } }

.rb-player-foot { display: flex; align-items: center; gap: 0.7rem; }
.rb-progress { flex: 1; height: 0.6rem; border-radius: 999px; background: rgb(255 255 255 / 0.1); overflow: hidden; }
.rb-progress i { display: block; height: 100%; width: calc(var(--done, 0) * 100%); border-radius: inherit; background: linear-gradient(90deg, var(--seat), var(--seat-glow) 70%, var(--rb-gold)); transition: width 0.8s ease; }
.rb-player-home { flex: none; font: 800 1.05rem var(--display); color: var(--rb-gold); }

/* Overrides for the layouts above (after the base rules so they win) */
@media (max-aspect-ratio: 3/2) { .rb-wordmark { font-size: 1.3rem; letter-spacing: 0.24em; } }
@media (max-aspect-ratio: 5/4) {
  .rb-player[data-corner='1'], .rb-player[data-corner='2'] { align-self: end; }
  .rb-player[data-corner='0'], .rb-player[data-corner='3'] { align-self: start; }
  .rb-turn { max-width: none; }
  /* Stacked panels are wide and short: name on the left, pegs on the right */
  .rb-player { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.6rem 1rem; padding: 0.8rem 1rem; }
  .rb-pegs { grid-template-columns: repeat(4, 2.8rem); }
  .rb-player-foot { grid-column: 1 / -1; }
}

/* Big moments land over the board, above the dome so the die stays in view */
.rb-banner { display: grid; justify-items: center; align-items: start; padding-top: 1rem; z-index: 2; }
.rb-moment {
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem; text-align: center;
  animation: rb-moment 2.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.rb-moment-big {
  font: 800 8.5rem/0.9 var(--display); letter-spacing: -0.04em;
  background: linear-gradient(180deg, #fff, var(--glow-70w, #fff) 55%, var(--seat, var(--rb-gold)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0.4rem 1.4rem rgb(0 0 0 / 0.55));
}
.rb-moment-small { font: 800 1.8rem var(--display); color: var(--ink); padding: 0.35rem 1.2rem; border-radius: 999px; background: rgb(8 10 22 / 0.78); border: 1px solid var(--rb-hair); }
.rb-moment.bump .rb-moment-big { font-size: 7rem; text-transform: uppercase; background-image: linear-gradient(180deg, #fff, #ffb4a6 50%, #e5402c); }
.rb-moment.home .rb-moment-big, .rb-moment.six .rb-moment-big { background-image: linear-gradient(180deg, #fffbe9, var(--rb-gold) 55%, var(--rb-gold-deep)); }
.rb-moment.home .rb-moment-big { font-size: 7rem; text-transform: uppercase; }
.rb-moment.nomove .rb-moment-big { font-size: 5rem; background-image: linear-gradient(180deg, #fff, #b9addb); }
@keyframes rb-moment {
  0% { opacity: 0; transform: scale(0.55) translateY(1rem); }
  14% { opacity: 1; transform: scale(1.06); }
  22%, 78% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.04) translateY(-1.2rem); }
}

.rb-overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 3; }
.rb-overlay:empty { display: none; }
/* The rules and results cards stand alone */
.rb-hud:is([data-screen='intro'], [data-screen='final']) :is(.rb-brand, .rb-player, .rb-lead, .rb-turn) { visibility: hidden; }

.rb-intro, .rb-final {
  width: min(58rem, 100%); display: flex; flex-direction: column; align-items: center; gap: 1.4rem; text-align: center;
  padding: 2.4rem 2.6rem; border-radius: 2rem;
  background: linear-gradient(180deg, rgb(12 14 30 / 0.86), rgb(8 9 20 / 0.9));
  border: 1px solid var(--rb-hair); box-shadow: 0 2rem 5rem rgb(0 0 0 / 0.55);
  animation: screen-in 0.7s var(--spring) both;
}
.rb-kicker { margin: 0; font: 800 1.1rem var(--body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--rb-gold); }
.rb-title { font: 800 5.6rem/0.95 var(--display); letter-spacing: -0.035em; margin: 0; }
.rb-rules { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; width: 100%; }
.rb-rule {
  display: flex; flex-direction: column; align-items: center; gap: 0.45rem; padding: 1.1rem 0.8rem; border-radius: 1.2rem;
  background: rgb(255 255 255 / 0.05); border: 1px solid var(--rb-hair);
  animation: rb-rise 0.6s var(--spring) both;
}
.rb-rule-icon { width: 3.2rem; height: 3.2rem; }
.rb-rule strong { font: 800 1.35rem var(--display); }
.rb-rule span { font: 600 1.02rem/1.3 var(--body); color: var(--muted); }
.rb-intro-seats { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.7rem; animation: rb-rise 0.6s var(--spring) 1.1s both; }
.rb-intro-seat {
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 0.6rem; align-items: center; text-align: left;
  padding: 0.45rem 0.9rem 0.45rem 0.45rem; border-radius: 1rem; background: rgb(255 255 255 / 0.05);
  border: 1px solid var(--rb-hair); box-shadow: inset 0 -0.2rem 0 var(--seat);
}
.rb-intro-seat .avatar { grid-row: span 2; }
.rb-intro-seat strong { font: 800 1.2rem/1.1 var(--display); }
.rb-intro-seat span { font: 700 0.85rem var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--glow-55muted); }
.rb-intro-seat .first-roll-dice { grid-column: 3; grid-row: 1 / span 2; margin-left: 0.4rem; }
.rb-starts { display: flex; align-items: center; gap: 0.6rem; margin: 0; font: 800 1.35rem var(--display); }
.rb-final { width: min(46rem, 100%); }
.rb-final .avatar-lg { --size: 6rem; }
.rb-final .rb-title { font-size: 4.6rem; background: linear-gradient(180deg, #fff, var(--glow-60w)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rb-final .rb-standing { font-size: 1.15rem; }

/* ---------- Phone ---------- */

.rb-view { gap: 1rem; }
.rb-note { margin: 0; color: var(--muted); text-align: center; font-weight: 700; }
.rb-note.up-next { color: var(--sun); font: 800 1.2rem var(--display); animation: pulse-ring 1.4s ease-in-out infinite; }
.rb-seat { display: inline-flex; align-self: flex-start; align-items: center; gap: 0.55rem; padding: 0.4rem 0.8rem; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font: 700 0.92rem var(--body); }
.rb-seat-swatch { width: 1rem; height: 1rem; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--seat-glow), var(--seat)); box-shadow: 0 0 0.6rem var(--seat-glow); }

.rb-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.rb-step { display: flex; align-items: center; gap: 0.8rem; padding: 0.75rem 0.9rem; border-radius: 1rem; background: var(--panel); border: 1px solid var(--line); font-weight: 700; animation: rb-rise 0.5s var(--spring) both; }
.rb-step-icon { width: 2.2rem; height: 2.2rem; flex: none; }

.rb-turn-view { position: relative; }
.rb-turn-view::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(70% 45% at 50% 42%, var(--seat-a32), transparent 70%); }
.rb-your-turn { text-align: center; font-size: clamp(2.4rem, 11vw, 3.2rem); background: linear-gradient(180deg, #fff, var(--seat-glow)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rb-turn-view .lede { text-align: center; }

/* The pop dome: a glass bubble on a gunmetal base, with the die inside */
.rb-pop {
  appearance: none; border: 0; background: none; padding: 0; margin: 0.4rem auto 0; cursor: pointer;
  position: relative; width: min(17rem, 78vw); aspect-ratio: 1 / 0.92; display: block;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; color: var(--ink);
}
.rb-pop-base {
  position: absolute; left: 4%; right: 4%; bottom: 10%; height: 26%; border-radius: 50%;
  background: radial-gradient(60% 70% at 50% 30%, #4a5060, #1c1f28 70%);
  box-shadow: inset 0 0.25rem 0 rgb(255 255 255 / 0.18), inset 0 -0.6rem 1rem rgb(0 0 0 / 0.6), 0 1.2rem 2rem rgb(0 0 0 / 0.5), 0 0 0 0.25rem var(--seat-gold);
}
.rb-dome {
  position: absolute; left: 12%; right: 12%; bottom: 20%; aspect-ratio: 1; border-radius: 50% 50% 46% 46%;
  display: grid; place-items: center; transform-origin: 50% 90%;
  background: radial-gradient(circle at 50% 75%, var(--deep-80k, rgb(11 18 38)), #070912 75%);
  transition: transform 0.12s ease-out;
}
.rb-glass {
  position: absolute; inset: -4%; border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(38% 26% at 34% 24%, rgb(255 255 255 / 0.55), transparent 70%),
    radial-gradient(70% 70% at 50% 50%, transparent 62%, rgb(190 214 255 / 0.35) 78%, rgb(255 255 255 / 0.5) 82%, transparent 84%),
    radial-gradient(circle at 70% 80%, rgb(255 255 255 / 0.12), transparent 40%);
  box-shadow: inset 0 0 1.6rem rgb(190 214 255 / 0.35), 0 0 2.4rem var(--glow-a35);
}
.rb-pop-label { position: absolute; left: 0; right: 0; bottom: -0.4rem; text-align: center; font: 800 1.15rem var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--seat-glow); }
.rb-pop:not(:disabled) .rb-dome { animation: rb-breathe 1.8s ease-in-out infinite; }
.rb-pop.pressed .rb-dome { animation: none; transform: scale(1.06, 0.86); }
/* --since: how long ago the dome popped, so a screen rebuilt mid-roll picks the motion up where it is */
.rb-pop.popped .rb-dome { animation: rb-popped 0.5s var(--spring) calc(var(--since, 0ms) * -1) both; }
.rb-pop:disabled { cursor: default; }
@keyframes rb-breathe { 50% { transform: scale(1.025, 0.985); } }
@keyframes rb-popped { 0% { transform: scale(1.08, 0.82); } 45% { transform: scale(0.96, 1.08); } 100% { transform: none; } }

/* A real 3D die, turned to show the roll */
.rb-cube-wrap { --s: 4.4rem; width: var(--s); height: var(--s); perspective: 40rem; }
.rb-cube { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateX(calc(var(--rx, -22deg) - 18deg)) rotateY(calc(var(--ry, 28deg) + 24deg)); transition: transform 0.6s var(--spring); }
/* Engraved numerals like the TV's die; the 6 in vermilion, underlined */
.rb-face {
  position: absolute; inset: 0; border-radius: 22%;
  display: grid; place-items: center;
  font: 800 calc(var(--s) * 0.62) / 1 var(--display); color: #1b1d29;
  text-shadow: 0 0.04em 0 rgb(255 255 255 / 0.8), 0 -0.03em 0 rgb(0 0 0 / 0.3);
  background: radial-gradient(circle at 30% 25%, #fffdf6, var(--rb-ivory) 55%, #d9cfbb);
  box-shadow: inset 0 0 0.6rem rgb(0 0 0 / 0.18);
  backface-visibility: hidden;
}
.rb-face.six { color: #b42318; text-decoration: underline 0.07em; text-underline-offset: 0.08em; }
.rb-face.front { transform: translateZ(calc(var(--s) / 2)); }
.rb-face.back { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.rb-face.right { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.rb-face.left { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.rb-face.top { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.rb-face.bottom { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.rb-cube-wrap.tumbling .rb-cube { animation: rb-tumble 0.55s linear infinite; }
/* On the pop the die is fired into the glass, then bounces lower and lower */
.rb-pop.popped .rb-cube-wrap { animation: rb-die-jump 1.1s linear calc(var(--since, 0ms) * -1) both; }
@keyframes rb-die-jump {
  0% { translate: 0 0.3rem; animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  18% { translate: 0 -3.2rem; animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.5); }
  40% { translate: 0 0; animation-timing-function: cubic-bezier(0.2, 0.6, 0.4, 1); }
  53% { translate: 0 -1.3rem; animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.5); }
  66% { translate: 0 0; animation-timing-function: cubic-bezier(0.2, 0.6, 0.4, 1); }
  74% { translate: 0 -0.5rem; animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.5); }
  82%, 100% { translate: 0 0; }
}
@keyframes rb-tumble { from { transform: rotateX(0) rotateY(0) rotateZ(0); } to { transform: rotateX(360deg) rotateY(720deg) rotateZ(180deg); } }

.rb-rolled { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.rb-rolled .rb-cube-wrap { --s: 3.6rem; }
.rb-rolled .rb-cube { transform: rotateX(var(--rx)) rotateY(var(--ry)); animation: rb-land 0.8s var(--spring) both; }
.rb-rolled .game-title { font-size: clamp(1.9rem, 8vw, 2.4rem); }
@keyframes rb-land { from { transform: rotateX(calc(var(--rx) + 540deg)) rotateY(calc(var(--ry) + 360deg)) scale(0.6); } }

.rb-moves { display: flex; flex-direction: column; gap: 0.55rem; }
.rb-move {
  appearance: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 0.85rem; padding: 0.8rem 0.95rem; border-radius: 1.15rem;
  background: linear-gradient(180deg, rgb(255 255 255 / 0.09), rgb(255 255 255 / 0.04)); border: 2px solid var(--line);
  box-shadow: 0 0.3rem 0 rgb(0 0 0 / 0.3);
  transition: transform 0.1s, border-color 0.15s, opacity 0.2s;
  animation: rb-rise 0.4s var(--spring) both;
}
.rb-move:nth-child(2) { animation-delay: 0.05s; }
.rb-move:nth-child(3) { animation-delay: 0.1s; }
.rb-move:nth-child(4) { animation-delay: 0.15s; }
.rb-move:active:not(:disabled) { transform: translateY(0.2rem); box-shadow: none; }
.rb-move-num { flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; font: 800 1.35rem var(--display); color: #fff; background: radial-gradient(circle at 35% 30%, var(--seat-glow), var(--seat) 65%); border: 2px solid var(--rb-ivory); }
.rb-move-text { display: flex; flex-direction: column; min-width: 0; }
.rb-move-text strong, .rb-move.only strong { font: 800 1.15rem var(--display); }
.rb-move-text span, .rb-move.only span { color: var(--muted); font-size: 0.92rem; }
.rb-move.bump { border-color: rgb(255 107 91 / 0.7); }
.rb-move.home { border-color: rgb(230 201 131 / 0.7); }
.rb-move.chosen { border-color: var(--seat-glow); background: var(--seat-a28); }
.rb-move:disabled:not(.chosen) { opacity: 0.4; }
.rb-move.only { display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem; cursor: default; }


.rb-mine { display: flex; align-items: center; justify-content: center; gap: 0.7rem; padding: 0.6rem 0.9rem; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-weight: 700; font-size: 0.92rem; color: var(--muted); }
.rb-mine .rb-pips { font-size: 1.05rem; }

.rb-watch-card { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; text-align: center; padding: 1.4rem 1rem; border-radius: 1.5rem; background: linear-gradient(180deg, var(--seat-a22, rgb(255 255 255 / 0.22)), rgb(255 255 255 / 0.03)); border: 1px solid var(--line); }
.rb-watch-card .lede { margin: 0; }
.rb-watch.hit .rb-watch-card { animation: shake 0.5s; border-color: var(--coral); box-shadow: 0 0 2rem rgb(255 107 91 / 0.35); }

@media (prefers-reduced-motion: reduce) {
  .rb-pop:not(:disabled) .rb-dome, .rb-pop.popped .rb-cube-wrap, .rb-cube-wrap.tumbling .rb-cube, }
