/* ============================================================================
   רמז — party word game · 3 themes, RTL, mobile-first
   ========================================================================== */
:root {
  /* ---- Boutique (warm, cozy, skeuomorphic) — DEFAULT ---- */
  --bg: #e8dabd; --bg2: #e0d0ad;
  --surface: #fbf4e5; --surface-2: #f1e3c8;
  --ink: #3b2d1d; --muted: #90795a; --line: rgba(92,66,28,0.16);
  --accent: #2f5c8a; --accent2: #c34b34; --good: #3f9c6d; --bad: #c34b34; --gold: #cc9a3e;
  --on-accent: #fbf4e5;
  --glow: 0 10px 22px -10px rgba(74,48,16,0.45);
  --paper: #fbf4e5; --wood: #a9743f; --card-edge: #e6d5b2;
  --track: rgba(96,64,26,0.14); --track-2: var(--accent);
  --radius: 22px; --radius-lg: 32px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", "Assistant", "Arial Hebrew", system-ui, sans-serif;
  --display: "Suez One", "Rubik", var(--font);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
/* ---- Cyberpunk Neon (opt-in) ---- */
[data-theme="cyber"] {
  --bg: #140b26; --bg2: #1e1140; --surface: #241748; --surface-2: #2c1c56;
  --ink: #f3ecff; --muted: #a99bd0; --line: rgba(160,140,220,0.18);
  --accent: #48f0a0; --accent2: #ff4fa3; --good: #48f0a0; --bad: #ff5f8f; --gold: #ffd166;
  --on-accent: #10121a;
  --glow: 0 0 24px rgba(72,240,160,0.5);
  --track: rgba(255,255,255,0.07); --track-2: var(--accent);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Rubik", "Assistant", Arial, system-ui, sans-serif;
  --display: var(--font);
}
/* ---- Casino Classic ---- */
[data-theme="casino"] {
  --bg: #0c3a2c; --bg2: #114a39; --surface: #0f5340; --surface-2: #14614b;
  --ink: #f6f1e2; --muted: #bcd8c9; --line: rgba(231,197,107,0.22);
  --accent: #e7c56b; --accent2: #ffffff; --good: #8fd694; --bad: #e8836f; --gold: #e7c56b;
  --on-accent: #123528;
  --glow: 0 0 22px rgba(231,197,107,0.4);
}
/* ---- Retro 8-Bit ---- */
[data-theme="retro"] {
  --bg: #180f2e; --bg2: #221543; --surface: #2a1a52; --surface-2: #341f63;
  --ink: #fdf6e3; --muted: #b6a6e0; --line: rgba(57,255,20,0.25);
  --accent: #39ff14; --accent2: #ff2e88; --good: #39ff14; --bad: #ff2e88; --gold: #ffe14d;
  --on-accent: #10121a;
  --glow: 0 0 0 rgba(0,0,0,0);
  --font: "Courier New", ui-monospace, Menlo, Consolas, monospace;
  --radius: 8px; --radius-lg: 12px;
}
[data-theme="retro"] .btn, [data-theme="retro"] .card-face, [data-theme="retro"] .tile,
[data-theme="retro"] .panel, [data-theme="retro"] .chip, [data-theme="retro"] .word {
  box-shadow: 4px 4px 0 rgba(0,0,0,0.5) !important; border-width: 2px !important;
}

/* ---- Boutique skeuomorphic depth (physical wood / pressed cardboard / paper) ---- */
[data-theme="boutique"] .panel,
[data-theme="boutique"] .snode,
[data-theme="boutique"] .chat {
  border: 1px solid var(--card-edge);
  box-shadow: 0 2px 0 var(--card-edge), 0 12px 22px -14px rgba(74,48,16,0.5), inset 0 1px 0 rgba(255,255,255,0.7);
}
[data-theme="boutique"] .btn { box-shadow: 0 3px 0 rgba(74,48,16,0.22), 0 10px 18px -10px rgba(74,48,16,0.45); border: 1px solid var(--card-edge); }
[data-theme="boutique"] .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(74,48,16,0.22); }
[data-theme="boutique"] .btn-primary { border-color: transparent; text-shadow: 0 1px 0 rgba(0,0,0,0.15); }
[data-theme="boutique"] .btn-primary:active { transform: translateY(2px); }
/* the spiral path looks like a warm wooden groove */
[data-theme="boutique"] .ribbon { filter: drop-shadow(0 3px 5px rgba(74,48,16,0.28)); }
[data-theme="boutique"] .snode.cur { box-shadow: 0 0 0 3px var(--gold), 0 10px 20px -8px rgba(74,48,16,0.55); animation: bobCur 1.6s ease-in-out infinite; }
[data-theme="boutique"] .neon-title, [data-theme="boutique"] .title { text-shadow: 0 2px 0 rgba(255,255,255,0.4); }

/* ---- Animated character tokens (idle float + landing squash) ---- */
.onode .tok { animation: idleBob 2.6s ease-in-out infinite; transform-origin: 50% 90%; will-change: transform; display: inline-block; }
.onode .tok.landed { animation: landSquash 0.5s var(--ease) 1; }
@keyframes idleBob { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-9%) scale(0.99, 1.02); } }
@keyframes landSquash { 0% { transform: translateY(-70%) scale(0.86, 1.2); } 55% { transform: translateY(0) scale(1.18, 0.8); } 78% { transform: translateY(-10%) scale(0.95, 1.06); } 100% { transform: translateY(0) scale(1, 1); } }
@keyframes bobCur { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -54%) scale(1.05); } }

/* ---- Landing particles (dust/paper ring on power tiles) ---- */
.spark { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); pointer-events: none; z-index: 5; transform: translate(-50%, -50%); animation: sparkFly 0.72s ease-out forwards; }
@keyframes sparkFly { 0% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2); } }
.ring-burst { position: absolute; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--gold); pointer-events: none; z-index: 4; transform: translate(-50%, -50%); animation: ringGrow 0.6s ease-out forwards; }
@keyframes ringGrow { 0% { opacity: .9; transform: translate(-50%, -50%) scale(0.4); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(4.5); } }

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font); color: var(--ink);
  background: radial-gradient(900px 600px at 50% -10%, var(--bg2) 0%, var(--bg) 60%), var(--bg);
  -webkit-font-smoothing: antialiased; display: grid; place-items: center; overflow: hidden;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
