:root {
  --bg: #0e3b3c;
  --bg-deep: #082a2b;
  --night: #0b2340;
  --card: #fffaf0;
  --ink: #1f2a2a;
  --muted: #6b7672;
  --gold: #f2c14e;
  --gold-deep: #d9a030;
  --green: #1f9e89;
  --red: #d1495b;
  --line: #eadfc8;
  --opt0: #1f9e89;
  --opt1: #e76f51;
  --opt2: #7b5ea7;
  --opt3: #3a86c8;
  --radius: 22px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

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

body {
  font-family: 'Tajawal', 'Baloo 2', system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  /* Eight-point star pattern over a deep teal-to-night gradient */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.06' stroke-width='1.5'%3E%3Crect x='24' y='24' width='32' height='32'/%3E%3Crect x='24' y='24' width='32' height='32' transform='rotate(45 40 40)'/%3E%3Ccircle cx='40' cy='40' r='8'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 60%, var(--night) 100%);
  background-attachment: fixed;
  font-size: 18px;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;
}

/* Twinkling stars behind everything */
.sky {
  position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image:
    radial-gradient(2px 2px at 12% 18%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 72% 12%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(2px 2px at 88% 42%, rgba(242, 193, 78, 0.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 30% 66%, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(2px 2px at 54% 84%, rgba(242, 193, 78, 0.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 6% 90%, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(1.5px 1.5px at 44% 36%, rgba(255, 255, 255, 0.4), transparent 60%);
  animation: twinkle 6s ease-in-out infinite alternate;
}

[lang='en'], [dir='ltr'] { font-family: 'Baloo 2', 'Tajawal', system-ui, sans-serif; }

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; }

/* ---------- layout ---------- */

.screen { max-width: 860px; margin: 0 auto; padding: 8px 16px 48px; }
.screen.enter { animation: screenIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
.screen.narrow { max-width: 620px; }
.screen.wide { max-width: 1200px; }
.screen > h1 { color: #fff; text-align: center; margin: 8px 0 4px; }
.center { text-align: center; }
.center-screen { min-height: 100vh; display: grid; place-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1200px; margin: 0 auto; padding: 12px 16px;
}
.topbar-right { display: flex; gap: 8px; align-items: center; }
.game-top .round-label { color: #fff; font-weight: 700; text-align: center; font-size: 17px; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin: 14px 0; position: relative;
}

.hint { color: rgba(255, 255, 255, 0.75); text-align: center; margin: 4px 0 12px; }
.card .hint { color: var(--muted); }
.hint.light { color: rgba(255, 255, 255, 0.85); }
.hint.small { font-size: 13px; margin: 10px 0 0; }
.notice {
  background: #fff3cd; color: #6b5200; border-radius: 14px; padding: 10px 14px;
  margin: 10px auto; max-width: 620px; font-size: 15px; text-align: center;
}
.error { color: var(--red); font-weight: 700; }

/* ---------- buttons ---------- */

.btn {
  border: none; border-radius: 999px; padding: 12px 26px; font-weight: 700;
  transition: transform 0.08s ease, filter 0.15s ease; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15); }
.btn:disabled { opacity: 0.45; }
.btn-big { font-size: 24px; padding: 16px 44px; margin-top: 14px; }
.btn-small { font-size: 15px; padding: 8px 16px; }
.btn-gold { background: linear-gradient(180deg, #f7d27a, var(--gold)); color: #3a2a00; }
.btn-gold:hover:not(:disabled) { filter: brightness(1.05); }
.btn-glow { animation: glow 2.2s ease-in-out infinite; }
.btn-green { background: var(--green); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-ghost { background: rgba(255, 255, 255, 0.9); color: var(--ink); }
.card .btn-ghost { background: #f1e9d8; }
.btn-ghost.light { background: rgba(255, 255, 255, 0.15); color: #fff; }
.btn-ghost.danger { color: var(--red); display: block; margin: 20px auto; }
.file-btn { cursor: pointer; display: inline-block; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, 0.15); color: #fff; font-size: 20px;
  display: grid; place-items: center; flex-shrink: 0;
}
.card .icon-btn { background: #f1e9d8; color: var(--ink); }
.icon-btn.small { width: 36px; height: 36px; font-size: 16px; }
.chip {
  border: none; border-radius: 999px; padding: 8px 16px; font-weight: 800;
  background: rgba(255, 255, 255, 0.15); color: #fff; font-size: 15px;
}
.chip.sync { font-size: 13px; padding: 6px 12px; }
.chip.sync.off { background: rgba(209, 73, 91, 0.35); }
.link-btn { background: none; border: none; color: rgba(255, 255, 255, 0.75); text-decoration: underline; font-size: 15px; margin-top: 10px; }
.link-btn.dark { color: var(--muted); display: block; margin: 10px auto 0; }

.seg { display: inline-flex; background: #efe6d2; border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg-btn { border: none; background: none; border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 15px; }
.seg-btn.on { background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; background: #f1e9d8; color: var(--ink);
  border-radius: 999px; padding: 4px 12px; font-size: 14px; font-weight: 700;
}
.tag.gold { background: var(--gold); }

/* ---------- home ---------- */

.home { text-align: center; }
.logo { font-size: 72px; line-height: 1; margin-top: 12px; filter: drop-shadow(0 6px 16px rgba(242, 193, 78, 0.5)); animation: float 4s ease-in-out infinite; }
.logo.spin { animation: spin 2s linear infinite; }
.home h1 { color: #fff; font-size: 48px; margin: 6px 0 0; font-weight: 800; text-shadow: 0 4px 20px rgba(242, 193, 78, 0.25); }
.tagline { color: var(--gold); font-size: 22px; margin: 0 0 18px; font-weight: 700; }
.player-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 10px 0; }
.player-pill {
  background: rgba(255, 255, 255, 0.12); color: #fff; border-radius: 18px; padding: 10px 14px; border: none;
  display: flex; flex-direction: column; align-items: center; min-width: 96px; transition: transform 0.15s, background 0.15s;
}
button.player-pill:hover { background: rgba(255, 255, 255, 0.2); transform: translateY(-2px); }
.player-pill.dark { background: #f1e9d8; color: var(--ink); }
.player-pill .avatar { font-size: 34px; }
.player-pill small { font-size: 11px; }
.rank-mini { opacity: 0.85; margin-top: 2px; }
.quick-row { margin-top: 12px; }
.quick-row .btn { font-size: 16px; padding: 10px 18px; }
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 520px; margin: 22px auto 0; }
.btn-menu {
  background: rgba(255, 255, 255, 0.95); border-radius: 20px; padding: 16px; font-size: 18px; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.btn-menu span { font-size: 30px; }
.badge-count {
  position: absolute; top: 8px; inset-inline-end: 10px; background: var(--red); color: #fff; font-style: normal;
  font-size: 13px; font-weight: 800; border-radius: 999px; min-width: 24px; padding: 2px 7px;
}
.foot { color: rgba(255, 255, 255, 0.6); font-size: 14px; margin-top: 22px; }

/* ---------- players & settings ---------- */

.player-card { display: flex; gap: 16px; align-items: flex-start; }
.avatar-btn {
  font-size: 46px; width: 84px; height: 84px; border-radius: 22px; border: 3px dashed var(--line);
  background: #fff; flex-shrink: 0;
}
.player-fields { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.name-input {
  font: inherit; font-size: 22px; font-weight: 700; border: 2px solid var(--line); border-radius: 14px;
  padding: 8px 12px; background: #fff; width: 100%;
}
.field-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field-row.centered { justify-content: center; margin: 14px 0; }
.field-label, .level-name { color: var(--muted); font-size: 15px; }
.remove { flex-shrink: 0; }
.btn-ghost:not(.danger):not(.light):not(.btn-small) { display: block; margin: 8px auto; }

.settings .setting {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.settings .setting.column { flex-direction: column; align-items: stretch; }
.settings .setting:last-child { border-bottom: none; }
.setting small { display: block; color: var(--muted); font-size: 14px; }
.round-toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.round-toggle {
  border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 10px; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; gap: 8px; opacity: 0.55; transition: all 0.15s;
}
.round-toggle span { font-size: 22px; }
.round-toggle.on { opacity: 1; border-color: var(--gold-deep); background: #fff8e1; }
.code-form { display: flex; gap: 10px; max-width: 360px; margin: 16px auto 0; }

/* ---------- leaderboard & profile ---------- */

.table-card { overflow-x: auto; padding: 8px 12px; }
.board { width: 100%; border-collapse: collapse; }
.board th { color: var(--muted); font-size: 14px; font-weight: 700; padding: 10px 8px; text-align: start; }
.board td { padding: 12px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.board tr.clickable { cursor: pointer; }
.board tr.clickable:hover td { background: #fbf3e2; }
.board .medal { font-size: 24px; width: 40px; }
.who-cell { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.who-cell .avatar { font-size: 26px; }
.section-title { color: #fff; margin: 26px 0 0; }
.section-title small { color: var(--gold); font-size: 16px; }
.game-row { padding: 14px 18px; margin: 10px 0; }
.game-date { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.game-scores { display: flex; flex-wrap: wrap; gap: 8px; }
.game-chip { background: #f1e9d8; border-radius: 999px; padding: 4px 12px; font-size: 15px; }
.game-chip.winner { background: var(--gold); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

.profile-head h1 { margin: 4px 0 0; }
.big-avatar.still { animation: none; }
.rank-title { font-size: 22px; font-weight: 800; color: var(--gold-deep); margin: 4px 0 10px; }
.xp { height: 14px; background: #efe6d2; border-radius: 999px; overflow: hidden; max-width: 360px; margin: 0 auto; }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); border-radius: 999px; animation: growX 1s ease; transform-origin: left; }
[dir='rtl'] .xp-fill { transform-origin: right; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat-grid div { background: #f6efdf; border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; }
.stat-grid b { font-size: 24px; }
.stat-grid small { color: var(--muted); font-size: 13px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.badge {
  background: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.55); border-radius: 18px; padding: 12px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px;
}
.badge .badge-icon { font-size: 36px; filter: grayscale(1); opacity: 0.45; }
.badge small { font-size: 12px; }
.badge.got { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.badge.got .badge-icon { filter: none; opacity: 1; animation: pop 0.5s ease; }
.badge.got small { color: var(--muted); }
.mastery-num { min-width: 70px; color: var(--muted); }

/* ---------- review & flags ---------- */

.review-stats { color: var(--gold); text-align: center; font-weight: 700; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 14px 0 4px; }
.select { font: inherit; font-size: 15px; border-radius: 999px; padding: 6px 14px; border: none; background: #efe6d2; }
.select.search { min-width: 200px; }
.report-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.report-card small { display: block; color: var(--muted); font-size: 14px; }
.review-card { border-inline-start: 6px solid transparent; }
.review-card.is-verified { border-inline-start-color: var(--green); }
.review-card.is-flagged { border-inline-start-color: var(--red); }
.review-card.is-retired { opacity: 0.6; }
.review-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.review-body { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.review-side { font-size: 16px; }
.review-q { font-weight: 700; font-size: 18px; margin: 0 0 8px; }
.review-options { margin: 0; padding-inline-start: 20px; }
.review-options .right, .review-side .right { color: var(--green); font-weight: 800; }
.review-explain { color: var(--ink); margin: 10px 0 4px; }
.clues { margin: 0; padding-inline-start: 22px; }
.review-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.review-actions .btn { display: inline-block; margin: 0; }
.source { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.flag-block { background: #fdecee; border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; }
.flag-block small { color: var(--muted); }
.flag-reasons { display: flex; gap: 6px; flex-wrap: wrap; }
.flag-note { margin: 8px 0 4px; font-style: italic; }

.flag-btn {
  border: none; background: #f1e9d8; color: var(--muted); width: 36px; height: 36px; border-radius: 50%;
  font-size: 16px; display: inline-grid; place-items: center; flex-shrink: 0; transition: transform 0.15s;
}
.flag-btn:hover { transform: scale(1.1); }
.flag-btn.on { background: var(--red); color: #fff; }
.flag-btn.small { width: 30px; height: 30px; font-size: 14px; }
.flag-link {
  background: rgba(255, 255, 255, 0.12); border: none; color: rgba(255, 255, 255, 0.85); border-radius: 999px;
  padding: 8px 16px; font-size: 15px; margin-top: 12px;
}
.flag-link.on { background: rgba(209, 73, 91, 0.5); color: #fff; }

.reason-grid { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px 0 12px; }
.reason-chip {
  border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 15px;
  transition: all 0.12s;
}
span.reason-chip { padding: 3px 10px; font-size: 13px; }
.reason-chip.on { background: var(--red); border-color: var(--red); color: #fff; }

/* Bottom sheet */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); opacity: 0; transition: opacity 0.25s; }
.sheet-panel {
  position: absolute; inset-inline: 0; bottom: 0; margin: 0 auto; max-width: 560px; background: var(--card);
  border-radius: 26px 26px 0 0; padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); text-align: center;
  transform: translateY(100%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); max-height: 90vh; overflow-y: auto;
}
.sheet.open .sheet-backdrop { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
.sheet-grip { width: 44px; height: 5px; background: var(--line); border-radius: 999px; margin: 0 auto 10px; }
.sheet-panel h3 { margin: 4px 0; color: var(--red); }
.sheet-q { font-weight: 700; margin: 8px 0; }
.flag-input {
  width: 100%; font: inherit; font-size: 16px; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px;
  resize: vertical; background: #fff;
}
.sheet-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.sheet-actions .btn { display: inline-block; margin: 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 70;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none; background: #1f2a2a; color: #fff; border-radius: 999px;
  padding: 10px 12px 10px 20px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s; font-weight: 700; max-width: calc(100vw - 32px);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast-btn { border: none; background: var(--gold); color: #3a2a00; border-radius: 999px; padding: 6px 14px; font-weight: 800; }

/* ---------- game ---------- */

.score-strip { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 0 16px; }
.score-chip {
  display: flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, 0.12); color: #fff; position: relative;
  border-radius: 999px; padding: 6px 14px 6px 10px; font-size: 15px; transition: transform 0.2s, background 0.2s;
}
.score-chip.active { background: var(--gold); color: #3a2a00; transform: scale(1.08); }
.score-chip.gain { animation: chipGain 0.7s ease; }
.score-chip.loss { animation: shake 0.45s ease; }
.score-chip .avatar { font-size: 22px; }
.score-chip b { font-size: 18px; font-variant-numeric: tabular-nums; }
.delta {
  position: absolute; top: -6px; inset-inline-end: 6px; font-weight: 800; font-size: 16px; pointer-events: none;
  animation: floatUp 1.2s ease forwards;
}
.delta.up { color: #7dffb2; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.delta.down { color: #ffb0b9; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.streak { font-size: 13px; }

.big-emoji { font-size: 72px; line-height: 1.1; position: relative; }
.big-emoji.zoom { animation: zoomIn 0.6s cubic-bezier(0.2, 1.4, 0.4, 1); }
.big-avatar { font-size: 110px; line-height: 1.1; animation: bounce 1.2s ease infinite; position: relative; }
.round-kicker { color: var(--muted); font-weight: 700; margin: 6px 0 0; position: relative; }
.round-intro, .pass-card { overflow: hidden; }
.round-intro > *, .pass-card > * { position: relative; }
.round-intro h1 { font-size: 40px; margin: 4px 0 8px; }
.rules { font-size: 19px; color: var(--ink); line-height: 1.6; }
.pass-card h1 { font-size: 40px; margin: 8px 0 0; }

/* Slowly turning light rays behind big moments */
.rays {
  position: absolute !important; inset: -60%; pointer-events: none; opacity: 0.35;
  background: repeating-conic-gradient(from 0deg, rgba(242, 193, 78, 0.35) 0deg 10deg, transparent 10deg 24deg);
  animation: spin 30s linear infinite;
  mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 55%);
}

.golden { background: linear-gradient(135deg, #fff6d6, #ffe8a3 40%, #fff6d6 60%, #ffe39a); background-size: 300% 300%; animation: shimmer 3s linear infinite; box-shadow: 0 0 0 3px var(--gold), 0 10px 40px rgba(242, 193, 78, 0.55); }
.golden-banner { font-weight: 800; color: var(--gold-deep); font-size: 20px; margin: 8px 0 0; animation: pulse 1.2s ease-in-out infinite; }

.joker {
  display: inline-flex; align-items: center; gap: 10px; margin: 18px auto 0; padding: 10px 18px;
  border-radius: 999px; border: 2px dashed var(--gold-deep); background: #fff8e1; font-weight: 700; font-size: 16px;
}
.joker.small { font-size: 15px; margin-top: 16px; background: rgba(255, 255, 255, 0.95); }
.joker.armed { background: var(--gold); border-style: solid; animation: pulse 1.2s ease-in-out infinite; }
.joker:disabled { opacity: 0.45; }
.joker-icon { background: var(--gold-deep); color: #fff; border-radius: 999px; padding: 2px 10px; font-weight: 800; }

.timer { height: 12px; background: rgba(255, 255, 255, 0.15); border-radius: 999px; overflow: hidden; margin: 14px 0 0; position: relative; }
.timer-space { height: 12px; margin: 14px 0 0; }
.timer-fill { height: 100%; width: 100%; background: var(--gold); border-radius: 999px; transition: width 0.1s linear, background 0.3s; }
.timer-fill.low { background: var(--opt1); animation: pulse 0.6s ease-in-out infinite; }
.timer-secs {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; z-index: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.lightning .timer, .buzz-screen .timer { height: 20px; }

.q-card { text-align: center; padding: 22px 24px 26px; }
.q-head { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.q-text { font-size: 30px; line-height: 1.45; margin: 16px 0 6px; font-weight: 800; }
.q-alt { color: var(--muted); font-size: 18px; margin: 4px 0 0; }
.clue-list { text-align: start; font-size: 22px; line-height: 1.6; margin: 10px auto; max-width: 560px; padding-inline-start: 30px; }
.clue-list li { animation: fadeIn 0.4s ease; margin-bottom: 6px; }
.worth { color: var(--gold-deep); font-weight: 800; margin: 10px 0 0; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.option {
  border: none; border-radius: 20px; color: #fff; font-size: 24px; font-weight: 800; min-height: 96px;
  padding: 14px 18px; display: flex; align-items: center; gap: 14px; text-align: start;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2); transition: transform 0.08s, opacity 0.25s, filter 0.25s;
}
.option:hover:not(:disabled) { filter: brightness(1.07); }
.option:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2); }
.option:disabled { cursor: default; }
.option .shape { font-size: 22px; opacity: 0.8; min-width: 24px; text-align: center; }
.option.out { opacity: 0.2; }
.option.dim { opacity: 0.35; filter: grayscale(0.5); }
.option.right { background: var(--green); box-shadow: 0 0 0 4px #fff, 0 0 30px rgba(125, 255, 178, 0.8); animation: pop 0.45s ease; }
.option.wrong { background: var(--red); box-shadow: 0 0 0 4px #fff; }
.option.right .shape::before { content: '✓ '; }
.shake { animation: shake 0.45s ease; }
.opt-alt { display: block; font-size: 15px; font-weight: 600; opacity: 0.85; }
.opt-0 { background: var(--opt0); }
.opt-1 { background: var(--opt1); }
.opt-2 { background: var(--opt2); }
.opt-3 { background: var(--opt3); }
.options.tf .option { font-size: 32px; justify-content: center; min-height: 130px; }

/* Put-in-order */
.options.order { display: block; }
.order-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.order-slot {
  min-height: 70px; border-radius: 16px; border: 3px dashed rgba(255, 255, 255, 0.35); color: #fff; font-weight: 800;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px; font-size: 16px; text-align: center;
}
.order-slot.filled { border-style: solid; background: rgba(255, 255, 255, 0.14); animation: pop 0.3s ease; }
.order-slot.right { background: var(--green); border-color: #fff; }
.order-slot.wrong { background: var(--red); border-color: #fff; }
.slot-n { background: var(--gold); color: #3a2a00; border-radius: 999px; width: 26px; height: 26px; display: grid; place-items: center; font-size: 15px; }
.order-items { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.order-item { min-height: 76px; font-size: 21px; }
.order-item.placed { opacity: 0.45; transform: scale(0.97); }
.order-item.placed .shape { background: var(--gold); color: #3a2a00; border-radius: 999px; opacity: 1; }
.order-actions { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 14px; }
.order-actions .btn { display: inline-block; margin: 0; }
.order-answer { text-align: start; font-size: 20px; font-weight: 700; margin: 6px 0 0; padding-inline-start: 26px; }
.order-answer li.right { color: var(--green); }

.steal-title { font-size: 22px; font-weight: 800; color: var(--gold-deep); margin: 14px 0 10px; }
.steal-grid { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-bottom: 16px; }
.steal-btn {
  border: 3px solid var(--line); background: #fff; border-radius: 20px; padding: 12px 18px;
  display: flex; flex-direction: column; align-items: center; font-weight: 700; min-width: 110px; transition: all 0.15s;
}
.steal-btn .avatar { font-size: 44px; }
.steal-btn:hover { border-color: var(--gold); }
.steal-btn.picked { border-color: var(--green); background: #e3f6f1; transform: scale(1.05); }

.feedback h1 { margin: 6px 0; }
.good { color: var(--green); }
.bad { color: var(--red); }
.points { font-size: 32px; font-weight: 800; color: var(--gold-deep); margin: 4px 0; }
.bonus { font-size: 20px; }
.answer-box { background: #f1e9d8; border-radius: 16px; padding: 12px 16px; margin-top: 12px; }
.answer-box small { display: block; color: var(--muted); }
.answer-box b { font-size: 24px; }
.did-you-know h3 { margin: 0 0 6px; color: var(--gold-deep); }
.did-you-know p { margin: 6px 0; line-height: 1.6; }
.explain-small { color: var(--ink); line-height: 1.6; margin: 10px 0 0; }
.unverified-note { color: var(--muted); font-size: 13px; font-style: italic; }
.feedback-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; }

/* Lightning */
.bolt { transition: background 0.2s; }
.bolt.flash-good { animation: flashGood 0.35s ease; }
.bolt.flash-bad { animation: flashBad 0.35s ease, shake 0.35s ease; }
.bolt-stats { display: flex; gap: 18px; justify-content: center; margin-top: 16px; font-size: 26px; font-weight: 800; }
.bolt-stats .good { color: #7dffb2; }
.bolt-stats .bad { color: #ffb0b9; }
.bolt-stats .hot { color: var(--gold); animation: pulse 0.8s ease-in-out infinite; }
.bolt-log { padding: 8px 14px; }
.bolt-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.bolt-row:last-child { border-bottom: none; }
.bolt-mark { font-weight: 800; font-size: 20px; min-width: 20px; }
.bolt-row.right .bolt-mark { color: var(--green); }
.bolt-row.wrong .bolt-mark { color: var(--red); }
.bolt-text { flex: 1; text-align: start; }
.bolt-text small { display: block; color: var(--muted); margin-top: 4px; }

/* Buzz-in */
.buzz-screen .options .option { min-height: 76px; font-size: 21px; }
.buzz-status { color: #fff; text-align: center; font-size: 20px; font-weight: 800; margin: 8px 0; animation: fadeIn 0.3s ease; }
/* Buzzers stay docked at the bottom of the screen so nobody has to scroll to reach theirs. */
.buzz-dock {
  position: sticky; bottom: 0; z-index: 5; margin: 12px -16px 0; padding: 4px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(11, 35, 64, 0), rgba(11, 35, 64, 0.92) 22%);
}
.buzz-dock .hint.small { margin: 8px 0 0; }
.buzz-pads { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.buzz-pads.pads-2 { grid-template-columns: repeat(2, 1fr); }
.buzz-pads.pads-3 { grid-template-columns: repeat(3, 1fr); }
.buzz-pads.pads-4 { grid-template-columns: repeat(4, 1fr); }
.buzz-pads.pads-5, .buzz-pads.pads-6 { grid-template-columns: repeat(3, 1fr); }
.buzz-pad {
  position: relative; overflow: hidden; border: none; border-radius: 26px; min-height: 110px; padding: 10px;
  background: radial-gradient(circle at 50% 30%, #ff8a73, #d1495b); color: #fff; font-weight: 800; font-size: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 8px 0 #8d2433, 0 10px 20px rgba(0, 0, 0, 0.3); touch-action: manipulation; user-select: none; -webkit-user-select: none;
  transition: transform 0.06s, box-shadow 0.06s, opacity 0.2s;
}
.buzz-pad .avatar { font-size: 40px; }
.buzz-pad.ready { animation: padReady 1.4s ease-in-out infinite; }
.buzz-pad:active:not(:disabled) { transform: translateY(6px); box-shadow: 0 2px 0 #8d2433; }
.buzz-pad.locked { background: #5b6b6b; box-shadow: 0 8px 0 #333; }
.buzz-pad.wait, .buzz-pad.out { opacity: 0.35; filter: grayscale(0.8); }
.buzz-pad.active { background: radial-gradient(circle at 50% 30%, #ffe08a, var(--gold-deep)); color: #3a2a00; box-shadow: 0 0 0 5px #fff, 0 0 40px rgba(242, 193, 78, 0.9); transform: scale(1.04); }
.lock-bar { position: absolute; inset-inline-start: 0; bottom: 0; height: 8px; width: 100%; background: var(--gold); animation: lockDrain var(--lock) linear forwards; }
.buzz-result { animation: fadeIn 0.3s ease; }

/* Comeback wheel */
.wheel-wrap { position: relative; width: min(78vw, 340px); aspect-ratio: 1; margin: 16px auto 8px; }
.wheel {
  position: absolute; inset: 0; border-radius: 50%; border: 8px solid #fff; box-shadow: 0 0 0 4px var(--gold-deep), var(--shadow);
  background: conic-gradient(var(--opt0) 0 45deg, var(--opt1) 45deg 90deg, var(--opt2) 90deg 135deg, var(--opt3) 135deg 180deg,
    var(--opt0) 180deg 225deg, var(--opt1) 225deg 270deg, var(--opt2) 270deg 315deg, var(--opt3) 315deg 360deg);
  transition: transform 4.5s cubic-bezier(0.15, 0.6, 0.1, 1);
}
/* Each label sits at the centre, turned to its slice and pushed out towards the rim. */
.wheel-label {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0; display: flex; justify-content: center; align-items: center;
  color: #fff; font-weight: 800; font-size: clamp(16px, 5vw, 24px); white-space: nowrap; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.35); direction: ltr;
  transform: rotate(var(--a)) translateY(calc(min(78vw, 340px) * -0.32));
}
.wheel-pointer { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); z-index: 2; font-size: 34px; color: var(--red); text-shadow: 0 2px 0 #fff; }
.wheel-hub {
  position: absolute; left: 50%; top: 50%; width: 26%; height: 26%; transform: translate(-50%, -50%); border-radius: 50%;
  border: 5px solid var(--gold-deep); background: #fff; font-size: clamp(26px, 8vw, 40px); z-index: 2; box-shadow: var(--shadow);
}
[dir='rtl'] .wheel-hub { transform: translate(50%, -50%); right: 50%; left: auto; }
.wheel-result { background: #fff8e1; border: 3px solid var(--gold); border-radius: 18px; padding: 10px; margin: 12px auto 0; max-width: 360px; }
.wheel-result b { font-size: 34px; }
.wheel-result p { margin: 4px 0 0; font-weight: 700; font-size: 18px; }

.bars { margin: 16px 0; }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.bar-name { display: flex; align-items: center; gap: 6px; width: 130px; font-weight: 700; flex-shrink: 0; text-align: start; }
.bar-name .avatar { font-size: 24px; }
.bar { flex: 1; height: 22px; background: #efe6d2; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); border-radius: 999px; transition: width 0.8s ease; }
.bar-fill.grow { width: var(--w); animation: barGrow 1s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Final: third, then second, then the champion */
.final { text-align: center; }
.champ-wrap { animation: champIn 0.8s cubic-bezier(0.2, 1.4, 0.4, 1) 3.1s both; }
.champ { color: var(--gold); font-size: 38px; margin: 6px 0 0; text-shadow: 0 4px 24px rgba(242, 193, 78, 0.6); }
.winner-names { color: #fff; font-size: 30px; font-weight: 800; margin: 4px 0 14px; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin: 30px 0 10px; min-height: 290px; }
.podium-col { display: flex; flex-direction: column; align-items: center; width: 130px; animation: riseUp 0.7s cubic-bezier(0.2, 1.2, 0.4, 1) both; }
.podium-col.rank-3 { animation-delay: 0.5s; }
.podium-col.rank-2 { animation-delay: 1.7s; }
.podium-col.rank-1 { animation-delay: 3s; }
.podium-col.rank-1 .podium-avatar { font-size: 72px; }
.podium-avatar { font-size: 56px; animation: bounce 1.4s ease infinite; }
.podium-name { color: #fff; font-weight: 700; margin: 4px 0 6px; }
.podium-block {
  width: 100%; background: var(--card); border-radius: 18px 18px 6px 6px; display: flex;
  flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 12px; box-shadow: var(--shadow);
}
.podium-block b { font-size: 26px; }
.podium-rank { font-size: 34px; }
.podium-block.h1 { height: 190px; background: linear-gradient(180deg, #ffe08a, var(--gold)); }
.podium-block.h2 { height: 140px; }
.podium-block.h3 { height: 105px; }
.no-anim .podium-col, .no-anim .champ-wrap, .no-anim .unlocks { animation: none; }
.others { max-width: 420px; margin: 0 auto 16px; }
.unlocks { text-align: start; animation: fadeIn 0.6s ease both; }
.unlocks h3 { margin: 0 0 8px; color: var(--gold-deep); text-align: center; }
.unlock-row { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.unlock-row .avatar { font-size: 36px; }
.unlock-rank { color: var(--gold-deep); font-weight: 800; }
.unlock-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.badge-chip { background: #fff3cd; border-radius: 999px; padding: 4px 10px; font-weight: 700; font-size: 14px; animation: pop 0.5s ease both; }

/* Car mode */
.car-card .q-text { font-size: 28px; }
.car-options { text-align: start; font-size: 22px; line-height: 1.7; max-width: 520px; margin: 10px auto 0; font-weight: 700; }
.car-options li.right { color: var(--green); }

.pop { animation: pop 0.5s ease; }

/* ---------- challenge board & wager ---------- */

.board-title { color: #fff; text-align: center; margin: 14px 0; }
.board-grid { display: grid; gap: 10px; align-items: stretch; }
.board-cat {
  background: var(--gold); color: #3a2a00; border-radius: 14px; padding: 10px 6px;
  font-weight: 800; text-align: center; font-size: 16px; display: grid; place-items: center;
}
.board-level { color: #fff; display: grid; place-items: center; font-size: 14px; padding: 0 4px; }
.tile {
  border: none; border-radius: 16px; min-height: 84px; font-size: 30px; font-weight: 800;
  background: var(--opt3); color: #fff; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2); animation: fadeIn 0.4s ease both;
}
.tile.lvl-1 { background: linear-gradient(180deg, #4fb8a6, var(--opt0)); }
.tile.lvl-2 { background: linear-gradient(180deg, #5aa2dd, var(--opt3)); }
.tile.lvl-3 { background: linear-gradient(180deg, #9a7cc6, var(--opt2)); }
.tile:hover { filter: brightness(1.1); transform: translateY(-2px); }
.tile:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); }
.tile.done {
  background: rgba(255, 255, 255, 0.08); box-shadow: none; display: grid; place-items: center;
  color: rgba(255, 255, 255, 0.4); font-size: 24px;
}
.wager-cat { font-size: 20px; margin: 10px 0; }
.bets { margin: 16px 0; }
.bet-row { display: flex; align-items: center; gap: 12px; margin: 14px 0; }
.bet-row input[type='range'] { flex: 1; accent-color: var(--gold-deep); }
.bet-value { min-width: 48px; font-size: 22px; color: var(--gold-deep); }
.points.lost { color: var(--red); }

/* ---------- animations ---------- */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(6deg); } }
@keyframes pop { 0% { transform: scale(0.3); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes zoomIn { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
@keyframes glow { 0%, 100% { box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15), 0 0 0 rgba(242, 193, 78, 0); } 50% { box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15), 0 0 28px rgba(242, 193, 78, 0.75); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes chipGain { 0% { transform: scale(1); } 40% { transform: scale(1.18); box-shadow: 0 0 22px rgba(125, 255, 178, 0.8); } 100% { transform: scale(1); } }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-28px); } }
@keyframes shimmer { 0% { background-position: 0% 50%; } 100% { background-position: 300% 50%; } }
@keyframes flashGood { 0% { background: #c9f7e6; } 100% { background: var(--card); } }
@keyframes flashBad { 0% { background: #ffd3d9; } 100% { background: var(--card); } }
@keyframes padReady { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.15); } }
@keyframes lockDrain { from { width: 100%; } to { width: 0; } }
@keyframes barGrow { from { width: 0; } }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes riseUp { from { opacity: 0; transform: translateY(80px) scale(0.8); } to { opacity: 1; transform: none; } }
@keyframes champIn { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: none; } }
@keyframes twinkle { from { opacity: 0.5; } to { opacity: 1; } }

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

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  body { font-size: 16px; }
  .home h1 { font-size: 38px; }
  .q-text { font-size: 23px; }
  .options { grid-template-columns: 1fr; gap: 10px; }
  .option { font-size: 19px; min-height: 64px; }
  .options.tf { grid-template-columns: 1fr 1fr; }
  .options.tf .option { min-height: 110px; font-size: 26px; }
  .order-slots { grid-template-columns: repeat(2, 1fr); }
  .order-slot { min-height: 54px; font-size: 14px; }
  .order-item { min-height: 58px; font-size: 17px; }
  .review-body { grid-template-columns: 1fr; }
  .player-card { flex-wrap: wrap; }
  .podium-col { width: 100px; }
  .bar-name { width: 104px; }
  .game-top .round-label { font-size: 14px; }
  .tile { font-size: 20px; min-height: 64px; }
  .board-cat { font-size: 12px; padding: 6px 2px; }
  .board-grid { gap: 6px; }
  .buzz-screen .options .option { min-height: 56px; font-size: 17px; }
  .buzz-pads { gap: 8px; }
  .buzz-pad { min-height: 78px; font-size: 14px; border-radius: 20px; }
  .buzz-pad .avatar { font-size: 30px; }
  .stat-grid b { font-size: 20px; }
  .score-chip { padding: 4px 10px 4px 8px; font-size: 13px; }
  .score-chip .avatar { font-size: 18px; }
  .score-name { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .card { padding: 16px; }
  .big-avatar { font-size: 88px; }
  .round-intro h1, .pass-card h1 { font-size: 32px; }
}
[dir='rtl'] .car-options { list-style-type: arabic-indic; }

/* ---------- first-time setup & family ---------- */

.onboard { text-align: center; }
.hero-title { color: #fff; font-size: 46px; margin: 6px 0 0; font-weight: 800; }
.hero-sub { color: rgba(255, 255, 255, 0.85); font-size: 24px; margin: 0; font-weight: 700; }
.muted { color: var(--muted); }
.lang-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.lang-btn {
  border: 3px solid var(--line); background: #fff; border-radius: 22px; padding: 18px 10px; font-size: 22px; font-weight: 800;
  display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform 0.12s, border-color 0.12s;
}
.lang-btn span {
  width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 28px;
  background: linear-gradient(180deg, #f7d27a, var(--gold)); color: #3a2a00;
}
.lang-btn:hover { border-color: var(--gold); transform: translateY(-2px); }
.field { display: flex; flex-direction: column; gap: 6px; text-align: start; margin: 14px 0; }
.code-row { display: flex; gap: 8px; align-items: center; }
.code-input { letter-spacing: 0.02em; }
.icon-btn.dice { width: 52px; height: 52px; font-size: 26px; background: #f1e9d8; }
.code-check { color: var(--muted); font-size: 14px; min-height: 18px; }
.tip { background: #fff8e1; border-radius: 14px; padding: 10px 14px; font-size: 15px; color: #5c4a14; text-align: start; line-height: 1.6; }
.code-display {
  font-size: 28px; font-weight: 800; letter-spacing: 0.04em; background: #fff8e1; border: 3px dashed var(--gold-deep);
  border-radius: 18px; padding: 14px 18px; margin: 14px auto; word-break: break-word; user-select: all;
}
.code-display.small { font-size: 18px; padding: 6px 12px; margin: 6px 0 0; border-width: 2px; display: inline-block; }
.ready-card { overflow: hidden; }
.ready-card > * { position: relative; }
.family-chip { color: #fff; background: rgba(255, 255, 255, 0.12); display: inline-block; border-radius: 999px; padding: 4px 16px; margin: 0 0 6px; font-weight: 700; }
.danger-text { color: var(--red) !important; }
