/* Hanja Word-Building — /hanja/
 * The lab's editorial frame: white ground, one-pixel rules, serif headings,
 * a single blue accent. Learning content (characters, words) gets the size;
 * interface text stays small and quiet.
 */

:root {
  --bg: #ffffff;
  --ink: #111827;
  --muted: #4b5563;
  --subtle: #6b7280;
  --line: #e5e7eb;
  --line-strong: #111827;
  --accent: #1d4ed8;
  --ok: #15803d;
  --err: #b91c1c;
  --wash: #f9fafb;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px 96px;
}

/* ── top bar ─────────────────────────────────────────── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-back {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.nav-back:hover { border-bottom-color: var(--ink); }

.nav-sep { color: var(--subtle); }

.series-label { color: var(--subtle); font-size: 12.5px; }

/* ── hero ────────────────────────────────────────────── */
.hj-hero {
  padding: 44px 0 30px;
  border-bottom: 1px solid var(--line-strong);
}

.hj-kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  margin-bottom: 12px;
}

.hj-hero h1 {
  font-family: 'Noto Serif KR', Georgia, serif;
  font-size: clamp(30px, 4.6vw, 40px);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  word-break: keep-all;
}

.hj-lede {
  font-size: 16px;
  color: var(--muted);
  margin: 0;
  max-width: 620px;
}

.hj-hero-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 20px;
  font-size: 12.5px;
  color: var(--subtle);
}

.hj-hero-meta span::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 1px;
  background: var(--line-strong);
  vertical-align: middle;
  margin-right: 8px;
}

/* ── sections ────────────────────────────────────────── */
section { padding: 46px 0 0; }

.hj-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 24px;
}

.hj-section-head h2 {
  font-family: 'Noto Serif KR', Georgia, serif;
  font-size: 23px;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.35;
}

.hj-section-head .hj-sub {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--subtle);
  margin-left: 10px;
}

.hj-section-note {
  font-size: 12.5px;
  color: var(--subtle);
}

/* ── why hanja ───────────────────────────────────────── */
.hj-prose p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 15.5px;
  max-width: 680px;
}

.hj-prose p strong { color: var(--ink); font-weight: 600; }

.hj-prose .hj-quote {
  font-family: 'Noto Serif KR', Georgia, serif;
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  border-left: 2px solid var(--line-strong);
  padding-left: 16px;
  margin: 22px 0;
  max-width: 620px;
}

.hj-rule {
  border: 1px solid var(--line);
  border-top: 2px solid var(--line-strong);
  padding: 22px 22px 18px;
  margin: 30px 0 8px;
}

.hj-rule h3 {
  font-family: 'Noto Serif KR', Georgia, serif;
  font-size: 18px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.hj-rule > p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14.5px;
}

.hj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.hj-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--subtle);
  border-bottom: 1px solid var(--line);
  padding: 0 10px 8px 0;
}

.hj-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 10px 10px 0;
  vertical-align: top;
  color: var(--muted);
}

.hj-table tr:last-child td { border-bottom: 0; }

.hj-table td:first-child { color: var(--ink); white-space: nowrap; }

.hj-mark-ok { color: var(--ok); font-weight: 600; }
.hj-mark-no { color: var(--err); font-weight: 600; }

.hj-hun {
  margin-top: 18px;
  font-size: 13px;
  color: var(--subtle);
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.hj-hun strong { color: var(--ink); }

/* ── explorer ────────────────────────────────────────── */
.hj-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line-strong);
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.hj-tabs button {
  appearance: none;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--subtle);
  padding: 10px 18px 10px 0;
  margin-right: 18px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
}

.hj-tabs button:hover { color: var(--ink); }

.hj-tabs button.is-active {
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--ink);
}

.hj-tabs button small {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--subtle);
}

.hj-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}

