:root {
  --paper: #eeefea;
  --ink: #22241f;
  --muted: #5b5e55;
  --line: #c4c7bc;
  --control-line: #868b7e;
  --accent: #a43817;
  --selected: #e2e5dc;
  --measure: 1120px;
  --header-height: 63px;
  --page-padding: 24px;
  --layout-gap: clamp(16px, 2.8svh, 24px);
  --section-gap: clamp(24px, 4svh, 32px);
  scroll-padding-top: calc(var(--header-height) + env(safe-area-inset-top) + 16px);
  font-family: "Pretendard Variable", Pretendard, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 16px;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

[lang="en"] { word-break: normal; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
input { color: inherit; }
h1, h2, p, dl, dd { margin: 0; }
h1, h2 { font-weight: 500; line-height: 1.2; }
h1 { font-size: 36px; letter-spacing: -.8px; }
h2 { font-size: 22px; letter-spacing: -.3px; }
a, button, input { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: -80px;
  left: 20px;
  padding: 12px 20px;
  background: var(--ink);
  color: var(--paper);
  z-index: 5;
}
.skip-link:focus { top: 16px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.header-inner, main, .footer {
  width: 100%;
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
  padding-left: 40px;
  padding-right: 40px;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 3;
  flex-shrink: 0;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  height: var(--header-height);
}
.brand {
  display: inline-flex;
  align-items: center;
  height: 63px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.8px;
}
.header-inner nav { display: flex; gap: 28px; }
.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  border-bottom: 2px solid transparent;
  font-size: 15px;
  color: var(--muted);
}
.nav-link:hover { color: var(--ink); border-color: var(--control-line); }
.nav-link[aria-current] { color: var(--ink); border-color: var(--accent); }
main { padding-top: var(--page-padding); padding-bottom: 48px; outline: none; }
.first-view {
  min-height: calc(75svh - var(--header-height) - env(safe-area-inset-top) - 2 * var(--page-padding));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--layout-gap);
}
.first-view .page-heading { margin-bottom: 0; }
.first-view .study-layout { flex: 1; padding-top: 0; }
.first-view .question-word { align-self: start; }
.first-view .exercise,
.first-view .answer-review { display: flex; flex-direction: column; }
.first-view .exercise-actions { margin-top: auto; padding-top: var(--layout-gap); }
.first-view .answer-review > form { margin-top: auto; }
.footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: auto;
  padding-top: 24px;
  padding-bottom: 24px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.page-heading { margin-bottom: var(--section-gap); }
.page-heading p { color: var(--muted); margin-top: 12px; }
.heading-with-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 11px 24px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  text-align: center;
}
.button:hover { background: #41453a; border-color: #41453a; }
.button.secondary { background: transparent; border-color: var(--control-line); color: var(--ink); }
.button.secondary:hover { background: var(--selected); border-color: var(--ink); }
.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
  text-decoration: underline;
  text-decoration-color: var(--control-line);
  text-underline-offset: 4px;
}
.text-link:hover { text-decoration-color: var(--ink); }

.study-entry { border-top: 1px solid var(--ink); padding-top: var(--section-gap); }
.study-format { margin-top: 12px; font-size: 14px; color: var(--muted); }
.start-actions { display: flex; flex-wrap: wrap; gap: 16px; margin-top: var(--layout-gap); }
.progress-section { border-top: 1px solid var(--line); padding-top: var(--section-gap); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 24px; }
.stat { padding-right: 32px; }
.stat + .stat { border-left: 1px solid var(--line); padding-left: 32px; }
.stat dt { font-size: 14px; }
.stat-value { font-size: 42px; line-height: 1.2; font-variant-numeric: tabular-nums; margin: 12px 0; letter-spacing: -1px; }
.stat-value > span:not(.sr-only) { color: var(--muted); font-size: 18px; letter-spacing: 0; }
.stat-note { color: var(--muted); font-size: 14px; }
.progress-section > .stat-note { margin-top: 16px; }
.section-note { font-size: 14px; color: var(--muted); margin-top: 32px; max-width: 80ch; }

