/* ============================================================
   KNOU 학습 콘솔 스타일 — mobile first, 다크/라이트, 탭 친화
   ============================================================ */
:root {
  --bg: #0d1117;
  --bg-2: #090c11;
  --surface: #151b23;
  --surface-2: #1b232d;
  --line: #27323e;
  --line-soft: #1f2833;
  --text: #e8eef6;
  --muted: #93a1b1;
  --accent: #7aa2f7;
  --accent-ink: #0b1220;
  --accent-2: #9d7cf4;
  --ok: #4ade80;
  --bad: #f87171;
  --warn: #fbbf24;
  --mask: #37445a;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 16px;
  --radius-sm: 10px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Segoe UI", Roboto, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="light"] {
  --bg: #f7f5f0;
  --bg-2: #efeae1;
  --surface: #ffffff;
  --surface-2: #f4f1ea;
  --line: #e3ddd1;
  --line-soft: #ece7dd;
  --text: #1b2430;
  --muted: #5d6a79;
  --accent: #2d5bb9;
  --accent-ink: #ffffff;
  --accent-2: #6b4fd8;
  --ok: #12784a;
  --bad: #b42318;
  --warn: #9a6400;
  --mask: #d9d3c6;
  --shadow: 0 8px 24px rgba(40, 33, 20, .10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background:
    radial-gradient(1100px 520px at 15% -10%, rgba(122, 162, 247, .10), transparent 60%),
    radial-gradient(900px 480px at 90% 0%, rgba(157, 124, 244, .09), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
}

h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
strong { color: var(--text); font-weight: 700; }
a { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.tiny { font-size: 12.5px; }

/* ---------- 상단 바 ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line-soft);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--line-soft);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { font-size: 22px; line-height: 1; }
.brand-text { min-width: 0; }
.brand-text h1 { font-size: 16px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text p { font-size: 11.5px; color: var(--muted); letter-spacing: .01em; }

.icon-btn {
  flex: none;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  font-size: 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform .12s ease, background .2s ease;
}
.icon-btn:active { transform: scale(.94); }

/* ---------- 탭 ---------- */
.tabbar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }

.tab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
}

/* ---------- 레이아웃 ---------- */
main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 16px 40px;
}

.tab-panel { display: none; animation: fade .22s ease; }
.tab-panel.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel-head { margin: 26px 0 12px; }
.panel-head:first-child { margin-top: 14px; }
.panel-head h2 { font-size: 17px; letter-spacing: -0.02em; }
.panel-head p { margin-top: 4px; font-size: 13.5px; }

