:root {
  color-scheme: light dark;
  --bg: #f7f7fa;
  --card: #ffffff;
  --text: #1d1d1f;
  --text-dim: #6b6b76;
  --border: #e5e5ea;
  --accent: #2f5fd6;
  --accent-soft: #e8edfc;
  --term-bg: #fff3c4;
  --fr: #1d1d1f;
  --en: #6b6b76;
  --ko: #2f5fd6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101014;
    --card: #18181e;
    --text: #f0f0f2;
    --text-dim: #92929c;
    --border: #2a2a32;
    --accent: #7f9fff;
    --accent-soft: #1c2440;
    --term-bg: #4a3d10;
    --fr: #f0f0f2;
    --en: #92929c;
    --ko: #7f9fff;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Pretendard, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}
.topnav {
  position: sticky; top: 0; background: var(--bg);
  border-bottom: 1px solid var(--border); z-index: 10;
}
.topnav-inner {
  max-width: 760px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px; overflow-x: auto; white-space: nowrap;
}
.topnav a { color: var(--text-dim); text-decoration: none; font-size: 0.76rem; padding: 5px 9px; border-radius: 999px; }
.topnav a.brand { color: var(--text); font-weight: 700; font-size: 0.9rem; padding-right: 4px; }
.topnav a.active, .topnav a:hover { background: var(--accent-soft); color: var(--accent); }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px 60px; }
h1.page-title { font-size: 1.4rem; margin: 0 0 4px; }
.page-sub { color: var(--text-dim); font-size: 0.88rem; margin: 0 0 20px; }
h2.section-title { font-size: 1.12rem; margin: 26px 0 8px; color: var(--accent); }
p { font-size: 1rem; margin: 0 0 12px; }

.term {
  background: var(--term-bg); padding: 0 4px; border-radius: 4px;
  text-decoration: none; color: inherit; font-weight: 600;
  border-bottom: 1px dashed var(--text-dim);
}
.term:hover { filter: brightness(1.1); }

.callout {
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 10px 14px; margin: 14px 0; font-size: 0.92rem;
}
.callout .callout-title { font-weight: 700; margin-bottom: 4px; }

.sentence {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
}
.sentence .fr { color: var(--fr); font-weight: 700; font-size: 1.02rem; }
.sentence .en { color: var(--en); font-size: 0.88rem; margin-top: 2px; }
.sentence .ko { color: var(--ko); font-size: 0.88rem; margin-top: 2px; }
.sentence .ko::before { content: "KO(영어어순): "; font-size: 0.72rem; color: var(--text-dim); }
.sentence .en::before { content: "EN: "; font-size: 0.72rem; color: var(--text-dim); }

.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 10px 0 20px; }
.word-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px;
}
.word-card .w-fr { font-weight: 700; }
.word-card .w-en { color: var(--text-dim); font-size: 0.82rem; }
.word-card .w-ko { color: var(--accent); font-size: 0.82rem; }

.pattern-box {
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 10px 0;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.92rem;
}

.chapter-nav {
  display: flex; justify-content: space-between; margin-top: 24px; padding-top: 14px;
  border-top: 1px solid var(--border); font-size: 0.85rem;
}
.chapter-nav a { color: var(--accent); text-decoration: none; }
.chapter-nav a:hover { text-decoration: underline; }

.glossary-entry {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 10px; scroll-margin-top: 60px;
}
.glossary-entry h3 { margin: 0 0 4px; font-size: 0.98rem; }
.glossary-entry p { margin: 0; font-size: 0.88rem; color: var(--text-dim); }
.glossary-entry .glossary-tag {
  font-size: 0.68rem; color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 1px 8px; margin-left: 8px;
}

.toc-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.toc-list a {
  display: block; background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; color: var(--text); text-decoration: none;
}
.toc-list a:hover { border-color: var(--accent); }
.toc-num { color: var(--accent); font-weight: 700; margin-right: 8px; }
.toc-desc { display: block; color: var(--text-dim); font-size: 0.85rem; margin-top: 3px; }
