:root {
  --bg: #f7f3ef;
  --panel: #ffffff;
  --text: #1c1c1c;
  --muted: #6f6a63;
  --accent: #1b9c5a;
  --danger: #c43a2f;
  --line: #ece5dd;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --font: "Figtree", "Avenir Next", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top left, #f2eee8 0%, #f8f4f1 40%, #f3efe9 100%);
  color: var(--text);
  font-family: var(--font);
}

.app {
  max-width: 980px;
  margin: 36px auto 60px;
  padding: 0 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  background: var(--panel);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2a8b6f 0%, #73c28c 100%);
}

.title {
  font-size: 20px;
  font-weight: 700;
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.timer {
  min-width: 220px;
  text-align: right;
}

.timer-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.timer-bar {
  margin: 8px 0 6px;
  height: 10px;
  background: #efe7df;
  border-radius: 999px;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transition: width 1s linear, background 0.4s ease;
}

.timer-fill.warning {
  background: var(--danger);
}

.timer-text {
  font-weight: 700;
  font-size: 16px;
}

.content {
  margin-top: 24px;
}

.panel {
  background: var(--panel);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.hidden {
  display: none;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.question-index {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.question-text {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 20px;
}

.options {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.page-btn {
  min-width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f6f1ec;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-btn.active {
  background: #0b1f3b;
  color: #f2d08c;
  border-color: #0b1f3b;
}

.page-btn.answered {
  border-color: #b9d7c5;
  background: #eef8f2;
}

.page-btn.answered.active {
  color: #f2d08c;
}

.page-btn:hover {
  transform: translateY(-1px);
}

.option {
  border: 1px solid var(--line);
  padding: 14px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.option input {
  accent-color: var(--accent);
}

.option.selected {
  border-color: #cfe7d8;
  background: #f4fbf7;
}

.option.correct {
  border-color: #74c69d;
  background: #e8f7ef;
}

.option.incorrect {
  border-color: #e39a93;
  background: #fdecea;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.nav-right {
  display: flex;
  gap: 12px;
}

.btn {
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  background: #1b7f5b;
  color: #fff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(27, 127, 91, 0.2);
}

.btn.ghost {
  background: #f0ebe6;
  color: var(--text);
  box-shadow: none;
}

.btn.danger {
  background: var(--danger);
}

.result-header {
  text-align: center;
  margin-bottom: 24px;
}

.result-title {
  font-size: 24px;
  font-weight: 700;
}

.score {
  font-size: 48px;
  font-weight: 800;
  margin-top: 8px;
}

.score-pct {
  font-size: 18px;
  color: var(--muted);
}

.review {
  display: grid;
  gap: 16px;
  margin: 24px 0;
}

.review-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.review-q {
  font-weight: 700;
  margin-bottom: 8px;
}

.review-a {
  color: var(--muted);
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .timer {
    width: 100%;
    text-align: left;
  }
}
