/* واثق — التصميم */
@font-face {
  font-family: 'Cairo';
  src: url('/fonts/cairo-arabic.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Cairo';
  src: url('/fonts/cairo-latin.woff2') format('woff2');
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #100e2b;
  --bg-2: #181541;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-2: rgba(255, 255, 255, 0.1);
  --surface-3: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f6f4ff;
  --muted: #b6b1e2;
  --faint: #8580b8;
  --gold: #ffd23f;
  --gold-2: #ffaa1f;
  --gold-ink: #261b00;
  --coral: #ff7a59;
  --good: #2bd576;
  --good-bg: rgba(43, 213, 118, 0.14);
  --bad: #ff5c7a;
  --bad-bg: rgba(255, 92, 122, 0.14);
  --radius: 20px;
  --shadow: 0 14px 36px rgba(4, 2, 28, 0.45);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Cairo', 'Segoe UI', Tahoma, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 85% -12%, rgba(91, 60, 230, 0.55), transparent 62%),
    radial-gradient(760px 480px at -15% 108%, rgba(30, 90, 200, 0.4), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

.icon {
  flex: none;
}

.muted {
  color: var(--muted);
}

.small,
small {
  font-size: 0.85rem;
}

.center {
  text-align: center;
}

/* ———— الهيكل ———— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
  background: rgba(16, 14, 43, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 4px;
  font-weight: 900;
  font-size: 1.25rem;
}

.logo {
  display: block;
  border-radius: 24%;
}

.room-pill {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.room-pill b {
  color: var(--gold);
  letter-spacing: 1px;
}

.top-actions {
  margin-inline-start: auto;
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: var(--surface-2);
  color: var(--text);
}

.main {
  max-width: 620px;
  margin: 0 auto;
  padding: 14px 16px calc(32px + env(safe-area-inset-bottom, 0px));
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise 0.32s ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  margin: 4px 0 10px;
}

.card-title small {
  color: var(--faint);
  font-weight: 600;
}

.card-title:not(:first-child) {
  margin-top: 18px;
}

.count {
  min-width: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.85rem;
  text-align: center;
}

/* ———— الأزرار ———— */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.3;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.2s, opacity 0.2s, box-shadow 0.2s;
}

.btn:hover {
  background: var(--surface-3);
}

.btn:active {
  transform: scale(0.97);
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  color: var(--gold-ink);
  box-shadow: 0 10px 26px rgba(255, 176, 32, 0.28);
}

.btn.primary:hover {
  filter: brightness(1.05);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  border-color: transparent;
  background: var(--bad);
  color: #fff;
}

.btn.big {
  width: 100%;
  min-height: 60px;
  font-size: 1.15rem;
}

.btn.small {
  min-height: 42px;
  padding: 8px 14px;
  font-size: 0.95rem;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.primary:disabled {
  opacity: 1;
  background: #2f2a63;
  color: var(--faint);
  border-color: var(--line);
}

.btn.back {
  align-self: center;
  min-height: 44px;
  color: var(--muted);
}

.btn.sticky {
  position: sticky;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 5;
}

.link-btn {
  background: none;
  border: 0;
  color: var(--gold);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
  padding: 4px 0;
}

:focus-visible {
  outline: 3px solid rgba(255, 210, 63, 0.7);
  outline-offset: 2px;
}

/* ———— الرئيسيّة ———— */
.home {
  gap: 18px;
}

.hero {
  text-align: center;
  padding: 18px 0 6px;
}

.hero .logo {
  margin: 0 auto 10px;
  filter: drop-shadow(0 16px 30px rgba(91, 60, 230, 0.55));
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  50% {
    transform: translateY(-6px);
  }
}

.hero h1 {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1.1;
  background: linear-gradient(90deg, var(--gold), var(--coral));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin-top: 6px;
  color: var(--muted);
  font-size: 1.12rem;
  font-weight: 700;
}

.cats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.cat-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px;
  border-radius: 18px;
  background: var(--surface);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
}

.cat-tile b {
  font-size: 0.98rem;
  line-height: 1.4;
}

.cat-tile small {
  color: var(--muted);
}

.cat-icon {
  color: var(--c);
  display: inline-flex;
}

.home-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.home-links .btn {
  min-height: 46px;
  color: var(--muted);
  border-color: transparent;
}

.note {
  text-align: center;
  color: var(--faint);
  font-size: 0.88rem;
}

.note.bad {
  color: var(--bad);
}

/* ———— النماذج ———— */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form h2,
.intro h2 {
  font-size: 1.5rem;
  font-weight: 900;
}

.intro {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.best b {
  color: var(--gold);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
}

.field > span {
  color: var(--muted);
  font-size: 0.95rem;
}

.field input,
.answer-input {
  width: 100%;
  min-height: 54px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  font-size: 1.1rem;
  font-weight: 700;
  outline: none;
  transition: border-color 0.2s;
}

.field input:focus,
.answer-input:focus {
  border-color: var(--gold);
}

.code-input {
  text-align: center;
  font-size: 2rem !important;
  letter-spacing: 12px;
  font-weight: 900 !important;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 6px;
}

.av-pick {
  aspect-ratio: 1;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--surface);
  font-size: 1.5rem;
  line-height: 1;
  transition: transform 0.12s;
}

.av-pick.sel {
  border-color: var(--gold);
  background: rgba(255, 210, 63, 0.14);
  transform: scale(1.08);
}

.av-pick:disabled {
  opacity: 0.2;
}

/* ———— الإعدادات ———— */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.cat-toggle {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--surface);
  text-align: start;
  transition: border-color 0.2s, background 0.2s;
}

.cat-toggle .cat-name {
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.35;
}

.cat-toggle .cat-count {
  color: var(--muted);
  font-size: 0.8rem;
}

.cat-toggle .cat-icon {
  color: var(--faint);
}

.cat-toggle.on {
  border-color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
}

.cat-toggle.on .cat-icon {
  color: var(--c);
}

.cat-tick {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--c);
  color: #111;
  opacity: 0;
}