.library-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 32px;
  border-top: 1px solid var(--ink);
  padding-top: 24px;
}
.search-form { width: 420px; max-width: 100%; }
.search-form label { display: block; margin-bottom: 8px; font-size: 14px; }
.search-controls { display: flex; gap: 8px; }
.search-controls input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--control-line);
  border-radius: 2px;
  background: #f7f8f3;
  padding: 10px 12px;
}
.search-controls input::placeholder { color: var(--muted); }
.search-controls .button { padding-left: 18px; padding-right: 18px; }
.tabs { display: flex; gap: 24px; }
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.tab span { font-size: 13px; font-variant-numeric: tabular-nums; }
.tab:hover { color: var(--ink); border-color: var(--control-line); }
.tab[aria-current] { color: var(--ink); border-color: var(--accent); }
.collection-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; font-size: 14px; color: var(--muted); }
.collection-summary p { overflow-wrap: anywhere; }
.list-head, .word-entry { display: grid; grid-template-columns: 220px minmax(0, 1fr) 128px; column-gap: 32px; }
.list-head { padding: 12px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.word-entry { padding: var(--section-gap) 0; border-top: 1px solid var(--line); }
.word-entry:last-child { border-bottom: 1px solid var(--line); }
.word-heading h2 { font-size: 23px; overflow-wrap: anywhere; }
.word-meta { margin-top: 8px; font-size: 14px; color: var(--muted); }
.example { margin-top: 8px; font-size: 15px; color: var(--muted); }
.word-status { font-size: 14px; }
.word-status span { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.empty-state { padding: 32px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.empty-state p { margin: 16px 0 24px; color: var(--muted); }

.practice-resume { margin-bottom: 24px; font-size: 14px; color: var(--muted); }
.practice-set { padding: 24px 0; border-top: 1px solid var(--line); }
.practice-set:last-child { border-bottom: 1px solid var(--line); }
.set-preview { max-width: 64ch; margin-top: 12px; font-size: 14px; color: var(--muted); }
.set-confirm { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 12px; font-size: 14px; }
.set-confirm input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }

.practice-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--ink); font-size: 14px; }
.practice-heading p:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.study-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 64px; padding-top: 32px; }
.question-word h1 { font-size: 42px; overflow-wrap: anywhere; }
.part-of-speech { margin-top: 12px; font-size: 15px; color: var(--muted); }
.word-topic { font-size: 14px; margin-top: 24px; color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-size: 18px; margin-bottom: 20px; }
.answer-options { border-top: 1px solid var(--line); }
.answer-option {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 16px 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  cursor: pointer;
}
.answer-option:hover { background: #e7e9e1; }
.answer-option:has(input:checked) { background: var(--selected); border-left-color: var(--accent); }
.answer-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.answer-option input { width: 20px; height: 20px; flex-shrink: 0; margin: 0; accent-color: var(--accent); cursor: pointer; }
.exercise-actions { display: flex; align-items: center; gap: 24px; margin-top: 28px; }
.practice-note { margin-top: 24px; font-size: 14px; color: var(--muted); }
.feedback { border-left: 3px solid var(--accent); padding-left: 16px; margin-bottom: 28px; }
.feedback.correct { border-left-color: var(--ink); }
.review-details > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 24px; margin-top: 24px; }
.review-details dt { font-size: 14px; color: var(--muted); padding-top: 2px; }
.result-definition { font-size: 18px; }
.your-answer { color: var(--muted); }

html:has(.guide-page) {
  scroll-padding-top: calc(var(--header-height) + env(safe-area-inset-top) + 85px);
}
.guide-page main { padding-top: 10px; padding-bottom: 80px; }
.guide-page .page-heading { margin-bottom: 56px; }
.guide-page .page-heading p { max-width: 38em; margin-top: 24px; line-height: 1.85; }
.guide-layout { padding-top: 4px; }
.guide-navigation {
  position: sticky;
  top: calc(var(--header-height) + env(safe-area-inset-top) + 11px);
  z-index: 2;
  background: var(--paper);
  box-shadow: 0 -10px 0 var(--paper);
  width: 100%;
  padding: 8px 4px 22px 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.guide-navigation::-webkit-scrollbar,
.faq-categories::-webkit-scrollbar { display: none; }
.guide-navigation:focus-visible,
.faq-categories:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.guide-navigation .text-link,
.faq-categories .text-link {
  flex: 0 0 auto;
  min-height: 28px;
  justify-content: center;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--muted);
  text-decoration: none;
}
.guide-navigation .text-link:hover,
.faq-categories .text-link:hover { color: var(--ink); background: var(--selected); }
.guide-navigation .text-link:focus-visible,
.faq-categories .text-link:focus-visible { outline-offset: -2px; }
.guide-navigation .text-link[aria-current="page"] {
  color: #fff;
  background: var(--muted);
  border-color: var(--muted);
}
.guide-sections { max-width: 760px; line-height: 1.85; }
.guide-sections section { padding: 64px 0; }
.guide-sections section:first-child { padding-top: 40px; }
.guide-sections section:last-child { padding-bottom: 0; }
.guide-sections section + section { border-top: 1px solid var(--line); }
.guide-sections h2 { margin-bottom: 32px; font-size: 26px; }
.guide-sections p + p { margin-top: 24px; }
.guide-sections section > .text-link { margin-top: 28px; }
.guide-facts { display: grid; gap: 32px; }
.guide-sections p + .guide-facts { margin-top: 40px; }
.guide-facts > div { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 24px; }
.guide-facts dt { font-size: 14px; font-weight: 500; padding-top: 2px; }
.guide-facts dd { color: var(--muted); }
.faq-note { font-size: 14px; color: var(--muted); }
.faq-categories {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 20px;
  padding: 8px 4px 8px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.faq-category { margin-top: 40px; }
.faq-category h3 { margin: 0 0 16px; font-size: 20px; font-weight: 500; }
.faq-item { border-top: 1px solid var(--line); }
.faq-item.is-animating { overflow: hidden; }
.faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-item summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  min-height: 60px;
  padding: 18px 0;
  font-size: 15px;
  line-height: 1.6;
  list-style: none;
  cursor: pointer;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.faq-toggle { flex: 0 0 20px; font-size: 22px; line-height: 24px; text-align: center; }
.faq-toggle::before { content: "+"; }
.faq-item[open] .faq-toggle::before { content: "−"; }
.faq-item summary[aria-expanded="false"] .faq-toggle::before { content: "+"; }
.faq-answer { padding: 2px 44px 24px 0; font-size: 14px; line-height: 1.8; color: var(--muted); }
.faq-answer p + p { margin-top: 12px; }
.faq-answer .text-link { display: inline; min-height: 0; font-size: inherit; }
.guide-sections #sources { color: var(--muted); font-size: 14px; }
.guide-sections #sources h2 { font-size: 20px; color: var(--ink); }

@media (max-width: 900px) {
  .guide-facts > div { grid-template-columns: 1fr; gap: 8px; }
  .header-inner, main, .footer { padding-left: 32px; padding-right: 32px; }
  .library-toolbar { align-items: start; flex-direction: column; gap: 16px; }
  .search-form { width: 100%; }
  .list-head, .word-entry { grid-template-columns: 160px minmax(0, 1fr) 112px; column-gap: 24px; }
  .study-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 32px; }
  .question-word h1 { font-size: 36px; }
}