.stack { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: transform .12s ease, filter .2s ease, background .2s ease;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.06); }
.btn.small { min-height: 38px; padding: 7px 12px; font-size: 13px; }
.btn-ghost {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--line);
}
.btn-danger { color: #fff; background: #b42318; }
html[data-theme="dark"] .btn-danger { background: #8e2a22; }
.btn[aria-pressed="true"] {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- D-Day ---------- */
.dday-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 700px) {
  .dday-grid { grid-template-columns: repeat(3, 1fr); }
}

.dday-card {
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.dday-card::after {
  content: "";
  position: absolute;
  inset: auto -30% -60% auto;
  width: 180px; height: 180px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  pointer-events: none;
}
.dday-card.is-urgent {
  border-color: color-mix(in srgb, var(--bad) 55%, var(--line));
}
.dday-label { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.dday-value {
  margin: 6px 0 2px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.dday-value span { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.dday-card.is-urgent .dday-value { color: var(--bad); }
.dday-when { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dday-detail { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------- 진도 ---------- */
.progress-list { display: flex; flex-direction: column; gap: 12px; }

.course-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
}
.course-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.course-name { font-size: 15.5px; font-weight: 700; }
.course-meta { font-size: 12.5px; color: var(--muted); }
.bar {
  margin: 10px 0 12px;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--line-soft);
}
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .35s ease;
}
.lecture-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
}
.lecture-row:first-of-type { border-top: 0; }
.lecture-body { flex: 1; min-width: 0; }
.lecture-title { font-size: 14px; font-weight: 600; }
.lecture-sum { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.status-chip {
  flex: none;
  min-width: 78px;
  min-height: 34px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}
.status-chip[data-state="doing"] {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 45%, var(--line));
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}
.status-chip[data-state="done"] {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
  background: color-mix(in srgb, var(--ok) 12%, transparent);
}

/* ---------- 통계 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.stat-value { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 동기화 ---------- */
.sync-rows { display: flex; flex-direction: column; gap: 4px; }
.sync-card { box-shadow: none; }
.sync-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.sync-row:last-child { border-bottom: 0; }
.sync-row > div { min-width: 0; }
.sync-meta { margin-top: 10px; }

.kit-list {
  margin: 0;
  padding: 0 0 0 4px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kit-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
}
.kit-list li::before { content: "✔"; color: var(--ok); font-weight: 700; }

/* ---------- 플레이어 ---------- */
.player-card { position: relative; }
.player-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.clock-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
#player { width: 100%; margin: 2px 0 6px; }

.segments { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.seg-group { display: flex; flex-direction: column; gap: 4px; }
.seg-group + .seg-group { margin-top: 4px; }
.seg-group-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.seg-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 560px) { .seg-row { grid-template-columns: repeat(4, 1fr); } }

.seg-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 58px;
  padding: 9px 11px;
  font: inherit;
  text-align: left;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .12s ease;
}
.seg-btn:active { transform: scale(.98); }
.seg-btn .seg-name { font-size: 13.5px; font-weight: 700; }
.seg-btn .seg-clock { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.seg-btn.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, var(--surface-2));
}
.seg-btn.is-locked { opacity: .5; cursor: not-allowed; }
.seg-count {
  position: absolute;
  top: 6px; right: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.seg-btn.is-locked .seg-count { color: var(--bad); }

.limit-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.limit-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  width: 46px; height: 26px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background .2s ease, border-color .2s ease;
  flex: none;
}
.switch-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .2s ease, background .2s ease;
}
.switch input:checked + .switch-track { background: color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); background: var(--accent); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-label { font-size: 13.5px; font-weight: 600; }
#limit-help { margin-top: 6px; }

/* ---------- 받아쓰기 ---------- */
.dict-part {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
  margin-bottom: 12px;
}
.part-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.part-title { font-size: 15px; font-weight: 700; }
.part-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.dict-tip { margin: 6px 0 10px; font-size: 12.5px; color: var(--muted); }

.dict-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.dict-item:first-of-type { border-top: 0; }
.dict-num { font-family: var(--font-mono); font-size: 12px; color: var(--muted); padding-top: 6px; text-align: right; }
.dict-text { font-family: var(--font-serif); font-size: 16px; line-height: 2.2; color: var(--text); }

.blank-input {
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-bottom: 2px dashed color-mix(in srgb, var(--muted) 55%, transparent);
  border-radius: 0;
  padding: 0 4px;
  min-height: 30px;
  text-align: center;
  transition: border-color .2s ease, background .2s ease, color .2s ease;
}
.blank-input:focus { outline: none; border-bottom-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.blank-input.is-ok {
  color: var(--ok);
  border-bottom-style: solid;
  border-bottom-color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
}
.blank-input.is-bad {
  color: var(--bad);
  border-bottom-style: solid;
  border-bottom-color: var(--bad);
  background: color-mix(in srgb, var(--bad) 12%, transparent);
}
.blank-input[data-uncertain="1"]::after { content: ""; }
.blank-uncertain {
  font-size: 11px;
  color: var(--warn);
  vertical-align: super;
  margin-left: 1px;
  cursor: help;
}
.blank-answer {
  display: none;
  margin-left: 4px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-radius: 6px;
  padding: 1px 6px;
}
.dict-part.reveal .blank-answer { display: inline; }
.part-score { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.part-score.is-full { color: var(--ok); }

/* ---------- 요약문 / 발음 ---------- */
.sum-card .sum-title { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.sum-card .sum-text { font-family: var(--font-serif); font-size: 15.5px; line-height: 1.85; }
.sum-card .sum-note { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

.accordion { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.accordion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 700;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.accordion-head .chev { color: var(--muted); transition: transform .2s ease; }
.accordion.open .accordion-head .chev { transform: rotate(180deg); }
.accordion-body { display: none; padding: 0 16px 16px; }
.accordion.open .accordion-body { display: block; }
.accordion-body .lead { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }

.ph-example {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
}
.ph-example:first-of-type { border-top: 0; }
.ph-en { font-family: var(--font-serif); font-weight: 600; }
.ph-ipa { font-family: var(--font-mono); font-size: 13px; color: var(--accent); }
.ph-note { font-size: 12.5px; color: var(--muted); }
.ph-trap {
  margin-top: 10px;
  padding: 10px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line));
}

/* ---------- 필터 / 칩 ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  min-height: 36px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.chip.is-active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* ---------- 강독 카드 ---------- */
.reading-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 980px) { .reading-grid { grid-template-columns: repeat(2, 1fr); align-items: start; } }

.reading-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.rc-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.rc-lesson, .rc-tag {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-2);
}
.rc-lesson { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.rc-title { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.rc-lead { margin-top: 4px; font-size: 13px; color: var(--muted); font-style: italic; }

.quote {
  margin: 12px 0 4px;
  padding: 12px 14px;
  border-left: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.quote-en { font-family: var(--font-serif); font-size: 15.5px; line-height: 1.75; }
.quote-ko { margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.quote-src { margin-top: 6px; font-size: 11.5px; color: var(--muted); letter-spacing: .02em; }

.rc-block { margin-top: 12px; font-size: 14.5px; line-height: 1.85; }
.rc-block ul { margin: 0; padding-left: 18px; }
.rc-block li { margin: 6px 0; }
.rc-block.rc-note {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  font-size: 13.5px;
}

/* 탭하면 열리는 용어 */
.term {
  display: inline;
  padding: 0 2px;
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  border-bottom: 1.5px dotted color-mix(in srgb, var(--accent) 70%, transparent);
  cursor: pointer;
  text-align: left;
  transition: color .15s ease, background .15s ease;
}
.term:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.term.is-open { color: var(--accent-2); border-bottom-style: solid; }

.blank-mode .term:not(.is-open) .term-text {
  color: transparent;
  background: var(--mask);
  border-radius: 4px;
  padding: 0 2px;
  user-select: none;
}
.blank-mode .term:not(.is-open) { border-bottom-color: transparent; }

.term-note {
  display: none;
  margin: 8px 0 2px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent-2);
  border-radius: var(--radius-sm);
}
.term-note.is-open { display: block; }

.reveals { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 4px; }
.reveal-item { border-bottom: 1px solid var(--line-soft); }
.reveal-item:last-child { border-bottom: 0; }
.reveal-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 11px 0;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  text-align: left;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
}
.reveal-q .plus { color: var(--accent); font-weight: 800; font-size: 16px; }
.reveal-a { display: none; padding: 0 0 12px; font-size: 13.5px; line-height: 1.8; color: var(--muted); }
.reveal-item.is-open .reveal-a { display: block; }
.reveal-item.is-open .plus { transform: rotate(45deg); }

/* ---------- 퀴즈 ---------- */
.quiz-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.q-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 12px; }
.q-index { font-family: var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.q-prompt { font-size: 16px; font-weight: 700; line-height: 1.6; }
.q-passage {
  margin: 12px 0;
  padding: 12px 14px;
  white-space: pre-line;
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.8;
  background: var(--surface-2);
  border-left: 3px solid color-mix(in srgb, var(--accent-2) 60%, transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.6;
  text-align: left;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, opacity .18s ease;
}
.choice:not(:disabled):hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.choice .marker {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
}
.choice.is-correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.choice.is-correct .marker { color: #04170c; background: var(--ok); border-color: var(--ok); }
.choice.is-wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.choice.is-wrong .marker { color: #fff; background: var(--bad); border-color: var(--bad); }
.choice.is-dim { opacity: .55; }
.choice:disabled { cursor: default; }
.choice-text { flex: 1; min-width: 0; }

.explain {
  margin-top: 14px;
  padding: 14px;
  font-size: 13.5px;
  line-height: 1.8;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.explain.is-ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.explain.is-bad { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.explain .verdict { display: block; font-size: 13px; font-weight: 800; margin-bottom: 6px; letter-spacing: .01em; }
.explain.is-ok .verdict { color: var(--ok); }
.explain.is-bad .verdict { color: var(--bad); }

.quiz-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; }
.quiz-summary { text-align: center; padding: 8px 0 4px; }
.quiz-summary .big { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }

.empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ---------- 용어 해설 시트 ---------- */
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 80;
  max-height: 60vh;
  overflow-y: auto;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -14px 44px rgba(0, 0, 0, .38);
  transform: translateY(105%);
  transition: transform .24s ease;
}
.sheet.is-on { transform: none; }
@media (min-width: 760px) {
  .sheet {
    left: auto; right: 24px; bottom: 24px;
    width: 460px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transform: translateY(120%);
  }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sheet-term { font-family: var(--font-serif); font-size: 15.5px; font-weight: 700; color: var(--accent); }
.sheet-body { font-size: 13.5px; line-height: 1.85; color: var(--text); }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  max-width: min(92vw, 520px);
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 92%, var(--accent));
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 90;
  text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.footnote { max-width: 1120px; margin: 0 auto; padding: 0 16px 24px; line-height: 1.7; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
