:root {
  color-scheme: dark;
  --ink: #0a0e0b;
  --surface: #111916;
  --surface-2: #171f1a;
  --surface-raised: #1c2620;
  --brass: #c9982f;
  --brass-light: #e8c55a;
  --cream: #e8ddc8;
  --muted: #9b9480;
  --jade: #2d9d7a;
  --jade-subtle: rgba(45, 157, 122, 0.12);
  --ruby: #c44d46;
  --ruby-subtle: rgba(196, 77, 70, 0.12);
  --border: rgba(232, 221, 200, 0.08);
  --border-hover: rgba(232, 221, 200, 0.16);
  --border-accent: rgba(201, 152, 47, 0.3);
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; margin: 0; }

html {
  min-height: 100%;
  background: var(--ink);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--cream);
  font-family: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Geeza Pro", Tahoma, sans-serif;
  font-weight: 500;
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, rgba(45, 157, 122, 0.06) 0%, transparent 60%),
    var(--ink);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; border: none; }
a { color: inherit; }
p { margin: 0; }

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brass-light);
  outline-offset: 3px;
}

#app { min-height: 100vh; }

/* ── Start & Result shells ── */

.start-screen, .result-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(20px, 5vw, 48px) clamp(16px, 4vw, 40px);
}

.intro-panel, .result-panel {
  width: min(640px, 100%);
  padding: clamp(28px, 6vw, 48px) clamp(20px, 5vw, 36px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.result-panel {
  width: min(720px, 100%);
}

.broadcast-mark {
  display: inline-block;
  margin-bottom: 20px;
  padding: 5px 14px;
  border-radius: 100px;
  color: var(--brass-light);
  background: rgba(201, 152, 47, 0.1);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.stage-asset {
  display: none;
}

.intro-panel h1, .result-panel h1 {
  color: var(--cream);
  font-size: clamp(2rem, 7vw, 3.8rem);
  line-height: 1.15;
  font-weight: 700;
  text-wrap: balance;
}

.intro-panel h1 span, .result-panel h1 span {
  color: var(--brass-light);
}

.tagline {
  max-width: 480px;
  margin: 16px auto 28px;
  color: var(--muted);
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  line-height: 1.85;
}

.primary-action {
  min-height: 52px;
  padding: 0 32px;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--brass-light);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease;
}

.primary-action:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.primary-action:active { transform: translateY(0); }

.secondary-action {
  min-height: 52px;
  padding: 0 24px;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  color: var(--cream);
  background: transparent;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

.secondary-action:hover {
  border-color: var(--border-accent);
  color: var(--brass-light);
}

.start-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.start-stats span {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(232, 221, 200, 0.04);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ── Game shell ── */

.game-shell {
  min-height: 100vh;
  padding: clamp(12px, 2vw, 20px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto 14px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-lockup img {
  display: none;
}

.brand-lockup p, .micro-label {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.brand-lockup h1 {
  color: var(--cream);
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 1.3;
  font-weight: 700;
}

.score-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  white-space: nowrap;
  font-size: 0.85rem;
}

.score-strip span { color: var(--muted); }
.score-strip strong { color: var(--brass-light); }

.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: clamp(12px, 2vw, 20px);
  max-width: 1200px;
  margin: 0 auto;
}

.question-zone, .ladder-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.question-zone {
  padding: clamp(20px, 4vw, 36px);
}

.question-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: clamp(20px, 3vw, 32px);
}

.question-toolbar strong {
  display: block;
  color: var(--brass-light);
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
}

/* ── Timer ── */

.timer {
  --timer-angle: 360deg;
  width: clamp(68px, 9vw, 88px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 0 56%, transparent 57%),
    conic-gradient(var(--brass-light) var(--timer-angle), var(--border) 0);
  color: var(--brass-light);
}

.timer strong, .timer span { grid-area: 1 / 1; }

.timer strong {
  margin-top: -8px;
  font-size: clamp(1.3rem, 2.8vw, 1.8rem);
  line-height: 1;
  font-weight: 700;
}

.timer span {
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.timer.danger {
  animation: pulse-danger 600ms ease-in-out infinite alternate;
  background:
    radial-gradient(circle at center, var(--surface) 0 56%, transparent 57%),
    conic-gradient(var(--ruby) var(--timer-angle), var(--border) 0);
  color: #ff8f78;
}

/* ── Question ── */

.question-text {
  margin-bottom: clamp(20px, 3vw, 32px);
  color: var(--cream);
  font-size: clamp(1.25rem, 3.5vw, 2rem);
  line-height: 1.6;
  font-weight: 700;
  text-wrap: balance;
}

/* ── Answer buttons ── */

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

.answer-button {
  min-height: 72px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  color: var(--cream);
  background: var(--surface-2);
  text-align: right;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.answer-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--border-accent);
  background: var(--surface-raised);
}

.answer-button:disabled { cursor: default; }

.answer-letter {
  width: 36px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--brass-light);
  background: rgba(201, 152, 47, 0.1);
  font-weight: 700;
  font-size: 0.9rem;
}

.answer-button span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(0.88rem, 1.6vw, 1rem);
  line-height: 1.7;
  font-weight: 600;
}

.answer-button.is-hidden {
  opacity: 0.3;
  border-style: dashed;
  border-color: var(--border);
  background: var(--surface);
}

.answer-button.is-selected {
  border-color: var(--brass-light);
}

.answer-button.is-locked {
  border-color: var(--brass-light);
  animation: lock-pulse 600ms ease-in-out infinite alternate;
}

.answer-button.is-correct {
  border-color: var(--jade);
  background: var(--jade-subtle);
  animation: answer-pop 400ms ease both;
}

.answer-button.is-wrong {
  border-color: var(--ruby);
  background: var(--ruby-subtle);
  animation: answer-shake 380ms ease both;
}

/* ── Feedback ── */

.feedback {
  margin: clamp(14px, 2vw, 20px) 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  background: rgba(232, 221, 200, 0.03);
  line-height: 1.75;
  font-size: 0.92rem;
}

.feedback strong {
  color: var(--cream);
  margin-inline-end: 4px;
}

.feedback.correct {
  color: #a8e4c6;
  background: var(--jade-subtle);
}

.feedback.wrong {
  color: #f0b0a8;
  background: var(--ruby-subtle);
}

/* ── Lifelines ── */

.lifeline-dock {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.lifeline-button {
  min-height: 50px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--cream);
  background: transparent;
  text-align: right;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}

.lifeline-button:hover:not(:disabled) {
  border-color: var(--border-accent);
  color: var(--brass-light);
}

.lifeline-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.lifeline-button span {
  display: grid;
  place-items: center;
  width: 24px;
  aspect-ratio: 1;
  color: var(--brass-light);
  font-size: 0.9rem;
}

.lifeline-button strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
}

.lifeline-panel {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  animation: rise-in 220ms ease both;
}

.panel-title {
  color: var(--brass-light);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.lifeline-panel p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.9rem;
}

.lifeline-panel strong { color: var(--cream); }

.poll-bars { display: grid; gap: 6px; }

.poll-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 40px;
  gap: 6px;
  align-items: center;
  font-size: 0.85rem;
}

