/* =========================================================================
   1. VARIABLES
   ========================================================================= */
:root {
  /* Player colors */
  --yellow: #F7D44A;
  --yellow-dark: #EFC537;
  --blue: #69BDF5;
  --blue-dark: #3D93E8;
  --green: #61D73D;
  --green-dark: #3DAF2B;
  --red: #ED5B54;
  --red-dark: #C63E38;

  /* Brighter variants used only for the colored home-column paths */
  --path-red-1: #F2746D;
  --path-red-2: #D8483D;
  --path-green-1: #62D53F;
  --path-green-2: #3BAA2B;
  --path-yellow-1: #FADB6B;
  --path-yellow-2: #F0C93E;
  --path-blue-1: #73C5FF;
  --path-blue-2: #479DEE;

  /* Frame + neutrals */
  --gold-light: #F5E1A0;
  --gold: #D4A94A;
  --bronze: #A9752E;
  --white: #FFFFFF;
  --shadow: rgba(0, 0, 0, .35);
  --highlight: rgba(255, 255, 255, .4);

  /* Background radial gradient (deep purple) */
  --bg-1: #6664A9;
  --bg-2: #555196;
  --bg-3: #403D79;
  --bg-4: #31305F;

  /* Border radii */
  --radius-board: 24px;
  --radius-area: 18px;
  --radius-box: 14px;
  --radius-tile: 2px;
  --radius-btn: 12px;

  /* App chrome (outside the board spec — reused across the rest of the UI
     for a consistent premium-mobile-game feel) */
  --panel: #2f2761;
  --panel-raised: #3a3175;
  --ink: #eef0f3;
  --ink-muted: #b3a8dd;
  --rule: #4c3f92;
  --accent: #f2a71b;
  --board-track: #fbf8f0;
  --banner-h: 54px;
}

/* =========================================================================
   2. RESET
   ========================================================================= */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
button { font-family: inherit; }
.hidden { display: none !important; }

/* =========================================================================
   3. LAYOUT
   ========================================================================= */
body {
  /* Deep purple radial gradient, per spec, with a very subtle speckled
     noise texture layered on top (two faint repeating radial dot-fields). */
  background-image:
    radial-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    radial-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    radial-gradient(ellipse 900px 650px at 50% 0%, var(--bg-1) 0%, transparent 68%),
    radial-gradient(ellipse 1000px 800px at 50% 100%, var(--bg-4) 0%, transparent 62%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg-3) 100%);
  background-size: 70px 70px, 130px 130px, 100% 100%, 100% 100%, 100% 100%;
  background-position: 0 0, 35px 65px, 0 0, 0 0, 0 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  padding-bottom: calc(var(--banner-h) + 8px);
  display: flex;
  flex-direction: column;
}
.screen { flex: 1; display: flex; }
#screen-game { flex-direction: column; padding: 12px 12px 0; }

/* =========================================================================
   4. BOARD (outer golden frame)
   ========================================================================= */
.board-wrap {
  display: flex; justify-content: center; padding: 14px;
  background: radial-gradient(ellipse at 50% 40%, rgba(106,79,196,.28) 0%, transparent 72%);
  border-radius: 20px; margin: 0 0 10px;
}
.board-frame {
  width: min(90vw, 440px);
  padding: 9px;
  border-radius: var(--radius-board);
  /* Top light gold -> middle warm gold -> bottom bronze */
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 48%, var(--bronze) 100%);
  box-shadow:
    0 18px 40px var(--shadow),                     /* outer shadow */
    inset 0 2px 3px var(--highlight),               /* inner highlight */
    inset 0 -6px 10px rgba(0,0,0,.35);              /* inner shadow */
}
.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #d8cca3;
  gap: 1px;
  border-radius: calc(var(--radius-board) - 9px);
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.25);
}

/* =========================================================================
   5. PLAYER AREAS (the 4 colored corners)
   ========================================================================= */
.cell { position: relative; background: var(--board-track); border: 1px solid rgba(0,0,0,.06); border-radius: var(--radius-tile); }

/* Individual base-* cells stay transparent — .base-area below carries the
   actual color/gradient/shadow as one unified rounded panel, not 36 tiles. */
