@font-face {
  font-family: 'NanumSquare';
  src: url('/font/NanumSquareR.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'NanumSquare';
  src: url('/font/NanumSquareB.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'NanumSquare';
  src: url('/font/NanumSquareEB.ttf') format('truetype');
  font-weight: 800;
  font-display: swap;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'NanumSquare', sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.7;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; }

h1, h2, h3 { line-height: 1.35; letter-spacing: -0.01em; }
h1 { font-size: 1.9rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 700; margin-top: 1.4em; }
article p { margin: 0.9em 0; }

.container { max-width: var(--content-width); margin: 0 auto; padding: 0 20px; }
main.container { padding: 32px 20px 80px; }

header.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
header.site-header .brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; letter-spacing: -0.01em; }
header.site-header nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
header.site-header nav a { font-size: 0.9rem; text-decoration: none; color: var(--muted); transition: color 0.15s; }
header.site-header nav a:hover { color: var(--fg); }

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  transition: border-color 0.15s, transform 0.1s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle:active { transform: scale(0.97); }

.card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
a.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}
.card-list { display: grid; gap: 12px; }

.card.has-icon { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: nowrap; }
.card.has-icon .card-text { flex: 1 1 auto; min-width: 0; }
.card.has-icon .card-icon { flex: 0 0 auto; width: 48px; height: 48px; object-fit: contain; }
@media (max-width: 480px) {
  .card.has-icon .card-icon { display: none; }
}

.card > *:first-child,
article > *:first-child { margin-top: 0; }

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.accent { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.badge.correct { background: var(--correct); color: #fff; border-color: var(--correct); }
.badge.wrong { background: var(--wrong); color: #fff; border-color: var(--wrong); }

.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
  font-family: inherit;
  padding: 11px 22px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: filter 0.15s, transform 0.1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: transparent; color: var(--fg); border: 1px solid var(--border); box-shadow: none; }
.btn.secondary:hover { filter: none; border-color: var(--accent); }

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 20px;
  font-size: 0.8rem;
  color: var(--muted);
}
footer.site-footer .legal-note { margin-bottom: 10px; }
footer.site-footer nav a { margin-right: 12px; color: var(--muted); transition: color 0.15s; }
footer.site-footer nav a:hover { color: var(--fg); }

.question-block { border-bottom: 1px solid var(--border); padding: 20px 0; }
.question-block:last-child { border-bottom: none; }
.question-meta { display: flex; gap: 8px; margin-bottom: 8px; }
.choice-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.choice-list li label {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
}
.choice-list li label.is-correct { border-color: var(--correct); background: color-mix(in srgb, var(--correct) 12%, var(--card-bg)); }
.choice-list li label.is-wrong { border-color: var(--wrong); background: color-mix(in srgb, var(--wrong) 12%, var(--card-bg)); }
.explanation { margin-top: 10px; font-size: 0.9rem; color: var(--muted); }
.question-meta-line { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.question-block .btn-add-wrongnote,
.question-block .btn-remove-wrongnote { margin-top: 10px; }
.choice-list input:disabled { cursor: not-allowed; }

.timer { font-weight: 800; font-size: 1.1rem; }

.chapter-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.chapter-nav + .btn { margin-top: 16px; }

article + section { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }

#exam-form > .btn { margin-top: 20px; }

.reading-progress-track {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 100;
}
.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.1s linear;
}

article table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.9rem;
}
article table caption {
  text-align: left;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}
article th, article td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}
article th {
  background: var(--card-bg);
  font-weight: 700;
}
.table-scroll { overflow-x: auto; margin: 16px 0; }
.table-scroll table { margin: 0; }

.search-box { margin: 20px 0; }
.search-box input {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--fg);
}
.search-box input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.hub-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
}
.hub-hero-illustration { flex-shrink: 0; width: 120px; height: 120px; }
.hub-intro { color: var(--muted); margin-top: 8px; }
@media (max-width: 560px) {
  .hub-hero { flex-direction: column-reverse; align-items: flex-start; }
  .hub-hero-illustration { width: 96px; height: 96px; }
}

body[data-hide-meta] .badge.difficulty,
body[data-hide-meta] .badge.accuracy { display: none; }