@media (max-width: 600px) {
  .guide-page main { padding-bottom: 56px; }
  .guide-page .page-heading { margin-bottom: 32px; }
  .guide-sections section { padding: 48px 0; }
  .guide-sections h2 { font-size: 23px; margin-bottom: 28px; }
  :root { --header-height: 107px; --page-padding: 16px; }
  .header-inner, main, .footer { padding-left: 20px; padding-right: 20px; }
  .header-inner { flex-wrap: wrap; gap: 0; }
  .brand { font-size: 18px; flex-shrink: 0; }
  .header-inner nav { width: 100%; justify-content: space-between; gap: 12px; }
  .nav-link { min-height: 44px; font-size: 14px; white-space: nowrap; }
  main { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
  h1 { font-size: 30px; }
  h2 { font-size: 21px; }
  .heading-with-action { align-items: start; flex-direction: column; gap: var(--layout-gap); }
  .start-actions { gap: 12px; }
  .start-actions .button { flex: 1; padding-left: 12px; padding-right: 12px; }
  .stats-grid { margin-top: 20px; }
  .stat { padding-right: 12px; }
  .stat + .stat { padding-left: 16px; }
  .stat dt { font-size: 13px; }
  .stat-value { font-size: 30px; white-space: nowrap; }
  .stat-value > span:not(.sr-only) { font-size: 14px; }
  .stat-note { font-size: 13px; }
  .section-note { margin-top: 24px; }
  .tabs { width: 100%; justify-content: space-between; gap: 12px; }
  .tab { gap: 6px; font-size: 14px; }
  .collection-summary { min-height: 60px; }
  .collection-summary .text-link { flex-shrink: 0; font-size: 14px; }
  .list-head { display: none; }
  .word-entry { grid-template-columns: minmax(0, 1fr) 106px; gap: 16px; }
  .word-heading { grid-column: 1; }
  .word-heading h2 { font-size: 24px; }
  .word-meta { font-size: 13px; }
  .word-status { grid-column: 2; grid-row: 1; text-align: right; font-size: 13px; padding-top: 4px; }
  .word-meaning { grid-column: 1 / -1; }
  .study-layout { grid-template-columns: 1fr; gap: var(--layout-gap); padding-top: var(--layout-gap); }
  .first-view .study-layout { grid-template-rows: auto 1fr; }
  .question-word { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; }
  .question-word h1 { grid-row: 1 / 3; font-size: 32px; }
  .part-of-speech, .word-topic { margin: 0; font-size: 13px; text-align: right; }
  .practice-heading { font-size: 13px; }
  .answer-option { padding: 14px 10px; gap: 12px; }
  .exercise-actions { flex-wrap: wrap; gap: 12px 24px; margin-top: 24px; }
  .exercise-actions .button { flex: 1; }
  .review-details > div { grid-template-columns: 64px minmax(0, 1fr); gap: 16px; margin-top: 16px; }
  .feedback { margin-bottom: 8px; }
  .result-definition { font-size: 16px; }
  .footer { flex-direction: column; gap: 8px; padding-top: 20px; padding-bottom: 20px; }

  .practice-page { min-height: 100svh; }
  .practice-page .footer,
  .practice-page .practice-note { display: none; }
  .practice-page main { padding-bottom: max(var(--page-padding), env(safe-area-inset-bottom)); }
  .practice-page .practice-heading { padding-bottom: 12px; }
  .practice-page legend { font-size: 16px; margin-bottom: 12px; }
  .practice-page .answer-option { min-height: 52px; padding: 10px 8px; line-height: 1.4; }
}

@media (max-width: 600px) and (min-height: 740px) {
  .practice-page .answer-option { padding-top: 14px; padding-bottom: 14px; }
}

@media (max-width: 600px) and (max-height: 739px) {
  .practice-page { --page-padding: 8px; --layout-gap: 12px; }
  .practice-page .practice-heading { padding-bottom: 8px; }
}