.cell.base-red, .cell.base-green, .cell.base-yellow, .cell.base-blue { background: transparent; border-color: transparent; box-shadow: none; }

.base-area {
  z-index: 1;
  border-radius: var(--radius-area);
  box-shadow:
    inset 0 2px 3px var(--highlight),   /* soft highlight */
    inset 0 -6px 10px rgba(0,0,0,.25),  /* depth */
    0 2px 4px rgba(0,0,0,.2);
}
/* Mostly flat, like the reference — just a subtle darkening toward one corner rather
   than a strong light-to-dark sweep across the whole panel. */
.base-area-yellow { background: linear-gradient(160deg, var(--yellow) 0%, var(--yellow) 72%, var(--yellow-dark) 100%); }
.base-area-blue   { background: linear-gradient(160deg, var(--blue) 0%, var(--blue) 72%, var(--blue-dark) 100%); }
.base-area-green  { background: linear-gradient(160deg, var(--green) 0%, var(--green) 72%, var(--green-dark) 100%); }
.base-area-red    { background: linear-gradient(160deg, var(--red) 0%, var(--red) 72%, var(--red-dark) 100%); }

/* =========================================================================
   6. PATHS (shared track tiles + colored home-column runways)
   ========================================================================= */
.cell {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.9),   /* light bevel */
    inset 0 -1px 0 rgba(0,0,0,.05),       /* tiny shadow */
    inset 0 0 0 1px rgba(255,255,255,.3); /* inset highlight */
}

.home-run { z-index: 1; }
.home-run-red    { background: linear-gradient(180deg, var(--path-red-1), var(--path-red-2)); }
.home-run-green  { background: linear-gradient(180deg, var(--path-green-1), var(--path-green-2)); }
.home-run-yellow { background: linear-gradient(180deg, var(--path-yellow-1), var(--path-yellow-2)); }
.home-run-blue   { background: linear-gradient(180deg, var(--path-blue-1), var(--path-blue-2)); }

/* A solid CSS triangle, not a text glyph — renders as a bold, consistent shape
   regardless of font/browser. Sits directly on the colored home-run entrance cell
   (white, so it reads clearly against any of the four colors), not off in a
   separate plain cell. */
.home-arrow-glyph { position: absolute; z-index: 3; pointer-events: none; }
.home-arrow-glyph-on-run {
  width: 42%; height: 42%; top: 29%; left: 29%;
  background: var(--white);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
}
.home-arrow-glyph-right  { clip-path: polygon(0% 0%, 100% 50%, 0% 100%); }
.home-arrow-glyph-left   { clip-path: polygon(100% 0%, 0% 50%, 100% 100%); }
.home-arrow-glyph-down   { clip-path: polygon(0% 0%, 100% 0%, 50% 100%); }
.home-arrow-glyph-up     { clip-path: polygon(0% 100%, 100% 100%, 50% 0%); }

/* Start square: a star colored to match its own owner (a red star in red's zone, a
   gold star in yellow's, etc.) — confirmed against the reference photos, where each
   color's own arm-start star matches that color, distinct from the plain blue stars
   elsewhere on the track. */