.cat-toggle.on .cat-tick {
  opacity: 1;
}

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
}

.seg button {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.95rem;
  padding: 4px 6px;
  white-space: nowrap;
}

.seg button.on {
  background: var(--gold);
  color: var(--gold-ink);
}

.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  cursor: pointer;
}

.toggle .t-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  line-height: 1.4;
}

.toggle small {
  color: var(--muted);
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  flex: none;
  position: relative;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background 0.2s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.toggle input:checked + .switch {
  background: var(--good);
}

.toggle input:checked + .switch::after {
  transform: translateX(-22px);
}

[dir='ltr'] .toggle input:checked + .switch::after {
  transform: translateX(22px);
}

.toggle input:focus-visible + .switch {
  outline: 3px solid rgba(255, 210, 63, 0.7);
  outline-offset: 2px;
}

.toggle.disabled {
  cursor: default;
  opacity: 0.75;
}

.settings.readonly .cat-toggle,
.settings.readonly .seg button {
  cursor: default;
}

.settings.readonly .seg button:disabled,
.settings.readonly .cat-toggle:disabled {
  opacity: 1;
}

.settings .seg button:disabled:not(.on) {
  opacity: 0.6;
}

.avail {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

.avail.ok {
  background: var(--good-bg);
  color: #8ff0b8;
}

.avail.warn {
  background: var(--bad-bg);
  color: #ffb3c1;
}

/* ———— غرفة الانتظار ———— */
.code-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  background:
    radial-gradient(400px 160px at 50% 0, rgba(255, 210, 63, 0.14), transparent 70%),
    var(--surface);
}

.room-code {
  border: 0;
  background: none;
  font-size: 3.6rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 10px;
  color: var(--gold);
  padding: 0 0 0 10px;
  text-shadow: 0 6px 30px rgba(255, 210, 63, 0.35);
}

.players {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--surface);
  animation: rise 0.3s ease-out;
}

.player.me {
  outline: 1px solid rgba(255, 210, 63, 0.35);
}

.player.off {
  opacity: 0.55;
}

.p-name {
  font-weight: 800;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.p-name small {
  color: var(--faint);
  font-weight: 600;
}

.crown {
  color: var(--gold);
  display: inline-flex;
}

.kick {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--faint);
}

.kick:hover {
  background: var(--bad-bg);
  color: var(--bad);
}

.av {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  background: color-mix(in srgb, var(--pc) 22%, transparent);
  box-shadow: inset 0 0 0 2px var(--pc);
}

.av.big {
  width: 60px;
  height: 60px;
  font-size: 2rem;
}

.av.off {
  filter: grayscale(1);
  opacity: 0.6;
}

.waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.dots {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.25;
    transform: scale(0.7);
  }
}

/* ———— السؤال ———— */
.q-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
}

.q-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.q-num {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.95rem;
}

