:root {
  --bg: #f4f7f6;
  --card: #ffffff;
  --ink: #12302d;
  --muted: #60736f;
  --accent: #0f766e;
  --accent-soft: #dff4f0;
  --accent-2: #f59e0b;
  --accent-2-soft: #fff6db;
  --line: #d9e4e1;
  --good: #18794e;
  --good-soft: #e5f7ed;
  --bad: #b42318;
  --bad-soft: #feebe9;
  --shadow: 0 18px 50px rgba(20, 55, 50, 0.10);
  --radius: 24px;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(15, 118, 110, .12), transparent 31rem),
    radial-gradient(circle at 100% 15%, rgba(245, 158, 11, .09), transparent 26rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
img { max-width: 100%; display: block; }
button { font: inherit; }
button:focus-visible, summary:focus-visible { outline: 4px solid rgba(15, 118, 110, .25); outline-offset: 3px; }
.app-shell { width: min(1040px, 100%); margin: 0 auto; padding: max(18px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 10px 2px 22px; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: .14em; }
h1 { margin: 0; font-size: clamp(28px, 5vw, 44px); line-height: 1.04; letter-spacing: -.035em; }
.subtitle { margin: 8px 0 0; color: var(--muted); font-size: 16px; }
.panel { background: rgba(255,255,255,.95); border: 1px solid rgba(217, 228, 225, .95); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(18px, 4vw, 34px); }
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(290px, .85fr); gap: 24px; align-items: center; }
.hero h2, .result-title { margin: 0 0 12px; font-size: clamp(25px, 4vw, 34px); letter-spacing: -.025em; }
.hero p, .small-note, .result-copy { color: var(--muted); line-height: 1.55; }
.hero-card { background: linear-gradient(145deg, var(--accent-soft), #fff7df); border: 1px solid var(--line); border-radius: 28px; padding: 16px; }
.hero-card-animated { overflow: hidden; }
.hero-visual-stack { display: flex; justify-content: center; align-items: center; min-height: 320px; padding: 8px 0 0; }
.hero-character-animated { width: min(100%, 210px); image-rendering: pixelated; image-rendering: crisp-edges; filter: drop-shadow(0 18px 28px rgba(18,48,45,.18)); }
.hero-bubble { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 10px 12px; font-weight: 850; font-size: 14px; color: var(--ink); box-shadow: 0 10px 25px rgba(18,48,45,.08); }
.hero-character { width: min(100%, 285px); margin: 8px auto 2px; filter: drop-shadow(0 18px 28px rgba(18,48,45,.16)); }
.hero-caption { text-align: center; color: var(--muted); font-size: 13px; font-weight: 800; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 22px 0 14px; }
.stat { background: #f8fbfa; border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.stat strong { display: block; font-size: 25px; margin-bottom: 3px; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 700; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.primary-btn, .ghost-btn, .next-btn, .secondary-btn { border-radius: 14px; border: 0; min-height: 50px; padding: 0 20px; font-weight: 850; cursor: pointer; }
.primary-btn, .next-btn { color: white; background: var(--accent); }
.primary-btn:hover, .next-btn:hover { filter: brightness(.96); }
.ghost-btn { color: var(--accent); background: white; border: 1px solid var(--line); }
.ghost-btn:hover { background: #f8fbfa; }
.secondary-btn { color: #725016; background: #fff7df; border: 1px solid #f4dfab; }
.secondary-btn:hover { background: #fff4d2; }
.install-btn { min-height: 40px; padding: 0 14px; }
.note { margin-top: 16px; border-left: 4px solid var(--accent-2); background: #fffaf0; padding: 12px 14px; color: #725016; border-radius: 0 12px 12px 0; line-height: 1.45; font-size: 14px; }
.small-note { margin-top: 10px; font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.mini-panel { background: #f8fbfa; border: 1px solid var(--line); border-radius: 18px; padding: 16px; }
.mini-panel h3 { margin: 0 0 12px; font-size: 17px; }
.category-list, .history-list, .badge-list { display: grid; gap: 10px; }
.category-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.category-row-name { font-weight: 800; font-size: 14px; }
.category-row-score { color: var(--muted); font-weight: 800; font-size: 13px; }
.bar { height: 8px; grid-column: 1 / -1; background: #e9efed; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.history-item { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.history-item:last-child { border-bottom: 0; padding-bottom: 0; }
.history-meta { color: var(--muted); font-size: 13px; }
.history-score { font-weight: 900; }
.badge { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-weight: 800; }
.quiz-panel { padding-top: 24px; }
.quiz-meta { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 14px; color: var(--muted); font-weight: 800; font-size: 14px; flex-wrap: wrap; }
.progress-track { height: 10px; overflow: hidden; border-radius: 999px; background: #e9efed; margin-bottom: 24px; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.category-pill, .mode-pill, .xp-pill { display: inline-flex; align-items: center; min-height: 30px; border-radius: 999px; padding: 0 12px; font-size: 13px; font-weight: 900; }
.category-pill { background: var(--accent-soft); color: var(--accent); }
.mode-pill, .xp-pill { background: #fff7df; color: #725016; }
.quiz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 195px; gap: 22px; align-items: start; }
.question { margin: 10px 0 20px; font-size: clamp(22px, 4vw, 31px); line-height: 1.2; letter-spacing: -.018em; }
.options { display: grid; gap: 12px; }
.option { width: 100%; min-height: 62px; display: flex; align-items: center; gap: 13px; text-align: left; padding: 13px 15px; border-radius: 16px; border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; font-weight: 750; line-height: 1.35; }
.option:hover:not(:disabled) { border-color: #a9cbc5; background: #fbfefd; }
.option:disabled { cursor: default; }
.option-letter { flex: 0 0 34px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #edf3f1; font-weight: 950; }
.option.correct { border-color: #84cfaa; background: var(--good-soft); color: #105b3a; }
.option.correct .option-letter { background: #c9edd9; }
.option.wrong { border-color: #f0a6a0; background: var(--bad-soft); color: #8e1e16; }
.option.wrong .option-letter { background: #ffd4d0; }
.option.selected { border-color: #a6cec8; background: #f4fbf9; }
.option.dimmed { opacity: .55; }
.quiz-sidekick { position: sticky; top: 14px; background: linear-gradient(145deg, #fff, #fff7df); border: 1px solid var(--line); border-radius: 20px; padding: 12px; }
.quiz-sidekick img { width: 100%; max-width: 140px; margin: 0 auto; }
.quiz-sidekick p { margin: 6px 0 0; text-align: center; font-size: 13px; font-weight: 800; color: var(--muted); }
.feedback { margin-top: 18px; border-radius: 16px; padding: 15px 16px; background: #f8fbfa; border: 1px solid var(--line); line-height: 1.5; }
.feedback strong { display: block; margin-bottom: 4px; }
.feedback.good strong { color: var(--good); }
.feedback.bad strong { color: var(--bad); }
.source { display: inline-block; margin-top: 8px; color: var(--muted); font-size: 13px; font-weight: 750; }
.source-block { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; }
.book-reference { margin-top: 12px; background: var(--accent-2-soft); border: 1px solid #f3e0ad; border-radius: 16px; overflow: hidden; }
.book-reference summary { list-style: none; cursor: pointer; padding: 12px 14px; font-weight: 900; color: #725016; }
.book-reference summary::-webkit-details-marker { display: none; }
.book-reference-body { padding: 0 14px 14px; }
.book-reference img { width: 100%; border-radius: 14px; border: 1px solid rgba(18,48,45,.10); background: #fff; }
.book-reference .page-note { font-size: 13px; color: var(--muted); margin-top: 8px; }
.quiz-actions { display: flex; justify-content: flex-end; margin-top: 18px; gap: 10px; }
.next-btn { min-width: 150px; }
.score-ring { width: 160px; height: 160px; margin: 6px auto 16px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--accent) var(--score-angle), #e6efed 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: white; }
.score-ring span { position: relative; z-index: 1; font-size: 32px; font-weight: 950; }
.result-copy { text-align: center; margin: 0 auto 14px; max-width: 620px; }
.result-mascot { width: 120px; margin: 0 auto 8px; filter: drop-shadow(0 14px 20px rgba(18,48,45,.12)); }
.stars { text-align: center; font-size: 30px; margin-bottom: 10px; }
.review { margin-top: 24px; }
.review-item { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-top: 12px; background: #fbfefd; }
.review-q { font-weight: 850; margin-bottom: 8px; }
.review-a, .review-yours { color: var(--muted); margin-top: 4px; }
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 16px 4px 2px; }
.build-label { margin-top: 6px; font-size: 10px; color: #8a9a96; letter-spacing: .04em; text-transform: uppercase; }
@media (max-width: 900px) { .hero, .quiz-layout, .grid-2 { grid-template-columns: 1fr; } .stats { grid-template-columns: repeat(2, 1fr); } .quiz-sidekick { position: static; order: -1; display: flex; align-items: center; gap: 12px; } .quiz-sidekick img { width: 90px; margin: 0; } .quiz-sidekick p { text-align: left; } }
@media (max-width: 560px) { .app-shell { padding-inline: 12px; } .topbar { flex-direction: column; } .actions, .quiz-actions { flex-direction: column; } .primary-btn, .ghost-btn, .next-btn, .secondary-btn { width: 100%; } }

.section-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 18px 0 10px;
}
.section-btn {
  text-align: left;
  min-height: 104px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  padding: 13px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.section-btn:hover { border-color: #a9cbc5; background: #fbfefd; }
.section-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(15,118,110,.12);
}
.section-btn strong { font-size: 16px; }
.section-btn span { font-size: 13px; font-weight: 850; color: var(--accent); }
.section-btn small { font-size: 12px; line-height: 1.35; color: var(--muted); }
.section-current {
  display: flex;
  gap: 6px;
  flex-direction: column;
  border-radius: 12px;
  background: #f8fbfa;
  border: 1px solid var(--line);
  padding: 10px 12px;
  margin-bottom: 6px;
}
.section-current strong { font-size: 14px; }
.section-current span { font-size: 12px; color: var(--muted); }
@media (max-width: 720px) {
  .section-picker { grid-template-columns: 1fr; }
  .section-btn { min-height: 0; }
}

.question-labels {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.format-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  background: #eef0ff;
  color: #4b4f8c;
  font-size: 13px;
  font-weight: 900;
}
.multi-help {
  margin: -8px 0 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}
.option.multi-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(15,118,110,.14);
}
.option.multi-selected .option-letter {
  background: var(--accent);
  color: white;
}
.validate-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  filter: none;
}
