:root {
  color-scheme: dark;
  --bg: #07152b;
  --bg-deep: #030a16;
  --surface: #10284a;
  --surface-2: #17365f;
  --surface-3: #244a78;
  --text: #f7fbff;
  --muted: #b9c9dd;
  --border: #3d6796;
  --blue: #42a5ff;
  --blue-deep: #1367bf;
  --gold: #ffc83d;
  --gold-deep: #aa6d00;
  --green: #57d68d;
  --red: #ff6b72;
  --purple: #9b6cff;
  --orange: #ff9b45;
  --focus: #fff18a;
  --shadow: 0 18px 50px rgb(0 0 0 / .38);
  --radius: 20px;
  --control: 50px;
  --font-scale: 1;
  --motion: 1;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg-deep); font-size: calc(16px * var(--font-scale)); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgb(70 63 170 / .28), transparent 32rem),
    radial-gradient(circle at 88% 6%, rgb(0 147 255 / .20), transparent 28rem),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; }
button, a { touch-action: manipulation; }
button { color: inherit; }
a { color: inherit; }
img, svg { display: block; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.skip-link {
  position: fixed;
  top: .5rem;
  left: .5rem;
  z-index: 1000;
  padding: .75rem 1rem;
  border-radius: 12px;
  background: var(--focus);
  color: #111;
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; }

:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }

.site-header, .game-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: max(.7rem, env(safe-area-inset-top)) clamp(1rem, 4vw, 2.5rem) .7rem;
  border-bottom: 1px solid rgb(255 255 255 / .12);
  background: rgb(4 13 30 / .8);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; }
.header-end { display: flex; align-items: center; gap: .6rem; }
.brand img { filter: drop-shadow(0 6px 12px rgb(0 0 0 / .4)); }
.brand span { display: grid; line-height: 1; }
.brand strong { font-size: 1.35rem; letter-spacing: -.025em; }
.brand small { color: var(--gold); margin-top: .2rem; text-transform: uppercase; letter-spacing: .14em; font-weight: 800; }
.game-title { flex: 1; display: grid; min-width: 0; }
.game-title strong { font-size: clamp(1rem, 4vw, 1.3rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-title span { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-button {
  width: var(--control);
  height: var(--control);
  border: 1px solid var(--border);
  border-radius: 15px;
  display: inline-grid;
  place-items: center;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  flex: none;
}
.icon-button:hover { background: var(--surface-2); }
.icon-button svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.home-main { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2rem, 7vw, 5rem) 0 4rem; }
.home-intro { max-width: 760px; margin-bottom: 2rem; }
.home-intro h1 { margin: 0; font-size: clamp(2.5rem, 9vw, 5.6rem); line-height: .96; letter-spacing: -.055em; }
.home-intro p { color: var(--muted); font-size: clamp(1rem, 2.5vw, 1.25rem); max-width: 680px; }
.game-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.game-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / .15);
  border-radius: 28px;
  background: linear-gradient(180deg, rgb(25 51 89 / .95), rgb(9 24 48 / .98));
  box-shadow: var(--shadow);
}
.game-art { height: clamp(250px, 34vw, 360px); position: relative; overflow: hidden; border-bottom: 1px solid rgb(255 255 255 / .12); }
.game-copy { padding: 1.5rem; }
.game-copy h2 { margin: 0 0 .65rem; font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.1; }
.game-copy p { color: var(--muted); min-height: 4.3em; }
.feature-row { display: flex; flex-wrap: wrap; gap: .55rem; list-style: none; padding: 0; margin: 1rem 0 1.35rem; }
.feature-row li { padding: .45rem .7rem; border-radius: 999px; background: rgb(255 255 255 / .08); border: 1px solid rgb(255 255 255 / .1); font-size: .82rem; font-weight: 750; }

/* Poster art fills the card window; the crop favors the title + Sterling. */
.poster-art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; }

