/* شخبطة - "بث مباشر" / Vintage Saudi TV Broadcast
   Two surfaces, one identity: the TV is the broadcast, the phone is the control gallery.
   Fonts are self-hosted via /fonts.css (linked in each page head before this file). */

:root {
  --ink: #0A1A24;        /* studio night */
  --ink-2: #0E2330;      /* lifted panel */
  --ink-3: #123040;      /* tool wells / inputs */
  --line: #1c4356;       /* hairline on dark */
  --bone: #F3ECDB;       /* broadcast bone (text/paper) */
  --bone-dim: #b9c4c2;   /* muted bone */
  --teal: #16A6A0;       /* station color */
  --teal-d: #0c6f6b;
  --orange: #FF6A1A;     /* signal / CTA */
  --orange-d: #c24400;
  --gold: #FFC21F;       /* lamp gold / code */
  --gold-d: #b9820a;
  --magenta: #E4356A;    /* reveal accent */
  --green: #57D06A;      /* live bug */
  --display: 'Rakkas', 'Changa', system-ui, sans-serif;
  --ui: 'Changa', system-ui, sans-serif;
  --r: 10px;
  --panel-sh: 0 2px 0 rgba(0,0,0,.5), 0 22px 44px -22px rgba(0,0,0,.85);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--ui);
  color: var(--bone);
  background:
    radial-gradient(130% 90% at 50% -10%, rgba(22,166,160,.18), rgba(22,166,160,0) 46%),
    radial-gradient(120% 80% at 50% 120%, rgba(255,106,26,.12), rgba(255,106,26,0) 52%),
    #07151d;
  background-attachment: fixed;
}
/* CRT broadcast texture: faint scanlines + corner vignette, restrained */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px),
    radial-gradient(120% 120% at 50% 50%, transparent 60%, rgba(0,0,0,.45) 100%);
  opacity: .5; mix-blend-mode: multiply;
}

h1, h2, h3 { font-weight: 800; margin: 0; }
.muted { color: var(--bone-dim); }
.center { text-align: center; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.wrap { max-width: 600px; margin: 0 auto; padding: 16px 16px 48px; position: relative; z-index: 1; }
.wrap.wide { max-width: 1180px; }
section { position: relative; z-index: 1; }

/* ---------- The Sadu/SMPTE color-bar strip (signature divider + wipe motif) ---------- */
.sadu {
  height: 8px; border-radius: 3px;
  background: linear-gradient(90deg,
    var(--teal) 0 12.5%, var(--gold) 0 25%, var(--magenta) 0 37.5%, var(--bone) 0 50%,
    var(--green) 0 62.5%, var(--orange) 0 75%, var(--teal) 0 87.5%, var(--gold) 0 100%);
  box-shadow: 0 1px 0 rgba(0,0,0,.5);
}
.sadu.hero { height: 14px; border-radius: 4px; }

/* ---------- Station bug + callsign (persistent broadcast identity) ---------- */
.bug {
  position: fixed; top: 12px; z-index: 70; pointer-events: none;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--ui); font-weight: 800;
}
.bug.right { right: 16px; }
.bug.left { left: 16px; }
.bug .name {
  font-family: var(--display); font-weight: 400; color: var(--bone);
  font-size: 1.25rem; letter-spacing: .5px; line-height: 1;
  text-shadow: 0 1px 0 rgba(0,0,0,.6);
}
.live {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.35); border: 1px solid rgba(87,208,106,.4);
  color: var(--green); font-size: .8rem; font-weight: 800;
  padding: 3px 9px 4px; border-radius: 4px; letter-spacing: .5px;
}
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: blink 1.4s steps(1) infinite; }
@keyframes blink { 0%,60% { opacity: 1; } 61%,100% { opacity: .25; } }

/* ---------- Ticker (anticipation / waiting personality) ---------- */
.ticker {
  display: flex; align-items: stretch; overflow: hidden;
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--r); height: 40px; margin: 14px 0;
}
.ticker .tag {
  flex: none; display: flex; align-items: center; gap: 6px;
  background: var(--magenta); color: #fff; font-weight: 800; font-size: .82rem;
  padding: 0 12px; letter-spacing: .5px; margin: 0; line-height: 1; /* reset generic .tag margin so عاجل centers */
}
.ticker .tag .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1.2s steps(1) infinite; }
.ticker .track { flex: 1; overflow: hidden; position: relative; }
/* the headline span is positioned + animated by Game.startTicker (right-to-left) */
.ticker .track span {
  position: absolute; white-space: nowrap; will-change: transform;
  top: 50%; left: 0; transform: translate(0, -50%);
  font-weight: 600; color: var(--bone); font-size: 1rem;
}

/* ---------- The color-bar WIPE transition ---------- */
#wipe {
  position: fixed; inset: 0 auto 0 0; width: 100vw; height: 100%;
  z-index: 150; pointer-events: none; display: flex; transform: translateX(120%);
}
#wipe i { flex: 1; height: 100%; }
#wipe i:nth-child(1){background:var(--teal)} #wipe i:nth-child(2){background:var(--gold)}
#wipe i:nth-child(3){background:var(--magenta)} #wipe i:nth-child(4){background:var(--bone)}
#wipe i:nth-child(5){background:var(--green)} #wipe i:nth-child(6){background:var(--orange)}
#wipe i:nth-child(7){background:var(--teal)} #wipe i:nth-child(8){background:var(--ink)}
#wipe.go { animation: wipeSweep .55s cubic-bezier(.7,0,.3,1) both; }
@keyframes wipeSweep { 0% { transform: translateX(120%); } 50% { transform: translateX(0); } 100% { transform: translateX(-120%); } }

/* ---------- Lower-third caption bar (the workhorse broadcast element) ---------- */
.lt {
  display: inline-flex; align-items: stretch; border-radius: 8px; overflow: hidden;
  box-shadow: var(--panel-sh); border: 1px solid rgba(0,0,0,.35);
}
.lt .cat {
  display: flex; align-items: center; padding: 0 16px; font-weight: 800;
  background: var(--orange); color: #1a0a02; font-size: 1rem; letter-spacing: .5px;
}
.lt .txt {
  display: flex; align-items: center; padding: 10px 20px; background: var(--ink-2);
  color: var(--bone); font-weight: 700; border-top: 3px solid var(--teal);
}

/* ---------- Panels / cards ---------- */
.card {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 20px; margin-top: 16px; box-shadow: var(--panel-sh);
  position: relative;
}
.card::before { /* top accent stripe - the "module title" feel */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--teal), var(--gold)); border-radius: var(--r) var(--r) 0 0;
}

/* ---------- Buttons: broadcast "key" buttons with travel ---------- */
.btn {
  display: block; width: 100%; font-family: var(--ui); font-weight: 800;
  font-size: 1.3rem; color: #1a0a02; background: var(--orange);
  border: none; border-radius: 10px; padding: 15px 18px; cursor: pointer; margin-top: 14px;
  box-shadow: 0 5px 0 var(--orange-d), 0 14px 22px -12px rgba(255,106,26,.6);
  transition: transform .08s ease, box-shadow .08s ease, filter .15s ease;
  position: relative;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--orange-d), 0 6px 14px -10px rgba(255,106,26,.5); }
