/* ==========================================================================
   ROYAL GAMES — design tokens
   ========================================================================== */
:root{
  --ink-950:#0a0d18;
  --ink-900:#11142a;
  --ink-850:#161a35;
  --ink-800:#1b2040;
  --ink-700:#232a4d;
  --violet-deep:#241a4a;

  --gold:#d9b76a;
  --gold-light:#f4dfa8;
  --gold-deep:#a9822f;
  --gold-line: linear-gradient(135deg, #f4dfa8, #d9b76a 45%, #a9822f);

  --ruby:#ef4f63;
  --ruby-deep:#a52338;
  --emerald:#31c48d;
  --emerald-deep:#187a53;
  --sapphire:#4f8ef7;
  --sapphire-deep:#2857b0;
  --topaz:#f2b705;
  --topaz-deep:#b4820a;

  --ink-text:#f3f0ea;
  --ink-text-dim:#b9bad0;
  --ink-text-faint:#7b7d99;

  --glass: rgba(255,255,255,0.045);
  --glass-strong: rgba(255,255,255,0.08);
  --glass-border: rgba(244,223,168,0.14);

  --radius-lg: 26px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --font-display: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'URW Palladio L', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

  --shadow-deep: 0 24px 60px -20px rgba(0,0,0,0.65);
  --shadow-soft: 0 10px 30px -12px rgba(0,0,0,0.5);
}

*{ box-sizing:border-box; -webkit-tap-highlight-color: transparent; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: var(--font-body);
  background: var(--ink-950);
  color: var(--ink-text);
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
}
button{ font-family:inherit; cursor:pointer; }
ul{ margin:0; padding:0; }
h1,h2,h3{ margin:0; }
p{ margin:0; }

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:0.001ms !important; animation-iteration-count:1 !important; transition-duration:0.001ms !important; }
}

::selection{ background: var(--gold); color:#241a05; }

/* ==========================================================================
   Stage / Screen system
   ========================================================================== */
.stage{
  position:relative;
  min-height:100dvh;
  max-width:560px;
  margin:0 auto;
  background:
    radial-gradient(1200px 800px at 50% -10%, rgba(217,183,106,0.08), transparent 60%),
    var(--ink-950);
  overflow:hidden;
}

.screen{
  display:none;
  min-height:100dvh;
  flex-direction:column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  animation: screenIn 0.42s cubic-bezier(.2,.8,.2,1);
}
.screen.active{ display:flex; }

@keyframes screenIn{
  from{ opacity:0; transform: translateY(10px) scale(0.994); }
  to{ opacity:1; transform:none; }
}

/* ==========================================================================
   HOME
   ========================================================================== */
#screen-home{ position:relative; padding-bottom:28px; }

.home-bg{ position:absolute; inset:0; z-index:0; pointer-events:none; }
.glow{ position:absolute; border-radius:50%; filter:blur(70px); opacity:0.55; }
.glow-a{ width:340px; height:340px; background: radial-gradient(circle, rgba(217,183,106,0.35), transparent 70%); top:-120px; left:-80px; }
.glow-b{ width:380px; height:380px; background: radial-gradient(circle, rgba(79,142,247,0.22), transparent 70%); bottom:-140px; right:-100px; }
.constellation{
  position:absolute; inset:0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(244,223,168,0.5), transparent 60%),
    radial-gradient(1.5px 1.5px at 70% 18%, rgba(244,223,168,0.4), transparent 60%),
    radial-gradient(1px 1px at 85% 55%, rgba(244,223,168,0.35), transparent 60%),
    radial-gradient(1px 1px at 40% 70%, rgba(244,223,168,0.3), transparent 60%),
    radial-gradient(1.5px 1.5px at 10% 80%, rgba(244,223,168,0.35), transparent 60%);
}