::selection { background: var(--accent); color: var(--on-accent); }

#frame { position: relative; width: 460px; height: min(940px, 100dvh); overflow: hidden; border-radius: 34px; box-shadow: 0 40px 90px -30px rgba(0,0,0,0.7); background: var(--bg); }
#app { position: absolute; inset: 0; overflow: hidden; }
@media (max-width: 480px) { body { display: block; overflow: hidden; } #frame { width: 100%; height: 100dvh; border-radius: 0; } }

/* Boutique: soft warm paper/canvas texture (no grid). */
#frame::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.9;
  background-image:
    radial-gradient(1100px 500px at 50% -8%, rgba(255,250,238,0.6), transparent 70%),
    radial-gradient(circle at 20% 12%, rgba(255,255,255,0.25), transparent 30%),
    repeating-linear-gradient(0deg, rgba(120,86,40,0.035) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(90deg, rgba(120,86,40,0.03) 0 2px, transparent 2px 4px);
}
/* Neon themes keep the glowing backdrop grid. */
[data-theme="cyber"] #frame::before, [data-theme="retro"] #frame::before {
  opacity: 0.5;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px; mask: radial-gradient(120% 80% at 50% 0%, #000 30%, transparent 75%);
}

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom)); overflow-y: auto; animation: slideup 0.4s var(--ease) both; }
.screen::-webkit-scrollbar { width: 0; }
.grow { flex: 1; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }

/* text */
.title { font-family: var(--display); font-size: 30px; font-weight: 800; letter-spacing: -0.01em; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; color: var(--accent); text-transform: uppercase; }
.muted { color: var(--muted); }
.h2 { font-size: 18px; font-weight: 800; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%; padding: 16px; border-radius: 16px; font-size: 16px; font-weight: 800; transition: transform 0.14s var(--ease), filter 0.2s, box-shadow 0.2s; }
.btn:active { transform: scale(0.97); }
.btn-primary { color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: var(--glow); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); }
.btn-lg { padding: 20px; font-size: 18px; }
.btn[disabled] { opacity: 0.45; cursor: default; box-shadow: none; }

.panel { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 16px; }
.chip { padding: 9px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 700; color: var(--muted); background: var(--surface); border: 1.5px solid var(--line); transition: all 0.18s; }
.chip.on { color: var(--on-accent); background: var(--accent); border-color: transparent; }

/* ---- Welcome ------------------------------------------------------------- */
.logo { width: 128px; height: 128px; margin-bottom: 8px; filter: drop-shadow(0 10px 30px rgba(0,0,0,0.5)); }
.welcome .title { font-size: 46px; margin-top: 6px; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.welcome .sub { color: var(--muted); font-size: 15px; margin-top: 8px; max-width: 300px; }
.theme-picker { display: flex; gap: 10px; margin: 26px 0 6px; }
.theme-dot { flex: 1; padding: 12px 8px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); text-align: center; transition: all 0.2s; }
.theme-dot.on { border-color: var(--accent); box-shadow: var(--glow); }
.theme-dot .sw { display: flex; justify-content: center; gap: 3px; margin-bottom: 6px; }
.theme-dot .sw i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.theme-dot .nm { font-size: 11px; font-weight: 700; }

/* modal */
.modal-scrim { position: absolute; inset: 0; z-index: 50; background: rgba(10,6,20,0.7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 24px; opacity: 0; pointer-events: none; transition: opacity 0.25s; }
.modal-scrim.open { opacity: 1; pointer-events: auto; }
.modal { width: 100%; max-width: 380px; background: var(--bg2); border: 1.5px solid var(--line); border-radius: var(--radius-lg); padding: 22px; max-height: 80dvh; overflow-y: auto; }
.modal h3 { font-size: 20px; font-weight: 800; margin-bottom: 12px; }
.modal ol { padding-inline-start: 20px; display: flex; flex-direction: column; gap: 9px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.modal .close { margin-top: 18px; }

/* ---- Setup --------------------------------------------------------------- */
.setup-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 13px; font-weight: 800; margin-bottom: 10px; color: var(--ink); }
.seg { display: flex; gap: 6px; background: var(--surface); padding: 5px; border-radius: 14px; border: 1.5px solid var(--line); }
.seg button { flex: 1; padding: 11px; border-radius: 10px; font-size: 14px; font-weight: 700; color: var(--muted); transition: all 0.2s; }
.seg button.on { color: var(--on-accent); background: var(--accent); }
.teams-list { display: flex; flex-direction: column; gap: 10px; }
.team-row { display: flex; align-items: center; gap: 10px; }
.token-btn { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: var(--surface); border: 1.5px solid var(--line); }
.team-row input { flex: 1; padding: 13px 15px; font-size: 15px; border-radius: 13px; background: var(--surface); border: 1.5px solid var(--line); color: var(--ink); outline: none; }
.team-row input:focus { border-color: var(--accent); }
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat { display: flex; align-items: center; gap: 9px; padding: 13px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); font-size: 14px; font-weight: 700; transition: all 0.2s; }
.cat.on { border-color: var(--accent); box-shadow: var(--glow); }
.cat .em { font-size: 18px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); }
.toggle { position: relative; width: 46px; height: 27px; border-radius: 999px; background: rgba(255,255,255,0.14); flex: none; transition: background 0.25s; }
.toggle::after { content: ""; position: absolute; top: 3px; right: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: transform 0.25s var(--ease); }
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(-19px); }

