:root {
  color-scheme: light;
  --ink: #172554;
  --muted: #64748b;
  --paper: #fffdf7;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --line: rgba(148, 163, 184, 0.28);
  --green: #22c55e;
  --red: #ef4444;
  --blue: #2563eb;
  --indigo: #4f46e5;
  --yellow: #facc15;
  --pink: #fb7185;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.16);
  --shadow-soft: 0 14px 36px rgba(15, 23, 42, 0.1);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(250, 204, 21, 0.32), transparent 26rem),
    radial-gradient(circle at 86% 18%, rgba(79, 70, 229, 0.18), transparent 26rem),
    radial-gradient(circle at 88% 86%, rgba(34, 197, 94, 0.2), transparent 24rem),
    linear-gradient(135deg, #eef6ff 0%, #fffdf7 50%, #fff1f2 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.06) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.78), transparent 78%);
}

button {
  font: inherit;
}

.ambient {
  position: fixed;
  z-index: -2;
  border-radius: 999px;
  filter: blur(3px);
  opacity: 0.8;
}

.ambient-one {
  width: 19rem;
  height: 19rem;
  left: -5rem;
  bottom: 6rem;
  background: rgba(251, 113, 133, 0.18);
}

.ambient-two {
  width: 15rem;
  height: 15rem;
  right: -3rem;
  top: 5rem;
  background: rgba(37, 99, 235, 0.14);
}

.game-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.stage {
  position: relative;
  width: min(1120px, 100%);
  min-height: min(704px, calc(100vh - 56px));
  padding: clamp(18px, 3vw, 32px);
  overflow: hidden;
  background: rgba(255, 253, 247, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 36%, rgba(255, 255, 255, 0.4));
}

.stage > * {
  position: relative;
}

.topbar,
.play-area,
.scoreboard,
.timer-row,
.segmented,
.question-header {
  display: flex;
}

.topbar {
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
.lede {
  margin: 0;
}

h1 {
  margin-top: 4px;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 0.92;
  letter-spacing: -0.08em;
  color: #0f172a;
}

.lede {
  max-width: 34rem;
  margin-top: 12px;
  color: #475569;
  font-size: clamp(1rem, 2vw, 1.13rem);
  font-weight: 700;
}

.scoreboard {
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.scoreboard div {
  min-width: 98px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
}

.scoreboard strong {
  display: block;
  margin-top: 3px;
  color: #0f172a;
  font-size: 1.65rem;
  line-height: 1;
}

.play-area {
  align-items: stretch;
  gap: 20px;
}

.side-panel,
.question-panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
}

.side-panel {
  width: 270px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-radius: var(--radius-lg);
}

.mascot {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 26%, rgba(255, 255, 255, 0.9), transparent 7rem),
    linear-gradient(145deg, #dbeafe, #fef3c7 55%, #ffe4e6);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.mascot svg {
  width: 82%;
  height: 82%;
  filter: drop-shadow(0 14px 22px rgba(15, 23, 42, 0.18));
}

.setting {
  display: grid;
  gap: 10px;
}

.segmented {
  gap: 8px;
  padding: 6px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.chip,
.secondary,
.primary,
.answer {
  border: 0;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.chip,
.secondary {
  color: var(--ink);
  font-weight: 900;
}

.chip {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border-radius: 13px;
}

.chip.active {
  background: var(--panel-strong);
  color: var(--indigo);
  box-shadow: 0 9px 20px rgba(15, 23, 42, 0.1);
}

.secondary {
  margin-top: auto;
  padding: 13px 15px;
  background: #0f172a;
  color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.18);
}

.question-panel {
  flex: 1;
  min-width: 0;
  padding: clamp(18px, 3vw, 28px);
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 18px;
  border-radius: var(--radius-lg);
}

.question-header {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #64748b;
  font-size: 0.95rem;
  font-weight: 800;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: #166534;
  background: #dcfce7;
  border: 1px solid rgba(34, 197, 94, 0.28);
  border-radius: 999px;
}

.status-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.16);
}

.timer-row {
  align-items: center;
  gap: 12px;
}

.timer-track {
  flex: 1;
  height: 13px;
  padding: 3px;
  overflow: hidden;
  background: #e2e8f0;
  border-radius: 999px;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.12);
}

#timerBar {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--pink));
  border-radius: inherit;
  transform-origin: left center;
  transition: transform 0.24s linear;
}

#timeLeft {
  min-width: 2ch;
  text-align: right;
  font-size: 1.15rem;
}

.problem-box {
  position: relative;
  display: grid;
  align-content: center;
  gap: 18px;
  min-height: 230px;
  padding: clamp(24px, 5vw, 42px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.09) 1px, transparent 1px),
    linear-gradient(rgba(37, 99, 235, 0.09) 1px, transparent 1px),
    linear-gradient(145deg, #f8fbff, #fff7ed);
  background-size: 30px 30px, 30px 30px, auto;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.problem-box::after {
  content: "";
  position: absolute;
  width: 12rem;
  height: 12rem;
  right: -4rem;
  top: -5rem;
  background: rgba(250, 204, 21, 0.24);
  border-radius: 999px;
}

.feedback {
  position: relative;
  z-index: 1;
  min-height: 1.5rem;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 900;
}

.feedback.correct {
  color: #15803d;
}

.feedback.wrong {
  color: #b91c1c;
}

h2 {
  position: relative;
  z-index: 1;
  color: #0f172a;
  font-size: clamp(3rem, 8vw, 5.7rem);
  line-height: 0.95;
  letter-spacing: -0.07em;
}

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

.answer {
  min-height: 88px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff, #eff6ff);
  color: var(--ink);
  border: 1px solid #bfdbfe;
  border-bottom-width: 4px;
  border-radius: 22px;
  font-size: clamp(1.5rem, 5vw, 2.4rem);
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.1);
}

.answer:hover,
.chip:hover,
.secondary:hover,
.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.16);
}

.answer.correct {
  background: linear-gradient(180deg, #f0fdf4, #dcfce7);
  border-color: var(--green);
}

.answer.wrong {
  background: linear-gradient(180deg, #fff1f2, #fee2e2);
  border-color: var(--red);
}

.answer:disabled {
  cursor: default;
}

.answer:disabled:hover {
  transform: none;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.1);
}

.primary {
  justify-self: end;
  min-width: 150px;
  padding: 15px 20px;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  color: #ffffff;
  border-radius: 18px;
  font-weight: 900;
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.24);
}

.hidden {
  display: none;
}

@media (max-width: 780px) {
  .game-shell {
    padding: 14px;
    place-items: start center;
  }

  .stage {
    min-height: auto;
    border-radius: 26px;
  }

  .topbar,
  .play-area,
  .question-header {
    flex-direction: column;
  }

  .topbar,
  .question-header {
    align-items: flex-start;
  }

  .scoreboard {
    width: 100%;
    justify-content: stretch;
  }

  .scoreboard div {
    flex: 1;
    min-width: 0;
  }

  .side-panel {
    width: 100%;
  }

  .mascot {
    display: none;
  }

  .answers {
    grid-template-columns: 1fr;
  }

  .answer {
    min-height: 72px;
  }
}