.hj-search {
  flex: 1 1 240px;
  min-width: 0;
  font-family: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.hj-search:focus { outline: none; border-color: var(--line-strong); }

.hj-sort {
  font-family: inherit;
  font-size: 13px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.hj-sort:focus { outline: none; border-color: var(--line-strong); }

.hj-warn {
  font-size: 13px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  padding: 4px 0;
}

.hj-warn input { accent-color: #111827; width: 14px; height: 14px; margin: 0; cursor: pointer; }

.hj-count {
  font-size: 12px;
  color: var(--subtle);
  margin: 0 0 14px;
  font-variant-numeric: tabular-nums;
}

.hj-list { list-style: none; margin: 0; padding: 0; }

.hj-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.hj-item:first-child { border-top: 1px solid var(--line); }

/* The Hangul syllable is the card's subject; the character is a quiet note
 * underneath for the reader who wants to know which Hanja it is. */
.hj-syllable {
  text-align: center;
  padding-top: 2px;
}

.hj-sound {
  display: block;
  font-family: 'Noto Serif KR', 'Noto Sans KR', serif;
  font-size: 40px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--ink);
  word-break: keep-all;
}

.hj-sound-dash {
  display: inline-block;
  width: 0.26em;
  height: 2px;
  background: #c7cbd1;
  vertical-align: 0.32em;
  margin: 0 0.04em;
}

.hj-hanja {
  display: block;
  margin-top: 3px;
  font-family: 'Noto Serif KR', 'Noto Sans KR', serif;
  font-size: 13px;
  line-height: 1.2;
  color: #9ca3af;
}

.hj-body { min-width: 0; }

.hj-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.hj-reading {
  font-size: 13px;
  color: var(--subtle);
}

.hj-reading b {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.hj-hun-alt { color: var(--subtle); }

.hj-rank {
  font-size: 11px;
  color: var(--subtle);
  font-variant-numeric: tabular-nums;
}

.hj-meaning {
  font-size: 15.5px;
  color: var(--ink);
  margin: 4px 0 8px;
}

.hj-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--subtle);
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}

.hj-stats b { font-weight: 600; color: var(--ink); }

.hj-words {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.hj-words li {
  display: inline-flex;
  align-items: baseline;
}

.hj-word {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  font-family: 'Noto Sans KR', 'Inter', sans-serif;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-bottom: 1px solid transparent;
}

.hj-word-spk {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--muted);
  transition: color 0.15s ease;
}

.hj-word:hover .hj-word-spk {
  color: var(--ink);
}

.hj-word:hover {
  border-bottom-color: var(--line-strong);
}

.hj-word.is-speaking {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.hj-word.is-speaking .hj-word-spk,
.hj-word.is-speaking .hj-word-text {
  color: var(--accent);
}

.hj-word:focus-visible {
  outline: 1px solid var(--line-strong);
  outline-offset: 2px;
}

.hj-word span {
  font-size: 12px;
  color: var(--subtle);
}

.hj-word .hj-word-text {
  font-size: 14px;
  color: var(--ink);
}

/* The block, marked where it sits inside the example word. */
.hj-w-block {
  font-weight: 600;
  color: var(--accent);
}

.hj-note {
  margin: 10px 0 0;
  padding: 8px 10px;
  background: var(--wash);
  border-left: 2px solid var(--line-strong);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

.hj-note strong { color: var(--ink); font-weight: 600; }

.hj-empty {
  font-size: 14px;
  color: var(--subtle);
  padding: 26px 0;
}

/* ── practice ────────────────────────────────────────── */
.hj-practice-note {
  font-size: 14.5px;
  color: var(--muted);
  max-width: 640px;
  margin: 0 0 22px;
}

.hj-board {
  border: 1px solid var(--line);
  border-top: 2px solid var(--line-strong);
  padding: 0;
}

.hj-scorebar {
  display: flex;
  align-items: center;
  gap: 26px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--wash);
}

.hj-stat {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.hj-stat b {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hj-stat span {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--subtle);
}

.hj-restart {
  margin-left: auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
}

.hj-restart:hover { border-color: var(--line-strong); }

.hj-stage { padding: 24px 20px 22px; }

.hj-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.hj-prompt {
  font-family: 'Noto Serif KR', Georgia, serif;
  font-size: clamp(19px, 2.6vw, 23px);
  line-height: 1.4;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.hj-prompt-ko {
  font-size: 14px;
  color: var(--subtle);
  margin: 0 0 18px;
}

.hj-prompt-ko b {
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 17px;
  color: var(--ink);
  font-weight: 600;
}

/* build: assembly slots */
.hj-slots {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 74px;
  margin-bottom: 6px;
}

.hj-slot {
  width: 60px;
  height: 68px;
  border: 1px dashed #d1d5db;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: #fff;
  cursor: default;
}

.hj-slot.is-filled {
  border: 1px solid var(--line-strong);
  cursor: pointer;
}

.hj-slot .hj-slot-syl {
  font-family: 'Noto Serif KR', 'Noto Sans KR', serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.05;
}

.hj-slot .hj-slot-ch {
  font-size: 10.5px;
  color: #9ca3af;
}

.hj-slot.is-ok { border-color: var(--ok); background: #f4fbf6; }
.hj-slot.is-bad { border-color: var(--err); background: #fdf5f5; }

.hj-assembled {
  font-size: 13px;
  color: var(--subtle);
  margin: 0 0 18px;
  min-height: 20px;
}

.hj-assembled b { color: var(--ink); font-size: 15px; }

.hj-bank {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.hj-block {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  font-family: inherit;
  color: var(--ink);
  width: 76px;
  height: 86px;
  padding: 6px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.hj-block:hover { border-color: var(--line-strong); background: #fcfcfd; }

.hj-block.is-used { opacity: 0.35; }

.hj-block .hj-block-syl {
  font-family: 'Noto Serif KR', 'Noto Sans KR', serif;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.1;
}

.hj-block .hj-block-ch {
  font-family: 'Noto Serif KR', serif;
  font-size: 11px;
  line-height: 1.1;
  color: #9ca3af;
}

.hj-block .hj-block-en {
  font-size: 9.5px;
  line-height: 1.25;
  color: var(--subtle);
  text-align: center;
  max-height: 24px;
  overflow: hidden;
}

/* choice answers */
.hj-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.hj-choice {
  appearance: none;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  font-family: 'Noto Sans KR', 'Inter', sans-serif;
  font-size: 16px;
  color: var(--ink);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.hj-choice:hover:not(:disabled) { border-color: var(--line-strong); }

.hj-choice.is-ok { border-color: var(--ok); background: #f4fbf6; }
.hj-choice.is-bad { border-color: var(--err); background: #fdf5f5; }
.hj-choice:disabled { cursor: default; }

.hj-sound-choices {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.hj-sound-choice {
  appearance: none;
  width: 92px;
  height: 88px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.hj-sound-choice:hover:not(:disabled) { border-color: var(--line-strong); }
.hj-sound-choice.is-ok { border-color: var(--ok); background: #f4fbf6; }
.hj-sound-choice.is-bad { border-color: var(--err); background: #fdf5f5; }
.hj-sound-choice:disabled { cursor: default; }

.hj-sound-choice-syl {
  font-family: 'Noto Serif KR', 'Noto Sans KR', serif;
  font-size: 29px;
  font-weight: 700;
  line-height: 1.1;
}

.hj-sound-choice-ch {
  font-family: 'Noto Serif KR', serif;
  font-size: 11.5px;
  line-height: 1.1;
  color: #9ca3af;
}

/* actions + feedback */
.hj-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.hj-btn {
  font-family: inherit;
  font-size: 13px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}

.hj-btn:hover { background: #000; }

.hj-btn.is-quiet {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.hj-btn.is-quiet:hover { border-color: var(--line-strong); background: #fafafa; }

.hj-btn:disabled { opacity: 0.45; cursor: default; }

.hj-feedback {
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 2px solid var(--line-strong);
  background: var(--wash);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--muted);
}

.hj-feedback.is-ok { border-left-color: var(--ok); background: #f4fbf6; }
.hj-feedback.is-bad { border-left-color: var(--err); background: #fdf5f5; }

.hj-feedback b { color: var(--ink); }

.hj-summary { padding: 8px 0 4px; }

.hj-summary h3 {
  font-family: 'Noto Serif KR', Georgia, serif;
  font-size: 22px;
  margin: 0 0 8px;
}

.hj-summary p { color: var(--muted); font-size: 14.5px; margin: 0 0 18px; }

/* ── footer ──────────────────────────────────────────── */
.page-footer {
  margin-top: 56px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  font-size: 12.5px;
  color: var(--subtle);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── small screens ───────────────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 0 16px 72px; }
  .hj-hero { padding: 30px 0 24px; }
  section { padding: 34px 0 0; }
  .hj-item { grid-template-columns: 64px 1fr; gap: 14px; padding: 16px 0; }
  .hj-sound { font-size: 31px; }
  .hj-hanja { font-size: 12px; }
  .hj-stage { padding: 18px 14px 18px; }
  .hj-scorebar { gap: 18px; padding: 12px 14px; }
  .hj-tabs button { padding: 9px 12px 9px 0; margin-right: 12px; font-size: 13px; }
  .hj-block { width: 68px; }
  .hj-choice { font-size: 15px; }
  .hj-sound-choice { width: 74px; height: 76px; }
  .hj-sound-choice-syl { font-size: 25px; }
  .hj-slot { width: 52px; height: 60px; }
  .hj-table { font-size: 13px; }
}