.home-header{ position:relative; z-index:1; text-align:center; padding: 48px 28px 8px; }
.crest{ width:76px; margin:0 auto 14px; filter: drop-shadow(0 8px 18px rgba(217,183,106,0.25)); }
.crest-svg{ width:100%; height:auto; }
.crest-crown{ fill: url(#none); fill: var(--gold); }
.crest-band{ fill: var(--gold-deep); }
.crest-gem{ fill: var(--ruby); }

.eyebrow{
  font-family: var(--font-mono);
  font-size:11px; letter-spacing:0.28em; text-transform:uppercase;
  color: var(--gold-light); opacity:0.85; margin-bottom:10px;
}
.home-title{
  font-family: var(--font-display);
  font-weight:700;
  font-size: clamp(38px, 11vw, 54px);
  letter-spacing:0.02em;
  color: var(--ink-text);
  line-height:1.05;
}
.home-title span{
  background: var(--gold-line);
  -webkit-background-clip:text; background-clip:text; color:transparent;
}
.home-sub{ margin-top:12px; color: var(--ink-text-dim); font-size:14.5px; max-width:320px; margin-inline:auto; }

.game-picker{ position:relative; z-index:1; padding: 22px 20px 8px; display:flex; flex-direction:column; gap:16px; flex:1; }

.game-card{
  position:relative;
  text-align:left;
  border:1px solid var(--glass-border);
  background: linear-gradient(160deg, var(--glass-strong), var(--glass));
  border-radius: var(--radius-lg);
  padding:18px 18px 20px;
  display:grid;
  grid-template-columns: 78px 1fr;
  grid-template-rows:auto auto;
  column-gap:16px;
  color: inherit;
  box-shadow: var(--shadow-soft);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  overflow:hidden;
}
.game-card::before{
  content:""; position:absolute; inset:0; border-radius:inherit; padding:1px;
  background: linear-gradient(160deg, rgba(244,223,168,0.35), transparent 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events:none;
}
.game-card:active{ transform: scale(0.978); }

.game-card-art{ grid-row: 1 / 3; display:flex; align-items:center; justify-content:center; }
.mini-board{
  width:64px; height:64px; border-radius:16px; overflow:hidden;
  display:grid; grid-template-columns:1fr 1fr; grid-template-rows:1fr 1fr;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), var(--shadow-soft);
}
.mb-red{ background: linear-gradient(160deg, var(--ruby), var(--ruby-deep)); }
.mb-green{ background: linear-gradient(160deg, var(--emerald), var(--emerald-deep)); }
.mb-yellow{ background: linear-gradient(160deg, var(--topaz), var(--topaz-deep)); }
.mb-blue{ background: linear-gradient(160deg, var(--sapphire), var(--sapphire-deep)); }

.mini-snl{ width:64px; height:64px; border-radius:16px; background: linear-gradient(160deg, var(--ink-700), var(--ink-900)); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08), var(--shadow-soft); }
.mini-snl-svg{ width:100%; height:100%; }
.mini-snake{ fill:none; stroke: var(--emerald); stroke-width:4; stroke-linecap:round; }
.mini-ladder-rail{ stroke: var(--gold); stroke-width:3; }
.mini-ladder-rung{ stroke: var(--gold-deep); stroke-width:2.4; }

.game-card-body{ align-self:center; }
.game-card-eyebrow{ font-family: var(--font-mono); font-size:10.5px; letter-spacing:0.16em; text-transform:uppercase; color: var(--gold-light); opacity:0.8; }
.game-card-body h2{ font-family: var(--font-display); font-size:23px; margin:3px 0 4px; }
.game-card-body p{ font-size:12.8px; color: var(--ink-text-dim); line-height:1.45; }

.game-card-cta{
  grid-column: 1 / 3;
  margin-top:14px; padding-top:14px;
  border-top:1px solid rgba(255,255,255,0.08);
  font-size:13px; font-weight:700; color: var(--gold-light);
  display:flex; align-items:center; justify-content:space-between;
}
.game-card-cta i{ font-style:normal; }

.home-footer{ position:relative; z-index:1; display:flex; flex-direction:column; align-items:center; gap:10px; padding: 10px 24px 4px; }
.home-footer-note{ font-size:11px; color: var(--ink-text-faint); letter-spacing:0.02em; text-align:center; }

.ghost-btn{
  border:1px solid var(--glass-border);
  background: var(--glass);
  color: var(--ink-text);
  border-radius:999px;
  padding:11px 22px;
  font-weight:700; font-size:13.5px;
  transition: background .2s ease, transform .2s ease;
}
.ghost-btn:active{ transform: scale(0.96); }

/* ==========================================================================
   Buttons shared
   ========================================================================== */
.primary-btn{
  border:none; border-radius:999px;
  background: var(--gold-line);
  color:#241a05;
  font-weight:800; font-size:15px;
  padding:15px 22px;
  box-shadow: 0 12px 30px -10px rgba(217,183,106,0.55);
  transition: transform .2s ease, box-shadow .2s ease;
}
.primary-btn:active{ transform: scale(0.975); box-shadow: 0 6px 18px -8px rgba(217,183,106,0.5); }
.primary-btn:disabled{ opacity:0.45; box-shadow:none; }

.icon-btn{
  width:40px; height:40px; border-radius:50%;
  border:1px solid var(--glass-border);
  background: var(--glass-strong);
  color: var(--ink-text);
  font-size:17px; display:flex; align-items:center; justify-content:center;
}
.back-btn{
  border:none; background:none; color: var(--ink-text-dim);
  font-size:20px; padding:6px 10px; margin: 14px 0 0 6px; align-self:flex-start;
  border-radius:50%;
}

/* ==========================================================================
   SETUP screen
   ========================================================================== */
.setup-wrap{ padding: 4px 24px 28px; display:flex; flex-direction:column; gap:22px; flex:1; }
.setup-title{ font-family: var(--font-display); font-size:30px; margin-top:6px; }
.setup-sub{ color: var(--ink-text-dim); font-size:13.5px; margin-top:-12px; }
.setup-label{ font-family: var(--font-mono); font-size:11px; letter-spacing:0.16em; text-transform:uppercase; color: var(--gold-light); margin-bottom:10px; }
.setup-block{ display:flex; flex-direction:column; }

.count-toggle{ display:flex; gap:10px; }
.count-toggle button{
  flex:1; padding:13px 0; border-radius:14px;
  border:1px solid var(--glass-border); background: var(--glass);
  color: var(--ink-text); font-weight:700; font-size:16px;
  transition: all .2s ease;
}
.count-toggle button.active{
  background: var(--gold-line); color:#241a05; border-color:transparent;
  box-shadow: 0 10px 24px -10px rgba(217,183,106,0.55);
}

.seat-list{ display:flex; flex-direction:column; gap:10px; }
.seat-row{
  display:flex; align-items:center; gap:12px;
  border:1px solid var(--glass-border); background: var(--glass);
  border-radius:16px; padding:10px 14px;
}
.seat-swatch{ width:30px; height:30px; border-radius:10px; flex-shrink:0; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15); }
.seat-input{
  flex:1; background:none; border:none; color: var(--ink-text);
  font-family: var(--font-body); font-weight:600; font-size:14.5px; outline:none;
}
.seat-tag{ font-family: var(--font-mono); font-size:10.5px; color: var(--ink-text-faint); text-transform:uppercase; letter-spacing:0.08em; }