.cell.start-red::after, .cell.start-green::after, .cell.start-yellow::after, .cell.start-blue::after {
  content: "★"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 15px; text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.cell.start-red::after { color: var(--red-dark); }
.cell.start-green::after { color: var(--green-dark); }
.cell.start-yellow::after { color: color-mix(in srgb, var(--yellow-dark) 80%, black); }
.cell.start-blue::after { color: var(--blue-dark); }

/* Power tiles (this game's own bonus mechanic) reuse the reference's second, plain
   blue star style — the surprise is in what it does, not a special icon color. */
.cell.power-tile::after {
  content: "★"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #AEDCFF;
  filter: drop-shadow(0 0 3px rgba(174,220,255,.9));
  animation: star-glow 1.6s ease-in-out infinite;
}
@keyframes star-glow { 0%,100% { opacity: .8; transform: scale(1); } 50% { opacity: 1; transform: scale(1.22); } }
.cell.flash { animation: cell-flash .5s ease; }
@keyframes cell-flash { 0%,100% { filter: none; } 30% { filter: brightness(2.1) saturate(1.4); } }

/* =========================================================================
   7. HOME (die-face box + wells + name tag)
   ========================================================================= */
.base-yard {
  z-index: 1; border-radius: var(--radius-box);
  box-shadow:
    inset 0 4px 8px rgba(0,0,0,.45),      /* pressed-in shadow */
    inset 0 -1px 2px var(--highlight);    /* gloss edge */
}
.base-yard-red    { background: linear-gradient(160deg, rgba(0,0,0,.15), rgba(0,0,0,.4)), var(--red-dark); }
.base-yard-green  { background: linear-gradient(160deg, rgba(0,0,0,.15), rgba(0,0,0,.4)), var(--green-dark); }
.base-yard-yellow { background: linear-gradient(160deg, rgba(0,0,0,.15), rgba(0,0,0,.4)), var(--yellow-dark); }
.base-yard-blue   { background: linear-gradient(160deg, rgba(0,0,0,.15), rgba(0,0,0,.4)), var(--blue-dark); }

/* Home circles: soft transparent brown, inner shadow, small highlight. Sit on the grid-line
   crossing given by BASE_SLOTS (see board-data.js) — board-relative absolute placement, not
   a per-cell decoration, since a crossing point straddles 4 cells rather than centering in one. */
.base-slot-dot {
  position: absolute; z-index: 2; transform: translate(-50%, -50%);
  width: 3.07%; height: 3.07%; border-radius: 50%;
  background: rgba(76, 48, 30, .38);
  box-shadow: inset 0 2px 3px rgba(0,0,0,.45), inset 0 -1px 1px var(--highlight);
  pointer-events: none;
}

.base-label { z-index: 4; display: flex; padding: 3%; pointer-events: none; }
.base-label-top { align-items: flex-start; }
.base-label-bottom { align-items: flex-end; }
/* Counter-rotation target (see render.js's renderBaseLabels) — the outer .base-label handles
   top/bottom edge placement (recomputed per-rotation), this inner piece keeps the text upright. */
.base-label-inner { display: flex; }
.base-label-name, .base-label-level {
  background: rgba(20,14,40,.72); color: #fff; font-weight: 700;
  font-size: 11px; padding: 2px 7px; line-height: 1.5; white-space: nowrap;
}
.base-label-level { border-radius: 5px 0 0 5px; }
.base-label-name { border-radius: 0 5px 5px 0; margin-left: 1px; }
.base-label:not(:has(.base-label-level)) .base-label-name { border-radius: 5px; }
.base-label-red .base-label-level { background: var(--red-dark); }
.base-label-green .base-label-level { background: var(--green-dark); }
.base-label-yellow .base-label-level { background: color-mix(in srgb, var(--yellow-dark) 75%, black); }
.base-label-blue .base-label-level { background: var(--blue-dark); }

/* =========================================================================
   8. CENTER (four raised gradient triangles)
   ========================================================================= */
.cell.center { background: #2a2050; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); }
.center-triangle { z-index: 2; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.center-triangle-left  { clip-path: polygon(0% 0%, 0% 100%, 50% 50%); }
.center-triangle-right { clip-path: polygon(100% 0%, 100% 100%, 50% 50%); }
.center-triangle-top   { clip-path: polygon(0% 0%, 100% 0%, 50% 50%); }
.center-triangle-bottom{ clip-path: polygon(0% 100%, 100% 100%, 50% 50%); }
.center-triangle-red    { background: linear-gradient(135deg, var(--path-red-1), var(--red-dark)); }
.center-triangle-green  { background: linear-gradient(135deg, var(--path-green-1), var(--green-dark)); }
.center-triangle-yellow { background: linear-gradient(135deg, var(--path-yellow-1), var(--yellow-dark)); }
.center-triangle-blue   { background: linear-gradient(135deg, var(--path-blue-1), var(--blue-dark)); }

/* =========================================================================
   9. PAWNS
   ========================================================================= */
.token {
  position: absolute; cursor: pointer; z-index: 2;
  filter: drop-shadow(0 5px 10px rgba(0,0,0,.3));
}
/* Counter-rotation target for a rotated board (see render.js's createTokenEl) — kept separate
   from .token itself so it never fights the outer element's own transform (base-slot
   centering, hop-bounce, pulse). */
.token-inner { width: 100%; height: 100%; position: relative; }
/* fill/stroke are inherited SVG properties, so they must be set on the <svg>/<use>
   itself — classes on shapes *inside* a <symbol> aren't reachable by outside CSS
   selectors once cloned through a <use>. */
.pawn-svg {
  width: 100%; height: 100%; overflow: visible; display: block;
  stroke: rgba(0,0,0,.45); stroke-width: 1.5; stroke-linejoin: round;
}
.token.color-red .pawn-svg { fill: url(#grad-red); }
.token.color-green .pawn-svg { fill: url(#grad-green); }
.token.color-yellow .pawn-svg { fill: url(#grad-yellow); }
.token.color-blue .pawn-svg { fill: url(#grad-blue); }

.shield-badge {
  display: none; position: absolute; top: -8%; right: -8%; font-size: 46%;
  background: #fff; border-radius: 50%; padding: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.token.shielded .shield-badge { display: block; }
.token.shielded .pawn-svg { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 5px #fff); }

.token.movable { animation: pulse 1s infinite; cursor: pointer; z-index: 3; }
.token:not(.movable) { cursor: default; }
.token.hopping { animation: hop-bounce .16s ease-out; z-index: 4; }
@keyframes pulse { 0%,100% { transform: scale(1) translateY(0); } 50% { transform: scale(1.1) translateY(-6%); } }
@keyframes hop-bounce {
  0% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-42%) scale(0.96, 1.08); }
  100% { transform: translateY(0) scale(1); }
}

/* =========================================================================
   10. RESPONSIVE
   ========================================================================= */
@media (min-width: 700px) {
  .home-inner { padding-top: 64px; }
  .board-frame { width: min(60vw, 520px); }
}
@media (max-width: 360px) {
  .board-frame { padding: 6px; }
}

/* =========================================================================
   11. APP CHROME — everything outside the board itself (home screen, lobby,
   controls, modals, shop). Not covered by the board spec above, but built to
   match its variables/radii/shadow language for a consistent whole.
   ========================================================================= */
.home-inner { max-width: 420px; margin: 0 auto; padding: 40px 20px 20px; width: 100%; }
.logo { font-size: 40px; font-weight: 800; text-align: center; margin: 0 0 6px; letter-spacing: -0.02em; }
.tagline { text-align: center; color: var(--ink-muted); margin: 0 0 28px; font-size: 14.5px; }

.home-card { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 20px; }
.field { display: block; margin-bottom: 16px; }
.field span, .field-label { display: block; font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 9px; border: 1px solid var(--rule);
  background: var(--panel-raised); color: var(--ink); font-size: 16px;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn { border: none; border-radius: var(--radius-btn); padding: 13px 18px; font-size: 15px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 14px rgba(0,0,0,.25); }
.btn-primary { background: linear-gradient(180deg, var(--gold-light), var(--gold)); color: #241a04; }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary { background: var(--panel-raised); color: var(--ink); border: 1px solid var(--rule); box-shadow: none; }
.btn-text { background: transparent; color: var(--ink-muted); font-weight: 600; padding: 10px; box-shadow: none; }
.btn-block { width: 100%; display: block; }
.btn-small { padding: 8px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.mode-tabs { display: flex; gap: 6px; margin-bottom: 18px; background: var(--panel-raised); border-radius: 10px; padding: 4px; }
.mode-tab { flex: 1; background: transparent; border: none; color: var(--ink-muted); padding: 10px 8px; border-radius: 7px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.mode-tab.active { background: var(--accent); color: #241a04; }

.divider { text-align: center; color: var(--ink-muted); font-size: 12px; margin: 14px 0; position: relative; }
.divider span { background: var(--panel); padding: 0 10px; position: relative; z-index: 1; }
.divider::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--rule); }

.local-player-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.local-player-row { display: flex; align-items: center; gap: 10px; background: var(--panel-raised); border: 1px solid var(--rule); border-radius: 9px; padding: 9px 12px; }
.local-player-row .swatch { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.local-player-row .label { flex: 1; font-size: 14px; font-weight: 600; }
.local-player-row select { background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: 6px 8px; font-size: 13px; }

.error-text { color: var(--red); font-size: 13px; margin-top: 10px; }

.room-code-display { font-family: ui-monospace, Consolas, monospace; letter-spacing: .12em; background: var(--panel-raised); padding: 3px 10px; border-radius: 6px; }
.lobby-player-list { list-style: none; padding: 0; margin: 20px 0; display: flex; flex-direction: column; gap: 8px; }
.lobby-player-list li { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--rule); border-radius: 9px; padding: 10px 14px; font-size: 14.5px; font-weight: 600; }
.lobby-player-list .swatch { width: 12px; height: 12px; border-radius: 50%; }

.game-topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 480px; margin: 0 auto; width: 100%; margin-bottom: 10px; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.icon-btn { background: transparent; border: none; color: var(--ink-muted); font-size: 17px; padding: 6px; cursor: pointer; line-height: 1; }
.player-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--rule); border-radius: 100px; padding: 5px 10px 5px 6px; font-size: 12px; font-weight: 700; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.chip.active-turn { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.chip .finished-count { color: var(--ink-muted); font-weight: 500; }

.game-controls { max-width: 480px; margin: 0 auto; width: 100%; padding-bottom: 10px; }
/* Dice anchored bottom-left (matching the player's own board corner after per-viewer
   rotation — see app.js's currentBoardRotation), turn info alongside it. Leaves the row's
   right side, and the space below, clear for the ad banner / future features. */
.game-controls-row { display: flex; align-items: center; gap: 14px; }
.game-controls-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.turn-indicator { font-size: 14px; font-weight: 700; }

/* Idle-timer indicator: a radial "pie" countdown inscribed inside the dice face — a full
   green circle at the start of the turn, sweeping away clockwise (conic-gradient, driven
   by app.js's startTurnTimerIfNeeded) like a clock hand as the 10s runs out, rather than
   just fading in place. A round inset (not a full-square fill) so the dice's own corners
   stay visibly cream-colored even at full time — it reads as a clock face on the dice,
   not a flat color wash. Fixed, constant opacity: depletion is conveyed by the shrinking
   wedge shape itself, not by fading. */
.dice-wrap { position: relative; flex-shrink: 0; }
.dice-timer-ring {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 52px; height: 52px; border-radius: 50%;
  opacity: 0.65;
  z-index: 0; pointer-events: none;
}
.dice {
  position: relative;
  width: 66px; height: 66px; border-radius: 16px; cursor: pointer;
  background: #fbf8f0; border: none; box-shadow: 0 4px 0 #c9bd97, 0 6px 14px rgba(0,0,0,.25);
  padding: 9px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  gap: 2px;
}
.dice:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #c9bd97, 0 2px 6px rgba(0,0,0,.3); }
.dice:disabled { opacity: .45; cursor: not-allowed; }
.dice .pip { position: relative; z-index: 1; border-radius: 50%; background: transparent; align-self: center; justify-self: center; width: 100%; height: 100%; }
.dice .pip.on { background: #241a04; }
.dice.rolling { animation: dice-shake .5s ease; }
@keyframes dice-shake {
  0%, 100% { transform: rotate(0) scale(1); }
  20% { transform: rotate(-14deg) scale(1.05); }
  40% { transform: rotate(12deg) scale(1.05); }
  60% { transform: rotate(-10deg) scale(1.05); }
  80% { transform: rotate(8deg) scale(1.05); }
}
.message-strip { min-height: 18px; font-size: 13px; color: var(--ink-muted); text-align: left; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-card { background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; padding: 26px; max-width: 340px; width: 100%; text-align: center; }
.modal-card h2 { margin: 0 0 8px; }
.modal-card p { color: var(--ink-muted); margin: 0 0 20px; }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%);
  background: var(--panel-raised); border: 1px solid var(--accent); color: var(--ink);
  padding: 10px 16px; border-radius: 10px; font-size: 13.5px; font-weight: 700; z-index: 60;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}

.ad-banner {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--banner-h);
  background: #0c0e11; border-top: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: center; z-index: 40;
}
.ad-banner-placeholder { color: var(--ink-muted); font-size: 11px; padding: 0 12px; text-align: center; }

.field-hint { font-size: 12px; color: var(--ink-muted); margin: -4px 0 14px; }

.profile-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 22px; }
.profile-level { display: flex; align-items: center; gap: 8px; flex: 1; }
.level-badge {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #241a04;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex-shrink: 0;
}
.xp-track { flex: 1; height: 7px; border-radius: 100px; background: var(--panel-raised); border: 1px solid var(--rule); overflow: hidden; max-width: 140px; }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #ffd873); width: 0%; transition: width .4s ease; }
.coin-pill {
  display: flex; align-items: center; gap: 5px; background: var(--panel-raised); border: 1px solid var(--rule);
  border-radius: 100px; padding: 6px 10px; color: var(--ink); font-weight: 800; font-size: 13.5px; cursor: pointer;
}
.coin-pill.small { padding: 4px 9px; font-size: 12px; cursor: default; }
.coin-pill .coin-icon { font-size: 13px; }
.coin-pill .plus { color: var(--accent); font-size: 15px; margin-left: 2px; }

.mode-cards { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.mode-card {
  text-align: left; background: var(--panel-raised); border: 2px solid var(--rule); border-radius: 11px;
  padding: 12px 14px; cursor: pointer; color: var(--ink);
}
.mode-card.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel-raised)); }
.mode-card .mode-name { font-weight: 800; font-size: 14.5px; margin-bottom: 3px; }
.mode-card .mode-blurb { font-size: 12.5px; color: var(--ink-muted); line-height: 1.4; }

.bet-chips { display: flex; gap: 8px; margin-bottom: 18px; }
.bet-chip {
  flex: 1; background: var(--panel-raised); border: 2px solid var(--rule); border-radius: 9px;
  padding: 9px 4px; text-align: center; font-weight: 800; font-size: 13px; color: var(--ink); cursor: pointer;
}
.bet-chip.selected { border-color: var(--accent); color: var(--accent); }
.bet-chip:disabled { opacity: .35; cursor: not-allowed; }

.stepper-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.stepper { display: flex; align-items: center; gap: 10px; background: var(--panel-raised); border: 1px solid var(--rule); border-radius: 9px; padding: 4px 6px; }
.stepper-btn { width: 26px; height: 26px; border-radius: 6px; border: none; background: var(--panel); color: var(--ink); font-size: 16px; font-weight: 800; cursor: pointer; }
#stepper-value { min-width: 16px; text-align: center; font-weight: 800; }

.result-badge { font-size: 44px; margin-bottom: 6px; }
.result-rewards { background: var(--panel-raised); border: 1px solid var(--rule); border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; }
.reward-row { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; padding: 4px 0; }
.reward-row span:last-child { color: var(--accent); }
.level-up-banner { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); border-radius: 8px; padding: 8px; font-weight: 800; font-size: 13px; margin: -6px 0 14px; }

.shop-ad-btn { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.shop-reward { color: var(--accent); font-weight: 800; }
.shop-packages { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.shop-package {
  display: flex; align-items: center; justify-content: space-between; background: var(--panel-raised);
  border: 1px solid var(--rule); border-radius: 9px; padding: 10px 14px; cursor: pointer; color: var(--ink);
}
.shop-package .pkg-coins { font-weight: 800; font-size: 14px; }
.shop-package .pkg-price { color: var(--ink-muted); font-size: 13px; font-weight: 700; }
.shop-package.best { border-color: var(--accent); }

/* =========================================================================
   BOOT / LOADING SCREEN (Facebook Instant Games + web)
   ========================================================================= */
.boot-loader {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(120% 120% at 50% 30%, var(--bg-1), var(--bg-3) 60%, var(--bg-4));
  transition: opacity .35s ease, visibility .35s ease;
}
.boot-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; display: flex; }
.boot-logo {
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  font-weight: 700; font-size: 44px; letter-spacing: .5px; color: var(--white);
  text-shadow: 0 3px 0 var(--bronze), 0 6px 16px rgba(0, 0, 0, .4);
}
.boot-track {
  width: 220px; max-width: 60vw; height: 8px; border-radius: 100px;
  background: rgba(0, 0, 0, .28); overflow: hidden; border: 1px solid rgba(255, 255, 255, .15);
}
.boot-fill {
  height: 100%; width: 8%;
  background: linear-gradient(90deg, var(--gold-light), var(--gold));
  border-radius: 100px; transition: width .2s ease;
}
.boot-hint { color: var(--ink-muted); font-size: 13px; font-weight: 600; }
