:root {
  /* identity "حوسة": violet stage, lime + pink accents, thick ink outlines with solid shadows */
  --bg: #3524C9;
  --bg2: #2A1CA8;
  --card: #2A1CA8;
  --ink: #14105A;
  --line: #14105A;
  --soft: #4A3BD8;
  --text: #ffffff;
  --muted: #D7D2FF;
  --gold: #C6F432;      /* main accent (lime) */
  --gold2: #D9FF6B;     /* highlight text */
  --pink: #FF4FA3;
  --good: #C6F432;
  --bad: #FF4FA3;
  --blue: #7FE7FF;
  --radius: 18px;
  --bw: 3px;
  --shadow: 4px 4px 0 var(--ink);
  --display: 'Marhey', 'Readex Pro', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.07) 1.5px, transparent 0) 0 0 / 28px 28px,
    var(--bg);
  color: var(--text);
  font-family: 'Readex Pro', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
#app { min-height: 100dvh; display: flex; flex-direction: column; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--gold2); }

.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 24px 16px 40px; }
.wrap.wide { max-width: 1280px; }

.logo { font-weight: 900; font-size: 44px; letter-spacing: 0; margin: 8px 0 0; line-height: 1.1; }
.logo span { color: var(--gold); }
.sub { color: var(--muted); margin: 4px 0 24px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card h3 { margin: 0 0 6px; font-size: 20px; }
.card p { margin: 0; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px;
  padding: 14px 20px; font-weight: 800; font-size: 18px; cursor: pointer; background: var(--line); transition: transform .08s, filter .15s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #241500; }
.btn.good { background: var(--good); color: #002414; }
.btn.bad { background: var(--bad); color: #2a0006; }
.btn.blue { background: var(--blue); color: #001634; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn.big { font-size: 24px; padding: 18px 26px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1; }
.stack > * + * { margin-top: 10px; }

label { display: block; font-weight: 600; margin: 12px 0 6px; }
input:not([type=checkbox]):not([type=radio]), select {
  width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); font-size: 18px; outline: none;
}
input:focus { border-color: var(--gold); }
.hint { color: var(--muted); font-size: 14px; margin-top: 4px; }

.choice { display: block; width: 100%; text-align: right; background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px; cursor: pointer; margin-bottom: 12px; }
.choice:hover { border-color: var(--gold); }
.choice .t { font-size: 22px; font-weight: 800; }
.choice .d { color: var(--muted); margin-top: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--bg2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; display: inline-flex; gap: 8px; align-items: center; }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: 18px; line-height: 1; }
.chip.off { opacity: .5; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid3 .h { color: var(--muted); font-size: 14px; text-align: center; }
.grid3 input, .grid3 select { text-align: center; padding: 10px 6px; }

/* ---------- TV ---------- */
.tv { min-height: 100dvh; display: flex; flex-direction: column; padding: 2.2vmin 3vmin; gap: 2vmin; }
.tv .top { display: flex; justify-content: space-between; align-items: center; gap: 2vmin; color: var(--muted); font-size: clamp(14px, 2.2vmin, 26px); }
.tv .top b { color: var(--text); }
.tv .center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 3vmin; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 15vmin; height: 15vmin; padding: 0 3vmin; border-radius: 999px;
  background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #241500; font-weight: 900; font-size: 9vmin; box-shadow: 0 0 60px rgba(245,184,61,.35); }
.badge.sm { min-width: 0; height: auto; font-size: clamp(16px, 2.6vmin, 30px); padding: .3em 1em; box-shadow: none; }
.who { font-size: clamp(22px, 4.6vmin, 64px); font-weight: 900; }
.who .pass { color: var(--bad); display: block; font-size: .55em; }
.qtext { font-size: clamp(24px, 5.2vmin, 76px); font-weight: 800; line-height: 1.35; max-width: 92%; }
.answer { font-size: clamp(30px, 7vmin, 100px); font-weight: 900; color: var(--gold2); }
.result { font-size: clamp(22px, 4vmin, 56px); font-weight: 900; }
.result.good { color: var(--good); }
.result.bad { color: var(--bad); }
.typed { color: var(--muted); font-size: clamp(16px, 2.6vmin, 32px); }
.typed s { color: var(--bad); }
.typed b { color: var(--good); }
.pts { color: var(--muted); font-size: clamp(14px, 2.4vmin, 28px); }
.hintbox { font-size: clamp(20px, 3.4vmin, 44px); color: var(--blue); font-weight: 800; }

.timer { --p: 1; width: 16vmin; height: 16vmin; border-radius: 50%; display: grid; place-items: center; font-size: 6.5vmin; font-weight: 900;
  background: conic-gradient(var(--gold) calc(var(--p) * 360deg), var(--line) 0); position: relative; }
.timer::before { content: ''; position: absolute; inset: 1.2vmin; border-radius: 50%; background: var(--bg); }
.timer span { position: relative; }
.timer.low { background: conic-gradient(var(--bad) calc(var(--p) * 360deg), var(--line) 0); }
.timer.idle span { font-size: 3vmin; color: var(--muted); }

.controls { display: flex; gap: 1.6vmin; justify-content: center; flex-wrap: wrap; }
.controls .btn { font-size: clamp(16px, 2.6vmin, 30px); padding: 1.6vmin 3.4vmin; min-width: 18vmin; }

.intro h1 { font-size: clamp(36px, 9vmin, 130px); margin: 0; font-weight: 900; color: var(--gold2); }
.intro p { font-size: clamp(18px, 3.4vmin, 44px); max-width: 80%; margin: 0 auto; line-height: 1.6; }

.board { width: min(900px, 94%); }
.board .r { display: grid; grid-template-columns: 7vmin 1fr 14vmin 14vmin; align-items: center; gap: 2vmin; padding: 1.6vmin 2.4vmin;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 1.2vmin; font-size: clamp(18px, 3.4vmin, 44px);
  opacity: 0; transform: translateY(14px); animation: rise .5s forwards; }
.board .r.first { border-color: var(--gold); box-shadow: 0 0 40px rgba(245,184,61,.25); }
.board .r .n { color: var(--muted); font-weight: 900; }
.board .r .nm { font-weight: 800; text-align: right; }
.board .r .p { color: var(--muted); font-size: .7em; }
.board .r .t { font-weight: 900; color: var(--gold2); }
.board .head { background: none; border: 0; color: var(--muted); font-size: clamp(12px, 2vmin, 22px); animation: none; opacity: 1; transform: none; padding-block: 0; }
@keyframes rise { to { opacity: 1; transform: none; } }

.lobby { display: grid; grid-template-columns: auto 1fr; gap: 5vmin; align-items: center; width: min(1200px, 96%); }
.qr { background: #fff; border-radius: 20px; padding: 2vmin; width: 42vmin; height: 42vmin; }
.qr img { width: 100%; height: 100%; display: block; }
.code { font-size: clamp(36px, 9vmin, 120px); font-weight: 900; letter-spacing: .1em; color: var(--gold2); direction: ltr; }
.joinurl { color: var(--muted); direction: ltr; font-size: clamp(14px, 2.4vmin, 28px); word-break: break-all; }
.lobby .chips .chip { font-size: clamp(16px, 2.8vmin, 34px); padding: .3em .9em; }
.winner { font-size: clamp(40px, 10vmin, 150px); font-weight: 900; color: var(--gold2); }
.confetti { font-size: 10vmin; }

.judgeqr { position: fixed; bottom: 2vmin; left: 2vmin; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); max-width: 300px; }
.judgeqr img { width: 84px; height: 84px; background: #fff; border-radius: 8px; padding: 4px; }

/* ---------- phone player ---------- */
.phone { display: flex; flex-direction: column; min-height: 100dvh; padding: 16px; gap: 14px; }
.phone .bar { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.phone .main { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; text-align: center; }
.phone .qtext { font-size: 22px; max-width: none; }
.phone .who { font-size: 26px; }
.phone .answer { font-size: 36px; }
.phone .result { font-size: 26px; }
.phone .timer { width: 84px; height: 84px; font-size: 30px; margin: 0 auto; }
.phone .timer::before { inset: 7px; }
.phone .badge { min-width: 72px; height: 72px; font-size: 40px; margin: 0 auto; }
.phone .badge.sm { height: auto; font-size: 16px; }
.phone .board .r { grid-template-columns: 28px 1fr 56px 56px; font-size: 18px; padding: 10px 12px; }
.phone .board { width: 100%; }
.myturn { border: 2px solid var(--gold); border-radius: var(--radius); padding: 14px; background: var(--card); }
.myturn input { font-size: 22px; text-align: center; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #000c; padding: 10px 18px; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 9; }
#toast.show { opacity: 1; }

@media (max-width: 760px) {
  .lobby { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .qr { width: 60vw; height: 60vw; }
  .judgeqr { display: none; }
}

.grid3.auto { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid3.auto .h { text-align: right; }
.grid3.auto input { text-align: right; }
table td, table th { padding: 8px 6px; }
.controls.small .btn { font-size: clamp(13px, 1.8vmin, 20px); padding: 1vmin 2.4vmin; min-width: 0; opacity: .8; }
details.card summary { cursor: pointer; font-weight: 700; }

/* ---------- identity "حوسة": outlines, solid shadows, display font ---------- */
.logo, .badge, .winner, .code, .intro h1, .timer span, .board .r .t, .board .r .n, .pod-pts, .pod-block span, .round-no, .answer { font-family: var(--display); font-weight: 700; }
.logo { font-size: 48px; }
.logo span, .logo b { color: var(--gold); }
.brand { display: flex; align-items: center; gap: 14px; }
.brand img { width: 56px; height: 56px; }
.card, .choice, .board .r:not(.head), .award, .judgeqr, .pod-block, .myturn { border: var(--bw) solid var(--ink); box-shadow: var(--shadow); }
.choice { transition: transform .1s, box-shadow .1s; }
.choice:hover { border-color: var(--ink); transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.choice .t { display: flex; align-items: center; gap: 10px; }
.btn { border: var(--bw) solid var(--ink); box-shadow: var(--shadow); color: var(--ink); background: #fff; font-weight: 700; transition: transform .08s, box-shadow .08s; }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.gold { background: var(--gold); color: var(--ink); }
.btn.good { background: var(--good); color: var(--ink); }
.btn.bad { background: var(--pink); color: var(--ink); }
.btn.blue { background: var(--blue); color: var(--ink); }
.btn.ghost { background: var(--soft); color: #fff; border-color: var(--ink); }
input:not([type=checkbox]):not([type=radio]), select { border: var(--bw) solid var(--ink); background: #fff; color: var(--ink); }
input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold); }
input::placeholder { color: #6e68a8; }
select option { color: var(--ink); }
.chip { background: #fff; color: var(--ink); border: 2px solid var(--ink); font-weight: 600; }
.chip button { color: var(--ink); }
a { color: var(--gold); }
.hint { color: var(--muted); }

.badge { background: var(--gold); color: var(--ink); border: 4px solid var(--ink); border-radius: 26%; box-shadow: 6px 6px 0 var(--ink); transform: rotate(-5deg); }
.badge.sm { border-radius: 999px; transform: none; border-width: 3px; box-shadow: var(--shadow); font-family: 'Readex Pro', sans-serif; }
.tv .badge:not(.sm) { animation: none; }
.timer { background: conic-gradient(var(--pink) calc(var(--p) * 360deg), var(--ink) 0); border: 4px solid var(--ink); }
.timer::before { background: #fff; }
.timer span { color: var(--ink); }
.timer.low { background: conic-gradient(var(--pink) calc(var(--p) * 360deg), #fff 0); }
.timer.idle span { color: var(--ink); opacity: .6; }
.who { color: var(--gold); }
.who .pass { color: var(--pink); }
.answer { color: var(--gold); }
.result.good { color: var(--gold); }
.result.bad { color: var(--pink); }
.typed b { color: var(--gold); }
.typed s { color: var(--pink); }
.hintbox { color: var(--ink); background: var(--blue); border: 3px solid var(--ink); border-radius: 14px; padding: .2em .8em; box-shadow: var(--shadow); }
.qr { border: 4px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.code { color: var(--gold); }
.board .r.first { background: var(--gold); color: var(--ink); border-color: var(--ink); box-shadow: 6px 6px 0 var(--ink); }
.board .r.first .n, .board .r.first .p, .board .r.first .t { color: var(--ink); }
.board .r .t { color: var(--gold); }
.myturn { border-color: var(--ink); background: var(--gold); color: var(--ink); }
.myturn .who { color: var(--ink) !important; }
.myturn .pts { color: var(--ink); }
#toast { background: var(--ink); color: #fff; border: 2px solid var(--gold); }
.intro h1 { color: var(--gold); }
.intro.anim .round-no { color: #fff; opacity: .12; }
.final .crown { color: var(--gold); filter: drop-shadow(5px 5px 0 var(--ink)); }
.final .winner { color: var(--gold); text-shadow: 5px 5px 0 var(--ink); }
.pod1 .pod-block { background: var(--gold); border: var(--bw) solid var(--ink); }
.pod1 .pod-block span { color: var(--ink); }
.pod2 .pod-block { background: #fff; }
.pod2 .pod-block span { color: var(--ink); }
.pod3 .pod-block { background: var(--pink); }
.pod3 .pod-block span { color: var(--ink); }
.pod-pts { color: var(--gold); }
.aw-ic { background: var(--gold); color: var(--ink); border: 3px solid var(--ink); }
.aw-v { color: var(--gold); }
.mute { width: 48px; height: 48px; }
.tv .badge.key3 { border-radius: 999px; padding: 0 3vmin; }

/* ---------- motion, sound toggle, celebration ---------- */
.fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 50; }
.mute { position: fixed; top: 1.6vmin; left: 1.6vmin; width: 48px; height: 48px; padding: 0; z-index: 10; opacity: .7; }
.mute:hover { opacity: 1; }
.mute svg { width: 24px; height: 24px; }

@keyframes pop { 0% { transform: scale(.3) rotate(-12deg); opacity: 0; } 60% { transform: scale(1.12) rotate(3deg); opacity: 1; } 100% { transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fadeOut { to { opacity: 0; transform: scale(.9); visibility: hidden; } }
@keyframes pulse { 50% { transform: scale(1.06); } }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes glow { 50% { box-shadow: 0 0 90px rgba(245,184,61,.6); } }

.tv.fresh .badge { animation: pop .55s cubic-bezier(.2,1.4,.4,1) both; }
.tv.fresh .who { animation: fadeUp .4s .15s both; }
.tv.fresh .qtext { animation: fadeUp .5s .25s both; }
.tv .badge:not(.sm) { animation: glow 2.4s ease-in-out infinite; }
.tv.fresh .badge:not(.sm) { animation: pop .55s cubic-bezier(.2,1.4,.4,1) both, glow 2.4s .6s ease-in-out infinite; }
.timer.low { animation: pulse .5s ease-in-out infinite; }
.who .pass { animation: shake .45s both; }
.phase-reveal .result { animation: pop .5s cubic-bezier(.2,1.4,.4,1) both; }
.phase-reveal .result.bad { animation: shake .45s both; }
.phase-reveal .answer { animation: fadeUp .45s .2s both; }
.hintbox { animation: fadeUp .4s both; }

.intro.anim .round-no { font-size: clamp(90px, 26vmin, 340px); font-weight: 900; line-height: .9; color: var(--gold); opacity: .18; position: absolute; animation: pop .7s both; pointer-events: none; }
.intro.anim { position: relative; }
.intro.anim .badge { animation: fadeUp .4s .3s both; }
.intro.anim h1 { animation: pop .6s .55s cubic-bezier(.2,1.4,.4,1) both; }
.intro.anim p { animation: fadeUp .5s 1.1s both; }
.intro.anim .btn { animation: fadeUp .4s 1.5s both; }

/* final screen: drumroll, champion, podium, awards */
.final { display: flex; flex-direction: column; align-items: center; gap: 2.2vmin; width: 100%; position: relative; }
.final .drum { position: absolute; top: 30%; font-size: clamp(30px, 7vmin, 100px); font-weight: 900; color: var(--muted); animation: pulse .35s ease-in-out 5, fadeOut .3s 1.7s forwards; }
.final .champ { display: flex; flex-direction: column; align-items: center; animation: pop .8s 1.9s cubic-bezier(.2,1.4,.4,1) both; }
.final .crown { color: var(--gold); width: clamp(48px, 11vmin, 150px); filter: drop-shadow(0 0 30px rgba(245,184,61,.6)); animation: pulse 1.6s 2.8s ease-in-out infinite; }
.final .crown svg { width: 100%; height: auto; display: block; }
.final .winner { line-height: 1.1; text-shadow: 0 0 40px rgba(245,184,61,.45); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 1.6vmin; width: min(820px, 94%); }
.pod { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .6vmin; animation: fadeUp .6s var(--d) both; min-width: 0; }
.pod-name { font-weight: 800; font-size: clamp(16px, 3vmin, 40px); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-pts { font-weight: 900; color: var(--gold2); font-size: clamp(16px, 3.4vmin, 46px); }
.pod-block { width: 100%; border-radius: 14px 14px 4px 4px; background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; transform-origin: bottom; animation: grow .7s var(--d) cubic-bezier(.2,1.2,.4,1) both; }
.pod-block span { font-size: clamp(24px, 6vmin, 80px); font-weight: 900; color: var(--muted); }
.pod1 .pod-block { height: 20vmin; background: linear-gradient(180deg, var(--gold2), var(--gold)); border: 0; }
.pod1 .pod-block span { color: #241500; }
.pod2 .pod-block { height: 14vmin; }
.pod3 .pod-block { height: 10vmin; }
@keyframes grow { from { transform: scaleY(0); } to { transform: none; } }
.final .rest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; animation: fadeUp .5s 3.4s both; font-size: clamp(14px, 2.2vmin, 28px); }
.awards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 1.4vmin; width: min(1100px, 96%); }
.award { display: flex; gap: 1.4vmin; align-items: center; text-align: right; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 1.4vmin 1.8vmin; animation: fadeUp .5s var(--d) both; }
.aw-ic { flex: 0 0 auto; width: clamp(36px, 6vmin, 72px); height: clamp(36px, 6vmin, 72px); border-radius: 50%; display: grid; place-items: center; background: var(--bg2); color: var(--gold); }
.aw-ic svg { width: 58%; height: 58%; }
.aw-t { color: var(--muted); font-size: clamp(12px, 1.8vmin, 22px); font-weight: 700; }
.aw-who { font-weight: 900; font-size: clamp(16px, 2.8vmin, 36px); line-height: 1.2; }
.aw-v { color: var(--gold2); font-size: clamp(12px, 1.9vmin, 24px); font-weight: 700; }

.final.is-phone .drum { top: 10%; font-size: 30px; }
.final.is-phone .winner { font-size: 40px; }
.final.is-phone .podium { width: 100%; gap: 8px; }
.final.is-phone .pod-name { font-size: 15px; }
.final.is-phone .pod-pts { font-size: 18px; }
.final.is-phone .pod1 .pod-block { height: 90px; }
.final.is-phone .pod2 .pod-block { height: 64px; }
.final.is-phone .pod3 .pod-block { height: 46px; }
.final.is-phone .pod-block span { font-size: 28px; }
.final.is-phone .awards { gap: 8px; }
.final.is-phone .award { padding: 10px 12px; gap: 10px; }
.myrank { font-size: 18px; color: var(--muted); animation: fadeUp .4s 2.4s both; }
.myrank b { color: var(--gold2); font-size: 1.3em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
  .final .drum { display: none; }
}

/* brand lockup + icon tiles */
.brand { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.brand img { width: 64px; height: 64px; border-radius: 16px; }
.brand .logo { margin: 0; }
.brand.sm img { width: 44px; height: 44px; border-radius: 12px; }
.brand.sm .logo { font-size: 32px; }
.ic { width: 40px; height: 40px; border-radius: 12px; border: 2.5px solid var(--ink); color: var(--ink); display: inline-grid; place-items: center; flex: 0 0 auto; }
.ic svg { width: 22px; height: 22px; }
.intro-icon { width: clamp(90px, 20vmin, 260px); border-radius: 22%; animation: pop .7s cubic-bezier(.2,1.4,.4,1) both; }
.intro h1 { text-shadow: 6px 6px 0 var(--ink); }
.btn { text-decoration: none; }
.final .winner { margin-bottom: .15em; }

/* ---------- light, calm version of "حوسة" (cream background, soft pastel fills, same outlines) ---------- */
:root {
  --bg: #FBF8F2;        /* off-white */
  --bg2: #FFFFFF;
  --card: #FFFFFF;
  --ink: #2B2350;
  --line: #2B2350;
  --soft: #EDE6F7;
  --text: #2B2350;
  --muted: #6B6489;
  --gold: #D4EC7A;      /* soft lime fill */
  --gold2: #5B4BD6;     /* accent text (violet) */
  --pink: #F7A8C4;
  --good: #D4EC7A;
  --bad: #F7A8C4;
  --blue: #A8DDF0;
  --violet: #5B4BD6;
  --bw: 2.5px;
  --shadow: 3px 3px 0 var(--ink);
}
body { background: radial-gradient(circle at 1px 1px, rgba(43,35,80,.06) 1.5px, transparent 0) 0 0 / 28px 28px, var(--bg); }
.logo span, .logo b, a, .code, .who, .answer, .result.good, .typed b, .board .r .t, .pod-pts, .aw-v, .intro h1, .final .winner, .final .crown, .myrank b { color: var(--violet); }
.result.bad, .who .pass, .typed s { color: #C2185B; }
.intro h1 { text-shadow: 4px 4px 0 var(--gold); }
.final .winner { text-shadow: 4px 4px 0 var(--gold); }
.final .crown { filter: drop-shadow(3px 3px 0 var(--gold)); }
.btn.ghost { background: var(--soft); color: var(--ink); }
.choice, .card, .award, .judgeqr { background: var(--card); }
.timer { background: conic-gradient(var(--violet) calc(var(--p) * 360deg), var(--soft) 0); border-color: var(--ink); }
.timer.low { background: conic-gradient(#E0457B calc(var(--p) * 360deg), var(--soft) 0); }
.badge { box-shadow: 4px 4px 0 var(--ink); }
.board .r.first .t, .board .r.first .n, .board .r.first .p { color: var(--ink); }
.aw-ic { background: var(--gold); color: var(--ink); border: 2px solid var(--ink); }
.intro.anim .round-no { color: var(--violet); opacity: .1; }
.myturn { background: var(--gold); }
#toast { background: var(--ink); color: #fff; }
.mute { color: var(--ink); }
.pod1 .pod-block { background: var(--gold); }
.badge, .btn.gold { background: var(--gold); }

/* wordmark: «ألف» in ink, «بائية» in violet, so it never reads as one word */
.intro h1 { color: var(--ink); }
.intro h1 span { color: var(--violet); }
.intro-icon { height: auto; }

/* =====================================================================
   Site chrome and responsive layout (phone, foldables, tablet, desktop, TV)
   ===================================================================== */
#app { min-height: 100dvh; display: flex; flex-direction: column; }
main.wrap { flex: 1 0 auto; }
.wrap { padding: 20px 16px 40px; }
.wrap.md { max-width: 760px; }
.wrap.lg { max-width: 1080px; }
@media (min-width: 768px) { .wrap { padding: 32px 28px 56px; } }

/* header */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(251, 248, 242, .9); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1.5px solid rgba(43, 35, 80, .12); padding-top: env(safe-area-inset-top); }
.tb-in { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
@media (min-width: 768px) { .tb-in { padding: 12px 28px; } }
.tb-side { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.tb-brand img { width: 38px; height: 38px; border-radius: 10px; flex: 0 0 auto; }
.tb-brand .logo { font-size: 24px; margin: 0; white-space: nowrap; }
.iconbtn, .pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; min-width: 42px; padding: 0 12px;
  border-radius: 12px; border: 2px solid var(--ink); background: #fff; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px;
  cursor: pointer; box-shadow: 2px 2px 0 var(--ink); transition: transform .08s, box-shadow .08s; font-family: inherit; }
.iconbtn:active, .pill:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.pill { background: var(--gold); }
.pill b { font-family: var(--display); font-size: 19px; line-height: 1; }
.i { width: 20px; height: 20px; flex: 0 0 auto; }
.lbl { white-space: nowrap; }
@media (max-width: 640px) {
  .tb-side .lbl { display: none; }
  .tb-in { padding: 8px 12px; }
  .tb-brand .logo { font-size: 21px; }
  .tb-brand img { width: 34px; height: 34px; }
  .iconbtn, .pill { height: 40px; min-width: 40px; padding: 0 9px; }
}
@media (max-width: 340px) { .tb-brand .logo { display: none; } }

/* page titles */
.phead { display: flex; align-items: center; gap: 12px; margin: 4px 0 20px; flex-wrap: wrap; }
.phead h2, .ptitle { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(26px, 4vw, 36px); line-height: 1.2; }
.ptitle { margin: 4px 0 20px; }
.phead .ic { width: 50px; height: 50px; border-radius: 14px; }
.phead .ic svg { width: 26px; height: 26px; }
.card h3 { display: flex; align-items: center; gap: 8px; }
.card h3 .i { color: var(--violet); }

/* footer */
.site-foot { margin-top: auto; border-top: 1.5px solid rgba(43, 35, 80, .12); background: #fff; }
.sf-in { max-width: 1080px; margin: 0 auto; padding: 22px 16px calc(22px + env(safe-area-inset-bottom)); display: grid; gap: 12px; justify-items: center; text-align: center; }
.sf-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.sf-brand img { width: 28px; height: 28px; border-radius: 8px; }
.sf-brand .logo { font-size: 18px; margin: 0; }
.sf-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; }
.sf-links a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.sf-copy { margin: 0; color: var(--muted); font-size: 12.5px; opacity: .85; }
@media (min-width: 900px) { .sf-in { grid-template-columns: auto 1fr auto; align-items: center; padding-inline: 28px; } }

/* home */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 22px; }
.eyebrow { margin: 0; color: var(--muted); font-weight: 600; }
.hero h2 { margin: 2px 0 4px; font-family: var(--display); font-weight: 700; font-size: clamp(30px, 5vw, 46px); line-height: 1.15; }
.hero .sub { margin: 0; }
.notice { display: flex; gap: 10px; align-items: center; background: #fff; border: 2px dashed var(--violet); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; }
.notice p { margin: 0; }
.notice .i { color: var(--violet); }
.modes { display: grid; gap: 16px; margin-bottom: 16px; }
@media (min-width: 640px) { .modes { grid-template-columns: 1fr 1fr; } }
.mode { text-align: start; background: #fff; border: var(--bw) solid var(--ink); border-radius: 22px; box-shadow: 4px 4px 0 var(--ink); padding: 22px;
  cursor: pointer; display: flex; flex-direction: column; gap: 8px; color: var(--ink); transition: transform .1s, box-shadow .1s; }
@media (min-width: 640px) { .mode { min-height: 230px; padding: 26px; } }
.mode .ic { width: 58px; height: 58px; border-radius: 16px; }
.mode .ic svg { width: 30px; height: 30px; }
.mode .t { font-family: var(--display); font-size: clamp(22px, 3vw, 30px); font-weight: 700; margin-top: 6px; }
.mode .d { color: var(--muted); line-height: 1.6; }
.mode .go { margin-top: auto; align-self: flex-end; display: inline-flex; gap: 6px; align-items: center; font-weight: 700; color: var(--violet); padding-top: 6px; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.tile { display: flex; gap: 12px; align-items: center; text-align: start; background: #fff; border: 2px solid var(--ink); border-radius: 16px; padding: 14px;
  cursor: pointer; color: var(--ink); box-shadow: 2px 2px 0 var(--ink); transition: transform .1s, box-shadow .1s; }
.tile .t { font-weight: 700; font-size: 17px; }
.tile .d { color: var(--muted); font-size: 14px; margin-top: 2px; }
.bank { text-align: center; margin-top: 22px; }
.mode:active, .tile:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
@media (hover: hover) {
  .iconbtn:hover, .pill:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
  .mode:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
  .tile:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
  .sf-links a:hover { color: var(--violet); }
}

/* sign-in landing */
.auth { display: grid; gap: 22px; }
.hero-title { font-family: var(--display); font-weight: 700; font-size: clamp(28px, 5vw, 50px); line-height: 1.3; margin: 4px 0 0; }
.hero-title span { color: var(--violet); }
.auth-hero .lead { font-size: 18px; color: var(--muted); line-height: 1.7; margin: 10px 0 16px; }
.feats { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 12px; }
.feats li { display: flex; gap: 12px; align-items: center; color: var(--muted); }
.feats b { display: block; color: var(--ink); }
@media (max-width: 899px) { .feats { display: none; } }
@media (min-width: 900px) {
  .auth { grid-template-columns: 1.1fr 1fr; align-items: center; gap: 64px; min-height: calc(100dvh - 230px); }
  .auth-form { max-width: 460px; width: 100%; justify-self: end; }
}

/* game setup */
.setup-grid { display: grid; gap: 16px; align-items: start; }
.setup-grid .card { margin: 0; }
@media (min-width: 900px) { .setup-grid { grid-template-columns: 1fr 1.25fr; } }
#go.big { margin-top: 18px; }
@media (min-width: 900px) { .wrap.lg > #go.big, .how > .btn.big { max-width: 440px; margin-inline: auto; display: flex; } }
.rset { border-top: 1.5px solid rgba(43, 35, 80, .12); padding: 12px 0; display: grid; gap: 10px; }
.card h3 + .rset { border-top: 0; }
.rtoggle { display: flex; gap: 10px; align-items: center; margin: 0; cursor: pointer; }
.rtoggle input { width: 22px; height: 22px; accent-color: var(--violet); flex: 0 0 auto; }
.rtoggle b { display: block; font-size: 17px; }
.rtoggle small { color: var(--muted); font-weight: 400; font-size: 13px; }
.rfields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; transition: opacity .15s; }
.rfields label { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; display: grid; gap: 4px; }
.rfields select, .rfields input { padding: 10px !important; font-size: 17px !important; text-align: center; }
.rset:has(input[type=checkbox]:not(:checked)) .rfields { opacity: .4; }
.codein { font-size: 30px !important; text-align: center; letter-spacing: .3em; direction: ltr; font-family: var(--display); }

/* store */
.pkgs { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); margin: 6px 0 16px; }
.pkg { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; padding-top: 26px; }
.pkg-n { font-family: var(--display); font-size: 52px; line-height: 1; color: var(--violet); }
.pkg h3 { margin: 0; justify-content: center; }
.pkg-price { margin: 6px 0 12px; min-height: 54px; display: grid; align-content: center; }
.pkg .btn { margin-top: auto; }
.pkg-badge { position: absolute; top: -13px; background: var(--pink); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 12px; font-size: 13px; font-weight: 700; }

/* how to play */
.how-grid { display: grid; gap: 20px; margin-bottom: 22px; }
@media (min-width: 900px) { .how-grid { grid-template-columns: 1.45fr 1fr; align-items: start; } }
.video-card { border: var(--bw) solid var(--ink); border-radius: 20px; overflow: hidden; box-shadow: 4px 4px 0 var(--ink); background: #000; aspect-ratio: 16 / 9; }
.video-card video { width: 100%; height: 100%; display: block; }
.rules { display: grid; gap: 12px; }
.rule { display: flex; gap: 12px; align-items: flex-start; background: #fff; border: 2px solid var(--ink); border-radius: 16px; padding: 14px; }
.rule .num { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; border: 2px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-size: 20px; }
.rule h3 { margin: 0 0 4px; font-size: 18px; }
.rule p { margin: 0; color: var(--muted); line-height: 1.6; }

/* TV / mirrored screen: size by the smaller of width and height, so a phone mirrored
   to a TV (portrait or landscape) and a real TV both stay readable from the sofa */
.tv .qtext { font-size: clamp(24px, min(9.4vw, 6.6vh), 96px); max-width: 94%; }
.tv .timer.idle span { font-size: .8em; }
.tv .qtext.small { font-size: clamp(18px, min(5.6vw, 4.2vh), 58px); }
.tv .who { font-size: clamp(20px, min(6.4vw, 4.8vh), 66px); }
.tv .badge:not(.sm) { min-width: clamp(64px, min(24vw, 15vh), 170px); height: clamp(64px, min(24vw, 15vh), 170px); font-size: clamp(36px, min(14vw, 9vh), 104px); }
.tv .timer { width: clamp(72px, min(22vw, 15vh), 170px); height: clamp(72px, min(22vw, 15vh), 170px); font-size: clamp(24px, min(8vw, 6vh), 64px); }
.tv .timer::before { inset: clamp(6px, 1.2vmin, 14px); }
.tv .answer { font-size: clamp(28px, min(10vw, 7vh), 104px); }
.tv .answer.small { font-size: clamp(16px, min(5vw, 3.4vh), 44px); }
.tv .hintbox { font-size: clamp(18px, min(6vw, 3.6vh), 46px); }
.tv .pts { font-size: clamp(14px, min(4vw, 2.4vh), 28px); }
.tv .controls .btn { font-size: clamp(16px, min(4.6vw, 2.8vh), 30px); }
.tv .controls.small .btn { font-size: clamp(13px, min(3.4vw, 1.9vh), 20px); }
@media (max-height: 560px) { .judgeqr { display: none; } .tv { gap: 1vh; } .tv .center { gap: 1.6vh; } }
@media (orientation: portrait) and (max-width: 760px) { .tv .top { font-size: 13px; } .tv .center { gap: 18px; } }

@media (max-width: 639px) {
  .mode { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 2px; padding: 18px; align-items: center; }
  .mode .ic { grid-row: span 2; width: 52px; height: 52px; }
  .mode .t { margin: 0; font-size: 22px; }
  .mode .d { font-size: 14.5px; line-height: 1.5; }
  .mode .go { display: none; }
}

/* legal pages */
body.page { display: flex; flex-direction: column; min-height: 100dvh; }
body.page main { flex: 1 0 auto; }
.doc { background: #fff; border: var(--bw) solid var(--ink); border-radius: 22px; box-shadow: 4px 4px 0 var(--ink); padding: clamp(20px, 4vw, 44px); }
.doc h1 { font-family: var(--display); font-weight: 700; font-size: clamp(28px, 4.5vw, 40px); margin: 0 0 4px; }
.doc h2 { border-top: 1.5px solid rgba(43, 35, 80, .1); padding-top: 18px; }
.doc ul { padding-inline-start: 22px; }

/* ---------- categories + new setup page ---------- */
.setup-grid .col { display: grid; gap: 16px; align-content: start; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h3 { margin: 0; }
.btn.sm { padding: 8px 16px; font-size: 15px; box-shadow: 2px 2px 0 var(--ink); }
.catsum { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.catsum b { font-size: 17px; }
.catsum .hint { margin: 0; }
.minis { display: inline-flex; padding-inline-start: 8px; }
.mini { width: 38px; height: 38px; border-radius: 11px; border: 2px solid var(--ink); display: grid; place-items: center; margin-inline-start: -8px; color: var(--ink); }
.mini svg { width: 22px; height: 22px; }
.lens { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 10px; }
.len { display: grid; gap: 2px; justify-items: center; padding: 14px 6px; background: #fff; border: 2px solid var(--ink); border-radius: 16px; cursor: pointer; color: var(--ink); font-family: inherit; transition: transform .08s, box-shadow .08s; }
.len b { font-size: 19px; font-family: var(--display); font-weight: 700; }
.len span { color: var(--muted); font-size: 13px; }
.len strong { font-size: 14px; }
.len.on { background: var(--gold); box-shadow: 3px 3px 0 var(--ink); }
.len.on span { color: var(--ink); }
.adv summary { cursor: pointer; color: var(--violet); font-weight: 700; padding: 6px 0; list-style: none; }
.adv summary::-webkit-details-marker { display: none; }
.adv summary::after { content: ' ▾'; }
.adv[open] summary::after { content: ' ▴'; }
.adv .rset:first-of-type { border-top: 0; }
.create { max-width: 560px; margin: 20px auto 0; text-align: center; }
.create #go.big { margin-top: 0; }
.create .hint { margin-top: 10px; }
@media (min-width: 900px) { .setup-grid { grid-template-columns: 1fr 1.15fr; } }

/* picker */
.sheet-back { position: fixed; inset: 0; z-index: 60; background: rgba(43, 35, 80, .45); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeUp .2s both; }
.sheet { background: var(--bg); border: var(--bw) solid var(--ink); border-radius: 24px; box-shadow: 6px 6px 0 var(--ink); width: min(980px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 20px; }
.sheet-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sheet-head h3 { margin: 0; font-family: var(--display); font-size: 26px; }
.sheet-head .count { color: var(--violet); font-weight: 700; }
.sheet-head .pills { margin-inline-start: auto; display: flex; gap: 8px; }
.chipbtn { border: 2px solid var(--ink); border-radius: 999px; padding: 6px 14px; background: #fff; font-weight: 700; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); font-family: inherit; color: var(--ink); }
.chipbtn.on { background: var(--gold); }
.sheet > .hint { margin: 6px 0 14px; }
.sheet > .btn { margin-top: 18px; position: sticky; bottom: 0; }
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 12px; padding: 10px 6px 4px; }
@media (min-width: 600px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px) { .cat-grid { grid-template-columns: repeat(6, 1fr); } }
.cat { position: relative; display: grid; justify-items: center; gap: 8px; padding: 16px 6px 12px; background: #fff; border: 2.5px solid var(--ink); border-radius: 18px;
  box-shadow: 3px 3px 0 var(--ink); cursor: pointer; color: var(--ink); font-family: inherit; transition: transform .08s, box-shadow .08s; }
.cat:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.cat-ic { width: 62px; height: 62px; border-radius: 16px; border: 2.5px solid var(--ink); display: grid; place-items: center; transform: rotate(var(--tilt, -4deg)); color: var(--ink); }
.cat-ic svg { width: 36px; height: 36px; }
.cat .nm { font-weight: 700; font-size: 15px; line-height: 1.3; text-align: center; }
.cat .tick { position: absolute; top: -10px; left: -10px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--ink); background: var(--gold); display: grid; place-items: center; font-weight: 900; font-size: 15px; }
.cat.off { background: transparent; border: 2.5px dashed #B9B2CF; box-shadow: none; }
.cat.off .cat-ic { background: #F1EEF6 !important; filter: grayscale(1); opacity: .55; border-color: #B9B2CF; }
.cat.off .nm { color: #9A93B5; text-decoration: line-through; }
.cat.off .tick { background: #fff; border-color: #B9B2CF; color: #9A93B5; }
@media (max-width: 599px) {
  .sheet-back { align-items: flex-end; padding: 0; }
  .sheet { border-radius: 24px 24px 0 0; border-bottom: 0; box-shadow: none; max-height: 92dvh; padding: 18px 14px calc(16px + env(safe-area-inset-bottom)); }
  .cat-ic { width: 54px; height: 54px; }
  .cat-ic svg { width: 32px; height: 32px; }
  .cat .nm { font-size: 14px; }
}
@media (max-width: 380px) { .lens { gap: 6px; } .len b { font-size: 17px; } .len span { font-size: 12px; } }

/* end of game: play again */
.again { display: grid; gap: 10px; justify-items: center; animation: fadeUp .4s 4.8s both; }
.again-btns { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.again-btns .btn { min-width: min(260px, 80vw); }
.again .hint { margin: 0; text-align: center; }

/* ---------- optional rounds: السلسلة, المراهنة, أوله وتاليه ---------- */
.ri { width: 42px; height: 42px; border-radius: 12px; border: 2.3px solid var(--ink); background: #fff; display: inline-grid; place-items: center; flex: none; }
.ri svg { width: 28px; height: 28px; }
/* setup: slot picker */
.slot-row { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; margin-top: 12px; }
.slot-row .sl { font-weight: 700; font-size: 14px; }
.slot-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.slot-opts.one { grid-template-columns: 1fr; }
.ro { position: relative; border: 2.5px solid var(--ink); border-radius: 16px; background: #fff; padding: 10px 12px; display: flex; align-items: center; gap: 10px; text-align: right; font: inherit; color: var(--ink); cursor: pointer; transition: transform .08s, box-shadow .08s; }
.ro:hover { transform: translate(-1px, -1px); }
.ro.on { background: var(--gold); box-shadow: 3px 3px 0 var(--ink); }
.ro-t b { font-size: 15.5px; display: block; }
.ro-t span { font-size: 12px; color: #4A436B; line-height: 1.35; display: block; }
.ro .new, .new-pill { background: var(--pink); border: 2px solid var(--ink); border-radius: 999px; font-size: 10.5px; font-weight: 700; padding: 1px 8px; color: var(--ink); }
.ro .new { position: absolute; top: -10px; left: 10px; }
.ro .ok2 { position: absolute; top: -9px; right: -9px; width: 22px; height: 22px; border-radius: 50%; background: var(--violet); border: 2px solid var(--ink); display: grid; place-items: center; }
.ro .ok2 svg { width: 11px; height: 11px; }
@media (max-width: 599px) {
  .slot-row { grid-template-columns: 1fr; gap: 6px; }
  .ro { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px; }
}
/* rule cards */
.rcard { background: #fff; border: 2.5px solid var(--ink); border-radius: 18px; box-shadow: 3px 3px 0 var(--ink); padding: 16px; display: flex; flex-direction: column; gap: 10px; text-align: right; max-width: 640px; color: var(--ink); }
.rc-head { display: flex; gap: 12px; align-items: center; }
.rc-head h3 { margin: 0; font-family: var(--display); font-size: 1.4em; }
.rc-tag { color: var(--violet); font-weight: 700; }
.rcard ul { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 5px; line-height: 1.5; }
.tv .rcard { font-size: clamp(14px, 2.4vmin, 28px); }
.nr-intro h1 { margin: 0; }
.alt-rounds h3 { display: flex; gap: 8px; align-items: center; }
.alt-row { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.alt-row p { margin: 0; }
/* السلسلة */
.chainbar { display: flex; justify-content: space-between; align-items: center; gap: 2vmin; margin-top: 1vmin; flex-wrap: wrap; }
.chain { display: flex; align-items: center; flex-wrap: nowrap; justify-content: center; }
.chain.wrap { flex-wrap: wrap; row-gap: 8px; max-width: 92%; margin: 0 auto; }
.lnk { border: 2.5px solid var(--ink); border-radius: 999px; padding: .2em .75em; background: #fff; font-weight: 700; font-size: clamp(13px, 2vmin, 24px); white-space: nowrap; display: inline-flex; align-items: center; gap: .35em; color: var(--ink); }
.lnk i { font-style: normal; color: #fff; background: var(--violet); border-radius: 50%; width: 1.35em; height: 1.35em; display: inline-grid; place-items: center; font-size: .8em; line-height: 1; }
.lnk.gold { background: #FFD95A; box-shadow: 0 0 0 4px rgba(255,217,90,.45); }
.lnk.next { border-style: dashed; color: #9A93B5; background: transparent; }
.cnx { width: 14px; height: 9px; border: 2.5px solid var(--ink); border-radius: 999px; margin: 0 -3px; background: var(--bg); position: relative; z-index: 1; flex: none; }
.gc { display: flex; gap: 5px; align-items: center; font-size: clamp(12px, 1.8vmin, 22px); }
.gc b { margin-inline-end: 4px; }
.gc span { width: 1.1em; height: 1.1em; border-radius: 50%; border: 2.2px solid var(--ink); background: #fff; }
.gc span.on { background: #FFD95A; }
.ltr-wrap { display: inline-flex; align-items: flex-end; gap: 10px; }
.lt-l { color: var(--muted); font-size: clamp(12px, 1.8vmin, 22px); font-weight: 600; }
.ltr { width: clamp(64px, 20vmin, 148px); height: clamp(64px, 20vmin, 148px); border-radius: 22%; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); background: var(--gold); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: clamp(38px, 12vmin, 88px); color: var(--ink); line-height: 1; }
.ltr.sm { width: clamp(44px, 9vmin, 92px); height: clamp(44px, 9vmin, 92px); font-size: clamp(26px, 5.4vmin, 54px); box-shadow: 2px 2px 0 var(--ink); }
.ltr.white { background: #fff; }
.phone .ltr { width: 84px; height: 84px; font-size: 50px; }
.phone .ltr.sm { width: 50px; height: 50px; font-size: 28px; }
.jump { display: inline-block; background: #FFD95A; border: 2.5px solid var(--ink); border-radius: 999px; padding: .15em .8em; font-weight: 800; transform: rotate(-4deg); animation: pop .5s; }
.golden-banner { background: #FFD95A; border: 2.5px solid var(--ink); border-radius: 999px; padding: .3em 1.1em; font-weight: 800; box-shadow: 0 0 0 5px rgba(255,217,90,.45); animation: pop .6s; }
.broke { color: #C2185B; font-weight: 800; }
.nextl { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-weight: 600; }
.nextl .arr { font-size: 1.4em; }
.nextl .ltr:last-of-type { animation: hop .9s .4s both; }
@keyframes hop { 0% { transform: translateX(-60px) scale(.6); opacity: 0; } 60% { transform: translateY(-14px); opacity: 1; } 100% { transform: none; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.chain-end h2 { font-family: var(--display); margin: 0 0 12px; font-size: clamp(24px, 5vmin, 60px); }
.chain-end p { font-weight: 700; margin: 10px 0 0; }
.chain-end { margin-bottom: 2vmin; }
.phone .chain { justify-content: center; margin: 0 auto; }
/* المراهنة */
.fish { position: relative; width: clamp(48px, 11vmin, 110px); height: clamp(48px, 11vmin, 110px); border-radius: 50%; border: 3px solid var(--ink); display: inline-grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: clamp(20px, 4.6vmin, 46px); color: var(--ink); box-shadow: 2px 3px 0 var(--ink); padding: 0; cursor: default; flex: none; }
button.fish { cursor: pointer; transition: transform .1s; }
button.fish:hover { transform: translateY(-4px) rotate(-6deg); }
button.fish:active { transform: translateY(2px); }
.fish::before { content: ""; position: absolute; inset: 12%; border-radius: 50%; border: 2.5px dashed rgba(43,35,80,.45); pointer-events: none; }
.c1 { background: #A8DDF0; } .c2 { background: #D4EC7A; } .c3 { background: #F7A8C4; } .c4 { background: #FFD95A; } .c5 { background: #C9B8FF; }
.fish[data-big] { transform: scale(1.18); }
.chips-row { display: flex; gap: clamp(10px, 2vmin, 22px); justify-content: center; align-items: center; flex-wrap: wrap; }
.phone .chips-row.big .fish { width: 72px; height: 72px; font-size: 30px; }
.intro-chips .fish { animation: toss 1s calc(var(--i) * .15s) both; }
@keyframes toss { 0% { transform: translateY(40px) rotate(-90deg); opacity: 0; } 60% { transform: translateY(-20px) rotate(10deg); opacity: 1; } 100% { transform: none; } }
.fish.fly { animation: flyup 1.1s calc(var(--i, 0) * .1s) both; }
@keyframes flyup { 0% { transform: translateY(30px) scale(.6); opacity: 0; } 70% { transform: translateY(-16px) scale(1.05); opacity: 1; } 100% { transform: none; } }
.fish.fall { animation: falldown 1.2s calc(var(--i, 0) * .12s) both; }
@keyframes falldown { 0% { transform: none; } 100% { transform: translateY(14px) rotate(-24deg); filter: grayscale(.4); opacity: .75; } }
.fstack { display: inline-flex; flex-direction: column-reverse; align-items: center; }
.fstack .s { width: 44px; height: 11px; border-radius: 50%; border: 2.3px solid var(--ink); margin-top: -5px; }
.catpill { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 3px 3px 0 var(--ink); padding: 6px 12px 6px 10px; font-weight: 700; font-size: clamp(14px, 2.6vmin, 30px); color: var(--ink); }
.cp-ic { width: 1.6em; height: 1.6em; border-radius: 10px; border: 2px solid var(--ink); display: inline-grid; place-items: center; }
.cp-ic svg { width: 70%; height: 70%; }
.bet-clue { display: flex; align-items: center; justify-content: center; gap: 16px; flex-direction: row-reverse; }
.bet-clue.sm .catpill { font-size: clamp(13px, 2vmin, 22px); }
.bet-corner { position: absolute; top: 9vmin; inset-inline-end: 3vmin; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.bet-corner b { display: block; color: var(--violet); font-family: var(--display); font-size: 1.6em; }
.bet-corner.inline { position: static; justify-content: center; }
.tv { position: relative; }
.timer.bet { background: conic-gradient(var(--pink) calc(var(--p) * 360deg), #fff 0); width: clamp(48px, 10vmin, 100px); height: clamp(48px, 10vmin, 100px); }
.bet-res .delta { font-family: var(--display); font-weight: 700; font-size: clamp(36px, 9vmin, 110px); line-height: 1.1; }
.bet-res.win .delta { color: #5B8A00; }
.bet-res.lose .delta { color: #C2185B; }
.bet-res p { font-weight: 800; margin: 6px 0 0; }
.tv.allin, .phone.allin { background: #2E2470 radial-gradient(circle at 1px 1px, rgba(255,255,255,.08) 1.5px, transparent 0) 0 0 / 28px 28px; color: #fff; }
.phone.allin { border-radius: 0; min-height: 100vh; }
.tv.allin .top, .tv.allin .top b, .phone.allin .bar, .tv.allin .hint, .phone.allin .hint, .tv.allin .pts { color: #CFC8F5; }
.tv.allin .who, .phone.allin .who { color: #fff; }
.allin-for { color: #FFD95A; font-weight: 800; font-size: clamp(16px, 2.8vmin, 32px); }
.allin-t { font-family: var(--display); color: #fff; margin: 0; font-size: clamp(30px, 8vmin, 96px); }
/* أوله وتاليه */
.edges { display: flex; align-items: flex-start; justify-content: center; gap: clamp(8px, 1.6vmin, 18px); }
.et { display: flex; flex-direction: column; align-items: center; gap: 4px; animation: drop .6s both; }
.et.last { animation-delay: .15s; }
@keyframes drop { 0% { transform: translateY(-50px); opacity: 0; } 70% { transform: translateY(6px); opacity: 1; } 100% { transform: none; } }
.et small { color: var(--muted); font-weight: 700; }
.tile2 { width: clamp(56px, 15vmin, 140px); height: clamp(64px, 17vmin, 160px); border-radius: 18%; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: clamp(34px, 10vmin, 88px); background: var(--gold); color: var(--ink); line-height: 1; }
.tile2.pink { background: var(--pink); }
.edges .gap { align-self: center; margin-bottom: 1.4em; min-width: clamp(70px, 16vmin, 240px); height: clamp(36px, 7vmin, 80px); border-radius: 12px; border: 2.5px dashed #B9B2CF; display: grid; place-items: center; color: #9A93B5; font-weight: 700; letter-spacing: 4px; background: #fff; }
.edges .blank { display: flex; flex-direction: row; gap: 6px; align-self: center; margin-bottom: 1.4em; }
.edges .blank span { width: clamp(28px, 6vmin, 64px); height: clamp(36px, 8vmin, 80px); border-radius: 9px; border: 2.5px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: clamp(20px, 4.6vmin, 50px); background: #fff; color: var(--ink); animation: pop .35s calc(.3s + var(--i) * .18s) both; }
.phone .tile2 { width: 64px; height: 72px; font-size: 40px; }
.phone .edges .blank span { width: 26px; height: 34px; font-size: 20px; }
.halfway { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 700; font-size: clamp(20px, 4vmin, 48px); color: var(--violet); animation: pop .6s; }
.halfway .fish { width: 1.6em; height: 1.6em; font-size: .8em; }
.halfway.sm { font-size: 18px; justify-content: center; }
.lnk-w { display: inline-flex; align-items: center; }
.bet-res .chips-row { margin-bottom: 12px; }
@media (max-width: 700px) { .bet-corner { position: static; justify-content: center; } }
/* pass-around: «دار السؤال» track and the owner's second chance */
.ptrack { display: flex; align-items: flex-start; justify-content: flex-start; gap: 6px; flex-wrap: wrap; margin-top: 1vmin; max-width: 100%; }
.pt { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 44px; font-size: clamp(11px, 1.6vmin, 18px); color: var(--ink); }
.pt-c { width: 2.4em; height: 2.4em; border-radius: 50%; border: 2.3px solid var(--ink); background: #fff; display: grid; place-items: center; font-family: var(--display); font-weight: 700; }
.pt-n { font-weight: 700; max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt small { color: var(--muted); }
.pt.own .pt-c { background: #FFD95A; }
.pt.tried { opacity: .5; }
.pt.tried .pt-c { background: #EDE6F7; }
.pt.now .pt-c { background: var(--violet); color: #fff; box-shadow: 0 0 0 4px rgba(91,75,214,.3); }
.pt.now small { color: var(--violet); font-weight: 700; }
.pt-a { color: var(--muted); align-self: center; margin-top: -1.2em; }
.second-pill { display: inline-block; background: #FFD95A; border: 2.5px solid var(--ink); border-radius: 999px; padding: .25em 1em; font-weight: 800; box-shadow: 3px 3px 0 var(--ink); animation: pop .5s; }
.tv .second-pill { font-size: clamp(16px, 3vmin, 36px); }
.pt.won .pt-c { background: #D4EC7A; box-shadow: 0 0 0 4px rgba(120,170,40,.3); }
.pt.won small { color: #4C7A12; font-weight: 700; }

/* ---------- question controls in the top corners (pause right, skip left) ---------- */
.tv .top { min-height: 56px; }
.tv .top .tl { flex: 1; text-align: center; }
.qc-gap { width: 56px; flex: 0 0 auto; }
.qc { font: inherit; cursor: pointer; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; border: var(--bw, 3px) solid var(--ink); box-shadow: 0 4px 0 var(--ink); transition: transform .08s; }
.qc:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.qc svg { width: 22px; height: 22px; }
.qc-pause { width: 56px; height: 56px; border-radius: 50%; justify-content: center; background: #E5484D; color: #fff; padding: 0; }
.qc-resume { height: 56px; border-radius: 999px; padding: 0 18px 0 8px; background: #5B8A00; color: #fff; font-weight: 800; font-size: 18px; }
.qc-resume svg { width: 34px; height: 34px; }
.qc-skip { height: 46px; border-radius: 999px; padding: 0 16px; background: var(--card, #fff); color: var(--ink); font-weight: 700; font-size: clamp(14px, 1.8vmin, 20px); }
.brk { gap: 2.4vmin; }
.brk-t { font-family: var(--display); font-weight: 700; font-size: clamp(56px, 16vmin, 190px); line-height: 1.1; color: var(--ink); }
.brk-t span { font-size: .7em; }
.brk-t.sm { font-size: 64px; text-align: center; }
.brk-s { color: var(--muted); font-size: clamp(16px, 3vmin, 34px); font-weight: 600; margin: 0; }
.brk-left { display: flex; align-items: center; gap: 2vmin; font-weight: 700; color: var(--ink); font-size: clamp(14px, 2.4vmin, 26px); }
.timer.paused { width: 10vmin; height: 10vmin; min-width: 60px; min-height: 60px; filter: grayscale(1); opacity: .75; }
.timer.paused span { font-size: clamp(20px, 3.6vmin, 40px); color: var(--ink); }
/* mute bottom-left, game number bottom-right */
.mute { top: auto; bottom: 1.6vmin; }
.gcode { position: fixed; bottom: 2vmin; right: 2vmin; color: var(--muted); font-size: clamp(13px, 1.8vmin, 20px); z-index: 5; }
.gcode b { color: var(--ink); }
.judgeqr { left: calc(2vmin + 60px); }
@media (max-width: 700px) {
  .qc-pause, .qc-gap { width: 46px; height: 46px; }
  .qc-resume { height: 46px; font-size: 15px; }
  .qc-skip { height: 40px; padding: 0 12px; font-size: 14px; }
  .tv .top .tl { font-size: 12px; }
}
/* judge remote: big صح/خطأ stacked under the timer, فزعة a small pill */
.tv.judge.phase-question .controls:not(.small) { flex-direction: column; align-items: stretch; width: min(100%, 460px); gap: 12px; }
.tv.judge.phase-question .controls:not(.small) .btn.good, .tv.judge.phase-question .controls:not(.small) .btn.bad { font-size: 24px; padding: 18px; width: 100%; }
.tv.judge.phase-question .controls:not(.small) [data-a=hint] { align-self: center; padding: 8px 22px; font-size: 16px; }
/* small screens: keep the top label on one line (round name gives way to «سؤال ٣ من ٦») */
.tv .top .tl { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) {
  .tv.phase-question .top .tl-r, .tv.phase-question .top .tl-dot { display: none; }
  .tv .top .tl { font-size: 15px; }
}

/* ---------- pop-up sheet (leave game?, where's the answer?) ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(43,35,80,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: fadeIn .15s; }
.sheet { background: var(--card); border: var(--bw) solid var(--ink); box-shadow: var(--shadow); border-radius: 22px; padding: 22px; width: min(100%, 520px); max-height: calc(100vh - 32px); overflow: auto; text-align: center; color: var(--text); }
.sheet h3 { margin: 4px 0 10px; font-size: 22px; }
.sheet p { margin: 6px 0; line-height: 1.7; }
.sheet-ic { font-size: 40px; }
.sheet-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.sheet .jchoice { margin: 10px 0 14px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- judge: where the answer shows ---------- */
.jchoice { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(100%, 860px); text-align: right; font-size: clamp(14px, 1.9vmin, 20px); }
.jc-opt { background: var(--card); border: var(--bw) solid var(--ink); box-shadow: var(--shadow); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.jc-opt p { margin: 0; color: var(--muted); line-height: 1.6; }
.jc-t { font-weight: 800; color: var(--ink); }
.jc-t .tag { font-size: .75em; background: var(--gold); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 8px; margin-inline-start: 6px; }
.jc-row { display: flex; gap: 12px; align-items: center; }
.jc-qr { width: clamp(84px, 14vmin, 150px); height: auto; aspect-ratio: 1; background: #fff; border-radius: 10px; padding: 4px; border: 2px solid var(--ink); flex: none; }
.jc-status { font-weight: 700; color: var(--muted); }
.jc-status.on { color: #1f8a4c; }
.jc-opt .btn { margin-top: auto; }
@media (max-width: 760px) { .jchoice { grid-template-columns: 1fr; } .jchoice .jc-opt:last-child { order: -1; } }
.jpill { position: fixed; bottom: 2vmin; left: calc(2vmin + 60px); z-index: 6; background: var(--card); border: 2px solid var(--ink); font-size: 14px; padding: 8px 14px; display: none; }
@media (max-width: 760px), (max-height: 560px) { .jpill { display: inline-flex; } }
.jback { display: flex; justify-content: center; margin: 4px 12px 16px; }
.jback .btn { font-size: 14px; }

/* the judge's answer card */
.jans { background: #fff; border: var(--bw) dashed var(--violet); border-radius: 18px; padding: 10px 18px 12px; width: min(100%, 560px); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.jans-l { font-weight: 800; color: var(--violet); font-size: 14px; }
.jans-l span { color: var(--muted); font-weight: 600; }
.jans .answer.small { font-size: clamp(26px, min(7vw, 5vh), 52px); line-height: 1.2; }
.jans-alts { color: var(--ink); font-size: 15px; }
.jans-help { width: 100%; text-align: right; font-size: 14px; color: var(--muted); }
.jans-help summary { cursor: pointer; text-align: center; color: var(--violet); font-weight: 700; list-style: none; }
.jans-help summary::-webkit-details-marker { display: none; }
.jans-help summary::before { content: '؟ '; }
.jans-help p { margin: 6px 0; line-height: 1.6; }
.jans-help b { color: var(--ink); }
.jans-help .btn { font-size: 14px; padding: 6px 14px; margin-top: 4px; }

/* "you have a game that isn't finished" */
.resume { position: relative; display: flex; flex-direction: column; gap: 12px; border: var(--bw) solid var(--ink); box-shadow: var(--shadow); }
.resume-h { display: flex; gap: 12px; align-items: flex-start; }
.resume .t { font-weight: 800; font-size: 18px; }
.resume .d { color: var(--muted); font-size: 14px; margin-top: 2px; }
.resume .d b { color: var(--ink); }
.resume-x { position: absolute; top: 8px; left: 10px; background: none; border: 0; font-size: 22px; color: var(--muted); cursor: pointer; }
/* the mute button sits bottom-left; keep the judge's score box clear of it */
body:has(.jback) #adjbox { margin-bottom: 76px !important; }
.intro.anim .jchoice { animation: fadeUp .4s 1.2s both; }
.intro .jchoice p, .sheet .jchoice p { font-size: 1em; line-height: 1.55; }
.intro .jchoice { margin: 0 auto; }
.intro:has(.jchoice) .intro-icon { width: clamp(56px, 11vmin, 130px); height: auto; }
.intro:has(.jchoice) h1 { font-size: clamp(32px, 7vmin, 100px); }
.intro:has(.jchoice) { gap: 1.8vmin; }

/* test copy only (APP_ENV=staging) */
#staging-banner { position: sticky; top: 0; z-index: 9999; background: #E8336D; color: #fff; text-align: center;
  font: 600 13px/1.6 'Readex Pro', sans-serif; padding: 2px 8px; }
