:root {
  --blue: #1D5BBF;
  --blue-dk: #154696;
  --navy: #22308C;
  --cell: #F6F9FF;
  --slot: #2D6FD6;
  --mid: #DCE8FA;
  --orange: #F47A1F;
  --sun: #FFD43B;
  --wood: #C98E58;
  --wood-dk: #A8713F;
  --ink: #23170E;
  --paper: #FFFDF7;
  --muted: #6E6253;
  --line: rgba(35, 23, 14, .12);
  --yellow: #F7C51E;
  --purple: #7B3FB8;
  --green: #2E9E44;
  --red: #E03131;
  --r: 16px;
  --board: 600px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Nunito', 'Trebuchet MS', system-ui, sans-serif;
  font-weight: 700;
  color: var(--ink);
  background-color: var(--wood);
  background-image:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 160px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .04) 0 1px, transparent 1px 7px),
    linear-gradient(90deg, #C68B55, #D29A64 40%, #C3864F 70%, #CF9660);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }
h1, h2, h3, .display { font-family: 'Lilita One', 'Arial Black', sans-serif; font-weight: 400; letter-spacing: .01em; }

/* ---------- wordmark ---------- */
.wordmark { margin: 0; font-size: clamp(3.2rem, 13vw, 6.4rem); line-height: .9; display: flex; flex-wrap: wrap; justify-content: center; transform: rotate(-3deg); }
.wordmark span { color: var(--sun); -webkit-text-stroke: 3px var(--orange); paint-order: stroke fill; text-shadow: 0 5px 0 var(--orange), 0 9px 0 rgba(0, 0, 0, .25); }
.mini-mark { font-family: 'Lilita One', sans-serif; color: var(--sun); -webkit-text-stroke: 1.5px var(--orange); paint-order: stroke fill; font-size: 1.5rem; text-shadow: 0 2px 0 var(--orange); }

/* ---------- buttons ---------- */
.btn { border: 0; border-radius: 12px; padding: 9px 18px; font-weight: 900; background: #fff; color: var(--ink); box-shadow: 0 3px 0 rgba(0, 0, 0, .25), inset 0 0 0 2px var(--line); transition: transform .06s; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .25), inset 0 0 0 2px var(--line); }
.btn.primary { background: var(--sun); box-shadow: 0 4px 0 #D9902B; }
.btn.blue { background: var(--blue); color: #fff; box-shadow: 0 4px 0 #0E3577; }
.btn.danger { background: #FF8787; box-shadow: 0 4px 0 #C92A2A; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.btn.big { width: 100%; padding: 13px; font-size: 1.15rem; }
.btn.small { padding: 5px 12px; font-size: .9rem; border-radius: 10px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: rgba(255, 253, 247, .9); box-shadow: 0 3px 0 rgba(0, 0, 0, .25); position: relative; font-size: 1.05rem; }
.badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: .7rem; font-style: normal; line-height: 18px; padding: 0 4px; }
label { display: block; font-weight: 800; font-size: .95rem; margin-bottom: 12px; }
input:not([type=checkbox]), select { display: block; width: 100%; margin-top: 4px; padding: 10px 13px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-size: 1.05rem; }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-weight: 900; }
.error { color: #C92A2A; min-height: 1.3em; margin: 10px 0 0; }
.fine { font-size: .85rem; color: var(--muted); margin: 12px 0 0; }

/* ---------- home ---------- */
#app { height: 100%; }
.screen { height: 100%; }
.home { height: 100%; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 7vh 16px 30px; }
.tag { max-width: 420px; text-align: center; color: #fff; font-size: 1.1rem; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); margin: 22px 0; }
.home-card { width: 100%; max-width: 400px; background: var(--paper); border-radius: 20px; padding: 20px; box-shadow: 0 10px 0 rgba(0, 0, 0, .18), 0 0 0 6px var(--blue); }
.tabs { display: flex; background: var(--mid); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tab { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 9px; font-weight: 900; color: var(--blue-dk); }
.tab.active { background: var(--blue); color: #fff; }
.home-ings { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 30px; max-width: 520px; }
.home-ings .tile { width: 52px; height: 52px; }

/* ---------- room ---------- */
#screen-room { display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; padding-top: max(8px, env(safe-area-inset-top)); }
.code-chip { border: 0; background: var(--navy); color: #fff; border-radius: 10px; padding: 6px 12px; font-weight: 800; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.code-chip b { letter-spacing: .14em; margin-left: 4px; color: var(--sun); }
.turn-banner { flex: 1; text-align: center; font-family: 'Lilita One', sans-serif; font-size: 1.25rem; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; }
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px 1fr 320px; gap: 14px; padding: 0 14px 14px; }
.layout.lobby-mode { grid-template-columns: 1fr 320px; }
.layout.lobby-mode .cards-col { display: none; }

/* provision cards */
.cards-col { display: flex; flex-direction: column; gap: 12px; overflow: auto; min-height: 0; padding-top: 10px; }
.pcard { background: var(--navy); border-radius: 14px; padding: 8px; color: #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .25); position: relative; transition: transform .2s; }
.pcard.turn { box-shadow: 0 0 0 4px #fff, 0 6px 0 rgba(0, 0, 0, .25); transform: translateY(-2px); }
.pcard.out { opacity: .5; }
.pcard .head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pcard .bun-sq { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; flex: none; position: relative; }
.pcard .bun-sq .hat { width: 28px; height: 28px; }
.pcard .who { flex: 1; min-width: 0; line-height: 1.1; }
.pcard .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 1rem; }
.pcard .who small { color: #B9C3F2; font-size: .78rem; }
.pcard .count { font-family: 'Lilita One', sans-serif; font-size: 1.5rem; }
.pcard .count small { font-size: .9rem; opacity: .7; }
.pcard .slots { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; background: #fff; border-radius: 8px; padding: 4px; }
.slot { aspect-ratio: 1; border-radius: 5px; background: #fff; display: grid; place-items: center; position: relative; box-shadow: inset 0 0 0 1px #C9D3EE; }
.slot svg { width: 100%; height: 100%; }
.slot.empty svg { filter: grayscale(1) contrast(.5) brightness(1.35); opacity: .6; }
.slot.got { background: #FFF4D6; box-shadow: inset 0 0 0 1px #F1C76B; }
.slot.got.pop svg { animation: pop .6s cubic-bezier(.3, 1.6, .5, 1); }
.slot.bunslot.empty::after { content: '🔒'; position: absolute; font-size: .55rem; bottom: -2px; right: -2px; }
.pcard .team-tag { position: absolute; top: -8px; right: 10px; font-size: .7rem; font-weight: 900; padding: 1px 8px; border-radius: 999px; background: #fff; color: var(--navy); }
.pcard .timer-ring { position: absolute; inset: -4px; border-radius: 17px; pointer-events: none; }
.seat-yellow { background: var(--yellow); } .seat-purple { background: var(--purple); } .seat-green { background: var(--green); } .seat-red { background: var(--red); }

/* centre */
.centre { position: relative; min-height: 0; min-width: 0; display: flex; flex-direction: column; }
.game { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.board-wrap { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
.board {
  width: var(--board); height: var(--board); position: relative; background: var(--blue); border-radius: 14px; padding: 2.2%;
  box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--blue-dk), 0 14px 0 rgba(0, 0, 0, .22);
}
.track { position: absolute; inset: 2.2%; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(7, 1fr); gap: .6%; }
.sq { background: var(--cell); border-radius: 7%; display: grid; place-items: center; position: relative; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .08); }
.sq svg.ing { width: 82%; height: 82%; }
.sq.kitchen { border-radius: 10%; }
.sq.kitchen.seat-yellow { background: var(--yellow); } .sq.kitchen.seat-purple { background: var(--purple); }
.sq.kitchen.seat-green { background: var(--green); } .sq.kitchen.seat-red { background: var(--red); }
.board .sq.kitchen .klabel { color: rgba(255, 255, 255, .92); }
.board .sq.kitchen.seat-yellow .klabel { color: rgba(0, 0, 0, .6); }
.sq.kitchen .hat { width: 60%; height: 60%; }
.sq.kitchen .klabel { position: absolute; bottom: 4%; font-size: calc(var(--board) * .018); font-weight: 900; color: rgba(0, 0, 0, .55); }
.sq.bunsq::after { content: '?'; position: absolute; top: 2%; right: 6%; font-family: 'Lilita One', sans-serif; color: var(--blue); font-size: calc(var(--board) * .03); }
.sq.hl { box-shadow: 0 0 0 4px var(--sun), inset 0 -3px 0 rgba(0, 0, 0, .08); }
.sq .dest { position: absolute; inset: -3px; border-radius: 10%; border: 3px dashed #fff; animation: pulse 1s infinite; pointer-events: none; }
.sq .dest b { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--sun); border-radius: 999px; padding: 0 6px; font-size: .75rem; box-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.middle {
  position: absolute; left: calc(2.2% + (100% - 4.4%) / 7 + .6%); top: calc(2.2% + (100% - 4.4%) / 7 + .6%);
  width: calc((100% - 4.4%) * 5 / 7 - .6%); height: calc((100% - 4.4%) * 5 / 7 - .6%);
  background: var(--mid); border-radius: 10px; padding: 3%; display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(6, 1fr); gap: 3%;
}
.spot { border-radius: 14%; background: var(--slot); box-shadow: inset 0 3px 0 rgba(0, 0, 0, .2); position: relative; border: 0; padding: 0; }
.spot .tile { position: absolute; inset: 0; }
.tile { border-radius: 14%; background: #F3E3BC; box-shadow: 0 3px 0 #B08E4A, inset 0 0 0 2px rgba(255, 255, 255, .5); display: grid; place-items: center; transition: transform .25s; }
.tile .tback { width: 80%; height: 80%; }
.tile .ing { width: 90%; height: 90%; }
.tile.face { background: #FFFDF2; }
.spot .mark { position: absolute; top: -4px; right: -4px; width: 26%; height: 26%; border-radius: 50%; border: 2px solid #fff; z-index: 2; pointer-events: none; }
.spot.can { cursor: pointer; }
.spot.can .tile { animation: wiggle 1.6s ease-in-out infinite; }
.spot.can:hover .tile { transform: translateY(-4px) scale(1.06); }
.spot.empty.can { background: #8FB6F2; box-shadow: inset 0 0 0 3px #fff; animation: pulse 1.1s infinite; }
.spot.lifted .tile { transform: translateY(-14%) scale(1.15); box-shadow: 0 10px 14px rgba(0, 0, 0, .3); }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-2deg) translateY(-2px); } }
@keyframes pulse { 50% { opacity: .6; } }
@keyframes pop { 0% { transform: scale(.2); } 100% { transform: scale(1); } }

.pawns { position: absolute; inset: 0; pointer-events: none; }
.pawn { position: absolute; width: calc(var(--board) * .055); height: calc(var(--board) * .082); transition: left .16s ease, top .16s ease; z-index: 3; }
.pawn .pawn-svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 1px rgba(0, 0, 0, .2)); }
.pawn.hop .pawn-svg { animation: hop .16s ease; }
@keyframes hop { 50% { transform: translateY(-35%); } }
.pawn.mine-choice { pointer-events: auto; cursor: pointer; }
.pawn.mine-choice .pawn-svg { animation: bob .8s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-12%); } }
.pawn .ptag { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: #fff; border-radius: 999px; font-size: .65rem; padding: 0 5px; font-weight: 900; white-space: nowrap; box-shadow: 0 1px 0 rgba(0, 0, 0, .3); }

/* action bar */
.action-bar { width: min(100%, 760px); background: var(--paper); border-radius: var(--r); padding: 10px 14px; display: flex; align-items: center; gap: 14px; box-shadow: 0 5px 0 rgba(0, 0, 0, .2); min-height: 82px; }
.dice { display: flex; gap: 8px; flex: none; }
.die { width: 52px; height: 52px; border-radius: 12px; background: #E8302C; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .25), 0 3px 0 rgba(0, 0, 0, .3); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 7px; transition: transform .2s, opacity .2s; }
.die i { width: 9px; height: 9px; border-radius: 50%; background: #FFF6E5; place-self: center; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25); }
.die.blank { background: #E8302C; opacity: .35; }
.die.used { opacity: .3; transform: scale(.85); }
.die.sel { box-shadow: 0 0 0 4px var(--sun), inset 0 -4px 0 rgba(0, 0, 0, .25); transform: translateY(-3px); }
.die.rolling { animation: roll .5s ease; }
.die.clickable { cursor: pointer; }
@keyframes roll { 0% { transform: rotate(0) translateY(0); } 30% { transform: rotate(160deg) translateY(-18px); } 60% { transform: rotate(300deg) translateY(4px); } 100% { transform: rotate(360deg); } }
.action { flex: 1; min-width: 0; }
.action h3 { margin: 0 0 4px; font-size: 1.25rem; line-height: 1.1; }
.action p { margin: 0; color: var(--muted); font-size: .92rem; }
.action .opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.opt { border: 0; background: #fff; border-radius: 10px; padding: 4px 10px 4px 6px; display: flex; align-items: center; gap: 6px; box-shadow: 0 3px 0 rgba(0, 0, 0, .2), inset 0 0 0 2px var(--line); font-weight: 800; font-size: .9rem; }
.opt:hover { box-shadow: 0 3px 0 rgba(0, 0, 0, .2), inset 0 0 0 2px var(--blue); }
.opt svg { width: 30px; height: 30px; }
.opt .hat { width: 26px; height: 26px; }
.opt.need { background: #FFF4D6; box-shadow: 0 3px 0 #D9902B, inset 0 0 0 2px #F1C76B; }
.opt .tag { font-size: .7rem; background: var(--blue); color: #fff; border-radius: 999px; padding: 0 6px; }
.held { display: flex; align-items: center; gap: 12px; }
.held .tile { width: 64px; height: 64px; flex: none; animation: flip .5s ease; }
@keyframes flip { 0% { transform: rotateY(90deg) scale(.6); } 100% { transform: rotateY(0) scale(1); } }
.turn-timer { flex: none; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; font-family: 'Lilita One', sans-serif; font-size: 1.1rem; background: conic-gradient(var(--blue) var(--p, 100%), #DCE8FA 0); position: relative; }
.turn-timer::before { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: var(--paper); }
.turn-timer span { position: relative; }
.turn-timer.low { background: conic-gradient(var(--red) var(--p, 100%), #FFE3E3 0); }

/* lobby */
.lobby { flex: 1; overflow: auto; display: flex; justify-content: center; align-items: flex-start; }
.lobby-card { width: 100%; max-width: 760px; background: var(--paper); border-radius: 20px; padding: 22px; box-shadow: 0 8px 0 rgba(0, 0, 0, .18); }
.lobby-card h2 { margin: 0; font-size: 2rem; color: var(--blue-dk); }
.seat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.seat { border-radius: 16px; padding: 14px 10px 12px; text-align: center; color: #fff; position: relative; box-shadow: 0 5px 0 rgba(0, 0, 0, .22); min-height: 150px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.seat.seat-yellow { color: var(--ink); }
.seat .hat { width: 46px; height: 46px; }
.seat .sname { font-family: 'Lilita One', sans-serif; font-size: 1.2rem; line-height: 1.1; word-break: break-word; }
.seat .skind { font-size: .8rem; opacity: .85; }
.seat .sbtns { margin-top: auto; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.seat .sbtns .btn { width: 100%; }
.seat.mine { box-shadow: 0 0 0 4px #fff, 0 5px 0 rgba(0, 0, 0, .22); }
.seat .team-tag { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: #fff; color: var(--navy); border-radius: 999px; padding: 0 8px; font-size: .72rem; font-weight: 900; white-space: nowrap; }
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 14px; margin-bottom: 6px; }
.settings .check { display: flex; align-items: center; gap: 8px; margin-top: 26px; }
.settings .check input { width: 20px; height: 20px; accent-color: var(--blue); }
.watchers { margin: 8px 0 14px; color: var(--muted); }
.watchers b { color: var(--ink); }
.rules-mini { margin: 14px 0 0; padding: 12px 14px; background: var(--mid); border-radius: 12px; font-size: .9rem; color: #22336B; }
.rules-mini ul { margin: 6px 0 0; padding-left: 18px; }

/* side panel */
.side { background: var(--paper); border-radius: var(--r); display: flex; flex-direction: column; min-height: 0; overflow: hidden; box-shadow: 0 5px 0 rgba(0, 0, 0, .2); }
.side-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 2px solid var(--line); align-items: center; }
.stab { border: 0; background: transparent; border-radius: 9px; padding: 6px 10px; font-weight: 900; color: var(--muted); }
.stab.active { background: var(--blue); color: #fff; }
.close-side { display: none; margin-left: auto; width: 34px; height: 34px; }
.spane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-tools { padding: 6px 12px 0; }
.switch { display: flex; align-items: center; gap: 6px; margin: 0; font-size: .82rem; color: var(--muted); }
.switch input { width: 16px; height: 16px; accent-color: var(--blue); }
.chat-list { list-style: none; margin: 0; padding: 8px 12px; flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 92%; }
.msg .who { font-weight: 900; font-size: .82rem; }
.msg .bubble { background: #EEF3FD; border-radius: 4px 14px 14px 14px; padding: 5px 11px; overflow-wrap: anywhere; font-weight: 700; }
.msg.mine { align-self: flex-end; text-align: right; }
.msg.mine .bubble { background: #FFF0C2; border-radius: 14px 4px 14px 14px; text-align: left; }
.msg.sys { align-self: center; text-align: center; color: var(--muted); font-size: .84rem; max-width: 100%; }
.voice { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 0; font-weight: 800; }
.voice .pl { width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: .8rem; }
.voice .wave { width: 70px; height: 16px; background: repeating-linear-gradient(90deg, #8DA2D6 0 2px, transparent 2px 5px); border-radius: 2px; }
.voice.playing .wave { background: repeating-linear-gradient(90deg, var(--blue) 0 2px, transparent 2px 5px); }
.reactions { display: flex; justify-content: space-around; padding: 4px 8px; border-top: 2px solid var(--line); }
.reactions button { border: 0; background: transparent; font-size: 1.3rem; padding: 3px; border-radius: 8px; }
.reactions button:active { transform: scale(1.3); }
.chat-form { display: flex; gap: 8px; padding: 8px 10px; padding-bottom: max(8px, env(safe-area-inset-bottom)); align-items: center; }
.chat-form input { margin: 0; padding: 8px 12px; font-size: 1rem; }
.mic { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; background: #EEF3FD; }
.rec-bar { display: flex; align-items: center; gap: 10px; padding: 10px; background: #FFE3E3; }
.rec-bar .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }
.rec-bar #rec-time { flex: 1; font-weight: 900; }
.log-list { list-style: none; margin: 0; padding: 8px 12px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.log-list li { display: flex; gap: 8px; align-items: baseline; }
.log-list .ld { width: 10px; height: 10px; border-radius: 50%; flex: none; transform: translateY(1px); }
.people { list-style: none; margin: 0; padding: 8px 12px; overflow: auto; }
.people li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.people .av { width: 32px; height: 32px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 900; font-size: .85rem; flex: none; position: relative; }
.people .av.off { filter: grayscale(1); opacity: .6; }
.people .pn { flex: 1; min-width: 0; }
.people .pn b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.people .pn small { color: var(--muted); }
.people .pm { border: 0; background: transparent; font-size: 1.2rem; padding: 2px 8px; border-radius: 8px; color: var(--muted); }

/* overlay (game over) */
.overlay { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 10px; background: rgba(21, 70, 150, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.over-card { background: var(--paper); border-radius: 22px; padding: 24px; width: 100%; max-width: 480px; text-align: center; box-shadow: 0 10px 0 rgba(0, 0, 0, .22), 0 0 0 6px var(--sun); animation: rise .45s cubic-bezier(.2, 1.3, .5, 1); max-height: 100%; overflow: auto; }
@keyframes rise { from { transform: translateY(40px) scale(.9); opacity: 0; } }
.over-card h2 { margin: 0; font-size: 2.2rem; color: var(--blue-dk); line-height: 1.05; }
.stack { display: flex; flex-direction: column; align-items: center; margin: 14px auto; width: 150px; }
.stack .layer { width: 100%; height: 30px; margin-top: -6px; display: flex; justify-content: center; opacity: 0; animation: drop .4s cubic-bezier(.3, 1.4, .6, 1) forwards; }
.stack .layer svg { width: 64px; height: 64px; margin-top: -20px; }
@keyframes drop { from { transform: translateY(-60px); opacity: 0; } to { transform: none; opacity: 1; } }
.standings { list-style: none; margin: 12px 0; padding: 0; text-align: left; }
.standings li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; }
.standings li:nth-child(1) { background: #FFF4D6; }
.standings .sw { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.standings .n { flex: 1; }
.over-card .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }

/* toasts & effects */
.toasts { position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: max-content; max-width: 94vw; }
.toast { background: var(--navy); color: #fff; padding: 7px 16px; border-radius: 999px; font-weight: 900; box-shadow: 0 4px 0 rgba(0, 0, 0, .25); animation: tin .3s ease, tout .4s ease 2.6s forwards; text-align: center; display: flex; align-items: center; gap: 8px; }
.toast svg { width: 30px; height: 30px; flex: none; }
.toast.good { background: var(--green); }
.toast.bad { background: var(--red); }
.toast.gold { background: var(--sun); color: var(--ink); }
@keyframes tin { from { transform: translateY(-14px) scale(.9); opacity: 0; } }
@keyframes tout { to { transform: translateY(-10px); opacity: 0; } }
.float-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.floater { position: absolute; bottom: -40px; font-size: 2.1rem; animation: floatUp 2.6s ease-out forwards; text-align: center; }
.floater small { display: block; font-size: .72rem; font-weight: 900; color: #fff; text-shadow: 0 1px 3px #000; }
@keyframes floatUp { to { transform: translateY(-75vh) rotate(var(--rot, 10deg)); opacity: 0; } }
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(20, 30, 70, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: var(--paper); border-radius: 18px; padding: 22px; width: 100%; max-width: 420px; box-shadow: 0 8px 0 rgba(0, 0, 0, .25); animation: rise .25s; max-height: 90vh; overflow: auto; }
.modal-card h3 { margin: 0 0 6px; font-size: 1.5rem; color: var(--blue-dk); }
.modal-card p, .modal-card li { color: #4A4035; font-weight: 700; }
.modal-card .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.menu { position: fixed; z-index: 75; background: var(--paper); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); padding: 6px; min-width: 210px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; font-weight: 800; }
.menu button:hover { background: #EEF3FD; }
.menu button.danger { color: #C92A2A; }
.menu hr { border: 0; border-top: 2px solid var(--line); margin: 4px 0; }
#confetti { position: fixed; inset: 0; z-index: 65; pointer-events: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 220px 1fr; }
  .layout.lobby-mode { grid-template-columns: 1fr; }
  .side { position: fixed; right: 0; top: 0; bottom: 0; width: min(380px, 100%); z-index: 50; border-radius: 0; transform: translateX(105%); transition: transform .25s; }
  .side.open { transform: none; }
  .close-side { display: grid; place-items: center; }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  #screen-room { height: auto; min-height: 100%; }
  .layout, .layout.lobby-mode { grid-template-columns: 1fr; padding: 0 8px 10px; gap: 8px; }
  .mini-mark { display: none; }
  .topbar { padding: 8px; gap: 8px; }
  .turn-banner { font-size: 1rem; }
  .centre { order: 1; }
  .cards-col { order: 2; display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .pcard .slots { grid-template-columns: repeat(9, 1fr); gap: 2px; padding: 3px; }
  .pcard .bun-sq { width: 30px; height: 30px; }
  .pcard .count { font-size: 1.15rem; }
  .board-wrap { flex: none; }
  .action-bar { padding: 8px 10px; gap: 10px; }
  .die { width: 42px; height: 42px; padding: 6px; }
  .die i { width: 7px; height: 7px; }
  .action h3 { font-size: 1.05rem; }
  .seat-grid { grid-template-columns: 1fr 1fr; }
  .lobby-card { padding: 16px; }
  .overlay { position: fixed; }
  .toasts { bottom: 16px; }
}
/* play-on places */
.settings .wide { grid-column: span 2; }
@media (max-width: 760px) { .settings .wide { grid-column: 1 / -1; } }
.pcard .place-tag { position: absolute; top: -9px; left: 10px; background: var(--sun); color: var(--ink); border-radius: 999px; padding: 0 8px; font-size: .75rem; font-weight: 900; box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }
.pcard.finished { opacity: .78; }
.pawn.done { opacity: .45; filter: grayscale(.6); }

/* about */
.about-link { margin-top: 22px; border: 0; background: transparent; color: #fff; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.about { text-align: center; }
.about-burger { width: 72px; height: 72px; margin: 0 auto 4px; }
.about-burger svg { width: 100%; height: 100%; }
.about h3 { font-size: 2rem; }
.about-credit { font-size: 1.1rem; margin: 14px 0; }
.about-credit b { color: var(--blue-dk); letter-spacing: .04em; }
.btn.yt { display: inline-flex; align-items: center; gap: 10px; background: #FF0000; color: #fff; text-decoration: none; box-shadow: 0 4px 0 #A30000; padding: 10px 18px; }
.btn.yt svg { width: 26px; height: 26px; background: #FF0000; border-radius: 6px; }
.about .actions { justify-content: center; }
@media (max-width: 760px) { #btn-about { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
