:root {
  --bg0: #0b0724;
  --bg1: #160f3d;
  --bg2: #22185a;
  --card: rgba(255, 255, 255, 0.06);
  --card2: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f6f3ff;
  --muted: #a99fd6;
  --gold: #f5b301;
  --gold2: #ffd84d;
  --teamA: #f5b301;
  --teamB: #18b5c9;
  --red: #ff3b4e;
  --green: #2ed47a;
  --tile: linear-gradient(180deg, #2b4fd8 0%, #1a2f9a 100%);
  --tile-on: linear-gradient(180deg, #fff6d6 0%, #ffd84d 100%);
  --r: 18px;
  --logo: 'Lemonada', 'Lalezar', system-ui, sans-serif;
  --display: 'Lalezar', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --body: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--body);
  color: var(--text);
  background: radial-gradient(1200px 700px at 50% -10%, #3a2690 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 110%, #0d4f6b55 0%, transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--gold2); }
.ic { width: 1.25em; height: 1.25em; flex: none; }
.ic.big { width: 64px; height: 64px; color: var(--gold2); filter: drop-shadow(0 0 18px #f5b30188); }
.hidden { display: none !important; }
.display { font-family: var(--display); font-weight: 400; letter-spacing: 0; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.center { text-align: center; }

/* stars bg */
.stars { position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: .5;
  background-image: radial-gradient(1px 1px at 20% 30%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 80% 10%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 60% 70%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 35% 85%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 90% 55%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 10% 60%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 45% 15%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 70% 40%, #fff 50%, transparent 51%);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px;
  background: var(--card2); border: 1px solid var(--line);
  font-weight: 700; transition: transform .08s ease, background .2s;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #2a1a00; border-color: #ffe9a0; box-shadow: 0 6px 18px #f5b30140; }
.btn.red { background: linear-gradient(180deg, #ff6170, var(--red)); color: #fff; border-color: #ff8a95; box-shadow: 0 6px 18px #ff3b4e40; }
.btn.green { background: linear-gradient(180deg, #4be696, var(--green)); color: #022b14; border-color: #8cf3bb; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 11px; }
.btn.lg { min-height: 60px; font-size: 19px; border-radius: 18px; }
.btn.block { width: 100%; }
.btn.icon { width: 44px; padding: 0; }
.btn.teamA { background: color-mix(in srgb, var(--teamA) 22%, transparent); border-color: var(--teamA); }
.btn.teamB { background: color-mix(in srgb, var(--teamB) 22%, transparent); border-color: var(--teamB); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; backdrop-filter: blur(8px); }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 600; }
.input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; background: rgba(0,0,0,.25); border: 1px solid var(--line); outline: none; }
.input:focus { border-color: var(--gold); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--card2); font-size: 13px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: var(--red); }

/* toasts */
#toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast { background: #1d1550ee; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 24px #0008; animation: pop .25s ease; transition: opacity .4s, transform .4s; }
.toast.err { border-color: var(--red); }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }

/* sheet / modal */
.sheet-bg { position: fixed; inset: 0; background: #0009; z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { width: min(640px, 100%); max-height: 92vh; overflow: auto; background: linear-gradient(180deg, #221861, #160f3d); border: 1px solid var(--line); border-radius: 24px 24px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up .25s ease; }
@media (min-width: 700px) { .sheet-bg { align-items: center; } .sheet { border-radius: 24px; } }
.sheet h3 { margin: 0 0 12px; font-family: var(--display); font-weight: 400; font-size: 26px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* ---------- logo / brand ---------- */
.logo { display: inline-block; width: 96px; height: 96px; filter: drop-shadow(0 6px 18px #f5b30155); }
.logo svg { width: 100%; height: 100%; }
.tv-logo .brandmark { grid-auto-flow: column; align-items: center; justify-content: start; gap: 2vh; }
.tv-logo .word { text-align: start; }
.brand { font-family: var(--display); font-size: clamp(40px, 10vw, 68px); line-height: 1.1; margin: 8px 0 0;
  background: linear-gradient(180deg, #fff6c9, var(--gold) 70%); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: 0 4px 30px #f5b30133; }

/* ---------- home ---------- */
.home { max-width: 760px; margin: 0 auto; padding: 32px 16px 60px; }
.hero { text-align: center; padding: 24px 0 8px; }
.hero p { color: var(--muted); margin: 6px 0 0; font-size: 17px; }
.crew { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 18px 0 6px; }
.crew span { padding: 6px 14px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); font-weight: 700; }
.games { display: grid; gap: 14px; margin-top: 26px; }
@media (min-width: 640px) { .games { grid-template-columns: 1fr 1fr; } }
.game-card { position: relative; overflow: hidden; border-radius: 24px; padding: 22px; min-height: 210px; display: flex; flex-direction: column; justify-content: flex-end;
  background: linear-gradient(160deg, #3b2aa3, #1b1260); border: 1px solid #ffffff22; text-align: start; transition: transform .15s; }
.game-card:active { transform: scale(.98); }
.game-card .art { position: absolute; top: 14px; inset-inline-end: 14px; width: 120px; opacity: .95; }
.game-card h2 { font-family: var(--display); font-weight: 400; font-size: 36px; margin: 0; }
.game-card p { margin: 4px 0 0; color: #d6ceff; }
.game-card.soon { background: linear-gradient(160deg, #24305e, #141b3d); opacity: .75; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--gold); color: #2a1a00; font-weight: 800; font-size: 12px; margin-bottom: 8px; width: fit-content; }
.links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.role-btn { display: flex; align-items: center; gap: 14px; text-align: start; padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); width: 100%; margin-bottom: 10px; }
.role-btn .ic { width: 30px; height: 30px; color: var(--gold2); }
.role-btn b { display: block; font-size: 17px; }
.role-btn small { color: var(--muted); }
.code-input { font-family: var(--display); font-size: 40px; text-align: center; letter-spacing: 12px; direction: ltr; }

.rules h3 { font-family: var(--display); font-weight: 400; font-size: 24px; margin: 22px 0 6px; color: var(--gold2); }
.rules ol, .rules ul { padding-inline-start: 22px; line-height: 1.9; margin: 0; }
.rules p { line-height: 1.9; margin: 0 0 6px; }

/* ================= TV ================= */
.tv { height: 100vh; overflow: hidden; display: grid; grid-template-rows: auto 1fr auto; padding: 2vh 2.5vw; gap: 1.6vh; }
.tv-top { display: flex; align-items: center; justify-content: space-between; gap: 2vw; }
.tv-brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-size: 3.2vh; color: var(--gold2); }
.tv-brand .logo { width: 6vh; height: 6vh; }
.round-tag { font-family: var(--display); font-size: 3vh; padding: .4vh 1.6vh; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); }
.round-tag b { color: var(--gold2); font-weight: 400; }
.tv-mid { display: grid; grid-template-columns: 1fr 4.2fr 1fr; gap: 2vw; align-items: center; min-height: 0; }
.team-panel { display: grid; justify-items: center; gap: 1vh; padding: 2.5vh 1vw; border-radius: 3vh; background: var(--card); border: 2px solid transparent; transition: all .3s; position: relative; }
.team-panel .tname { font-family: var(--display); font-size: 3.4vh; text-align: center; line-height: 1.2; }
.team-panel .tscore { font-family: var(--display); font-size: 9vh; line-height: 1; direction: ltr; }
.team-panel.ctrl { border-color: var(--tc); box-shadow: 0 0 40px color-mix(in srgb, var(--tc) 50%, transparent); background: color-mix(in srgb, var(--tc) 14%, transparent); }
.team-panel .ctrl-tag { position: absolute; top: -1.6vh; font-size: 1.8vh; font-weight: 800; background: var(--tc); color: #111; padding: .3vh 1.2vh; border-radius: 999px; }
.team-panel.bump .tscore { animation: bump .6s ease; }
@keyframes bump { 40% { transform: scale(1.35); color: var(--gold2); } }

.board-wrap { display: grid; gap: 1.6vh; min-height: 0; }
.question { text-align: center; font-family: var(--display); font-size: 4.6vh; line-height: 1.35; min-height: 6vh; padding: 0 2vw; text-shadow: 0 3px 18px #0008; }
.question .pre { display: block; font-family: var(--body); font-size: 2.2vh; color: var(--muted); font-weight: 600; }
.bank { justify-self: center; display: flex; align-items: center; gap: 1.4vh; font-family: var(--display); font-size: 5.6vh; padding: .6vh 3.4vh; border-radius: 2vh;
  background: linear-gradient(180deg, #11104a, #07062a); border: .4vh solid var(--gold); box-shadow: 0 0 30px #f5b30144 inset, 0 8px 30px #0008; direction: ltr; min-width: 18vh; justify-content: center; }
.bank small { font-size: 2.2vh; color: var(--muted); font-family: var(--body); }
.board { display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: column; grid-template-rows: repeat(4, 1fr); gap: 1.4vh;
  padding: 2vh; border-radius: 3vh; background: linear-gradient(180deg, #0d0b3a, #050420); border: .5vh solid #ffd84d88; box-shadow: 0 0 0 .5vh #0a0830, 0 20px 60px #000a, inset 0 0 40px #2b4fd833; }
.slot { position: relative; height: 9.2vh; perspective: 900px; }
.slot .inner { position: absolute; inset: 0; transition: transform .7s cubic-bezier(.3, 1.4, .5, 1); transform-style: preserve-3d; }
.slot.on .inner { transform: rotateX(180deg); }
.slot .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 1.4vh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.slot .front { background: var(--tile); border: .3vh solid #6f8bff; box-shadow: inset 0 -.6vh 0 #0f1d6b; }
.slot .front .num { width: 6.4vh; height: 6.4vh; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 4.6vh; color: #fff;
  background: radial-gradient(circle at 35% 30%, #4f72ff, #12237d); border: .35vh solid #b8c6ff; box-shadow: 0 0 20px #4f72ff88; }
.slot.empty .num { display: none; }
.slot.empty .front { background: linear-gradient(180deg, #151a4d, #0d1035); border-color: #262c6c; box-shadow: none; }
.slot .back { transform: rotateX(180deg); background: var(--tile-on); color: #1a1240; border: .3vh solid #fff; justify-content: space-between; padding: 0 2.2vh; box-shadow: inset 0 -.6vh 0 #e0a800; }
.slot .back .t { font-family: var(--display); font-size: 4vh; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .back .p { font-family: var(--display); font-size: 4.4vh; min-width: 8vh; height: 7vh; display: grid; place-items: center; border-radius: 1vh; background: #1a2f9a; color: #fff; }
.slot.unscored .back { background: linear-gradient(180deg, #e9e6f5, #bdb7d6); box-shadow: inset 0 -.6vh 0 #8f88ad; }
.slot.unscored .back .p { background: #5b5880; }
.slot.flash .back { animation: shine 1s ease; }
@keyframes shine { 0% { filter: brightness(2); } 100% { filter: brightness(1); } }

.tv-bottom { display: flex; align-items: center; justify-content: center; gap: 2vw; min-height: 7vh; }
.strikes { display: flex; gap: 1.4vh; }
.strikes .x { width: 7vh; height: 7vh; border-radius: 1.4vh; display: grid; place-items: center; border: .4vh solid #ffffff22; color: #ffffff22; }
.strikes .x.on { border-color: var(--red); color: var(--red); background: #ff3b4e22; box-shadow: 0 0 20px #ff3b4e66; }
.strikes .x .ic { width: 70%; height: 70%; stroke-width: 3.5; }
.stage-msg { font-family: var(--display); font-size: 3.6vh; padding: .6vh 2.6vh; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); }
.stage-msg.steal { background: var(--red); border-color: #ff8a95; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }

/* big overlays */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; z-index: 40; pointer-events: none; }
.big-x { display: flex; gap: 3vh; animation: xin .9s ease forwards; }
.big-x div { width: 30vh; height: 30vh; border-radius: 4vh; display: grid; place-items: center; background: #ff3b4e22; border: 1.2vh solid var(--red); color: var(--red); box-shadow: 0 0 80px #ff3b4e; }
.big-x .ic { width: 80%; height: 80%; stroke-width: 3.5; }
@keyframes xin { 0% { transform: scale(2.4); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(.95); } }
.buzz-banner { padding: 4vh 8vh; border-radius: 4vh; text-align: center; background: linear-gradient(180deg, #2a1d6e, #140c3e); border: .8vh solid var(--bc, var(--gold)); box-shadow: 0 0 120px var(--bc, var(--gold)); animation: xin 3s ease forwards; }
.buzz-banner .ic { width: 12vh; height: 12vh; color: var(--bc, var(--gold)); animation: ring .5s ease 3; }
.buzz-banner b { display: block; font-family: var(--display); font-weight: 400; font-size: 10vh; line-height: 1.1; }
.buzz-banner span { font-size: 3.4vh; color: var(--muted); }
@keyframes ring { 25% { transform: rotate(-18deg); } 75% { transform: rotate(18deg); } }
.award-banner { text-align: center; animation: xin 3.2s ease forwards; }
.award-banner b { display: block; font-family: var(--display); font-weight: 400; font-size: 18vh; line-height: 1; color: var(--gold2); text-shadow: 0 0 60px #f5b301; direction: ltr; }
.award-banner span { font-family: var(--display); font-size: 6vh; }

.lobby-tv { display: grid; grid-template-columns: 1.2fr 1fr; gap: 4vw; align-items: center; height: 100%; padding: 0 3vw; }
.lobby-tv h1 { font-family: var(--display); font-weight: 400; font-size: 13vh; margin: 0; line-height: 1; background: linear-gradient(180deg, #fff6c9, var(--gold) 70%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lobby-tv .sub { font-size: 3vh; color: var(--muted); margin: 1vh 0 4vh; }
.join-box { background: #fff; color: #140c3e; border-radius: 4vh; padding: 3vh; text-align: center; justify-self: center; box-shadow: 0 20px 80px #0009; }
.join-box .qr { width: 36vh; height: 36vh; }
.join-box .qr svg, .join-box .qr img { width: 100%; height: 100%; }
.join-box .code { font-family: var(--display); font-size: 9vh; letter-spacing: 1.5vh; direction: ltr; line-height: 1; margin-top: 1vh; }
.join-box small { font-size: 2.2vh; font-weight: 600; color: #554c86; }
.player-chips { display: flex; flex-wrap: wrap; gap: 1.2vh; }
.player-chips .chip { font-size: 2.8vh; font-weight: 700; padding: .8vh 2vh; border-radius: 999px; background: var(--card2); border: .3vh solid var(--tc, var(--line)); animation: pop .3s ease; }
.player-chips .chip.off { opacity: .4; }
.teams-tv { display: grid; grid-template-columns: 1fr 1fr; gap: 2vw; margin-top: 3vh; }
.teams-tv > div { padding: 2vh; border-radius: 2.4vh; background: var(--card); border-top: .6vh solid var(--tc); }
.teams-tv h3 { margin: 0 0 1.4vh; font-family: var(--display); font-weight: 400; font-size: 4vh; color: var(--tc); }

.winner-tv { text-align: center; display: grid; place-items: center; height: 100%; }
.winner-tv .ic { width: 22vh; height: 22vh; color: var(--gold2); filter: drop-shadow(0 0 40px var(--gold)); animation: pulse 1.6s infinite; }
.winner-tv h1 { font-family: var(--display); font-weight: 400; font-size: 14vh; margin: 2vh 0 0; line-height: 1; color: var(--wc); text-shadow: 0 0 60px var(--wc); }
.winner-tv p { font-size: 4vh; color: var(--muted); margin: 1vh 0; }
.final-scores { display: flex; gap: 6vw; justify-content: center; margin-top: 3vh; font-family: var(--display); font-size: 5vh; }

/* fast money tv */
.fm-tv { display: grid; grid-template-rows: auto 1fr auto; gap: 2vh; height: 100%; }
.fm-head { display: flex; justify-content: space-between; align-items: center; }
.fm-title { font-family: var(--display); font-size: 6vh; color: var(--gold2); }
.fm-timer { font-family: var(--display); font-size: 10vh; width: 18vh; height: 18vh; border-radius: 50%; display: grid; place-items: center; background: #07062a; border: .8vh solid var(--gold); box-shadow: 0 0 40px #f5b30155; direction: ltr; }
.fm-timer.low { border-color: var(--red); color: var(--red); animation: pulse .5s infinite; }
.fm-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2vw; padding: 2vh; border-radius: 3vh; background: linear-gradient(180deg, #0d0b3a, #050420); border: .5vh solid #ffd84d88; }
.fm-col { display: grid; gap: 1.2vh; align-content: start; }
.fm-col h4 { margin: 0 0 .5vh; text-align: center; font-family: var(--display); font-weight: 400; font-size: 3.4vh; color: var(--muted); }
.fm-col.active h4 { color: var(--gold2); }
.fm-row { display: grid; grid-template-columns: 1fr 10vh; gap: 1vh; height: 8.4vh; }
.fm-row > div { border-radius: 1.2vh; background: var(--tile); border: .3vh solid #6f8bff; display: flex; align-items: center; padding: 0 2vh; font-family: var(--display); font-size: 3.8vh; overflow: hidden; white-space: nowrap; }
.fm-row > div:last-child { justify-content: center; direction: ltr; }
.fm-row .fill { animation: flipin .5s ease; }
@keyframes flipin { from { transform: rotateX(90deg); } }
.fm-total { justify-self: center; display: flex; gap: 3vh; align-items: center; font-family: var(--display); font-size: 6vh; }
.fm-total .bank { font-size: 7vh; }

/* ================= HOST ================= */
.host { max-width: 720px; margin: 0 auto; padding: 10px 12px calc(110px + env(safe-area-inset-bottom)); }
.host-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px 2px; background: linear-gradient(180deg, var(--bg1) 70%, transparent); }
.room-code { font-family: var(--display); font-size: 26px; direction: ltr; color: var(--gold2); line-height: 1; }
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.score-box { border-radius: 16px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--tc); }
.score-box .n { font-weight: 800; font-size: 15px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.score-box .s { font-family: var(--display); font-size: 36px; line-height: 1.1; }
.score-box.ctrl { background: color-mix(in srgb, var(--tc) 16%, transparent); }
.adj { display: flex; gap: 4px; }
.adj button { width: 30px; height: 30px; border-radius: 9px; background: var(--card2); display: grid; place-items: center; }
.adj .ic { width: 16px; height: 16px; }
.section { margin-top: 14px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 8px; font-weight: 800; color: var(--muted); font-size: 14px; }
.h-question { font-size: 19px; font-weight: 800; line-height: 1.5; }
.h-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.answers { display: grid; gap: 8px; }
.ans { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-align: start; width: 100%; min-height: 56px; transition: background .2s; }
.ans .i { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #2b4fd8; font-weight: 800; flex: none; }
.ans .t { flex: 1; font-weight: 700; font-size: 17px; }
.ans .p { font-family: var(--display); font-size: 24px; color: var(--gold2); min-width: 40px; text-align: center; }
.ans.on { background: #ffd84d1a; border-color: #ffd84d66; }
.ans.on .i { background: var(--gold); color: #2a1a00; }
.ans.on .t::after { content: ' ✓'; color: var(--green); }
.stage-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--card2); font-weight: 700; line-height: 1.5; }
.stage-bar.steal { background: #ff3b4e33; border: 1px solid var(--red); }
.stage-bar.done { background: #2ed47a22; border: 1px solid var(--green); }
.strike-dots { display: flex; gap: 4px; }
.strike-dots i { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #ffffff33; display: grid; place-items: center; font-style: normal; font-weight: 900; color: transparent; font-size: 13px; }
.strike-dots i.on { border-color: var(--red); color: var(--red); background: #ff3b4e22; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dock { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: linear-gradient(0deg, var(--bg0) 60%, transparent); }
.dock > div { max-width: 720px; margin: 0 auto; display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; }
.buzz-status { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.buzz-status .ic { color: var(--gold2); width: 26px; height: 26px; }
.buzz-status b { font-size: 17px; }
.buzz-order { font-size: 13px; color: var(--muted); }
.plist { display: flex; flex-wrap: wrap; gap: 6px; }
.plist .chip { padding: 5px 10px; border-radius: 999px; background: var(--card2); border: 1px solid var(--tc, var(--line)); font-size: 14px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; }
.plist .chip.off { opacity: .45; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.tabs button { white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.tabs button.on { background: var(--gold); color: #2a1a00; border-color: var(--gold); }
.q-item { width: 100%; text-align: start; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); margin-bottom: 8px; display: flex; gap: 10px; align-items: center; }
.q-item .meta { font-size: 12px; color: var(--muted); }
.q-item.used { opacity: .45; }
.q-item.sel { border-color: var(--gold); background: #f5b3011a; }
.empty-state { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty-state .ic { width: 48px; height: 48px; color: var(--gold2); margin-bottom: 8px; }
.fm-q { padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); margin-bottom: 8px; }
.fm-q .qt { font-weight: 800; margin-bottom: 8px; }
.fm-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.fm-opts button { padding: 6px 10px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); font-size: 14px; font-weight: 700; }
.fm-opts button.sel { background: var(--gold); color: #2a1a00; }
.fm-opts button.dis { opacity: .35; text-decoration: line-through; }
.fm-entry { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14px; }

/* ================= BUZZER ================= */
.buzz-page { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
.buzz-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; background: color-mix(in srgb, var(--tc, #888) 30%, transparent); border: 2px solid var(--tc, var(--line)); }
.buzz-zone { display: grid; place-items: center; }
.buzzer { width: min(78vw, 48vh); aspect-ratio: 1; border-radius: 50%; position: relative; touch-action: manipulation;
  background: radial-gradient(circle at 50% 35%, #ff7b88, #e8192d 55%, #8c0012); box-shadow: 0 2.4vh 0 #5c000b, 0 3vh 50px #ff3b4e88, inset 0 -2vh 4vh #0004, inset 0 2vh 3vh #ffffff55;
  border: 1.2vh solid #2a1d6e; transition: transform .06s, box-shadow .06s; display: grid; place-items: center; }
.buzzer span { font-family: var(--display); font-size: min(14vw, 8vh); color: #fff; text-shadow: 0 4px 0 #8c0012; }
.buzzer:active, .buzzer.pressed { transform: translateY(2vh); box-shadow: 0 .4vh 0 #5c000b, 0 1vh 30px #ff3b4e88, inset 0 -2vh 4vh #0004, inset 0 2vh 3vh #ffffff55; }
.buzzer.locked { filter: grayscale(.9) brightness(.6); }
.buzzer.won { background: radial-gradient(circle at 50% 35%, #8cffbf, #19c46a 55%, #05622f); box-shadow: 0 2.4vh 0 #033d1d, 0 3vh 80px #2ed47a; animation: pulse 1s infinite; }
.buzzer.won span { text-shadow: 0 4px 0 #05622f; }
.buzz-msg { text-align: center; font-family: var(--display); font-size: 30px; min-height: 48px; margin-top: 4vh; }
.buzz-msg small { display: block; font-family: var(--body); font-size: 15px; color: var(--muted); }
.name-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.name-grid button { min-height: 52px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-weight: 800; font-size: 17px; }
.name-grid button.on { background: var(--gold); color: #2a1a00; }
.team-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team-pick button { min-height: 72px; border-radius: 16px; border: 2px solid var(--tc); background: color-mix(in srgb, var(--tc) 12%, transparent); font-family: var(--display); font-size: 24px; }
.team-pick button.on { background: var(--tc); color: #111; }
.emoji-row { display: flex; gap: 6px; flex-wrap: wrap; }
.emoji-row button { width: 46px; height: 46px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-size: 24px; }
.emoji-row button.on { border-color: var(--gold); background: #f5b30133; }

/* ================= EDITOR ================= */
.editor { max-width: 760px; margin: 0 auto; padding: 16px 14px 80px; }
.ed-answer { display: grid; grid-template-columns: 28px 1fr 84px 40px; gap: 6px; align-items: center; margin-bottom: 6px; }
.ed-answer .i { color: var(--muted); font-weight: 800; text-align: center; }
.sum { font-weight: 800; }
.sum.bad { color: var(--red); }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.page-head h1 { font-family: var(--display); font-weight: 400; font-size: 32px; margin: 0; flex: 1; }


/* ================= APP SHELL: ثابت مثل التطبيقات =================
   الصفحة نفسها مقفولة (ما تنسحب ولا تتكبر)، والمحتوى يتحرك داخل .app-scroll بس */
html, body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: pan-x pan-y; }
.app-scroll { position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: none; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-width: none; }
.app-scroll::-webkit-scrollbar { display: none; }
* { touch-action: manipulation; }
.app-scroll, .app-scroll * { touch-action: pan-y; }
button, a, .btn, input, label { touch-action: manipulation !important; }
input, textarea, select, [contenteditable] { -webkit-user-select: text; user-select: text; font-size: max(16px, 1em); }
img, svg { -webkit-user-drag: none; user-drag: none; pointer-events: auto; }
.sheet { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
/* مسافة النتوء (النوتش) فوق وتحت */
.app-home { padding-top: calc(18px + env(safe-area-inset-top)) !important; }
.host-top { padding-top: calc(10px + env(safe-area-inset-top)); }
.buzz-page { padding-top: calc(14px + env(safe-area-inset-top)) !important; }
.editor { padding-top: calc(16px + env(safe-area-inset-top)) !important; }
.app-scroll.page-in > *:not(.sheet-bg):not(.overlay) { animation: pageIn .3s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } }
/* انتقال ناعم بين الصفحات (بدون وميض أبيض) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
@media (hover: none) { .btn:hover, button:hover { filter: none; } }

/* ================= LOGO ================= */
.brandmark { display: grid; justify-items: center; gap: 2px; position: relative; }
.brandmark .emblem { width: var(--em, 92px); height: var(--em, 92px); position: relative; animation: floaty 4s ease-in-out infinite; }
.brandmark .emblem svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 10px 28px #f5b30155); }
.brandmark .word { font-family: var(--logo); font-weight: 700; line-height: 1.05; text-align: center; position: relative; }
.brandmark .w1, .brandmark .w2 { display: block; position: relative; background: linear-gradient(180deg, #fff7cf 0%, #ffd84d 45%, #f09b00 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #b06a00) drop-shadow(0 4px 0 #6b3a00) drop-shadow(0 10px 18px #0009); }
.brandmark .w1 { font-size: var(--w1, 64px); }
.brandmark .w2 { font-size: var(--w2, 40px); margin-top: -.15em; }
.brandmark .shine { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(100deg, transparent 35%, #ffffffcc 50%, transparent 65%) no-repeat;
  background-size: 250% 100%; -webkit-mask: var(--txt); mix-blend-mode: overlay; }
.brandmark .w1::after, .brandmark .w2::after { content: attr(data-t); position: absolute; inset: 0; background: linear-gradient(100deg, transparent 40%, #fff 50%, transparent 60%) no-repeat; background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: sweep 4.5s ease-in-out infinite; }
.brandmark .w2::after { animation-delay: .25s; }
@keyframes sweep { 0%, 55% { background-position: 150% 0; } 85%, 100% { background-position: -60% 0; } }
@keyframes floaty { 50% { transform: translateY(-6px) rotate(-2deg); } }
.brandmark .steam path { stroke-dasharray: 22; animation: steam 2.2s ease-in-out infinite; }
.brandmark .steam path:nth-child(2) { animation-delay: .7s; }
.brandmark .steam path:nth-child(3) { animation-delay: 1.3s; }
@keyframes steam { 0% { stroke-dashoffset: 22; opacity: 0; transform: translateY(4px); } 40% { opacity: .9; } 100% { stroke-dashoffset: -22; opacity: 0; transform: translateY(-8px); } }
.brandmark .tw { animation: twinkle 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.brandmark .tw:nth-of-type(2n) { animation-delay: .8s; }
.brandmark .tw:nth-of-type(3n) { animation-delay: 1.5s; }
@keyframes twinkle { 50% { opacity: .2; transform: scale(.5); } }
.brandmark.intro .emblem { animation: pop-in .7s cubic-bezier(.3, 1.6, .5, 1) both, floaty 4s 0.7s ease-in-out infinite; }
.brandmark.intro .w1 { animation: rise .7s .25s cubic-bezier(.3, 1.5, .5, 1) both; }
.brandmark.intro .w2 { animation: rise .7s .4s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes pop-in { from { transform: scale(0) rotate(-25deg); opacity: 0; } }
@keyframes rise { from { transform: translateY(30px) scale(.8); opacity: 0; } }
.brandmark .sparkles { position: absolute; inset: -20px; pointer-events: none; }
.brandmark .sparkles i { position: absolute; width: 8px; height: 8px; background: #fff6c9; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); animation: twinkle 2s ease-in-out infinite; }

/* splash */
.splash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: radial-gradient(800px 500px at 50% 30%, #3a2690, transparent 70%), linear-gradient(180deg, var(--bg1), var(--bg0)); transition: opacity .5s ease, transform .5s ease; }
.splash.out { opacity: 0; transform: scale(1.08); pointer-events: none; }
.splash .tag { text-align: center; color: var(--muted); margin-top: 18px; font-weight: 600; animation: rise .6s .7s both; }
.splash .loader { width: 120px; height: 5px; border-radius: 9px; background: #ffffff1a; margin: 18px auto 0; overflow: hidden; }
.splash .loader i { display: block; height: 100%; width: 40%; border-radius: 9px; background: linear-gradient(90deg, var(--gold), var(--gold2)); animation: load 1.1s ease-in-out infinite; }
@keyframes load { from { transform: translateX(160%); } to { transform: translateX(-260%); } }

/* home as app: header + tabs */
.app-home { max-width: 760px; margin: 0 auto; padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: center; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: #0d0828ee; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tabbar > div { display: grid; grid-template-columns: repeat(3, 1fr); width: min(520px, 100%); }
.tabbar button { display: grid; justify-items: center; gap: 3px; padding: 6px 0; color: var(--muted); font-size: 12px; font-weight: 700; transition: color .2s, transform .1s; }
.tabbar button .ic { width: 26px; height: 26px; }
.tabbar button.on { color: var(--gold2); }
.tabbar button.on .ic { filter: drop-shadow(0 0 8px #f5b30188); animation: tabpop .35s ease; }
.tabbar button:active { transform: scale(.9); }
@keyframes tabpop { 50% { transform: scale(1.25) translateY(-2px); } }
.tab-pane { display: none; }
.tab-pane.on { display: block; animation: pageIn .3s ease both; }
.install-hint { display: flex; gap: 12px; align-items: center; margin-top: 16px; }
.install-hint .ic { width: 30px; height: 30px; color: var(--gold2); }

/* ===== الشعار ككتابة (نفس ستايل الأيقونة) ===== */
.wordmark { position: relative; width: var(--wm); margin: 0 auto; text-align: center; font-family: 'Lalezar', var(--display); line-height: .95; padding-top: calc(var(--wm) * .2); }
.wm-crown { position: absolute; top: 0; left: 50%; width: calc(var(--wm) * .28); transform: translateX(-30%) rotate(-12deg); transform-origin: 50% 100%; filter: drop-shadow(0 4px 10px #f5b30166); animation: crown 3s ease-in-out infinite; z-index: 2; }
.wm-crown svg { width: 100%; display: block; }
@keyframes crown { 0%, 100% { transform: translateX(-30%) rotate(-12deg); } 50% { transform: translateX(-30%) rotate(-4deg) translateY(-6%); } }
.wm-1, .wm-2 { position: relative; display: block; }
.wm-1 { font-size: calc(var(--wm) * .36); }
.wm-2 { font-size: calc(var(--wm) * .3); margin-top: calc(var(--wm) * -.03); }
/* طبقة الحدود الغامقة ورا الكلام */
.wm-1::before, .wm-2::before { content: attr(data-t); position: absolute; inset: 0; color: #1a0b3d; -webkit-text-stroke: .16em #1a0b3d; z-index: 0;
  text-shadow: 0 .06em 0 #1a0b3d, 0 .1em 0 #1a0b3d, 0 .16em .2em #000a; }
.wm-1 span, .wm-2 span { position: relative; z-index: 1; display: inline-block; background-clip: text; -webkit-background-clip: text; color: transparent; }
.wm-1 span { background-image: linear-gradient(180deg, #ffffff 0%, #ffffff 55%, #d9d2f5 100%); }
.wm-2 span { background-image: linear-gradient(180deg, #f5b4ff 0%, #c65cff 45%, #8a1fe6 100%); }
/* لمعة تمر على الكلام */
.wm-1 span::after, .wm-2 span::after { content: attr(data-x); }
.wm-1 span, .wm-2 span { background-size: 100% 100%; }
.wordmark .wm-1 span { animation: none; }
.wm-shine { display: none; }
.wm-swoosh { width: 74%; margin: calc(var(--wm) * .015) auto 0; height: calc(var(--wm) * .07); }
.wm-swoosh svg { width: 100%; height: 100%; display: block; }
.wm-swoosh path:last-child { stroke-dasharray: 320; animation: swoosh 1s .9s ease-out both; }
@keyframes swoosh { from { stroke-dashoffset: 320; } }
.wordmark.intro .wm-crown { animation: crown-in .8s .55s cubic-bezier(.3, 1.6, .5, 1) both, crown 3s 1.4s ease-in-out infinite; }
.wordmark.intro .wm-1 { animation: rise .7s .1s cubic-bezier(.3, 1.5, .5, 1) both; }
.wordmark.intro .wm-2 { animation: rise .7s .3s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes crown-in { from { transform: translateX(-30%) translateY(-80%) rotate(-40deg) scale(.3); opacity: 0; } }
.wordmark:not(.intro) .wm-swoosh path:last-child { animation: none; }
.wm-sparkles { position: absolute; inset: 0; pointer-events: none; }
.wm-sparkles i { position: absolute; width: calc(var(--wm) * .07); height: calc(var(--wm) * .07); animation: twinkle 2.2s ease-in-out infinite; }
.wm-sparkles i.star { background: #ffd23d; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); filter: drop-shadow(0 0 6px #ffd23d); }
.wm-sparkles i.heart { background: #ff4d6d; clip-path: polygon(50% 100%, 0 40%, 10% 10%, 30% 0, 50% 18%, 70% 0, 90% 10%, 100% 40%); }
.wm-sparkles i.dot { background: #9b6bff; border-radius: 3px; width: calc(var(--wm) * .045); height: calc(var(--wm) * .045); }
.tv-logo .wordmark { margin: 0; }

/* ===== الشعار (نفس اللوجو بدون المربع) مع الحركات ===== */
.logo-art { position: relative; width: var(--wm); margin: 0 auto; aspect-ratio: 760 / 710; }
.logo-float { position: relative; width: 100%; height: 100%; animation: logo-bob 4s ease-in-out infinite; transform-origin: 50% 60%; }
.logo-float img { width: 100%; height: 100%; display: block; filter: drop-shadow(0 14px 30px #8b3dff66); -webkit-user-drag: none; }
.logo-shine { position: absolute; inset: 0; pointer-events: none; -webkit-mask: url(/icons/logo.webp) center / 100% 100% no-repeat; mask: url(/icons/logo.webp) center / 100% 100% no-repeat;
  background: linear-gradient(110deg, transparent 40%, #ffffffb0 50%, transparent 60%) no-repeat; background-size: 300% 100%; animation: sweep 4.5s ease-in-out infinite; mix-blend-mode: overlay; }
@keyframes logo-bob { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-5px) rotate(-1.2deg); } 75% { transform: translateY(-3px) rotate(1.2deg); } }
.logo-art.intro .logo-float { animation: logo-in .9s cubic-bezier(.3, 1.55, .5, 1) both, logo-bob 4s .9s ease-in-out infinite; }
@keyframes logo-in { 0% { transform: scale(.2) rotate(-12deg); opacity: 0; } 60% { opacity: 1; } }
.tv-logo .logo-art { margin: 0; }

/* ===== شاشة المقدّم المبسطة ===== */
.host-top { background: #160f3df2; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); margin: 0 -12px; padding-left: 12px; padding-right: 12px; border-bottom: 1px solid var(--line); }
.help-btn { font-family: var(--body); font-weight: 800; font-size: 15px; color: var(--gold2); width: auto !important; padding: 0 12px !important; }
.q-card .h-question { font-size: 21px; }
.step-card { border-color: #ffffff2a; background: linear-gradient(180deg, #2a1f6e, #1d1550); }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step-n { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; font-family: var(--display); font-size: 24px; background: var(--gold); color: #2a1a00; }
.step-t { font-family: var(--display); font-size: 25px; line-height: 1.3; }
.step-d { color: #d4ccf5; line-height: 1.7; margin-top: 2px; }
.step.steal .step-t { color: #ff8a95; }
.howto { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.howto span { background: #00000033; border-radius: 12px; padding: 8px 10px; font-size: 14px; font-weight: 700; text-align: center; }
details.more { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 0 14px; }
details.more summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 14px 0; font-weight: 800; color: var(--muted); cursor: pointer; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary { color: var(--text); }
.more-body { display: grid; gap: 8px; padding-bottom: 14px; }
.dock > div { grid-template-columns: 1fr 1.6fr; }
.help p { line-height: 1.9; margin: 0 0 10px; }
