:root {
  --bg: #07040f;
  --bg2: #120a24;
  --ink: #f4f1ff;
  --dim: #a59cc4;
  --mute: #6b6290;
  --gold: #ffcf4a;
  --gold2: #ff9a1f;
  --magenta: #ff3d7f;
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --green: #4ade80;
  --red: #ff4d5e;
  --glass: rgba(24, 14, 48, 0.62);
  --glass-edge: rgba(180, 150, 255, 0.18);
  --display: 'Bungee', 'Arial Black', Impact, sans-serif;
  --body: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --radius: 18px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at 50% 120%, #2a0f4a 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--ink);
  font-family: var(--body);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ---------- atmosphere ---------- */
#bg, #fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#bg { z-index: 0; }
#fx { z-index: 90; }
.vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, .75) 100%); }
.scanlines { position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: .07;
  background: repeating-linear-gradient(0deg, #fff 0 1px, transparent 1px 3px); mix-blend-mode: overlay; }

#stage { position: relative; z-index: 5; min-height: 100vh; }
#stage.shake { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
#stage.shake-big { animation: shake-big .7s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(4px, -2px); } 30%, 50%, 70% { transform: translate(-6px, 3px); } 40%, 60% { transform: translate(6px, -3px); } }
@keyframes shake-big { 10%, 90% { transform: translate(-4px, 2px) rotate(-.3deg); } 20%, 80% { transform: translate(8px, -4px) rotate(.4deg); } 30%, 50%, 70% { transform: translate(-12px, 6px) rotate(-.5deg); } 40%, 60% { transform: translate(12px, -6px) rotate(.5deg); } }

/* ---------- screens ---------- */
.screen { display: none; min-height: 100vh; padding: 24px 16px; }
.screen.active { display: flex; animation: screen-in .7s var(--ease-out); }
@keyframes screen-in { from { opacity: 0; transform: scale(1.04); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }

.panel {
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.panel-title { font-family: var(--display); font-weight: 400; font-size: 18px; letter-spacing: .04em; margin: 0 0 16px; display: flex; justify-content: space-between; align-items: center; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .22em; color: var(--dim); font-weight: 700; }
.hint { color: var(--dim); font-size: 14px; margin: 6px 0 0; }
.center { text-align: center; }
.mt { margin-top: 20px; }
.tag { font-family: var(--body); font-size: 12px; color: var(--gold); letter-spacing: .1em; text-transform: uppercase; }
.headline { font-family: var(--display); font-weight: 400; font-size: clamp(26px, 4vw, 40px); margin: 4px 0; }

/* ---------- buttons ---------- */
.btn {
  --c1: #3b2a6b; --c2: #24184a; --glow: rgba(139, 92, 246, .4);
  position: relative; border: 0; border-radius: 14px; padding: 12px 20px;
  font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 15px;
  background: linear-gradient(180deg, var(--c1), var(--c2));
  box-shadow: 0 6px 0 rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .08) inset, 0 10px 30px -8px var(--glow);
  transition: transform .15s var(--ease-back), box-shadow .2s, filter .2s;
  overflow: hidden; white-space: nowrap;
}
.btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); transform: translateX(-120%); transition: transform .6s; }
.btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.12); }
.btn:hover:not(:disabled)::after { transform: translateX(120%); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .08) inset; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); }
.btn:focus-visible, .icon-btn:focus-visible, .size-card:focus-visible, .chip:focus-visible, .cell:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.btn-gold { --c1: #ffe07a; --c2: #ff9a1f; --glow: rgba(255, 170, 40, .55); color: #2a1300; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); }
.btn-cyan { --c1: #5eead4; --c2: #0891b2; --glow: rgba(34, 211, 238, .5); color: #00222b; }
.btn-ghost { --c1: rgba(255, 255, 255, .08); --c2: rgba(255, 255, 255, .03); --glow: transparent; box-shadow: 0 0 0 1px rgba(255, 255, 255, .14) inset; }
.btn-xl { font-size: 18px; padding: 16px 26px; border-radius: 16px; font-family: var(--display); font-weight: 400; }
.btn-sm { font-size: 13px; padding: 8px 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .05); font-size: 20px; display: grid; place-items: center; transition: transform .2s var(--ease-back); flex: none; }
.icon-btn:hover { transform: rotate(-12deg) scale(1.1); }

input {
  width: 100%; padding: 13px 16px; border-radius: 12px; border: 1px solid var(--glass-edge);
  background: rgba(0, 0, 0, .35); outline: none; font-size: 17px; font-weight: 600; transition: border-color .2s, box-shadow .2s;
  user-select: text;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(34, 211, 238, .18); }

/* ---------- intro ---------- */
#intro { flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 26px; overflow: hidden; }
.intro-flare { position: absolute; top: 42%; left: -30%; width: 160%; height: 2px; background: linear-gradient(90deg, transparent, #fff 50%, transparent); filter: blur(1px); box-shadow: 0 0 40px 10px rgba(255, 207, 74, .6); opacity: 0; animation: flare 2.6s .9s var(--ease-out) forwards; }
@keyframes flare { 0% { opacity: 0; transform: scaleX(.1); } 30% { opacity: 1; } 100% { opacity: 0; transform: scaleX(1.4); } }
.intro-word { display: flex; gap: clamp(4px, 1.4vw, 14px); justify-content: center; }
.intro-word span {
  font-family: var(--display); font-size: clamp(64px, 16vw, 190px); line-height: .9;
  background: linear-gradient(180deg, #fff6c9 0%, var(--gold) 45%, var(--gold2) 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 0 #7a2d00) drop-shadow(0 0 30px rgba(255, 170, 40, .55));
  opacity: 0; transform: translateY(-120px) scale(2.4) rotate(-12deg);
  animation: letter-drop .7s calc(.25s + var(--i) * .14s) var(--ease-back) forwards;
}
@keyframes letter-drop { 60% { opacity: 1; } to { opacity: 1; transform: none; } }
.intro-blitz {
  font-family: 'Bungee Shade', var(--display); font-size: clamp(30px, 7vw, 76px); letter-spacing: .3em; margin-top: 6px; padding-left: .3em;
  color: var(--cyan); text-shadow: 0 0 18px rgba(34, 211, 238, .9), 0 0 60px rgba(34, 211, 238, .5);
  opacity: 0; animation: blitz-in .6s 1.2s var(--ease-out) forwards, flicker 4s 2s infinite;
}
@keyframes blitz-in { from { opacity: 0; letter-spacing: 1.2em; filter: blur(10px); } to { opacity: 1; letter-spacing: .3em; filter: none; } }
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: .4; } 94% { opacity: 1; } 96% { opacity: .6; } }
.intro-tag { color: var(--dim); letter-spacing: .25em; text-transform: uppercase; font-size: 13px; margin: 0; opacity: 0; animation: fade-up .8s 1.6s forwards; }
.intro-enter { opacity: 0; animation: fade-up .8s 1.9s forwards, pulse-glow 2s 2.7s infinite; }
@keyframes fade-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes pulse-glow { 50% { box-shadow: 0 6px 0 rgba(0, 0, 0, .35), 0 0 60px 6px rgba(255, 170, 40, .6); } }

/* ---------- home ---------- */
#home { align-items: center; justify-content: center; }
.home-panel { width: min(460px, 100%); text-align: center; }
.logo { font-family: var(--display); font-weight: 400; font-size: clamp(36px, 8vw, 54px); margin: 0; line-height: 1;
  background: linear-gradient(180deg, #fff6c9, var(--gold) 50%, var(--gold2)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 0 #6b2700); }
.logo em { font-style: normal; color: var(--cyan); -webkit-text-fill-color: var(--cyan); filter: drop-shadow(0 0 14px rgba(34, 211, 238, .8)); }
.sub { color: var(--dim); margin: 10px 0 22px; }
.identity { display: flex; gap: 14px; align-items: flex-end; text-align: left; margin-bottom: 22px; }
.field { flex: 1; min-width: 0; }
.field label { display: block; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; font-weight: 700; }
.name-row { display: flex; gap: 8px; }
.avatar-btn { width: 74px; height: 74px; flex: none; font-size: 40px; border-radius: 20px; border: 2px solid var(--gold); background: radial-gradient(circle at 30% 30%, rgba(255, 207, 74, .3), rgba(0, 0, 0, .3)); box-shadow: 0 0 24px rgba(255, 207, 74, .35); transition: transform .25s var(--ease-back); }
.avatar-btn:hover { transform: scale(1.08) rotate(-6deg); }
.home-actions { display: grid; gap: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--mute); font-size: 12px; text-transform: uppercase; letter-spacing: .2em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--glass-edge); }
.join-row { display: flex; gap: 10px; }
#codeInput { text-transform: uppercase; letter-spacing: .5em; text-align: center; font-family: var(--display); font-size: 22px; padding-left: 26px; }
.howto { text-align: left; margin-top: 22px; color: var(--dim); font-size: 14px; }
.howto summary { cursor: pointer; font-weight: 700; color: var(--ink); letter-spacing: .1em; text-transform: uppercase; font-size: 13px; }
.howto ol { padding-left: 20px; line-height: 1.55; }

/* ---------- lobby ---------- */
#lobby { justify-content: center; }
.lobby-wrap { width: min(980px, 100%); }
.lobby-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; gap: 12px; }
.room-code {
  font-family: var(--display); font-size: clamp(44px, 9vw, 72px); letter-spacing: .14em; border: 0; background: none; padding: 0; line-height: 1;
  color: var(--gold); text-shadow: 0 0 30px rgba(255, 207, 74, .55), 0 5px 0 #6b2700;
}
.lobby-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.slot {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .06); min-height: 64px;
  animation: slot-in .5s var(--ease-back) both;
}
@keyframes slot-in { from { opacity: 0; transform: translateX(-30px) scale(.9); } }
.slot.empty { border-style: dashed; color: var(--mute); justify-content: center; animation: none; }
.slot.empty span { animation: breathe 2.4s infinite; }
@keyframes breathe { 50% { opacity: .35; } }
.slot.me { border-color: color-mix(in srgb, var(--pc) 60%, transparent); box-shadow: 0 0 24px -6px var(--pc); }
.slot .av { width: 44px; height: 44px; display: grid; place-items: center; font-size: 26px; border-radius: 12px; background: color-mix(in srgb, var(--pc) 22%, transparent); border: 2px solid var(--pc); flex: none; }
.slot .nm { flex: 1; min-width: 0; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .nm small { display: block; font-weight: 400; color: var(--dim); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.slot input { padding: 6px 10px; font-size: 16px; }
.slot .wins { font-family: var(--display); color: var(--gold); font-size: 15px; }
.slot .off { opacity: .45; }
.edit-btn { border: 0; background: rgba(255, 255, 255, .08); border-radius: 8px; padding: 6px 9px; font-size: 13px; }

.size-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.size-card {
  border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .04); border-radius: 16px; padding: 14px 6px; display: grid; gap: 2px; text-align: center;
  transition: transform .25s var(--ease-back), border-color .2s, box-shadow .2s, background .2s;
}
.size-card b { font-family: var(--display); font-weight: 400; font-size: 26px; }
.size-card span { font-weight: 700; text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--cyan); }
.size-card i { font-style: normal; color: var(--dim); font-size: 12px; }
.size-card:hover:not(:disabled) { transform: translateY(-3px); }
.size-card.sel { border-color: var(--gold); background: linear-gradient(180deg, rgba(255, 207, 74, .2), rgba(255, 154, 31, .05)); box-shadow: 0 0 30px -6px rgba(255, 207, 74, .7); transform: translateY(-3px) scale(1.03); }
.size-card:disabled { cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .04); border-radius: 999px; padding: 8px 14px; font-weight: 700; transition: all .2s; }
.chip.sel { background: var(--cyan); color: #00222b; border-color: var(--cyan); box-shadow: 0 0 20px rgba(34, 211, 238, .5); }
.chip:disabled { cursor: default; }
.start-btn { width: 100%; margin-top: 24px; }

/* ---------- board ---------- */
.board-frame { position: relative; padding: 14px; border-radius: 24px; overflow: hidden; isolation: isolate;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8), 0 0 40px -10px rgba(139, 92, 246, .55); transition: box-shadow .4s; }
/* Rotating colour rim: a big conic square spun with transform (GPU only), covered by the inner fill. */
.board-frame::before { content: ''; position: absolute; left: 50%; top: 50%; width: 150%; aspect-ratio: 1; z-index: -2;
  background: conic-gradient(var(--magenta), var(--violet), var(--cyan), var(--gold), var(--magenta));
  transform: translate(-50%, -50%); animation: rim-spin 6s linear infinite; will-change: transform; }
