/* Ludo — styles. Colours and shapes follow the LUDO GO art in /img. */

@font-face { font-family: "Inter"; src: url("../fonts/Inter-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-ExtraBold.ttf") format("truetype"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Inter"; src: url("../fonts/Inter-Black.ttf") format("truetype"); font-weight: 900; font-display: swap; }

:root {
  --wood: #9f6233;
  --wood-dark: #7a4421;
  --card: #022523;
  --card-soft: #1b3836;
  --teal: #0b5a50;
  --gold: #ffc845;
  --gold-deep: #d8902a;
  --cream: #f8e7b5;
  --cream-light: #fff4d2;
  --text: #ffffff;
  --display: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --red: #e52c25; --blue: #1d8fe0; --yellow: #f5c518; --green: #23a047;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--wood) url("../img/wood.png") center / cover fixed;
  color: var(--text);
  font-family: var(--body);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}
input { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
img { display: block; }
.hidden { display: none !important; }

/* ---------- screens ---------- */
.screen { display: none; min-height: 100dvh; }
.screen.active { display: flex; }

/* ---------- shared pieces ---------- */
.card {
  background: var(--card) url("../img/card.png") center / 100% 100% no-repeat;
  background-color: transparent;
  padding: 34px 26px 28px;
  border-radius: 6px;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.35));
}
.card h2 {
  margin: 0;
  text-align: center;
  font: 900 clamp(24px, 6vw, 30px)/1.1 var(--body);
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .01em;
}
.divider { height: 4px; width: 62%; margin: 16px auto 18px; background: var(--cream); border-radius: 4px; }

.pill {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 12px auto 0;
  padding: 14px 20px;
  background: var(--gold);
  color: var(--card);
  border-radius: 999px;
  font: 800 19px/1.1 var(--body);
  box-shadow: 0 4px 0 #b9862a;
  transition: transform .08s ease;
}
.pill:active { transform: translateY(3px); box-shadow: 0 1px 0 #b9862a; }
.pill.ghost { background: transparent; color: var(--cream); box-shadow: inset 0 0 0 2px var(--cream); }
.pill.ghost:active { transform: translateY(1px); box-shadow: inset 0 0 0 2px var(--cream); }

.round-btn { width: 52px; height: 52px; flex: none; border-radius: 50%; transition: transform .1s; }
.round-btn:active { transform: scale(.92); }
.round-btn img { width: 100%; height: 100%; }
@media (max-width: 480px) {
  .topbar .round-btn { width: 44px; height: 44px; }
  .btn-group { gap: 5px; }
}

/* ---------- setup ---------- */
#setup { flex-direction: column; align-items: center; padding: 22px 16px 40px; position: relative; }
.setup-buttons { position: absolute; top: 16px; right: 16px; display: flex; gap: 10px; }
.btn-group { display: flex; gap: 8px; flex: none; }

.logo { width: min(440px, 88vw); margin: 48px 0 26px; text-align: center; }
.logo-top { display: flex; align-items: flex-end; height: 34px; padding: 0 9%; position: relative; z-index: 1; margin-bottom: -6px; }
.logo-top img { width: 30px; height: auto; margin-right: -4px; }
.logo-top img.up { transform: translateY(-6px); }
.logo-top .logo-die { width: 38px; margin-left: auto; transform: rotate(14deg); }
.logo-frame {
  background: linear-gradient(#f9d67a, #e7a73c 45%, #c97f26);
  border-radius: 24px;
  padding: 9px;
  box-shadow: 0 0 0 4px #9c5b25, 0 9px 0 4px #6d3a15, 0 16px 22px rgba(0,0,0,.35);
}
.logo-inner {
  background: linear-gradient(#0d665b, var(--teal) 55%, #08493f);
  border-radius: 16px;
  border: 3px solid #f6c65b;
  font: clamp(58px, 17vw, 86px)/1.1 var(--display);
  color: var(--cream-light);
  text-shadow: 0 5px 0 #063a33;
  padding: 6px 0 14px;
}
.tagline { margin: 22px 0 0; font: 700 15px var(--body); color: var(--cream-light); text-shadow: 0 2px 0 rgba(0,0,0,.25); }

.setup-card { width: min(480px, 100%); }
.seat { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(248,231,181,.12); }
.seat:last-child { border-bottom: 0; }
.seat img { width: 34px; height: auto; flex: none; }
.seat.off img { filter: grayscale(1) brightness(.6); }
.seat input[type=text] {
  flex: 1 1 auto; min-width: 0;
  background: var(--card-soft);
  border: 0; border-radius: 10px;
  color: #fff;
  font: 600 16px var(--body);
  padding: 10px 10px;
}
.seat.off input[type=text] { opacity: .4; }
.seg { display: flex; flex: none; background: var(--card-soft); border-radius: 10px; padding: 3px; }
.seg button { padding: 7px 9px; border-radius: 8px; font: 700 13px var(--body); color: var(--cream); }
.seg button[aria-pressed="true"] { background: var(--gold); color: var(--card); }

.toggle { display: flex; align-items: center; gap: 12px; margin: 16px 0 6px; font: 600 14px var(--body); color: var(--cream); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.switch { width: 44px; height: 26px; flex: none; border-radius: 99px; background: var(--card-soft); position: relative; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--cream); transition: transform .15s; }
.toggle input:checked + .switch { background: var(--gold); }
.toggle input:checked + .switch::after { transform: translateX(18px); background: var(--card); }
.toggle input:focus-visible + .switch { outline: 3px solid var(--gold); outline-offset: 2px; }
.setup-error { min-height: 1.2em; margin: 6px 0 0; text-align: center; color: #ff8a7a; font: 700 14px var(--body); }

/* ---------- game ---------- */
#game {
  --chrome: 424px;
  --board: min(calc(100vw - 16px), calc(100dvh - var(--chrome)), 760px);
  flex-direction: column; align-items: center; justify-content: center;
  padding: max(8px, env(safe-area-inset-top)) 8px max(10px, env(safe-area-inset-bottom));
  height: 100dvh; min-height: 0; overflow: hidden;
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: min(100%, 560px); min-height: 44px; }
.turn-banner { margin: 10px 0 0; max-width: min(calc(100vw - 40px), 340px); min-width: 0; transition: transform .25s; }
.turn-banner.pop { animation: pop .45s ease; }
.msg {
  margin: 6px 0 8px;
  min-height: 1.3em;
  max-width: 560px;
  text-align: center;
  font: 800 clamp(15px, 4.2vw, 19px)/1.25 var(--body);
  text-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.board-wrap { flex: none; padding: 24px 0; display: flex; align-items: center; justify-content: center; min-height: 0; }
/* The shadow is its own layer behind the board. (A drop-shadow filter on .board made the browser repaint the
   whole board and its shadow every time a piece hopped or anything on it pulsed: very slow on big iPad screens.) */
.board { position: relative; width: var(--board); aspect-ratio: 1608 / 1592; }
.board::before { content: ""; position: absolute; inset: 1.5% 1.5% 0; border-radius: 3%; box-shadow: 0 10px 22px rgba(0,0,0,.38); pointer-events: none; }
.board-img { position: relative; }
.board-img { width: 100%; height: 100%; }

.pad {
  position: absolute; width: 6.2%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(255,255,255,.38);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.85), 0 2px 4px rgba(0,0,0,.25);
}

.token {
  position: absolute; width: 5.6%; aspect-ratio: 78 / 80;
  transform: translate(-50%, -50%) scale(var(--s, 1));
  transition: left .14s ease, top .14s ease, transform .14s ease;
  z-index: 2;
  pointer-events: none;
}
.token img { width: 100%; height: 100%; position: relative; }
.token::after { content: ""; position: absolute; left: 14%; right: 14%; bottom: -5%; height: 30%; border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,.45), transparent); z-index: -1; }
.token.mine { z-index: 3; }
.token.can-move { pointer-events: auto; z-index: 4; cursor: pointer; }
.token.can-move::before {
  content: ""; position: absolute; inset: -55%;
  background: url("../img/glow.png") center / contain no-repeat;
  animation: pulse 0.9s ease-in-out infinite alternate;
  z-index: -1;
}
.token.can-move img { animation: bob .9s ease-in-out infinite alternate; }
.token.hop img { animation: hop .14s ease-out; }
.token.out { opacity: .25; }

/* footer */
.footer { width: min(100%, 560px); display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 8px; }

.roll-row { display: flex; align-items: center; gap: 16px; }
.dice { display: flex; gap: 10px; }
.die-btn { position: relative; width: 58px; height: 56px; transition: transform .15s; }
.die-btn .die-img { position: relative; width: 100%; height: 100%; z-index: 1; }
.die-glow { position: absolute; left: -45%; top: -45%; width: 190%; height: 190%; opacity: 0; transition: opacity .2s; pointer-events: none; }
.die-btn.ready .die-glow, .die-btn.selected .die-glow { opacity: 1; animation: pulse 0.9s ease-in-out infinite alternate; }
.die-btn.selected { transform: translateY(-5px) scale(1.06); }
.die-btn.rolling .die-img { animation: shake .12s linear infinite; }
.die-btn.rolling:nth-child(2) .die-img { animation-direction: reverse; }
.roll-btn { width: 168px; transition: transform .08s; }
.roll-btn img { width: 100%; height: auto; }
.roll-btn:not(:disabled):active { transform: translateY(3px) scale(.98); }
.roll-btn:disabled { cursor: default; }
.autoroll {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 12px;
  font: 800 14px var(--body); color: var(--cream); cursor: pointer; user-select: none;
}
.autoroll input { position: absolute; opacity: 0; width: 1px; height: 1px; }


/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: none; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(30, 14, 4, .72);
  overflow-y: auto;
}
.overlay.open { display: flex; animation: fade .2s ease; }
.overlay .card { animation: rise .28s cubic-bezier(.2,1.3,.5,1); }

.rules-card { width: min(460px, 100%); padding: 40px 28px 30px; cursor: pointer; }
.rule { display: flex; gap: 16px; align-items: flex-start; margin: 0 0 18px; }
.rule img { width: 58px; height: 58px; flex: none; }
.rule h3 { margin: 4px 0 4px; font: 800 17px var(--body); color: var(--cream); text-transform: uppercase; }
.rule p { margin: 0; font: 500 14.5px/1.4 var(--body); }

.menu-card { width: min(380px, 100%); padding: 40px 28px 34px; }

.results-card { width: min(420px, 100%); padding: 22px 28px 32px; text-align: center; }
.crown-wrap { position: relative; width: 150px; margin: 0 auto 14px; padding-top: 30px; }
.crown { position: absolute; top: 0; left: 50%; width: 62px; transform: translateX(-50%); }
.winner-circle {
  width: 150px; height: 150px; border-radius: 50%;
  background: var(--card-soft); border: 3px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
}
.winner-circle img { width: 74px; height: auto; animation: bob 1s ease-in-out infinite alternate; }
.standings { list-style: none; padding: 0; margin: 0 0 10px; text-align: left; }
.standings li { display: flex; align-items: center; gap: 12px; padding: 8px 6px; font: 700 16px var(--body); border-bottom: 1px solid rgba(248,231,181,.12); }
.standings li:last-child { border-bottom: 0; }
.standings .pos { width: 40px; font: 900 16px var(--body); color: var(--gold); }
.standings img { width: 28px; height: auto; }
.standings .who { flex: 1; }
.standings .home { color: var(--cream); font-weight: 600; font-size: 14px; }

/* confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.bit { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }

/* ---------- animations ---------- */
@keyframes pulse { from { transform: scale(.85); opacity: .65; } to { transform: scale(1.08); opacity: 1; } }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-9%); } }
@keyframes hop { 0% { transform: translateY(0) scale(1); } 50% { transform: translateY(-30%) scale(1.12); } 100% { transform: translateY(0) scale(1); } }
@keyframes shake { 0% { transform: rotate(-12deg) scale(1.05); } 50% { transform: rotate(12deg) scale(.95); } 100% { transform: rotate(-12deg) scale(1.05); } }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(30px) scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- setup tabs + online forms ---------- */
.tabs { display: flex; background: var(--card-soft); border-radius: 999px; padding: 4px; margin: 0 0 22px; }
.tabs button { flex: 1; padding: 11px 8px; border-radius: 999px; font: 800 15px var(--body); color: var(--cream); min-height: 44px; }
.tabs button[aria-selected="true"] { background: var(--gold); color: var(--card); }
.lead { margin: 0 0 16px; font: 500 15px/1.45 var(--body); color: var(--cream-light); text-align: center; }
.lead.small { font-size: 14px; margin: 10px 0 14px; }
.field { display: block; margin: 0 0 12px; }
.field span { display: block; margin: 0 0 6px; font: 700 13px var(--body); color: var(--cream); text-transform: uppercase; letter-spacing: .04em; }
.field input {
  width: 100%; border: 0; border-radius: 12px;
  background: var(--card-soft); color: #fff;
  font: 600 16px var(--body); padding: 13px 14px; min-height: 48px;
}
.field input::placeholder { color: rgba(255,255,255,.4); }
.code-input { text-align: center; font: 900 26px var(--body) !important; letter-spacing: .25em; text-transform: uppercase; }
.or { display: flex; align-items: center; gap: 10px; margin: 22px 0 14px; color: var(--cream); font: 700 13px var(--body); }
.or::before, .or::after { content: ""; flex: 1; height: 2px; background: rgba(248,231,181,.25); border-radius: 2px; }
.link-btn { display: block; margin: 18px auto 0; color: var(--gold); font: 700 14px var(--body); text-decoration: underline; text-underline-offset: 3px; min-height: 40px; }
.pill:disabled { opacity: .55; cursor: default; transform: none; }

