:root {
  --bg-deep: #0a1630;
  --bg-slate: #102445;
  --panel: rgba(244, 248, 252, 0.94);
  --ink: #10233d;
  --muted: #5f7691;
  --accent: #ffb85c;
  --accent-strong: #d97706;
  --ocean: #3ca7e2;
  --mint: #2fa87c;
  --danger: #cc5748;
  --shadow: 0 18px 48px rgba(8, 19, 36, 0.24);
  --radius-xl: 30px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100dvh;
  overflow: hidden;
  padding: 12px;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 184, 92, 0.25), transparent 25%),
    radial-gradient(circle at bottom right, rgba(60, 167, 226, 0.22), transparent 30%),
    linear-gradient(145deg, #081221 0%, #14335a 52%, #0a1930 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: 7%;
  left: 6%;
  width: 200px;
  height: 200px;
  border-radius: 42px;
  transform: rotate(16deg);
  background: linear-gradient(135deg, rgba(255, 184, 92, 0.18), rgba(255, 184, 92, 0));
}

body::after {
  bottom: 10%;
  right: 6%;
  width: 280px;
  height: 160px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(60, 167, 226, 0.16), rgba(60, 167, 226, 0));
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  height: calc(100dvh - 24px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.app-shell:fullscreen {
  width: 100%;
  height: 100dvh;
  padding: 12px;
  background:
    radial-gradient(circle at top left, rgba(255, 184, 92, 0.25), transparent 25%),
    radial-gradient(circle at bottom right, rgba(60, 167, 226, 0.22), transparent 30%),
    linear-gradient(145deg, #081221 0%, #14335a 52%, #0a1930 100%);
}

.screen-stack {
  height: 100%;
  min-height: 0;
}

.panel {
  height: 100%;
  background: var(--panel);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.56);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  overflow: hidden;
  animation: rise 0.45s ease;
}

.hidden {
  display: none;
}

.app-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(244, 248, 252, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 28px rgba(8, 19, 35, 0.18);
  backdrop-filter: blur(14px);
}

.toolbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #edf4fb;
  font-weight: 700;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #ffdf95);
  box-shadow: 0 0 0 6px rgba(255, 184, 92, 0.14);
}

.toolbar-button,
.primary-button,
.secondary-button,
.answer-button {
  border: none;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.toolbar-button {
  padding: 10px 16px;
  font-weight: 700;
  color: #11253f;
  background: linear-gradient(135deg, #ffd39b 0%, #ffffff 100%);
  box-shadow: 0 12px 24px rgba(8, 19, 35, 0.18);
}

.toolbar-button:hover,
.primary-button:hover,
.secondary-button:hover,
.answer-button:hover {
  transform: translateY(-2px);
}

.hero-screen {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 24px;
  padding: 24px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-copy h1,
.setup-card h2,
.question-card h2,
.results-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.hero-copy h1 {
  font-size: clamp(2.5rem, 4vw, 4.2rem);
  line-height: 0.94;
  margin-top: 8px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.78rem;
  font-weight: 700;
}

.intro {
  max-width: 54ch;
  margin: 14px 0 18px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 1rem;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.mini-card,
.score-card,
.result-card {
  background: rgba(255, 255, 255, 0.86);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid rgba(16, 35, 61, 0.08);
}

.mini-card span,
.score-card span,
.result-card span,
.progress-copy span,
.timer-box span,
.field span,
.tips-box p,
.review-heading p,
.question-kicker {
  color: var(--muted);
}

.mini-card strong,
.score-card strong,
.result-card strong {
  display: block;
  margin-top: 7px;
  font-size: 1.45rem;
}

.setup-card {
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding: 22px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(243, 247, 251, 0.92));
  border: 1px solid rgba(16, 35, 61, 0.08);
}

.setup-card h2 {
  font-size: 1.55rem;
  margin-bottom: 16px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.94rem;
}

select {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(16, 35, 61, 0.14);
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

select:focus {
  border-color: var(--ocean);
  box-shadow: 0 0 0 4px rgba(60, 167, 226, 0.14);
}

.helper-text {
  margin: 4px 0 16px;
  color: var(--muted);
  line-height: 1.5;
}

.primary-button,
.secondary-button {
  padding: 13px 18px;
  font-weight: 700;
}

.primary-button {
  width: 100%;
  background: linear-gradient(135deg, var(--accent) 0%, #ffd08a 100%);
  color: #2b1b08;
  box-shadow: 0 12px 24px rgba(217, 119, 6, 0.24);
}

.secondary-button {
  background: rgba(16, 35, 61, 0.08);
  color: var(--ink);
}

.tips-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: rgba(16, 35, 61, 0.05);
}

.tips-box p {
  margin: 7px 0;
  line-height: 1.45;
}

.quiz-screen,
.results-screen {
  padding: 22px;
}

.quiz-screen {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 14px;
}

.quiz-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

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

.chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 184, 92, 0.18);
  color: #8e5107;
  font-weight: 700;
}

.chip-alt {
  background: rgba(60, 167, 226, 0.14);
  color: #14587f;
}

.chip-dark {
  background: rgba(16, 35, 61, 0.1);
  color: var(--ink);
}

.timer-box {
  min-width: 190px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(16, 35, 61, 0.06);
}

.timer-box strong {
  display: block;
  margin: 6px 0 10px;
  font-size: 1.5rem;
}

.timer-track,
.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(16, 35, 61, 0.08);
}

.timer-bar,
.progress-bar {
  height: 100%;
  border-radius: inherit;
  transition: width 0.25s ease, background 0.25s ease;
}

.timer-bar {
  width: 100%;
  background: linear-gradient(90deg, #5fd18e 0%, #ffb85c 72%, #cc5748 100%);
}

.score-grid,
.results-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-weight: 700;
}

.progress-bar {
  width: 0%;
  background: linear-gradient(90deg, var(--ocean), var(--accent));
}

.question-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 22px;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at top right, rgba(255, 184, 92, 0.14), transparent 25%),
    linear-gradient(180deg, #ffffff, #f7fafc);
  border: 1px solid rgba(16, 35, 61, 0.08);
}