.board-frame::after { content: ''; position: absolute; inset: 3px; border-radius: 21px; z-index: -1;
  background: linear-gradient(145deg, #241446, #120a26 50%, #22102e); }
@keyframes rim-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.board-frame.my-turn { box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8), 0 0 50px -4px rgba(255, 207, 74, .7); }
.board-frame.my-turn::before { animation-duration: 2s; }
.board-frame.danger { box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8), 0 0 50px -2px rgba(255, 77, 94, .85); }
.board-frame.danger::before { background: conic-gradient(var(--red), #ff9a1f, var(--red), #ff9a1f, var(--red)); animation-duration: .8s; }

.board {
  --n: 5; --gap: clamp(5px, 1vw, 9px);
  display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: var(--gap);
  width: min(88vw, 60vh, 540px);
}
.cell {
  position: relative; aspect-ratio: 1; border: 0; border-radius: clamp(8px, 1.4vw, 14px);
  font-family: var(--display); font-size: calc(min(88vw, 60vh, 540px) / var(--n) * .36);
  background: linear-gradient(160deg, #2c1d57, #160e33);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .09), inset 0 -4px 0 rgba(0, 0, 0, .35), 0 4px 10px rgba(0, 0, 0, .3);
  color: var(--ink); display: grid; place-items: center; overflow: hidden;
  transition: transform .2s var(--ease-back), background .3s, box-shadow .3s, color .3s;
}
.cell.empty { color: transparent; background: rgba(255, 255, 255, .03); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .08); }
.cell.placed { animation: pop .35s var(--ease-back); }
.cell.selected { background: linear-gradient(160deg, #0e7490, #164e63); box-shadow: 0 0 0 3px var(--cyan), 0 0 24px var(--cyan); transform: scale(1.06); }
.cell.dealt { animation: deal .5s var(--ease-back) both; animation-delay: calc(var(--d) * 22ms); }
@keyframes deal { from { opacity: 0; transform: translateY(-40px) rotateX(80deg) scale(.6); } }
@keyframes pop { 50% { transform: scale(1.18); } }

.board.pickable .cell:not(.marked):hover { transform: translateY(-3px) scale(1.06); background: linear-gradient(160deg, #4b2fa0, #2a1868); box-shadow: 0 0 0 2px var(--gold), 0 0 26px rgba(255, 207, 74, .55); cursor: pointer; }
.board:not(.pickable) .cell { cursor: default; }
#setupBoard .cell { cursor: pointer; }
#setupBoard .cell:hover { transform: scale(1.05); }

.cell.marked { background: linear-gradient(160deg, var(--pc, var(--magenta)), color-mix(in srgb, var(--pc, var(--magenta)) 55%, #000)); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.cell.marked::before { content: ''; position: absolute; inset: 14%; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .55); opacity: .7; }
.cell.stamp { animation: stamp .55s var(--ease-back); }
.cell.stamp::after { content: ''; position: absolute; inset: -10%; border-radius: 50%; border: 4px solid #fff; animation: ring-out .6s var(--ease-out) forwards; }
@keyframes stamp { 0% { transform: scale(1.6) rotate(-14deg); filter: brightness(2.4); } 60% { transform: scale(.92); } 100% { transform: none; } }
@keyframes ring-out { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
.cell.in-line { box-shadow: 0 0 0 2px rgba(255, 255, 255, .7), 0 0 22px var(--gold); }
.cell.in-line.marked { background: linear-gradient(160deg, #ffe07a, #ff9a1f); color: #3a1700; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); }
.cell.hot { animation: hot 1s infinite; }
@keyframes hot { 50% { box-shadow: 0 0 0 2px var(--red), 0 0 22px var(--red); } }

.beams { position: absolute; inset: 14px; pointer-events: none; }
.beam { position: absolute; height: 10px; border-radius: 10px; transform-origin: 0 50%;
  background: linear-gradient(90deg, transparent, #fff 15%, var(--gold) 50%, #fff 85%, transparent);
  box-shadow: 0 0 20px 4px rgba(255, 207, 74, .9), 0 0 60px 10px rgba(255, 154, 31, .5);
  animation: beam 1.4s var(--ease-out) forwards; }
@keyframes beam { 0% { clip-path: inset(0 100% 0 0); opacity: 1; } 45% { clip-path: inset(0 0 0 0); opacity: 1; } 100% { clip-path: inset(0 0 0 0); opacity: 0; } }

/* ---------- setup ---------- */
#setup { justify-content: center; }
.setup-wrap { width: min(1000px, 100%); }
.setup-head { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 18px; }
.setup-timer { position: relative; width: 80px; height: 80px; flex: none; display: grid; place-items: center; font-family: var(--display); font-size: 24px; }
.setup-timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.setup-timer circle { fill: none; stroke: rgba(255, 255, 255, .1); stroke-width: 4; }
.setup-timer .arc { stroke: var(--cyan); stroke-linecap: round; stroke-dasharray: 119.4; transition: stroke-dashoffset .25s linear, stroke .3s; }
.setup-body { display: flex; gap: 26px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
.setup-side { display: grid; gap: 14px; width: min(320px, 100%); }
.tool-row { display: flex; gap: 10px; flex-wrap: wrap; }
.tool-row .btn { flex: 1; font-size: 14px; padding: 12px 10px; }
.manual-tools { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: rgba(0, 0, 0, .25); }
.next-num { display: flex; justify-content: space-between; align-items: center; color: var(--dim); text-transform: uppercase; letter-spacing: .12em; font-size: 13px; font-weight: 700; }
.next-num b { font-family: var(--display); font-size: 34px; color: var(--gold); font-weight: 400; }
.ready-list { display: grid; gap: 6px; }
.ready-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); }
.ready-row .st { margin-left: auto; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.ready-row.ready .st { color: var(--green); text-shadow: 0 0 10px var(--green); }
.ready-row.ready { animation: pop .4s var(--ease-back); }
#readyBtn.locked { --c1: #4ade80; --c2: #15803d; --glow: rgba(74, 222, 128, .5); color: #022c12; }

/* ---------- game ---------- */
#game { flex-direction: column; padding: 14px 16px 90px; gap: 10px; }
.hud { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.hud-left { display: flex; gap: 8px; flex-wrap: wrap; }
.hud-right { display: flex; justify-content: flex-end; gap: 8px; }
.pill { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .06); border: 1px solid var(--glass-edge); font-size: 13px; color: var(--dim); white-space: nowrap; }
.pill b { color: var(--ink); }
.turn-banner { font-family: var(--display); font-size: clamp(16px, 2.6vw, 26px); text-align: center; padding: 8px 22px; border-radius: 14px; white-space: nowrap; max-width: 60vw; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--tc, var(--violet)) 35%, transparent), transparent); text-shadow: 0 0 20px var(--tc, var(--violet)); transition: all .3s; }
.turn-banner.mine { color: var(--gold); animation: pulse-text 1.2s infinite; }
@keyframes pulse-text { 50% { transform: scale(1.06); } }
.timer-bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; }
#timerFill { height: 100%; width: 100%; transform-origin: left; background: linear-gradient(90deg, var(--cyan), var(--violet)); box-shadow: 0 0 14px var(--cyan); }
#timerFill.low { background: linear-gradient(90deg, var(--red), var(--gold2)); box-shadow: 0 0 14px var(--red); animation: blink .5s infinite; }
@keyframes blink { 50% { opacity: .5; } }

.arena { flex: 1; display: grid; grid-template-columns: 250px 1fr 200px; gap: 18px; align-items: start; }
.center { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.word-bar { display: flex; gap: clamp(6px, 1.2vw, 12px); }
.word-letter {
  width: clamp(44px, 7vw, 70px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 14px;
  font-family: var(--display); font-size: clamp(24px, 4vw, 40px); color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .03); border: 2px dashed rgba(255, 255, 255, .12); transition: all .3s;
}
.word-letter.lit { color: #3a1700; border: 2px solid #fff3c4; background: linear-gradient(180deg, #fff1a8, var(--gold) 50%, var(--gold2));
  box-shadow: 0 0 30px rgba(255, 207, 74, .8), 0 6px 0 #7a3300; text-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
.word-letter.slam { animation: letter-slam .7s var(--ease-back); }
@keyframes letter-slam { 0% { transform: scale(3) rotate(-20deg); opacity: 0; filter: brightness(3); } 55% { transform: scale(.85) rotate(4deg); opacity: 1; } 100% { transform: none; } }
.your-turn-hint { color: var(--gold); font-weight: 700; letter-spacing: .2em; text-transform: uppercase; font-size: 13px; opacity: 0; transition: opacity .3s; }
.your-turn-hint.show { opacity: 1; animation: breathe 1.6s infinite; }

.rail { display: grid; gap: 10px; }
.pcard {
  --pc: var(--violet); position: relative; padding: 12px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-edge);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: transform .4s var(--ease-back), box-shadow .3s, border-color .3s; overflow: hidden;
}
.pcard::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--pc); box-shadow: 0 0 12px var(--pc); }
.pcard.turn { transform: scale(1.04) translateX(6px); border-color: var(--pc); box-shadow: 0 0 34px -6px var(--pc); }
.pcard.turn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, color-mix(in srgb, var(--pc) 30%, transparent) 50%, transparent 70%); animation: sweep 1.6s infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.pcard.threat { animation: threat 1s infinite; }
@keyframes threat { 50% { box-shadow: 0 0 0 2px var(--red), 0 0 30px var(--red); } }
.pcard.offline { opacity: .5; filter: grayscale(.7); }
.pcard-top { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.pcard .av { width: 40px; height: 40px; display: grid; place-items: center; font-size: 24px; border-radius: 12px; border: 2px solid var(--pc); background: color-mix(in srgb, var(--pc) 22%, transparent); flex: none; }
.pcard .who { min-width: 0; flex: 1; }
.pcard .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .meta { font-size: 12px; color: var(--dim); }
.pcard .meta.warn { color: var(--red); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.pcard .rank { font-family: var(--display); font-size: 18px; color: var(--dim); }
.mini-word { display: flex; gap: 4px; margin-top: 10px; position: relative; z-index: 1; }
.mini-word span { flex: 1; text-align: center; font-family: var(--display); font-size: 13px; padding: 3px 0; border-radius: 6px; background: rgba(255, 255, 255, .05); color: rgba(255, 255, 255, .18); transition: all .3s; }
.mini-word span.lit { background: var(--pc); color: #0b0618; box-shadow: 0 0 10px var(--pc); }
.mini-word span.slam { animation: letter-slam .6s var(--ease-back); }
.pcard .emote-pop { position: absolute; right: 8px; top: -4px; font-size: 30px; z-index: 2; animation: emote-pop 1.6s var(--ease-out) forwards; }
@keyframes emote-pop { 0% { transform: scale(0) translateY(10px); } 20% { transform: scale(1.3); } 80% { opacity: 1; transform: scale(1) translateY(-14px); } 100% { opacity: 0; transform: translateY(-30px); } }

.history { padding: 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--glass-edge); }
.last-call { font-family: var(--display); font-size: 64px; text-align: center; line-height: 1.1; margin: 6px 0 10px; color: var(--gold); text-shadow: 0 0 30px rgba(255, 207, 74, .6); }
.last-call.flash { animation: pop .5s var(--ease-back); }
.history-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 46vh; overflow: auto; }
.hball { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #0b0618;
  background: radial-gradient(circle at 35% 30%, #fff, var(--pc) 55%, color-mix(in srgb, var(--pc) 60%, #000)); box-shadow: 0 3px 8px rgba(0, 0, 0, .4); animation: ball-in .5s var(--ease-back); }
.hball.auto { outline: 2px dashed rgba(255, 255, 255, .5); outline-offset: 1px; }
@keyframes ball-in { from { transform: translateY(-30px) scale(0); } }

.emote-bar { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; padding: 8px; border-radius: 18px; background: var(--glass); border: 1px solid var(--glass-edge); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); z-index: 20; }
.emote-bar button { width: 44px; height: 44px; font-size: 24px; border: 0; border-radius: 12px; background: transparent; transition: transform .2s var(--ease-back), background .2s; }
.emote-bar button:hover { transform: scale(1.25) translateY(-4px); background: rgba(255, 255, 255, .08); }
#floaters { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.floater { position: absolute; bottom: -60px; font-size: 44px; animation: float-up 2.6s var(--ease-out) forwards; }
.floater small { display: block; font-size: 12px; text-align: center; font-weight: 700; color: #fff; text-shadow: 0 1px 4px #000; }
@keyframes float-up { 0% { transform: translateY(0) scale(.5); opacity: 0; } 15% { opacity: 1; transform: translateY(-15vh) scale(1.2); } 100% { transform: translateY(-75vh) translateX(var(--dx)) scale(1); opacity: 0; } }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; pointer-events: none; }
.overlay.show { display: grid; }

#reveal { background: radial-gradient(circle, rgba(10, 4, 30, .72), rgba(5, 2, 15, .92)); }
#reveal.show { animation: fade-in .2s; }
#reveal.out { animation: fade-out .35s forwards; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.reveal-rays { position: absolute; width: 160vmax; height: 160vmax; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc, var(--gold)) 22%, transparent) 0 6deg, transparent 6deg 18deg); animation: spin 14s linear infinite; mask-image: radial-gradient(circle, #000 0, transparent 50%); -webkit-mask-image: radial-gradient(circle, #000 0, transparent 50%); }
.reveal-ring { position: absolute; width: 40vmin; height: 40vmin; border-radius: 50%; border: 6px solid var(--rc, var(--gold)); opacity: 0; }
#reveal.slammed .reveal-ring { animation: shock .8s var(--ease-out); }
@keyframes shock { from { transform: scale(.2); opacity: 1; } to { transform: scale(3); opacity: 0; border-width: 1px; } }
.reveal-num { position: relative; font-family: var(--display); font-size: clamp(140px, 34vmin, 320px); line-height: 1;
  background: linear-gradient(180deg, #fff, #fff2b0 30%, var(--rc, var(--gold)) 80%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 10px 0 rgba(0, 0, 0, .55)) drop-shadow(0 0 40px var(--rc, var(--gold))); }
.reveal-num.rolling { filter: blur(3px) drop-shadow(0 0 20px var(--rc, var(--gold))); animation: roll .08s linear infinite; }
@keyframes roll { 50% { transform: translateY(-10px); } }
#reveal.slammed .reveal-num { animation: num-slam .5s var(--ease-back); }
@keyframes num-slam { 0% { transform: scale(2.6); } 60% { transform: scale(.9); } 100% { transform: scale(1); } }
.reveal-by { position: absolute; top: calc(50% + clamp(80px, 19vmin, 180px)); font-size: clamp(16px, 2.6vw, 24px); letter-spacing: .25em; text-transform: uppercase; font-weight: 700; color: var(--dim); opacity: 0; }
#reveal.slammed .reveal-by { animation: fade-up .4s .1s forwards; }
.reveal-by b { color: var(--rc, var(--gold)); }

.banner { place-items: center; }
.banner-strip { width: 100%; padding: 26px 0; text-align: center; transform: skewY(-4deg);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bc, var(--gold)) 85%, #000) 20%, var(--bc, var(--gold)) 50%, color-mix(in srgb, var(--bc, var(--gold)) 85%, #000) 80%, transparent);
  box-shadow: 0 0 80px color-mix(in srgb, var(--bc, var(--gold)) 70%, transparent); }
.banner-strip span { display: inline-block; font-family: var(--display); font-size: clamp(36px, 8vw, 90px); color: #0b0618; text-shadow: 0 3px 0 rgba(255, 255, 255, .4); white-space: nowrap; }
.banner.show .banner-strip { animation: strip 1.5s var(--ease-out) forwards; }
.banner.show .banner-strip span { animation: strip-text 1.5s var(--ease-out) forwards; }
@keyframes strip { 0% { transform: skewY(-4deg) scaleY(0); } 15% { transform: skewY(-4deg) scaleY(1); } 80% { transform: skewY(-4deg) scaleY(1); opacity: 1; } 100% { transform: skewY(-4deg) scaleY(0); opacity: 0; } }
@keyframes strip-text { 0% { transform: translateX(80vw); } 20% { transform: translateX(0); } 75% { transform: translateX(-3vw); } 100% { transform: translateX(-90vw); } }

#countdown { background: rgba(5, 2, 15, .78); }
.count-num { font-family: var(--display); font-size: clamp(160px, 40vmin, 380px); color: var(--cyan); text-shadow: 0 0 60px var(--cyan), 0 10px 0 #053b47; }
.count-num.go { color: var(--gold); text-shadow: 0 0 80px var(--gold), 0 10px 0 #6b2700; }
.count-num.tick { animation: count-tick .9s var(--ease-out); }
@keyframes count-tick { 0% { transform: scale(2.4); opacity: 0; filter: blur(12px); } 25% { transform: scale(1); opacity: 1; filter: none; } 85% { opacity: 1; } 100% { transform: scale(.6); opacity: 0; } }
.count-order { position: absolute; bottom: 12vh; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 0 16px; }
.count-order div { padding: 8px 14px; border-radius: 12px; border: 2px solid var(--pc); background: color-mix(in srgb, var(--pc) 18%, transparent); font-weight: 700; animation: fade-up .5s both; }

#victory { background: radial-gradient(circle at 50% 30%, rgba(60, 22, 110, .92), rgba(5, 2, 15, .97)); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); pointer-events: auto; overflow-y: auto; place-items: start center; padding: 6vh 16px 40px; }
#victory.show { animation: fade-in .6s; }
.victory-inner { width: min(960px, 100%); text-align: center; }
.victory-crown { font-size: clamp(60px, 12vw, 110px); animation: crown 1.2s var(--ease-back) both, bob 3s 1.2s ease-in-out infinite; filter: drop-shadow(0 0 30px rgba(255, 207, 74, .8)); }
@keyframes crown { from { transform: translateY(-200px) rotate(-30deg) scale(.3); opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-10px) rotate(4deg); } }
.victory-title { font-family: var(--display); font-size: clamp(56px, 13vw, 140px); line-height: 1; margin-top: 6px;
  background: linear-gradient(180deg, #fff6c9, var(--gold) 50%, var(--gold2)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 8px 0 #6b2700) drop-shadow(0 0 40px rgba(255, 170, 40, .6));
  animation: title-in 1s .3s var(--ease-back) both; }
#victory.lose .victory-title { background: linear-gradient(180deg, #e0d8ff, #8b7fbf); -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 8px 0 #22183f); }
@keyframes title-in { from { transform: scale(4); opacity: 0; letter-spacing: .5em; } }
.victory-name { font-size: clamp(18px, 3vw, 28px); font-weight: 700; margin: 10px 0 26px; letter-spacing: .08em; animation: fade-up .6s .9s both; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.pod { width: 150px; border-radius: 16px 16px 6px 6px; padding: 14px 10px; background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 40%, transparent), rgba(255, 255, 255, .03)); border: 1px solid color-mix(in srgb, var(--pc) 60%, transparent); animation: pod-rise .8s var(--ease-back) both; animation-delay: calc(1s + var(--d) * .15s); }
@keyframes pod-rise { from { transform: translateY(80px); opacity: 0; } }
.pod .pav { font-size: 40px; }
.pod .pn { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .pp { font-family: var(--display); font-size: 30px; color: var(--pc); }
.pod .ps { font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .12em; }
.pod.first { min-height: 190px; box-shadow: 0 0 40px -6px var(--gold); }
.pod.p2 { min-height: 160px; } .pod.p3 { min-height: 140px; } .pod.p4, .pod.p5 { min-height: 120px; }
.reveal-boards { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.rb { padding: 10px; border-radius: 14px; background: rgba(0, 0, 0, .3); border: 1px solid color-mix(in srgb, var(--pc) 50%, transparent); animation: fade-up .6s both; animation-delay: calc(1.4s + var(--d) * .12s); }
.rb .rbn { font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--pc); }
.rb .g { display: grid; gap: 3px; grid-template-columns: repeat(var(--n), 22px); }
.rb .g span { height: 22px; border-radius: 4px; font-size: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .06); color: var(--dim); }
.rb .g span.m { background: color-mix(in srgb, var(--pc) 55%, transparent); color: #fff; }
.rb .g span.l { background: var(--gold); color: #3a1700; }
.victory-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.picker { background: rgba(5, 2, 15, .7); pointer-events: auto; }
.picker .panel { width: min(400px, calc(100% - 32px)); }
.picker h3 { font-family: var(--display); font-weight: 400; margin: 0 0 14px; }
.avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.avatar-grid button { aspect-ratio: 1; font-size: 34px; border-radius: 14px; border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .05); transition: transform .2s var(--ease-back); }
.avatar-grid button:hover { transform: scale(1.12) rotate(-6deg); }
.avatar-grid button.sel { border: 2px solid var(--gold); box-shadow: 0 0 18px rgba(255, 207, 74, .5); }

#toasts { position: fixed; bottom: 86px; left: 16px; z-index: 85; display: grid; gap: 8px; width: min(320px, calc(100% - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 14px; background: rgba(20, 10, 40, .92); border: 1px solid var(--glass-edge); border-left: 4px solid var(--tc, var(--violet));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5); font-weight: 600; animation: toast-in .45s var(--ease-back), toast-out .4s 3.2s forwards; }
.toast.big { font-family: var(--display); font-weight: 400; font-size: 18px; border-left-width: 6px; }
.toast.danger { border-left-color: var(--red); background: rgba(60, 8, 20, .94); }
@keyframes toast-in { from { transform: translateX(-120%); } }
@keyframes toast-out { to { transform: translateX(-120%); opacity: 0; } }

.combo { position: fixed; left: 50%; top: 40%; z-index: 70; pointer-events: none; font-family: var(--display); font-size: clamp(42px, 9vw, 96px); white-space: nowrap;
  background: linear-gradient(180deg, #fff, var(--gold) 50%, var(--magenta)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .6)) drop-shadow(0 0 30px rgba(255, 61, 127, .7)); animation: combo 1.8s var(--ease-out) forwards; }
@keyframes combo { 0% { transform: translate(-50%, -50%) scale(4) rotate(-10deg); opacity: 0; } 18% { transform: translate(-50%, -50%) scale(1) rotate(-4deg); opacity: 1; } 75% { transform: translate(-50%, -60%) scale(1.05) rotate(-4deg); opacity: 1; } 100% { transform: translate(-50%, -90%) scale(.9); opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .arena { grid-template-columns: 210px 1fr; }
  .history { grid-column: 1 / -1; order: 3; }
  .history-list { max-height: none; }
  .last-call { display: none; }
}
@media (max-width: 760px) {
  .screen { padding: 16px; }
  .lobby-grid { grid-template-columns: 1fr; }
  .setup-head { flex-direction: row; align-items: flex-start; }
  .arena { grid-template-columns: 1fr; }
  .rail { order: -1; display: flex; overflow-x: auto; gap: 8px; padding: 6px 2px 10px; scroll-snap-type: x mandatory; }
  .pcard { min-width: 168px; scroll-snap-align: start; }
  .pcard.turn { transform: scale(1.02); }
  .hud { grid-template-columns: 1fr auto; }
  .hud-left { display: none; }
  .turn-banner { justify-self: start; text-align: left; padding: 6px 0; max-width: 70vw; background: none; }
  .board { width: min(calc(100vw - 60px), 56vh); }
  .cell { font-size: calc(min(calc(100vw - 60px), 56vh) / var(--n) * .36); }
  .emote-bar { left: 16px; right: 16px; transform: none; justify-content: space-between; }
  .emote-bar button { width: 36px; height: 40px; font-size: 22px; }
  .pod { width: 120px; }
}

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

/* ---------- icons, sigils, reactions (no emoji) ---------- */
.ico { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
.ico.sm { width: .95em; height: .95em; vertical-align: -0.12em; }
.icon-btn .ico { width: 22px; height: 22px; }
.btn [data-icon], .btn .ico { margin-right: 4px; }
.btn [data-icon] .ico { margin: 0; }
.sigil { display: block; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .45)); }
.avatar-btn { display: grid; place-items: center; padding: 0; }
.slot .av, .pcard .av { background: none; border: 0; padding: 0; }
.slot .av:disabled { cursor: default; }
.ready-row .sigil { width: 28px; height: 28px; }
.avatar-grid button { display: grid; place-items: center; }
.victory-crown { color: var(--gold); display: flex; justify-content: center; }
.victory-crown .ico { width: clamp(70px, 12vw, 120px); height: auto; stroke-width: 1.6; }
.pav { position: relative; display: flex; justify-content: center; margin-bottom: 6px; }
.pcrown { position: absolute; top: -22px; color: var(--gold); filter: drop-shadow(0 0 10px var(--gold)); }
.pcrown .ico { width: 30px; height: 30px; }
.toast .ico { color: var(--tc, var(--gold)); }
.toast.danger .ico { color: var(--red); }

.emote-bar button { width: auto; height: 38px; padding: 0 12px; font-family: var(--display); font-size: 13px; letter-spacing: .04em; color: var(--dim); white-space: nowrap; }
.emote-bar button:hover { color: var(--gold); transform: translateY(-3px) scale(1.06); }
.floater { font-family: var(--display); font-size: clamp(26px, 4vw, 40px); color: #fff; text-align: center; white-space: nowrap;
  text-shadow: 0 0 18px var(--pc), 0 3px 0 rgba(0, 0, 0, .6); -webkit-text-stroke: 1px color-mix(in srgb, var(--pc) 70%, #000); }
.floater span { display: inline-block; padding: 4px 14px; border-radius: 12px; transform: rotate(-4deg); background: color-mix(in srgb, var(--pc) 30%, transparent); border: 2px solid var(--pc); }
.floater small { font-family: var(--body); color: var(--pc); -webkit-text-stroke: 0; margin-top: 4px; }
.pcard .emote-pop { font-family: var(--display); font-size: 13px; padding: 3px 8px; border-radius: 8px; background: var(--pc); color: #0b0618; top: 6px; }
@media (max-width: 760px) {
  .emote-bar { overflow-x: auto; justify-content: flex-start; }
  .emote-bar button { width: auto; font-size: 12px; padding: 0 10px; }
}

/* ---------- invite, share, bots, settings, connection ---------- */
.wide { width: 100%; }
.invite-panel { display: grid; gap: 16px; }
.invite-code { font-family: var(--display); font-size: clamp(56px, 16vw, 92px); letter-spacing: .14em; line-height: 1; padding-left: .14em;
  color: var(--gold); text-shadow: 0 0 30px rgba(255, 207, 74, .55), 0 5px 0 #6b2700; animation: title-in .8s var(--ease-back) both; }
.invite-info { color: var(--dim); margin: 0; line-height: 1.5; }
.invite-info b { color: var(--ink); }
.warn-text { color: var(--red); font-weight: 700; }
.invite-panel .identity { margin-bottom: 0; }
.link-btn { background: none; border: 0; color: var(--dim); text-decoration: underline; text-underline-offset: 4px; font-size: 14px; padding: 6px; }
.link-btn:hover { color: var(--ink); }
.stats-line { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin: -8px 0 18px; font-size: 13px; color: var(--dim); }
.stats-line b { color: var(--gold); font-family: var(--display); font-weight: 400; }
.stats-line:empty { display: none; }
.rejoin { margin-bottom: 16px; }
.install { margin-top: 14px; }

.share-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.bot-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: 14px; border: 1px dashed var(--glass-edge); color: var(--dim); font-size: 13px; flex-wrap: wrap; }
.bot-row span { flex: 1; min-width: 140px; }
.edit-btn.kick { color: var(--dim); }
.edit-btn.kick:hover { color: var(--red); background: rgba(255, 77, 94, .15); }

.qr-panel { width: min(340px, calc(100% - 32px)); text-align: center; }
.qr-box { background: #fff; border-radius: 16px; padding: 10px; box-shadow: 0 0 40px rgba(255, 207, 74, .35); }
.qr-box svg { display: block; width: 100%; height: auto; }
.qr-code { font-family: var(--display); font-size: 40px; letter-spacing: .14em; color: var(--gold); margin-top: 12px; }

.settings-panel { display: grid; gap: 14px; }
.settings-panel h3 { margin-bottom: 0; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; }
.set-row.col { flex-direction: column; align-items: stretch; }
.toggle { width: 54px; height: 30px; border-radius: 30px; border: 1px solid var(--glass-edge); background: rgba(255, 255, 255, .08); position: relative; transition: background .2s; flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--dim); transition: transform .25s var(--ease-back), background .2s; }
.toggle.on { background: var(--cyan); border-color: var(--cyan); }
.toggle.on::after { transform: translateX(24px); background: #00222b; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, .3); }
.seg button { border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 700; color: var(--dim); }
.seg button.sel { background: var(--gold); color: #2a1300; }

.net-banner { position: fixed; top: 0; left: 50%; z-index: 95; transform: translate(-50%, -110%); padding: 10px 18px; border-radius: 0 0 14px 14px;
  background: #3a0d1a; border: 1px solid rgba(255, 77, 94, .5); border-top: 0; font-weight: 700; font-size: 14px; transition: transform .35s var(--ease-out); white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
.net-banner.show { transform: translate(-50%, 0); }

.corner-gear { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 30; }
body[data-screen="intro"] .corner-gear, body[data-screen="game"] .corner-gear, body:not([data-screen]) .corner-gear { display: none; }
.lobby-head { padding-right: 56px; }
#toasts { bottom: 16px; }
body[data-screen="game"] #toasts { bottom: 86px; }
@media (max-width: 480px) { .leave-label { display: none; } #leaveLobby { padding: 10px 12px; } }
@media (max-width: 760px) { .hud-right { gap: 6px; } }

/* ---------- Lite effects: same game, far less GPU work ---------- */
[data-fx="lite"] .scanlines, [data-fx="lite"] .reveal-rays { display: none; }
[data-fx="lite"] .panel, [data-fx="lite"] .pcard, [data-fx="lite"] .history, [data-fx="lite"] .emote-bar, [data-fx="lite"] #victory {
  backdrop-filter: none; -webkit-backdrop-filter: none; }
[data-fx="lite"] .panel, [data-fx="lite"] .pcard, [data-fx="lite"] .history, [data-fx="lite"] .emote-bar { background: #160d2e; }
[data-fx="lite"] .board-frame::before { animation: none; }
[data-fx="lite"] .pcard.turn::after { animation: none; opacity: .5; transform: none; }
[data-fx="lite"] .screen.active { animation-name: fade-in; }
[data-fx="lite"] .reveal-num, [data-fx="lite"] .intro-word span, [data-fx="lite"] .logo, [data-fx="lite"] .victory-title { filter: none; }
[data-fx="lite"] .reveal-num.rolling { filter: none; }
[data-fx="lite"] .cell { box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .35); }
[data-fx="lite"] .btn::after { display: none; }
[data-fx="lite"] .intro-blitz { animation: blitz-in .6s 1.2s var(--ease-out) forwards; }
[data-fx="lite"] #stage.shake, [data-fx="lite"] #stage.shake-big { animation-duration: .3s; }