.poll-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(232, 221, 200, 0.08);
  overflow: hidden;
}

.poll-track i {
  --poll-width: 0%;
  display: block;
  width: var(--poll-width);
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--jade), var(--brass-light));
}

/* ── Prize ladder ── */

.ladder-panel {
  padding: 14px;
  align-self: start;
  position: sticky;
  top: 14px;
}

.ladder-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.ladder-heading strong { color: var(--brass-light); }

.prize-ladder {
  display: grid;
  gap: 3px;
  padding: 0;
  list-style: none;
}

.prize-ladder li {
  min-height: 32px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.82rem;
}

.prize-ladder li.current {
  color: var(--cream);
  background: rgba(201, 152, 47, 0.12);
}

.prize-ladder li.passed {
  color: #a8e4c6;
}

.prize-ladder li.safe em {
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--ink);
  background: var(--brass-light);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
}

/* ── Result screen ── */

.score-card {
  width: min(480px, 100%);
  margin: 22px auto 18px;
  padding: clamp(22px, 5vw, 36px);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(232, 221, 200, 0.035), transparent 45%),
    radial-gradient(ellipse at 50% 0%, rgba(201, 152, 47, 0.14) 0%, transparent 62%),
    var(--surface-2);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
}

.final-score {
  color: var(--brass-light);
  font-size: clamp(2.35rem, 8vw, 4.7rem);
  font-weight: 700;
  line-height: 1;
  margin-bottom: 12px;
  transition: transform 300ms ease;
}