.setup-wrap .primary-btn{ margin-top:auto; }

/* ==========================================================================
   Game screen shared (topbar, HUD, board stage)
   ========================================================================== */
.game-topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 16px;
}
.turn-banner{
  display:flex; align-items:center; gap:8px;
  background: var(--glass-strong); border:1px solid var(--glass-border);
  border-radius:999px; padding:8px 16px;
  font-weight:700; font-size:13px;
  max-width:70%;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.turn-dot{ width:10px; height:10px; border-radius:50%; flex-shrink:0; box-shadow: 0 0 0 3px rgba(255,255,255,0.06); }

.board-stage{
  flex:1; display:flex; align-items:center; justify-content:center;
  padding: 4px 14px;
  min-height:0;
}

.game-hud{ padding: 6px 16px calc(18px + env(safe-area-inset-bottom)); display:flex; flex-direction:column; gap:14px; }
.players-strip{ display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; scrollbar-width:none; }
.players-strip::-webkit-scrollbar{ display:none; }

.player-chip{
  flex:0 0 auto; display:flex; align-items:center; gap:8px;
  padding:8px 12px; border-radius:14px;
  background: var(--glass); border:1px solid var(--glass-border);
  font-size:12px; font-weight:700; color: var(--ink-text-dim);
  transition: all .25s ease; position:relative;
}
.player-chip.is-turn{
  color: var(--ink-text); background: var(--glass-strong);
  box-shadow: 0 0 0 1.5px var(--chip-color, var(--gold)), 0 8px 20px -8px rgba(0,0,0,0.5);
}
.player-chip .chip-dot{ width:9px; height:9px; border-radius:50%; background: var(--chip-color, var(--gold)); flex-shrink:0; }
.player-chip .chip-progress{ font-family: var(--font-mono); font-size:10.5px; color: var(--ink-text-faint); }
.player-chip.is-done{ opacity:0.55; }

.dice-dock{ display:flex; flex-direction:column; align-items:center; gap:8px; }
.die{
  width:64px; height:64px; border-radius:18px; perspective: 400px;
  background: linear-gradient(160deg, #fdf9f0, #e7dcc0);
  box-shadow: 0 14px 30px -10px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(255,255,255,0.6);
  display:flex; align-items:center; justify-content:center;
  transition: transform .12s ease;
}
.die:active{ transform: scale(0.94); }
.die.disabled{ opacity:0.45; pointer-events:none; }
.die-face{
  font-family: var(--font-mono); font-weight:700; font-size:26px; color:#241a05;
}
.die.rolling .die-face{ animation: dieSpin 0.55s steps(6); }
@keyframes dieSpin{
  0%{ transform: rotateX(0) rotateY(0); }
  100%{ transform: rotateX(360deg) rotateY(360deg); }
}
.dice-hint{ font-size:11.5px; color: var(--ink-text-faint); font-weight:600; letter-spacing:0.02em; }

/* toast layer for capture/six/etc. notices */
.toast-layer{ position:absolute; left:0; right:0; top:64px; display:flex; justify-content:center; pointer-events:none; z-index:20; }
.toast{
  background: rgba(15,17,32,0.92); border:1px solid var(--glass-border);
  color: var(--ink-text); font-size:12.5px; font-weight:700;
  padding:9px 16px; border-radius:999px; box-shadow: var(--shadow-soft);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 1.6s forwards;
}
@keyframes toastIn{ from{ opacity:0; transform:translateY(-8px);} to{ opacity:1; transform:none; } }
@keyframes toastOut{ to{ opacity:0; transform:translateY(-8px); } }

/* ==========================================================================
   Win overlay
   ========================================================================== */
.win-overlay{
  position:fixed; inset:0; z-index:100; display:none;
  align-items:center; justify-content:center;
  background: rgba(5,6,14,0.72); backdrop-filter: blur(6px);
  padding:24px;
}
.win-overlay.active{ display:flex; }
.win-card{
  width:100%; max-width:340px; text-align:center;
  background: linear-gradient(160deg, var(--ink-850), var(--ink-950));
  border:1px solid var(--glass-border); border-radius: var(--radius-lg);
  padding:32px 24px 26px; box-shadow: var(--shadow-deep);
  animation: winPop 0.45s cubic-bezier(.2,.9,.25,1.2);
}
@keyframes winPop{ from{ opacity:0; transform: scale(0.85) translateY(10px);} to{ opacity:1; transform:none; } }
.win-crown{ font-size:44px; filter: drop-shadow(0 6px 14px rgba(217,183,106,0.4)); }
.win-eyebrow{ font-family: var(--font-mono); font-size:11px; letter-spacing:0.24em; text-transform:uppercase; color: var(--gold-light); margin:8px 0 6px; }
#win-title{ font-family: var(--font-display); font-size:26px; margin-bottom:22px; }
.win-actions{ display:flex; flex-direction:column; gap:10px; }

/* ==========================================================================
   How-to modal
   ========================================================================== */
.modal-overlay{
  position:fixed; inset:0; z-index:100; display:none;
  align-items:flex-end; justify-content:center;
  background: rgba(5,6,14,0.65); backdrop-filter: blur(4px);
}
.modal-overlay.active{ display:flex; }
.modal-card{
  width:100%; max-width:560px; max-height:78vh;
  background: linear-gradient(180deg, var(--ink-900), var(--ink-950));
  border:1px solid var(--glass-border); border-top-left-radius:26px; border-top-right-radius:26px;
  padding:20px 22px calc(24px + env(safe-area-inset-bottom));
  position:relative; box-shadow: var(--shadow-deep);
  animation: modalUp 0.35s cubic-bezier(.2,.8,.2,1);
  display:flex; flex-direction:column;
}
@keyframes modalUp{ from{ transform: translateY(30px); opacity:0;} to{ transform:none; opacity:1; } }
.modal-close{
  position:absolute; top:14px; right:16px; width:32px; height:32px; border-radius:50%;
  border:1px solid var(--glass-border); background: var(--glass-strong); color: var(--ink-text);
}
.modal-tabs{ display:flex; gap:8px; margin: 6px 0 16px; }
.modal-tab{
  flex:1; padding:10px 0; border-radius:12px; border:1px solid var(--glass-border);
  background: var(--glass); color: var(--ink-text-dim); font-weight:700; font-size:13px;
}
.modal-tab.active{ background: var(--gold-line); color:#241a05; border-color:transparent; }
.modal-body{ overflow-y:auto; }
.modal-pane{ display:none; }
.modal-pane.active{ display:block; }
.modal-pane ul{ list-style:none; display:flex; flex-direction:column; gap:12px; }
.modal-pane li{
  position:relative; padding-left:20px; font-size:13.5px; line-height:1.55; color: var(--ink-text-dim);
}
.modal-pane li::before{ content:"◆"; position:absolute; left:0; top:1px; color: var(--gold); font-size:9px; }
.modal-pane b{ color: var(--ink-text); }

/* ==========================================================================
   LUDO BOARD
   ========================================================================== */
.ludo-board{
  position:relative;
  width:100%; max-width:460px; aspect-ratio:1/1;
  border-radius:18px;
  background: linear-gradient(160deg, var(--ink-850), var(--ink-950));
  box-shadow: var(--shadow-deep), inset 0 0 0 1px rgba(244,223,168,0.18);
  padding:8px;
}
.ludo-grid{ width:100%; height:100%; border-radius:12px; overflow:hidden; position:relative; }
.lcell{ position:relative; box-shadow: inset 0 0 0 0.5px rgba(255,255,255,0.05); }

.lcell-yard{ background: var(--ink-900); }
.lcell-yard-red{ background: linear-gradient(160deg, rgba(239,79,99,0.16), rgba(239,79,99,0.05)); }
.lcell-yard-green{ background: linear-gradient(160deg, rgba(49,196,141,0.16), rgba(49,196,141,0.05)); }
.lcell-yard-yellow{ background: linear-gradient(160deg, rgba(242,183,5,0.16), rgba(242,183,5,0.05)); }
.lcell-yard-blue{ background: linear-gradient(160deg, rgba(79,142,247,0.16), rgba(79,142,247,0.05)); }

.lyard-house{
  position:relative; border-radius:14%;
  background: rgba(0,0,0,0.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.lyard-house-red{ box-shadow: inset 0 0 0 2px rgba(239,79,99,0.4); }
.lyard-house-green{ box-shadow: inset 0 0 0 2px rgba(49,196,141,0.4); }
.lyard-house-yellow{ box-shadow: inset 0 0 0 2px rgba(242,183,5,0.4); }
.lyard-house-blue{ box-shadow: inset 0 0 0 2px rgba(79,142,247,0.4); }

.lyard-slot{
  position:relative; align-self:center; justify-self:center;
  width:60%; height:60%; border-radius:50%;
  background: rgba(0,0,0,0.28);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.14);
}
.lyard-slot-red{ box-shadow: inset 0 0 0 1.5px rgba(239,79,99,0.55); }
.lyard-slot-green{ box-shadow: inset 0 0 0 1.5px rgba(49,196,141,0.55); }
.lyard-slot-yellow{ box-shadow: inset 0 0 0 1.5px rgba(242,183,5,0.55); }
.lyard-slot-blue{ box-shadow: inset 0 0 0 1.5px rgba(79,142,247,0.55); }

.lcell-loop{ background: linear-gradient(160deg, #f4dfa8, #e2c785); }
.lcell-safe::after{
  content:"★"; position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-size:60%; color: rgba(41,29,10,0.55);
}
.lcell-start-red{ background: linear-gradient(160deg, var(--ruby), var(--ruby-deep)); }
.lcell-start-green{ background: linear-gradient(160deg, var(--emerald), var(--emerald-deep)); }
.lcell-start-yellow{ background: linear-gradient(160deg, var(--topaz), var(--topaz-deep)); }
.lcell-start-blue{ background: linear-gradient(160deg, var(--sapphire), var(--sapphire-deep)); }
.lcell-start-red::after,.lcell-start-green::after,.lcell-start-yellow::after,.lcell-start-blue::after{ color: rgba(255,255,255,0.75); }

.lcell-home-red{ background: linear-gradient(160deg, var(--ruby), var(--ruby-deep)); }
.lcell-home-green{ background: linear-gradient(160deg, var(--emerald), var(--emerald-deep)); }
.lcell-home-yellow{ background: linear-gradient(160deg, var(--topaz), var(--topaz-deep)); }
.lcell-home-blue{ background: linear-gradient(160deg, var(--sapphire), var(--sapphire-deep)); }

.lcell-blank{ background: var(--ink-950); }
.lcell-center{ background:transparent; }

.lhub-crest{ position:relative; z-index:2; }
.lhub-crest svg{ width:100%; height:100%; }
.lhub-diamond-outer{ fill: var(--ink-950); }
.lhub-tri{ opacity:0.92; }
.lhub-tri-red{ fill: var(--ruby); }
.lhub-tri-green{ fill: var(--emerald); }
.lhub-tri-yellow{ fill: var(--topaz); }
.lhub-tri-blue{ fill: var(--sapphire); }
.lhub-gem{ fill: var(--gold-light); stroke: var(--gold-deep); stroke-width:1.5; }

.ltoken-layer{ position:absolute; inset:8px; pointer-events:none; }
.ltoken{
  position:absolute; pointer-events:auto;
  display:flex; align-items:center; justify-content:center;
  transition: left .38s cubic-bezier(.3,.7,.3,1.15), top .38s cubic-bezier(.3,.7,.3,1.15), transform .2s ease;
  z-index:5;
}
.ltoken-gem{
  width:64%; height:64%; border-radius:50% 50% 50% 6%;
  transform: rotate(45deg);
  box-shadow: 0 4px 8px -2px rgba(0,0,0,0.6), inset 0 2px 3px rgba(255,255,255,0.5), inset 0 -3px 4px rgba(0,0,0,0.25);
}
.ltoken-red .ltoken-gem{ background: linear-gradient(160deg, #ff8a97, var(--ruby) 55%, var(--ruby-deep)); }
.ltoken-green .ltoken-gem{ background: linear-gradient(160deg, #7fe7bd, var(--emerald) 55%, var(--emerald-deep)); }
.ltoken-yellow .ltoken-gem{ background: linear-gradient(160deg, #ffe066, var(--topaz) 55%, var(--topaz-deep)); }
.ltoken-blue .ltoken-gem{ background: linear-gradient(160deg, #9dc2ff, var(--sapphire) 55%, var(--sapphire-deep)); }

.ltoken-movable{ animation: tokenPulse 1s ease-in-out infinite; z-index:6; }
@keyframes tokenPulse{
  0%,100%{ filter: drop-shadow(0 0 0 rgba(244,223,168,0)); transform: translateY(0); }
  50%{ filter: drop-shadow(0 0 8px rgba(244,223,168,0.85)); transform: translateY(-6%); }
}
.ltoken-home{ opacity:0.92; }

/* ==========================================================================
   SNAKES & LADDERS BOARD
   ========================================================================== */
.snake-board{
  position:relative;
  width:100%; max-width:460px; aspect-ratio:1/1;
  border-radius:18px;
  background: linear-gradient(160deg, var(--ink-850), var(--ink-950));
  box-shadow: var(--shadow-deep), inset 0 0 0 1px rgba(244,223,168,0.18);
  padding:8px;
}
.snl-grid{
  width:100%; height:100%; border-radius:12px; overflow:hidden;
  display:grid; grid-template-columns: repeat(10, 1fr); grid-template-rows: repeat(10, 1fr);
  position:relative;
}
.scell{
  position:relative; display:flex; align-items:flex-end; justify-content:flex-start;
  font-family: var(--font-mono); font-size:9px; color: rgba(20,14,4,0.42); font-weight:700;
  padding:3px 0 0 4px;
}
.scell-a{ background: linear-gradient(160deg, #efe0bd, #e2cf9f); }
.scell-b{ background: linear-gradient(160deg, #e6d3ab, #d8c28c); }
.scell-final{ background: var(--gold-line); color:#241a05; }
.scell-final::after{ content:"👑"; position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:130%; padding-bottom:8px; }

.snl-overlay-svg{ position:absolute; inset:8px; width:calc(100% - 16px); height:calc(100% - 16px); pointer-events:none; z-index:3; }
.snake-path{ fill:none; stroke-linecap:round; }
.ladder-rail{ stroke-linecap:round; }

.stoken-layer{ position:absolute; inset:8px; pointer-events:none; z-index:5; }
.stoken{
  position:absolute; display:flex; align-items:center; justify-content:center;
  transition: left .5s cubic-bezier(.3,.6,.25,1.1), top .5s cubic-bezier(.3,.6,.25,1.1);
}
.stoken-gem{
  width:60%; height:60%; border-radius:50%;
  box-shadow: 0 4px 8px -2px rgba(0,0,0,0.6), inset 0 2px 3px rgba(255,255,255,0.55), inset 0 -3px 4px rgba(0,0,0,0.25);
}
.stoken-red .stoken-gem{ background: linear-gradient(160deg, #ff8a97, var(--ruby) 55%, var(--ruby-deep)); }
.stoken-green .stoken-gem{ background: linear-gradient(160deg, #7fe7bd, var(--emerald) 55%, var(--emerald-deep)); }
.stoken-yellow .stoken-gem{ background: linear-gradient(160deg, #ffe066, var(--topaz) 55%, var(--topaz-deep)); }
.stoken-blue .stoken-gem{ background: linear-gradient(160deg, #9dc2ff, var(--sapphire) 55%, var(--sapphire-deep)); }

/* ==========================================================================
   Footer button row (home screen)
   ========================================================================== */
.footer-row{ display:flex; gap:10px; }
.footer-row .ghost-btn{ flex:1; }

/* ==========================================================================
   ONLINE LOBBY
   ========================================================================== */
.online-config-warning{
  background: rgba(239,79,99,0.1); border:1px solid rgba(239,79,99,0.35);
  border-radius:14px; padding:12px 14px; font-size:12.5px; line-height:1.5; color: var(--ink-text-dim);
}
.online-config-warning b{ color: var(--ink-text); }
.online-config-warning code{ background: rgba(255,255,255,0.08); padding:1px 5px; border-radius:5px; font-family: var(--font-mono); font-size:11.5px; }

.online-choice{ display:flex; flex-direction:column; gap:12px; }
.online-tile{
  display:flex; flex-direction:column; align-items:flex-start; gap:4px;
  border:1px solid var(--glass-border); background: var(--glass);
  border-radius: var(--radius-md); padding:16px 18px; text-align:left; color: inherit;
  transition: transform .2s ease, background .2s ease;
}
.online-tile:active{ transform: scale(0.98); }
.online-tile-icon{ font-size:22px; margin-bottom:2px; }
.online-tile-title{ font-weight:800; font-size:15px; }
.online-tile-sub{ font-size:12.5px; color: var(--ink-text-dim); }

.online-panel{ display:flex; flex-direction:column; gap:4px; }
.online-error{ color: var(--ruby); font-size:12.5px; margin-top:8px; min-height:1em; }

.room-code-display{ text-align:center; margin-bottom:6px; }
.room-code-big{
  font-family: var(--font-mono); font-size:40px; font-weight:700; letter-spacing:0.18em;
  color: var(--gold-light); margin:6px 0;
}
.online-share-hint{ font-size:12px; color: var(--ink-text-faint); }

.lobby-seats{ display:flex; flex-direction:column; gap:8px; margin: 14px 0 20px; }
.lobby-seat{
  display:flex; align-items:center; gap:10px;
  border:1px solid var(--glass-border); background: var(--glass);
  border-radius:14px; padding:10px 14px; font-size:13.5px; color: var(--ink-text-faint); font-weight:600;
}
.lobby-seat.is-filled{ color: var(--ink-text); background: var(--glass-strong); }
.lobby-seat-dot{ width:10px; height:10px; border-radius:50%; flex-shrink:0; }

/* ==========================================================================
   HALL OF FAME / STATS
   ========================================================================== */
.stats-list{ display:flex; flex-direction:column; gap:8px; flex:1; }
.stats-empty{ color: var(--ink-text-dim); font-size:13.5px; text-align:center; margin-top:30px; }
.stats-row{
  display:flex; align-items:center; gap:10px;
  border:1px solid var(--glass-border); background: var(--glass);
  border-radius:14px; padding:11px 14px;
}
.stats-rank{ font-family: var(--font-mono); font-size:12px; color: var(--ink-text-faint); width:16px; }
.stats-dot{ width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.stats-name{ flex:1; font-weight:700; font-size:14px; }
.stats-wins{ font-family: var(--font-mono); font-size:12px; color: var(--gold-light); font-weight:700; }

@media (min-width:560px){
  .stage{ margin-top:2vh; min-height:96dvh; border-radius:32px; box-shadow: var(--shadow-deep); border:1px solid var(--glass-border); }
}
