:root {
  --bg: #150c2c;
  --card: rgba(255, 255, 255, 0.07);
  --card-strong: rgba(255, 255, 255, 0.13);
  --line: rgba(255, 255, 255, 0.15);
  --text: #ffffff;
  --muted: #c9bdf2;
  --accent: #ffd23f;
  --accent-ink: #2a1d00;
  --good: #2fe0a0;
  --good-soft: rgba(47, 224, 160, 0.14);
  --bad: #ff5d7d;
  --bad-soft: rgba(255, 93, 125, 0.14);
  --unicorn: #c792ff;
  --unicorn-soft: rgba(199, 146, 255, 0.16);
  --red: #ff4d6d;
  --red-soft: rgba(255, 77, 109, 0.16);
  --blue: #3fa2ff;
  --blue-soft: rgba(63, 162, 255, 0.16);
  --radius: 18px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  --glow1: #5b2bb8;
  --glow2: #a82f78;
  --watermark: none; /* the game's emblem, faint in the corner: url('/icons/<icon>.svg') */
  color-scheme: dark;
}

/* Each game has its own mood: colours, glow and a faint emblem in the corner (its icon).
   Pages set data-theme on <body> (the host and player pages follow the room's game). */
[data-theme="herd"] {
  --bg: #0c1f12;
  --glow1: #2f8f4e;
  --glow2: #6aa52f;
  --muted: #cfe6c6;
  --accent: #ffe066;
  --accent-ink: #2a2200;
  --watermark: url('/icons/users-round.svg');
}
[data-theme="time"] {
  --bg: #140d08;
  --glow1: #c2410c;
  --glow2: #7c2d12;
  --muted: #f3d3bd;
  --accent: #ffb020;
  --accent-ink: #2a1600;
  --watermark: url('/icons/timer.svg');
}
[data-theme="seen"] {
  --bg: #070f2b;
  --glow1: #1d4ed8;
  --glow2: #0e7490;
  --muted: #c3d2f5;
  --accent: #ffd23f;
  --accent-ink: #2a1d00;
  --watermark: url('/icons/circle-help.svg');
}
[data-theme="mafia"] {
  --bg: #0c0707;
  --glow1: #7f1d1d;
  --glow2: #3f1d1d;
  --muted: #e6c3c3;
  --accent: #f43f5e;
  --accent-ink: #ffffff;
  --watermark: url('/icons/drama.svg');
}
[data-theme="outsider"] {
  --bg: #170a1f;
  --glow1: #9d174d;
  --glow2: #4c1d95;
  --muted: #e9c9e6;
  --accent: #ff8fd0;
  --accent-ink: #2b0620;
  --watermark: url('/icons/venetian-mask.svg');
}
[data-theme="letters"] {
  --bg: #1a1205;
  --glow1: #b7791f;
  --glow2: #6b3e00;
  --muted: #f1dfb8;
  --accent: #ffc83d;
  --accent-ink: #2a1d00;
  --watermark: url('/icons/hexagon.svg');
}
[data-theme="feud"] {
  --bg: #050f33;
  --glow1: #1d4ed8;
  --glow2: #b45309;
  --muted: #c7d3f2;
  --accent: #fbbf24;
  --accent-ink: #241600;
  --watermark: url('/icons/chart-bar-big.svg');
}
[data-theme="who"] {
  --bg: #04201f;
  --glow1: #0f766e;
  --glow2: #155e75;
  --muted: #c4ece6;
  --accent: #2dd4bf;
  --accent-ink: #032521;
  --watermark: url('/icons/pointer.svg');
}
[data-theme="truth"] {
  --bg: #160d33;
  --glow1: #7c3aed;
  --glow2: #0e7490;
  --muted: #d9cffb;
  --accent: #c4f04d;
  --accent-ink: #1d2600;
  --watermark: url('/icons/circle-check-big.svg');
}
[data-theme="scam"] {
  --bg: #0a0b24;
  --glow1: #4338ca;
  --glow2: #be123c;
  --muted: #cdd0f5;
  --accent: #ff6a3d;
  --accent-ink: #2a0a00;
  --watermark: url('/icons/fingerprint.svg');
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: 'Tajawal', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 85% -10%, var(--glow1) 0%, transparent 60%),
    radial-gradient(900px 700px at -10% 110%, var(--glow2) 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.4s ease;
}
body::after {
  content: '';
  position: fixed;
  inset-inline-start: -40px;
  bottom: -50px;
  width: min(42vw, 320px);
  aspect-ratio: 1;
  background: var(--text);
  -webkit-mask: var(--watermark) center / contain no-repeat;
  mask: var(--watermark) center / contain no-repeat;
  opacity: 0.06;
  transform: rotate(-12deg);
  pointer-events: none;
  z-index: 0;
}
body[data-theme="letters"] {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 0 L56 16 L56 48 L28 64 L0 48 L0 16 Z M28 64 L28 97' fill='none' stroke='%23ffc83d' stroke-opacity='0.07' stroke-width='2'/%3E%3C/svg%3E"),
    radial-gradient(1100px 700px at 85% -10%, var(--glow1) 0%, transparent 60%),
    radial-gradient(900px 700px at -10% 110%, var(--glow2) 0%, transparent 55%);
}
.app, .home, .landing { position: relative; z-index: 1; }

h1, h2, h3 { margin: 0 0 12px; line-height: 1.3; }
h2 { font-size: 20px; }
p { margin: 0 0 12px; }

.app, .home { max-width: 1100px; margin: 0 auto; padding: 16px 16px 56px; }
.narrow { max-width: 520px; margin: 0 auto; }
.center { text-align: center; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; }
.loading { text-align: center; color: var(--muted); padding-top: 30vh; }

/* ---------- Building blocks ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}
.card + .card { margin-top: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 22px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card-strong);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:not(:disabled):hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--bad); color: #fff; border-color: transparent; }
.btn.big { width: 100%; min-height: 56px; font-size: 20px; margin-top: 8px; }
.btn.small { min-height: 36px; padding: 4px 14px; font-size: 15px; border-radius: 12px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--card-strong);
  font-size: 15px;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-weight: 700; font-size: 14px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 18px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
select option { color: #111; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
#code { letter-spacing: 0.3em; text-align: center; font-size: 28px; font-weight: 800; direction: ltr; }

.banner { padding: 12px 16px; border-radius: 14px; text-align: center; font-size: 18px; margin-bottom: 16px; }
.banner.good { background: var(--good-soft); border: 1px solid var(--good); }
.banner.bad { background: var(--bad-soft); border: 1px solid var(--bad); }

.mode-pill {
  align-self: center;
  margin: 0 auto 12px;
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 700;
  text-align: center;
  background: var(--good-soft);
  border: 1px solid var(--good);
}
.mode-pill.different { background: var(--unicorn-soft); border-color: var(--unicorn); }
.player .mode-pill { font-size: 14px; }

.category-tag {
  align-self: center;
  margin: 0 auto -8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 15px;
  text-align: center;
}

.field-head { display: flex; align-items: center; gap: 12px; }
.field-head > span { font-weight: 700; font-size: 14px; color: var(--muted); margin-inline-end: auto; }
.link-btn.small { font-size: 13px; direction: rtl; }
.category-tree { display: flex; flex-direction: column; gap: 8px; }
.cat-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.expand-btn {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
}
.sub-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 4px; margin-inline-start: 12px; border-inline-start: 2px solid var(--line); }
.sub-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.sub-chip.picked { border-color: var(--accent); background: rgba(255, 210, 63, 0.14); color: var(--text); }
.category-chip.partial { border-color: var(--accent); border-style: dashed; color: var(--text); }
.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.category-chip.picked { border-color: var(--accent); background: rgba(255, 210, 63, 0.14); color: var(--text); }
.category-count {
  min-width: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--card-strong);
  font-size: 12px;
  text-align: center;
}

.mode-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.mode-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 8px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: center;
}
.mode-option b { font-size: 18px; }
.mode-option small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.mode-emoji { font-size: 30px; line-height: 1.2; }
.mode-option.picked { border-color: var(--accent); background: rgba(255, 210, 63, 0.12); }

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: 20px;
  margin: 0 auto;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 14px;
  background: #2a1a52;
  border: 1px solid var(--bad);
  text-align: center;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
}
.toast.ok { border-color: var(--good); }
.toast.show { opacity: 1; transform: none; }

.offline {
  position: fixed;
  top: 0;
  inset-inline: 0;
  padding: 8px;
  text-align: center;
  background: var(--bad);
  color: #fff;
  font-weight: 700;
  z-index: 30;
}

/* ---------- Home ---------- */

.hero { text-align: center; padding: 32px 0 20px; }
.hero h1 { font-size: 40px; font-weight: 800; margin-bottom: 4px; }
.logo { font-size: 64px; }
.home .card { max-width: 520px; margin: 0 auto 16px; }

/* One big tile per game, each in its own colours. */
.game-tiles { display: grid; gap: 14px; max-width: 1080px; margin: 4px auto 28px; }
@media (min-width: 700px) { .game-tiles { grid-template-columns: 1fr 1fr; gap: 18px; } }
@media (min-width: 1000px) { .game-tiles { grid-template-columns: repeat(3, 1fr); } }
.game-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 184px;
  padding: 20px 22px;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    radial-gradient(420px 260px at 0% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    linear-gradient(140deg, var(--glow1), var(--glow2) 70%, var(--bg));
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
@media (min-width: 700px) {
  .game-tile { min-height: 230px; }
  .game-tile-emoji { font-size: 96px; }
}
.game-tile:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4); }
.game-tile:active { transform: scale(0.98); }
.game-tile-emoji {
  position: absolute;
  inset-inline-end: 18px;
  top: 16px;
  font-size: 72px;
  line-height: 1;
  transform: rotate(-10deg);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}
.game-tile b { position: relative; font-size: 30px; font-weight: 800; line-height: 1.2; }
.game-tile small { position: relative; font-size: 17px; color: rgba(255, 255, 255, 0.85); }
.game-tile-meta { position: relative; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.game-tile-meta span { padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.28); font-size: 13px; font-weight: 700; }
.game-tile-go { position: relative; margin-top: 12px; color: var(--accent); font-weight: 800; }
.home-how { max-width: 620px; margin: 0 auto 22px; text-align: center; color: var(--muted); }

/* ---------- Game pages ---------- */

.landing { max-width: 1100px; margin: 0 auto; padding: 12px 16px 64px; }
.landing-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.landing-nav a { color: var(--muted); font-weight: 700; text-decoration: none; }
.landing-nav a:hover { color: var(--text); }
.landing-hero { display: grid; gap: 28px; align-items: center; padding: 18px 0 32px; }
@media (min-width: 880px) { .landing-hero { grid-template-columns: 1fr 1.05fr; gap: 40px; padding: 44px 0 52px; } }
.landing-kicker {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}
.landing-intro h1 { font-size: clamp(46px, 10vw, 80px); font-weight: 800; line-height: 1.05; margin-bottom: 10px; }
.landing-tagline { margin: 0 0 20px; color: var(--muted); font-size: clamp(20px, 3.6vw, 27px); line-height: 1.4; }
.landing-facts { display: flex; flex-wrap: wrap; gap: 10px; max-width: 460px; padding: 0; margin: 0 0 20px; list-style: none; }
.landing-facts li { flex: 1 1 90px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); text-align: center; }
.landing-facts b { display: block; color: var(--accent); font-size: 28px; line-height: 1.2; }
.landing-facts span { color: var(--muted); font-size: 14px; }
.landing-intro .btn.big, .landing-final .btn.big { max-width: 460px; min-height: 62px; font-size: 22px; }
.landing-intro .hint { max-width: 460px; margin: 10px 0 0; }
.landing-visual { min-width: 0; }