.final-score.score-landed {
  transform: scale(1.04);
}

.rank-badge {
  display: inline-block;
  padding: 7px 18px;
  border: 1px solid rgba(45, 157, 122, 0.28);
  border-radius: 100px;
  color: #a8e4c6;
  background: var(--jade-subtle);
  font-weight: 700;
  font-size: 0.95rem;
  transition: opacity 300ms ease, transform 300ms ease;
}

.rank-badge.rank-hidden {
  opacity: 0;
  transform: translateY(6px);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 14px;
  text-align: right;
}

.summary-grid section {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(232, 221, 200, 0.035);
}

.summary-grid span {
  display: block;
  color: var(--brass-light);
  font-weight: 700;
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.summary-grid p, .verdict {
  color: var(--muted);
  line-height: 1.75;
  font-size: 0.9rem;
}

.verdict {
  width: min(560px, 100%);
  margin: 0 auto 6px;
}

/* ── Social CTA ── */

.social-cta {
  margin: 18px 0 16px;
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(201, 152, 47, 0.08), transparent 46%),
    var(--surface-2);
  text-align: right;
}

.social-copy { max-width: 620px; }

.social-copy span {
  display: block;
  color: var(--brass-light);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.social-copy h2 {
  color: var(--cream);
  font-size: clamp(1.1rem, 2.8vw, 1.5rem);
  line-height: 1.55;
  font-weight: 700;
}

.social-copy p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.8;
  font-size: 0.9rem;
}

.social-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.social-link {
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease;
}

.social-link:hover {
  border-color: var(--border-accent);
  background: var(--surface-raised);
}

.social-link span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.social-link strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--cream);
  font-size: 0.88rem;
  font-weight: 600;
}

.social-link.facebook:hover { border-color: rgba(24, 119, 242, 0.5); }
.social-link.youtube:hover { border-color: rgba(255, 0, 0, 0.4); }
.social-link.instagram:hover { border-color: rgba(214, 41, 118, 0.4); }
.social-link.linkedin:hover { border-color: rgba(10, 102, 194, 0.5); }

.share-notice {
  min-height: 22px;
  margin-top: 12px;
  color: #a8e4c6;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.6;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.round-history {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 6px;
  margin-top: 20px;
  padding: 0;
  list-style: none;
}

.round-history li {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: rgba(232, 221, 200, 0.03);
  color: var(--muted);
  font-size: 0.82rem;
}

.round-history strong {
  display: block;
  font-size: 0.85rem;
  color: var(--cream);
}

.round-history li.right strong { color: #a8e4c6; }
.round-history li.miss strong { color: #f0b0a8; }

/* ── Animations ── */

@keyframes rise-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes answer-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

@keyframes answer-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(6px); }
  50% { transform: translateX(-5px); }
  75% { transform: translateX(3px); }
}

@keyframes lock-pulse {
  from { border-color: var(--brass-light); background: rgba(201, 152, 47, 0.08); }
  to { border-color: var(--border-hover); background: var(--surface-2); }
}

@keyframes pulse-danger {
  from { filter: brightness(1); }
  to { filter: brightness(1.2); }
}

/* ── Responsive ── */

@media (max-width: 980px) {
  .play-layout {
    display: flex;
    flex-direction: column;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .score-strip {
    justify-content: space-between;
    overflow-x: auto;
  }

  .ladder-panel { position: static; }

  .prize-ladder {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .prize-ladder li {
    grid-template-columns: 1fr;
    gap: 1px;
    text-align: center;
    padding: 6px;
  }
}

@media (max-width: 700px) {
  .question-zone { padding: 16px; }

  .answers-grid,
  .lifeline-dock,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .social-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-panel { padding-inline: 16px; }

  .score-card {
    margin-top: 18px;
  }

  .final-score {
    font-size: clamp(2.15rem, 12vw, 3.5rem);
  }

  .answer-button { min-height: 64px; }

  .score-strip { font-size: 0.8rem; }

  .prize-ladder {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

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