/* ---------- lobby ---------- */
#lobby { flex-direction: column; align-items: center; justify-content: center; padding: 84px 16px 40px; position: relative; }
.lobby-card { width: min(480px, 100%); }
.code-box { text-align: center; background: var(--card-soft); border-radius: 16px; padding: 14px 12px 16px; }
.code-label { display: block; font: 700 12px var(--body); color: var(--cream); text-transform: uppercase; letter-spacing: .12em; }
.big-code { display: block; margin: 4px 0 12px; font: clamp(40px, 13vw, 56px)/1 var(--display); letter-spacing: .14em; color: var(--gold); user-select: all; -webkit-user-select: all; }
.code-actions { display: flex; gap: 10px; justify-content: center; }
.mini-btn {
  padding: 9px 14px; min-height: 40px; border-radius: 999px;
  font: 800 13px var(--body); color: var(--card); background: var(--cream);
  white-space: nowrap; flex: none;
}
.mini-btn:active { transform: translateY(1px); }
.lobby-seats { list-style: none; margin: 0 0 6px; padding: 0; }
.lobby-seat { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid rgba(248,231,181,.12); font: 700 15px var(--body); min-height: 56px; }
.lobby-seat:last-child { border-bottom: 0; }
.lobby-seat img { width: 32px; height: auto; flex: none; }
.lobby-seat .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-seat .who em { font-style: normal; color: var(--gold); }
.lobby-seat.open .who { color: rgba(255,255,255,.5); font-weight: 600; font-style: italic; }
.lobby-seat .tag { font: 800 11px var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--card); background: var(--gold); border-radius: 99px; padding: 3px 8px; }
.lobby-seat .mini-btn { background: transparent; color: var(--cream); box-shadow: inset 0 0 0 2px rgba(248,231,181,.5); }
.lobby-status { margin: 10px 0 4px; min-height: 1.3em; text-align: center; font: 700 14px/1.4 var(--body); color: var(--cream); }
.lobby-status.warn { color: #ff9b8c; }

/* ---------- game code strip (always on top during online games) ---------- */
.net-strip {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  align-self: center;
  margin: 0 0 8px; padding: 5px 6px 5px 12px;
  background: var(--card); border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(248,231,181,.35), 0 4px 10px rgba(0,0,0,.25);
  font: 700 12px var(--body); color: var(--cream);
  max-width: 100%;
}
.net-strip .dot { width: 10px; height: 10px; border-radius: 50%; background: #ff6b5e; box-shadow: 0 0 0 3px rgba(255,107,94,.25); flex: none; }
.net-strip .dot.ok { background: #48d16b; box-shadow: 0 0 0 3px rgba(72,209,107,.25); }
.strip-label { text-transform: uppercase; letter-spacing: .1em; }
.strip-code { font: 20px/1 var(--display); letter-spacing: .14em; color: var(--gold); user-select: all; -webkit-user-select: all; }
.strip-share { padding: 6px 12px; min-height: 32px; border-radius: 99px; background: var(--gold); color: var(--card); font: 800 12px var(--body); }

.standings li.me .who { color: var(--gold); }

/* rules: online steps */
.section-title { margin-top: 26px !important; }
.steps { margin: 0 0 14px; padding: 0 0 0 4px; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 12px 44px; font: 500 14.5px/1.45 var(--body); }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold); color: var(--card); font: 900 15px/30px var(--body); text-align: center;
}
.steps b, .tips b { color: var(--cream); }
.steps code { font: 800 14px var(--body); color: var(--gold); letter-spacing: .08em; }
.tips { margin: 0 0 8px; padding: 12px 14px 12px 30px; background: var(--card-soft); border-radius: 14px; font: 500 13.5px/1.45 var(--body); color: var(--cream-light); }
.tips li { margin: 0 0 6px; }
.tips li:last-child { margin: 0; }
.rules-card { max-height: none; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 40;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: var(--card); color: #fff; border-radius: 999px; padding: 12px 20px;
  font: 700 14px var(--body); box-shadow: 0 0 0 2px var(--gold), 0 8px 20px rgba(0,0,0,.35);
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* online games show the code strip, so leave room for it */


/* ---------- small phones ---------- */
@media (max-width: 360px) {
  .seg button { padding: 7px 6px; font-size: 12px; }
  .seat input[type=text] { font-size: 16px; padding: 9px 8px; }
  .roll-btn { width: 140px; }
  .die-btn { width: 50px; height: 48px; }
  .card { padding-left: 18px; padding-right: 18px; }
}

/* ---------- tablets in portrait (iPad etc.) ---------- */
@media (min-width: 700px) and (orientation: portrait) {
  #game { --chrome: 560px; padding-top: max(20px, env(safe-area-inset-top)); }
  .topbar { width: min(100%, 720px); }
  .topbar .round-btn { width: 60px; height: 60px; }
  .turn-banner { max-width: 440px; margin-top: 16px; }
  .board-wrap { padding: 30px 0; }
  .msg { font-size: 22px; margin: 12px 0 14px; max-width: 720px; }
  .net-strip { font-size: 14px; padding: 7px 8px 7px 16px; gap: 12px; }
  .strip-code { font-size: 26px; }
  .strip-share { font-size: 14px; padding: 8px 16px; min-height: 38px; }
  .footer { width: min(100%, 720px); gap: 14px; padding-top: 16px; }
  .roll-row { gap: 28px; }
  .dice { gap: 16px; }
  .die-btn { width: 84px; height: 81px; }
  .roll-btn { width: 240px; }
  .setup-card, .lobby-card { width: min(560px, 100%); }
  .logo { width: min(520px, 80vw); margin-top: 70px; }
}

/* ---------- landscape (phones on their side, iPad landscape, laptops) ----------
   Board on the left, everything else in a panel on the right. */
@media (orientation: landscape) and (min-aspect-ratio: 6/5) {
  #game {
    --panel: clamp(250px, 30vw, 340px);
    --board: min(calc(100dvh - 68px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), calc(100vw - var(--panel) - 48px), 900px);
    display: none;
    grid-template-columns: var(--board) var(--panel);
    grid-template-rows: 1fr auto auto auto auto auto 1fr;
    grid-template-areas: "board ." "board top" "board banner" "board strip" "board msg" "board foot" "board .";
    column-gap: 24px;
    justify-content: center; align-content: center;
    padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }
  #game.active { display: grid; }
  .board-wrap { grid-area: board; }
  .topbar { grid-area: top; width: 100%; }
  .turn-banner { grid-area: banner; justify-self: center; max-width: 100%; margin-top: 12px; }

  .msg { grid-area: msg; margin: 10px 0; font-size: 16px; }
  .footer { grid-area: foot; width: 100%; gap: 14px; padding-top: 4px; }
  .roll-row { flex-direction: column; gap: 12px; }
  .die-btn { width: 66px; height: 64px; }
  .roll-btn { width: min(200px, 100%); }
}
/* phones on their side: very little height, so tighten everything */
@media (orientation: landscape) and (max-height: 520px) {
  #game { --panel: clamp(230px, 34vw, 300px); column-gap: 16px; }
  .topbar .round-btn { width: 38px; height: 38px; }
  .topbar { min-height: 38px; }
  .turn-banner { margin-top: 6px; }
  .strip-label { display: none; }
  .msg { font-size: 13px; margin: 4px 0; }
  .net-strip { padding: 3px 4px 3px 10px; font-size: 11px; }
  .strip-code { font-size: 16px; }
  .strip-share { min-height: 26px; padding: 4px 10px; }
  .footer { gap: 6px; }
  .roll-row { flex-direction: row; gap: 10px; }
  .die-btn { width: 44px; height: 42px; }
  .dice { gap: 6px; }
  .roll-btn { width: 118px; }
  #setup, #lobby { padding-top: 64px; }
  .logo { margin: 8px 0 16px; }
  .logo-inner { font-size: 52px; }
}
/* big landscape screens (iPad landscape, desktops): roomier panel */
@media (orientation: landscape) and (min-height: 700px) {
  .topbar .round-btn { width: 56px; height: 56px; }
  .msg { font-size: 19px; }
  .die-btn { width: 82px; height: 79px; }
  .roll-btn { width: min(230px, 100%); }
  .net-strip { font-size: 13px; }
  .strip-code { font-size: 24px; }
}

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

/* ---------- game type: everyone for themselves / 2 colours each ---------- */
.mode-seg { margin: 0 0 4px; }
.mode-seg button { flex: 1; padding: 9px 8px; line-height: 1.25; min-height: 44px; }
#mode-hint { margin: 10px 0 6px; }
.team { padding: 4px 0 14px; border-bottom: 1px solid rgba(248,231,181,.12); }
.team:last-child { border-bottom: 0; }
.team .seat { border-bottom: 0; }
.color-pick { display: flex; gap: 10px; justify-content: center; }
.color-pick .pick { width: 54px; height: 54px; border-radius: 14px; background: var(--card-soft); display: grid; place-items: center; transition: transform .12s ease; }
.color-pick .pick img { width: 30px; height: auto; }
.color-pick .pick.on { box-shadow: inset 0 0 0 3px var(--gold); background: rgba(255,200,69,.16); }
.color-pick .pick:active { transform: scale(.94); }
.color-pick .pick:disabled { opacity: .4; cursor: default; }

/* ---------- "the computer is playing for you" ---------- */
#game { position: relative; }
.auto-bar {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 6;
  display: flex; align-items: center; gap: 10px; margin-top: 4px;
  max-width: calc(100% - 24px); padding: 6px 6px 6px 14px; border-radius: 99px;
  background: rgba(31,18,10,.82); box-shadow: 0 6px 16px rgba(0,0,0,.3);
  color: #fff; font: 700 13px/1.3 var(--body);
}
.auto-bar .mini-btn { flex: none; }

/* ---------- vote and pause cards ---------- */
.vote-card, .pause-card { width: min(410px, 100%); padding: 26px 24px 24px; text-align: center; }
.vote-card .lead, .pause-card .lead { margin-bottom: 18px; }
.vote-actions { display: flex; gap: 12px; }
.vote-actions .pill { flex: 1; margin: 0; }
.vote-card #vote-back { margin-top: 12px; }
.pause-card .code-box { margin-bottom: 4px; }
.pause-card .big-code { margin-bottom: 4px; }
.lobby-seat .tag.off { background: #ff6b5e; color: #fff; }
.lobby-seat .mini-btn + .mini-btn { margin-left: -4px; }
.standings img + img { margin-left: -10px; }

/* ---------- turn banner (shows the player's name) ---------- */
.tb-frame {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 7px 20px 7px 8px; border-radius: 22px;
  background: linear-gradient(180deg, #23786b, #0b5249);
  border: 3px solid #f2c34d;
  box-shadow: 0 0 0 4px #a56a2a, 0 5px 0 4px #6b3d14, 0 10px 18px rgba(0,0,0,.35);
  transition: filter .2s;
}
.turn-banner.theirs .tb-frame { filter: saturate(.8) brightness(.92); }
#tb-token { --av: 44px; }
.tb-text {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 30px/1.15 var(--display); color: var(--cream-light); letter-spacing: .02em;
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.tb-text.long { font-size: 24px; }

/* the game code sits between the menu and help buttons */
.topbar .net-strip { margin: 0; min-width: 0; }

/* ---------- name tags at each corner of the board ---------- */
#tags { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.tag {
  --c: var(--gold);
  position: absolute; display: flex; align-items: center; gap: 6px; max-width: 47%;
  padding: 3px 12px 3px 3px; border-radius: 999px;
  background: rgba(2,37,35,.92); color: #fff; font: 800 13px var(--body);
  box-shadow: 0 3px 8px rgba(0,0,0,.3);
  transition: background .2s, box-shadow .2s, opacity .2s;
}
.tag .av { --av: 22px; }
.tag .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag.tl { left: 1.5%; top: 0; transform: translateY(-62%); }
.tag.tr { right: 1.5%; top: 0; transform: translateY(-62%); }
.tag.bl { left: 1.5%; bottom: 0; transform: translateY(62%); }
.tag.br { right: 1.5%; bottom: 0; transform: translateY(62%); }
.tag.c-red { --c: var(--red); } .tag.c-blue { --c: var(--blue); } .tag.c-yellow { --c: var(--yellow); } .tag.c-green { --c: var(--green); }
.tag small {
  flex: none; padding: 2px 6px; border-radius: 999px;
  font: 800 10px var(--body); text-transform: uppercase; letter-spacing: .04em;
  background: #fff; color: var(--c);
}
.tag.on { background: var(--c); box-shadow: 0 0 0 3px #fff, 0 0 8px 1px var(--c); }
.tag.on::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 20px 6px var(--c); animation: tagpulse 1.1s ease-in-out infinite alternate; pointer-events: none; will-change: opacity; }
.tag.on.c-yellow { color: var(--card); }
.tag.on.c-yellow small { background: var(--card); color: var(--yellow); }
.tag.me:not(.on) .nm { color: var(--gold); }
.tag.away { opacity: .6; }
.tag.done { opacity: .85; }
.tag small.place { background: var(--gold); color: var(--card); }
.tag small.off { background: #ff6b5e; color: #fff; }
.tag small.ai { background: var(--gold); color: var(--card); }
@keyframes tagpulse { from { opacity: 0; } to { opacity: 1; } }

/* auto roll switch */
.autoroll .track { position: relative; width: 40px; height: 24px; flex: none; border-radius: 12px; background: rgba(248,231,181,.25); transition: background .15s; }
.autoroll .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--cream); transition: transform .15s, background .15s; }
.autoroll input:checked + .track { background: var(--gold); }
.autoroll input:checked + .track::after { transform: translateX(16px); background: var(--card); }
.autoroll input:focus-visible + .track { outline: 2px solid var(--cream); outline-offset: 2px; }

/* short phones in portrait: smaller banner so the board stays big */
@media (orientation: portrait) and (max-height: 720px) {
  #game { --chrome: 372px; }
  .turn-banner { margin-top: 6px; }
  .tb-frame { padding: 5px 16px 5px 6px; gap: 10px; border-radius: 18px; }
  #tb-token { --av: 34px; }
  .tb-text { font-size: 24px; }
  .tb-text.long { font-size: 20px; }
  .msg { margin: 4px 0 4px; }
}
@media (max-width: 370px) { .strip-label { display: none; } }

/* banner and tag sizes for bigger screens and landscape (after the base rules above) */
@media (min-width: 700px) and (orientation: portrait) {
  #tb-token { --av: 56px; }
  .tb-text { font-size: 40px; }
  .tb-text.long { font-size: 32px; }
  .tag { font-size: 16px; }
  .tag .av { --av: 30px; }
}
@media (orientation: landscape) and (min-aspect-ratio: 6/5) {
  .tb-text { font-size: 24px; }
  .tb-text.long { font-size: 19px; }
  #tb-token { --av: 36px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .tb-frame { padding: 4px 12px 4px 5px; gap: 8px; border-radius: 16px; }
  .tb-text { font-size: 17px; }
  .tb-text.long { font-size: 15px; }
  #tb-token { --av: 26px; }
  .tag { font-size: 11px; padding: 2px 8px 2px 2px; }
  .tag .av { --av: 16px; }
}
@media (orientation: landscape) and (min-height: 700px) {
  .tag { font-size: 15px; }
  .tag .av { --av: 28px; }
}

/* ---------- player pictures (man, woman, computer) ---------- */
.av {
  --av: 34px; --c: var(--gold);
  width: var(--av); height: var(--av); flex: none; display: inline-grid; place-items: center;
  border-radius: 50%; overflow: hidden; background: var(--c);
  box-shadow: 0 0 0 2px #fff, 0 2px 4px rgba(0,0,0,.3);
}
span.av > img { width: 100%; height: 100%; display: block; }
.av.c-red { --c: var(--red); } .av.c-blue { --c: var(--blue); } .av.c-yellow { --c: var(--yellow); } .av.c-green { --c: var(--green); }
#tb-token { box-shadow: 0 0 0 3px #fff, 0 2px 6px rgba(0,0,0,.35); }
.tag .av { box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
.lobby-seat .av { --av: 32px; }
.seat .av { --av: 34px; }
.av-btn { position: relative; flex: none; border-radius: 50%; }
.av-btn::after {
  content: "⇄"; position: absolute; right: -4px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--gold); color: var(--card); font: 900 10px/16px var(--body); text-align: center;
}
.name-row { display: flex; align-items: flex-end; gap: 10px; }
.name-row .field { flex: 1; min-width: 0; }
.av-pick { display: flex; gap: 6px; padding-bottom: 14px; }
.av-pick button { border-radius: 50%; opacity: .45; transition: opacity .15s, transform .15s; }
.av-pick button .av { --av: 40px; }
.av-pick button[aria-pressed="true"] { opacity: 1; transform: scale(1.08); }
.av-pick button[aria-pressed="true"] .av { box-shadow: 0 0 0 3px var(--gold); }
.join-hint { margin: 8px 0 0; text-align: center; opacity: .8; }

/* ---------- rejoin: pick your name ---------- */
.pick-list { list-style: none; margin: 4px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pick-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 16px;
  background: var(--card-soft); color: #fff; font: 800 16px var(--body); text-align: left;
  box-shadow: inset 0 0 0 2px rgba(248,231,181,.3);
}
.pick-btn .av { --av: 40px; }
.pick-btn .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-btn .tk { width: 20px; height: auto; }
.pick-btn .st { padding: 5px 10px; border-radius: 999px; background: var(--gold); color: var(--card); font: 800 12px var(--body); }
.pick-btn.busy { opacity: .55; }
.pick-btn.busy .st { background: transparent; color: var(--cream); box-shadow: inset 0 0 0 2px rgba(248,231,181,.4); }
.pick-btn:not(:disabled):active { transform: translateY(1px); }

/* ---------- turn cues ---------- */
.house-glow {
  position: absolute; z-index: 1; pointer-events: none; border-radius: 6%;
  --c: var(--gold);
  box-shadow: inset 0 0 0 4px var(--c), 0 0 18px 6px var(--c);
  animation: houseglow 1.1s ease-in-out infinite alternate; will-change: opacity;
}
.house-glow.c-red { --c: rgba(229,44,37,.9); } .house-glow.c-blue { --c: rgba(29,143,224,.9); }
.house-glow.c-yellow { --c: rgba(245,197,24,.95); } .house-glow.c-green { --c: rgba(35,160,71,.9); }
.house-glow.mine { box-shadow: inset 0 0 0 6px var(--c), 0 0 26px 10px var(--c); }
@keyframes houseglow { from { opacity: .45; } to { opacity: 1; } }

.turn-pop {
  position: absolute; left: 50%; top: 50%; z-index: 8; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 26px 16px; border-radius: 24px; min-width: 58%;
  background: rgba(2,37,35,.94); border: 3px solid #f2c34d;
  box-shadow: 0 0 0 4px #a56a2a, 0 14px 30px rgba(0,0,0,.45);
  transform: translate(-50%, -50%) scale(.6); opacity: 0; visibility: hidden;
}
.turn-pop.show { animation: turnpop 1.5s ease forwards; visibility: visible; }
.turn-pop .av { --av: 72px; box-shadow: 0 0 0 4px #fff, 0 0 22px 6px var(--c); }
.turn-pop strong { font: 34px/1.05 var(--display); color: var(--cream-light); letter-spacing: .02em; text-align: center; }
.turn-pop small { font: 800 14px var(--body); color: var(--gold); text-align: center; }
@keyframes turnpop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  22% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(.92); }
}
.roll-btn.go { animation: rollgo 1s ease-in-out infinite; }
@keyframes rollgo { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.nudge { animation: nudge .6s ease !important; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px) rotate(-2deg); } 40% { transform: translateX(8px) rotate(2deg); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@media (orientation: landscape) and (max-height: 520px) {
  .turn-pop { padding: 10px 16px; }
  .turn-pop .av { --av: 44px; }
  .turn-pop strong { font-size: 22px; }
}
@media (min-width: 700px) and (orientation: portrait) {
  .turn-pop .av { --av: 96px; }
  .turn-pop strong { font-size: 46px; }
  .turn-pop small { font-size: 18px; }
}

/* ---------- home screen: your games, new game, have a code ---------- */
.home { width: min(480px, 100%); display: flex; flex-direction: column; align-items: stretch; }
.home .sec { margin: 6px 6px 10px; font: 800 12px var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--cream); opacity: .9; }
#my-games-wrap { margin-bottom: 10px; }
.game-card {
  position: relative; display: flex; align-items: center; gap: 12px; margin-bottom: 10px; padding: 12px 12px 12px 12px;
  border-radius: 22px; background: rgba(2,37,35,.95); box-shadow: 0 0 0 3px rgba(248,231,181,.18), 0 8px 18px rgba(0,0,0,.28);
  animation: slideup .45s cubic-bezier(.2,.9,.3,1.2) both; animation-delay: calc(var(--i, 0) * 80ms);
}
.game-card.hot { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(255,200,69,.45); }
.game-card .stack { display: flex; flex: none; }
.game-card .stack .av { --av: 38px; }
.game-card .stack .av + .av { margin-left: -12px; }
.game-card .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.game-card .info b { font: 800 15px/1.2 var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-card .info small { font: 600 12px var(--body); color: var(--cream); opacity: .85; }
.game-card .act { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.game-card .forget { position: absolute; top: -7px; right: -5px; width: 24px; height: 24px; border-radius: 50%; background: var(--card-soft); color: var(--cream); font: 900 14px/24px var(--body); box-shadow: 0 0 0 2px rgba(248,231,181,.35); }
.pillst { padding: 4px 9px; border-radius: 999px; font: 800 10px var(--body); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.pillst.go { background: #3fdc6a; color: #06331a; animation: pulse-soft 1.2s ease-in-out infinite alternate; }
.pillst.wait { background: rgba(248,231,181,.18); color: var(--cream); }
@keyframes pulse-soft { from { transform: scale(1); } to { transform: scale(1.08); } }
.pill.small { width: auto; max-width: none; margin: 0; padding: 9px 16px; font-size: 15px; box-shadow: 0 3px 0 #b9862a; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 14px 10px; border-radius: 22px;
  background: rgba(2,37,35,.95); box-shadow: 0 0 0 3px rgba(248,231,181,.18), 0 8px 18px rgba(0,0,0,.28); color: #fff;
  transition: transform .12s; animation: slideup .45s cubic-bezier(.2,.9,.3,1.2) both; animation-delay: .1s;
}
.choice + .choice { animation-delay: .18s; }
.choice:active { transform: scale(.97); }
.choice .art { height: 78px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.choice b { margin: 8px 0 4px; font: 22px/1 var(--display); color: var(--gold); letter-spacing: .02em; font-weight: 400; }
.choice > span:last-child { font: 600 12px/1.35 var(--body); color: var(--cream-light); }
.phone { width: 46px; height: 74px; border-radius: 10px; background: #0b1414; box-shadow: inset 0 0 0 3px var(--cream); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.phone .av { --av: 24px; }
.phone.sm { width: 34px; height: 56px; border-radius: 8px; }
.phone.sm .av { --av: 22px; }
.phone.up { transform: translateY(-8px); }
.choice:hover .phone, .choice:focus-visible .phone { animation: wiggle .5s ease; }
@keyframes wiggle { 30% { transform: rotate(-6deg); } 60% { transform: rotate(5deg); } }

.codebar { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px; border-radius: 22px; background: rgba(2,37,35,.95); box-shadow: 0 0 0 3px rgba(248,231,181,.18), 0 8px 18px rgba(0,0,0,.28); animation: slideup .45s cubic-bezier(.2,.9,.3,1.2) .26s both; }
.codebar-label { font: 800 13px/1.15 var(--body); color: var(--cream); flex: none; width: 62px; }
.boxes { position: relative; display: flex; gap: 5px; flex: 1; min-width: 0; cursor: text; }
.boxes input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; color: transparent; caret-color: transparent; border: 0; background: transparent; z-index: 2; }
.boxes i {
  flex: 1; min-width: 0; height: 44px; border-radius: 10px; background: var(--card-soft); display: grid; place-items: center;
  font: normal 24px var(--display); color: var(--gold); box-shadow: inset 0 0 0 2px rgba(248,231,181,.25); transition: box-shadow .15s;
}
.boxes i:empty::after { content: ""; width: 12px; height: 3px; border-radius: 2px; background: rgba(248,231,181,.35); }
.boxes i.filled { animation: boxpop .22s ease; }
.boxes i.cur { box-shadow: inset 0 0 0 2px var(--gold); }
.boxes.ok i { box-shadow: inset 0 0 0 2px #3fdc6a; color: #fff; }
.boxes.bad i { box-shadow: inset 0 0 0 2px #ff6b5e; }
.boxes.bad { animation: shake .45s ease; }
@keyframes boxpop { 0% { transform: scale(.7); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }
@keyframes slideup { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.home .net-error { margin: 8px 4px 0; }
.howto-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 14px; border-radius: 18px; background: rgba(2,37,35,.75); color: #fff; text-align: left; animation: slideup .45s cubic-bezier(.2,.9,.3,1.2) .34s both; }
.howto-row img { width: 34px; height: 34px; }
.howto-row b { display: block; font: 800 14px var(--body); }
.howto-row small { font: 600 12px var(--body); color: var(--cream); }

/* sub-views (play here, with friends, join) */
.view { position: relative; animation: slideup .35s ease both; }
.back-btn { position: absolute; top: 14px; left: 14px; padding: 6px 12px; border-radius: 999px; background: var(--card-soft); color: var(--cream); font: 800 13px var(--body); z-index: 2; }
.view h2 { margin-top: 26px; }

/* join a friend's game */
.invite { text-align: center; }
.invite .back-btn + span { display: block; margin-top: 24px; }
.invite .av.host { --av: 88px; box-shadow: 0 0 0 4px #fff, 0 0 24px 6px var(--c); animation: hostpop .6s cubic-bezier(.2,.9,.3,1.4) both; }
@keyframes hostpop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.invite h2 { margin: 12px 0 8px; }
.invite .boxes { justify-content: center; margin: 0 auto; max-width: 280px; }
.invite .boxes i { height: 46px; }
.found { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px 0 14px; font: 800 13px var(--body); color: #7ff0a0; }
.found svg { width: 18px; height: 18px; flex: none; }
.whois { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; margin: 0 0 14px; }
.whois div { display: flex; flex-direction: column; align-items: center; gap: 5px; font: 800 12px var(--body); }
.whois .av { --av: 44px; }
.invite .name-row { text-align: left; }
.note { margin: 0 0 4px; font: 600 12px var(--body); color: var(--cream); opacity: .8; }

/* ---------- playing: turn strip, hint pill, waiting pill ---------- */
.turn-strip { display: flex; align-items: center; justify-content: center; gap: 2px; margin-top: 10px; padding: 6px 10px 4px; border-radius: 999px; background: rgba(2,37,35,.55); max-width: 100%; }
.turn-strip:empty { display: none; }
.turn-strip .sp { position: relative; display: flex; flex-direction: column; align-items: center; width: 56px; min-width: 0; }
.turn-strip .sp .av { --av: 26px; opacity: .55; transition: opacity .2s; }
.turn-strip .sp > span:last-child { margin-top: 2px; max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 800 10px var(--body); color: var(--cream); opacity: .7; }
.turn-strip .sp.now .av { --av: 32px; opacity: 1; box-shadow: 0 0 0 3px var(--gold), 0 0 12px var(--gold); animation: nowpop .4s cubic-bezier(.2,.9,.3,1.4); }
.turn-strip .sp.now > span:last-child, .turn-strip .sp.next > span:last-child { opacity: 1; color: #fff; }
.turn-strip .sp.next .av { opacity: 1; }
.turn-strip .sp.done .av { opacity: .35; filter: grayscale(.6); }
.turn-strip .sp em { position: absolute; top: -9px; z-index: 1; padding: 1px 6px; border-radius: 999px; font: 900 8px var(--body); font-style: normal; letter-spacing: .06em; }
.turn-strip .sp.now em { background: var(--gold); color: var(--card); }
.turn-strip .sp.next em { background: #fff; color: var(--card); }
.turn-strip .sp em.pl { background: var(--card-soft); color: var(--gold); }
.turn-strip .arr { color: var(--cream); opacity: .45; font: 900 12px var(--body); }
@keyframes nowpop { from { transform: scale(.7); } to { transform: none; } }

#game .msg {
  display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap;
  margin: 2px auto 6px; padding: 7px 14px; min-height: 36px; max-width: min(100%, 560px); border-radius: 999px;
  background: rgba(2,37,35,.72); color: var(--cream-light); text-shadow: none;
  font: 800 14px/1.25 var(--body);
}
#game .msg.go { background: var(--cream-light); color: var(--card); box-shadow: 0 4px 0 rgba(0,0,0,.2); animation: hintin .3s ease; }
#game .msg.hit { background: #fff; color: #a3150f; box-shadow: 0 4px 0 rgba(0,0,0,.2); animation: hintin .3s ease; }
#game .msg.dark { background: rgba(2,37,35,.92); }
#game .msg img { width: 24px; height: 24px; }
#game .msg .num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--gold); font: 900 12px var(--body); flex: none; }
#game .msg .num.done { background: #23a047; color: #fff; }
#game .msg .bar { width: 12px; height: 2px; background: currentColor; opacity: .3; }
#game .msg .clock { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--gold); position: relative; flex: none; }
#game .msg .clock::after { content: ""; position: absolute; left: 50%; top: 1px; width: 2px; height: 5px; margin-left: -1px; background: var(--gold); transform-origin: 50% 100%; animation: tick 2s steps(8) infinite; }
#game .msg .star { width: 18px; height: 18px; flex: none; background: currentColor; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
@keyframes hintin { from { transform: translateY(6px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes tick { to { transform: rotate(360deg); } }

.wait-pill { display: flex; align-items: center; gap: 10px; width: 170px; min-height: 64px; padding: 6px 14px 6px 8px; border-radius: 22px; background: rgba(2,37,35,.92); box-shadow: inset 0 0 0 2px rgba(248,231,181,.25); font: 800 14px/1.2 var(--body); color: #fff; }
.wait-pill .av { --av: 40px; animation: bob .9s ease-in-out infinite alternate; }
.wait-pill .spin { display: inline-block; width: 13px; height: 13px; margin-right: 5px; vertical-align: -2px; border-radius: 50%; border: 2.5px solid rgba(248,231,181,.25); border-top-color: var(--gold); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* dice: chosen die badge, a six sparkles, "no move" stamp */
.die-btn.selected::after {
  content: attr(data-val); position: absolute; top: -9px; right: -9px; z-index: 3; width: 22px; height: 22px; border-radius: 50%;
  background: var(--gold); color: var(--card); font: 900 12px/22px var(--body); text-align: center; box-shadow: 0 0 0 2px #fff;
}
.die-btn.six .die-img { animation: sixflash .9s ease; }
.die-btn.six::before {
  content: ""; position: absolute; inset: -30%; z-index: 2; pointer-events: none;
  background: radial-gradient(circle, rgba(255,230,140,.95) 0 8%, transparent 9%) 20% 20% / 30% 30% no-repeat,
              radial-gradient(circle, rgba(255,255,255,.95) 0 8%, transparent 9%) 75% 30% / 26% 26% no-repeat,
              radial-gradient(circle, rgba(255,200,69,.95) 0 8%, transparent 9%) 45% 80% / 28% 28% no-repeat;
  animation: sparkle .9s ease forwards;
}
@keyframes sixflash { 25% { filter: brightness(1.6) drop-shadow(0 0 10px #ffc845); transform: scale(1.15); } }
@keyframes sparkle { from { opacity: 1; transform: scale(.6) rotate(0); } to { opacity: 0; transform: scale(1.4) rotate(40deg); } }
.dice { position: relative; }
.dice.nomove::after {
  content: "\2715  No move"; position: absolute; left: 50%; top: 50%; z-index: 5; white-space: nowrap;
  padding: 4px 10px; border-radius: 8px; border: 3px solid #ff6b5e; color: #ff6b5e; background: rgba(2,37,35,.88);
  font: 900 14px var(--body); letter-spacing: .04em; text-transform: uppercase; animation: stamp 1.4s ease forwards;
}
@keyframes stamp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2) rotate(-14deg); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1) rotate(-8deg); }
}

/* where a piece would land */
#preview { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
#preview .c-red { --c: #e52c25; } #preview .c-blue { --c: #1d8fe0; } #preview .c-yellow { --c: #f5c518; } #preview .c-green { --c: #23a047; }
#preview .trail { position: absolute; width: 1.8%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px var(--c); }
#preview .ghost {
  position: absolute; width: 5.8%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  border: 2.5px dashed #fff; background: var(--c); opacity: .8;
  box-shadow: 0 0 0 2px var(--c), 0 0 10px 3px rgba(255,255,255,.85); animation: ghost 1s ease-in-out infinite alternate;
}
#preview .ghost.hit { border-color: #ffc845; box-shadow: 0 0 0 2px #e52c25, 0 0 14px 5px rgba(255,200,69,.9); }
@keyframes ghost { from { opacity: .45; transform: translate(-50%, -50%) scale(.9); } to { opacity: .85; transform: translate(-50%, -50%) scale(1.05); } }

/* board effects */
#fx { position: absolute; inset: 0; z-index: 9; pointer-events: none; }
#fx .fx { position: absolute; transform: translate(-50%, -50%); }
#fx .burst { width: 30%; aspect-ratio: 1; display: grid; place-items: center; animation: burst 1.2s ease forwards; }
#fx .burst::before {
  content: ""; position: absolute; inset: 0; background: #ffc845;
  clip-path: polygon(50% 0, 60% 22%, 82% 10%, 76% 35%, 100% 40%, 80% 56%, 96% 76%, 72% 74%, 72% 100%, 52% 84%, 32% 100%, 30% 76%, 6% 80%, 20% 58%, 0 42%, 24% 34%, 16% 10%, 40% 22%);
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.25));
}
#fx .burst b { position: relative; font: clamp(14px, 4.4vw, 26px)/1 var(--display); color: #fff; -webkit-text-stroke: 1.5px #7d120e; text-shadow: 0 3px 0 #7d120e; transform: rotate(-8deg); white-space: nowrap; }
@keyframes burst {
  0% { transform: translate(-50%, -50%) scale(.2) rotate(-20deg); opacity: 0; }
  18% { transform: translate(-50%, -50%) scale(1.1) rotate(4deg); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.15); opacity: 0; }
}
#fx .puff { width: 11%; aspect-ratio: 1; border-radius: 50%; border: 4px solid var(--c, #fff); animation: puff .7s ease-out forwards; }
#fx .puff.c-red { --c: #e52c25; } #fx .puff.c-blue { --c: #1d8fe0; } #fx .puff.c-yellow { --c: #f5c518; } #fx .puff.c-green { --c: #23a047; }
@keyframes puff { from { transform: translate(-50%, -50%) scale(.4); opacity: 1; } to { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } }
#fx .shield { width: 6%; aspect-ratio: 5 / 6; clip-path: polygon(50% 0, 100% 15%, 92% 60%, 50% 100%, 8% 60%, 0 15%); background: linear-gradient(#bff0ff, #1d8fe0); animation: shield .9s ease forwards; }
@keyframes shield { 0% { transform: translate(-50%, -120%) scale(.5); opacity: 0; } 30% { transform: translate(-50%, -150%) scale(1.1); opacity: 1; } 100% { transform: translate(-50%, -180%) scale(1); opacity: 0; } }
#fx .sparkle {
  width: 26%; aspect-ratio: 1; animation: sparkle 1.2s ease forwards;
  background: radial-gradient(circle, #fff 0 4%, transparent 5%) 10% 20% / 20% 20% no-repeat,
              radial-gradient(circle, #ffc845 0 5%, transparent 6%) 80% 15% / 22% 22% no-repeat,
              radial-gradient(circle, #fff 0 4%, transparent 5%) 70% 80% / 20% 20% no-repeat,
              radial-gradient(circle, #ffc845 0 5%, transparent 6%) 20% 75% / 22% 22% no-repeat,
              radial-gradient(circle, rgba(255,200,69,.6), transparent 60%);
}

.token.fly { transition: left .75s cubic-bezier(.3,.1,.6,1), top .75s cubic-bezier(.25,-1.1,.6,1); z-index: 8; }
.token.fly img { animation: spinfly .75s linear; }
@keyframes spinfly { to { transform: rotate(540deg); } }
.board.shake { animation: boardshake .45s ease; }
@keyframes boardshake { 20% { transform: translate(-5px, 2px); } 40% { transform: translate(5px, -2px); } 60% { transform: translate(-3px, 1px); } 80% { transform: translate(2px, 0); } }
.tag.hurt { animation: hurt .5s ease 2; }
@keyframes hurt { 25% { margin-left: -5px; } 75% { margin-left: 5px; } }

@media (orientation: portrait) and (max-height: 720px) {
  .turn-strip { margin-top: 6px; padding: 5px 8px 3px; }
  .turn-strip .sp > span:last-child { display: none; }
  .turn-strip .sp .av { --av: 22px; }
  .turn-strip .sp.now .av { --av: 26px; }
  #game .msg { min-height: 30px; padding: 5px 12px; font-size: 13px; }
}
@media (orientation: landscape) and (min-aspect-ratio: 6/5) {
  .turn-strip { grid-area: strip; justify-self: center; }
  #game .msg { grid-area: msg; margin: 10px 0; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .turn-strip .sp > span:last-child { display: none; }
  .turn-strip .sp .av { --av: 20px; }
  .turn-strip .sp.now .av { --av: 24px; }
  .turn-strip { margin-top: 4px; padding: 4px 8px 2px; }
  #game .msg { font-size: 12px; padding: 4px 10px; min-height: 26px; }
  .wait-pill { width: 140px; min-height: 44px; font-size: 12px; }
  .wait-pill .av { --av: 30px; }
}
@media (min-width: 700px) and (orientation: portrait) {
  .turn-strip .sp { width: 72px; }
  .turn-strip .sp .av { --av: 34px; }
  .turn-strip .sp.now .av { --av: 42px; }
  .turn-strip .sp > span:last-child { font-size: 12px; max-width: 72px; }
  #game .msg { font-size: 17px; min-height: 44px; }
  .wait-pill { width: 240px; min-height: 80px; font-size: 17px; }
  .wait-pill .av { --av: 54px; }
}

#game .msg.empty { visibility: hidden; }
.tb-text.longer { font-size: 19px; }
@media (min-width: 700px) and (orientation: portrait) { .tb-text.longer { font-size: 28px; } }
@media (orientation: landscape) and (max-height: 520px) { .tb-text.longer { font-size: 13px; } }

/* ---------- loading screen: the rules while the game gets ready ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto;
  background: var(--wood) url("../img/wood.png") center / cover;
  display: flex; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  transition: opacity .4s ease, transform .4s ease;
}
.loader.out { opacity: 0; transform: scale(1.04); pointer-events: none; }
.ld-inner { width: min(460px, 100%); min-height: 100%; display: flex; flex-direction: column; align-items: center; }
.ld-logo { margin: 18px 0 16px; width: min(320px, 80vw); animation: lddrop .7s cubic-bezier(.2,.9,.3,1.3) both; }
.ld-logo .logo-inner { font-size: clamp(48px, 15vw, 70px); }
.ld-logo .logo-top img { animation: ldhop .5s ease both; }
.ld-logo .logo-top img:nth-child(2) { animation-delay: .1s; } .ld-logo .logo-top img:nth-child(3) { animation-delay: .2s; }
.ld-logo .logo-top img:nth-child(4) { animation-delay: .3s; } .ld-logo .logo-top img:nth-child(5) { animation-delay: .4s; }
@keyframes lddrop { from { transform: translateY(-40px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ldhop { 0% { transform: translateY(-14px); opacity: 0; } 60% { transform: translateY(2px); opacity: 1; } 100% { transform: none; } }
.ld-card { width: 100%; padding: 18px 14px 12px; border-radius: 26px; background: rgba(2,37,35,.95); box-shadow: 0 0 0 3px rgba(248,231,181,.2), 0 10px 24px rgba(0,0,0,.35); animation: slideup .5s ease .15s both; }
.ld-card h2 { margin: 0 0 12px; text-align: center; font: 26px/1 var(--display); color: var(--cream-light); letter-spacing: .02em; text-transform: none; }
.ld-pages { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.ld-pages::-webkit-scrollbar { display: none; }
.ld-page { flex: 0 0 100%; scroll-snap-align: start; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: start; }
.ld-rule { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 12px 8px; border-radius: 16px; background: var(--card-soft); }
.ld-rule img { width: 44px; height: 44px; object-fit: contain; }
.ld-rule > b { font: 18px/1 var(--display); color: var(--gold); letter-spacing: .03em; font-weight: 400; margin-top: 2px; }
.ld-rule > span:last-child { font: 600 12px/1.35 var(--body); color: var(--cream-light); }
.ld-rule > span:last-child b { color: var(--gold); }
.ld-rule.wide { grid-column: 1 / -1; }
.ld-ic { display: flex; gap: 4px; height: 44px; align-items: center; }
.ld-ic img { width: 40px; height: 40px; border-radius: 50%; background: var(--gold); }
.ld-ic.phones span { width: 20px; height: 34px; border-radius: 5px; box-shadow: inset 0 0 0 3px var(--cream); }
.ld-ic.phones span:nth-child(2) { transform: translateY(-5px); }
.ld-dots { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.ld-dots button { width: 9px; height: 9px; border-radius: 50%; background: rgba(248,231,181,.3); transition: width .2s, background .2s; }
.ld-dots button.on { width: 22px; border-radius: 5px; background: var(--gold); }
.ld-foot { width: 100%; margin-top: auto; padding: 20px 0 8px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ld-bar { width: 86%; height: 16px; padding: 3px; border-radius: 999px; background: rgba(2,37,35,.85); box-shadow: inset 0 0 0 2px rgba(248,231,181,.35); }
.ld-bar i { display: block; width: 4%; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f9d67a, #e7a73c); box-shadow: 0 0 10px rgba(255,200,69,.6); transition: width .25s ease;
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 0 0; } to { background-position: -200% 0; } }
.ld-status { margin: 0; font: 800 14px var(--body); color: var(--cream); text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.ld-play { max-width: 340px; font: 24px/1 var(--display); letter-spacing: .03em; padding: 16px; animation: playpulse 1.1s ease-in-out infinite alternate; }
@keyframes playpulse { from { transform: scale(1); } to { transform: scale(1.04); } }

/* ---------- votes: pictures, countdown ring, voters ---------- */
.vote-card { text-align: center; }
.vote-art { position: relative; width: 104px; height: 104px; margin: 0 auto 8px; display: grid; place-items: center; }
.vote-art > .av { --av: 80px; box-shadow: 0 0 0 4px #fff, 0 6px 14px rgba(0,0,0,.35); animation: hostpop .5s cubic-bezier(.2,.9,.3,1.4) both; }
.vote-art.away > .av { filter: grayscale(.85); }
.vote-art .ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.vote-art .ring circle { fill: none; stroke-width: 5; }
.vote-art .ring .bg { stroke: rgba(248,231,181,.18); }
.vote-art .ring .fg { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset .5s linear; }
.vote-art .secs { position: absolute; right: -16px; bottom: 0; padding: 3px 8px; border-radius: 999px; background: var(--gold); color: var(--card); font: 900 13px var(--body); }
.vote-art .vbadge { position: absolute; left: -4px; bottom: 2px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 0 0 3px var(--card); }
.vote-art .vbadge.off { background: #ff6b5e; }
.vote-art .vbadge.off svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }
.vote-art .vbadge.ai { background: transparent; }
.vote-art .vbadge.ai .av { --av: 32px; }
.vote-card h2 { margin: 8px 0 6px; }
.vote-card .lead { margin-bottom: 12px; }
.voters { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; margin: 0 0 14px; }
.voters:empty { display: none; }
.voters div { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; font: 800 11px var(--body); color: var(--cream-light); }
.voters .av { --av: 42px; }
.voters i { position: absolute; top: 24px; right: -6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 900 12px var(--body); font-style: normal; box-shadow: 0 0 0 2px var(--card); animation: hostpop .35s cubic-bezier(.2,.9,.3,1.6) both; }
.voters i.y { background: #3fdc6a; color: #06331a; }
.voters i.n { background: #ff6b5e; color: #fff; }
.voters i.w { background: var(--card-soft); color: var(--cream); animation: none; }
.vote-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 8px; min-height: 96px; border-radius: 18px; font: 800 13px/1.25 var(--body); }
.vbtn.yes { background: var(--gold); color: var(--card); box-shadow: 0 4px 0 #b9862a; }
.vbtn.no { color: var(--cream); box-shadow: inset 0 0 0 2px var(--cream); }
.vbtn:active { transform: translateY(2px); }
.vbtn .av { --av: 40px; }
.vic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(2,37,35,.15); font: 900 20px var(--body); }
.vbtn.no .vic { background: rgba(248,231,181,.15); }
.vic.pause svg { width: 20px; height: 20px; fill: currentColor; }
.vic.big { width: 80px; height: 80px; font-size: 40px; background: var(--card-soft); color: var(--gold); }

/* ---------- paused: big code, steps, share ---------- */
.pause-card { text-align: center; }
.pause-icon { width: 70px; height: 70px; margin: 0 auto 6px; border-radius: 50%; background: var(--gold); display: grid; place-items: center; box-shadow: 0 0 0 6px rgba(255,200,69,.25); animation: hostpop .5s cubic-bezier(.2,.9,.3,1.4) both; }
.pause-icon svg { width: 34px; height: 34px; fill: var(--card); }
.pause-who { display: flex; justify-content: center; gap: 6px; margin: 4px 0 6px; }
.pause-who:empty { display: none; }
.pause-who .av { --av: 40px; filter: grayscale(.7); }
.code-tiles { display: flex; justify-content: center; gap: 6px; margin: 6px 0 14px; }
.code-tiles i { width: 46px; height: 58px; border-radius: 12px; background: var(--card-soft); display: grid; place-items: center; font: normal 32px var(--display); color: var(--gold); box-shadow: inset 0 0 0 2px rgba(255,200,69,.5); animation: tiledrop .45s cubic-bezier(.2,.9,.3,1.4) both; }
.code-tiles i:nth-child(2) { animation-delay: .06s; } .code-tiles i:nth-child(3) { animation-delay: .12s; } .code-tiles i:nth-child(4) { animation-delay: .18s; } .code-tiles i:nth-child(5) { animation-delay: .24s; }
@keyframes tiledrop { from { transform: translateY(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
.pause-steps { display: flex; gap: 6px; margin: 0 0 10px; }
.pause-steps div { flex: 1; padding: 8px 4px; border-radius: 12px; background: var(--card-soft); font: 700 11px/1.3 var(--body); color: var(--cream-light); }
.pause-steps b { display: block; width: 22px; height: 22px; margin: 0 auto 4px; border-radius: 50%; background: var(--gold); color: var(--card); font: 900 12px/22px var(--body); }
.pause-actions .pill + .pill { margin-top: 10px; }

/* ---------- results: podium and stats ---------- */
.results-wrap { width: min(440px, 100%); text-align: center; padding: 10px 0 20px; }
.win-title { margin: 6px 0 4px; font: clamp(34px, 10vw, 48px)/1 var(--display); color: var(--cream-light); text-shadow: 0 3px 0 #6b3d14; letter-spacing: .02em; text-transform: none; animation: lddrop .6s cubic-bezier(.2,.9,.3,1.3) both; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 6px; margin: 16px 0 0; min-height: 250px; }
.pod { display: flex; flex-direction: column; align-items: center; width: 31%; max-width: 128px; }
.pod .av { --av: 58px; margin-bottom: 6px; box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(0,0,0,.3); animation: hostpop .5s cubic-bezier(.2,.9,.3,1.4) both; }
.pod.first .av { --av: 86px; box-shadow: 0 0 0 4px #fff, 0 0 26px 8px rgba(255,200,69,.8); animation-delay: .5s; }
.pod.second .av { animation-delay: .3s; } .pod.third .av { animation-delay: .15s; }
.pod .pcrown { width: 54px; margin-bottom: -8px; position: relative; z-index: 1; animation: crowndrop .5s cubic-bezier(.2,.9,.3,1.4) .8s both; }
@keyframes crowndrop { from { transform: translateY(-30px) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
.pod b { font: 800 15px var(--body); color: #fff; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod.me b { color: var(--gold); }
.pod small { font: 700 11px var(--body); color: var(--cream); margin: 2px 0 6px; }
.pod .blk { width: 100%; border-radius: 14px 14px 0 0; display: flex; justify-content: center; padding-top: 8px; font: 38px/1 var(--display); color: var(--card); box-shadow: inset 0 -6px 0 rgba(0,0,0,.15); transform-origin: bottom; animation: rise .6s cubic-bezier(.2,.9,.3,1.1) both; }
.pod.first .blk { height: 110px; background: linear-gradient(#f9d67a, #d8902a); animation-delay: .35s; }
.pod.second .blk { height: 80px; background: linear-gradient(#eef1f4, #aab3bb); animation-delay: .2s; }
.pod.third .blk { height: 60px; background: linear-gradient(#f0b98a, #b36b33); animation-delay: .05s; }
@keyframes rise { from { transform: scaleY(0); } to { transform: none; } }
.standings.rest { max-width: 360px; margin: 10px auto 0; }
.standings.rest:empty { display: none; }
.standings.rest .av { --av: 28px; }
.game-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 6px; padding: 12px; border-radius: 0 0 22px 22px; background: rgba(2,37,35,.95); box-shadow: 0 8px 18px rgba(0,0,0,.3); }
.gs { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.gs .av { --av: 30px; }
.gs .vic { width: 30px; height: 30px; font-size: 16px; background: var(--card-soft); color: var(--gold); }
.gs b { font: 24px/1 var(--display); color: var(--gold); margin-top: 4px; font-weight: 400; }
.gs > span:last-child { font: 700 11px var(--body); color: var(--cream); }
#results .pill { max-width: 360px; }
@media (min-width: 700px) {
  .pod .av { --av: 76px; }
  .pod.first .av { --av: 110px; }
  .podium { min-height: 300px; }
}
#results { background: rgba(24,12,4,.93); }

/* ---------- picture page: choose a Nigerian landmark or heritage picture ---------- */
.pf-btn { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 12px; border-radius: 14px; }
.pf-btn .av { --av: 50px; box-shadow: 0 0 0 3px var(--gold), 0 3px 8px rgba(0,0,0,.35); transition: transform .15s; }
.pf-btn small { font: 800 11px var(--body); color: var(--card); background: var(--gold); padding: 2px 8px; border-radius: 999px; }
.pf-btn:active .av { transform: scale(.94); }
.pf-caption { margin: -4px 0 12px; font: 600 13px var(--body); color: rgba(248,231,181,.8); }
.pf-caption b { color: var(--cream); }
.invite .pf-caption { text-align: left; }

#profile { z-index: 30; }
.profile-card { width: min(480px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; padding: 26px 18px 20px; text-align: center; }
.profile-card h2 { margin: 0 0 12px; }
.pf-now { display: flex; align-items: center; gap: 14px; margin: 0 4px 14px; padding: 10px 12px; border-radius: 16px; background: rgba(255,255,255,.07); text-align: left; }
.pf-big { width: 76px; height: 76px; flex: none; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 3px var(--gold), 0 0 16px rgba(255,200,69,.5); }
.pf-big img { width: 100%; height: 100%; display: block; }
.pf-big.pop { animation: pf-pop .35s cubic-bezier(.2,1.5,.5,1); }
@keyframes pf-pop { from { transform: scale(.7); } to { transform: scale(1); } }
.pf-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pf-info b { font: 400 22px/1.1 var(--display); color: var(--gold); }
.pf-info span { font: 700 13px var(--body); color: var(--cream); opacity: .8; }
.pf-grid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; padding: 4px; margin: 0 -4px 14px; overscroll-behavior: contain; }
.pf-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 4px 8px; border-radius: 14px; background: rgba(255,255,255,.06); color: #fff; transition: background .15s, transform .15s; }
.pf-tile img { width: 62px; height: 62px; border-radius: 50%; margin-bottom: 4px; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.pf-tile b { font: 800 11.5px/1.2 var(--body); }
.pf-tile small { font: 600 10px/1.2 var(--body); color: rgba(248,231,181,.65); }
.pf-tile:active { transform: scale(.96); }
.pf-tile.on { background: rgba(255,200,69,.18); box-shadow: inset 0 0 0 2px var(--gold); }
.pf-tile.on img { box-shadow: 0 0 0 3px var(--gold); }
.pf-tile.on::after { content: "✓"; position: absolute; top: 6px; right: 8px; width: 20px; height: 20px; border-radius: 50%; background: var(--gold); color: var(--card); font: 900 12px/20px var(--body); }
.pf-actions { display: flex; gap: 10px; justify-content: center; }
.pf-actions .pill { margin: 0; }
.pick-btn .who small { display: block; font: 600 11px var(--body); color: rgba(248,231,181,.65); overflow: hidden; text-overflow: ellipsis; }
@media (max-height: 640px) {
  .pf-big { width: 56px; height: 56px; }
  .pf-tile img { width: 50px; height: 50px; }
}
.pf-grid { position: relative; }
.pf-actions .pill { flex: 1; max-width: 200px; white-space: nowrap; padding-left: 12px; padding-right: 12px; font-size: 19px; }

/* ---------- install the app ---------- */
#install-row { animation-delay: .42s; }
#install-row .app-ic { border-radius: 9px; }
#install-row.hidden { display: none; }

/* ---------- numbered how-to steps on the setup screen and in the lobby ---------- */
.how-steps { list-style: none; counter-reset: hs; margin: 2px 0 14px; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.06); text-align: left; display: grid; gap: 9px; }
.how-steps li { counter-increment: hs; display: flex; gap: 10px; align-items: flex-start; font: 500 13.5px/1.4 var(--body); color: var(--cream); transition: opacity .25s; }
.how-steps li::before { content: counter(hs); flex: none; width: 22px; height: 22px; margin-top: -1px; border-radius: 50%; background: var(--gold); color: var(--card); display: grid; place-items: center; font: 900 12px var(--body); }
.how-steps b { color: #fff; font-weight: 800; }
#lobby-steps li { opacity: .55; }
#lobby-steps li.now { opacity: 1; }
#lobby-steps li.done { opacity: .75; }
#lobby-steps li.done::before { content: "\2713"; background: #3fdc6a; }
#mode-hint { margin-bottom: 8px; }

/* ---------- game rules, chosen before each game (setup screen and lobby) ---------- */
.rules-box { margin: 14px 0 6px; padding: 12px 14px 14px; border-radius: 16px; background: rgba(255,255,255,.06); text-align: left; }
.rules-box h3 { margin: 0; font: 400 20px/1.1 var(--display); color: var(--gold); letter-spacing: .02em; }
.rules-box h3 small { display: block; margin-top: 3px; font: 600 12px/1.3 var(--body); color: var(--cream); opacity: .7; letter-spacing: 0; }
.toggle.rule-row { margin: 12px 0 0; align-items: flex-start; }
.toggle.rule-row .switch { margin-top: 1px; }
.rule-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rule-text b { font: 800 14.5px/1.25 var(--body); color: #fff; }
.rule-text small { font: 600 12.5px/1.35 var(--body); color: var(--cream); opacity: .85; }