.landing-section { padding: 28px 0; }
.landing-section > h2 { margin-bottom: 6px; font-size: clamp(27px, 4.4vw, 36px); text-align: center; }
.landing-section > .lead { max-width: 640px; margin: 0 auto 20px; color: var(--muted); text-align: center; font-size: 17px; }
.landing-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; padding: 0; margin: 18px 0 0; list-style: none; counter-reset: step; }
.landing-steps li { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); counter-increment: step; }
.landing-steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 21px;
  font-weight: 800;
}
.landing-steps b { display: block; margin-bottom: 4px; font-size: 19px; }
.landing-steps p { margin: 0; color: var(--muted); }
.landing-split { display: grid; gap: 14px; }
@media (min-width: 760px) { .landing-split { grid-template-columns: 1fr 1fr; } }
.landing-box { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.landing-box h3 { font-size: 22px; margin-bottom: 6px; }
.landing-box p { margin: 0; color: var(--muted); }
.landing-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 900px; margin: 0 auto; padding: 0; list-style: none; }
.landing-chips li { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 700; font-size: 15px; }
.landing-final {
  margin-top: 16px;
  padding: 36px 18px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--glow1) 60%, transparent), color-mix(in srgb, var(--glow2) 60%, transparent));
  text-align: center;
}
.landing-final h2 { font-size: clamp(28px, 5vw, 40px); margin-bottom: 4px; }
.landing-final p { margin: 0 0 14px; color: var(--muted); }
.landing-final .btn.ghost { max-width: 460px; margin-top: 10px; }
.landing-final .btn { margin-inline: auto; }

/* عقلية القطيع: the herd and the one who walks the other way */
.herd-demo { display: flex; flex-direction: column; gap: 12px; padding: 20px; border: 1px solid var(--line); border-radius: 26px; background: rgba(0, 0, 0, 0.22); }
.herd-demo-q { padding: 14px 16px; border-radius: 16px; background: var(--card-strong); font-size: clamp(19px, 3vw, 24px); font-weight: 800; text-align: center; }
.herd-group { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 16px; background: var(--card); }
.herd-group b { font-size: 22px; min-width: 64px; }
.herd-group .herd-crowd { font-size: 28px; letter-spacing: 2px; direction: ltr; text-align: end; }
.herd-group em { font-style: normal; font-size: 13px; font-weight: 800; padding: 2px 10px; border-radius: 999px; }
.herd-group.herd { border-color: var(--good); background: var(--good-soft); }
.herd-group.herd em { background: var(--good); color: #00321f; }
.herd-group.lone { border-color: var(--unicorn); background: var(--unicorn-soft); }
.herd-group.lone em { background: var(--unicorn); color: #2a0b4a; }
.herd-crowd span { display: inline-block; animation: herd-bob 1.6s ease-in-out infinite; }
.herd-crowd span:nth-child(2) { animation-delay: 0.2s; }
.herd-crowd span:nth-child(3) { animation-delay: 0.4s; }
.herd-crowd span:nth-child(4) { animation-delay: 0.6s; }
@keyframes herd-bob { 50% { transform: translateY(-4px); } }
.herd-bets { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; direction: ltr; }
.herd-bets span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--card-strong); font-weight: 800; }
.herd-bets span.used { opacity: 0.35; text-decoration: line-through; }
.herd-bets span.pick { background: var(--accent); color: var(--accent-ink); transform: scale(1.1); }
.mode-box .mode-emoji { font-size: 44px; line-height: 1; }