.button {
  min-height: var(--control);
  border: 1px solid transparent;
  border-radius: 15px;
  padding: .78rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.15;
}
.button.primary { background: linear-gradient(180deg, #43a9ff, #1b70cc); color: #fff; box-shadow: 0 8px 18px rgb(22 115 211 / .35); }
.button.secondary { border-color: var(--border); background: var(--surface); color: var(--text); }
.button.danger { background: #a52939; color: white; }
.button.compact { min-height: 42px; padding: .55rem .8rem; }
.button:hover:not(:disabled) { filter: brightness(1.08); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.action-button { min-width: min(180px, 46vw); min-height: 62px; font-size: 1.15rem; }

.comfort-strip { margin-top: 2rem; padding: 1.5rem; border-radius: 24px; border: 1px solid rgb(255 255 255 / .12); background: rgb(12 31 59 / .7); }
.comfort-strip h2 { margin-top: 0; }
.comfort-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.comfort-grid div { display: grid; gap: .3rem; padding-left: 1rem; border-left: 4px solid var(--green); }
.comfort-grid span { color: var(--muted); font-size: .9rem; }
.site-footer { padding: 1rem; text-align: center; color: var(--muted); font-size: .82rem; }

.game-layout { width: min(1200px, calc(100% - 1rem)); margin: 0 auto; padding: 1rem 0 max(2rem, env(safe-area-inset-bottom)); display: grid; gap: .9rem; }
.status-panel {
  min-height: 74px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .8rem;
  padding: .75rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgb(23 54 95 / .95), rgb(12 34 66 / .98));
  border: 1px solid rgb(255 255 255 / .12);
}
.status-panel > div:nth-child(2) { display: grid; min-width: 0; }
.status-panel strong { font-size: 1.05rem; }
.status-panel span { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; }
.turn-avatar { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; color: #111; background: var(--gold); font-weight: 950; box-shadow: inset 0 0 0 4px rgb(255 255 255 / .25); }
.turn-avatar.blue { background: var(--blue); color: white; }
.turn-avatar.gold { background: var(--gold); color: #231600; }

.board-shell { position: relative; border-radius: 22px; overflow: hidden; border: 1px solid rgb(255 255 255 / .18); box-shadow: var(--shadow); }
.ramps-shell { padding: clamp(.45rem, 1.5vw, .9rem); background: linear-gradient(145deg, #2f6b3b, #163d54 50%, #3d286d); }
.ramps-board { display: grid; grid-template-columns: repeat(10, 1fr); gap: clamp(2px, .45vw, 6px); aspect-ratio: 10 / 6; }
.board-space {
  position: relative;
  min-width: 0;
  border: 0;
  border-radius: clamp(5px, 1vw, 12px);
  background: linear-gradient(145deg, #fff9df, #dce8ee);
  color: #1b2a3a;
  box-shadow: inset 0 0 0 2px rgb(20 48 65 / .12), 0 2px 5px rgb(0 0 0 / .28);
  padding: 0;
  display: grid;
  place-items: center;
  overflow: visible;
}
.board-space:nth-child(4n+2) { background: linear-gradient(145deg, #ddf1ff, #bad7e8); }
.board-space:nth-child(4n+3) { background: linear-gradient(145deg, #fff0bd, #e3c67c); }
.board-space.special-ramp { background: linear-gradient(145deg, #d9ffe5, #74d798); }
.board-space.special-roadblock { background: linear-gradient(145deg, #ffe4e5, #e98d92); }
.board-space.special-spoon { background: linear-gradient(145deg, #fffbd9, #f1c94b); }
.board-space.finish { background: linear-gradient(145deg, #e8dcff, #9b6cff); color: #fff; }
.space-number { position: absolute; top: 4px; left: 6px; font-size: clamp(.52rem, 1.4vw, .8rem); font-weight: 900; opacity: .74; }
.space-icon { font-size: clamp(.75rem, 2.1vw, 1.5rem); line-height: 1; }
.tokens-layer { position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1px; pointer-events: none; }
.rr-token {
  width: clamp(11px, 2.9vw, 27px);
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgb(0 0 0 / .48);
  color: white;
  font-size: clamp(.45rem, 1.2vw, .75rem);
  font-weight: 950;
}
.rr-token.p0 { background: #2e8eea; }
.rr-token.p1 { background: #d88a0b; }
.rr-token.p2 { background: #3ca768; }
.rr-token.p3 { background: #824fd0; }
.rr-token.p4 { background: #df5a66; }
.rr-token.p5 { background: #e57222; }
.rr-token.active { box-shadow: 0 0 0 3px var(--focus), 0 2px 8px rgb(0 0 0 / .5); }

.game-controls { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: center; padding: .85rem; border-radius: 18px; background: rgb(13 32 61 / .9); border: 1px solid rgb(255 255 255 / .12); }
.dice-area { display: flex; gap: .75rem; align-items: center; }
.die {
  width: 54px;
  aspect-ratio: 1;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #fffdf5, #dce4e8);
  color: #172236;
  border: 2px solid #fff;
  box-shadow: inset -3px -4px 6px rgb(0 0 0 / .14), 0 6px 12px rgb(0 0 0 / .3);
  font-weight: 950;
  font-size: 1.45rem;
}
.die.large { width: 64px; }
.die.used { opacity: .38; }
.die.rolling { animation: die-pop calc(.55s * var(--motion)) ease; }
@keyframes die-pop { 0%,100% { transform: rotate(0) scale(1); } 40% { transform: rotate(13deg) scale(1.13); } 70% { transform: rotate(-9deg) scale(.98); } }
.resource-area { min-width: 130px; display: grid; gap: .3rem; }
.resource-area > span { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.spoon-meter { display: flex; gap: .3rem; }
.spoon { width: 24px; height: 34px; position: relative; opacity: .28; }
.spoon::before { content: ""; position: absolute; top: 1px; left: 5px; width: 14px; height: 17px; border-radius: 50%; background: linear-gradient(145deg,#fff4ac,#e9a816); border: 2px solid #fff2a4; }
.spoon::after { content: ""; position: absolute; top: 16px; left: 10px; width: 5px; height: 17px; border-radius: 3px; background: #e9a816; }
.spoon.full { opacity: 1; filter: drop-shadow(0 2px 5px rgb(255 198 32 / .5)); }
.players-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px,1fr)); gap: .6rem; }
.player-chip { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .55rem; padding: .65rem .75rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.player-chip.current { border-color: var(--focus); box-shadow: inset 0 0 0 2px var(--focus); }
.player-chip .chip-token { width: 30px; height: 30px; border-radius: 50%; }
.player-chip small { color: var(--muted); }

/* Backgammon */
.bg-shell {
  padding: clamp(.45rem,1.5vw,.85rem);
  background:
    repeating-linear-gradient(105deg, rgb(255 220 170 / .045) 0 3px, transparent 3px 11px),
    linear-gradient(145deg, #5f4028, #3a2417 55%, #241711);
}
.backgammon-board {
  min-height: min(69vh, 720px);
  display: grid;
  grid-template-columns: 72px 1fr 54px 1fr 72px;
  grid-template-rows: 1fr 1fr;
  grid-template-areas: "blue top bar top gold" "blue bottom bar bottom gold";
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(130% 95% at 50% 32%, rgb(255 236 190 / .35), transparent 58%),
    linear-gradient(180deg, #e6c184, #d5a961 55%, #c69347);
  border: 6px solid #33200f;
  box-shadow:
    inset 0 0 0 2px rgb(255 226 168 / .28),
    inset 0 0 44px rgb(60 30 8 / .38),
    0 10px 26px rgb(0 0 0 / .35);
}
.bg-points { display: grid; grid-template-columns: repeat(12,1fr); min-width: 0; }
.bg-points.top { grid-area: top; align-items: start; }
.bg-points.bottom { grid-area: bottom; align-items: end; }
.bg-point { position: relative; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; border: 0; padding: 0; background: transparent; color: #fff; cursor: default; }
/* Full-height two-tone points: dark walnut and cream, shaded toward the tip
   so they read as inlaid wood rather than flat spikes. clip-path swallows
   box-shadow, so depth comes from a drop-shadow filter instead. */
.bg-point::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  height: 92%;
  filter: drop-shadow(0 2px 3px rgb(58 30 8 / .38));
}
.bg-points.top .bg-point::before { top: 0; clip-path: polygon(0 0,100% 0,50% 100%); background: linear-gradient(180deg, #8a4a1e, #5c2c0e); }
.bg-points.bottom .bg-point::before { bottom: 0; clip-path: polygon(50% 0,100% 100%,0 100%); background: linear-gradient(0deg, #8a4a1e, #5c2c0e); }
.bg-points.top .bg-point.alt::before { background: linear-gradient(180deg, #f8ecca, #dcbd85); }
.bg-points.bottom .bg-point.alt::before { background: linear-gradient(0deg, #f8ecca, #dcbd85); }
.bg-point.legal-destination::after { content: ""; position: absolute; width: 72%; aspect-ratio: 1; border-radius: 50%; border: 4px solid #7cf29d; background: rgb(124 242 157 / .18); z-index: 4; }
.bg-points.top .bg-point.legal-destination::after { top: 8%; }
.bg-points.bottom .bg-point.legal-destination::after { bottom: 8%; }
.point-number {
  position: absolute; z-index: 5;
  font-size: clamp(.56rem,1.3vw,.78rem); font-weight: 900; color: #fff;
  padding: .02rem .28rem; border-radius: 999px;
  background: rgb(24 13 4 / .55); text-shadow: 0 1px 2px #000;
}
.bg-points.top .point-number { top: 3px; }
.bg-points.bottom .point-number { bottom: 3px; }
.checker-stack { position: absolute; inset: 22px 3px; display: flex; flex-direction: column; align-items: center; z-index: 3; pointer-events: none; }
.bg-points.bottom .checker-stack { justify-content: flex-end; }
.checker {
  width: clamp(24px,5.5vw,47px);
  aspect-ratio: 1;
  flex: 0 0 auto;
  border-radius: 50%;
  margin-top: clamp(-12px,-1.1vw,-6px);
  border: 3px solid rgb(255 255 255 / .55);
  box-shadow:
    inset 0 0 0 4px rgb(255 255 255 / .14),
    inset 0 5px 7px rgb(255 255 255 / .3),
    inset 0 -6px 9px rgb(0 0 0 / .28),
    0 3px 8px rgb(0 0 0 / .45);
  display: grid;
  place-items: center;
  font-size: clamp(.55rem,1.5vw,.8rem);
  font-weight: 950;
  color: white;
}
.checker.blue { background: radial-gradient(circle at 34% 28%, #78ceff, #1674c9 57%, #07396f); }
.checker.gold { background: radial-gradient(circle at 34% 28%, #fff5a8, #d88b0c 57%, #784000); color: #271800; }
.checker.legal-checker { box-shadow: 0 0 0 4px #7cf29d, inset 0 0 0 5px rgb(255 255 255 / .15), 0 3px 8px rgb(0 0 0 / .42); }
.checker.selected { box-shadow: 0 0 0 5px var(--focus), inset 0 0 0 5px rgb(255 255 255 / .15), 0 4px 12px #000; transform: scale(1.06); }
.stack-count { position: absolute; z-index: 6; right: 2px; padding: .15rem .35rem; border-radius: 999px; background: #07152b; color: #fff; font-size: .7rem; font-weight: 950; }
.bg-points.top .stack-count { top: 30%; }
.bg-points.bottom .stack-count { bottom: 30%; }
/* The bar reads as one continuous wood spine; the two drop slots stay
   invisible until they become legal destinations. */
.bg-bar {
  grid-area: bar;
  background:
    repeating-linear-gradient(0deg, rgb(0 0 0 / .07) 0 2px, transparent 2px 9px),
    linear-gradient(90deg, #2c1a0f, #58381f 30%, #6d4a2c 50%, #58381f 70%, #2c1a0f);
  border-inline: 2px solid #1f120d;
  box-shadow: inset 0 0 14px rgb(0 0 0 / .5);
  display: grid; grid-template-rows: 1fr 1fr; padding: .35rem; gap: .35rem;
}
.bar-slot { border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; min-width: 0; border: 1px solid transparent; }
.bar-slot.legal-destination { border-color: #7cf29d; box-shadow: inset 0 0 0 3px #7cf29d, inset 0 0 18px rgb(124 242 157 / .25); }
.bg-side-label { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; padding: .3rem; color: #f3e3c2; text-align: center; }
.bg-side-label span {
  width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: 50%; font-size: 1.3rem; font-weight: 950; color: #fff;
  background: #10233d;
  box-shadow: inset 0 2px 4px rgb(255 255 255 / .18), inset 0 -4px 6px rgb(0 0 0 / .4), 0 3px 7px rgb(0 0 0 / .4);
}
.bg-side-label small { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; }
/* Matched leather trays; the team shows in the count puck, not the wall. */
.blue-label, .gold-label {
  background:
    repeating-linear-gradient(0deg, rgb(255 226 168 / .04) 0 2px, transparent 2px 10px),
    linear-gradient(180deg, #47301d, #241509);
  box-shadow: inset 0 0 16px rgb(0 0 0 / .45);
}
.blue-label { grid-area: blue; }
.gold-label { grid-area: gold; }
.blue-label span { background: radial-gradient(circle at 35% 30%, #3f8fd8, #14508f 60%, #0a2c55); border: 3px solid #8fccff; }
.gold-label span { background: radial-gradient(circle at 35% 30%, #d9a53a, #96650c 60%, #4f3203); border: 3px solid #ffd97a; }
.dice-pair { display: flex; gap: .4rem; }
.bg-controls { justify-content: space-between; }
.match-summary { display: grid; grid-template-columns: 1fr auto 1fr; gap: .7rem; align-items: center; padding: .8rem; border-radius: 18px; background: rgb(13 32 61 / .9); border: 1px solid rgb(255 255 255 / .12); }
.match-summary > div:first-child, .match-summary > div:last-child { display: grid; grid-template-columns: auto 1fr; gap: .15rem .5rem; align-items: center; }
.match-summary > div:last-child { text-align: right; }
.match-summary small { grid-column: 2; color: var(--muted); }
.summary-dot { width: 24px; height: 24px; border-radius: 50%; grid-row: span 2; }
.summary-dot.blue { background: var(--blue); }
.summary-dot.gold { background: var(--gold); }
.move-sequence { padding: .55rem .75rem; border-radius: 12px; background: var(--surface); color: var(--muted); text-align: center; }

/* Dialogs */
dialog { border: 0; padding: 0; color: var(--text); background: transparent; max-width: min(94vw, 620px); max-height: min(92vh, 850px); }
dialog::backdrop { background: rgb(0 4 12 / .78); backdrop-filter: blur(5px); }
.dialog-card { margin: 0; width: min(92vw, 580px); max-height: 88vh; overflow: auto; padding: 1.2rem; border-radius: 24px; background: linear-gradient(180deg,#183860,#091b35); border: 1px solid var(--border); box-shadow: var(--shadow); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dialog-heading h2 { margin: 0; }
.field { display: grid; gap: .4rem; margin: 1rem 0; font-weight: 750; }
.field input, .field select { width: 100%; min-height: var(--control); padding: .75rem; border-radius: 13px; border: 2px solid var(--border); background: #07182e; color: var(--text); }
.mode-options { border: 0; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: repeat(2,1fr); gap: .7rem; }
.mode-options legend { width: 100%; margin-bottom: .6rem; font-weight: 900; }
.mode-option { min-height: 86px; padding: .85rem; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); color: var(--text); display: grid; gap: .2rem; text-align: left; cursor: pointer; }
.mode-option span { color: var(--muted); font-size: .82rem; }
.mode-option.selected { border-color: var(--focus); box-shadow: inset 0 0 0 2px var(--focus); }
.sub-options { padding: .2rem .8rem; border-radius: 14px; background: rgb(0 0 0 / .14); }
.switch-row { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: center; padding: .8rem 0; cursor: pointer; }
.switch-row input { width: 26px; height: 26px; accent-color: var(--green); }
.switch-row span { display: grid; }
.switch-row small { color: var(--muted); }
.form-error { color: #ffb3b7; min-height: 1.4em; }
.event-card { text-align: center; }
.event-icon { width: 76px; height: 76px; margin: 0 auto .8rem; border-radius: 24px; display: grid; place-items: center; background: var(--surface-3); font-size: 2.2rem; font-weight: 950; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: 1rem; }
.prose-card { text-align: left; }
.prose-card li { margin-bottom: .6rem; }
.settings-grid { display: grid; gap: .35rem; margin: 1rem 0; }
.volume-row { display: grid; grid-template-columns: 92px 1fr 44px; gap: .6rem; align-items: center; padding: .55rem 0; }
.volume-row input { width: 100%; }
.settings-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

/* Accessibility modes */
body.high-contrast {
  --bg: #000;
  --bg-deep: #000;
  --surface: #101010;
  --surface-2: #1d1d1d;
  --surface-3: #2b2b2b;
  --text: #fff;
  --muted: #f1f1f1;
  --border: #fff;
  --blue: #4fc3ff;
  --gold: #ffe347;
  background: #000;
}
body.high-contrast .game-card,
body.high-contrast .status-panel,
body.high-contrast .game-controls,
body.high-contrast .match-summary,
body.high-contrast .dialog-card { border: 2px solid #fff; background: #050505; }
body.high-contrast .board-space { border: 2px solid #111; }
body.large-ui { --control: 60px; --font-scale: 1.14; }
body.large-ui .game-layout { width: min(1240px, calc(100% - .5rem)); }
body.clean-screen { background: var(--bg-deep); }
body.clean-screen .board-shell { box-shadow: none; }
body.clean-screen .space-icon { opacity: .72; }
body.clean-screen .site-footer { display: none; }
body.reduced-motion, body.reduced-motion * { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }

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

@media (max-width: 760px) {
  .game-picker { grid-template-columns: 1fr; }
  .comfort-grid { grid-template-columns: repeat(2,1fr); }
  .game-layout { width: calc(100% - .5rem); padding-top: .5rem; gap: .5rem; }
  .status-panel { grid-template-columns: auto 1fr; }
  .status-panel .button { grid-column: 1 / -1; width: 100%; }
  .ramps-board { gap: 2px; }
  .game-controls { position: sticky; bottom: max(.25rem, env(safe-area-inset-bottom)); z-index: 10; box-shadow: 0 -10px 35px rgb(0 0 0 / .36); }
  .bg-controls { justify-content: center; }
  .backgammon-board { min-height: min(62vh, 610px); grid-template-columns: 45px 1fr 38px 1fr 45px; border-width: 3px; }
  .bg-side-label span { width: 34px; height: 34px; font-size: 1rem; }
  .bg-side-label small { writing-mode: vertical-rl; transform: rotate(180deg); }
  .checker { border-width: 2px; }
  .match-summary { grid-template-columns: 1fr 1fr; }
  .move-sequence { grid-column: 1 / -1; grid-row: 1; }
  .mode-options { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  .home-main { width: min(100% - 1rem, 1180px); }
  .home-intro h1 { font-size: 3rem; }
  .game-copy { padding: 1rem; }
  .comfort-grid { grid-template-columns: 1fr; }
  .game-header { padding-inline: .5rem; }
  .status-panel { padding: .55rem; }
  .turn-avatar { width: 42px; height: 42px; }
  .ramps-shell { padding: 4px; }
  .game-controls { padding: .55rem; }
  .action-button { min-width: 130px; }
  .resource-area { min-width: 100px; }
  .backgammon-board { min-height: 560px; grid-template-columns: 34px 1fr 31px 1fr 34px; }
  .bg-side-label small { display: none; }
  .point-number { display: none; }
  .checker-stack { inset: 12px 1px; }
}
.backgammon-board { grid-template-areas: none; }
.bg-points.top { grid-column: 2 / 5; grid-row: 1; }
.bg-points.bottom { grid-column: 2 / 5; grid-row: 2; }
.bg-bar { grid-column: 3; grid-row: 1 / 3; z-index: 8; }
.blue-label { grid-column: 1; grid-row: 1 / 3; }
.gold-label { grid-column: 5; grid-row: 1 / 3; }
.bg-side-label { cursor: pointer; }

.bg-points { grid-template-columns: repeat(6, minmax(0,1fr)) 54px repeat(6, minmax(0,1fr)); }
.bg-point:nth-child(7) { grid-column: 8; }
.bg-side-label { border: 0; color: inherit; font: inherit; }
.bg-side-label.legal-destination { box-shadow: inset 0 0 0 5px #7cf29d; }
@media (max-width: 760px) { .bg-points { grid-template-columns: repeat(6,minmax(0,1fr)) 38px repeat(6,minmax(0,1fr)); } }
@media (max-width: 430px) { .bg-points { grid-template-columns: repeat(6,minmax(0,1fr)) 31px repeat(6,minmax(0,1fr)); } }
.player-chip > span:nth-child(2) { display: grid; min-width: 0; }
.player-chip > span:nth-child(2) strong,
.player-chip > span:nth-child(2) small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .bg-controls { position: static; box-shadow: none; }
  .backgammon-board { min-height: min(55vh, 520px); }
}
@media (max-width: 430px) {
  .backgammon-board { min-height: 470px; }
}

/* Ramps & Roadblocks — illustrated accessible board */
body[data-page="ramps"] {
  --rr-panel: #0b1730;
  --rr-panel-2: #111f3d;
  --rr-purple: #7b31d8;
  --rr-purple-bright: #a855f7;
  --rr-gold: #ffc83d;
  --rr-cream: #fff1c8;
  --rr-ink: #12233a;
  background:
    radial-gradient(circle at 18% -5%, rgb(133 67 220 / .35), transparent 28rem),
    radial-gradient(circle at 92% 8%, rgb(28 141 224 / .22), transparent 30rem),
    linear-gradient(180deg, #08142b, #030914 82%);
}
body[data-page="ramps"] .game-layout { width: min(1480px, calc(100% - 1.25rem)); }
body[data-page="ramps"] .rr-header { border-bottom-color: rgb(168 85 247 / .3); }
.rr-game-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(275px, 330px); gap: 1rem; align-items: start; }
.rr-board-column { min-width: 0; display: grid; gap: .8rem; }
.rr-control-column { min-width: 0; display: grid; gap: .8rem; position: sticky; top: 86px; }

.rr-status {
  padding: .75rem .9rem;
  background: linear-gradient(135deg, rgb(24 51 91 / .96), rgb(40 22 77 / .96));
  border-color: rgb(172 119 244 / .32);
  box-shadow: 0 12px 28px rgb(0 0 0 / .22);
}
.rr-status-copy { display: grid; gap: .12rem; min-width: 0; }
.rr-progress-track { width: min(420px, 100%); height: 7px; margin-top: .35rem; border-radius: 999px; overflow: hidden; background: rgb(255 255 255 / .12); }
.rr-progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #54db8d, #ffc83d); transition: width calc(.45s * var(--motion)) ease; }
.rr-turn-avatar { padding: 3px; overflow: hidden; background: #111c32 !important; }
.rr-turn-avatar img { width: 100%; height: 100%; object-fit: contain; }

body[data-page="ramps"] .ramps-shell {
  padding: .7rem;
  overflow: hidden;
  background: linear-gradient(145deg, #5e2aa8, #152d54 52%, #0f674e);
  border: 2px solid rgb(255 200 61 / .55);
  box-shadow: 0 22px 60px rgb(0 0 0 / .45), inset 0 0 0 1px rgb(255 255 255 / .13);
}
.rr-board-topline {
  min-height: 55px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .25rem .35rem .65rem;
}
.rr-board-topline > div:first-child { display: grid; }
.rr-board-topline strong { font-size: clamp(.92rem, 1.7vw, 1.18rem); }
.rr-board-topline span { color: #d8e5f4; font-size: .8rem; }
.rr-board-progress {
  flex: none;
  min-width: 84px;
  padding: .45rem .7rem;
  border-radius: 12px;
  color: #211300;
  background: linear-gradient(180deg, #ffe27a, #eaa51d);
  border: 2px solid #fff2ad;
  text-align: center;
  font-weight: 950;
  box-shadow: 0 5px 14px rgb(0 0 0 / .3);
}
body[data-page="ramps"] .ramps-board {
  position: relative;
  display: block;
  width: 100%;
  /* Sized for the 3-row standard board; JS stamps data-rows for the rest. */
  aspect-ratio: 1.9;
  min-height: 250px;
  overflow: hidden;
  border-radius: 16px;
  background: linear-gradient(180deg, #14304a, #0c1f30);
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / .18), inset 0 -80px 120px rgb(2 11 19 / .2);
  isolation: isolate;
}
/* The park illustration has its own painted path baked in; blur it into
   ambience so its tiles/numbers can't ghost between our rows. */
body[data-page="ramps"] .ramps-board::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url('../assets/images/rr-board-park.webp') center / cover no-repeat;
  filter: blur(7px) saturate(.85) brightness(.8);
  transform: scale(1.08);
}
/* Taller layouts only appear for legacy online rooms from older boards. */
body[data-page="ramps"] .ramps-board[data-rows="4"] { aspect-ratio: 2.05; min-height: 348px; }
body[data-page="ramps"] .ramps-board[data-rows="5"] { aspect-ratio: 1.85; min-height: 400px; }
body[data-page="ramps"] .ramps-board[data-rows="6"] { aspect-ratio: 1.58; min-height: 470px; }
/* Wash + vignette over the blurred art (z1, but earlier in DOM order than
   the trail and tiles, so it stays behind both). */
body[data-page="ramps"] .ramps-board::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 45%, transparent 0 60%, rgb(4 14 24 / .12) 86%, rgb(4 10 18 / .36) 100%),
    linear-gradient(180deg, rgb(14 34 50 / .38), rgb(10 26 38 / .46));
}
/* No z-index on the container: each connector stacks on its own, so the
   trail can sit under the tiles (z1) while ramp/roadblock arcs fly over
   them (z3), chutes-and-ladders style. */
.rr-connectors { position: absolute; inset: 0; pointer-events: none; }
.rr-connector {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  width: var(--length);
  height: clamp(9px, 1vw, 15px);
  transform: rotate(var(--angle));
  transform-origin: 0 50%;
  border-radius: 999px;
  opacity: .9;
  filter: drop-shadow(0 5px 4px rgb(0 0 0 / .42));
}
.rr-connector.trail {
  z-index: 1;
  height: clamp(12px, 1.7vw, 22px);
  margin-top: clamp(-11px, -.85vw, -6px);
  background: linear-gradient(180deg, rgb(252 238 199 / .62), rgb(233 205 146 / .48));
  border: 0;
  opacity: 1;
  filter: none;
  box-shadow: 0 0 0 clamp(2px, .3vw, 4px) rgb(250 236 198 / .2);
}
.rr-connector.trail::after { display: none; }
.space-dest {
  position: absolute;
  bottom: 4%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  padding: .06rem .32rem;
  border-radius: 999px;
  font-size: clamp(.5rem, .95vw, .72rem);
  font-weight: 950;
  white-space: nowrap;
  color: #fff;
  background: rgb(9 20 34 / .78);
  box-shadow: 0 1px 3px rgb(0 0 0 / .4);
}
.board-space.special-ramp .space-dest { background: rgb(8 96 50 / .88); }
.board-space.special-roadblock .space-dest { background: rgb(139 38 10 / .88); }
body[data-page="ramps"] .board-space {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--space-w);
  height: var(--space-h);
  min-width: 0;
  z-index: 2;
  transform: rotate(var(--rot));
  border-radius: clamp(7px, .75vw, 13px);
  background: linear-gradient(155deg, #fff9e7 0%, #efd59a 100%);
  border: clamp(1px, .18vw, 3px) solid #fff4c4;
  color: var(--rr-ink);
  box-shadow:
    0 5px 0 #8e6427,
    0 9px 14px rgb(0 0 0 / .35),
    inset 0 0 0 1px rgb(119 76 20 / .22),
    inset 0 6px 10px rgb(255 255 255 / .4);
  overflow: visible;
}
/* One base tile color; only the special tiles carry color. Calm > confetti. */
body[data-page="ramps"] .board-space.special-ramp {
  background: linear-gradient(155deg, #d7ffd7, #4ad881);
  border-color: #eaffdd;
  box-shadow: 0 5px 0 #0d7843, 0 9px 14px rgb(0 0 0 / .38), inset 0 0 0 1px rgb(8 104 55 / .3);
}
body[data-page="ramps"] .board-space.special-roadblock {
  background: linear-gradient(155deg, #ffe8ce, #ff8551);
  border-color: #fff0d6;
  box-shadow: 0 5px 0 #9f2e0d, 0 9px 14px rgb(0 0 0 / .38), inset 0 0 0 1px rgb(129 35 12 / .3);
}
body[data-page="ramps"] .board-space.special-spoon {
  background: linear-gradient(155deg, #fff9b9, #ffc83d);
  border-color: #fff7ba;
  box-shadow: 0 5px 0 #a56500, 0 9px 14px rgb(0 0 0 / .38), inset 0 0 0 1px rgb(127 75 0 / .3);
}
body[data-page="ramps"] .board-space.start { background: linear-gradient(155deg, #d9ceff, #7a4ce1); color: #fff; box-shadow: 0 5px 0 #412381, 0 9px 14px rgb(0 0 0 / .42); }
body[data-page="ramps"] .board-space.finish { background: linear-gradient(155deg, #f4d6ff, #9b46ed); color: #fff; box-shadow: 0 5px 0 #51248d, 0 9px 14px rgb(0 0 0 / .42), 0 0 24px rgb(181 88 255 / .5); }
body[data-page="ramps"] .space-number {
  top: 5%;
  left: 8%;
  font-size: clamp(.56rem, 1.06vw, .82rem);
  font-weight: 950;
  opacity: .92;
  text-shadow: 0 1px 0 rgb(255 255 255 / .45);
}
body[data-page="ramps"] .space-icon { width: 52%; height: 56%; display: grid; place-items: center; }
body[data-page="ramps"] .space-icon img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 2px rgb(0 0 0 / .28)); }
.finish-star { font-size: clamp(1rem, 2.3vw, 2rem); color: #fff8a8; text-shadow: 0 2px 5px #502074; }
.space-label {
  position: absolute;
  left: 50%;
  bottom: -15px;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 7px;
  color: #fff;
  background: #16152b;
  border: 1px solid rgb(255 255 255 / .45);
  font-size: clamp(.4rem, .65vw, .62rem);
  font-weight: 950;
  letter-spacing: .08em;
  box-shadow: 0 3px 7px rgb(0 0 0 / .4);
}
body[data-page="ramps"] .tokens-layer { inset: 18% 4% 3%; z-index: 5; align-items: end; align-content: end; gap: 0; }
body[data-page="ramps"] .rr-token {
  width: clamp(24px, 3.3vw, 46px);
  border: 0;
  background: transparent !important;
  box-shadow: none;
  overflow: visible;
}
body[data-page="ramps"] .rr-token img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 4px rgb(0 0 0 / .55)); }
body[data-page="ramps"] .rr-token.active img { filter: drop-shadow(0 0 4px #fff18a) drop-shadow(0 0 9px #ffe34c) drop-shadow(0 5px 4px rgb(0 0 0 / .55)); transform: translateY(-2px) scale(1.09); }

.rr-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; }
.rr-legend-card {
  min-height: 76px;
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: .65rem;
  padding: .65rem;
  border-radius: 16px;
  color: #fff;
  border: 1px solid rgb(255 255 255 / .18);
  box-shadow: 0 9px 22px rgb(0 0 0 / .23);
}
.rr-legend-card img { width: 48px; height: 48px; object-fit: contain; }
.rr-legend-card span { display: grid; }
.rr-legend-card small { color: rgb(255 255 255 / .78); font-size: .74rem; }
.rr-legend-card.ramp { background: linear-gradient(135deg, #0d6f42, #153d31); }
.rr-legend-card.roadblock { background: linear-gradient(135deg, #9d3112, #3d1c17); }
.rr-legend-card.spoon-card { background: linear-gradient(135deg, #805c08, #322713); }
.rr-legend-card.calm { background: linear-gradient(135deg, #3c2374, #151c3d); }
.rr-calm-icon { width: 45px; height: 45px; display: grid !important; place-items: center; border-radius: 50%; font-size: 2rem; color: #aee7ff; border: 4px solid #3ca9dd; }

body[data-page="ramps"] .rr-controls {
  position: static;
  display: grid;
  gap: .85rem;
  padding: 1rem;
  border-radius: 20px;
  border: 1px solid rgb(171 104 247 / .42);
  background: linear-gradient(180deg, #1d1439, #0b1730 72%);
  box-shadow: 0 16px 40px rgb(0 0 0 / .35);
}
.rr-control-heading { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.rr-control-heading span { color: #cbb9e6; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 900; }
.rr-control-heading strong { font-size: .9rem; text-align: right; }
.rr-dice-area { display: grid; grid-template-columns: 82px 1fr; width: 100%; gap: .75rem; }
body[data-page="ramps"] .rr-die {
  width: 82px;
  border-radius: 19px;
  background: linear-gradient(145deg, #fffef9, #d5dae1);
  border: 3px solid #fff;
  box-shadow: inset -6px -7px 10px rgb(0 0 0 / .16), 0 10px 20px rgb(0 0 0 / .34);
}
.rr-die-pips { width: 58px; height: 58px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 4px; align-items: center; justify-items: center; }
.rr-die-pips b { grid-column: 1 / -1; grid-row: 1 / -1; align-self: center; font-size: 2rem; color: #23324a; }
.rr-die-pips .pip { width: 11px; height: 11px; border-radius: 50%; background: transparent; }
.rr-die-pips .pip.on { background: radial-gradient(circle at 35% 30%, #556274, #0b1422); box-shadow: inset 0 1px 1px rgb(255 255 255 / .18); }
body[data-page="ramps"] .action-button { min-width: 0; width: 100%; min-height: 82px; border-radius: 18px; font-size: 1.2rem; background: linear-gradient(180deg, #8f3fe2, #5220a8); border-color: #bb79f3; box-shadow: 0 9px 20px rgb(85 28 164 / .48), inset 0 1px 0 rgb(255 255 255 / .24); }
.rr-resource-area { min-width: 0; padding: .8rem; border-radius: 16px; background: rgb(255 255 255 / .055); border: 1px solid rgb(255 255 255 / .11); }
.rr-resource-area > div:first-child { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.rr-resource-area > div:first-child span { color: #cfbddf; font-size: .75rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
body[data-page="ramps"] .spoon-meter { margin-top: .45rem; gap: .45rem; }
body[data-page="ramps"] .spoon { width: 38px; height: 52px; opacity: .23; }
body[data-page="ramps"] .spoon::before, body[data-page="ramps"] .spoon::after { display: none; }
body[data-page="ramps"] .spoon img { width: 100%; height: 100%; object-fit: contain; }
body[data-page="ramps"] .spoon.full { opacity: 1; }
.rr-new-game { width: 100%; }

.rr-players-card { padding: .9rem; border-radius: 20px; background: linear-gradient(180deg, #102440, #08152b); border: 1px solid rgb(255 255 255 / .14); box-shadow: 0 16px 40px rgb(0 0 0 / .27); }
.rr-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .65rem; }
.rr-panel-heading h2 { margin: 0; font-size: 1rem; }
.rr-panel-heading span { min-width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; background: #3c2667; color: #fff; font-weight: 950; }
body[data-page="ramps"] .players-panel { display: grid; grid-template-columns: 1fr; gap: .55rem; }
body[data-page="ramps"] .player-chip {
  grid-template-columns: 46px 1fr auto;
  padding: .58rem;
  border-radius: 15px;
  background: linear-gradient(135deg, rgb(255 255 255 / .065), rgb(255 255 255 / .025));
  border-color: rgb(255 255 255 / .13);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .05);
}
body[data-page="ramps"] .player-chip.current { border-color: #ffe66c; box-shadow: inset 0 0 0 2px #ffe66c, 0 5px 15px rgb(0 0 0 / .22); }
body[data-page="ramps"] .player-chip .chip-token { width: 46px; height: 46px; }
.player-chip-copy { gap: .07rem; }
.player-chip-copy small { font-size: .7rem; }
.player-mini-progress { height: 4px; margin-top: .25rem; border-radius: 999px; overflow: hidden; background: rgb(255 255 255 / .1); }
.player-mini-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #58d790, #ffc83d); }
.player-spoons { display: flex; gap: 1px; align-items: center; }
.player-spoons img { width: 15px; height: 24px; object-fit: contain; }

.rr-comfort-note { display: grid; grid-template-columns: auto 1fr; gap: .7rem; align-items: center; padding: .9rem; border-radius: 18px; background: linear-gradient(135deg, #123d36, #0c1b33); border: 1px solid rgb(87 214 141 / .3); }
.rr-comfort-note > div:last-child { display: grid; }
.rr-comfort-note span { color: #c2d3df; font-size: .78rem; }
.rr-comfort-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; color: #092718; background: #74e5a2; font-size: 1.4rem; font-weight: 950; }

body[data-page="ramps"] .event-card { border: 2px solid rgb(255 200 61 / .45); background: linear-gradient(180deg, #2b1850, #0b1a35); }
body[data-page="ramps"] .event-icon { background: linear-gradient(145deg, #8c3edb, #2a174e); border: 2px solid rgb(255 255 255 / .2); }

body.high-contrast[data-page="ramps"] .ramps-board { background: #07120b; box-shadow: inset 0 0 0 3px #fff; }
body.high-contrast[data-page="ramps"] .board-space { background: #fff !important; color: #000 !important; border: 3px solid #000; box-shadow: 0 5px 0 #000; }
body.high-contrast[data-page="ramps"] .board-space.special-ramp { background: #92ff9f !important; }
body.high-contrast[data-page="ramps"] .board-space.special-roadblock { background: #ff9d72 !important; }
body.high-contrast[data-page="ramps"] .board-space.special-spoon { background: #fff25a !important; }
body.high-contrast[data-page="ramps"] .board-space.start, body.high-contrast[data-page="ramps"] .board-space.finish { background: #b783ff !important; color: #000 !important; }
body.clean-screen[data-page="ramps"] .ramps-board { background-image: linear-gradient(#143329, #0d241e); }
body.clean-screen[data-page="ramps"] .rr-connectors { opacity: .62; }

@media (max-width: 1050px) {
  .rr-game-grid { grid-template-columns: 1fr; }
  .rr-control-column { position: static; grid-template-columns: minmax(250px, .85fr) minmax(320px, 1.15fr); align-items: start; }
  .rr-comfort-note { grid-column: 1 / -1; }
  .rr-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body[data-page="ramps"] .game-layout { width: calc(100% - .45rem); }
  .rr-status { grid-template-columns: auto 1fr auto; }
  .rr-status .button { grid-column: auto; width: auto; font-size: .78rem; padding-inline: .65rem; }
  .rr-control-column { grid-template-columns: 1fr; }
  .rr-comfort-note { grid-column: auto; }
  body[data-page="ramps"] .ramps-board { min-height: 0; aspect-ratio: 1.32; background-position: center; }
  body[data-page="ramps"] .ramps-shell { padding: .42rem; }
  .rr-board-topline { min-height: 48px; padding-inline: .2rem; }
  .rr-board-topline span { display: none; }
  .rr-board-progress { min-width: 70px; padding: .35rem .5rem; }
  body[data-page="ramps"] .board-space { border-radius: 7px; box-shadow: 0 3px 0 #8e6427, 0 4px 6px rgb(0 0 0 / .3); }
  body[data-page="ramps"] .board-space.special-ramp { box-shadow: 0 3px 0 #0d7843, 0 4px 6px rgb(0 0 0 / .3); }
  body[data-page="ramps"] .board-space.special-roadblock { box-shadow: 0 3px 0 #9f2e0d, 0 4px 6px rgb(0 0 0 / .3); }
  body[data-page="ramps"] .space-number { top: 2px; left: 4px; font-size: clamp(.43rem, 2.2vw, .65rem); }
  body[data-page="ramps"] .space-icon { width: 58%; height: 58%; }
  body[data-page="ramps"] .rr-token { width: clamp(16px, 7.2vw, 30px); }
  .space-label { bottom: -10px; padding: 1px 4px; font-size: .36rem; }
  .rr-legend-card { min-height: 64px; grid-template-columns: 42px 1fr; padding: .5rem; }
  .rr-legend-card img { width: 39px; height: 39px; }
  body[data-page="ramps"] .rr-controls { position: static; box-shadow: 0 12px 30px rgb(0 0 0 / .3); }
}

@media (max-width: 480px) {
  .rr-status { grid-template-columns: auto 1fr; }
  .rr-status .button { display: none; }
  .rr-progress-track { height: 5px; }
  .rr-board-topline strong { font-size: .8rem; }
  body[data-page="ramps"] .ramps-board { aspect-ratio: 1.18; }
  .rr-legend { grid-template-columns: 1fr 1fr; gap: .4rem; }
  .rr-legend-card { grid-template-columns: 31px 1fr; min-height: 58px; gap: .4rem; border-radius: 13px; }
  .rr-legend-card img { width: 30px; height: 30px; }
  .rr-calm-icon { width: 30px; height: 30px; border-width: 3px; font-size: 1.2rem; }
  .rr-legend-card strong { font-size: .78rem; }
  .rr-legend-card small { font-size: .62rem; }
  .rr-dice-area { grid-template-columns: 72px 1fr; }
  body[data-page="ramps"] .rr-die { width: 72px; }
  body[data-page="ramps"] .action-button { min-height: 72px; }
}
body[data-page="ramps"] .rr-connector.ramp { opacity: .58; }
body[data-page="ramps"] .rr-connector.roadblock { opacity: .28; }
body[data-page="ramps"] .event-icon img { width: 58px; height: 58px; object-fit: contain; }
body[data-page="ramps"] .event-icon span { display: grid; place-items: center; width: 100%; height: 100%; }

/* Ramps start sheet: a quieter, more legible first decision. */
.rr-start-card { width: min(620px, calc(100vw - 1.25rem)); }
.rr-start-hero {
  display: grid;
  justify-items: center;
  gap: .15rem;
  margin: -.15rem 0 .85rem;
  padding: .9rem;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at 15% 10%, rgb(255 221 91 / .25), transparent 8rem),
    linear-gradient(135deg, #183d55, #2d1857 72%);
  border: 1px solid rgb(255 255 255 / .16);
}
.rr-start-hero > strong { margin-top: .4rem; font-size: 1.08rem; }
.rr-start-hero > span { color: #cbd9e8; font-size: .78rem; }
.rr-start-route { width: min(330px, 90%); display: flex; align-items: center; }
.rr-start-route i { height: 6px; flex: 1; margin-inline: -2px; background: linear-gradient(90deg, #f7d98f, #70d39b); box-shadow: 0 2px 5px rgb(0 0 0 / .35); }
.rr-start-route > span { position: relative; z-index: 1; width: 48px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 14px; background: #fff2c7; border: 2px solid #fff8e1; box-shadow: 0 5px 12px rgb(0 0 0 / .3); }
.rr-start-route img { width: 38px; height: 38px; object-fit: contain; }
.rr-start-route .finish-star { color: #6f29c2; font-size: 1.7rem; text-shadow: none; }
.rr-start-card .mode-options { grid-template-columns: 1fr 1fr; gap: .55rem; }
.rr-start-card .mode-options legend { margin-bottom: .5rem; font-weight: 850; }
.rr-start-card .mode-option {
  min-height: 76px;
  grid-template-columns: 42px 1fr 24px;
  align-items: center;
  gap: .65rem;
  padding: .65rem;
  text-align: left;
  border: 2px solid rgb(255 255 255 / .13);
  background: rgb(255 255 255 / .045);
}
.rr-start-card .mode-option > span:nth-child(2) { display: grid; gap: .1rem; }
.rr-start-card .mode-option small { color: #b9c8db; font-size: .72rem; }
.rr-start-card .mode-option.selected { border-color: #ffd95d; background: linear-gradient(135deg, rgb(115 58 190 / .38), rgb(255 200 61 / .1)); box-shadow: inset 0 0 0 1px rgb(255 217 93 / .3); }
.rr-mode-icon { width: 42px; height: 42px; display: grid !important; place-items: center; border-radius: 13px; color: #20133a; background: linear-gradient(145deg, #fff4c9, #d9b8ff); font-size: 1.35rem; font-weight: 950; }
.rr-mode-check { width: 23px; height: 23px; display: grid !important; place-items: center; border-radius: 50%; color: transparent; border: 2px solid rgb(255 255 255 / .28); font-size: .8rem; }
.mode-option.selected .rr-mode-check { color: #17301d; background: #ffe174; border-color: #fff1ac; }
.rr-start-button { width: 100%; min-height: 54px; }

@media (max-width: 760px) {
  /* Keep the only turn decision directly beneath the board on phones. */
  .rr-game-grid, .rr-board-column, .rr-control-column { display: contents; }
  .rr-game-grid { display: grid; }
  .rr-status { order: 1; }
  body[data-page="ramps"] .ramps-shell { order: 2; }
  body[data-page="ramps"] .rr-controls { order: 3; }
  .rr-players-card { order: 4; }
  .rr-legend { order: 5; }
  .rr-comfort-note { order: 6; }
}

@media (max-width: 520px) {
  .rr-start-card { padding: .8rem; }
  .rr-start-card .mode-options { grid-template-columns: 1fr; }
  .rr-start-card .mode-option { min-height: 64px; }
  .rr-start-hero { padding: .7rem; }
  .rr-start-hero > strong { font-size: .95rem; }
}