.question-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  font-weight: 700;
}

.question-card h2 {
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  line-height: 1.22;
}

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

.answer-button {
  min-height: 84px;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  background: #ffffff;
  border: 1px solid rgba(16, 35, 61, 0.12);
  color: var(--ink);
  box-shadow: 0 10px 18px rgba(13, 27, 42, 0.05);
}

.answer-button strong {
  display: inline-flex;
  width: 34px;
  height: 34px;
  margin-right: 12px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: rgba(16, 35, 61, 0.08);
}

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

.answer-button.correct {
  background: rgba(47, 168, 124, 0.12);
  border-color: rgba(47, 168, 124, 0.42);
}

.answer-button.wrong {
  background: rgba(204, 87, 72, 0.12);
  border-color: rgba(204, 87, 72, 0.36);
}

.answer-button.dimmed {
  opacity: 0.68;
}

.feedback-panel {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: rgba(16, 35, 61, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.feedback-panel p {
  margin: 0;
  line-height: 1.55;
}

.feedback-panel.correct {
  background: rgba(47, 168, 124, 0.12);
}

.feedback-panel.wrong,
.feedback-panel.timeout {
  background: rgba(204, 87, 72, 0.11);
}

.results-screen {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 16px;
}

.results-header h2 {
  font-size: clamp(1.9rem, 3.5vw, 2.8rem);
  margin: 8px 0 10px;
}

.results-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.results-actions {
  display: flex;
  gap: 12px;
}

.results-actions .primary-button,
.results-actions .secondary-button {
  width: auto;
}

.review-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: 18px;
  border-top: 1px solid rgba(16, 35, 61, 0.08);
}

.review-heading h3 {
  margin: 0;
  font-size: 1.25rem;
}

.review-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.review-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(16, 35, 61, 0.08);
}

.review-card.good {
  background: rgba(47, 168, 124, 0.08);
}

.review-card.bad {
  background: rgba(204, 87, 72, 0.07);
}

.review-card h4 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.mini-tag {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(16, 35, 61, 0.08);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
}

.review-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

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

@media (max-width: 920px) {
  body {
    overflow: auto;
    padding: 10px;
  }

  .app-shell {
    height: auto;
    min-height: calc(100dvh - 20px);
  }

  .hero-screen {
    grid-template-columns: 1fr;
  }

  .quiz-topbar {
    flex-direction: column;
  }

  .timer-box {
    width: 100%;
  }

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

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

@media (max-width: 640px) {
  body {
    padding: 8px;
  }

  .app-shell {
    min-height: calc(100dvh - 16px);
  }

  .app-toolbar {
    border-radius: 24px;
    padding: 10px 12px;
  }

  .toolbar-brand {
    font-size: 0.92rem;
  }

  .toolbar-button {
    padding: 9px 14px;
    font-size: 0.92rem;
  }

  .hero-screen,
  .quiz-screen,
  .results-screen {
    padding: 16px;
  }

  .stats-strip,
  .score-grid,
  .results-grid {
    grid-template-columns: 1fr 1fr;
  }

  .feedback-panel,
  .results-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .results-actions .primary-button,
  .results-actions .secondary-button {
    width: 100%;
  }
}