:root {
  color-scheme: light;
  --bg: #f4efe6;
  --panel: #fffdf8;
  --panel-border: #d9cdbd;
  --text: #2b241d;
  --muted: #736557;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --success: #166534;
  --danger: #b91c1c;
  --shadow: 0 20px 60px rgba(63, 40, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(15, 118, 110, 0.18), transparent 30%),
    linear-gradient(180deg, #f8f3ea 0%, var(--bg) 100%);
}

.app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  position: relative;
  width: min(680px, 100%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 32px 32px 56px;
  box-shadow: var(--shadow);
}

.eyebrow,
.progress,
.score,
.feedback {
  color: var(--muted);
}

h1,
h2,
p {
  margin-top: 0;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.question {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 24px;
}

.answers {
  display: grid;
  gap: 12px;
}

.text-answer {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

.text-answer:focus {
  outline: 2px solid rgba(15, 118, 110, 0.2);
  border-color: var(--accent);
}

.text-answer:disabled {
  background: #f4efe6;
  color: var(--muted);
}

.topics {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.topic-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
  align-items: center;
}

.topic-question-count {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

.selection-hint {
  margin-bottom: 8px;
}

.option-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 8px;
  color: var(--text);
}

.option-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.topic-button,
.answer-button,
.button {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.answer-button {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  text-align: left;
  background: #fff;
  color: var(--text);
}

.answer-shortcut {
  display: inline-grid;
  place-items: center;
  justify-self: start;
  align-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 2px solid var(--panel-border);
  background: transparent;
  color: var(--text);
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.answer-text {
  min-width: 0;
}

.topic-button {
  text-align: left;
  background: rgba(15, 118, 110, 0.08);
  color: var(--text);
}

.topic-button:hover,
.answer-button:hover:enabled,
.button:hover:enabled {
  transform: translateY(-1px);
}

.answer-button.selected {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.08);
}

.answer-button.selected .answer-shortcut {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.14);
  color: var(--accent-hover);
}

.answer-button.correct {
  border-color: var(--success);
  background: rgba(22, 101, 52, 0.12);
}

.answer-button.correct .answer-shortcut {
  border-color: var(--success);
  background: rgba(22, 101, 52, 0.14);
  color: var(--success);
}

.answer-button.incorrect {
  border-color: var(--danger);
  background: rgba(185, 28, 28, 0.1);
}

.answer-button.incorrect .answer-shortcut {
  border-color: var(--danger);
  background: rgba(185, 28, 28, 0.12);
  color: var(--danger);
}

.button {
  margin-top: 20px;
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.feedback {
  min-height: 24px;
  margin-top: 14px;
}

.explanation {
  min-height: 48px;
  margin-top: 10px;
  color: var(--text);
  line-height: 1.5;
}

.final-score {
  font-size: 1.25rem;
  margin-bottom: 20px;
}

.version {
  position: absolute;
  right: 32px;
  bottom: 24px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 640px) {
  .card {
    padding: 24px 24px 52px;
  }

  .topic-option {
    grid-template-columns: 1fr;
  }

  .quiz-header {
    flex-direction: column;
    gap: 4px;
  }

  .version {
    right: 24px;
    bottom: 18px;
  }
}
