* { box-sizing: border-box; }
:root {
  --bg: #f5f7fb; --card: #fff; --text: #1f2937; --muted: #6b7280; --accent: #1d4ed8; --border: #e5e7eb;
  --ok-bg: #d1fae5; --ok: #065f46; --bad-bg: #fee2e2; --bad: #991b1b; --chosen-bg: #dbeafe;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827; --card: #1f2937; --text: #f3f4f6; --muted: #9ca3af; --accent: #60a5fa; --border: #374151;
    --ok-bg: #064e3b; --ok: #a7f3d0; --bad-bg: #7f1d1d; --bad: #fecaca; --chosen-bg: #1e3a8a;
  }
}
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 17px; line-height: 1.5; }
main { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
main.center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; }
header.top h1 { font-size: 1.35rem; margin: 4px 0; overflow-wrap: anywhere; }
h2 { font-size: 1.1rem; }
.meta, .hint { color: var(--muted); font-size: 0.9rem; margin: 4px 0; }
.notice { background: var(--chosen-bg); border-radius: 8px; padding: 10px 12px; }
.question { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin: 12px 0; }
.question.correct { border-left: 5px solid #10b981; }
.question.wrong { border-left: 5px solid #ef4444; }
.question-no { color: var(--muted); font-size: 0.85rem; margin: 0 0 4px; }
.question-text { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; font-weight: 500; }
.options { display: flex; flex-direction: column; gap: 8px; }
.option { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 12px; text-align: left; font: inherit; color: var(--text); background: var(--bg); border: 2px solid var(--border); border-radius: 10px; cursor: pointer; -webkit-tap-highlight-color: transparent; flex-wrap: wrap; }
button.option[aria-pressed="true"] { border-color: var(--accent); background: var(--chosen-bg); }
.option.static { cursor: default; }
.option.is-correct { border-color: #10b981; background: var(--ok-bg); }
.option.is-wrong { border-color: #ef4444; background: var(--bad-bg); }
.option-id { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--card); border: 1px solid var(--border); font-weight: 600; font-size: 0.85rem; }
.option-text { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.tag { font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; background: var(--border); }
.tag.ok { background: #10b981; color: #fff; }
.verdict { font-weight: 600; }
.correct .verdict { color: #10b981; }
.wrong .verdict { color: #ef4444; }
.explanation { margin: 10px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--border); justify-content: space-between; }
.bar-info { display: flex; flex-direction: column; font-size: 0.85rem; min-width: 0; }
.save-status { color: var(--muted); }
.save-status.bad { color: #ef4444; }
button { font: inherit; padding: 10px 16px; min-height: 44px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.link { border: none; background: none; color: var(--accent); padding: 4px 0; min-height: 0; text-align: left; }
button:disabled { opacity: 0.6; cursor: default; }
.score { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; margin: 12px 0; }
.score-value { font-size: 1.6rem; font-weight: 700; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.guide { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.guide summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.markdown { overflow-wrap: anywhere; }
.markdown h3, .markdown h4, .markdown h5, .markdown h6 { margin: 14px 0 6px; font-size: 1rem; }
.markdown h3 { font-size: 1.1rem; }
.markdown blockquote { margin: 8px 0; padding: 4px 12px; border-left: 4px solid var(--border); color: var(--muted); }
.markdown pre { background: var(--bg); padding: 10px; border-radius: 8px; overflow-x: auto; }
.markdown code { background: var(--bg); padding: 0 4px; border-radius: 4px; font-size: 0.9em; }
.markdown pre code { padding: 0; }
.table-box { overflow-x: auto; }
.markdown table { border-collapse: collapse; margin: 8px 0; font-size: 0.9rem; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; vertical-align: top; }
.history ul { padding-left: 18px; }
a { color: var(--accent); }
