:root {
  color-scheme: dark;
  --navy: #0b1428;
  --panel: #111f37;
  --surface: #1a2c47;
  --line: #354e70;
  --text: #edf4ff;
  --muted: #b4c7e4;
  --blue: #95c6ff;
  --mint: #79e0c0;
  --rose: #ffadb8;
  --gold: #f9d58a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 70% 0, #263d64, transparent 65%), var(--navy);
  color: var(--text);
  font: 1rem/1.4 system-ui, sans-serif;
  min-height: 100dvh;
}
a { color: var(--blue); text-decoration: none; }
button, input, select, summary { font: inherit; }
button, input, select, .quiz-link, .arena-header summary {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  padding: 7px 10px;
}
button, .quiz-link {
  background: linear-gradient(120deg, #3564ad, #23447f);
  border-color: #597fb4;
  font-weight: 720;
  cursor: pointer;
}
button:disabled { opacity: .58; cursor: wait; }
button:not(:disabled):hover, .quiz-link:hover { border-color: var(--blue); }
.secondary { background: var(--surface); border-color: var(--line); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
h1, h2, p, figure { margin: 0; }
h1 { font-size: clamp(1.35rem, 4vw, 2.6rem); line-height: 1.1; }
h2 { font-size: clamp(1.05rem, 3vw, 1.4rem); line-height: 1.2; }
p, small { color: var(--muted); }
.arena-shell {
  max-width: 960px;
  margin-inline: auto;
  padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
.arena-header {
  display: grid;
  grid-template-columns: minmax(44px, 1fr) minmax(0, 2fr) minmax(44px, 1fr);
  align-items: center;
  gap: 8px;
}
.arena-brand, .quiz-link, .arena-header summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.arena-brand { justify-content: flex-start; min-height: 44px; overflow-wrap: anywhere; }
.arena-brand span {
  padding: 5px 8px;
  border: 1px solid #69a1d7;
  border-radius: 9px;
  background: #1b3859;
  font-size: 1.25rem;
  line-height: 1.2;
}
.quiz-link, .arena-header summary { text-align: center; overflow-wrap: anywhere; }
.quiz-link .coin-icon { flex: none; }
.coin-amount { display: inline-flex; align-items: center; gap: .25em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.coin-icon { width: 1.2em; height: 1.2em; flex: none; vertical-align: middle; }
.coin-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.stake-field { display: flex; align-items: center; gap: 6px; min-width: 0; }
.arena-header details { position: relative; }
.arena-header summary, .rules summary, #restoreDetails summary { cursor: pointer; font-weight: 650; }
.arena-header summary::-webkit-details-marker { display: none; }
.menu {
  position: absolute;
  z-index: 2;
  inset: calc(100% + 7px) 0 auto auto;
  width: min(230px, 72vw);
  display: grid;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 12px 25px #030919a6;
}
.menu a { display: grid; align-items: center; min-height: 44px; padding: 4px 8px; }
.menu a[aria-current] { color: var(--text); background: var(--surface); border-radius: 8px; }
.menu label { padding-inline: 8px; color: var(--muted); }
main { display: grid; gap: 9px; margin-top: clamp(8px, 2dvh, 18px); }
.arena-heading, .topline, .round-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.arena-heading {
  min-width: 0;
  flex-wrap: wrap;
  gap: 16px;
  padding: clamp(14px, 3vw, 28px);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--blue);
  border-radius: 14px;
  background: var(--panel);
}
.arena-heading p { margin-block-start: 6px; max-inline-size: 52ch; }
.arena-wallet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.arena-wallet > div { display: grid; gap: 3px; padding: 6px 10px; background: var(--surface); border-radius: 8px; }
.arena-wallet .coin-amount { color: var(--gold); font-size: 1.1rem; font-weight: 760; }
.arena-wallet > div + div .coin-amount { color: var(--blue); }
.stats small { display: block; }
.arena-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.arena-tabs button { background: #14243b; border-color: transparent; padding-inline: 3px; overflow-wrap: anywhere; font-size: .85rem; }
.arena-tabs [aria-pressed="true"] { border-color: #6aa8e9; background: #234b7b; }
#notice:empty { display: none; }
#notice { border-inline-start: 3px solid var(--blue); padding-inline: 8px; overflow-wrap: anywhere; }
.panel {
  display: grid;
  gap: 9px;
  padding: clamp(9px, 2vw, 20px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, #192b47, var(--panel) 55%);
  box-shadow: 0 8px 24px #03091960;
  animation: appear .22s ease-out both;
}
#ranking {
  max-block-size: clamp(120px, calc(100dvh - 335px), 510px);
  overflow: auto;
  margin: 0;
  scrollbar-color: #5475a1 var(--panel);
}
.lobby { display: grid; gap: 12px; }
.lobby-start, .create-facts, .how ol { display: grid; gap: 10px; }
.lobby-start {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.how ol {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding-inline-start: 1.4em;
  color: var(--text);
}
.how li { padding-inline-end: 12px; }
.how li::marker { color: var(--blue); font-weight: 750; }
.how > p, .commit-note { font-size: .93rem; }
.slot-caption { font-weight: 650; }
.slots { display: flex; gap: 5px; max-width: 18rem; }
.slots span { flex: 1; height: 6px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.slots .filled { background: var(--blue); border-color: var(--blue); }
.create-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.create-facts p { border-radius: 8px; background: var(--surface); padding: 7px 10px; overflow-wrap: anywhere; }
.confirm-choice {
  min-height: 44px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.confirm-choice input { width: 20px; min-height: 20px; margin: 0; accent-color: var(--blue); }
#create button:disabled, #newChallenge:disabled { cursor: default; }
#joinedSection { display: grid; gap: 8px; }
.game-list { display: grid; align-content: start; gap: 8px; }
.game-list > p { padding: 12px; border: 1px dashed var(--line); border-radius: 8px; }
.game {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.game > div:first-child { min-inline-size: 0; overflow-wrap: anywhere; }
.game h3, #joinedSection h3 { margin: 0; font-size: 1rem; }
.game small { display: block; font-size: .87rem; }
.game-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-block: 5px; }
.game .game-status {
  display: inline-block;
  padding: 2px 8px;
  margin-block-start: 4px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--blue);
}
.game-status[data-outcome="win"] { color: var(--mint); }
.game-status[data-outcome="loss"] { color: var(--rose); }
.game[data-status="cancelled"] .game-status, .game-status[data-outcome="draw"] { color: var(--gold); }
.game-actions, .actions { display: flex; flex-wrap: wrap; gap: 5px; }
.game-actions:empty { display: none; }
#ranking { padding-inline-start: 28px; }
#ranking li { padding: 5px; overflow-wrap: anywhere; }
form, #guest, #signed, .recovery-box { display: grid; gap: 7px; }
.fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.fields label { display: grid; align-content: start; gap: 4px; }
.fields label:first-child { grid-column: 1 / -1; }
input, form select { width: 100%; font-size: max(16px, 1rem); }
body, button, input, select, summary, a { touch-action: manipulation; }
#restoreDetails > summary, .rules > summary { padding-block: 6px; min-height: 44px; align-content: center; }
#restoreDetails p, .rules p { margin-block: 5px; }
#restoreDetails form { margin-block-start: 7px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; overflow-wrap: anywhere; }
.stats > * { padding: 5px; background: var(--surface); border-radius: 5px; }
.recovery-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
#secret { font-family: monospace; }
.rules { color: var(--muted); padding-inline: 5px; }
@media (max-width: 620px) {
  .arena-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .how ol { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .arena-wallet { width: 100%; }
}
@media (max-width: 400px) {
  .lobby-start, .game, .create-facts { grid-template-columns: minmax(0, 1fr); }
  .game-actions > button { flex: 1 1 auto; }
}
.arena-shell:has(.round:not([hidden])) .arena-heading { display: none; }
.round { --answer-list-height: clamp(86px, calc(100dvh - 470px), 220px); animation:none; }
.round figure { min-inline-size: 0; }
#photo { touch-action: pan-y; }
html:lang(hi) body {font-family:"Nirmala UI","Kohinoor Devanagari","Noto Sans Devanagari",Mangal,system-ui,sans-serif}
#answer { min-inline-size: 0; }
.answer-options {
  display: grid;
  align-content: start;
  gap: 4px;
  min-inline-size: 0;
  max-block-size: var(--answer-list-height);
  overflow: auto;
  overscroll-behavior-y: contain;
  scrollbar-color: #5475a1 var(--panel);
}
.four-choices .answer-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-block-size: none;
  overflow: visible;
}
.answer-options button {
  min-block-size: 44px;
  padding: 5px 8px;
  background: var(--surface);
  color: var(--text);
  text-align: start;
  overflow-wrap: anywhere;
  line-height: 1.23;
  transition: background-color .15s ease, border-color .15s ease;
}
.answer-options button[aria-pressed="true"] {
  background: #254f80;
  border-color: var(--blue);
  box-shadow: inset 3px 0 var(--blue);
}
.answer-options button[aria-pressed="true"]:disabled { opacity: 1; }
.round-photo {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(86px, calc(100dvh - 295px - var(--answer-list-height)), 490px);
  background: #080f1f;
  border-radius: 9px;
  overflow: hidden;
}
.round-photo #photo { display:block;width:100%;height:100%;object-fit:contain }
.round-photo:not([data-photo-state="ready"]) #photo { visibility:hidden }
#roundPhotoStatus {
  position:absolute;inset:0;display:grid;place-content:center;text-align:center;gap:4px;
  padding:4px;color:var(--muted);background:#0d1d34;
}
.four-choices .round-photo { height: clamp(86px, calc(100dvh - 338px), 490px); }
#answerReviewRows {display:grid;gap:.45rem;overflow-wrap:anywhere}
#credit {
  display: block;
  font-size: .75rem;
  text-align: end;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#timer {
  padding: 3px 12px;
  border: 1px solid #8a6e3f;
  border-radius: 30px;
  color: var(--gold);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-inline-size: 4ch;
  text-align: end;
}
#timer.urgent { color: var(--rose); border-color: var(--rose); animation: pulse .9s ease-in-out infinite alternate; }
.result-scores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.score-card {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow-wrap: anywhere;
}
.score-card b { font-size: clamp(1.1rem, 5vw, 2rem); }
.score-card.winner { border-color: var(--mint); }
.correct, .result[data-outcome="win"] .coin-delta { color: var(--mint); }
.incorrect, .result[data-outcome="loss"] .coin-delta { color: var(--rose); }
.coin-delta { color: var(--gold); font-size: 1.3rem; font-weight: 750; animation: coin-in .28s ease-out both; }
@keyframes appear { from { opacity: .65; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes coin-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { from { background: transparent; } to { background: #7b354469; } }
@media (max-width: 480px) {
  .arena-brand b { display: none; }
  .arena-header { grid-template-columns: 44px minmax(0, 1fr) minmax(62px, auto); }
}
@media (max-width: 650px) {
  .round { --answer-list-height: clamp(86px, calc(100dvh - 470px), 165px); gap: 6px; }
  .round #answer { gap: 5px; }
  .round-photo { height: clamp(86px, calc(100dvh - 270px - var(--answer-list-height)), 490px); }
  .four-choices .round-photo { height: clamp(86px, calc(100dvh - 350px), 490px); }
}
@media (orientation: landscape) and (max-height: 480px) {
  main { gap: 6px; margin-top: 6px; }
  .panel { gap: 6px; padding: 9px; }
  .round { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .round-bar { grid-column: 1 / -1; }
  .round-photo, .four-choices .round-photo { height: clamp(85px, calc(100dvh - 152px), 245px); }
  .answer-options { max-block-size: clamp(60px, calc(100dvh - 216px), 180px); }
  #answer { align-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; }
  .answer-options button { transition: none; }
}
