:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-hover: #F5F5F3;
  --border: #E8E5E0;
  --text-primary: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-tertiary: #9B9B9B;
  --accent: #2383E2;
  --accent-light: #E8F2FC;
  --correct: #2E8B57;
  --correct-light: #E6F4EC;
  --wrong: #D44C4C;
  --wrong-light: #FCEAEA;
  --tag-bg: #F0EDEB;
  --tag-text: #5A5A5A;
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
}

[data-theme="dark"] {
  --bg: #191919;
  --surface: #202020;
  --surface-hover: #2C2C2C;
  --border: #363636;
  --text-primary: #E0E0E0;
  --text-secondary: #A0A0A0;
  --text-tertiary: #707070;
  --accent: #5BA0D6;
  --accent-light: #1A3350;
  --correct: #4CAF7A;
  --correct-light: #1A3328;
  --wrong: #E06060;
  --wrong-light: #3A1E1E;
  --tag-bg: #2A2A2A;
  --tag-text: #909090;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 24px;
  flex: 1;
  width: 100%;
}

header { margin-bottom: 48px; }
header h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 12px; }

.philosophy {
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.7;
  border-left: 2px solid var(--border);
  padding-left: 16px;
  margin-bottom: 24px;
}

.stats-bar {
  display: flex; gap: 24px; font-size: 0.85rem; color: var(--text-tertiary);
  font-variant-numeric: tabular-nums; padding: 12px 0;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.stats-bar span strong { color: var(--text-primary); font-weight: 600; }

.filter-row { display: flex; gap: 8px; margin: 24px 0 16px; flex-wrap: wrap; }
.filter-btn {
  background: var(--tag-bg); color: var(--tag-text); border: none;
  padding: 4px 12px; border-radius: 4px; font-size: 0.8rem;
  cursor: pointer; transition: background 0.15s;
}
.filter-btn.active { background: var(--accent); color: #fff; }

.record-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.record-result-filters { display: flex; gap: 12px; }
.result-tab {
  font-size: 0.78rem; color: var(--text-tertiary); cursor: pointer;
  transition: color 0.15s; padding-bottom: 2px;
}
.result-tab.active { color: var(--text-primary); border-bottom: 1.5px solid var(--accent); }

.problem-list { display: flex; flex-direction: column; gap: 2px; }
.problem {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden; box-shadow: var(--shadow);
}
.problem-header {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  cursor: pointer; user-select: none; transition: background 0.1s;
}
.problem-num { font-size: 0.75rem; color: var(--text-tertiary); min-width: 28px; font-variant-numeric: tabular-nums; }
.problem-title { flex: 1; font-size: 0.925rem; font-weight: 500; }

.result-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.result-dot.correct { background: var(--correct); }
.result-dot.wrong { background: var(--wrong); }
.result-dot.retry { background: var(--accent); }

.chevron { color: var(--text-tertiary); font-size: 0.75rem; transition: transform 0.2s; flex-shrink: 0; }
.problem.open .chevron { transform: rotate(90deg); }

.problem-body {
  max-height: 0; overflow: hidden; opacity: 0;
  padding: 0 16px; font-size: 0.875rem; line-height: 1.7;
  transition: max-height 0.28s ease, opacity 0.2s ease, padding 0.28s ease;
}
.problem.open .problem-body { max-height: 1200px; opacity: 1; padding: 0 16px 16px; }
.problem-body .section-label {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-tertiary); margin-top: 12px; margin-bottom: 4px;
}
.problem-body .content { color: var(--text-secondary); }
.problem-body .choices { list-style: none; margin: 8px 0; }
.problem-body .choices li { padding: 4px 0; color: var(--text-secondary); }
.problem-body .choices li.was-selected { font-weight: 600; color: var(--text-primary); }
.problem-body .choices li.is-answer { color: var(--correct); font-weight: 600; }

.answer-box { margin-top: 12px; padding: 10px 14px; border-radius: 5px; font-size: 0.85rem; }
.answer-box.correct { background: var(--correct-light); color: var(--correct); }
.answer-box.wrong { background: var(--wrong-light); color: var(--wrong); }

.explanation { margin-top: 8px; padding: 10px 14px; border-radius: 5px; font-size: 0.84rem; line-height: 1.6; background: var(--tag-bg); color: var(--text-secondary); border-left: 3px solid var(--accent); }

.tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.tag { background: var(--tag-bg); color: var(--tag-text); font-size: 0.7rem; padding: 2px 8px; border-radius: 3px; }

/* ── Notes ── */
.notes-section { margin-bottom: 8px; }
.notes-toggle {
  display: flex; align-items: baseline; gap: 10px; user-select: none;
  padding-bottom: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.notes-chevron {
  color: var(--text-tertiary); font-size: 0.75rem;
  transition: transform 0.2s; flex-shrink: 0;
}
.notes-section.open .notes-chevron { transform: rotate(90deg); }
.notes-section .notes-list { display: none; }
.notes-section.open .notes-list { display: flex; margin-bottom: 32px; }

.record-section { margin-top: 8px; }
.record-toggle {
  display: flex; align-items: baseline; gap: 10px; user-select: none;
  padding-bottom: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.record-toggle .record-result-filters { margin-right: auto; }
.record-section .record-content { display: none; }
.record-section.open .record-content { display: block; }
.record-section.open .notes-chevron { transform: rotate(90deg); }

.section-heading { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; letter-spacing: -0.01em; }

.notes-list { display: flex; flex-direction: column; gap: 2px; }
.note {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden; box-shadow: var(--shadow);
}
.note-header {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  cursor: pointer; user-select: none; transition: background 0.1s;
}
.note-icon { color: var(--accent); font-size: 0.65rem; }
.note-title { flex: 1; font-size: 0.925rem; font-weight: 500; }

.note-level {
  font-size: 0.65rem; padding: 2px 7px; border-radius: 3px;
  flex-shrink: 0; letter-spacing: 0.02em;
}
.note-level.unknown { background: var(--wrong-light); color: var(--wrong); }
.note-level.understand { background: var(--accent-light); color: var(--accent); }
.note-level.code { background: var(--correct-light); color: var(--correct); }

.bookmark-select {
  font-size: 0.78rem; padding: 3px 10px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--tag-bg);
  color: var(--text-tertiary); cursor: pointer; flex-shrink: 0;
  letter-spacing: 0.02em; transition: all 0.15s;
}
.bookmark-select:focus { outline: 1px solid var(--accent); }

.note-body {
  max-height: 0; overflow: hidden; opacity: 0;
  padding: 0 16px;
  transition: max-height 0.28s ease, opacity 0.2s ease, padding 0.28s ease;
}
.note.open .note-body { max-height: 2400px; opacity: 1; padding: 0 16px 16px; }
.note.open .chevron { transform: rotate(90deg); }

.note-card { font-size: 0.85rem; line-height: 1.75; }
.note-card .content { color: var(--text-secondary); }
.note-card .section-label {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-tertiary); margin-top: 12px; margin-bottom: 4px;
}

.steps { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.step { display: flex; align-items: baseline; gap: 10px; color: var(--text-secondary); }
.step-n {
  background: var(--accent-light); color: var(--accent);
  font-size: 0.7rem; font-weight: 700; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; flex-shrink: 0;
}

.code-block {
  background: var(--tag-bg); border: 1px solid var(--border);
  border-radius: 5px; padding: 12px 14px;
  font-family: "Cascadia Code", "Fira Code", "JetBrains Mono", monospace;
  font-size: 0.78rem; line-height: 1.7; overflow-x: auto;
  margin: 8px 0; color: var(--text-primary);
}

.compare-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; margin: 8px 0; font-variant-numeric: tabular-nums; }
.compare-table th, .compare-table td { padding: 6px 10px; border: 1px solid var(--border); text-align: center; }
.compare-table th { background: var(--tag-bg); font-weight: 600; font-size: 0.75rem; }
.compare-table td:first-child { text-align: left; font-weight: 500; color: var(--text-secondary); }

code {
  background: var(--tag-bg); padding: 1px 5px; border-radius: 3px;
  font-family: "Cascadia Code", "Fira Code", monospace; font-size: 0.82em;
}

/* ── Heatmap ── */
.heatmap-inline { padding: 6px 0 0; border-bottom: 1px solid var(--border); padding-bottom: 14px; overflow-x: auto; }
.heatmap-label { font-size: 0.75rem; color: var(--text-tertiary); margin-bottom: 6px; }
.heatmap {
  display: grid; grid-template-columns: repeat(30, 1fr);
  grid-auto-flow: row; gap: 3px;
}
.heatmap-cell { width: 100%; aspect-ratio: 1; border-radius: 2px; background: var(--tag-bg); }
.heatmap-cell.l1 { background: #c6dbf0; }
.heatmap-cell.l2 { background: #7bb3e0; }
.heatmap-cell.l3 { background: #3a8fd4; }
.heatmap-cell.l4 { background: #1a5fa0; }
.heatmap-cell[title] { cursor: default; }
.heatmap-months { display: flex; font-size: 0.65rem; color: var(--text-tertiary); margin-bottom: 4px; }
.heatmap-months span { flex-shrink: 0; }

[data-theme="dark"] .heatmap-cell.l1 { background: #1a3350; }
[data-theme="dark"] .heatmap-cell.l2 { background: #1f4a6e; }
[data-theme="dark"] .heatmap-cell.l3 { background: #2a6a9a; }
[data-theme="dark"] .heatmap-cell.l4 { background: #3a8fd4; }

.prompt-copy-btn {
  margin-left: auto; background: none; border: 1px solid var(--border);
  color: var(--text-tertiary); padding: 3px 10px; border-radius: 4px;
  font-size: 0.75rem; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}

.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.page-btn {
  background: var(--tag-bg); color: var(--tag-text); border: none;
  width: 32px; height: 32px; border-radius: 4px; font-size: 0.8rem;
  cursor: pointer; transition: all 0.15s; font-variant-numeric: tabular-nums;
  animation: slideLeft 0.3s ease both;
}
.page-btn.active { background: var(--accent); color: #fff; }
.page-btn.page-arrow { color: var(--text-secondary); display: inline-flex; align-items: center; justify-content: center; }

.empty-state {
  text-align: center; padding: 16px 24px 48px; color: var(--text-tertiary); font-size: 0.9rem;
  animation: fadeInUp 0.4s ease both;
}
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.hide-answers .answer-box,
.hide-answers .explanation { display: none !important; }
.hide-answers .result-dot { visibility: hidden; }
.hide-answers .choices li.was-selected { font-weight: normal !important; color: var(--text-secondary) !important; }
.hide-answers .choices li.is-answer { color: var(--text-secondary) !important; font-weight: normal !important; }

.view-mode-select {
  background: var(--tag-bg); color: var(--tag-text);
  border: 1px solid var(--border); padding: 3px 8px;
  border-radius: 4px; font-size: 0.75rem; cursor: pointer; margin-left: 8px;
}

/* ── Theme toggle ── */
.header-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

.theme-toggle {
  background: none; border: 1px solid var(--border);
  border-radius: 4px; width: 28px; height: 28px;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; color: var(--text-tertiary);
  transition: all 0.15s; flex-shrink: 0; box-sizing: border-box;
}
.theme-toggle svg { width: 14px; height: 14px; }

/* ── Note filters ── */
.note-filters { display: flex; gap: 12px; flex: 1; flex-wrap: wrap; align-items: center; }
.note-filter-tab {
  font-size: 0.78rem; color: var(--text-tertiary); cursor: pointer;
  transition: color 0.15s; padding-bottom: 2px;
}
.note-filter-tab.active { color: var(--text-primary); border-bottom: 1.5px solid var(--accent); }

.notes-empty { text-align: center; padding: 32px 24px; color: var(--text-tertiary); font-size: 0.85rem; }

/* ── Animations ── */
@keyframes slideLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

header > * { animation: slideLeft 0.4s ease both; }
header > *:nth-child(1) { animation-delay: 0s; }
header > *:nth-child(2) { animation-delay: 0.06s; }
header > *:nth-child(3) { animation-delay: 0.12s; }
header > *:nth-child(4) { animation-delay: 0.18s; }

.notes-section.open .notes-list .note,
.notes-section.open .notes-list .pagination { animation: slideLeft 0.3s ease both; }
.notes-list.no-anim .note,
.notes-list.no-anim .pagination,
.notes-list.no-anim .page-btn { animation: none !important; }

.record-section.open .record-content .problem { animation: slideLeft 0.3s ease both; }
#problem-list.no-anim .problem,
#problem-list.no-anim .pagination,
#problem-list.no-anim .page-btn { animation: none !important; }

.notes-toggle, .record-toggle { animation: slideLeft 0.35s ease both; }

.stats-bar span, .stats-bar .prompt-copy-btn { animation: slideLeft 0.3s ease both; }
.stats-bar span:nth-child(1) { animation-delay: 0.04s; }
.stats-bar span:nth-child(2) { animation-delay: 0.08s; }
.stats-bar span:nth-child(3) { animation-delay: 0.12s; }
.stats-bar span:nth-child(4) { animation-delay: 0.16s; }
.stats-bar .prompt-copy-btn { animation-delay: 0.2s; }

.view-mode-select { animation: slideLeft 0.3s ease both; }

.record-section.open .record-content .filter-row .filter-btn,
.record-section.open .record-content .filter-row .result-tab { animation: slideLeft 0.25s ease both; }
.filter-row.no-anim .filter-btn { animation: none !important; }

/* ── Top Nav ── */
.top-nav {
  width: 100%; padding: 12px 0 0; font-size: 0.85rem;
}
.top-nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 720px; margin: 0 auto; padding: 0 24px;
}
.nav-left, .nav-right { display: flex; align-items: center; gap: 8px; }
.nav-link {
  color: var(--text-secondary); text-decoration: none; padding: 4px 10px;
  border-radius: 4px; transition: all 0.15s;
}
.nav-link.active { color: var(--text-primary); background: var(--surface-hover); }
.nav-home {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 4px; box-sizing: border-box;
  border: 1px solid var(--border); color: var(--text-secondary);
  text-decoration: none; transition: all 0.15s; flex-shrink: 0;
}
.nav-btn {
  background: none; border: 1px solid var(--border); color: var(--text-secondary);
  padding: 0 12px; height: 28px; border-radius: 4px; font-size: 0.82rem;
  cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 4px;
  box-sizing: border-box;
}
.nav-arrow { font-size: 0.7rem; display: inline-block; transition: transform 0.15s; }
.nav-dropdown.open .nav-arrow { transform: rotate(180deg); }
.nav-dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  min-width: 160px; z-index: 100; overflow: hidden;
}
.nav-dropdown.open .dropdown-menu { display: block; }
@media (hover: hover) {
  .nav-dropdown:hover > .dropdown-menu { display: block; }
  .nav-dropdown > .dropdown-menu { top: 100%; }
}
@media (hover: hover) and (min-width: 900px) {
  .nav-dropdown > .dropdown-menu { left: 0; right: auto; }
}
.dropdown-menu a {
  display: block; padding: 8px 14px; color: var(--text-secondary);
  text-decoration: none; font-size: 0.82rem; transition: background 0.1s;
}
[data-theme="dark"] .dropdown-menu { box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

/* ── Reset Modal ── */
#reset-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000;
}
#reset-modal-box {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 28px 32px; z-index: 1001;
  width: min(380px, 90vw); box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
#reset-modal-box h3 { margin: 0 0 12px; font-size: 1.1rem; color: var(--text-primary); }
#reset-modal-box p  { margin: 0 0 8px; font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; }
.reset-hint         { margin-top: 16px !important; }
#reset-confirm-input {
  width: 100%; box-sizing: border-box; margin-top: 10px;
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.9rem;
  background: var(--bg); color: var(--text-primary); outline: none;
}
#reset-confirm-input:focus { border-color: var(--accent); }
.reset-modal-btns   { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }
.reset-btn-cancel   {
  padding: 7px 18px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-secondary); cursor: pointer; font-size: 0.88rem;
}
.reset-btn-ok       {
  padding: 7px 18px; border-radius: 8px; border: none;
  background: #e53e3e; color: #fff; cursor: pointer; font-size: 0.88rem; font-weight: 600;
}
.reset-btn-ok:disabled { background: #ccc; cursor: not-allowed; }

/* ── Quiz Page ── */
.quiz-stats { margin-bottom: 24px; }
.quiz-stats-row {
  display: flex; gap: 16px; font-size: 0.85rem; color: var(--text-tertiary);
  font-variant-numeric: tabular-nums; flex-wrap: wrap; align-items: center;
}
.quiz-stats-row strong { color: var(--text-primary); font-weight: 600; }
.quiz-mode-label {
  background: var(--accent); color: #fff; padding: 2px 10px;
  border-radius: 4px; font-size: 0.78rem; font-weight: 600;
}

.quiz-container { max-width: 720px; }
.quiz-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.quiz-number { font-size: 0.8rem; color: var(--text-tertiary); font-weight: 600; font-variant-numeric: tabular-nums; }
.quiz-type-tag {
  font-size: 0.7rem; background: var(--tag-bg); color: var(--tag-text);
  padding: 2px 8px; border-radius: 3px; display: none;
}
.quiz-question {
  font-size: 1rem; line-height: 1.75; color: var(--text-primary);
  margin-bottom: 20px; font-weight: 500;
}
.quiz-choices { display: flex; flex-direction: column; gap: 8px; }
.quiz-choice {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px 16px; text-align: left;
  font-size: 0.9rem; cursor: pointer; transition: all 0.15s;
  color: var(--text-primary);
}
.quiz-choice:disabled { cursor: default; opacity: 0.85; }
.quiz-choice.correct { background: var(--correct-light); border-color: var(--correct); color: var(--correct); font-weight: 600; }
.quiz-choice.wrong { background: var(--wrong-light); border-color: var(--wrong); color: var(--wrong); }

.quiz-feedback {
  margin-top: 16px; padding: 12px 16px; border-radius: 6px;
  font-size: 0.9rem; line-height: 1.6;
}
.quiz-feedback.correct { background: var(--correct-light); color: var(--correct); }
.quiz-feedback.wrong { background: var(--wrong-light); color: var(--wrong); }
.quiz-feedback em { font-style: normal; font-weight: 600; }

.quiz-btn-row {
  display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap;
}
.quiz-next-btn {
  background: var(--accent); color: #fff; border: none;
  padding: 10px 24px; border-radius: 6px; font-size: 0.88rem;
  cursor: pointer; transition: opacity 0.15s;
}
.quiz-home-btn {
  background: var(--tag-bg); color: var(--tag-text); border: 1px solid var(--border);
  padding: 10px 20px; border-radius: 6px; font-size: 0.88rem;
  text-decoration: none; transition: all 0.15s;
}

.quiz-empty {
  text-align: center; padding: 80px 24px; color: var(--text-tertiary);
  font-size: 1rem; line-height: 1.8;
}
.quiz-link {
  color: var(--accent); text-decoration: none; font-weight: 600;
}
.quiz-loading { text-align: center; padding: 80px 24px; color: var(--text-tertiary); }

/* ── 인라인 퀴즈 패널 ── */
@keyframes fadeOutUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-10px); } }
#inline-quiz {
  border-bottom: 1px solid var(--border);
  padding: 24px 0 32px;
  margin-bottom: 8px;
  animation: fadeInUp 0.3s ease both;
}
.quiz-mode-tag {
  font-size: 0.8rem; color: var(--text-tertiary); font-weight: 600;
  margin-bottom: 16px; font-variant-numeric: tabular-nums;
}
.iq-close-row {
  display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 28px;
}
.iq-close-btn {
  background: none; border: 1px solid var(--border); color: var(--text-secondary);
  padding: 0 20px; height: 36px; border-radius: 4px; font-size: 0.88rem;
  cursor: pointer; transition: all 0.15s;
}
.iq-close-row .quiz-next-btn { padding: 0 20px; height: 36px; font-size: 0.88rem; }

/* ── 퀴즈 팝업 애니메이션 ── */
@keyframes iqFadeOut    { to   { opacity: 0; } }
@keyframes iqSlideIn    { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes iqSlideOut   { to   { opacity: 0; transform: translateY(-6px); } }
@keyframes iqBtnPop     { 0%,100% { transform: scale(1); } 40% { transform: scale(1.04); } }
@keyframes iqBtnShake   { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ── 퀴즈 팝업 모달 ── */
#iq-modal-backdrop,
#quiz-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 900;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
#iq-modal-box,
#quiz-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 32px;
  width: 100%; max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.quiz-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
.quiz-feedback small {
  display: block; margin-top: 6px; font-size: 0.82rem; opacity: 0.85; line-height: 1.5;
}

/* ── Auth (Google 로그인) ── */
.login-btn {
  background: var(--accent); color: #fff;
  border: none; border-radius: 4px;
  padding: 0 14px; height: 28px; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: opacity .15s; box-sizing: border-box;
}

.auth-user {
  display: flex; align-items: center; gap: 8px;
}
.auth-avatar {
  width: 18px; height: 18px; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--border);
}
.auth-name {
  font-size: 0.82rem; color: var(--text-secondary);
  max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.auth-logout-btn {
  font-size: 0.78rem; padding: 4px 10px;
  background: transparent; border: 1px solid var(--border);
  border-radius: 5px; color: var(--text-secondary); cursor: pointer;
}

/* ── Hover (마우스 기기만) ── */
@media (hover: hover) {
  .filter-btn:not(.active):hover  { background: var(--border); }
  .filter-btn.active:hover        { filter: brightness(0.88); }
  .result-tab:hover               { color: var(--text-secondary); }
  .problem-header:hover           { background: var(--surface-hover); }
  .note-header:hover              { background: var(--surface-hover); }
  .prompt-copy-btn:hover          { color: var(--accent); border-color: var(--accent); }
  .page-btn:not(.active):hover    { background: var(--border); }
  .page-btn.active:hover          { filter: brightness(0.88); }
  .theme-toggle:hover             { color: var(--text-secondary); border-color: var(--text-tertiary); }
  .note-filter-tab:not(.active):hover { color: var(--text-secondary); }
  .note-filter-tab.active:hover   { opacity: 0.85; }
  .nav-link:hover                 { color: var(--text-primary); background: var(--surface-hover); }
  .nav-home:hover                 { color: var(--text-primary) !important; border-color: var(--text-tertiary) !important; }
  .nav-btn:hover                  { color: var(--text-primary); border-color: var(--text-tertiary); }
  .dropdown-menu a:hover          { background: var(--surface-hover); color: var(--text-primary); }
  .reset-btn-cancel:hover         { background: var(--surface-hover); }
  .reset-btn-ok:not(:disabled):hover { opacity: 0.85; }
  .quiz-choice:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--accent); }
  .quiz-next-btn:hover            { filter: brightness(0.88); }
  .quiz-home-btn:hover            { background: var(--border); color: var(--text-primary); }
  .quiz-link:hover                { text-decoration: underline; }
  .iq-close-btn:hover             { border-color: var(--wrong); color: var(--wrong); }
  .login-btn:hover                { opacity: .85; }
  .auth-logout-btn:hover          { opacity: 0.85; }
}

@media (max-width: 480px) {
  .auth-name { display: none; }
  .page { padding: 32px 16px 64px; }
  header h1 { font-size: 1.5rem; }
  .stats-bar { gap: 16px; }
  .top-nav { padding: 8px 0 0; }
  .top-nav-inner { padding: 0 16px; }
  .quiz-stats-row { gap: 10px; font-size: 0.8rem; }
  .view-mode-select { display: none; }
}