/* تحدي الوقت: a picture and two chess clocks */
.tc-demo { padding: 18px; border: 1px solid var(--line); border-radius: 26px; background: rgba(0, 0, 0, 0.25); }
.tc-demo-pic { position: relative; aspect-ratio: 4 / 3; margin-bottom: 14px; overflow: hidden; border-radius: 18px; background: #000; }
.tc-demo-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tc-demo-pic span { position: absolute; inset-inline-start: 12px; top: 12px; padding: 4px 14px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); font-weight: 800; }
.tc-demo .tc-clocks { margin: 0; }
.tc-demo .tc-clock.active { animation: tc-tick 1s steps(2) infinite; }
@keyframes tc-tick { 50% { box-shadow: 0 0 12px rgba(255, 77, 109, 0.25); } }
.tc-samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-width: 900px; margin: 0 auto; }
.tc-sample { position: relative; aspect-ratio: 1; padding: 0; overflow: hidden; border: 2px solid var(--line); border-radius: 16px; background: #fff; color: var(--text); font: inherit; cursor: pointer; }
.tc-sample img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tc-sample.contain img { object-fit: contain; padding: 14px; }
.tc-sample.emoji { display: grid; place-items: center; background: var(--card-strong); font-size: 52px; }
.tc-sample-answer { position: absolute; inset-inline: 0; bottom: 0; padding: 6px; background: rgba(0, 0, 0, 0.72); font-size: 15px; font-weight: 800; }
.tc-sample:not(.open) .tc-sample-answer { color: var(--accent); }
.tc-sample:not(.open) .tc-sample-answer b { display: none; }
.tc-sample.open .tc-sample-answer i { display: none; }
.tc-sample-answer i { font-style: normal; }

/* سين جيم: the board */
.sj-demo { padding: 16px; border: 1px solid var(--line); border-radius: 26px; background: rgba(0, 0, 0, 0.25); }
.sj-demo .sj-board { gap: 6px; }
.sj-demo .sj-cat { height: 72px; font-size: 13px; }
.sj-demo .sj-cat-emoji { font-size: 22px; }
.sj-demo .sj-tile { min-height: 44px; font-size: clamp(14px, 2vw, 20px); }
@media (max-width: 520px) {
  .sj-demo { padding: 10px; }
  .sj-demo .sj-board { gap: 4px; }
  .sj-demo .sj-cat { height: 58px; font-size: 10.5px; overflow-wrap: normal; }
  .sj-demo .sj-tile { min-height: 34px; border-radius: 9px; }
}
.sj-demo .sj-tile.hot { animation: pulse 1.4s infinite; border-color: var(--accent); }
.sj-demo-score { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 22px; font-weight: 800; direction: ltr; }
.sj-demo-score span { flex: 1; padding: 6px 12px; border-radius: 14px; text-align: center; }
.sj-demo-score .red { background: var(--red-soft); color: #ff8da0; }
.sj-demo-score .blue { background: var(--blue-soft); color: #8cc8ff; }
.lifeline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.lifeline-grid .landing-box { text-align: center; }
.lifeline-grid .lifeline-emoji { font-size: 48px; line-height: 1.1; }
.lifeline-grid small { display: inline-block; margin-top: 8px; padding: 2px 10px; border-radius: 999px; background: var(--card-strong); color: var(--muted); font-size: 13px; }

/* برا السالفة: three cards, one of them out of the loop */
.os-demo { padding: 24px 16px; border: 1px solid var(--line); border-radius: 26px; background: rgba(0, 0, 0, 0.22); text-align: center; }
.os-demo-cards { display: flex; justify-content: center; margin: 10px 0 18px; }
.os-demo-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 38%;
  max-width: 180px;
  aspect-ratio: 3 / 4;
  margin-inline: -4%;
  padding: 10px;
  border-radius: 18px;
  border: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 22%, var(--bg)), var(--bg));
  box-shadow: var(--shadow);
  transform: rotate(8deg) translateY(10px);
}
.os-demo-card:first-child { transform: rotate(-8deg) translateY(10px); }
.os-demo-card.out { z-index: 1; transform: scale(1.06); border-color: var(--accent); background: linear-gradient(160deg, #3b0a2e, #12061a); }
.os-demo-card small { color: var(--muted); font-size: 14px; }
.os-demo-card.out small { font-size: 34px; line-height: 1; }
.os-demo-card b { font-size: clamp(18px, 3.4vw, 28px); line-height: 1.2; color: var(--accent); }
.os-demo-card span { color: var(--muted); font-size: 12px; }
.os-demo-q { margin: 0; padding: 10px 14px; border-radius: 14px; background: var(--card-strong); font-size: 17px; }

/* حروف: the honeycomb and the buzzer */
.hr-demo { max-width: 560px; margin: 0 auto; width: 100%; }
.hr-demo .hr-cell.path { animation: hr-glow 1.4s ease-in-out infinite; }
.hr-phone {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(78vw, 280px);
  min-height: 400px;
  margin: 0 auto;
  padding: 26px 18px 30px;
  border: 10px solid #111;
  border-radius: 42px;
  background: var(--bg);
  box-shadow: var(--shadow);
  text-align: center;
}
.hr-phone .hr-buzzer { width: min(56vw, 200px); cursor: default; animation: hr-press 2.4s ease-in-out infinite; }
.hr-phone .hr-buzzer span { font-size: 56px; }
.hr-phone .hr-buzzer small { font-size: 22px; }
@keyframes hr-press { 0%, 70%, 100% { transform: none; } 78% { transform: translateY(8px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); } }

@media (prefers-reduced-motion: reduce) {
  .herd-crowd span, .tc-demo .tc-clock.active, .sj-demo .sj-tile.hot, .hr-demo .hr-cell.path, .hr-phone .hr-buzzer { animation: none; }
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.brand { font-weight: 800; font-size: 20px; margin-inline-end: auto; }

/* ---------- Lobby (host) ---------- */

.lobby { display: grid; gap: 16px; }
@media (min-width: 860px) {
  .lobby { grid-template-columns: 1fr 1.2fr; grid-template-rows: auto 1fr; align-items: start; }
  /* «بطل السهرة» sits under the QR code, beside the settings. */
  .lobby > :nth-child(2) { grid-row: span 2; }
  .lobby > #night-card { grid-column: 1; }
}
.join-card { text-align: center; }
.sj-nophones { display: flex; flex-direction: column; gap: 12px; text-align: start; }
.sj-nophones h2 { text-align: center; }
.sj-nophones .muted { text-align: center; margin: 0; }
.sj-team-name input { font-size: 20px; font-weight: 800; }
.sj-team-name.red input { border-color: var(--red); }
.sj-team-name.blue input { border-color: var(--blue); }
.sj-nophones .link-btn { align-self: center; }
.sj-nophones-btn { margin: 4px 0 8px; }
.qr {
  background: #fff;
  border-radius: 16px;
  padding: 12px;
  width: min(320px, 100%);
  margin: 0 auto 16px;
}
.qr svg { display: block; width: 100%; height: auto; }
.big-code { display: flex; flex-direction: column; align-items: center; margin-bottom: 8px; }
.big-code small { color: var(--muted); }
.big-code b { font-size: 56px; letter-spacing: 0.15em; line-height: 1.1; direction: ltr; }
.link-btn {
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  direction: ltr;
  cursor: pointer;
  text-decoration: underline dotted;
  overflow-wrap: anywhere;
}
.count {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 16px;
}
.settings { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.settings .wide { grid-column: 1 / -1; }
.rules { margin: 4px 0 12px; }
.rules summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.rules-list { padding-inline-start: 20px; margin: 8px 0 0; }
.rules-list li { margin-bottom: 6px; }

/* ---------- Chips ---------- */

.chips { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.chips.center { justify-content: center; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--card-strong);
  border: 1px solid var(--line);
  font-weight: 700;
  animation: pop 0.25s ease;
}
.chip.done { background: var(--good-soft); border-color: var(--good); }
.chip.away { opacity: 0.45; }
.chip .x {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.chips .empty { color: var(--muted); }

/* ---------- Stage (question / reveal / results) ---------- */

.stage { display: flex; flex-direction: column; }
.question {
  text-align: center;
  font-size: clamp(26px, 6vw, 40px);
  font-weight: 800;
  margin: 8px 0 20px;
}
.host .question { font-size: clamp(32px, 5vw, 64px); }
.question.small, .host .question.small { font-size: clamp(20px, 3vw, 28px); color: var(--muted); }

.timer {
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
  border: 4px solid var(--accent);
}
.timer.urgent { border-color: var(--bad); color: var(--bad); animation: pulse 1s infinite; }

.stage > h2.center { margin-top: 28px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 20px; }
.actions .btn { min-width: 180px; }

/* ---------- Answer form (player) ---------- */

.answer-form { display: flex; flex-direction: column; gap: 10px; }
.step { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.step-num {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
}
.bets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; direction: ltr; }
.bet-btn {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}
.bet-btn.picked { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: scale(1.06); }
.bet-btn.used { opacity: 0.25; text-decoration: line-through; cursor: not-allowed; }
.answer-input { font-size: 22px; padding: 14px 16px; }

.sent { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.my-answer { font-size: 30px; font-weight: 800; }
.big-emoji { font-size: 56px; line-height: 1.1; }

/* ---------- Groups ---------- */

.groups { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.group {
  position: relative;
  flex: 1 1 230px;
  max-width: 340px;
  text-align: start;
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  animation: pop 0.3s ease;
}
.group.editable { cursor: pointer; padding-bottom: 52px; }
.group.editable:hover { background: var(--card-strong); }
.group.editable:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.group.rejected { opacity: 0.55; border-style: dashed; }
.group.rejected .group-text { text-decoration: line-through; }
.rejected-label { margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--bad); }
.card-actions { position: absolute; inset-inline-start: 12px; bottom: 12px; display: flex; gap: 6px; }
.reject-btn, .vote-btn {
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.reject-btn:hover { border-color: var(--bad); }
.vote-btn:hover { border-color: var(--accent); }
.voting-label { margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--accent); }

.vote-panel {
  margin: 0 auto 16px;
  width: 100%;
  max-width: 640px;
  padding: 16px;
  border-radius: var(--radius);
  border: 2px solid var(--accent);
  background: rgba(255, 210, 63, 0.08);
  text-align: center;
}
.vote-panel h3 { margin-bottom: 6px; }
.vote-panel .actions { margin-top: 8px; }
.vote-title { font-size: 28px; font-weight: 800; text-align: center; margin-top: 8px; }
.vote-answer { font-size: 34px; font-weight: 800; text-align: center; margin: 4px 0 16px; color: var(--accent); }
.vote-choices { display: grid; gap: 10px; margin-bottom: 8px; }
.vote-choice.keep.picked { background: var(--good); color: #00321f; border-color: transparent; }
.vote-choice.reject.picked { background: var(--bad); color: #fff; border-color: transparent; }
.group.winner { border-color: var(--good); background: var(--good-soft); }
.group.selected { outline: 3px dashed var(--accent); outline-offset: 3px; }
.group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.group-text { font-size: 24px; font-weight: 800; flex: 1; overflow-wrap: anywhere; }
.size {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--card-strong);
  font-size: 18px;
  font-weight: 800;
}
.winner .size { background: var(--good); color: #00321f; }
.members { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.members li { display: flex; align-items: center; gap: 8px; }
.member-name { flex: 1; }
.member-text { color: var(--muted); font-size: 14px; }
.bet, .gain, .points { direction: ltr; unicode-bidi: isolate; }
.bet {
  min-width: 34px;
  text-align: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--card-strong);
  font-weight: 800;
}
.bet.won { background: var(--good); color: #00321f; }
.bet.lost { text-decoration: line-through; opacity: 0.6; }
.crown { margin-top: 8px; font-size: 14px; font-weight: 700; color: var(--good); }

/* ---------- Results & standings ---------- */

.verdict {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  padding: 24px 16px;
  border-radius: var(--radius);
  background: var(--card);
  margin-bottom: 16px;
  animation: pop 0.35s ease;
}
.verdict.good { background: var(--good-soft); border: 2px solid var(--good); }
.verdict.bad { background: var(--bad-soft); border: 2px solid var(--bad); }
.points { font-size: 56px; color: var(--good); line-height: 1.1; }
.verdict-note { font-size: 18px; font-weight: 500; color: var(--muted); margin-top: 6px; }
.missed { margin-top: 16px; }

.score-card { display: flex; justify-content: space-around; gap: 16px; text-align: center; margin-bottom: 16px; width: 100%; }
.score-card small { display: block; color: var(--muted); }
.score-card b { font-size: 32px; }

.standings { list-style: none; padding: 0; margin: 0 auto; width: 100%; max-width: 560px; }
.standings li {
  text-align: start;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 6px;
  border-radius: 12px;
  background: var(--card);
}
.standings li.me { outline: 2px solid var(--accent); }
.standings .rank { width: 32px; text-align: center; font-weight: 800; font-size: 18px; }
.standings .name { flex: 1; font-weight: 700; }
.standings .gain { color: var(--good); font-weight: 700; }
.standings .score { font-size: 22px; font-weight: 800; min-width: 40px; text-align: center; }
details.card summary { cursor: pointer; font-weight: 700; }
details.card[open] summary { margin-bottom: 10px; }

.final { align-items: center; text-align: center; }
.trophy { font-size: 96px; line-height: 1.1; animation: bounce 1.6s ease infinite; }
.winner-name { font-size: clamp(32px, 6vw, 56px); color: var(--accent); }

.wave { font-size: 72px; text-align: center; animation: wave 1.8s ease infinite; transform-origin: 70% 70%; }
.spinner {
  width: 48px;
  height: 48px;
  margin: 16px auto;
  border-radius: 50%;
  border: 5px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.confetti span {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: fall linear infinite;
}
.final > :not(.confetti) { position: relative; z-index: 1; }

/* ---------- Game picker (host lobby) ---------- */

.game-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.game-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 8px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  cursor: pointer;
}
.game-option.picked { border-color: var(--accent); background: rgba(255, 210, 63, 0.12); }
@media (max-width: 480px) { .game-option { flex-direction: column; gap: 2px; font-size: 14px; } }
.game-emoji { font-size: 26px; line-height: 1; }
.pill-btn { border: 0; color: inherit; font: inherit; cursor: pointer; }
.inline-link { color: var(--accent); font-weight: 700; }

/* ---------- «تحدي الوقت» ---------- */

.tc-teams-head { margin-bottom: 10px; }
.tc-teams-head h2 { margin: 0; margin-inline-end: auto; }
.tc-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tc-team { border-radius: 16px; padding: 12px; border: 2px solid; min-width: 0; }
.tc-team.red, .tc-myteam.red, .tc-score-team.red, .tc-verdict.red { border-color: var(--red); background: var(--red-soft); }
.tc-team.blue, .tc-myteam.blue, .tc-score-team.blue, .tc-verdict.blue { border-color: var(--blue); background: var(--blue-soft); }
.tc-team h3 { display: flex; align-items: center; gap: 8px; font-size: 17px; margin-bottom: 10px; }
.tc-team .chips { margin: 0; }
.chip-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.team-pill.red { background: var(--red-soft); border: 1px solid var(--red); }
.team-pill.blue { background: var(--blue-soft); border: 1px solid var(--blue); }

.tc-stage { align-items: stretch; }
.tc-big-emoji { font-size: 84px; text-align: center; line-height: 1.2; }
.tc-big-emoji.spin { animation: spin 3s linear infinite; width: fit-content; margin: 0 auto; }
.tc-main-btn { max-width: 420px; }

.tc-myteam { text-align: center; padding: 16px; border-radius: var(--radius); border: 3px solid; margin-bottom: 16px; }
.tc-myteam small { color: var(--muted); font-weight: 700; }
.tc-myteam b { display: block; font-size: 30px; }
.tc-mates { color: var(--muted); }

/* Score */
.tc-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; width: 100%; max-width: 640px; margin: 0 auto 16px; }
.tc-score-team { display: flex; flex-direction: column; align-items: center; padding: 8px; border-radius: 16px; border: 2px solid; font-weight: 700; }
.tc-score-team b { font-size: 44px; line-height: 1.1; }
.tc-score-mid { color: var(--muted); font-size: 13px; text-align: center; max-width: 90px; line-height: 1.4; }

/* Clocks */
.tc-clocks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 720px; margin: 0 auto 12px; }
.tc-clock {
  padding: 8px 12px 10px;
  border-radius: 18px;
  border: 3px solid var(--line);
  background: var(--card);
  text-align: center;
  opacity: 0.55;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.tc-clock.red { border-color: rgba(255, 77, 109, 0.5); }
.tc-clock.blue { border-color: rgba(63, 162, 255, 0.5); }
.tc-clock.active { opacity: 1; transform: scale(1.03); }
.tc-clock.red.active { border-color: var(--red); background: var(--red-soft); box-shadow: 0 0 28px rgba(255, 77, 109, 0.45); }
.tc-clock.blue.active { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 28px rgba(63, 162, 255, 0.45); }
.tc-clock.mine .tc-clock-name { color: var(--accent); }
.tc-clock-name { font-weight: 700; font-size: 15px; }
.tc-clock-name small { font-size: 13px; }
.tc-clock-player { font-size: clamp(18px, 3vw, 24px); font-weight: 800; margin-top: 2px; }
.tc-duel { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px auto 12px; flex-wrap: wrap; }
.tc-duel-side { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 120px; padding: 10px 16px; border-radius: 16px; border: 2px solid transparent; }
.tc-duel-side.red { background: var(--red-soft); border-color: var(--red); }
.tc-duel-side.blue { background: var(--blue-soft); border-color: var(--blue); }
.tc-duel-side.me { outline: 3px solid var(--accent); outline-offset: 2px; }
.tc-duel-side small { color: var(--muted); font-weight: 700; }
.tc-duel-side b { font-size: clamp(20px, 3.4vw, 30px); }
.tc-duel-side select { font: inherit; font-size: clamp(18px, 3vw, 26px); font-weight: 800; background: transparent; color: var(--text); border: 0; text-align: center; cursor: pointer; }
.tc-duel-side select option { color: #111; }
.tc-duel-vs { font-weight: 800; color: var(--muted); }
.tc-duel-note { text-align: center; font-weight: 700; margin: 0 0 8px; }
.tc-duel-note.mine { color: var(--accent); font-size: 20px; }
.tc-clock-time { font-size: clamp(40px, 9vw, 76px); font-weight: 800; line-height: 1.1; direction: ltr; font-variant-numeric: tabular-nums; }
.tc-clock.urgent .tc-clock-time { color: var(--bad); animation: pulse 1s infinite; }
.tc-clock-bar { height: 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.3); overflow: hidden; }
.tc-clock-bar span { display: block; height: 100%; border-radius: inherit; }
.tc-clock.red .tc-clock-bar span { background: var(--red); }
.tc-clock.blue .tc-clock-bar span { background: var(--blue); }

/* Turn banner (phones) */
.tc-turn { text-align: center; font-size: 20px; font-weight: 800; padding: 10px; border-radius: 14px; margin-bottom: 12px; background: var(--card-strong); }
.tc-turn.red { background: var(--red-soft); border: 2px solid var(--red); }
.tc-turn.blue { background: var(--blue-soft); border: 2px solid var(--blue); }
.tc-turn.mine { background: var(--accent); color: var(--accent-ink); border: 0; animation: nudge 1.2s ease infinite; }

/* Card faces */
.tc-round-head { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tc-round-head .category-tag { margin: 0; font-size: 18px; color: var(--text); }
.tc-card { position: relative; width: 100%; max-width: min(720px, calc(44vh * 4 / 3)); margin: 8px auto 12px; }
.host .tc-card { max-width: min(720px, calc(36vh * 4 / 3)); }
.tc-card .tc-face { animation: card-in 0.18s ease; }
.tc-face {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 20px;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.tc-face img { display: block; width: 100%; height: 100%; object-fit: contain; }
.tc-face.map img, .tc-face.flag img { object-fit: cover; }
.tc-face.flag { background: #333; }
.tc-face.flag.hidden img { transform: scale(2.6); }
.tc-face.emoji, .tc-face.text { background: var(--card-strong); border: 1px solid var(--line); padding: 16px; text-align: center; }
.tc-face.emoji { font-size: clamp(56px, 14vw, 140px); line-height: 1.25; letter-spacing: 0.05em; }
.tc-face.text { font-size: clamp(30px, 6.5vw, 68px); font-weight: 800; line-height: 1.35; }
.tc-face.text.short { font-size: clamp(56px, 13vw, 120px); }
.tc-face.text.long { font-size: clamp(22px, 4.5vw, 44px); }
.tc-broken { color: #444; font-size: 20px; font-weight: 700; padding: 16px; text-align: center; }
.tc-paused {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: rgba(21, 12, 44, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 30px;
  font-weight: 800;
}
.host .tc-paused { align-items: start; padding-top: 12px; background: rgba(21, 12, 44, 0.35); backdrop-filter: none; -webkit-backdrop-filter: none; }

/* Answer and judge buttons (host) */
.tc-answer {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: 0 auto 12px;
  padding: 8px 16px;
  border-radius: 16px;
  border: 2px dashed var(--accent);
  background: rgba(255, 210, 63, 0.1);
  color: var(--text);
  font: inherit;
  text-align: center;
  cursor: pointer;
}
.tc-answer small { display: block; color: var(--muted); font-size: 14px; }
.tc-answer b { display: block; font-size: clamp(26px, 4vw, 42px); color: var(--accent); line-height: 1.25; }
.tc-alt { display: block; color: var(--muted); font-size: 15px; }
.tc-answer.masked b, .tc-answer.masked .tc-alt { filter: blur(14px); user-select: none; }
.tc-judge { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; width: 100%; max-width: 720px; margin: 0 auto; }
.tc-judge .btn { min-height: 76px; font-size: 26px; }
.tc-judge small { font-size: 15px; opacity: 0.8; }
.btn.tc-correct { background: var(--good); color: #00321f; border-color: transparent; }
.tc-tools { margin-top: 12px; }
.tc-tools .btn { min-width: 120px; }
.kbd-hint { margin: 10px 0 0; }
@media (hover: none) { .kbd-hint { display: none; } }

/* Wheel */
.tc-wheel { position: relative; width: min(86vw, 50vh, 460px); aspect-ratio: 1; margin: 12px auto 16px; }
.tc-wheel-clip { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 6px #fff, var(--shadow); }
.tc-wheel-disk { width: 100%; height: 100%; }
.tc-wheel-disk svg { display: block; width: 100%; height: 100%; }
.tc-wheel-pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  border-inline: 16px solid transparent;
  border-top: 30px solid #fff;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.45));
}
.tc-wheel-hub {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 17%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 4px solid #fff;
  background: var(--bg);
  font-size: clamp(18px, 4vw, 30px);
}
.tc-landed { text-align: center; min-height: 64px; }
.tc-landed-name { font-size: clamp(30px, 6vw, 52px); font-weight: 800; color: var(--accent); animation: pop 0.35s ease; }
.tc-landed .actions { margin-top: 8px; }
.tc-preload { text-align: center; color: var(--muted); font-size: 14px; margin-top: 8px; }

/* Round recap */
.tc-verdict { border: 2px solid; }
.tc-verdict.draw { border-color: var(--line); }
.tc-recap-title { margin-top: 24px; text-align: center; }
.tc-recap { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tc-recap-item { margin: 0; padding: 6px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); min-width: 0; }
.tc-recap-item.red { border-color: rgba(255, 77, 109, 0.7); }
.tc-recap-item.blue { border-color: rgba(63, 162, 255, 0.7); }
.tc-recap-item.skip, .tc-recap-item.stuck { opacity: 0.7; }
.tc-recap-item .tc-face { border-radius: 12px; box-shadow: none; padding: 6px; }
.tc-recap-item .tc-face.flag, .tc-recap-item .tc-face.image, .tc-recap-item .tc-face.map { padding: 0; }
.tc-recap-item .tc-face.emoji { font-size: 34px; }
.tc-recap-item .tc-face.text { font-size: 17px; }
.tc-recap-item .tc-broken { font-size: 13px; }
.tc-recap-item figcaption { display: flex; align-items: center; gap: 6px; padding: 6px 4px 2px; font-size: 15px; line-height: 1.3; }
.tc-recap-mark { flex: none; }

/* Preview page */
.preview-cats { position: sticky; top: 0; z-index: 3; padding: 10px 0; background: var(--bg); }
.preview-cats .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0; padding-bottom: 4px; }
.preview-cats .category-chip { flex: none; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.preview-item { margin: 0; padding: 6px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.preview-item .tc-face { border-radius: 12px; box-shadow: none; }
.preview-item .tc-face.emoji { font-size: 40px; }
.preview-item .tc-face.text { font-size: 20px; }
.preview-item figcaption { padding: 6px 4px 2px; }
.preview-item figcaption small { display: block; color: var(--muted); direction: ltr; text-align: right; overflow-wrap: anywhere; }
.preview-item.broken { border-color: var(--bad); background: var(--bad-soft); }
.preview-item.excluded { border-color: var(--bad); }
.preview-item.excluded .tc-face { opacity: 0.35; }
.exclude-btn {
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.exclude-btn.on { border-color: var(--bad); color: var(--text); }
.broken-list { padding-inline-start: 20px; margin: 8px 0 0; }
.tc-cat-details summary { cursor: pointer; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.tc-cat-details summary b { color: var(--text); }
.tc-cat-details .field-head { margin-bottom: 10px; }
.tc-cat-details .inline-link { margin-inline-end: auto; font-size: 14px; }

/* ---------- «سين جيم» ---------- */

.sj-stage { align-items: stretch; }
.sj-score { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 760px; margin: 0 auto 12px; }
.sj-score-team { padding: 8px 12px; border-radius: 16px; border: 2px solid; text-align: center; opacity: 0.75; transition: opacity 0.2s ease, transform 0.2s ease; }
.sj-score-team.red { border-color: var(--red); background: var(--red-soft); }
.sj-score-team.blue { border-color: var(--blue); background: var(--blue-soft); }
.sj-score-team.active { opacity: 1; transform: scale(1.03); box-shadow: 0 0 24px rgba(255, 255, 255, 0.12); }
.sj-score-team.mine .sj-score-name { color: var(--accent); }
.sj-score-name { font-weight: 700; font-size: 15px; }
.sj-score-points { font-size: clamp(32px, 6vw, 52px); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sj-lifelines { display: flex; justify-content: center; gap: 6px; font-size: 20px; }
.sj-score.compact .sj-score-team { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 12px; }
.sj-score.compact .sj-score-points { font-size: 26px; }
.sj-score.compact .sj-lifelines { font-size: 16px; gap: 3px; }
.sj-life.used { opacity: 0.25; filter: grayscale(1); text-decoration: line-through; }

.sj-turn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin: 0 auto 12px;
  width: 100%;
  max-width: 760px;
  border-radius: 14px;
  border: 2px solid;
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}
.sj-turn.red { border-color: var(--red); background: var(--red-soft); }
.sj-turn.blue { border-color: var(--blue); background: var(--blue-soft); }
.sj-turn .timer, .tc-turn .timer { width: 54px; height: 54px; margin: 0; font-size: 22px; border-width: 3px; }
.tc-turn { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }

.sj-board { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; width: 100%; max-width: 1060px; margin: 0 auto; }
.sj-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sj-cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 84px;
  padding: 6px 4px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--card-strong);
  font-weight: 800;
  font-size: 15px;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}
.sj-cat-emoji { font-size: 26px; line-height: 1.1; }
.sj-tile {
  display: grid;
  place-items: center;
  min-height: 52px;
  border-radius: 12px;
  border: 2px solid rgba(255, 210, 63, 0.6);
  background: linear-gradient(180deg, rgba(255, 210, 63, 0.22), rgba(255, 210, 63, 0.08));
  color: var(--accent);
  font: inherit;
  font-size: clamp(16px, 2.4vw, 26px);
  font-weight: 800;
  direction: ltr;
}
button.sj-tile { cursor: pointer; transition: transform 0.08s ease, filter 0.15s ease; }
button.sj-tile:hover { filter: brightness(1.2); }
button.sj-tile:active { transform: scale(0.96); }
.sj-tile.played { color: rgba(255, 255, 255, 0.35); border-color: var(--line); background: rgba(0, 0, 0, 0.2); text-decoration: line-through; }
.sj-tile.won-red { background: var(--red-soft); border-color: rgba(255, 77, 109, 0.5); }
.sj-tile.won-blue { background: var(--blue-soft); border-color: rgba(63, 162, 255, 0.5); }

.sj-picked { text-align: center; padding: 18px; margin: 0 auto 14px; width: 100%; border-radius: var(--radius); border: 3px solid; animation: pop 0.3s ease; }
.sj-picked.red { border-color: var(--red); background: var(--red-soft); }
.sj-picked.blue { border-color: var(--blue); background: var(--blue-soft); }
.sj-picked-cat { font-size: 24px; font-weight: 800; }
.sj-picked-value { font-size: clamp(56px, 12vw, 96px); font-weight: 800; color: var(--accent); line-height: 1.1; direction: ltr; }
.sj-life-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 4px 0 14px; }
.sj-life-btn { min-width: 160px; }
.sj-life-btn.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.sj-life-btn small { font-size: 12px; opacity: 0.8; }

.sj-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-bottom: 10px; }
.sj-head-cat { font-weight: 800; font-size: 18px; }
.sj-head-value { padding: 2px 12px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 800; direction: ltr; }
.sj-badge { padding: 2px 10px; border-radius: 999px; border: 1px solid var(--accent); font-size: 14px; }

.sj-question { width: 100%; max-width: 820px; margin: 0 auto 12px; text-align: center; animation: card-in 0.2s ease; }
.sj-q { font-size: clamp(24px, 4.2vw, 46px); font-weight: 800; line-height: 1.4; padding: 10px 6px; }
.player .sj-q { font-size: clamp(22px, 6vw, 30px); }
.player .sj-img { max-width: min(560px, calc(42vh * 4 / 3)); }
.sj-img { display: grid; place-items: center; width: 100%; max-width: min(560px, calc(30vh * 4 / 3)); aspect-ratio: 4 / 3; margin: 0 auto 6px; border-radius: 18px; background: #fff; overflow: hidden; }
.sj-img img { width: 100%; height: 100%; object-fit: contain; }
.sj-question.with-img .sj-q { font-size: clamp(20px, 3vw, 30px); }

.sj-result { text-align: center; padding: 14px; margin: 0 auto 12px; width: 100%; max-width: 760px; border-radius: var(--radius); border: 2px solid var(--line); font-size: clamp(24px, 4vw, 36px); font-weight: 800; animation: pop 0.3s ease; }
.sj-result.red { border-color: var(--red); background: var(--red-soft); }
.sj-result.blue { border-color: var(--blue); background: var(--blue-soft); }
.sj-result.none { background: var(--card); }
.sj-result-pit { font-size: 0.7em; color: var(--muted); }
.sj-reveal { text-align: center; padding: 14px; margin-bottom: 12px; border-radius: var(--radius); border: 2px solid var(--accent); background: rgba(255, 210, 63, 0.1); }
.sj-reveal small { display: block; color: var(--muted); }
.sj-reveal b { font-size: clamp(26px, 7vw, 40px); color: var(--accent); }
.sj-reveal.good { border-color: var(--good); background: var(--good-soft); }
.sj-reveal.bad { border-color: var(--bad); background: var(--bad-soft); }
.category-chip.full { opacity: 0.45; }

@media (max-width: 560px) {
  .sj-board { gap: 4px; }
  .sj-cat { height: 64px; font-size: 11px; padding: 4px 2px; }
  .sj-score.compact .sj-score-team { flex-wrap: wrap; justify-content: center; }
  .sj-cat-emoji { font-size: 20px; }
  .sj-tile { min-height: 36px; border-radius: 8px; font-size: 13px; }
  .sj-score-points { font-size: 30px; }
  .sj-lifelines { font-size: 16px; }
}

/* ---------- «حروف» ---------- */

.hr-stage { align-items: stretch; }
.hr-main { width: 100%; max-width: min(640px, calc(62vh * 1.19)); margin: 0 auto; }
.hr-split { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) {
  .hr-split { grid-template-columns: 1.1fr 1fr; }
  .hr-split .hr-main { max-width: 100%; }
}
.hr-frame {
  direction: ltr;
  padding: 10px 12px;
  border-radius: 18px;
  border-style: solid;
  border-width: 12px 14px;
  border-color: var(--blue) var(--red);
  background: rgba(0, 0, 0, 0.25);
}
.hr-board { position: relative; width: 100%; aspect-ratio: 5.5 / 4.6188; container-type: inline-size; }
.hr-cell {
  position: absolute;
  width: 18.1818%;
  height: 25%;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(160deg, #ffe27a, #f5b922);
  color: #3a2600;
  font: inherit;
  transform: scale(0.94);
  transition: transform 0.12s ease, filter 0.15s ease, background 0.25s ease;
}
.hr-cell span { font-size: 8.5cqw; font-weight: 800; line-height: 1; }
button.hr-cell { cursor: pointer; }
button.hr-cell:hover { filter: brightness(1.1); transform: scale(0.98); }
.hr-cell.red { background: linear-gradient(160deg, #ff7088, #d92c4c); color: #fff; }
.hr-cell.blue { background: linear-gradient(160deg, #6cb9ff, #1f7fe0); color: #fff; }
.hr-cell.current { animation: hr-glow 1s ease-in-out infinite; z-index: 1; }
.hr-cell.path { filter: brightness(1.15) saturate(1.2); transform: scale(1); }
.hr-sides { text-align: center; color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.hr-sides .red { color: #ff8da0; }
.hr-sides .blue { color: #8cc8ff; }
.hr-panel { display: flex; flex-direction: column; gap: 10px; text-align: center; }
.hr-big-letter {
  width: 120px;
  height: 138px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(160deg, #ffe27a, #f5b922);
  color: #3a2600;
  animation: pop 0.3s ease;
}
.hr-big-letter span { font-size: 64px; font-weight: 800; line-height: 1; }
.player .hr-big-letter { width: 90px; height: 104px; }
.player .hr-big-letter span { font-size: 48px; }
.hr-q { font-size: clamp(22px, 3vw, 36px); }
.hr-status { font-weight: 700; color: var(--accent); }
.hr-buzzed { font-size: 22px; animation: pop 0.25s ease; }
.hr-manual { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.team-btn.red { border-color: var(--red); background: var(--red-soft); }
.team-btn.blue { border-color: var(--blue); background: var(--blue-soft); }
.hr-mini { max-width: 300px; margin: 12px auto 0; width: 100%; }
.hr-mini .hr-frame { border-width: 6px 7px; padding: 4px 6px; border-radius: 12px; }

.hr-buzzer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: min(72vw, 260px);
  aspect-ratio: 1;
  margin: 10px auto 4px;
  border-radius: 50%;
  border: 8px solid rgba(255, 255, 255, 0.85);
  color: #fff;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.35), 0 16px 40px rgba(0, 0, 0, 0.4);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.hr-buzzer span { font-size: 72px; line-height: 1; }
.hr-buzzer small { font-size: 26px; font-weight: 800; }
.hr-buzzer.red { background: radial-gradient(circle at 35% 30%, #ff8095, #d61f42); }
.hr-buzzer.blue { background: radial-gradient(circle at 35% 30%, #7cc2ff, #1468c8); }
.hr-buzzer.pressed { transform: translateY(8px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.4); }
.hr-buzzer.late { filter: grayscale(0.7) brightness(0.8); }
.hr-buzzer.locked { background: var(--card-strong); border-color: var(--line); box-shadow: none; cursor: default; padding: 20px; text-align: center; }
.hr-buzzer.locked small { font-size: 16px; font-weight: 700; }
@keyframes hr-glow { 50% { filter: brightness(1.35); transform: scale(1.02); } }

.calm .group, .calm .chip, .calm .verdict { animation: none; }

@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 50% { transform: scale(1.08); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce { 50% { transform: translateY(-10px); } }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 20% { transform: rotate(16deg); } 40% { transform: rotate(-10deg); } }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
@keyframes nudge { 50% { transform: scale(1.03); } }
@keyframes card-in { from { transform: scale(0.94); opacity: 0.4; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}

/* ---------- Motion: screens and pages slide in (showScreen in common.js) ---------- */

/* Only the screen moves; the background and the top bar stay put. Named only
   while it moves, since a named element would stop the cards' backdrop blur. */
:root[data-motion] #app > main { view-transition-name: screen; }
::view-transition-group(screen) { animation-duration: 0.26s; animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
::view-transition-old(screen) { animation: vt-out 0.18s ease both; }
::view-transition-new(screen) { animation: vt-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
:root[data-motion="start"]::view-transition-new(screen) { animation: vt-zoom 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
:root[data-motion="final"]::view-transition-new(screen) { animation: vt-zoom 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes vt-out { to { opacity: 0; transform: scale(0.98); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes vt-zoom { from { opacity: 0; transform: scale(0.92); } }

/* Between pages of the site, and a game's name flies from its home tile to its page. */
@view-transition { navigation: auto; }
.game-tile[data-theme="herd"] b, body[data-theme="herd"] .landing-intro h1 { view-transition-name: title-herd; }
.game-tile[data-theme="time"] b, body[data-theme="time"] .landing-intro h1 { view-transition-name: title-time; }
.game-tile[data-theme="seen"] b, body[data-theme="seen"] .landing-intro h1 { view-transition-name: title-seen; }
.game-tile[data-theme="letters"] b, body[data-theme="letters"] .landing-intro h1 { view-transition-name: title-letters; }
.game-tile[data-theme="outsider"] b, body[data-theme="outsider"] .landing-intro h1 { view-transition-name: title-outsider; }
.game-tile[data-theme="mafia"] b, body[data-theme="mafia"] .landing-intro h1 { view-transition-name: title-mafia; }
.game-tile[data-theme="feud"] b, body[data-theme="feud"] .landing-intro h1 { view-transition-name: title-feud; }

/* The home tiles and a game page's intro rise in one after another. */
.game-tile, .landing-intro > *, .landing-visual { animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
.game-tile:nth-child(2), .landing-intro > :nth-child(2) { animation-delay: 50ms; }
.game-tile:nth-child(3), .landing-intro > :nth-child(3) { animation-delay: 100ms; }
.game-tile:nth-child(4), .landing-intro > :nth-child(4), .landing-visual { animation-delay: 150ms; }
.game-tile:nth-child(5), .landing-intro > :nth-child(5) { animation-delay: 200ms; }
.game-tile:nth-child(6), .landing-intro > :nth-child(6) { animation-delay: 250ms; }
.game-tile:nth-child(7), .landing-intro > :nth-child(7) { animation-delay: 300ms; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* A score that just changed pops (bumpChanges in common.js). */
.bump { animation: bump 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes bump { 35% { transform: scale(1.3); color: var(--accent); } }
@keyframes fade-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- Sound switches ---------- */

.sound-dock {
  position: fixed;
  inset-inline-end: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  gap: 8px;
}
.dock-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  font-size: 20px;
  cursor: pointer;
  opacity: 0.55;
  backdrop-filter: blur(6px);
  transition: opacity 0.15s ease, transform 0.08s ease;
}
.dock-btn.on { opacity: 1; }
.dock-btn:hover { opacity: 1; }
.dock-btn:active { transform: scale(0.94); }

/* ---------- «بطل السهرة» ---------- */

.night-card .field-head h2 { margin: 0; }
.night-card .hint { margin: 4px 0 12px; }
.night-card.compact { width: 100%; max-width: 560px; margin: 24px auto 0; text-align: start; }
.night-card.compact .hint { display: none; }
.night-list li { background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.night-list li:first-child { border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); }
.night-wins { color: var(--muted); font-size: 14px; font-weight: 700; }
.night-crown-btn { margin-top: 14px; }
.night-me {
  margin: 0 auto 12px;
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-size: 15px;
  text-align: center;
}
.night-me b { color: var(--accent); }

.crown-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--accent) 30%, var(--bg)), var(--bg) 70%);
  animation: pop 0.35s ease;
}
.crown-box { position: relative; z-index: 1; width: 100%; max-width: 560px; text-align: center; }
.crown-emoji { font-size: clamp(80px, 18vw, 140px); line-height: 1; animation: bounce 1.6s ease infinite; }
.crown-kicker { margin: 6px 0 0; color: var(--accent); font-size: 20px; font-weight: 800; }
.crown-box h1 { font-size: clamp(36px, 8vw, 64px); margin: 4px 0; }
.crown-box .night-list { margin: 18px auto 8px; text-align: start; }

/* ---------- «برا السالفة» ---------- */

.os-stage { align-items: stretch; text-align: center; gap: 4px; }
.os-head { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 8px; }
.os-head small { color: var(--muted); }
.os-category { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; border-radius: 999px; background: var(--card-strong); font-size: 20px; }
.os-category span { font-size: 26px; }
.os-big { font-size: 84px; line-height: 1.1; text-align: center; animation: bounce 1.6s ease infinite; }
.os-pair { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 18px 0; }
.os-person { display: flex; flex-direction: column; gap: 4px; padding: 22px 12px; border-radius: var(--radius); background: var(--card-strong); border: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); animation: pop 0.3s ease; }
.os-person small { color: var(--muted); font-size: 16px; }
.os-person b { font-size: clamp(30px, 6vw, 54px); line-height: 1.2; overflow-wrap: anywhere; }
.os-arrow { font-size: 44px; color: var(--accent); }
.os-voters .chip { font-size: 18px; }
.os-voters .chip.done { border-color: var(--good); background: var(--good-soft); }
.os-turn { font-size: 20px; margin-bottom: 12px; }

.os-card {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 230px;
  margin: 12px 0;
  padding: 0;
  border: 2px dashed color-mix(in srgb, var(--accent) 60%, transparent);
  border-radius: 24px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.os-card > div { grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 20px; }
.os-card-face { visibility: hidden; }
.os-card.open { border-style: solid; background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.os-card.open .os-card-face { visibility: visible; }
.os-card.open .os-card-cover { visibility: hidden; }
.os-card-emoji { font-size: 56px; line-height: 1.1; }
.os-card-cover b { font-size: 20px; }
.os-card small { color: var(--muted); font-size: 15px; }
.os-card-word { font-size: clamp(34px, 9vw, 52px); line-height: 1.2; color: var(--accent); }
.os-card-cat { margin-top: 6px; }

.os-vote-grid, .os-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.os-vote-grid .btn, .os-choices .btn { margin: 0; font-size: 18px; min-height: 60px; }
.os-vote-btn.picked { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.os-outsider { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 10px auto; padding: 14px 18px; border-radius: var(--radius); border: 3px solid; max-width: 520px; width: 100%; animation: pop 0.35s ease; }
.os-outsider small { color: var(--muted); }
.os-outsider b { font-size: clamp(28px, 6vw, 44px); line-height: 1.2; }
.os-outsider span { font-weight: 800; font-size: 20px; }
.os-outsider.caught { border-color: var(--good); background: var(--good-soft); }
.os-outsider.escaped { border-color: var(--unicorn); background: var(--unicorn-soft); }
.os-word { display: flex; flex-direction: column; align-items: center; margin: 4px auto 8px; }
.os-word small { color: var(--muted); }
.os-word b { font-size: clamp(40px, 9vw, 72px); line-height: 1.15; color: var(--accent); }
.os-guess.good { color: var(--good); font-weight: 800; }
.os-guess.bad { color: var(--muted); }
.os-waiting { margin: 12px 0; font-size: 20px; font-weight: 700; color: var(--accent); }
.os-tally { list-style: none; width: 100%; max-width: 520px; margin: 10px auto; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.os-tally li { display: grid; grid-template-columns: minmax(80px, 30%) 1fr 32px; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--card); text-align: start; }
.os-tally li.outsider { outline: 2px solid var(--accent); }
.os-tally-name { font-weight: 700; overflow-wrap: anywhere; }
.os-tally-bar { height: 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.3); overflow: hidden; }
.os-tally-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.os-gains { justify-content: center; }
.os-gains b { color: var(--good); }

/* ---------- «مافيا» ---------- */

.mf-stage { align-items: stretch; text-align: center; gap: 6px; }
.mf-big { font-size: 84px; line-height: 1.1; text-align: center; }
.mf-night .mf-big { animation: bounce 2.4s ease infinite; }
.mf-night { --card: rgba(120, 140, 255, 0.06); }
.mf-prompt { font-size: 22px; font-weight: 800; margin: 4px 0 8px; }
.mf-mayor { font-weight: 700; color: var(--accent); }
.mf-players { justify-content: center; margin: 12px 0; }
.mf-players .chip { font-size: 17px; }
.mf-players .chip.dead { opacity: 0.55; text-decoration: line-through; }
.mf-players .chip.me { outline: 2px solid var(--accent); }
.mf-badge { font-weight: 700; color: var(--muted); }
.mf-badge.mafia { color: #ff8a9b; }
.mf-lineup { justify-content: center; }
.mf-chip.mafia { border-color: rgba(244, 63, 94, 0.6); background: rgba(244, 63, 94, 0.14); }
.mf-badge.jester { color: #c4a1ff; }
.mf-chip.jester { border-color: rgba(167, 120, 255, 0.6); background: rgba(167, 120, 255, 0.14); }
.mf-lineup-box { margin: 14px 0; text-align: center; }
.mf-lineup-box b { display: block; margin-bottom: 8px; }
.mf-announce { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 560px; margin: 8px auto; animation: pop 0.35s ease; }
.mf-death, .mf-safe { padding: 16px; border-radius: var(--radius); font-size: clamp(22px, 4.5vw, 32px); font-weight: 800; }
.mf-death { border: 2px solid var(--bad); background: var(--bad-soft); }
.mf-death span { font-size: 0.7em; font-weight: 700; color: var(--muted); }
.mf-safe { border: 2px solid var(--good); background: var(--good-soft); }
.mf-shot { margin: 0; font-weight: 800; color: var(--accent); }
.mf-tally { list-style: none; padding: 0; margin: 4px auto; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 6px; }
.mf-tally li { display: flex; justify-content: space-between; padding: 8px 14px; border-radius: 12px; background: var(--card); }
.mf-team { color: var(--accent) !important; font-weight: 700; }
.mf-plan { margin: 4px 0 2px; padding: 12px 14px; border-color: rgba(244, 63, 94, 0.45); background: rgba(244, 63, 94, 0.08); }
.mf-plan .verdict { margin: 0 0 4px; }
.mf-plan .hint { margin: 0; }
.mf-plan-wait { margin: 0; font-weight: 700; }
.mf-plan-team { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; color: var(--muted); font-size: 15px; }
.mf-plan-team b { color: var(--text); }
.mf-confirm { width: 100%; margin: 0; }
.os-vote-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.os-vote-btn.pointed:not(.picked) { border-color: #ff8a9b; box-shadow: inset 0 0 0 1px #ff8a9b; }
.mf-pointers { font-size: 13px; font-weight: 700; color: #ff8a9b; }
.os-vote-btn.picked .mf-pointers { color: inherit; opacity: 0.85; }
.mf-card .os-card-word { color: var(--accent); }
.btn.ghost.picked { border-color: var(--accent); color: var(--accent); }

/* مافيا: night, the cards and the morning news */
.mf-demo { padding: 22px 16px; border: 1px solid var(--line); border-radius: 26px; background: radial-gradient(circle at 80% 10%, rgba(255, 240, 200, 0.12), transparent 40%), rgba(0, 0, 0, 0.35); text-align: center; }
.mf-demo-moon { font-size: 56px; line-height: 1; text-align: end; }
.mf-demo-cards { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.mf-demo-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 84px; aspect-ratio: 3 / 4; border-radius: 14px; border: 1px solid var(--line); background: var(--card-strong); }
.mf-demo-card span { font-size: 34px; line-height: 1; }
.mf-demo-card b { font-size: 15px; }
.mf-demo-card.bad { border-color: var(--accent); background: rgba(244, 63, 94, 0.18); transform: translateY(-6px); }
.mf-demo-news { padding: 12px 14px; border-radius: 14px; background: var(--good-soft); border: 1px solid var(--good); font-size: 17px; }

/* ---------- «أسئلتكم الخاصة» and «أضف أسئلة» ---------- */

.custom-box { margin: 16px 0; padding: 12px 14px; border: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.custom-box summary { cursor: pointer; font-weight: 800; font-size: 18px; }
.custom-box[open] summary { margin-bottom: 8px; }
.custom-box textarea { width: 100%; margin: 6px 0; }
.custom-box .btn { margin-top: 6px; }
.custom-status { font-weight: 700; color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; cursor: pointer; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.custom-share { display: flex; gap: 8px; margin-top: 8px; }
.custom-share select { flex: 1; min-width: 0; }

.contrib-page { max-width: 760px; }
.contrib-hero { text-align: center; padding: 16px 0 10px; }
.contrib-hero h1 { font-size: clamp(34px, 7vw, 52px); margin-bottom: 4px; }
.contrib-games { margin-bottom: 16px; }
.contrib-card { margin-bottom: 16px; }
.contrib-fields { display: grid; gap: 10px; margin-bottom: 8px; }
@media (min-width: 640px) { .contrib-fields { grid-template-columns: 1fr 1fr; } .contrib-fields .field.wide { grid-column: 1 / -1; } }
.contrib-fields textarea { width: 100%; }
.contrib-queue { padding-inline-start: 22px; margin: 0 0 12px; }
.contrib-queue li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.contrib-queue .x { flex: none; width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--card-strong); color: var(--text); font-size: 18px; cursor: pointer; }
.home-add { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0 auto 22px; }
.home-add .btn { max-width: 420px; width: 100%; }
@media (min-width: 880px) { .home-add .btn { width: auto; flex: 1 1 0; } }

.review-tabs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0 18px; }
.review-group { margin-bottom: 22px; }
.review-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.review-item.card + .review-item.card { margin-top: 0; }
.review-meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.review-text { margin: 0 0 8px; }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.landing-add { margin: 14px 0 0; }
.landing-add a { color: var(--accent); font-weight: 700; }
.category-chip.custom { border-style: dashed; }

/* ---------- «حسابي» ---------- */

.account-auth .review-tabs { margin: 0 0 12px; }
.mcp-url { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--card-strong); }
.mcp-url code { flex: 1; min-width: 0; overflow-wrap: anywhere; direction: ltr; text-align: left; font-size: 15px; }
.mcp-url span { flex: 1; min-width: 0; font-size: 15px; }
.bank-row { padding: 14px; }
.bank-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 8px; }
.bank-state { font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--card-strong); color: var(--muted); }
.bank-state.good { background: var(--good-soft); color: var(--good); }
.bank-details:empty { display: none; }
.bank-details { margin-top: 10px; }
.bank-items { max-height: 340px; overflow-y: auto; }
.bank-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex: none; }
.bank-items li span { flex: 1; }

/* ---------- «بنوكي» in the lobby ---------- */

.banks-box { margin: 16px 0; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.banks-box .field-head { margin-bottom: 8px; }
.banks-box .chips { margin-bottom: 4px; }
.category-chip.bank { border-style: dashed; }
.category-chip.bank:disabled { opacity: 0.45; cursor: not-allowed; }
.banks-login { margin: 12px 0; }
.banks-login a { color: var(--accent); font-weight: 700; }
.group-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.group-row select { flex: 1; min-width: 160px; }
.group-stat b { color: var(--accent); }
.group-line { margin-bottom: 20px; }
.group-top b { color: var(--accent); }
.name-picks { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.name-picks small { width: 100%; color: var(--muted); }
.group-card .group-ranking { margin: 8px 0; max-width: none; }
.group-card .group-ranking li { padding: 6px 10px; }
.group-card .group-members { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0; }
.group-card .group-add { display: flex; gap: 8px; margin: 6px 0; }
.group-card .group-add input { flex: 1; }
.group-card .group-games { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.group-card .group-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.consent .logo { font-size: 48px; }
.consent-who { font-size: 22px; }
.consent-actions { justify-content: center; }
.consent-actions .btn { flex: 1; }

/* ---------- «فاميلي فيود» ---------- */

.ff-stage { gap: 10px; }
.ff-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }
.ff-round-title { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.ff-double { padding: 4px 12px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); animation: pop 0.4s ease; }
.ff-score { display: flex; gap: 10px; justify-content: center; }
.ff-score-team { display: flex; flex-direction: column; align-items: center; min-width: 120px; padding: 8px 16px; border-radius: 16px; border: 2px solid transparent; }
.ff-score-team.red { background: var(--red-soft); border-color: var(--red); }
.ff-score-team.blue { background: var(--blue-soft); border-color: var(--blue); }
.ff-score-team.active { box-shadow: 0 0 0 3px var(--accent); }
.ff-score-team b { font-size: 30px; }
.ff-question { text-align: center; font-size: clamp(24px, 4.2vw, 44px); margin: 4px 0; }
.ff-question.small { font-size: clamp(20px, 6vw, 28px); }
.ff-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; }
.ff-source { font-size: 13px; color: var(--muted); padding: 3px 10px; border-radius: 999px; background: var(--card); }
.ff-source.survey { color: var(--accent); }
.ff-pot { display: flex; align-items: baseline; gap: 6px; font-weight: 800; }
.ff-pot b { font-size: 28px; color: var(--accent); }
.ff-strikes { display: flex; gap: 6px; }
.ff-x { font-size: 30px; font-weight: 900; color: rgba(255, 255, 255, 0.15); line-height: 1; }
.ff-x.on { color: #ef4444; text-shadow: 0 0 12px rgba(239, 68, 68, 0.7); animation: ff-x 0.5s ease; }
@keyframes ff-x { 0% { transform: scale(2.4); opacity: 0; } 60% { transform: scale(0.9); opacity: 1; } 100% { transform: none; } }
.ff-board { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 980px; margin: 4px auto; }
.ff-col { display: flex; flex-direction: column; gap: 8px; }
.ff-slot { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 8px 12px; border-radius: 12px; border: 2px solid rgba(251, 191, 36, 0.45);
  background: linear-gradient(180deg, #1e3a8a, #0b1f5c); color: #fff; font: inherit; font-size: clamp(16px, 2.4vw, 24px); font-weight: 800; text-align: start; }
button.ff-slot { cursor: pointer; }
button.ff-slot:hover { border-color: var(--accent); }
.ff-slot-num { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: rgba(0, 0, 0, 0.35); color: var(--accent); }
.ff-slot-answer { flex: 1; }
.ff-slot-points { min-width: 44px; padding: 4px 8px; border-radius: 8px; text-align: center; background: rgba(0, 0, 0, 0.3); }
.ff-slot.open { background: linear-gradient(180deg, #fde68a, #f59e0b); color: #241600; border-color: #fde68a; animation: ff-flip 0.45s ease; }
.ff-slot.open .ff-slot-num { color: #241600; background: rgba(255, 255, 255, 0.45); }
.ff-slot.peek .ff-slot-answer, .ff-slot.peek .ff-slot-points { opacity: 0.55; font-weight: 600; }
.ff-slot.late { background: rgba(253, 230, 138, 0.14); border-style: dashed; }
.ff-slot.late .ff-slot-answer, .ff-slot.late .ff-slot-points { opacity: 0.8; }
@keyframes ff-flip { 0% { transform: rotateX(90deg); } 100% { transform: none; } }
.ff-status { text-align: center; font-size: 20px; font-weight: 800; padding: 10px; border-radius: 14px; background: var(--card-strong); width: 100%; max-width: 980px; }
.ff-status.red { background: var(--red-soft); border: 2px solid var(--red); }
.ff-status.blue { background: var(--blue-soft); border: 2px solid var(--blue); }
.ff-team-btn.red { background: var(--red-soft); border-color: var(--red); }
.ff-team-btn.blue { background: var(--blue-soft); border-color: var(--blue); }
.ff-miss { background: rgba(239, 68, 68, 0.18); border-color: #ef4444; font-size: 20px; }
.ff-tools { flex-wrap: wrap; }
.ff-peek.on { border-color: var(--accent); color: var(--accent); }
.ff-verdict.red { background: var(--red-soft); border: 2px solid var(--red); }
.ff-verdict.blue { background: var(--blue-soft); border: 2px solid var(--blue); }
.ff-fast-title { font-size: clamp(26px, 4vw, 40px); font-weight: 900; text-align: center; color: var(--accent); }
.ff-fast-live { width: 100%; max-width: 980px; display: flex; flex-direction: column; gap: 10px; padding-inline-start: 20px; }
.ff-fast-live .chips { margin-top: 6px; }
.ff-fast-table { width: 100%; max-width: 980px; border-collapse: separate; border-spacing: 6px; }
.ff-fast-table th { color: var(--muted); font-size: 14px; }
.ff-fast-q { font-weight: 700; }
.ff-fast-cell { padding: 8px 10px; border-radius: 10px; background: linear-gradient(180deg, #fde68a, #f59e0b); color: #241600; }
.ff-fast-cell.zero { background: var(--card-strong); color: var(--text); }
.ff-fast-cell.hidden { background: linear-gradient(180deg, #1e3a8a, #0b1f5c); color: rgba(255, 255, 255, 0.5); text-align: center; }
.ff-fast-cell b { float: inline-end; }
.ff-fast-cell small { display: block; opacity: 0.8; }
.ff-fast-mark { display: block; margin-top: 4px; width: 100%; }
.ff-fast-total { display: flex; align-items: baseline; justify-content: center; gap: 8px; font-weight: 800; }
.ff-fast-total b { font-size: 44px; color: var(--accent); }
.ff-fast-form { display: flex; flex-direction: column; gap: 10px; }
.ff-fast-field input { font-size: 20px; }
.ff-dup-note { display: none; color: #ef4444; font-weight: 700; }
.ff-fast-field.dup .ff-dup-note { display: block; }
.ff-fast-field.dup input { border-color: #ef4444; }
.remote-btn { white-space: nowrap; }
.remote-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.82); backdrop-filter: blur(6px); animation: fade-in 0.2s ease; }
.remote-card { max-width: 380px; text-align: center; display: flex; flex-direction: column; gap: 10px; background: #0d1640; animation: pop 0.25s ease; }
.remote-card .qr { background: #fff; padding: 12px; border-radius: 16px; }
@media (max-width: 640px) {
  .ff-board { grid-template-columns: 1fr; gap: 6px; }
  .ff-col { gap: 6px; }
  .ff-slot { min-height: 44px; padding: 5px 10px; }
  .ff-slot-num { width: 28px; height: 28px; }
  .ff-score-team { min-width: 0; flex: 1; }
}

/* ---------- Icons (Lucide line icons from /icons.svg; icon() in common.js) ---------- */

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; fill: none; stroke: currentColor; }
.icon.lg { width: 1.6em; height: 1.6em; }
.icon.xl { width: 1em; height: 1em; } /* sized by the font-size of a big emblem (.trophy, .wave …) */
.btn .icon, .chip-btn .icon, .link-btn .icon, .pill .icon, .mf-chip .icon, .category-chip .icon { margin-inline-end: 0.35em; }
.btn > .icon:last-child:not(:first-child) { margin-inline: 0.35em 0; }
/* The big emblems that used to be emoji: one line icon in the theme's colour. */
.trophy, .wave, .big-emoji, .mf-big, .os-big, .crown-emoji, .logo { color: var(--accent); }
.trophy .icon, .wave .icon, .big-emoji .icon, .mf-big .icon, .os-big .icon, .crown-emoji .icon, .logo .icon { width: 1em; height: 1em; stroke-width: 1.6; }
.wave { display: block; }

/* A game's logo: its icon in a rounded tile of the game's colour. */
.game-logo { display: inline-grid; place-items: center; width: 2.2em; height: 2.2em; border-radius: 0.6em; background: var(--accent); color: var(--accent-ink); flex: none; }
.game-logo .icon { width: 1.3em; height: 1.3em; stroke-width: 2.2; }
.game-logo.lg { font-size: 26px; }
.game-logo.xl { font-size: 44px; }

/* Places: 1, 2, 3 in gold, silver and bronze. */
.rank-badge { display: inline-grid; place-items: center; min-width: 1.8em; height: 1.8em; padding: 0 0.3em; border-radius: 999px; font-weight: 800; font-size: 0.85em; background: var(--card-strong); color: var(--text); }
.rank-badge.r1 { background: linear-gradient(180deg, #ffe27a, #e0a800); color: #2a1d00; }
.rank-badge.r2 { background: linear-gradient(180deg, #f1f3f6, #a9b1bd); color: #1d2430; }
.rank-badge.r3 { background: linear-gradient(180deg, #f3b98a, #b96a33); color: #2b1505; }

/* Team colours as a dot, where a team's name shows. */
.team-dot { display: inline-block; width: 0.7em; height: 0.7em; border-radius: 50%; margin-inline-end: 0.35em; vertical-align: 0.02em; }
.team-dot.red { background: var(--red); }
.team-dot.blue { background: var(--blue); }

/* Text for screen readers only (an icon-only button's name). */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- «مين فينا؟» ---------- */
.game-tile[data-theme="who"] b, body[data-theme="who"] .landing-intro h1 { view-transition-name: title-who; }
.who-stage { gap: 14px; }
.who-question { margin: 6px 0; }
.who-asked { margin: 0; text-align: center; font-size: 20px; font-weight: 700; color: var(--muted); }
.host .who-asked { font-size: 26px; }
.who-progress { width: 100%; max-width: 520px; margin: 0 auto; }
.who-progress p { margin: 8px 0 0; font-size: 22px; }
.who-progress-bar { height: 14px; border-radius: 999px; background: rgba(0, 0, 0, 0.3); overflow: hidden; }
.who-progress-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.3s ease; }
.who-vote-grid .btn small { font-size: 13px; font-weight: 500; opacity: 0.8; }
.who-verdict { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 18px; border-radius: 18px; background: var(--card); border: 2px solid var(--accent); text-align: center; }
.who-verdict small { color: var(--muted); font-weight: 700; }
.who-verdict b { font-size: clamp(26px, 4vw, 44px); color: var(--accent); }
.who-verdict.none { border-color: var(--line); }
.who-verdict.none b { color: var(--text); font-size: 24px; }
.who-tally li.top { outline: 2px solid var(--accent); }
.who-tally li.top .os-tally-name { color: var(--accent); }
.who-titles { list-style: none; width: 100%; max-width: 560px; margin: 0 auto 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.who-titles li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 10px 14px; border-radius: 14px; background: var(--card); text-align: start; }
.who-titles li b { color: var(--accent); }
.who-titles li.me { outline: 2px solid var(--accent); }
.who-demo { width: 100%; max-width: 420px; padding: 18px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); }
.who-demo-q { margin: 0 0 10px; font-size: 20px; font-weight: 800; text-align: center; }

/* ---------- «صح ولا خطأ» ---------- */
.game-tile[data-theme="truth"] b, body[data-theme="truth"] .landing-intro h1 { view-transition-name: title-truth; }
.tf-stage { gap: 14px; }
.tf-statement { margin: 6px 0; }
.tf-asked { margin: 0; text-align: center; font-size: 20px; font-weight: 700; color: var(--muted); }
.host .tf-asked { font-size: 26px; }
.tf-answered { font-size: 22px; margin: 0; }
.tf-choices-hint { display: flex; justify-content: center; gap: 14px; font-size: 22px; font-weight: 800; }
.tf-choices-hint span { padding: 8px 18px; border-radius: 999px; }
.tf-choices-hint .yes, .tf-btn.yes, .tf-split-box.yes.right { background: var(--good-soft); border: 2px solid var(--good); }
.tf-choices-hint .no, .tf-btn.no, .tf-split-box.no.right { background: var(--bad-soft); border: 2px solid var(--bad); }
.tf-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0; }
.tf-btn { min-height: 132px; border-radius: 22px; color: var(--text); font: inherit; font-size: 30px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.tf-btn .icon { width: 1.4em; height: 1.4em; }
.tf-btn.yes.picked { background: var(--good); color: #04261a; }
.tf-btn.no.picked { background: var(--bad); color: #2b0610; }
.tf-btn:disabled { cursor: default; }
.tf-btn:disabled:not(.picked) { opacity: 0.35; }
.tf-answer { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 18px; border-radius: 18px; background: var(--card); text-align: center; }
.tf-answer b { font-size: clamp(34px, 5vw, 56px); }
.tf-answer.yes { border: 2px solid var(--good); }
.tf-answer.yes b { color: var(--good); }
.tf-answer.no { border: 2px solid var(--bad); }
.tf-answer.no b { color: var(--bad); }
.tf-why { margin: 0; font-size: 20px; color: var(--text); }
.tf-split { display: flex; justify-content: center; gap: 10px; }
.tf-split-box { min-width: 110px; padding: 10px 14px; border-radius: 16px; background: var(--card); border: 2px solid transparent; display: flex; flex-direction: column; align-items: center; }
.tf-split-box b { font-size: 30px; }
.tf-split-box small { color: var(--muted); font-weight: 700; }
.tf-best { justify-content: center; }
.tf-best b { color: var(--good); margin-inline-start: 6px; }
.tf-demo { width: 100%; max-width: 420px; padding: 18px; border-radius: 22px; background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.tf-demo-statement { margin: 0; font-size: 22px; font-weight: 800; text-align: center; }
.tf-demo .tf-btn { min-height: 84px; font-size: 22px; }

/* ---------- «مافيا»: the narrator's story ---------- */
.mf-story-title { margin-bottom: 4px; }
.mf-story {
  position: relative; overflow: hidden; width: 100%; max-width: 680px; margin: 0 auto; padding: 18px;
  display: flex; flex-direction: column; gap: 10px; border-radius: 22px;
  background: rgba(6, 8, 24, 0.6); border: 1px solid var(--line);
}
/* The night sky slowly turns to dawn over the story (resumes at the right point after a reload). */
.mf-story.night { background: linear-gradient(180deg, #050816 0%, #0d1033 70%, #1b1440 100%); }
.mf-story.night::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 90% 60% at 50% 115%, rgba(255, 168, 92, 0.6), rgba(244, 63, 94, 0.18) 55%, transparent 75%);
  opacity: 0; animation: mf-sunrise var(--story-length) ease-in both; animation-delay: var(--story-elapsed);
}
.mf-story.night.told::before { opacity: 1; animation: none; }
@keyframes mf-sunrise { 0%, 62% { opacity: 0; } 100% { opacity: 1; } }

.mf-beat {
  position: relative; z-index: 1; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 12px;
  padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid transparent; text-align: start;
  transition: opacity 0.5s ease;
}
.mf-beat p { margin: 0; font-size: clamp(17px, 4.2vw, 22px); font-weight: 700; line-height: 1.5; }
.host .mf-beat p { font-size: clamp(20px, 2.4vw, 30px); }
.mf-beat-icon { display: grid; place-items: center; width: 2.2em; height: 2.2em; border-radius: 50%; background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.mf-beat-icon .icon { width: 1.2em; height: 1.2em; }
.mf-beat .mf-name { color: var(--accent); }
.mf-beat-role { grid-column: 2; color: var(--muted); font-size: 15px; font-weight: 800; }
.host .mf-beat-role { font-size: 19px; }
/* Earlier lines step back while the story goes on. */
.mf-story:not(.told) .mf-beat:not(:last-child) { opacity: 0.5; }

.mf-beat.scene { background: transparent; }
.mf-beat.scene p { font-weight: 500; color: var(--muted); font-style: italic; }
.mf-beat.danger .mf-beat-icon { color: var(--bad); background: var(--bad-soft); }
.mf-beat.suspense p { color: #ffd9de; }
.mf-story:not(.told) .mf-beat.suspense:last-child .mf-beat-icon { animation: mf-thump 0.85s ease infinite; }
.mf-beat.reveal p, .mf-beat.role p { font-size: clamp(20px, 5vw, 28px); font-weight: 800; }
.host .mf-beat.reveal p, .host .mf-beat.role p { font-size: clamp(24px, 3vw, 40px); }
.mf-beat.reveal.good, .mf-beat.role.good { border-color: var(--good); background: var(--good-soft); }
.mf-beat.reveal.bad, .mf-beat.role.bad { border-color: var(--bad); background: var(--bad-soft); }
.mf-beat.good .mf-beat-icon { color: var(--good); background: var(--good-soft); }
.mf-beat.bad .mf-beat-icon { color: var(--bad); background: var(--bad-soft); }
.mf-beat.reveal.good .mf-name { color: var(--good); }
.mf-beat.reveal.bad .mf-name { color: #ff8a9b; }
.mf-beat.tally { padding: 8px 14px; }
.mf-beat.tally p { display: grid; grid-template-columns: minmax(80px, 34%) 1fr 32px; align-items: center; gap: 10px; }
.mf-beat-bar { height: 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.35); overflow: hidden; }
.mf-beat-bar span { display: block; height: 100%; width: calc(var(--fill) * 100%); border-radius: inherit; background: var(--accent); }
.mf-beat-votes { text-align: center; }

/* Once told, the story steps back to make room for the outcome and what's next. */
.mf-story.told { padding: 12px; gap: 6px; }
.mf-story.told .mf-beat { padding: 6px 12px; }
.mf-story.told .mf-beat p, .host .mf-story.told .mf-beat p { font-size: clamp(15px, 3.6vw, 19px); }
.mf-story.told .mf-beat.reveal p, .mf-story.told .mf-beat.role p,
.host .mf-story.told .mf-beat.reveal p, .host .mf-story.told .mf-beat.role p { font-size: clamp(17px, 4vw, 22px); }
.mf-story.told .mf-beat-icon { width: 1.8em; height: 1.8em; }

/* A new line: it rises out of the dark; a name comes into focus; a bar fills. */
.mf-beat.enter { animation: mf-beat-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.mf-beat.reveal.enter .mf-name, .mf-beat.role.enter p { display: inline-block; animation: mf-name-in 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s both; }
.mf-beat.reveal.bad.enter { animation: mf-beat-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both, mf-shake 0.5s ease 0.7s; }
.mf-beat.tally.enter .mf-beat-bar span { animation: mf-bar 0.8s ease-out both; }
@keyframes mf-beat-in { from { opacity: 0; transform: translateY(16px); filter: blur(6px); } }
@keyframes mf-name-in { from { opacity: 0; transform: scale(1.7); filter: blur(10px); } }
@keyframes mf-thump { 0%, 40%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 28% { transform: scale(1.06); } }
@keyframes mf-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes mf-bar { from { width: 0; } }
@media (prefers-reduced-motion: reduce) {
  .mf-story *, .mf-story::before { animation: none !important; }
  .mf-story.night::before { opacity: 0.5; }
}

/* ---------- «مين النصاب؟» ---------- */
.game-tile[data-theme="scam"] b, body[data-theme="scam"] .landing-intro h1 { view-transition-name: title-scam; }
.sc-stage { gap: 12px; padding-bottom: 72px; } /* clear of the sound button */
/* A negative score keeps its minus in front. */
.standings .score { direction: ltr; unicode-bidi: isolate; }
.sc-card-wrap { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.sc-card.impostor.open { border-color: var(--accent); background: linear-gradient(160deg, rgba(255, 106, 61, 0.22), rgba(190, 18, 60, 0.18)); }
.sc-card.impostor .os-card-word { color: #ff8a65; }
.sc-card-mission { margin-top: 8px; padding: 10px 14px; border-radius: 14px; border: 1px dashed var(--accent); background: rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; gap: 4px; }
.sc-card-mission b { font-size: 20px; line-height: 1.4; }
.sc-swap { align-self: center; }
.sc-turn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; border-radius: 20px; background: var(--card); border: 2px solid var(--accent); text-align: center; }
.sc-turn small { color: var(--muted); font-weight: 700; }
.sc-turn b { font-size: clamp(30px, 5vw, 56px); color: var(--accent); }
.sc-turn span { font-size: 20px; }
.sc-circle { list-style: none; margin: 0 auto; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 720px; }
.sc-circle li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 700; transition: opacity 0.3s ease; }
.sc-circle li b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); font-size: 14px; }
.sc-circle li.now { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, var(--card)); }
.sc-circle li.now b { background: var(--accent); color: var(--accent-ink); }
.sc-circle li.done { opacity: 0.5; }
.sc-rules-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; color: var(--muted); font-weight: 700; }
.sc-mission-choices { display: flex; flex-direction: column; gap: 8px; }
.sc-mission-btn { margin: 0; justify-content: flex-start; text-align: start; white-space: normal; line-height: 1.4; min-height: 52px; }
.sc-mission-btn.picked { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.sc-mission-reveal { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 18px; border-radius: 18px; background: var(--card); border: 2px solid var(--line); text-align: center; animation: pop 0.35s ease; }
.sc-mission-reveal small { color: var(--muted); font-weight: 700; }
.sc-mission-reveal b { font-size: clamp(20px, 3vw, 30px); color: var(--accent); }
.sc-mission-reveal.exposed { border-color: var(--good); background: var(--good-soft); }
.sc-mission-reveal.done { border-color: var(--bad); background: var(--bad-soft); }
.sc-judge { display: flex; flex-direction: column; gap: 4px; }
.sc-lines { width: 100%; max-width: 480px; margin: 0 auto; padding: 12px 16px; border-radius: 16px; background: var(--card); }
.sc-lines ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sc-lines li { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; }
.sc-lines p { margin: 10px 0 0; padding-top: 8px; border-top: 1px solid var(--line); text-align: center; font-weight: 800; font-size: 18px; }
.sc-lines .good, .os-gains .good { color: var(--good); }
.sc-lines .bad { color: var(--bad); }
.sc-punish-box { width: 100%; max-width: 560px; margin: 8px auto; }
.sc-wheel { display: flex; flex-direction: column; align-items: center; }
.sc-wheel .tc-wheel { width: min(78vw, 42vh, 380px); }
.sc-punishment { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 18px; border-radius: 18px; border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--card)); text-align: center; opacity: 0; transform: scale(0.85); }
.sc-punishment small { color: var(--muted); font-weight: 700; }
.sc-punishment b { font-size: clamp(20px, 3.4vw, 30px); }
.sc-punishment.shown { opacity: 1; transform: none; transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1.3); }
.sc-punishment.calm { transition: none; }
.sc-demo { width: 100%; max-width: 440px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sc-demo .os-card { min-height: 220px; pointer-events: none; }
