/* Snakes & Ladders: Mob Edition. Same back-room look as Guess the Mobster: wood panels, lamp light, gold and blood red. */
:root {
  --ink: #0d0a08; --wall: #1a120c; --paper: #f1e7d0; --paper2: #e3d4b0; --gold: #d2a54a; --gold2: #f0d28a; --blood: #a3241c;
  --display: "Oswald", "Arial Narrow", Impact, sans-serif; --type: "Special Elite", "Courier New", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: #efe6d2; font-family: var(--sans); }
body { overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
a { color: var(--gold2); }
[hidden] { display: none !important; }

.room { min-height: 100dvh; padding-bottom: env(safe-area-inset-bottom);
  background:
    radial-gradient(ellipse 70% 40% at 50% -5%, rgba(255,214,140,.26), transparent 70%),
    repeating-linear-gradient(90deg, #1d140d 0 46px, #170f09 46px 48px, #21170f 48px 94px, #170f09 94px 96px),
    var(--wall); }

.top { display: flex; align-items: center; justify-content: space-between; padding: max(12px, env(safe-area-inset-top)) 16px 8px; max-width: 980px; margin: 0 auto; }
.brand { font-family: var(--display); text-transform: uppercase; letter-spacing: .16em; font-size: 12px; color: var(--gold); text-decoration: none; }
.top-btns { display: flex; gap: 8px; }
.icon { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(210,165,74,.45); background: rgba(0,0,0,.35); color: var(--paper); font-family: var(--display); font-size: 16px; display: flex; align-items: center; justify-content: center; }

main { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* --- setup --- */
.setup { text-align: center; padding: 10px 0 8px; }
.kicker { font-family: var(--type); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #b9a98b; margin: 8px 0 0; }
h1 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(44px, 11vw, 88px); line-height: .95; margin: 8px 0 0; color: var(--gold2);
  text-shadow: 0 3px 0 #6b4425, 0 10px 30px rgba(0,0,0,.6); letter-spacing: .02em; }
h1 span { color: var(--blood); text-shadow: 0 3px 0 #3a0c08; font-size: .62em; vertical-align: .12em; }
.edition { font-family: var(--type); font-size: 18px; color: var(--paper); margin: 6px 0 0; letter-spacing: .1em; }
.sub { max-width: 520px; margin: 12px auto 18px; color: #d8ccb2; line-height: 1.5; font-size: 15px; }
.sub b { color: #ff8a7e; font-weight: 600; }

.panel { background: linear-gradient(180deg, rgba(31,22,15,.94), rgba(18,13,9,.96)); border: 1px solid rgba(210,165,74,.28); border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04); }
.panel-h { font-family: var(--display); font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-size: 13px; margin: 0 0 8px; }
.setup-card { max-width: 440px; margin: 0 auto; padding: 16px; text-align: left; }
.tabs { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.tab { font-family: var(--display); text-transform: uppercase; letter-spacing: .1em; font-size: 13px; padding: .55em 1em; border-radius: 999px; color: #b9a98b; background: rgba(0,0,0,.3); border: 1px solid rgba(210,165,74,.25); }
.tab[aria-selected="true"] { background: var(--gold); color: #1d1206; border-color: var(--gold); }
.players { display: grid; gap: 8px; }
.prow { display: flex; align-items: center; gap: 10px; }
.prow input { flex: 1; min-width: 0; background: var(--paper); color: #1d1611; border: 0; border-radius: 8px; padding: 10px 12px; font-family: var(--type); font-size: 16px; }
.prow .fixed { flex: 1; font-family: var(--type); font-size: 16px; color: var(--paper); padding: 10px 0; }
.prow .rm { width: 32px; height: 32px; border-radius: 50%; background: transparent; color: #b9a98b; border: 1px solid rgba(210,165,74,.3); }
.setup-actions { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.setup-actions .btn-gold { margin-left: auto; }
.resume { width: 100%; margin-top: 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; font-family: var(--display); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; border-radius: 10px; padding: .8em 1.3em; font-size: 15px; border: 0; transition: transform .12s, filter .12s; text-decoration: none; }
.btn:active { transform: translateY(2px); }
.btn.small { font-size: 12.5px; padding: .6em 1em; }
.btn-gold { background: linear-gradient(180deg, #f2cf7a, #c8952f); color: #1d1206; box-shadow: 0 4px 0 #7a5413, 0 8px 18px rgba(0,0,0,.4); }
.btn-red { background: linear-gradient(180deg, #d0392f, #92201a); color: #fff; box-shadow: 0 4px 0 #5a120e, 0 8px 18px rgba(0,0,0,.4); }
.btn-ghost { background: rgba(0,0,0,.3); border: 1px solid rgba(210,165,74,.45); color: #f1e7d0; }

/* --- tokens --- */
.tok { --c: #c8322a; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex: 0 0 auto;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 60%, #fff), var(--c) 55%, color-mix(in srgb, var(--c) 60%, #000));
  box-shadow: 0 2px 0 rgba(0,0,0,.5), 0 0 0 2px rgba(255,255,255,.75); }

/* --- game --- */
.game { padding-top: 4px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.hud { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.hud .pl { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: rgba(0,0,0,.4); border: 1px solid rgba(210,165,74,.25); font-family: var(--display); font-size: 13px; letter-spacing: .04em; opacity: .65; transition: opacity .2s, border-color .2s; }
.hud .pl .tok { width: 22px; height: 22px; font-size: 12px; }
.hud .pl.on { opacity: 1; border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 16px rgba(210,165,74,.3); }
.hud .pl small { color: #b9a98b; font-family: var(--type); font-size: 11px; }

.board-wrap { width: 100%; max-width: min(640px, calc(100dvh - 210px)); min-width: min(100%, 320px); margin: 0 auto; padding: 8px; border-radius: 14px;
  background: linear-gradient(180deg, #6b4425, #3a2312); box-shadow: 0 0 0 2px #2a190c, 0 24px 50px rgba(0,0,0,.6); }
.board { position: relative; aspect-ratio: 1; width: 100%; border-radius: 6px; overflow: hidden; }
.squares { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(10, 1fr); grid-template-rows: repeat(10, 1fr); }
.sq { position: relative; display: flex; align-items: flex-start; justify-content: flex-start; padding: 2px 3px; font-family: var(--type); font-size: clamp(7px, 1.6vw, 11px); color: #4a3a28; line-height: 1;
  background: var(--paper); box-shadow: inset 0 0 0 .5px rgba(80,55,30,.35); }
.sq.alt { background: var(--paper2); }
.sq.r { background: #e8c9b8; } .sq.r.alt { background: #dcb8a5; }
.sq.g { background: #d9dcb8; } .sq.g.alt { background: #cbd0a6; }
.sq.end { background: linear-gradient(135deg, #f2cf7a, #c8952f); color: #1d1206; font-weight: 700; }
.sq.end::after { content: "THE TOP"; position: absolute; inset: auto 0 3px; text-align: center; font-family: var(--display); font-size: clamp(6px, 1.3vw, 9px); letter-spacing: .08em; }
.sq.start::after { content: "START"; position: absolute; inset: auto 0 3px; text-align: center; font-family: var(--display); font-size: clamp(6px, 1.3vw, 9px); letter-spacing: .08em; color: #6b4425; }
.overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.faces { position: absolute; inset: 0; pointer-events: none; }
.mface { position: absolute; width: 6.4%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; overflow: hidden; border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,.5); background: #2a2018; }
.mface.snake { border-color: #ff6a5c; } .mface.ladder { border-color: var(--gold2); }
.mface img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.4) contrast(1.1); display: block; }
.tokens { position: absolute; inset: 0; pointer-events: none; }
.tokens .tok { position: absolute; width: 7%; height: 7%; font-size: clamp(9px, 2.4vw, 16px); transform: translate(-50%, -50%); transition: left .16s ease-out, top .16s ease-out; z-index: 2; }
.tokens .tok.slide { transition: left .9s cubic-bezier(.45,0,.25,1), top .9s cubic-bezier(.45,0,.25,1); }
.tokens .tok.hop { animation: hop .16s ease-out; }
@keyframes hop { 50% { transform: translate(-50%, -78%); } }
.tokens .tok.on { z-index: 3; box-shadow: 0 2px 0 rgba(0,0,0,.5), 0 0 0 2px #fff, 0 0 0 4px var(--gold2); }

.controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; max-width: 640px; width: 100%; margin: 0 auto; }
.turn { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 14px; background: var(--gold); box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.status { margin: 0; font-family: var(--type); font-size: 15px; line-height: 1.35; }
.die { width: 66px; height: 66px; flex: 0 0 66px; border-radius: 14px; border: 0; background: linear-gradient(160deg, #fffaf0, #e6d8b8); box-shadow: 0 5px 0 #8a6a3a, 0 10px 20px rgba(0,0,0,.5); padding: 9px; transition: transform .1s; }
.die:disabled { opacity: .55; cursor: default; }
.die:not(:disabled) { animation: nudge 2.2s ease-in-out infinite; }
@keyframes nudge { 0%, 80%, 100% { transform: none } 85% { transform: rotate(-8deg) } 90% { transform: rotate(7deg) } 95% { transform: rotate(-3deg) } }
.die.rolling { animation: roll .5s linear; }
@keyframes roll { 0% { transform: rotate(0) scale(1) } 50% { transform: rotate(200deg) scale(1.12) } 100% { transform: rotate(360deg) scale(1) } }
.pips { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 100%; height: 100%; }
.pips i { width: 10px; height: 10px; margin: auto; border-radius: 50%; background: var(--blood); box-shadow: inset 0 1px 1px rgba(0,0,0,.5); visibility: hidden; }
.pips i.v { visibility: visible; }

.ledger { padding: 12px 14px; max-width: 640px; width: 100%; margin: 0 auto; }
.log { list-style: none; margin: 0; padding: 0; max-height: 132px; overflow-y: auto; font-size: 13.5px; line-height: 1.4; color: #d8ccb2; display: flex; flex-direction: column-reverse; }
.log li { padding: 3px 0; border-top: 1px solid rgba(210,165,74,.12); }
.log li .s { color: #ff8a7e; } .log li .l { color: var(--gold2); }
.game-foot { text-align: center; }

/* --- cards (modal) --- */
.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(5,3,2,.72); backdrop-filter: blur(3px); }
.sheet { width: 100%; max-width: 400px; max-height: calc(100dvh - 32px); overflow-y: auto; animation: pop .35s cubic-bezier(.2,1.3,.4,1); }
@keyframes pop { from { transform: scale(.9) rotate(-2deg); opacity: 0 } to { transform: none; opacity: 1 } }
.card { position: relative; background: linear-gradient(180deg, #fbf7ee, #e9dfc8); color: #241a12; border-radius: 12px; padding: 18px; box-shadow: 0 20px 50px rgba(0,0,0,.6); }
.card .tag { display: inline-block; font-family: var(--display); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; font-size: 13px; padding: 4px 10px; border: 2px solid currentColor; border-radius: 4px; transform: rotate(-3deg); }
.card.snake .tag { color: var(--blood); } .card.ladder .tag { color: #8a5d12; }
.card .who { display: flex; gap: 14px; align-items: center; margin: 14px 0 10px; }
.card .who img { width: 86px; height: 86px; border-radius: 6px; object-fit: cover; filter: sepia(.4) contrast(1.1); box-shadow: 0 0 0 4px #fff, 0 4px 10px rgba(0,0,0,.35); transform: rotate(-2deg); flex: 0 0 auto; }
.card.snake .who img { filter: grayscale(1) contrast(1.15); }
.card h2 { font-family: var(--display); text-transform: uppercase; font-size: 24px; line-height: 1; margin: 0; }
.card .nick { font-family: var(--type); font-size: 13px; color: #7a6248; margin: 4px 0 0; }
.card .move { font-family: var(--type); font-size: 13px; margin: 6px 0 0; color: #5a4632; }
.card .head { font-family: var(--display); font-size: 17px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; margin: 6px 0 6px; line-height: 1.2; }
.card p.txt { font-size: 15px; line-height: 1.5; margin: 0; }
.card .fate { margin-top: 12px; padding: 10px 12px; border-left: 4px solid var(--blood); background: rgba(163,36,28,.08); font-family: var(--type); font-size: 13.5px; line-height: 1.45; }
.card.ladder .fate { border-color: #8a5d12; background: rgba(138,93,18,.08); }
.card .fate b { font-family: var(--display); letter-spacing: .1em; text-transform: uppercase; font-size: 11px; display: block; margin-bottom: 2px; }
.card .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.card .by { font-family: var(--type); font-size: 12px; color: #7a6248; margin: 10px 0 0; }
.card.win { text-align: center; }
.card.win .big { font-family: var(--display); font-size: 40px; text-transform: uppercase; line-height: 1; margin: 10px 0 4px; color: #8a5d12; }
.tally { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0; }
.tally div { background: #241a12; color: var(--paper); border-radius: 8px; padding: 8px 4px; }
.tally b { display: block; font-family: var(--display); font-size: 28px; color: var(--gold2); line-height: 1; }
.tally div.r b { color: #ff8a7e; }
.tally span { font-size: 11px; line-height: 1.25; display: block; margin-top: 4px; }
.rules { text-align: left; }
.rules ul { padding-left: 18px; margin: 10px 0 0; font-size: 14.5px; line-height: 1.5; }

.foot { text-align: center; font-size: 12px; color: #9a8b70; padding: 12px 0 28px; max-width: 620px; margin: 0 auto; line-height: 1.5; }

@media (min-width: 900px) {
  .game { grid-template-columns: minmax(0, 1fr) 280px; grid-template-areas: "hud hud" "board side1" "board side2" "board foot"; align-items: start; }
  .hud { grid-area: hud; }
  .board-wrap { grid-area: board; }
  .controls { grid-area: side1; flex-direction: column; align-items: stretch; }
  .controls .die { align-self: center; }
  .ledger { grid-area: side2; }
  .ledger .log { max-height: 300px; }
  .game-foot { grid-area: foot; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.card a { color: #8a5d12; font-weight: 600; }
.card .btn-ghost { background: transparent; color: #241a12; border-color: rgba(36,26,18,.45); }

/* --- the 3D table --- */
.stage { position: relative; width: calc(100% + 32px); margin: 0 -16px; height: min(66dvh, 640px, 122vw); min-height: 360px; background: #0b0806; overflow: hidden; }
.stage .c3d { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.stage .c3d:active { cursor: grabbing; }
.stage .hint { position: absolute; left: 0; right: 0; bottom: 8px; margin: 0; text-align: center; font-family: var(--type); font-size: 11.5px; color: rgba(241,231,208,.55); pointer-events: none; animation: hintfade 6s 2s forwards; }
@keyframes hintfade { to { opacity: 0 } }
.loading { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: radial-gradient(ellipse at 50% 20%, #2a1c10, #0b0806 70%); }
.loading p { margin: 0; font-family: var(--type); color: var(--paper); font-size: 15px; }
.lbar { width: 200px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.lbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #c8952f, #f2cf7a); transition: width .3s; }
.game-foot { display: flex; gap: 8px; justify-content: center; }
@media (min-width: 900px) {
  .stage { grid-area: board; width: 100%; margin: 0; height: calc(100dvh - 150px); min-height: 540px; max-height: 820px; border-radius: 14px; box-shadow: 0 0 0 2px #2a190c, 0 24px 50px rgba(0,0,0,.6); }
}
.age { font-family: var(--type); font-size: 12px; color: #9a8b70; margin: -8px 0 16px; }
