:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #697386;
  --line: #e3e8f1;
  --surface: #ffffff;
  --page: #f5f7fb;
  --blue: #4568f5;
  --blue-soft: #edf1ff;
  --green: #178451;
  --green-soft: #eaf8f0;
  --red: #c53b4b;
  --red-soft: #fff0f2;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--page); }
button { font: inherit; }
.app-shell { width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 64px; }
.app-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(28px, 6vw, 42px); letter-spacing: -.06em; }
.subtitle { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.text-button { border: 0; padding: 7px 0; color: var(--muted); background: transparent; font-size: 12px; cursor: pointer; white-space: nowrap; }
.text-button:hover { color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 18px; }
.stats div { min-width: 0; padding: 14px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.stats span, .stats strong { display: block; }
.stats span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.stats strong { margin-top: 5px; font-size: 21px; letter-spacing: -.04em; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filters button { border: 1px solid var(--line); border-radius: 999px; padding: 9px 13px; color: var(--muted); background: var(--surface); cursor: pointer; font-size: 13px; }
.filters button.active { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); font-weight: 800; }
.filters span { margin-left: 4px; font-variant-numeric: tabular-nums; }
.progress-row { display: flex; justify-content: space-between; margin: 0 2px 8px; color: var(--muted); font-size: 13px; }
.progress-track { height: 6px; margin-bottom: 18px; overflow: hidden; border-radius: 999px; background: #e7ebf4; }
.progress-track div { width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .2s ease; }
.question-card { border: 1px solid var(--line); border-radius: 24px; padding: clamp(22px, 5vw, 38px); background: var(--surface); box-shadow: 0 18px 45px rgba(33, 53, 93, .08); }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.topic { color: var(--blue); font-weight: 800; }
.review-badge { display: inline-block; margin-right: 5px; padding: 3px 6px; border-radius: 5px; color: #765b11; background: #fff8df; font-size: 10px; font-weight: 800; }
.question-number { margin: 26px 0 34px; font-size: clamp(21px, 4vw, 29px); line-height: 1.65; letter-spacing: -.045em; word-break: keep-all; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { min-height: 110px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: #fbfcfe; font-size: 46px; font-weight: 900; cursor: pointer; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.choice:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--blue); background: var(--blue-soft); }
.choice:disabled { cursor: default; }
.choice.selected-correct { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.choice.selected-wrong { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.choice.correct-answer { border-color: var(--green); color: var(--green); background: var(--green-soft); }
.option-list { display: grid; gap: 10px; }
.answer-option { display: flex; width: 100%; gap: 10px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fbfcfe; line-height: 1.65; text-align: left; word-break: keep-all; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.answer-option:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-soft); }
.answer-option:disabled { cursor: default; }
.answer-option.selected-option { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 2px rgba(69, 104, 245, .12); }
.answer-option.selected-correct { border-color: var(--green); background: var(--green-soft); }
.answer-option.selected-wrong { border-color: var(--red); background: var(--red-soft); }
.answer-option.correct-answer { border-color: var(--green); background: var(--green-soft); }
.answer-option span { flex: 0 0 28px; color: var(--blue); font-weight: 900; }
.typed-answer { display: grid; gap: 8px; }
.typed-answer label { color: var(--muted); font-size: 13px; font-weight: 800; }
.typed-answer input { width: 100%; min-height: 50px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; color: var(--ink); background: #fbfcfe; font: inherit; outline: none; }
.typed-answer input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.reveal-button { width: 100%; min-height: 48px; margin-top: 14px; border: 0; border-radius: 12px; color: white; background: var(--blue); cursor: pointer; font-weight: 800; }
.reveal-button:disabled { opacity: .45; cursor: not-allowed; }
.reveal-button:hover { background: #3658e8; }
.feedback { margin-top: 18px; padding: 20px; border-radius: 16px; background: #f7f9fc; }
.feedback.correct { border: 1px solid #bfe8cf; background: var(--green-soft); }
.feedback.wrong { border: 1px solid #f2c4ca; background: var(--red-soft); }
.feedback-title { margin: 0 0 8px; font-size: 19px; font-weight: 900; }
.feedback.correct .feedback-title { color: var(--green); }
.feedback.wrong .feedback-title { color: var(--red); }
.feedback p { margin: 5px 0 0; line-height: 1.7; word-break: keep-all; }
.answer-line { color: var(--muted); font-size: 14px; }
.explanation { margin-top: 12px !important; padding-top: 12px; border-top: 1px solid rgba(23, 32, 51, .1); }
.grade-actions { display: flex; gap: 8px; margin-top: 16px; }
.grade-actions button { flex: 1; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); cursor: pointer; font-weight: 700; }
.grade-actions button:hover { border-color: var(--blue); color: var(--blue); }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.card-actions button { min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; color: var(--ink); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 700; }
.card-actions button:hover { border-color: var(--blue); color: var(--blue); }
.card-actions .primary { border-color: var(--blue); color: white; background: var(--blue); }
.card-actions .primary:hover { color: white; background: #3658e8; }
.card-actions button[aria-pressed="true"] { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.source-link { display: inline-block; margin-top: 18px; color: var(--muted); font-size: 12px; text-decoration: none; }
.source-link:hover { color: var(--blue); text-decoration: underline; }
.review-note { margin-bottom: 16px; padding: 11px 13px; border-radius: 11px; color: #765b11; background: #fff8df; font-size: 13px; line-height: 1.5; }
.empty-state { border: 1px dashed #c8d0df; border-radius: 20px; padding: 56px 24px; color: var(--muted); background: rgba(255,255,255,.65); text-align: center; }
.empty-state h2 { margin: 0 0 8px; color: var(--ink); font-size: 22px; }
.empty-state p { margin: 0; line-height: 1.6; }

@media (max-width: 620px) {
  .app-shell { width: min(100% - 22px, 760px); padding-top: 26px; }
  .app-header { display: block; }
  .text-button { margin-top: 14px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats div:nth-child(4), .stats div:nth-child(5) { grid-column: span 1; }
  .stats strong { font-size: 18px; }
  .question-card { border-radius: 18px; padding: 22px 18px; }
  .question-number { margin: 22px 0 26px; font-size: 21px; }
  .choice { min-height: 88px; font-size: 38px; }
  .card-actions button { flex: 1 1 calc(50% - 10px); }
  .card-actions .primary { flex-basis: 100%; order: -1; }
}