.q-progress {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.q-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--coral));
  transition: width 0.4s;
}

.my-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  padding: 4px 10px;
  border-radius: 14px;
  background: var(--surface-2);
  line-height: 1.2;
}

.my-score small {
  color: var(--muted);
  font-size: 0.75rem;
}

.my-score b {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--gold);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--c);
  background: var(--surface-2);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
  white-space: nowrap;
}

.chip.big {
  padding: 8px 18px;
  font-size: 1.1rem;
}

.timer {
  position: relative;
  flex: none;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
}

.timer svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg) scaleY(-1);
}

.timer circle {
  fill: none;
  stroke-width: 6;
}

.timer .track {
  stroke: var(--surface-2);
}

.timer .bar {
  stroke: var(--gold);
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.timer span {
  font-weight: 900;
  font-size: 1.3rem;
}

.timer.urgent .bar {
  stroke: var(--bad);
}

.timer.urgent span {
  color: var(--bad);
  animation: beat 1s ease-in-out infinite;
}

@keyframes beat {
  50% {
    transform: scale(1.18);
  }
}

.q-card {
  padding: 22px 18px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03)),
    var(--bg-2);
}

.q-text {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.65;
}

.q-card.small {
  padding: 14px 16px;
}

/* قسم «بنت ولد جماد نبات»: الحرف كبيراً بجانب السؤال */
.q-card.has-letter {
  display: flex;
  align-items: center;
  gap: 16px;
}

.letter-badge {
  flex: none;
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(160deg, #fbcfe8, #f472b6);
  color: #3b0a24;
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 10px 26px rgba(244, 114, 182, 0.35);
  animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.q-card.small .letter-badge {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  font-size: 1.7rem;
}

.answer-card.many b {
  font-size: 1.15rem;
  line-height: 1.8;
}

/* التصنيف الخامس وحده في سطره يأخذ العرض كلّه */
.cats .cat-tile:last-child:nth-child(odd),
.cat-grid .cat-toggle:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.q-card.small .q-text {
  font-size: 1.08rem;
  color: var(--muted);
}

.final-stake {
  text-align: center;
  font-weight: 700;
  color: var(--muted);
}

.final-stake b {
  color: var(--gold);
  font-size: 1.3rem;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--surface);
  text-align: start;
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.45;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}

button.choice:not(:disabled):active {
  transform: scale(0.98);
}

.choice .letter {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  font-weight: 900;
}

.choice .c-text {
  flex: 1;
}

.choice.sel {
  border-color: var(--gold);
  background: rgba(255, 210, 63, 0.1);
}

.choice.sel .letter {
  background: var(--gold);
  color: var(--gold-ink);
}

.choice:disabled {
  cursor: default;
}

.choices .choice:disabled:not(.sel) {
  opacity: 0.6;
}

.choices.revealed .choice {
  opacity: 0.6;
}

.choices.revealed .choice.right {
  opacity: 1;
  border-color: var(--good);
  background: var(--good-bg);
}

.choices.revealed .choice.right .letter {
  background: var(--good);
  color: #062b16;
}

.choices.revealed .choice.wrong {
  opacity: 1;
  border-color: var(--bad);
  background: var(--bad-bg);
}

.choices.revealed .choice.mine {
  opacity: 1;
}

.pick-count {
  min-width: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 0.85rem;
  text-align: center;
}

.answer-input {
  min-height: 60px;
  font-size: 1.25rem;
}

.conf {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.conf-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.conf-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.conf-btn {
  --tint: hsl(calc(215 - var(--h) * 9) 90% 62%);
  height: clamp(48px, 12vw, 58px);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  background: color-mix(in srgb, var(--tint) 16%, rgba(255, 255, 255, 0.04));
  color: var(--text);
  font-weight: 900;
  font-size: 1.35rem;
  transition: transform 0.12s, background 0.15s, opacity 0.2s;
}

.conf-btn:not(:disabled):hover {
  background: color-mix(in srgb, var(--tint) 30%, rgba(255, 255, 255, 0.04));
}

.conf-btn:not(:disabled):active {
  transform: scale(0.92);
}

.conf-btn.sel {
  background: var(--gold);
  border-color: transparent;
  color: var(--gold-ink);
  transform: scale(1.07);
  box-shadow: 0 0 0 3px rgba(255, 210, 63, 0.3), 0 8px 20px rgba(255, 176, 32, 0.35);
  opacity: 1;
}

.conf-btn.used {
  opacity: 0.22;
  text-decoration: line-through;
  cursor: not-allowed;
}

.conf-btn:disabled:not(.sel):not(.used) {
  opacity: 0.45;
  cursor: default;
}

.locked-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-radius: 16px;
  background: var(--good-bg);
  color: #a6f5c8;
  font-weight: 800;
  text-align: center;
}

.progress-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.avatars {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.avatars .av {
  opacity: 0.4;
  transition: opacity 0.3s, transform 0.3s;
}

.avatars .av.done {
  opacity: 1;
  transform: scale(1.05);
}

.host-bar {
  display: flex;
  justify-content: center;
}

/* ———— الكشف ———— */
.answer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--good-bg);
  border: 2px solid var(--good);
  text-align: center;
}