/* ---- Dice ---------------------------------------------------------------- */
.dice-stage { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; perspective: 750px; }
.dice-team { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); transition: border-color 0.3s, box-shadow 0.3s; }
.dice-team.win { border-color: var(--accent); box-shadow: var(--glow); }
.dice-team .tk { font-size: 26px; }
.dice-team .nm { flex: 1; font-weight: 800; font-size: 15px; }
/* ---- 3D physics-style dice (real tumbling cube) ---- */
.dice3d { width: 60px; height: 60px; position: relative; }
.cube { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateX(-24deg) rotateY(18deg); }
.face { position: absolute; width: 60px; height: 60px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(150deg, #fbf4e5, #ead7b3); border: 1px solid var(--card-edge);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.78), inset 0 -4px 9px rgba(120,84,40,0.22); }
.face .die-face { transform: scale(0.92); }
.f1 { transform: rotateY(0deg) translateZ(30px); }
.f2 { transform: rotateY(90deg) translateZ(30px); }
.f3 { transform: rotateX(90deg) translateZ(30px); }
.f4 { transform: rotateX(-90deg) translateZ(30px); }
.f5 { transform: rotateY(-90deg) translateZ(30px); }
.f6 { transform: rotateY(180deg) translateZ(30px); }
.dice-sh { position: absolute; left: 50%; bottom: -13px; width: 52px; height: 12px; border-radius: 50%; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(74,48,16,0.42), transparent); }
.dice3d.drop { animation: diceDrop 0.62s cubic-bezier(.3,1.35,.5,1) both; }
@keyframes diceDrop { 0% { transform: translateY(-48px); } 55% { transform: translateY(0); } 72% { transform: translateY(-9px); } 100% { transform: translateY(0); } }
.order-badge { font-size: 12px; font-weight: 800; color: var(--accent); }

/* ---- Lineup -------------------------------------------------------------- */
.lineup .lu-team { text-align: center; animation: pop 0.5s var(--ease) both; margin-bottom: 24px; }
.lineup .lu-tk { font-size: 64px; filter: drop-shadow(0 10px 24px rgba(0,0,0,0.5)); }
.lineup .lu-name { font-size: 26px; font-weight: 900; margin-top: 6px; }
.lineup .lu-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---- Board --------------------------------------------------------------- */
.board-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.scoreline { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.score-pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: var(--surface); border: 1.5px solid var(--line); }
.score-pill.cur { border-color: var(--accent); box-shadow: var(--glow); }
.track { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin: 6px 0 16px; }
.tile { position: relative; aspect-ratio: 1/1; border-radius: 12px; display: grid; place-items: center; font-size: 15px; font-weight: 800; background: var(--surface); border: 1.5px solid var(--line); color: var(--muted); }
.tile.lvl { color: var(--ink); }
.tile.power { border-color: var(--gold); color: var(--gold); }
.tile.finish { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); }
.tile .tokens { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 1px; font-size: 17px; }
.turn-banner { text-align: center; margin-bottom: 14px; }
.turn-banner .who { font-size: 24px; font-weight: 900; }
.turn-banner .lvl-b { display: inline-block; margin-top: 8px; padding: 6px 16px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--on-accent); background: var(--accent); }

/* ---- Turn / card --------------------------------------------------------- */
.turn { position: absolute; inset: 0; display: flex; flex-direction: column; padding: calc(16px + var(--safe-top)) 18px calc(18px + var(--safe-bottom)); background: radial-gradient(700px 500px at 50% 0%, var(--bg2), var(--bg)); }
.turn-hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hud-team { font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; gap: 7px; }
.hud-lvl { font-size: 12px; font-weight: 800; color: var(--on-accent); background: var(--accent); padding: 4px 11px; border-radius: 999px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 900; font-size: 20px; color: var(--ink); display: inline-flex; align-items: center; gap: 8px; }
.timer.low { color: var(--bad); animation: pulse 0.6s infinite; }
.timer .ring { width: 40px; height: 40px; }
.hud-score { font-size: 13px; font-weight: 800; color: var(--muted); }

/* ---- Poker-style physical card — adapts to the chosen theme, with gold foil ---- */
.card-stage { flex: 1; display: flex; align-items: center; justify-content: center; perspective: 1600px; margin: 8px 0; }
.card { width: 100%; max-width: 330px; aspect-ratio: 0.7; position: relative; transform-style: preserve-3d; transition: transform 0.6s var(--ease); cursor: pointer; }
.card.flipped { transform: rotateY(180deg); }
.card-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 16px; overflow: hidden; background: var(--surface);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 8%, var(--surface)), inset 0 0 0 3.5px var(--line), inset 0 0 26px rgba(0,0,0,0.14), 0 16px 26px -8px rgba(0,0,0,0.42); }
/* separate the two faces in depth so neither bleeds through as mirrored text */
.card-back { transform: translateZ(0.6px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 60%),
    repeating-linear-gradient(45deg, color-mix(in srgb, var(--accent) 15%, transparent) 0 5px, transparent 5px 11px),
    repeating-linear-gradient(-45deg, color-mix(in srgb, var(--accent) 15%, transparent) 0 5px, transparent 5px 11px),
    var(--surface); }