.btn:disabled { background: var(--ink-3); color: #6f8088; box-shadow: 0 5px 0 #0a1c26; opacity: .8; cursor: default; transform: none; filter: none; }
.btn.secondary { background: var(--ink-2); color: var(--bone); border: 1px solid var(--teal); box-shadow: 0 5px 0 #061720, 0 14px 22px -14px rgba(0,0,0,.7); }
.btn.secondary:active { transform: translateY(4px); box-shadow: 0 1px 0 #061720; }
.btn.go { background: var(--gold); color: #2a1c02; box-shadow: 0 5px 0 var(--gold-d), 0 14px 22px -12px rgba(255,194,31,.55); }
.btn.go:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--gold-d); }
.btn:focus-visible, input:focus-visible, .seg:focus-visible, .tool-btn:focus-visible, .link-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.link-row { text-align: center; margin-top: 16px; }
.link-btn {
  background: none; border: none; cursor: pointer; color: var(--gold);
  font-family: var(--ui); font-weight: 700; font-size: 1.05rem;
  text-decoration: underline; text-underline-offset: 5px; padding: 8px;
}

/* ---------- Inputs ---------- */
input[type=text], input[type=tel] {
  width: 100%; font-family: var(--ui); font-weight: 700; font-size: 1.3rem;
  background: var(--ink); color: var(--bone); border: 2px solid var(--line);
  border-radius: 10px; padding: 15px; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.4) inset; transition: border-color .15s, box-shadow .15s;
}
input[type=text]:focus, input[type=tel]:focus {
  border-color: var(--gold); outline: none;
  box-shadow: 0 2px 8px rgba(0,0,0,.4) inset, 0 0 0 3px rgba(255,194,31,.22);
}
input::placeholder { color: #6f8088; }
#codeInput {
  font-family: var(--display); font-size: 3rem; letter-spacing: .35em;
  padding: 12px; color: var(--gold); direction: ltr;
}

/* ---------- Lobby join row: QR beside the call-in code ---------- */
.lobby-join { display: flex; gap: 18px; align-items: stretch; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.lobby-join .code-banner { margin: 0; flex: 1 1 auto; }
.qr-card {
  flex: none; align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--panel-sh);
}
.qr-box { background: #fff; border-radius: 10px; padding: 10px; width: 190px; height: 190px; box-shadow: 0 0 0 4px #06222e; }
.qr-box svg { display: block; width: 100%; height: 100%; }
.qr-cap { font-family: var(--ui); font-weight: 800; color: var(--teal); font-size: 1.05rem; }
@media (max-width: 700px) { .qr-box { width: 150px; height: 150px; } }

/* ---------- Host: title + call-in code ---------- */
.host-title {
  font-family: var(--display); font-weight: 400; text-align: center;
  font-size: clamp(2.4rem, 5.5vw, 4.4rem); line-height: 1; margin: 6px 0 0;
  color: var(--bone); letter-spacing: 1px;
}
.code-banner {
  margin: 16px auto 0; max-width: 860px; text-align: center;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 24px 24px; box-shadow: var(--panel-sh); position: relative; overflow: hidden;
}
.code-banner::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px;
  background: linear-gradient(90deg, var(--teal) 0 33%, var(--gold) 0 66%, var(--magenta) 0 100%); }
.code-banner .muted { font-weight: 700; }
.join-url { font-family: var(--ui); font-weight: 800; font-size: clamp(1.2rem, 2.6vw, 1.8rem); color: var(--teal); letter-spacing: .5px; direction: ltr; }
/* direction:ltr is critical - in an RTL flex the digits would otherwise render reversed,
   so a "6794" code would read "4976" on the TV and players would type the wrong number. */
.code-banner .code { display: inline-flex; gap: 12px; justify-content: center; margin-top: 8px; direction: ltr; }
.code-digit {
  font-family: var(--display); font-weight: 400; line-height: 1;
  font-size: clamp(3.4rem, 13vw, 8.5rem); color: var(--gold);
  background: var(--ink); border: 2px solid var(--gold-d); border-radius: 12px;
  padding: 4px clamp(10px, 2.6vw, 28px);
  box-shadow: 0 0 0 1px rgba(0,0,0,.5) inset, 0 0 30px -6px rgba(255,194,31,.5);
  text-shadow: 0 0 18px rgba(255,194,31,.45);
}

/* ---------- Player nameplates (guest check-in) ---------- */
.players-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.player-chip {
  display: inline-flex; align-items: center; gap: 0; font-family: var(--ui); font-weight: 800;
  font-size: 1.3rem; color: var(--bone); background: var(--ink-2);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  box-shadow: 0 3px 0 rgba(0,0,0,.4); padding: 8px 16px 8px 16px;
  position: relative;
}
.player-chip::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 6px; background: var(--teal); }
.player-chip.kickable { gap: 10px; padding-inline-end: 10px; }
/* host-only lobby remove button on each chip */
.kick-btn {
  flex: none; width: 26px; height: 26px; border-radius: 50%; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(228,53,106,.16); color: var(--magenta); border: 1px solid rgba(228,53,106,.5);
  font-weight: 800; font-size: .9rem; line-height: 1; cursor: pointer;
  transition: background .12s, color .12s, transform .08s;
}
.kick-btn:hover { background: var(--magenta); color: #fff; }
.kick-btn:active { transform: scale(.88); }
.kick-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.player-chip.off { opacity: .4; }
.player-chip.off::before { background: var(--bone-dim); }
.player-chip.done { color: var(--gold); }
.player-chip.done::before { background: var(--gold); box-shadow: 0 0 14px var(--gold); }
.player-chip.pop { animation: slam .45s cubic-bezier(.2,1.4,.4,1) both; }

/* ---------- Host phase title + broadcast clock ---------- */
.big-phase {
  font-family: var(--display); font-weight: 400; text-align: center;
  font-size: clamp(2rem, 6vw, 4.6rem); margin: 22px 0 8px; color: var(--bone);
}
.timer-num {
  font-family: var(--display); font-weight: 400; font-size: clamp(2.4rem, 7vw, 4rem);
  color: var(--gold); text-align: center; line-height: 1; transition: color .2s, transform .2s;
}
.timer-num.danger { color: var(--orange); animation: clockPulse .8s ease-in-out infinite; }
@keyframes clockPulse { 0%,100% { transform: scale(1); text-shadow: 0 0 0 rgba(255,106,26,0); } 50% { transform: scale(1.16); text-shadow: 0 0 28px rgba(255,106,26,.7); } }
.timerbar { height: 12px; background: var(--ink); border-radius: 7px; overflow: hidden; margin: 12px auto; box-shadow: 0 2px 5px rgba(0,0,0,.5) inset; border: 1px solid var(--line); }
.timerbar > div { height: 100%; width: 100%; background: linear-gradient(90deg, var(--teal), var(--green)); transition: width .5s linear; }
.timerbar.low > div { background: linear-gradient(90deg, var(--orange), var(--magenta)); }

/* ---------- Settings: the director's pre-show panel ---------- */
.settings { max-width: 680px; margin: 20px auto 0; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--panel-sh); }
.settings h3 { font-family: var(--display); font-weight: 400; font-size: 1.7rem; text-align: center; margin-bottom: 14px; color: var(--bone); letter-spacing: .5px; }
.set-row { margin-bottom: 16px; }
.set-label { font-weight: 700; margin-bottom: 8px; }
.set-label .hint { color: var(--bone-dim); font-weight: 500; font-size: .85rem; }
.segmented, .pack-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.seg, .pack {
  flex: 1 1 0; min-width: 92px; background: var(--ink-3); color: var(--bone);
  border: 2px solid var(--line); border-radius: 10px; padding: 10px 8px; cursor: pointer;
  text-align: center; font-family: var(--ui); transition: transform .08s, border-color .12s, background .12s;
}
.seg:active, .pack:active { transform: translateY(2px); }
.seg .seg-title { font-family: var(--display); font-weight: 400; font-size: 1.35rem; display: block; }
.seg .seg-sub, .pack .pack-count { color: var(--bone-dim); font-size: .8rem; }
.seg.sel, .pack.sel { border-color: var(--gold); background: #1a2e1f; box-shadow: 0 0 18px -6px rgba(255,194,31,.5); }
.seg.sel .seg-sub { color: var(--bone); }
.pack .pack-name { font-family: var(--display); font-weight: 400; font-size: 1.3rem; }
.pack.locked { opacity: .6; cursor: not-allowed; }
.badge-soon { display: inline-block; margin-top: 4px; font-size: .72rem; font-weight: 800; background: var(--magenta); color: #fff; border-radius: 999px; padding: 2px 10px; }
.badge-premium { display: inline-block; margin-top: 4px; font-size: .72rem; font-weight: 800; background: rgba(255,194,31,.18); color: var(--gold); border: 1px solid rgba(255,194,31,.5); border-radius: 999px; padding: 2px 10px; }

/* toggle */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch { position: relative; width: 58px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; cursor: pointer; background: var(--ink); border: 2px solid var(--line); border-radius: 999px; transition: background .2s, border-color .2s; }
.slider::before { content: ""; position: absolute; height: 22px; width: 22px; right: 4px; top: 3px; background: var(--bone); border-radius: 50%; transition: transform .2s; }
.switch input:checked + .slider { background: var(--teal); border-color: var(--teal); }
.switch input:checked + .slider::before { transform: translateX(-26px); }
.switch input:focus-visible + .slider { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Replay: the hosted show segment ---------- */
.replay-stage { max-width: 880px; margin: 16px auto; }
.replay-narrator { text-align: center; margin: 6px 0 4px; }
.replay-narrator .label { color: var(--bone-dim); font-weight: 700; font-size: 1.1rem; }
.replay-narrator .name { display: block; font-family: var(--display); font-weight: 400; color: var(--gold); font-size: clamp(2.2rem, 6.5vw, 3.8rem); line-height: 1.1; text-shadow: 0 0 24px rgba(255,194,31,.35); }
.replay-narrator .counter { color: var(--bone-dim); font-weight: 700; }
.dots { display: flex; gap: 10px; justify-content: center; margin: 12px 0 6px; flex-wrap: wrap; }
.dot { width: 16px; height: 8px; border-radius: 2px; background: var(--ink-3); border: 1px solid var(--line); transition: all .25s; }
.dot.done { background: var(--teal); border-color: var(--teal); }
.dot.active { background: var(--gold); border-color: var(--gold); width: 28px; box-shadow: 0 0 12px var(--gold); }

/* the broadcast monitor that frames each reveal */
.replay-card {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 24px; text-align: center; margin-top: 14px; box-shadow: var(--panel-sh); position: relative; overflow: hidden;
}
.replay-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--magenta), var(--orange)); }
.replay-card .who { display: inline-block; color: #1a0a02; background: var(--gold); font-weight: 800; font-size: 1rem; padding: 4px 14px; border-radius: 6px; margin-bottom: 14px; }
.replay-card .sentence { font-family: var(--display); font-weight: 400; font-size: clamp(1.7rem, 4.2vw, 2.8rem); line-height: 1.3; color: var(--bone); }
.replay-card img {
  max-width: 100%; max-height: 52vh; display: block; margin: 0 auto; background: #fff;
  padding: 10px; border-radius: 4px; border: 2px solid #06222e;
  box-shadow: 0 0 0 8px #06222e, 0 0 0 10px var(--teal), 0 26px 48px -22px rgba(0,0,0,.85);
}
.qmark { font-family: var(--display); font-size: 6rem; color: var(--bone-dim); }
.replay-card.reveal { animation: punchIn .55s cubic-bezier(.2,.9,.25,1.05) both; }
@keyframes punchIn { 0% { opacity: 0; transform: scale(.86); } 60% { opacity: 1; transform: scale(1.03); } 100% { transform: scale(1); } }

/* ---------- End: results title card + scoreboard ---------- */
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.end-hero { text-align: center; position: relative; z-index: 3; }
.end-title { font-family: var(--display); font-weight: 400; font-size: clamp(2.6rem, 7.5vw, 5rem); margin: 12px 0; color: var(--gold); text-shadow: 0 0 30px rgba(255,194,31,.4); }
.mawwal { font-family: var(--display); font-weight: 400; color: var(--bone); font-size: clamp(1.2rem, 3vw, 1.8rem); margin: 0 0 18px; }
.summary { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 0 auto 22px; max-width: 760px; }
.summary-card { background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; min-width: 200px; flex: 1 1 220px; max-width: 380px; box-shadow: var(--panel-sh); position: relative; }
.summary-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--teal); border-radius: 12px 12px 0 0; }
.summary-card .k { color: var(--bone-dim); font-weight: 700; margin-bottom: 6px; }
.summary-card .v { font-family: var(--display); font-weight: 400; font-size: 1.7rem; color: var(--bone); }
.summary-card .v.big { font-size: 3rem; color: var(--gold); }
.summary-card .drift { font-size: 1.15rem; line-height: 1.5; }
.summary-card .drift .from { color: var(--bone-dim); }
.summary-card .drift .arrow { color: var(--magenta); padding: 0 6px; font-weight: 800; }
.end-buttons { max-width: 400px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }

/* ---------- Share images (save a chain as a story image) ---------- */
.share-block { max-width: 760px; margin: 0 auto 22px; }
.share-title { font-family: var(--display); font-weight: 400; color: var(--bone); font-size: 1.5rem; margin-bottom: 12px; }
.share-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
/* player end screen: big, stacked, one-tap share buttons */
.player-share { display: flex; flex-direction: column; gap: 12px; max-width: 360px; margin: 16px auto 0; }
.player-share .share-btn { width: 100%; font-size: 1.15rem; padding: 16px 18px; box-shadow: 0 4px 0 #061720; }
.player-share .share-btn:active { box-shadow: 0 1px 0 #061720; }
.share-btn {
  font-family: var(--ui); font-weight: 700; font-size: 1rem; color: var(--bone);
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px; cursor: pointer; box-shadow: 0 3px 0 #061720;
  transition: transform .07s, box-shadow .07s, border-color .12s;
}
.share-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #061720; }
.share-btn:hover { border-color: var(--teal); }
.share-btn.featured { background: linear-gradient(180deg, #f0ad4a, var(--gold)); color: #2a1c02; border-color: var(--gold-d); box-shadow: 0 3px 0 var(--gold-d); font-weight: 800; }
.share-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- Player: wait / write / guess ---------- */
.wait-screen { text-align: center; padding: 40px 10px; }
.wait-screen .emoji { font-size: 3.6rem; display: inline-block; animation: floaty 3s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.watch-cue { /* the unmistakable "look at the TV" badge */
  display: inline-flex; align-items: center; gap: 8px; margin-top: 6px;
  background: var(--magenta); color: #fff; font-weight: 800; font-size: 1.1rem;
  padding: 8px 18px; border-radius: 8px; box-shadow: 0 4px 0 #a01f48;
  animation: cuePulse 1.5s ease-in-out infinite;
}
@keyframes cuePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.prompt-box { background: var(--ink-3); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; text-align: center; font-size: 1.35rem; font-weight: 700; margin: 10px 0; }
.prompt-box .draw-label { display: block; font-family: var(--display); font-weight: 400; color: var(--orange); font-size: 1.1rem; margin-bottom: 4px; letter-spacing: .5px; }
.prompt-box img { max-width: 100%; border-radius: 4px; background: #fff; padding: 8px; box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--teal); }

/* ---------- The drawing studio (heart of the game) ---------- */
.canvas-wrap { position: relative; width: 100%; }
#pad {
  width: 100%; background: #fff; border-radius: 6px; border: 2px solid #06222e;
  touch-action: none; display: block;
  box-shadow: 0 0 0 5px #06222e, 0 0 0 7px var(--teal), 0 16px 30px -16px rgba(0,0,0,.8);
}
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between;
  margin-top: 12px; padding: 10px; background: var(--ink); border: 1px solid var(--line); border-radius: 12px;
}
.tool-group { display: flex; gap: 6px; align-items: center; padding: 5px; background: var(--ink-3); border-radius: 10px; box-shadow: 0 2px 5px rgba(0,0,0,.4) inset; }
#colors.tool-group { flex-wrap: wrap; justify-content: center; flex: 1 1 100%; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(0,0,0,.45); cursor: pointer; padding: 0; box-shadow: 0 2px 5px rgba(0,0,0,.4); transition: transform .1s; }
.swatch:active { transform: scale(.88); }
.swatch.sel { transform: scale(1.14); box-shadow: 0 0 0 3px var(--ink-3), 0 0 0 5px var(--gold), 0 2px 6px rgba(0,0,0,.5); }
.tool-btn {
  font-family: var(--ui); font-size: 1.3rem; line-height: 1; width: 46px; height: 46px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--bone);
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
  box-shadow: 0 3px 0 #061720; transition: transform .07s, box-shadow .07s, background .12s, border-color .12s;
}
.tool-btn:active { transform: translateY(3px); box-shadow: 0 0 0 #061720; }
.tool-btn.sel { border-color: var(--gold); color: #2a1c02; background: var(--gold); box-shadow: 0 3px 0 var(--gold-d); }
.tool-btn .dot { background: currentColor; border-radius: 50%; display: block; }

/* ---------- How-to overlay (the show rundown) ---------- */
.overlay { position: fixed; inset: 0; z-index: 200; background: rgba(5,12,16,.8); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .25s; }
.overlay.open { opacity: 1; }
.overlay-sheet { background: var(--ink-2); width: 100%; max-width: 600px; border-radius: 18px 18px 0 0; border: 1px solid var(--line); border-bottom: none; padding: 18px 18px 28px; transform: translateY(24px); transition: transform .25s; max-height: 92vh; overflow-y: auto; }
.overlay.open .overlay-sheet { transform: none; }
.howto-h { font-family: var(--display); font-weight: 400; text-align: center; font-size: 2.1rem; margin: 12px 0 6px; color: var(--bone); }
.howto-steps { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.howto-step { display: flex; gap: 14px; align-items: center; background: var(--ink-3); border: 1px solid var(--line); border-radius: 10px; padding: 14px; position: relative; }
.howto-step::before { /* segment number, like a rundown */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--teal);
}
.howto-emoji { font-size: 2.2rem; flex: none; width: 48px; text-align: center; }
.howto-step-title { font-family: var(--display); font-weight: 400; font-size: 1.4rem; color: var(--bone); }
.howto-step-text { color: var(--bone-dim); font-size: 1rem; }
.howto-rules { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0 16px; }
.rule-pill { background: var(--ink-3); border: 1px solid var(--teal); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: .95rem; color: var(--bone); }

/* ---------- Splash (channel sign-on) ---------- */
.splash-hero { text-align: center; padding: 28px 0 6px; }
.splash-title {
  font-family: var(--display); font-weight: 400; font-size: clamp(3.4rem, 15vw, 6.6rem); line-height: 1;
  margin: 14px 0 6px; color: var(--bone); letter-spacing: 1px;
  text-shadow: 0 0 36px rgba(22,166,160,.4);
}
.splash-sub { color: var(--bone-dim); font-weight: 600; font-size: 1.18rem; margin: 0; }
/* single clean signature underline-wave: clear gaps above (from the tagline) and below (before the actions) */
.doodle { width: 200px; max-width: 60%; height: 40px; display: block; margin: 22px auto 24px; overflow: visible; }
.doodle path { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 600; stroke-dashoffset: 600; animation: drawIn 2.2s ease forwards .6s; filter: drop-shadow(0 2px 8px rgba(255,194,31,.35)); }
@keyframes drawIn { to { stroke-dashoffset: 0; } }
.tag { text-align: center; color: var(--bone-dim); font-weight: 700; font-size: .85rem; margin-top: 28px; }

/* ---------- Main menu ---------- */
/* show name can be up to 20 chars, so the menu title clamps smaller and may wrap */
.menu-title { font-size: clamp(2.6rem, 12vw, 5.2rem); overflow-wrap: anywhere; }
.menu-actions { max-width: 420px; margin: 8px auto 0; display: flex; flex-direction: column; gap: 12px; }
.menu-actions .btn { margin-top: 0; }

/* ---------- Hero: broadcast title-card (eyebrow + wordmark + lower-third) ---------- */
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 16px;
  font-family: var(--ui); font-weight: 800; font-size: .8rem; letter-spacing: 3px;
  color: var(--teal);
}
.hero-eyebrow .eb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: blink 1.4s steps(1) infinite; }
.hero-lt {
  display: inline-flex; align-items: stretch; margin: 16px auto 28px; max-width: 94%;
  border-radius: 8px; overflow: hidden; box-shadow: var(--panel-sh); border: 1px solid rgba(0,0,0,.35);
}
.hero-lt .cat {
  display: flex; align-items: center; padding: 0 14px; flex: none;
  background: var(--orange); color: #1a0a02; font-weight: 800; font-size: .8rem; letter-spacing: .5px;
}
.hero-lt .txt {
  display: flex; align-items: center; padding: 11px 16px; text-align: right; line-height: 1.35;
  background: var(--ink-2); color: var(--bone); font-weight: 700; font-size: 1.02rem; border-top: 3px solid var(--teal);
}

/* ---------- Menu hierarchy: one dominant primary, a secondary pair, quiet utilities ---------- */
.menu-actions .btn.primary {
  display: flex; align-items: center; gap: 14px; text-align: right; padding: 17px 22px;
}
.btn.primary .btn-emoji { font-size: 1.7rem; flex: none; line-height: 1; }
.btn.primary .btn-stack { display: flex; flex-direction: column; gap: 3px; line-height: 1.1; }
.btn.primary .btn-main { font-size: 1.5rem; font-weight: 800; }
.btn.primary .btn-sub { font-size: .8rem; font-weight: 700; color: #5a3d05; letter-spacing: .2px; }
.menu-split { display: flex; gap: 12px; }
.menu-split .btn { flex: 1; font-size: 1.14rem; padding: 14px 12px; }
.menu-split .btn .btn-emoji { font-size: 1.15rem; }
.menu-utility { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 18px; }
.util-btn {
  background: none; border: none; cursor: pointer; padding: 8px 14px; border-radius: 8px;
  font-family: var(--ui); font-weight: 700; font-size: .96rem; color: var(--bone-dim);
  transition: color .15s ease, background .15s ease;
}
.util-btn:hover { color: var(--bone); background: rgba(255,255,255,.05); }
.util-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.util-sep { width: 1px; height: 18px; background: var(--line); flex: none; }

/* ---------- Custom line-icon system (replaces emoji in the chrome) ---------- */
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; flex: none; }
.btn-emoji .ico { width: 1em; height: 1em; }
.util-btn .ico { width: 1.05em; height: 1.05em; vertical-align: -0.16em; margin-inline-start: 6px; }
.link-btn .ico { width: .95em; height: .95em; vertical-align: -0.1em; margin-inline-start: 5px; }
.btn .ico { width: 1.05em; height: 1.05em; vertical-align: -0.16em; }
.qr-cap .ico { width: 1.05em; height: 1.05em; vertical-align: -0.16em; margin-inline-start: 6px; }
.settings-title { font-family: var(--display); font-weight: 400; text-align: center; font-size: clamp(2rem, 6vw, 3rem); color: var(--bone); letter-spacing: 1px; margin: 12px 0 4px; }
#settings .settings { max-width: 620px; }

/* ---------- Entrances + screen transitions ---------- */
@keyframes slam { 0% { opacity: 0; transform: scale(1.12); } 60% { opacity: 1; transform: scale(.985); } 100% { transform: scale(1); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
.screen-in { animation: slam .42s cubic-bezier(.2,.85,.3,1) both; }
.anim-up { animation: fadeUp .5s ease both; }
.anim-pop { animation: popIn .5s cubic-bezier(.2,1.3,.4,1) both; }
.d1 { animation-delay: .08s; } .d2 { animation-delay: .2s; } .d3 { animation-delay: .34s; } .d4 { animation-delay: .48s; }

/* ---------- Personalization: show name + custom ticker ---------- */
/* host on-stage channel title (the brand شخبطة stays as the corner bug) */
.show-title {
  text-align: center; font-family: var(--display); font-weight: 400;
  font-size: clamp(1.7rem, 3.6vw, 2.8rem); color: var(--bone); line-height: 1.1;
  margin: 10px auto 0; letter-spacing: 1px; text-shadow: 0 0 26px rgba(22,166,160,.4);
}
.show-title .pre { display: block; font-family: var(--ui); font-weight: 800; font-size: .78rem; color: var(--teal); letter-spacing: 4px; margin-bottom: 2px; }
/* player channel bug (top-left), mirroring the brand bug on the right */
.show-bug { position: fixed; top: 12px; left: 16px; z-index: 70; pointer-events: none; }
.show-bug .chan {
  display: inline-block; font-family: var(--display); font-weight: 400; color: var(--gold);
  font-size: 1.05rem; line-height: 1; background: rgba(0,0,0,.32); padding: 4px 10px 5px;
  border-radius: 6px; border: 1px solid rgba(255,194,31,.35); text-shadow: 0 1px 0 rgba(0,0,0,.6);
}
textarea {
  width: 100%; font-family: var(--ui); font-weight: 600; font-size: 1.05rem; line-height: 1.7;
  background: var(--ink); color: var(--bone); border: 2px solid var(--line); border-radius: 10px;
  padding: 12px; resize: vertical; min-height: 84px; box-shadow: 0 2px 8px rgba(0,0,0,.4) inset;
}
textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 2px 8px rgba(0,0,0,.4) inset, 0 0 0 3px rgba(255,194,31,.22); }
/* live mini-preview of how the personalization will look on air */
.show-preview {
  margin-top: 12px; background: var(--ink); border: 1px dashed var(--line); border-radius: 10px;
  padding: 12px; overflow: hidden;
}
.show-preview .pv-label { font-weight: 700; color: var(--bone-dim); font-size: .82rem; margin-bottom: 8px; }
.show-preview .pv-title { font-family: var(--display); font-weight: 400; color: var(--bone); font-size: 1.5rem; text-align: center; }
.show-preview .pv-title .pre { display: block; font-family: var(--ui); font-weight: 800; font-size: .7rem; color: var(--teal); letter-spacing: 3px; }
.show-preview .pv-ticker { display: flex; align-items: stretch; min-height: 32px; margin-top: 10px; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
.show-preview .pv-ticker .tag { display: flex; align-items: center; justify-content: center; margin: 0; top: auto; bottom: auto; transform: none; line-height: 1; background: var(--magenta); color: #fff; font-weight: 800; font-size: .72rem; padding: 0 10px; }
.show-preview .pv-ticker .line { display: flex; align-items: center; padding: 0 10px; color: var(--bone); font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.locked-note { color: var(--bone-dim); font-size: .9rem; }
.locked-note .badge-soon { margin-inline-start: 8px; }

/* ---------- Live audience reactions ---------- */
.react-label { color: var(--bone-dim); font-weight: 700; margin-top: 22px; margin-bottom: 8px; }
.reactions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.react-btn {
  width: 60px; height: 60px; font-size: 1.9rem; line-height: 1; cursor: pointer;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 3px 0 #061720; transition: transform .07s, box-shadow .07s, border-color .12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.react-btn:active { transform: translateY(3px); box-shadow: 0 0 0 #061720; }
.react-btn:hover { border-color: var(--teal); }
.react-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.react-btn.pop { animation: reactPop .35s cubic-bezier(.2,1.5,.4,1); }
@keyframes reactPop { 0% { transform: scale(1); } 45% { transform: scale(1.35); } 100% { transform: scale(1); } }
/* send any emoji from the phone keyboard */
.react-custom { display: flex; gap: 8px; max-width: 320px; margin: 12px auto 0; }
.react-custom input { flex: 1; min-width: 0; text-align: center; font-size: 1.5rem; padding: 10px 8px; }
.react-custom .btn { margin: 0; width: auto; flex: none; padding: 12px 18px; font-size: 1rem; }

/* host: floating reaction emojis over the broadcast */
#reactionLayer { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.reaction-float {
  position: absolute; bottom: 6%; transform: translateY(0); will-change: transform, opacity;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); animation: floatUp 2.8s ease-out forwards;
}
@keyframes floatUp {
  0% { transform: translate(0, 0) scale(.5); opacity: 0; }
  12% { opacity: 1; transform: translate(calc(var(--drift, 0px) * .12), -6vh) scale(1.2); }
  80% { opacity: 1; }
  100% { transform: translate(var(--drift, 0px), -84vh) scale(1.15); opacity: 0; }
}
.reaction-float.static { bottom: 40%; animation: reactStatic .9s ease-out forwards; }
@keyframes reactStatic { 0% { opacity: 0; transform: scale(.6); } 25% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0; transform: scale(1); } }

/* ---------- الإعدادات + خصص قناتك (full-width broadcast layout) ---------- */
/* the whole settings screen: a live monitor on one side, all the controls on the other.
   stacks to one column on phones/tablet-portrait, splits on desktop/TV/tablet-landscape. */
.settings-layout { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 16px; align-items: start; }
@media (min-width: 980px) {
  .settings-layout { grid-template-columns: minmax(330px, 400px) 1fr; gap: 26px; }
}

/* live broadcast monitor (preview) - prominent, sticks in view on wide screens */
@media (min-width: 980px) { .settings-preview { position: sticky; top: 14px; } }
.pv-label { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--bone-dim); font-size: .95rem; margin-bottom: 10px; letter-spacing: .3px; }
.pv-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px var(--green); animation: blink 1.4s steps(1) infinite; flex: none; }
.pv-monitor { background: #05131b; border: 1px solid var(--line); border-radius: 16px; padding: 10px; box-shadow: var(--panel-sh), inset 0 0 0 4px rgba(0,0,0,.3); }
.pv-bars { height: 9px; border-radius: 5px; margin-bottom: 10px;
  background: linear-gradient(90deg, var(--teal) 0 14.3%, var(--gold) 0 28.6%, var(--magenta) 0 42.9%, var(--bone) 0 57.2%, var(--green) 0 71.5%, var(--orange) 0 85.8%, var(--teal) 0 100%); }
.pv-note { text-align: center; color: var(--bone-dim); font-size: .82rem; margin-top: 12px; }
.pv-frame { background: var(--ink); border: 1px solid var(--line); border-radius: 11px; padding: 20px 16px; text-align: center; }
.pv-frame .pv-title { font-family: var(--display); font-weight: 400; color: var(--bone); font-size: 2rem; line-height: 1.1; text-shadow: 0 0 22px rgba(255,194,31,.35); word-break: break-word; }
.pv-frame .pv-slogan { color: var(--gold); font-weight: 700; font-size: 1rem; margin-top: 4px; word-break: break-word; }
.pv-frame .pv-ticker { display: flex; align-items: stretch; min-height: 32px; margin-top: 14px; border-radius: 7px; overflow: hidden; border: 1px solid var(--line); }
/* The real cause: the generic .tag{margin-top:28px} (footer caption) leaks into this ticker's
   div.tag and the parent overflow:hidden then clips it. Full reset so it cannot be offset: zero
   margin/top/bottom/transform, line-height:1, and center it inside the full-height pink bar. */
.pv-frame .pv-ticker .tag {
  display: flex; align-items: center; justify-content: center;
  margin: 0; top: auto; bottom: auto; transform: none; line-height: 1;
  background: var(--magenta); color: #fff; font-weight: 800; font-size: .72rem; padding: 0 10px; flex: none;
}
.pv-frame .pv-ticker .line { display: flex; align-items: center; padding: 0 10px; color: var(--bone); font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-frame .pv-brand { color: var(--bone-dim); font-weight: 700; font-size: .82rem; margin-top: 14px; }

/* the controls side - a column of broadcast-styled cards */
.settings-controls { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.custom-h { font-family: var(--display); font-weight: 400; font-size: 1.9rem; text-align: center; color: var(--bone); margin: 8px 0 0; display: flex; align-items: center; justify-content: center; gap: 10px; }

.cust-card { background: var(--ink-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--panel-sh); min-width: 0; }
.cust-card-h { display: flex; align-items: center; gap: 9px; font-family: var(--ui); font-weight: 800; font-size: 1.05rem; color: var(--bone); margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--line); letter-spacing: .3px; }
.cust-card-h .hint { font-weight: 600; color: var(--bone-dim); font-size: .82rem; }
.cust-tab { width: 6px; height: 20px; border-radius: 3px; background: var(--gold); flex: none; box-shadow: 0 0 10px -2px var(--gold); }

/* two-column field rows (channel+slogan, news+wait) and the look/reaction pair - stack on narrow */
.field-2col, .cust-row { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 620px) { .field-2col { grid-template-columns: 1fr 1fr; gap: 14px 20px; } }
@media (min-width: 620px) { .cust-row { grid-template-columns: 1fr 1fr; align-items: start; } }
.field { min-width: 0; display: flex; flex-direction: column; }

/* labels above the field, room to breathe; the hint wraps cleanly and never forms a thin sliver */
.field-label { display: block; font-weight: 700; color: var(--bone); margin: 0 0 7px; line-height: 1.5; }
.field-label .hint { color: var(--bone-dim); font-weight: 500; font-size: .85rem; }
.field-hint { color: var(--bone-dim); font-size: .82rem; margin-top: 6px; min-height: 1em; }

/* form-styled fields inside the cards: wide and readable, right-aligned for Arabic
   (not the big centered style used for the room-code/name inputs elsewhere) */
.cust-card input[type=text] { font-size: 1.1rem; font-weight: 700; text-align: right; padding: 13px 14px; }
.cust-card textarea { min-height: 122px; font-size: 1.02rem; }
.field textarea { flex: 1; }

.look-row { display: flex; gap: 10px; flex-wrap: wrap; }
/* labeled look tile: a color chip + the full name, tile sized to its content (no truncation) */
.look-tile {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--ink); border: 2px solid var(--line); border-radius: 10px; padding: 9px 13px;
  color: var(--bone); font-family: var(--ui); font-weight: 700; font-size: .95rem;
  transition: transform .08s, border-color .12s, background .12s;
}
.look-tile .look-chip { width: 20px; height: 20px; border-radius: 6px; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.look-tile .look-name { white-space: nowrap; }
.look-tile:hover { border-color: var(--teal); }
.look-tile:active { transform: scale(.97); }
.look-tile.sel { border-color: var(--gold); background: var(--ink-3); box-shadow: 0 0 16px -6px var(--gold); }
.look-tile:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.react-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.react-pick-btn { width: 48px; height: 48px; font-size: 1.55rem; border-radius: 10px; cursor: pointer; background: var(--ink); border: 2px solid var(--line); opacity: .5; transition: opacity .12s, border-color .12s, transform .08s; }
.react-pick-btn:hover { opacity: .85; border-color: var(--teal); }
.react-pick-btn.sel { opacity: 1; border-color: var(--gold); background: var(--ink-3); }
.react-pick-btn:active { transform: scale(.9); }

/* host on-stage slogan under the channel title */
.show-title .show-slogan { display: block; font-family: var(--ui); font-weight: 700; font-size: .9rem; color: var(--gold); letter-spacing: 1px; margin-top: 4px; }

/* player avatar picker (lobby nameplate identity) */
.avatar-label { font-weight: 700; color: var(--bone-dim); margin: 12px 0 6px; font-size: .95rem; }
.avatar-pick { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.av-dot, .av-emoji { width: 38px; height: 38px; border-radius: 50%; cursor: pointer; border: 2px solid rgba(0,0,0,.4); box-shadow: 0 2px 5px rgba(0,0,0,.4); transition: transform .1s; }
.av-emoji { background: var(--ink-3); font-size: 1.2rem; display: inline-flex; align-items: center; justify-content: center; }
.av-dot:active, .av-emoji:active { transform: scale(.9); }
.av-dot.sel, .av-emoji.sel { transform: scale(1.14); box-shadow: 0 0 0 3px var(--ink-2), 0 0 0 5px var(--gold); }

/* avatar shown on the host nameplate */
.chip-avatar { width: 22px; height: 22px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px rgba(0,0,0,.3); }
.chip-avatar.emoji { background: transparent; box-shadow: none; font-size: 1.2rem; }

/* ---------- Voting segment ---------- */
.vote-grid { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; max-width: 1000px; margin: 14px auto 0; }
.vote-card {
  flex: 1 1 240px; max-width: 320px; background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 18px; box-shadow: var(--panel-sh); position: relative; text-align: center;
}
.vote-card.lead { border-color: var(--gold); box-shadow: 0 0 24px -6px rgba(255,194,31,.6); }
.vote-card .vc-starter { font-family: var(--display); font-weight: 400; color: var(--gold); font-size: 1.5rem; }
.vote-card .vc-first { color: var(--bone); font-size: 1.05rem; margin: 6px 0 10px; }
.vote-card .vc-count { font-family: var(--display); font-weight: 400; color: var(--teal); font-size: 2.4rem; line-height: 1; }
/* player vote options */
.vote-list { display: flex; flex-direction: column; gap: 10px; max-width: 520px; margin: 8px auto 0; }
.vote-opt {
  display: flex; flex-direction: column; gap: 4px; text-align: right; cursor: pointer;
  background: var(--ink-2); border: 2px solid var(--line); border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 3px 0 #061720; transition: transform .07s, border-color .12s, box-shadow .07s;
}
.vote-opt:active { transform: translateY(2px); box-shadow: 0 1px 0 #061720; }
.vote-opt.sel { border-color: var(--gold); background: #1a2e1f; box-shadow: 0 0 20px -6px rgba(255,194,31,.5); }
.vote-opt .vo-starter { font-family: var(--display); font-weight: 400; color: var(--gold); font-size: 1.4rem; }
.vote-opt .vo-first { color: var(--bone); font-size: 1.05rem; }
.vote-opt:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
/* the crowned "جولة السهرة" banner on the end screen */
.crown { margin: 0 auto 10px; }
.crown .crown-tag { font-family: var(--ui); font-weight: 800; letter-spacing: 3px; color: var(--magenta); font-size: 1rem; }
.crown .crown-name { font-family: var(--display); font-weight: 400; color: var(--gold); font-size: clamp(2.2rem, 6vw, 3.6rem); line-height: 1.1; text-shadow: 0 0 28px rgba(255,194,31,.5); }
.crown .crown-sub { color: var(--bone-dim); font-weight: 700; font-size: .95rem; }

/* ---------- Stage centering: single-focus screens fill the broadcast frame ---------- */
#phase { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; }
.clock {
  max-width: 540px; margin: 10px auto 4px; background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 16px; padding: 20px 28px 18px; box-shadow: var(--panel-sh); position: relative;
}
.clock::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px;
  background: linear-gradient(90deg, var(--teal) 0 50%, var(--gold) 0 100%); border-radius: 16px 16px 0 0; }
.clock .clock-label { font-weight: 800; color: var(--bone-dim); letter-spacing: 2px; font-size: .9rem; }
.clock .timer-num { font-size: clamp(3.2rem, 10vw, 6rem); }
#done { min-height: 82vh; display: flex; flex-direction: column; justify-content: center; }

/* phone: center the short single-message screens */
#join, #wait, #replayCtl, #write, #guess { min-height: 86vh; display: flex; flex-direction: column; justify-content: center; }

/* ---------- Responsive ---------- */
/* Host broadcast: on desktop/TV, fill the screen and vertically center so it
   reads as a full broadcast instead of a top-pinned column. "safe center" falls
   back to top-align when a state is taller than the viewport, so nothing clips.
   Scoped to .host-screen, so the phone/personal surfaces are untouched. */
@media (min-width: 1200px) {
  .host-screen .wrap.wide {
    min-height: calc(100dvh - 16px);
    display: flex; flex-direction: column; justify-content: safe center;
  }
}
@media (min-width: 1600px) {
  .wrap.wide { max-width: 1340px; }
  .host-screen .wrap.wide { max-width: 1500px; }
  .replay-stage { max-width: 1040px; }
}
@media (min-width: 1920px) {
  .host-screen .wrap.wide { max-width: 1680px; }
  .host-screen .qr-box { width: 230px; height: 230px; }
}
@media (max-width: 480px) {
  .code-banner { padding: 14px 12px 20px; }
  .code-banner .code { gap: 6px; max-width: 100%; flex-wrap: nowrap; }
  .code-digit { font-size: clamp(2rem, 12vw, 3.4rem); padding: 3px 9px; border-radius: 9px; }
  .seg, .pack { min-width: 84px; }
  .bug .name { font-size: 1.05rem; }
}
@media (max-width: 360px) {
  .wrap { padding: 14px 12px 36px; }
  .card { padding: 16px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .overlay { opacity: 1; } .overlay-sheet { transform: none; }
  .doodle path { stroke-dashoffset: 0 !important; }
  #wipe { display: none !important; }
}

/* ---------- Safety layer: respectful notice, report buttons, hidden content ---------- */
/* subtle, on-brand lower-third style reminder (teal = station colour), not a loud banner */
.respect-note {
  max-width: 460px; margin: 0 auto 10px; padding: 6px 12px 6px 14px; text-align: center;
  background: rgba(22,166,160,.07); border: 1px solid rgba(22,166,160,.22);
  border-inline-start: 3px solid var(--teal); border-radius: 8px;
  color: var(--bone-dim); font-weight: 600; font-size: .8rem; line-height: 1.45;
}
/* lobby: share the join link (under the code/QR) */
.join-share { max-width: 420px; margin: 14px auto 0; text-align: center; }
.join-share-hint { display: block; color: var(--bone-dim); font-size: .98rem; margin-bottom: 8px; line-height: 1.5; }
.join-share .btn { margin-top: 0; }
.report-btn {
  display: block; width: fit-content; margin: 10px auto 0; padding: 7px 14px; border-radius: 999px;
  background: var(--ink-2); border: 1px solid var(--line); color: var(--bone-dim);
  font-family: var(--ui); font-weight: 700; font-size: .85rem; cursor: pointer;
  transition: border-color .12s, color .12s;
}
.report-btn:hover { border-color: var(--magenta); color: var(--bone); }
.report-btn:disabled { opacity: .7; cursor: default; }
.hidden-art {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 140px;
  color: var(--bone-dim); font-weight: 800; font-size: 1.1rem;
  background: var(--ink); border-radius: 10px;
}
.host-hide-btn {
  display: block; margin: 10px auto 0; padding: 6px 14px; border-radius: 999px;
  background: rgba(228,53,106,.12); border: 1px solid rgba(228,53,106,.5); color: var(--bone);
  font-family: var(--ui); font-weight: 700; font-size: .9rem; cursor: pointer;
}
.host-hide-btn:hover { background: rgba(228,53,106,.22); }
.host-hide-btn:disabled { opacity: .7; cursor: default; }

/* ====================================================================
   RETRO SAUDI-TV BROADCAST DESIGN PASS
   The room is a CRT television set; panels are broadcast monitors and the
   chrome is broadcast graphics. Colours + fonts unchanged. The heavy glass
   TEXTURES (scanlines/grain/vignette/fringe) sit behind a reduced-motion check;
   the SET FRAME (bezel + curved screen) is structural and always on.
   ==================================================================== */

/* --- the CRT set: a heavy bezel with softly curved glass around the viewport --- */
body::before {
  content: ""; position: fixed; inset: 5px; z-index: 58; pointer-events: none;
  border-radius: 26px;
  background: radial-gradient(78% 52% at 22% -2%, rgba(255,255,255,.05), transparent 52%); /* soft glass glare */
  box-shadow:
    0 0 0 5px #04080b,                      /* the moulded TV set around the glass */
    inset 0 0 0 2px rgba(255,255,255,.05),   /* screen lip catch-light */
    inset 0 0 0 9px #0a1014,                 /* bezel body */
    inset 0 0 0 11px #21343d,                /* inner bezel highlight */
    inset 0 0 130px 6px rgba(0,0,0,.34);     /* glass darkens gently toward the bezel */
}

/* --- the glass texture: scanlines + grain + vignette + a touch of edge fringe --- */
body::after {
  content: ""; position: fixed; inset: 5px; z-index: 59; pointer-events: none;
  border-radius: 26px;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 1px, transparent 1px 3px),
    radial-gradient(126% 116% at 50% 50%, transparent 56%, rgba(0,0,0,.5) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: auto, auto, 150px 150px;
  opacity: .4; mix-blend-mode: multiply;
  box-shadow: inset 7px 0 16px -9px rgba(255,40,95,.22), inset -7px 0 16px -9px rgba(40,205,255,.2); /* chromatic edge fringe */
}

/* --- panels become broadcast monitors: a framed screen, not a soft floating card --- */
.card, .clock, .code-banner, .cust-card, .summary-card, .vote-card, .pv-frame {
  border-radius: 14px;
  border: 1px solid #21434f;
  background: linear-gradient(180deg, #102a37 0%, #0b1c27 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.07),       /* top bezel highlight */
    inset 0 0 0 4px #08161e,                    /* dark inner bezel ring = the monitor frame */
    inset 0 0 44px -12px rgba(0,0,0,.7),        /* screen vignette */
    0 3px 0 #050f17,                            /* hard bottom set edge */
    0 16px 26px -22px rgba(0,0,0,.85);          /* soft contact shadow */
}
/* keep the module-title accent stripe sitting on the new radius */
.card::before, .summary-card::before { border-radius: 14px 14px 0 0; height: 4px; }

/* --- channel-style buttons: moulded plastic keys with a hard edge --- */
.btn {
  border-radius: 9px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.4),
    inset 0 -2px 0 rgba(0,0,0,.22),
    0 5px 0 var(--orange-d),
    0 12px 18px -11px rgba(255,106,26,.55);
  text-shadow: 0 1px 0 rgba(0,0,0,.12);
}
.btn.go { box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 -2px 0 rgba(0,0,0,.18), 0 5px 0 var(--gold-d), 0 12px 18px -11px rgba(255,194,31,.5); }
.btn.secondary { box-shadow: inset 0 1px 0 rgba(255,255,255,.08), inset 0 -2px 0 rgba(0,0,0,.3), 0 5px 0 #050f17, 0 12px 18px -13px rgba(0,0,0,.7); }
.btn:active { box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 0 var(--orange-d); }

/* --- the LIVE bug + station callsign as on-air tally graphics --- */
.live {
  border-radius: 3px; padding: 4px 10px 5px; letter-spacing: 1px;
  background: rgba(0,0,0,.5); border: 1px solid rgba(87,208,106,.55);
  box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.5);
}
.bug .name {
  background: rgba(4,8,11,.5); border: 1px solid rgba(255,194,31,.3);
  padding: 3px 10px 4px; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.5);
}

/* --- the station clock: a framed broadcast countdown read-out --- */
.clock { border-radius: 16px; }
.clock .clock-label {
  display: inline-block; background: var(--orange); color: #1a0a02;
  padding: 2px 14px; border-radius: 4px; letter-spacing: 3px; font-size: .78rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.clock .timer-num {
  text-shadow: 0 0 26px rgba(255,194,31,.35), 0 3px 0 rgba(0,0,0,.4);
  letter-spacing: 2px;
}

/* --- single-focus titles read as a lower-third bar, not floating text --- */
.big-phase {
  display: inline-block; margin-inline: auto;
  padding: 8px 26px; border-radius: 6px;
  background: linear-gradient(180deg, rgba(14,35,48,.95), rgba(9,24,33,.95));
  border: 1px solid var(--line); border-bottom: 3px solid var(--teal);
  box-shadow: 0 3px 0 #050f17, 0 16px 26px -20px rgba(0,0,0,.8);
}

/* --- break the uniform pill row: pills get a clipped, broadcast-label corner --- */
.rule-pill, .badge-premium { border-radius: 4px 12px 4px 12px; }

/* --- the code banner gets a stronger monitor frame (it is the hero readout) --- */
.code-banner { border-radius: 16px; }

/* textures off for reduced-motion (the structural bezel frame stays) */
@media (prefers-reduced-motion: reduce) {
  body::after { display: none !important; }
}

/* small muted helper line under each settings control (explains what it changes) */
.ctrl-help { font-size: .8rem; color: var(--bone-dim); margin-top: 6px; line-height: 1.45; }
.field .ctrl-help { margin-top: 5px; }

/* the "+" that opens the device emoji picker (sits in the reaction row) */
.react-btn.react-more { border-style: dashed; border-color: var(--teal); color: var(--teal); font-weight: 800; }
.react-custom { justify-content: center; }

/* privacy/content fine print shared across the main screens (small, muted, unobtrusive) */
.legal-fine {
  max-width: 600px; margin: 20px auto 0; padding: 0 10px; text-align: center;
  color: var(--bone-dim); font-size: .72rem; line-height: 1.65; opacity: .72;
}

/* ---- On-phone reveal album (every phone gets the full result, swipeable) ---- */
.reveal-album {
  display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
  padding: 4px 2px 6px; margin: 6px 0 2px; scrollbar-width: none;
}
.reveal-album::-webkit-scrollbar { display: none; }
.rv-chain {
  flex: 0 0 86%; max-width: 420px; scroll-snap-align: center;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px; box-sizing: border-box;
}
.rv-chain.rv-win { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.rv-head {
  text-align: center; font-weight: 800; color: var(--gold);
  font-size: 1.05rem; margin: 2px 0 10px;
}
.rv-step { background: var(--ink-3); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.rv-step:last-child { margin-bottom: 0; }
.rv-who { font-size: .78rem; color: var(--bone-dim); margin-bottom: 6px; }
.rv-text { color: var(--bone); font-size: 1.15rem; line-height: 1.5; }
.rv-img { width: 100%; border-radius: 8px; background: #fff; display: block; }
.rv-blank {
  text-align: center; color: var(--bone-dim); font-size: 1.4rem;
  padding: 18px 0; background: #0a1c26; border-radius: 8px;
}
.reveal-dots { display: flex; gap: 6px; justify-content: center; margin: 2px 0 6px; }
.rv-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background .2s; }
.rv-dot.on { background: var(--gold); }
.reveal-hint { font-size: .82rem; margin: 0 0 6px; opacity: .8; }
.share-sep {
  text-align: center; color: var(--bone-dim); font-size: .9rem;
  margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid var(--line);
}

/* ---- Phones-only leader lobby ---- */
.leader-players { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.leader-chip {
  background: var(--ink-3); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-weight: 700; color: var(--bone); font-size: .95rem;
}
.leader-chip.off { opacity: .45; }
#leaderJoinHint { color: var(--bone-dim); direction: ltr; unicode-bidi: isolate; }

/* text-only mode: the previous sentence shown to retell (in the guess screen) */
.guess-text { font-size: 1.4rem; line-height: 1.6; color: var(--bone); text-align: center; padding: 6px 4px; }

/* ---- Mid-game pause overlay (reconnection) ---- */
.pause-overlay {
  position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 18, 26, .82); backdrop-filter: blur(3px); padding: 24px;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.pause-overlay.open { opacity: 1; pointer-events: auto; }
.pause-box {
  max-width: 420px; text-align: center; background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 18px; padding: 26px 22px; box-shadow: 0 20px 50px -20px rgba(0,0,0,.8);
}
.pause-emoji { font-size: 3rem; }
.pause-title { font-family: var(--display); font-size: 1.8rem; color: var(--bone); margin-top: 6px; }
.pause-sub { color: var(--gold); font-weight: 800; font-size: 1.15rem; margin-top: 10px; }
.pause-hint { color: var(--bone-dim); font-size: .9rem; margin-top: 10px; }

/* host: audience-count badge */
.aud-badge {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--ink-2); border: 1px solid var(--gold); color: var(--gold);
  font-weight: 800; font-size: 1rem; padding: 6px 14px; border-radius: 999px;
}

/* animated-reveal share button (alongside the still story-card) */
.share-btn.anim { background: linear-gradient(135deg, var(--magenta), var(--orange)); }