.answer-card small {
  color: #a6f5c8;
  font-weight: 700;
}

.answer-card b {
  font-size: 1.6rem;
  font-weight: 900;
}

.my-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  animation: pop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes pop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.my-result.good {
  background: linear-gradient(135deg, rgba(43, 213, 118, 0.28), rgba(43, 213, 118, 0.1));
}

.my-result.bad {
  background: linear-gradient(135deg, rgba(255, 92, 122, 0.26), rgba(255, 92, 122, 0.08));
}

.mr-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
}

.good .mr-icon {
  background: var(--good);
}

.bad .mr-icon {
  background: var(--bad);
}

.mr-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.mr-text b {
  font-size: 1.15rem;
}

.mr-text small {
  color: var(--muted);
}

.mr-points {
  font-size: 1.4rem;
  font-weight: 900;
}

.good .mr-points {
  color: #8ff0b8;
}

.bad .mr-points {
  color: #ffb3c1;
  font-size: 1.05rem;
}

.my-result .link-btn {
  flex-basis: 100%;
  text-align: start;
}

.info-card {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(56, 189, 248, 0.1);
  color: #c4ecff;
  font-weight: 600;
  line-height: 1.6;
}

.info-card .icon {
  color: #7dd3fc;
  margin-top: 3px;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ans-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--surface);
  border-inline-start: 4px solid var(--bad);
}

.ans-row.good {
  border-inline-start-color: var(--good);
}

.ans-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.ans-given {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.ans-conf {
  color: var(--faint);
  font-size: 0.82rem;
  white-space: nowrap;
}

.ans-pts {
  min-width: 40px;
  text-align: center;
  font-weight: 900;
}

.ans-row.good .ans-pts {
  color: #8ff0b8;
}

.judge {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
}

.judge.to-good {
  color: var(--good);
}

.judge.to-bad {
  color: var(--bad);
}

.standings {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.st-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 14px;
  background: var(--surface);
}

.st-row.me {
  background: rgba(255, 210, 63, 0.1);
  outline: 1px solid rgba(255, 210, 63, 0.35);
}

.st-rank {
  width: 24px;
  text-align: center;
  font-weight: 900;
  color: var(--faint);
}

.st-name {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.st-delta {
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0 8px;
  border-radius: 999px;
}

.st-delta.up {
  color: #8ff0b8;
  background: var(--good-bg);
}

.st-delta.down {
  color: #ffb3c1;
  background: var(--bad-bg);
}

.st-score {
  min-width: 44px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--gold);
}

.next-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: sticky;
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
}

/* ———— السؤال الأخير ———— */
.final-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 16px;
  text-align: center;
  border-radius: var(--radius);
  background:
    radial-gradient(420px 220px at 50% 0, rgba(255, 122, 89, 0.3), transparent 70%),
    var(--surface);
  border: 1px solid var(--line);
}

.final-badge {
  padding: 4px 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--coral));
  color: var(--gold-ink);
  font-weight: 900;
}

.final-hero h2 {
  font-size: 1.6rem;
  font-weight: 900;
}

.bets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.bet-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 18px 8px;
  border-radius: 20px;
  border: 2px solid var(--line);
  background: var(--surface);
  transition: transform 0.12s, border-color 0.2s;
}

.bet-btn b {
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1.1;
}

.bet-btn small {
  color: var(--muted);
  font-weight: 700;
}

.bet-btn:hover {
  border-color: var(--gold);
}

.bet-btn:active {
  transform: scale(0.95);
}

.bet-btn.b20 b {
  color: var(--coral);
}

.bet-btn.b10 b {
  color: var(--gold);
}

/* ———— النتائج ———— */
.results-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
  padding-top: 8px;
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  padding-top: 10px;
}