.card-front { transform: rotateY(180deg) translateZ(0.6px); padding: 18px; display: flex; flex-direction: column; gap: 7px; }
/* luxe gold ornamental frame */
.card-face::after { content: ""; position: absolute; inset: 10px; border: 1.5px solid var(--gold); border-radius: 10px; pointer-events: none; box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--gold) 20%, transparent), inset 0 0 16px color-mix(in srgb, var(--gold) 16%, transparent); }
/* light catch on flip */
.card-face::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3; background: linear-gradient(115deg, transparent 34%, rgba(255,255,255,0.5) 48%, transparent 60%); background-size: 300% 100%; background-position: 130% 0; }
.card.flipped .card-front::before { animation: sheen 0.9s var(--ease) 0.15s; }
@keyframes sheen { from { background-position: 130% 0; } to { background-position: -40% 0; } }
.card-back .rr { font-family: var(--display); font-size: 58px; font-weight: 900; color: var(--accent); -webkit-text-fill-color: currentColor; text-shadow: 0 2px 0 color-mix(in srgb, var(--surface) 70%, #fff), 0 4px 10px rgba(0,0,0,0.3); z-index: 2; }
.card-back .tap { font-size: 12.5px; color: var(--muted); font-weight: 700; background: color-mix(in srgb, var(--surface) 85%, transparent); padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); z-index: 2; }
.word { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: color-mix(in srgb, var(--ink) 5%, transparent); border: 1.5px solid transparent; color: var(--muted); font-size: 15px; font-weight: 700; opacity: 0.55; transition: all 0.2s; }
.word .lv { flex: none; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--muted); }
.word.target { opacity: 1; color: var(--on-accent); background: linear-gradient(120deg, var(--good), color-mix(in srgb, var(--good) 55%, #000)); border-color: transparent; box-shadow: 0 5px 14px -3px color-mix(in srgb, var(--good) 55%, transparent); font-size: 18px; font-weight: 900; }
.word.target .lv { background: rgba(0,0,0,0.24); color: #fff; }
.word.fog { filter: blur(7px); }

.turn-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.act { padding: 20px; border-radius: 18px; font-size: 17px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; gap: 9px; transition: transform 0.12s var(--ease); }
.act:active { transform: scale(0.96); }
.act.correct { color: #08160f; background: var(--good); box-shadow: var(--glow); }
.act.skip { color: #fff; background: rgba(255,95,143,0.18); border: 1.5px solid var(--bad); }
.act[disabled] { opacity: 0.4; }
.turn-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12px; color: var(--muted); font-weight: 700; }

.grace { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10,6,20,0.55); z-index: 5; }
.grace .g-card { background: var(--bg2); border: 1.5px solid var(--accent); border-radius: 20px; padding: 22px; text-align: center; box-shadow: var(--glow); }

/* ---- Powerup toast / banner ---------------------------------------------- */
.pow-banner { position: relative; z-index: 8; margin-bottom: 10px; padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--gold); color: var(--gold); font-weight: 800; font-size: 13.5px; display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 30px -10px rgba(0,0,0,0.6); animation: slidedown 0.3s var(--ease) both; }

/* ---- Results ------------------------------------------------------------- */
.trophy { font-size: 74px; text-align: center; animation: pop 0.5s var(--ease) both; }
.winner-name { text-align: center; font-size: 30px; font-weight: 900; margin-top: 6px; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.standings { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.stand { display: flex; align-items: center; gap: 13px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); }
.stand.first { border-color: var(--gold); box-shadow: 0 0 22px rgba(255,209,102,0.3); }
.stand .rank { font-size: 18px; font-weight: 900; width: 26px; }
.stand .tk { font-size: 24px; }
.stand .nm { flex: 1; font-weight: 800; }
.stand .pts { font-weight: 900; font-size: 17px; }

.toast { position: absolute; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%); z-index: 60; padding: 12px 20px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 13.5px; box-shadow: var(--glow); animation: toastIn 0.3s var(--ease) both; white-space: nowrap; }

/* ---- animations ---------------------------------------------------------- */
@keyframes slideup { from { opacity: 0; transform: translateY(16px); } }
@keyframes slidedown { from { opacity: 0; transform: translateY(-14px); } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes roll { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(0.9); } 100% { transform: rotate(360deg) scale(1); } }
@keyframes pulse { 50% { opacity: 0.55; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }
/* ---- icons / tokens ------------------------------------------------------ */
.ic { display: inline-block; vertical-align: -0.15em; }
.tok { display: inline-flex; align-items: center; }
.btn .ic, .act .ic, .score-pill .ic { vertical-align: -0.2em; }

/* ---- dice ---------------------------------------------------------------- */
.die { background: linear-gradient(150deg, #fff, #dfe2ec); border-radius: 14px; padding: 9px; box-shadow: 0 8px 18px -6px rgba(0,0,0,.5), inset 0 2px 0 rgba(255,255,255,.85); }
.die-face { width: 36px; height: 36px; display: grid; grid-template-columns: repeat(3,1fr); grid-template-rows: repeat(3,1fr); gap: 2px; }
.die-face i { border-radius: 50%; }
.die-face i.on { background: #1b1e28; box-shadow: inset 0 1px 1px rgba(0,0,0,.4); }

/* ---- spiral board -------------------------------------------------------- */
.spiral { position: relative; width: 100%; max-width: 360px; aspect-ratio: 1; margin: 8px auto 14px; container-type: size; }
/* The host is a TV/laptop — a real 3D physical board tilted like Monopoly Plus. */
.board-screen .spiral {
  max-width: min(72vw, 46vh); margin: 3vh auto 6vh;
  transform: perspective(1100px) rotateX(46deg); transform-origin: 50% 56%;
  transform-style: preserve-3d;
}
/* the shared main screen (TV/laptop) can be bigger than a phone */
.host-board .spiral { max-width: min(84vw, 64vh); margin: 3vh auto 7vh; }
/* thick warm wooden board plate under the path */
.board-screen .spiral::before {
  content: ""; position: absolute; inset: -7%; border-radius: 30px; z-index: 0;
  background: radial-gradient(125% 125% at 50% 28%, #f4e8ce, #e2cc9f);
  box-shadow: 0 28px 0 #b98a4e, 0 34px 44px rgba(74,48,16,0.55), inset 0 2px 0 rgba(255,255,255,0.65), inset 0 -8px 14px rgba(120,84,40,0.25);
}
.board-screen .ribbon { z-index: 1; }
/* raised tiles = little 3D blocks sitting on the board */
.board-screen .snode {
  z-index: 2; transition: transform .25s var(--ease);
  box-shadow: 0 6px 0 var(--card-edge), 0 11px 13px rgba(74,48,16,0.45), inset 0 1px 0 rgba(255,255,255,0.7);
}
.board-screen .snode.cur { box-shadow: 0 0 0 3px var(--gold), 0 8px 0 #b98a4e, 0 14px 18px rgba(74,48,16,0.55); }
/* board tokens are real CSS-3D pieces (glossy cast pawns) standing on the board */
.board-screen .snode { transform-style: preserve-3d; }
.board-screen .onode { position: absolute; inset: 0; transform-style: preserve-3d; }
.piece { position: absolute; inset: 0; transform: translateX(var(--ox, 0)) scale(var(--psc, 1)); transform-style: preserve-3d; }
.p3-ground { position: absolute; left: 50%; bottom: 5%; width: 72%; height: 28%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,.45), transparent); filter: blur(1px); z-index: 0; }
.pawn3d { position: absolute; left: 50%; bottom: 14%; width: 62%; height: 172%; transform: translateX(-50%) rotateX(-46deg); transform-origin: 50% 100%; transform-style: preserve-3d; z-index: 2; }
.pawn3d > i { position: absolute; left: 50%; transform: translateX(-50%); }
.p3-head { top: 0; width: 58%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 34% 28%, #ffffffe6, var(--pc) 50%, rgba(0,0,0,.42) 100%); box-shadow: inset -1px -2px 3px rgba(0,0,0,.4); z-index: 4; }
.p3-collar { top: 39%; width: 66%; height: 12%; border-radius: 50%; background: linear-gradient(90deg, rgba(0,0,0,.4), rgba(255,255,255,.85) 50%, rgba(0,0,0,.4)); z-index: 5; }
.p3-torso { bottom: 12%; width: 92%; height: 60%; clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%); background: linear-gradient(90deg, rgba(0,0,0,.45), var(--pc) 30%, rgba(255,255,255,.6) 50%, var(--pc) 70%, rgba(0,0,0,.5)); z-index: 3; }
.p3-base { bottom: 0; width: 122%; height: 20%; border-radius: 50%; background: linear-gradient(90deg, rgba(0,0,0,.5), var(--pc) 38%, rgba(255,255,255,.55) 55%, var(--pc) 72%, rgba(0,0,0,.55)); box-shadow: 0 2px 3px rgba(0,0,0,.45); z-index: 3; }
.pawn3d.shape { height: 155%; }
.pawn3d.shape .p3-ic { position: absolute; left: 50%; bottom: 24%; transform: translateX(-50%); color: var(--pc); z-index: 4;
  /* stacked colour drop-shadows = a solid extruded 3D edge under the shape */
  filter: drop-shadow(0 1px 0 color-mix(in srgb, var(--pc) 55%, #000)) drop-shadow(0 2px 0 color-mix(in srgb, var(--pc) 42%, #000)) drop-shadow(0 3px 0 color-mix(in srgb, var(--pc) 32%, #000)) drop-shadow(0 6px 5px rgba(0,0,0,0.45)); }
.pawn3d.shape .p3-ic .ic { width: calc(var(--sz, 44px) * 1); height: calc(var(--sz, 44px) * 1); }
.pawn3d.landed { animation: pawnLand .5s var(--ease); }
@keyframes pawnLand { 0% { transform: translateX(-50%) rotateX(-46deg) translateY(-45%) scaleY(1.12); } 55% { transform: translateX(-50%) rotateX(-46deg) translateY(0) scaleY(.9); } 100% { transform: translateX(-50%) rotateX(-46deg) translateY(0) scaleY(1); } }
/* tile-by-tile hop screen */
.hop-screen { justify-content: center; }
.hop-head { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.hop-head .tok { filter: drop-shadow(0 3px 3px rgba(74,48,16,.4)); }
.hop-pawn { position: absolute; z-index: 9; width: var(--sz, 44px); height: var(--sz, 44px); transform: translate(-50%, -50%); transition: left .36s cubic-bezier(.4,.1,.3,1), top .36s cubic-bezier(.4,.1,.3,1); pointer-events: none; }
.hop-pawn.hop .pawn3d { animation: hopArc3d .36s ease; }
@keyframes hopArc3d { 0%, 100% { transform: translateX(-50%) rotateX(-46deg) translateY(0); } 45% { transform: translateX(-50%) rotateX(-46deg) translateY(-75%); } 80% { transform: translateX(-50%) rotateX(-46deg) translateY(0) scaleY(.92); } }
.ribbon { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 5px 12px rgba(0,0,0,.45)); }
.snode {
  position: absolute; width: var(--sz, 44px); height: var(--sz, 44px); transform: translate(-50%, -50%);
  border-radius: clamp(3px, calc(var(--sz, 44px) * 0.16), 9px); display: grid; place-items: center;
  font-weight: 800; font-size: calc(var(--sz, 44px) * 0.42); color: var(--ink);
  background: radial-gradient(130% 130% at 30% 18%, var(--surface-2), var(--surface));
  border: 1.5px solid var(--line); box-shadow: 0 7px 14px -7px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.1);
  transition: box-shadow .25s var(--ease);
}
.snode .ic { width: calc(var(--sz, 44px) * 0.5); height: calc(var(--sz, 44px) * 0.5); }
.onode .ic { width: calc(var(--sz, 44px) * 0.52); height: calc(var(--sz, 44px) * 0.52); }
.snode.start { color: var(--on-accent); background: linear-gradient(140deg, var(--accent), var(--accent2)); border-color: transparent; box-shadow: var(--glow); }
.snode.finish { color: var(--gold); border-color: var(--gold); background: radial-gradient(130% 130% at 30% 18%, #40340f, var(--surface)); box-shadow: 0 0 18px rgba(255,209,102,.35); }
.snode.power { color: var(--gold); border-color: var(--gold); }
.snode.cur { box-shadow: 0 0 0 2px var(--accent), var(--glow); animation: pulseGlow 1.4s infinite; z-index: 3; }
.onode { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.onode .tok { filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
@keyframes pulseGlow { 50% { box-shadow: 0 0 0 3px var(--accent), 0 0 28px var(--accent); } }

/* ---- premium polish ------------------------------------------------------ */
.neon-title { text-shadow: 0 0 34px var(--accent); }
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.3), transparent 46%); pointer-events: none; }
.iconbtn { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--surface); border: 1.5px solid var(--line); color: var(--ink); transition: transform .14s var(--ease); }
.iconbtn:active { transform: scale(0.92); }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.tr-t { font-weight: 800; font-size: 14px; display: inline-flex; align-items: center; gap: 7px; }
.tr-s { font-size: 12px; color: var(--muted); margin-top: 3px; }
.hud-score { text-align: center; margin-top: 10px; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.timer { display: inline-flex; align-items: center; gap: 7px; }
.timer b { font-size: 20px; }
.big-num { font-size: 62px; font-weight: 900; line-height: 1; margin-top: 12px; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.endmark, .trophy-ic { animation: pop .5s var(--ease) both; }
.trophy-ic { color: var(--gold); filter: drop-shadow(0 0 22px rgba(255,209,102,.5)); }
.pow-banner.static { position: static; margin-top: 18px; justify-content: center; }
.pow-banner.danger { border-color: var(--bad); color: var(--bad); }
.stand .rank { width: 26px; text-align: center; }

/* ---- multiplayer --------------------------------------------------------- */
.row-links { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.link { color: var(--accent); font-weight: 700; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; }
.dot-sep { color: var(--muted); }
.room-code { font-family: var(--display); font-size: 54px; font-weight: 900; letter-spacing: 0.14em; margin-top: 14px; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; text-shadow: 0 0 30px var(--accent); }
.qr-wrap { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 9px; animation: slideup .35s var(--ease) both; }
.qr-box { width: 176px; height: 176px; padding: 11px; border-radius: 18px; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 14px 34px rgba(0,0,0,.34), var(--glow); }
.qr-box img, .qr-box svg { display: block; width: 100%; height: 100%; }
.qr-cap { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.join-row { display: flex; align-items: center; gap: 8px; margin-top: 13px; width: 100%; max-width: 340px; }
.join-link { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: left; font-family: var(--mono, ui-monospace, monospace); font-size: 12.5px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px; }
.btn-copy { flex: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; color: var(--accent); background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 9px 13px; cursor: pointer; transition: transform .12s var(--ease), border-color .2s, color .2s; }
.btn-copy:hover { border-color: var(--accent); }
.btn-copy:active { transform: scale(.95); }
.plist { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.prow { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-weight: 700; font-size: 14px; animation: slideup .3s var(--ease) both; }
/* ---- Smart lobby (host gatekeeping) ---- */
.lobby-wrap { display: flex; flex-direction: column; gap: 8px; }
.lobby-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; color: var(--muted); margin: 6px 2px 2px; }
.lobby-label .ic { color: var(--accent); }
.req-row { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 12px; background: color-mix(in srgb, var(--gold) 14%, var(--surface)); border: 1px solid var(--gold); animation: slideup .3s var(--ease) both; }
.req-name { font-weight: 800; font-size: 14px; }
.req-team { flex: 1; font-size: 12px; color: var(--muted); font-weight: 700; }
.req-ok, .req-no { flex: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 13px; padding: 7px 11px; border-radius: 9px; cursor: pointer; border: none; }
.req-ok { color: var(--on-accent); background: var(--good); }
.req-no { color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, transparent); }
.team-slot { padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); border-inline-start: 4px solid var(--tc); }
.team-head { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; }
.team-mem { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.mem { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--tc) 20%, var(--surface)); color: var(--ink); }
.team-empty { margin-top: 6px; font-size: 12px; color: var(--muted); }
/* controller team picker */
.team-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 340px; margin-top: 16px; }
.team-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 8px; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); border-top: 5px solid var(--tc); cursor: pointer; transition: transform .12s var(--ease), border-color .2s; }
.team-btn:active { transform: scale(.95); }
.team-btn:hover { border-color: var(--tc); }
.tb-name { font-weight: 800; font-size: 15px; }
.tb-count { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.code-input { width: 100%; margin-top: 22px; padding: 16px; text-align: center; font-size: 30px; font-weight: 900; letter-spacing: 0.3em; border-radius: 16px; background: var(--surface); border: 2px solid var(--line); color: var(--ink); outline: none; text-transform: uppercase; }
.code-input:focus { border-color: var(--accent); box-shadow: var(--glow); }
.name-input { width: 100%; margin-top: 12px; padding: 15px 16px; font-size: 16px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); color: var(--ink); outline: none; text-align: center; }
.name-input:focus { border-color: var(--accent); }
.join-err { color: var(--bad); font-weight: 700; font-size: 13px; margin-top: 12px; min-height: 18px; }
.host-turn { text-align: center; }
.host-turn .who { font-size: 22px; font-weight: 900; display: inline-flex; align-items: center; gap: 9px; justify-content: center; }
.host-sub { color: var(--muted); font-size: 13px; margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; }
.host-timer { font-size: 34px; font-weight: 900; margin-top: 10px; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.host-timer b { font-variant-numeric: tabular-nums; }
.host-timer.marathon { font-size: 26px; color: var(--gold); }
/* ---- New power-ups: open-stage feed + marathon banner ---- */
.host-pow { margin: 8px auto 2px; max-width: 640px; padding: 10px 16px; border-radius: 14px; font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 9px; justify-content: center; text-align: center; border: 1.5px solid var(--gold); color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--surface)); animation: slidedown 0.3s var(--ease) both; }
.host-pow.allplay { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.host-feed { max-width: 640px; margin: 10px auto 0; width: 100%; display: flex; flex-direction: column; gap: 7px; max-height: 30vh; overflow-y: auto; }
.host-feed::-webkit-scrollbar { width: 0; }
.feed-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 10px; display: flex; align-items: center; justify-content: center; gap: 7px; }
.feed-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); animation: slidedown 0.22s var(--ease) both; }
.feed-team { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; color: var(--ink); white-space: nowrap; }
.feed-text { flex: 1; font-size: 15px; font-weight: 700; color: var(--ink); text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-ok { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 8px 14px; border-radius: 999px; border: none; cursor: pointer; font-weight: 800; font-size: 13px; color: #08160f; background: var(--good); box-shadow: var(--glow); }
.feed-ok:active { transform: scale(.94); }
.cb-steal.allplay { color: var(--gold); }
.ctrl-hint.pow { color: var(--gold); font-weight: 800; font-size: 13.5px; }
.act.correct.wide { flex: 1; }
.timer.marathon { color: var(--gold); display: inline-flex; align-items: center; gap: 6px; font-weight: 900; }
.ctrl-hint { text-align: center; color: var(--muted); font-size: 12.5px; margin: 6px 0 10px; }
.ctrl-word-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding: 14px; border-radius: 16px; background: var(--surface);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ink) 8%, var(--surface)), inset 0 0 0 3.5px var(--gold), 0 12px 22px -10px rgba(0,0,0,0.45); }
.ctrl-word-list::-webkit-scrollbar { width: 0; }
.grace-note { text-align: center; color: var(--bad); font-weight: 800; margin: 8px 0; display: flex; align-items: center; gap: 6px; justify-content: center; }
.pulse-dot { width: 60px; height: 60px; border-radius: 50%; background: var(--accent); box-shadow: var(--glow); animation: pulseDot 1.3s infinite var(--ease); }
@keyframes pulseDot { 0%, 100% { transform: scale(.9); opacity: .7; } 50% { transform: scale(1.15); opacity: 1; } }

/* ---- Controller live board + steal chat (phones while another team plays) --- */
.cb { display: flex; flex-direction: column; gap: 8px; height: 100%; padding-bottom: 6px; }
.cb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cb-turn { font-size: 14px; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.cb-turn b { color: var(--ink); }
.cb-scores { display: flex; gap: 6px; flex-wrap: wrap; }
.cb-score { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 5px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.cb-score.cur { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 1px var(--accent); }
.cb-score b { color: var(--ink); }
.cb-spiral { max-width: min(74vw, 40vh); margin: 2px auto 4px; flex: none; }
.cb-steal { text-align: center; font-size: 12.5px; font-weight: 700; color: var(--accent); display: flex; align-items: center; justify-content: center; gap: 6px; }
.chat { flex: 1; min-height: 96px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; }
.chat-log::-webkit-scrollbar { width: 0; }
.msg { padding: 6px 10px; border-radius: 11px; background: var(--surface-2); align-self: flex-start; max-width: 92%; line-height: 1.35; }
.msg b { color: var(--accent); margin-inline-end: 5px; }
.msg.ok { background: linear-gradient(120deg, rgba(72,240,160,.22), rgba(72,240,160,.08)); border: 1px solid var(--good, #48f0a0); color: var(--ink); font-weight: 700; }
.msg.ok .ic { color: var(--good, #48f0a0); vertical-align: -2px; }
.chat-in { display: flex; gap: 8px; }
.chat-in input { flex: 1; min-width: 0; padding: 12px 14px; font-size: 16px; border-radius: 12px; background: var(--surface-2); border: 1.5px solid var(--line); color: var(--ink); outline: none; text-align: right; }
.chat-in input:focus { border-color: var(--accent); }
.chat-send { flex: none; width: 46px; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); display: grid; place-items: center; border: none; cursor: pointer; }
.ctrl-toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); z-index: 50; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); font-weight: 800; font-size: 14px; padding: 12px 18px; border-radius: 999px; box-shadow: var(--glow), 0 10px 30px rgba(0,0,0,.4); display: inline-flex; align-items: center; gap: 7px; opacity: 0; transition: opacity .3s var(--ease), transform .3s var(--ease); pointer-events: none; }
.ctrl-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.timer.low b { color: var(--bad); }

/* ---- Accounts / XP / leaderboard ---- */
.welcome-top { position: absolute; top: calc(12px + var(--safe-top)); left: 16px; right: 16px; display: flex; justify-content: space-between; gap: 8px; }
.acct-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 800; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; box-shadow: 0 2px 0 var(--card-edge); }
.acct-chip.ghost { color: var(--muted); }
.acct-chip .lvl { color: var(--on-accent); background: var(--accent); border-radius: 999px; padding: 1px 7px; font-size: 11px; }
.auth .name-input { max-width: 320px; }
.auth-tabs { margin: 16px 0; }
/* profile */
.profile { padding-top: calc(16px + var(--safe-top)); overflow-y: auto; }
.prof-hero { display: flex; align-items: center; gap: 16px; margin: 16px 2px 8px; }
.prof-av { position: relative; width: 78px; height: 78px; flex: none; display: grid; place-items: center; border-radius: 22px; background: radial-gradient(120% 120% at 30% 20%, var(--surface), var(--surface-2)); border: 1px solid var(--card-edge); box-shadow: 0 3px 0 var(--card-edge), 0 12px 20px -10px rgba(74,48,16,.5); }
.prof-av .tok { filter: drop-shadow(0 4px 6px rgba(74,48,16,.4)); }
.prof-lvl { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, var(--accent), var(--gold)); color: var(--on-accent); font-weight: 900; font-size: 12px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.prof-id { flex: 1; min-width: 0; }
.prof-name { font-family: var(--display); font-size: 24px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.prof-guest { font-family: var(--font); font-size: 11px; font-weight: 800; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: 999px; }
.xp-wrap { width: 100%; margin-top: 8px; }
.xp-bar { height: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.xp-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .6s var(--ease); }
.xp-row { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; margin-top: 5px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 14px 0 6px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 0 var(--card-edge); }
.stat b { font-family: var(--display); font-size: 22px; font-weight: 800; line-height: 1; }
.stat span { font-size: 11px; color: var(--muted); font-weight: 700; }
.sec-label { display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 13px; color: var(--muted); margin: 16px 2px 8px; }
.sec-label .ic { color: var(--gold); }
.ach-count { margin-inline-start: auto; color: var(--accent); }
.av-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.av-opt { aspect-ratio: 1; display: grid; place-items: center; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--line); transition: transform .12s var(--ease), border-color .2s; }
.av-opt.on { border-color: var(--accent); box-shadow: var(--glow); }
.av-opt:active { transform: scale(.9); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ach { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 7px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: center; opacity: .5; box-shadow: 0 2px 0 var(--card-edge); }
.ach .ach-ic { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); color: var(--muted); margin-bottom: 3px; }
.ach b { font-size: 12px; font-weight: 800; color: var(--ink); }
.ach span { font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.ach.got { opacity: 1; border-color: var(--gold); box-shadow: 0 2px 0 var(--card-edge), var(--glow); }
.ach.got .ach-ic { background: linear-gradient(135deg, var(--gold), #b98a4e); color: var(--on-accent); }
.lb-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; overflow-y: auto; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 0 var(--card-edge); }
.lb-row.me { border-color: var(--accent); box-shadow: 0 2px 0 var(--card-edge), 0 0 0 1px var(--accent); }
.lb-rank { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); font-weight: 900; font-size: 13px; }
.lb-rank.top { background: linear-gradient(135deg, var(--gold), #b98a4e); color: var(--on-accent); }
.lb-name { flex: 1; font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-lvl { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 800; color: var(--gold); }
.lb-xp { font-weight: 900; font-size: 13.5px; }
.lb-tabs { margin: 12px 0 2px; }
.friend-add { display: flex; gap: 8px; }
.friend-add .name-input { flex: 1; }
.fr-add-btn { flex: none; width: 48px; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); display: grid; place-items: center; border: none; cursor: pointer; box-shadow: 0 3px 0 rgba(74,48,16,.2); }
.fr-add-btn:active { transform: translateY(2px); box-shadow: none; }
.fr-msg { font-size: 12.5px; font-weight: 700; min-height: 16px; margin-top: 6px; }
.fr-msg.ok { color: var(--good); }
.fr-msg.err { color: var(--bad); }
/* shop */
.shop { overflow: hidden; }
.shop-credits { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 800; margin: 12px 2px 4px; }
.shop-credits .ic { color: var(--gold); }
.shop-credits b { font-family: var(--display); font-size: 20px; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 10px; overflow-y: auto; padding: 4px 2px 12px; }
.shop-card { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 14px 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 2px 0 var(--card-edge); }
.shop-card.eq { border-color: var(--accent); box-shadow: 0 2px 0 var(--card-edge), var(--glow); }
.shop-card.locked { opacity: .62; }
.shop-pawn { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 15px; background: radial-gradient(120% 120% at 30% 20%, var(--surface-2), var(--surface)); border: 1px solid var(--card-edge); }
.shop-pawn .tok { filter: drop-shadow(0 3px 4px rgba(74,48,16,.4)); }
.shop-btn { font-weight: 800; font-size: 13px; padding: 7px 13px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; border: none; }
.shop-btn.buy { color: var(--on-accent); background: linear-gradient(135deg, var(--gold), #b98a4e); }
.shop-btn.buy.poor { opacity: .5; }
.shop-btn.equip { color: var(--accent); background: var(--surface-2); border: 1px solid var(--line); }
.shop-eq { font-size: 12.5px; font-weight: 800; color: var(--accent); display: inline-flex; align-items: center; gap: 4px; }
.shop-lock { font-size: 12px; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.xp-gain { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 14px; color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--gold)); padding: 8px 16px; border-radius: 999px; box-shadow: var(--glow); animation: pop .5s var(--ease) both; }
.xp-gain .ic { vertical-align: -2px; }

/* ---- welcome tutorial button + join login ---- */
.btn-tut { margin-top: 10px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; font-size: 14px; padding: 13px; border-radius: 16px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--accent) 40%, var(--line)); }
.join-acct { font-size: 12.5px; font-weight: 700; color: var(--good); display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; }
.jlogin { margin-top: 12px; font-size: 13px; }
/* ---- interactive tutorial ---- */
.tut { padding-top: calc(16px + var(--safe-top)); }
.tut-top { display: flex; align-items: center; justify-content: space-between; }
.tut-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; padding: 10px 4px; }
.tut-mock { width: 100%; max-width: 320px; min-height: 190px; display: flex; align-items: center; justify-content: center; padding: 22px 18px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: inset 0 0 0 3px var(--gold), 0 14px 26px -12px rgba(0,0,0,0.4); animation: pop 0.4s var(--ease) both; }
.tut-title { font-family: var(--display); font-size: 23px; font-weight: 800; }
.tut-text { font-size: 15px; line-height: 1.55; color: var(--muted); max-width: 340px; }
.tut-text b { color: var(--ink); }
.tut-dots { display: flex; gap: 7px; justify-content: center; margin: 8px 0; }
.tut-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: all 0.3s; }
.tut-dots i.on { background: var(--accent); width: 22px; border-radius: 999px; }
.tut-nav { display: flex; gap: 10px; }
.tut-nav .btn { flex: 1; }
/* tutorial mockups */
.mock-tiles { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; padding-top: 16px; }
.mt { position: relative; width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); border: 1.5px solid var(--line); color: var(--muted); }
.mt.cur { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); color: var(--ink); }
.mt-pawn { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); filter: drop-shadow(0 3px 3px rgba(0,0,0,0.4)); }
.mock-card { width: 210px; }
.mc-inner { display: flex; flex-direction: column; gap: 5px; }
.mock-card .word { font-size: 13px; padding: 6px 10px; }
.mock-chat { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.mch { align-self: flex-start; background: var(--surface-2); padding: 6px 11px; border-radius: 11px; font-size: 13.5px; }
.mch b { color: var(--accent); }
.mch.ok { background: color-mix(in srgb, var(--good) 22%, transparent); border: 1px solid var(--good); font-weight: 700; }
.mch-steal { align-self: center; margin-top: 5px; font-weight: 800; font-size: 13px; color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--gold)); padding: 6px 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; }
.mock-pawns { display: flex; gap: 16px; }
.mp { filter: drop-shadow(0 6px 5px rgba(0,0,0,0.4)); }
.mock-actions { display: flex; gap: 12px; }
.mock-tips { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.tip { display: flex; align-items: center; gap: 8px; font-size: 13.5px; background: var(--surface-2); padding: 8px 12px; border-radius: 11px; }
.tip .ic { color: var(--good); flex: none; }
.tip b { color: var(--ink); }
.tip.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.tip.bad .ic { color: var(--bad); }
.mock-powers { display: flex; flex-direction: column; gap: 8px; width: 100%; max-height: 40vh; overflow-y: auto; padding-inline-end: 2px; }
.mock-powers::-webkit-scrollbar { width: 0; }
.pw { display: flex; align-items: flex-start; gap: 11px; background: var(--surface-2); padding: 9px 12px; border-radius: 12px; text-align: right; }
.pw-ic { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); margin-top: 1px; }
.pw b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.pw span { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.pw span b { display: inline; font-size: inherit; color: var(--ink); }

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