.pod {
  flex: 1;
  max-width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.pod-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pod-score {
  color: var(--gold);
  font-weight: 900;
  font-size: 1.2rem;
}

.pod-block {
  width: 100%;
  display: grid;
  place-items: center;
  border-radius: 16px 16px 6px 6px;
  font-size: 1.8rem;
  font-weight: 900;
  color: rgba(0, 0, 0, 0.55);
}

.pod-1 .pod-block {
  height: 120px;
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
}

.pod-2 .pod-block {
  height: 86px;
  background: linear-gradient(180deg, #e2e8f0, #94a3b8);
}

.pod-3 .pod-block {
  height: 62px;
  background: linear-gradient(180deg, #fdba74, #c2410c);
}

.pod.first .av {
  box-shadow: inset 0 0 0 3px var(--gold), 0 0 26px rgba(255, 210, 63, 0.5);
}

.solo-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0;
}

.solo-score b {
  font-size: 4.4rem;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(90deg, var(--gold), var(--coral));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.solo-score small {
  color: var(--muted);
  font-weight: 700;
}

.new-best {
  margin-top: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--good-bg);
  color: #8ff0b8;
  font-weight: 800;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.stat-grid > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
  line-height: 1.35;
}

.stat-grid b {
  font-size: 1.5rem;
  font-weight: 900;
}

.stat-grid b.good {
  color: #8ff0b8;
}

.stat-grid b.bad {
  color: #ffb3c1;
}

.stat-grid small {
  color: var(--muted);
}

.cat-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.cat-bar {
  display: grid;
  grid-template-columns: 9.5em 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 700;
}

.cat-bar .bar {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.cat-bar .bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--c);
}

.review summary {
  cursor: pointer;
  font-weight: 800;
}

.review ol {
  margin: 12px 0 0;
  padding-inline-start: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.review li {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface);
  border-inline-start: 4px solid var(--c);
  line-height: 1.5;
}

.review li::marker {
  color: var(--faint);
  font-weight: 800;
}

.rv-q {
  font-weight: 700;
}

.rv-a,
.rv-g {
  color: var(--muted);
  font-size: 0.9rem;
}

.review li.good .rv-g b {
  color: #8ff0b8;
}

.review li.bad .rv-g b {
  color: #ffb3c1;
}

/* ———— النوافذ والتنبيهات ———— */
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: rgba(6, 4, 24, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade 0.2s;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow: auto;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  border-radius: 24px;
  background: #1d1a4a;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: rise 0.25s ease-out;
}

@media (min-width: 640px) {
  .modal-back {
    align-items: center;
  }
}

.modal-x {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
}

.help h2 {
  font-size: 1.35rem;
  font-weight: 900;
  margin-bottom: 12px;
  padding-inline-end: 40px;
}

.help ol {
  margin: 0 0 12px;
  padding-inline-start: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help b {
  color: var(--gold);
}

.confirm {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 18px;
}

.confirm p {
  font-size: 1.15rem;
  font-weight: 800;
  padding-inline-end: 30px;
}

.confirm .btn {
  flex: 1;
}

.toast {
  position: fixed;
  top: calc(70px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 14px;
  background: #2b2768;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-weight: 700;
  text-align: center;
  transform: translateX(-50%);
  animation: drop 0.25s ease-out;
}

.toast.bad {
  background: #5b1830;
  border-color: rgba(255, 92, 122, 0.5);
}

.toast.good {
  background: #11452c;
  border-color: rgba(43, 213, 118, 0.5);
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
}

.netbar {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  z-index: 30;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #8a4b00;
  color: #fff;
  text-align: center;
  font-weight: 800;
}

.center-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px 0;
  color: var(--muted);
  font-weight: 700;
}

.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid var(--surface-2);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

.boot {
  display: grid;
  place-items: center;
  min-height: 70vh;
  color: var(--muted);
  font-weight: 700;
}

/* ———— الشاشات الكبيرة (العرض على تلفاز أو حاسوب) ———— */
@media (min-width: 1000px) {
  body {
    font-size: 18px;
  }

  .main {
    max-width: 760px;
  }

  .q-text {
    font-size: 1.8rem;
  }

  .choices:not(.revealed) {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 380px) {
  .q-text {
    font-size: 1.28rem;
  }

  .conf-btn {
    font-size: 1.15rem;
  }

  .room-code {
    font-size: 3rem;
  }

  .cat-bar {
    grid-template-columns: 7.5em 1fr auto;
  }
}

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