/* Before Noon — shared styles
   Palette: hanji paper, ink, dancheong cinnabar / jade / ochre / indigo */
:root {
  --bg: #f4eddf;
  --paper: #fffaf0;
  --paper-2: #f9f2e4;
  --ink: #1f1b16;
  --muted: #5f564b;
  --line: #e0d3bb;
  --red: #b23128;
  --red-soft: #f6dcd6;
  --jade: #17695d;
  --jade-soft: #d5ece6;
  --gold: #a56d00;
  --gold-soft: #f6e6c2;
  --blue: #23407a;
  --blue-soft: #dbe3f3;
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 8px 24px rgba(60, 40, 10, .08);
  --radius: 16px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ko: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-ko-serif: "Gowun Batang", "Noto Serif KR", "AppleMyungjo", serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121419;
  --paper: #1b1e26;
  --paper-2: #222631;
  --ink: #f1e9da;
  --muted: #b1a796;
  --line: #333845;
  --red: #ef6a5e;
  --red-soft: #3d2221;
  --jade: #4cc2ac;
  --jade-soft: #173631;
  --gold: #e9b44c;
  --gold-soft: #3a2f17;
  --blue: #8aa7e6;
  --blue-soft: #1f2a44;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121419;
    --paper: #1b1e26;
    --paper-2: #222631;
    --ink: #f1e9da;
    --muted: #b1a796;
    --line: #333845;
    --red: #ef6a5e;
    --red-soft: #3d2221;
    --jade: #4cc2ac;
    --jade-soft: #173631;
    --gold: #e9b44c;
    --gold-soft: #3a2f17;
    --blue: #8aa7e6;
    --blue-soft: #1f2a44;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(178, 49, 40, .05), transparent 40%),
    radial-gradient(circle at 88% 20%, rgba(23, 105, 93, .05), transparent 40%);
  min-height: 100vh;
  overflow-x: hidden;
}
img, svg, canvas { max-width: 100%; }
a { color: var(--blue); }
a:hover { color: var(--red); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 7vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 4.5vw, 2.2rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
.ko { font-family: var(--font-ko); }
.ko-serif { font-family: var(--font-ko-serif); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand-mark { width: 34px; height: 34px; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; line-height: 1; }
.brand-name small { display: block; font-family: var(--font-ko-serif); font-weight: 700; font-size: .72rem; color: var(--red); letter-spacing: .1em; margin-top: 3px; }
.site-nav { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav ul { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0 24px 0 0; white-space: nowrap; }
.site-nav a {
  display: block; padding: 7px 11px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-weight: 600; font-size: .9rem;
}
.site-nav a:hover { color: var(--ink); background: var(--paper-2); }
.site-nav a[aria-current="page"] { color: var(--paper); background: var(--ink); }
.icon-btn {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  display: grid; place-items: center; cursor: pointer; font-size: 1.1rem;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: block; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-dark { display: block; }
  :root:not([data-theme="light"]) .theme-icon-light { display: none; }
}

/* ---------- Layout ---------- */
main { display: block; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.section { padding: 48px 0; }
.section-tight { padding: 28px 0; }
.page-head { padding: 36px 0 12px; }
.page-head .kicker { margin-bottom: 6px; }
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--red);
}
.kicker .ko-serif { letter-spacing: .05em; text-transform: none; font-size: .95rem; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 62ch; }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Buttons ---------- */
.btn {
  --b: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border-radius: 999px;
  border: 2px solid var(--b); background: var(--b); color: var(--paper);
  font: 700 1rem/1.1 var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--b) 60%, #000);
}
.btn:hover { color: var(--paper); transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--b) 60%, #000); }
.btn-red { --b: var(--red); }
.btn-jade { --b: var(--jade); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: none; border-color: var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
:root[data-theme="dark"] .btn:not(.btn-ghost) { color: #12141a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn:not(.btn-ghost) { color: #12141a; } }

.speak-btn { display: none; }
.can-speak .speak-btn { display: inline-flex; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  background: var(--paper-2); border: 1px solid var(--line); font-size: .82rem; font-weight: 600; color: var(--muted);
}
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font: 600 .92rem var(--font-body); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 28px 0 40px; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px;
  font-weight: 600; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Home ---------- */
.hero { padding: 40px 0 24px; position: relative; }
.hero-grid { display: grid; gap: 28px; align-items: center; }
@media (min-width: 880px) { .hero-grid { grid-template-columns: 1.1fr .9fr; } }
.hero h1 .accent { color: var(--red); }
.hero-quote {
  border-left: 4px solid var(--red); padding: 6px 0 6px 14px; margin: 18px 0;
  font-family: var(--font-display); font-style: italic; font-size: 1.12rem;
}
.hero-quote cite { display: block; font-style: normal; font-family: var(--font-body); font-size: .85rem; color: var(--muted); margin-top: 4px; }
.sundial { position: relative; }
.sundial svg { width: 100%; height: auto; display: block; }
.compose-stage {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 140px;
  font-family: var(--font-ko); font-weight: 700;
}
.compose-stage .jamo { font-size: 3rem; color: var(--muted); transition: .5s; }
.compose-stage .op { font-size: 1.6rem; color: var(--line); }
.compose-stage .result { font-size: 5.5rem; color: var(--red); line-height: 1; transition: .4s; }
.compose-stage .rr { font-family: var(--font-body); font-size: 1rem; color: var(--muted); font-weight: 600; }
.stat-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .stat-strip { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-family: var(--font-display); font-size: 2rem; line-height: 1; color: var(--red); }
.stat span { font-size: .88rem; color: var(--muted); }
.mode-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: var(--ink); transition: transform .15s, border-color .15s; }
.mode-card:hover { transform: translateY(-3px); border-color: var(--ink); color: var(--ink); }
.mode-card .glyph {
  width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center;
  font: 700 2rem var(--font-ko); color: #fff;
}
.mode-card p { color: var(--muted); margin: 0; }
.mode-card .go { margin-top: auto; font-weight: 700; color: var(--red); }
.bg-red { background: var(--red); } .bg-jade { background: var(--jade); } .bg-gold { background: var(--gold); } .bg-blue { background: var(--blue); } .bg-ink { background: var(--ink); }
.best-banner { display: none; margin-top: 12px; }
.best-banner.show { display: inline-flex; }

/* ---------- Morning (lesson game) ---------- */
.sky {
  position: sticky; top: 61px; z-index: 40;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.sky-inner { max-width: 760px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 12px; }
.clock-digital { font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; min-width: 104px; font-variant-numeric: tabular-nums; }
.clock-digital.late { color: var(--red); }
.sky-track { flex: 1; position: relative; height: 34px; }
.sky-track .rail { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: linear-gradient(90deg, #3b3f73, #c8664a 25%, #f0b64a 60%, #f7d873); opacity: .85; }
.sky-track .sun {
  position: absolute; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff6c9, #f2b632 60%, #d98a12);
  box-shadow: 0 0 0 4px rgba(242, 182, 50, .25), 0 0 18px rgba(242, 182, 50, .6);
  transition: left .6s cubic-bezier(.3, 1.4, .5, 1);
}
.sky-track .tick { position: absolute; top: 0; font-size: .65rem; color: var(--muted); transform: translateX(-50%); }
.sky-track .tick::after { content: ""; display: block; width: 1px; height: 6px; background: var(--muted); margin: 0 auto; opacity: .5; }
.sky-meta { font-size: .78rem; color: var(--muted); text-align: right; line-height: 1.2; min-width: 60px; }
.time-pop { position: absolute; top: -6px; font-weight: 800; font-size: .8rem; color: var(--red); animation: pop 1s forwards; pointer-events: none; transform: translateX(-50%); }
@keyframes pop { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -18px); } }

.stage { max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; }
.lesson-map { display: grid; gap: 10px; counter-reset: lesson; }
.lesson-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px;
  background: var(--paper); border: 1px solid var(--line);
}
.lesson-row .hr { font-family: var(--font-display); font-weight: 800; min-width: 54px; color: var(--muted); }
.lesson-row .t { flex: 1; min-width: 0; }
.lesson-row .t b { display: block; }
.lesson-row .t span { font-size: .85rem; color: var(--muted); }
.lesson-row .letters { font: 700 1.05rem var(--font-ko); color: var(--jade); letter-spacing: .08em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34%; }
.lesson-row.done { opacity: .7; }
.lesson-row.done .hr { color: var(--jade); }
.lesson-row.current { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-soft); }
.lesson-row.current .hr { color: var(--red); }

.shared-banner { background: var(--gold-soft); border: 1px solid var(--gold); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.shared-banner b { font-family: var(--font-display); font-size: 1.3rem; }

.lesson-card { text-align: center; padding: 28px 20px; }
.lesson-card .show {
  font: 700 clamp(4rem, 22vw, 7.5rem)/1.05 var(--font-ko); color: var(--red); margin: 6px 0 12px;
  word-break: keep-all;
}
.lesson-card .show.small-show { font-size: clamp(2.6rem, 13vw, 4.4rem); }
.lesson-card .body { text-align: left; max-width: 56ch; margin: 0 auto; }
.lesson-card .body p:last-child { margin-bottom: 0; }
.letter-table { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0; }
.letter-pill { display: flex; flex-direction: column; align-items: center; min-width: 62px; padding: 8px; border-radius: 12px; background: var(--paper-2); border: 1px solid var(--line); cursor: pointer; color: var(--ink); font: inherit; }
.letter-pill b { font: 700 1.8rem/1.1 var(--font-ko); }
.letter-pill span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.letter-pill:hover { border-color: var(--ink); }
.card-dots { display: flex; gap: 6px; justify-content: center; margin: 16px 0; }
.card-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.card-dots i.on { background: var(--red); }

.q-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; font-size: .9rem; color: var(--muted); }
.q-progress { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; min-width: 0; max-width: 60%; }
.q-progress i { width: 14px; height: 6px; border-radius: 3px; background: var(--line); }
.q-progress i.ok { background: var(--jade); }
.q-progress i.bad { background: var(--red); }
.q-progress i.now { background: var(--ink); }
.q-prompt { font-weight: 700; font-size: 1.05rem; margin: 0 0 4px; }
.q-glyph {
  font: 700 clamp(3.6rem, 20vw, 6.5rem)/1.1 var(--font-ko); text-align: center; margin: 10px 0 18px;
  word-break: keep-all; overflow-wrap: anywhere;
}
.q-glyph.word { font-size: clamp(2.6rem, 13vw, 4.6rem); }
.q-glyph.latin { font-family: var(--font-display); font-size: clamp(2.6rem, 12vw, 4rem); color: var(--blue); }
.options { display: grid; gap: 10px; }
@media (min-width: 560px) { .options { grid-template-columns: 1fr 1fr; } }
.opt {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 14px;
  border-radius: 14px; border: 2px solid var(--line); background: var(--paper); color: var(--ink);
  font: 600 1.12rem var(--font-body); text-align: left; cursor: pointer; transition: border-color .12s, transform .12s, background .12s;
}
.opt .k { flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--paper-2); border: 1px solid var(--line); font-size: .78rem; color: var(--muted); }
.opt .ko { font-size: 1.6rem; font-weight: 700; }
.opt:hover:not([disabled]) { border-color: var(--ink); transform: translateY(-1px); }
.opt.right { border-color: var(--jade); background: var(--jade-soft); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); animation: shake .35s; }
.opt[disabled] { cursor: default; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.feedback {
  margin-top: 16px; padding: 14px 16px; border-radius: 14px; display: none; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
.feedback.show { display: flex; }
.feedback.good { background: var(--jade-soft); border: 1px solid var(--jade); }
.feedback.bad { background: var(--red-soft); border: 1px solid var(--red); }
.feedback .msg { flex: 1; min-width: 200px; }
.feedback .msg b { display: block; }
.q-tools { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.hint-box { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: var(--gold-soft); border: 1px dashed var(--gold); display: none; }
.hint-box.show { display: block; }

.build-slots { display: flex; justify-content: center; gap: 10px; margin: 6px 0 12px; }
.build-slot { width: 64px; height: 64px; border-radius: 14px; border: 2px dashed var(--line); display: grid; place-items: center; font: 700 2rem var(--font-ko); }
.build-slot.filled { border-style: solid; border-color: var(--ink); }
.build-preview { text-align: center; font: 700 4rem/1.1 var(--font-ko); min-height: 4.6rem; color: var(--red); }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile {
  width: 56px; height: 56px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper);
  font: 700 1.7rem var(--font-ko); color: var(--ink); cursor: pointer; transition: transform .1s;
}
.tile:hover:not([disabled]) { border-color: var(--ink); transform: translateY(-2px); }
.tile[disabled] { opacity: .35; cursor: default; }

.result-wrap { text-align: center; }
.result-time { font: 800 clamp(3.4rem, 16vw, 6rem)/1 var(--font-display); color: var(--red); margin: 8px 0; font-variant-numeric: tabular-nums; }
.rank-ko { font: 700 1.6rem var(--font-ko-serif); }
.rank-en { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }
.result-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.result-canvas { width: 100%; max-width: 600px; height: auto; border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow); margin: 16px auto; display: block; }

/* ---------- Letter Lab ---------- */
.shape-tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.shape-tabs button {
  width: 64px; height: 64px; border-radius: 16px; border: 2px solid var(--line); background: var(--paper);
  font: 700 2rem var(--font-ko); color: var(--ink); cursor: pointer;
}
.shape-tabs button[aria-selected="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.mouth-wrap { display: grid; gap: 18px; align-items: center; }
@media (min-width: 760px) { .mouth-wrap { grid-template-columns: 1fr 1fr; } }
.mouth-svg { width: 100%; max-width: 380px; margin: 0 auto; display: block; }
.mouth-svg .head { fill: var(--paper-2); stroke: var(--muted); stroke-width: 3; }
.mouth-svg .organ { fill: none; stroke: var(--muted); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.mouth-svg .tongue { fill: #e7a49a; stroke: #b5655b; stroke-width: 2; }
.mouth-svg .hl { fill: none; stroke: var(--red); stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; }
.mouth-svg .hl-fill { fill: none; stroke: var(--red); stroke-width: 9; }
.mouth-svg .draw { stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1.1s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.family { display: grid; gap: 10px; }
.family-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 12px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.family-row .base { background: var(--red); color: #fff; }
.fam-letter { display: inline-flex; flex-direction: column; align-items: center; min-width: 54px; padding: 6px 8px; border-radius: 12px; background: var(--paper-2); }
.fam-letter b { font: 700 1.8rem/1.1 var(--font-ko); }
.fam-letter span { font-size: .75rem; font-weight: 700; opacity: .85; }
.fam-letter.odd { outline: 2px dashed var(--gold); }
.fam-letter.lost { opacity: .55; }
.fam-arrow { color: var(--muted); font-weight: 700; }
.fam-label { font-size: .82rem; color: var(--muted); margin-left: auto; }
.vowel-kit { text-align: center; }
.prims { display: flex; justify-content: center; gap: 12px; margin: 14px 0; flex-wrap: wrap; }
.prim {
  width: 92px; height: 92px; border-radius: 18px; border: 2px solid var(--line); background: var(--paper); cursor: pointer; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: 600 .8rem var(--font-body);
}
.prim b { font: 700 2.2rem/1 var(--font-ko); }
.prim:hover { border-color: var(--ink); }
.vk-seq { min-height: 52px; display: flex; justify-content: center; gap: 6px; align-items: center; font: 700 1.8rem var(--font-ko); color: var(--muted); }
.vk-out { font: 700 5rem/1.1 var(--font-ko); color: var(--jade); min-height: 5.6rem; }
.vk-found { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.vk-found span { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font: 700 1.4rem var(--font-ko); border: 1.5px dashed var(--line); color: var(--line); }
.vk-found span.got { border-style: solid; border-color: var(--jade); color: var(--jade); background: var(--jade-soft); }
.lost-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.lost-card { text-align: center; }
.lost-card b { display: block; font: 700 3rem/1.1 var(--font-ko-serif); color: var(--gold); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.chart-cell {
  aspect-ratio: 1; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font: inherit;
}
.chart-cell b { font: 700 1.7rem/1.1 var(--font-ko); }
.chart-cell span { font-size: .72rem; color: var(--muted); font-weight: 600; }
.chart-cell[aria-pressed="true"] { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-soft); }
.chart-cell.v b { color: var(--jade); }
.chart-detail { margin-top: 14px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.chart-detail .big { font: 700 4.5rem/1 var(--font-ko); color: var(--red); min-width: 90px; text-align: center; }
.chart-detail .info { flex: 1; min-width: 200px; }

/* ---------- Forge ---------- */
.forge-top { display: grid; gap: 16px; }
@media (min-width: 820px) { .forge-top { grid-template-columns: 1fr 1fr; align-items: stretch; } }
.forge-anvil { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.forge-glyph { font: 700 clamp(6rem, 30vw, 9rem)/1 var(--font-ko); color: var(--red); min-height: 1em; }
.forge-glyph.bump { animation: bump .35s; }
@keyframes bump { 50% { transform: scale(1.12); } }
.forge-eq { font: 700 1.3rem var(--font-ko); color: var(--muted); margin: 8px 0; }
.forge-eq .i { color: var(--red); } .forge-eq .v { color: var(--jade); } .forge-eq .f { color: var(--gold); }
.forge-rr { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.layout-diagram { width: 92px; height: 92px; }
.layout-diagram rect { stroke: var(--ink); stroke-width: 2; rx: 4; }
.layout-diagram .li { fill: var(--red-soft); } .layout-diagram .lv { fill: var(--jade-soft); } .layout-diagram .lf { fill: var(--gold-soft); }
.layout-diagram text { font: 700 14px var(--font-ko); fill: var(--ink); }
.picker { margin-top: 14px; }
.picker h3 { font-size: 1rem; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.picker h3 i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.picker-tiles { display: flex; flex-wrap: wrap; gap: 6px; }
.ptile {
  min-width: 46px; height: 50px; padding: 0 6px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--paper);
  color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05;
}
.ptile b { font: 700 1.35rem var(--font-ko); }
.ptile span { font-size: .66rem; color: var(--muted); font-weight: 600; }
.ptile[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.ptile[aria-pressed="true"] span { color: var(--paper); opacity: .8; }
.collect-bar { height: 10px; border-radius: 5px; background: var(--paper-2); border: 1px solid var(--line); overflow: hidden; }
.collect-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); width: 0; transition: width .4s; }
.found-in { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.target-card { text-align: center; background: var(--blue-soft); border: 1px solid var(--blue); }
.target-word { font: 700 2.2rem var(--font-ko); letter-spacing: .1em; }
.target-word .slot { display: inline-block; min-width: 1.1em; border-bottom: 3px solid var(--blue); margin: 0 2px; }
.target-word .slot.cur { border-color: var(--red); }

/* ---------- Rush ---------- */
.rush-setup .group { margin-bottom: 18px; }
.rush-setup .group > b { display: block; margin-bottom: 8px; }
.pack-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.pack-btn {
  text-align: left; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--paper); cursor: pointer; color: var(--ink); font: inherit;
}
.pack-btn b { display: block; font-size: 1rem; }
.pack-btn .ko { font-size: 1.4rem; font-weight: 700; display: block; color: var(--red); }
.pack-btn span { font-size: .8rem; color: var(--muted); }
.pack-btn[aria-pressed="true"] { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.rush-hud { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.rush-hud .score { font: 800 1.6rem var(--font-display); min-width: 70px; }
.rush-hud .combo { font-weight: 800; color: var(--gold); min-width: 52px; }
.timer-bar { flex: 1; height: 12px; border-radius: 6px; background: var(--paper-2); border: 1px solid var(--line); overflow: hidden; }
.timer-bar i { display: block; height: 100%; background: var(--jade); width: 100%; transition: width .2s linear; }
.timer-bar.low i { background: var(--red); }
.rush-secs { font: 700 1.1rem var(--font-display); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.sign {
  border-radius: 18px; padding: 26px 16px; margin: 6px 0 16px; text-align: center; position: relative; overflow: hidden;
  min-height: 170px; display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.sign .ko { font-weight: 800; font-size: clamp(2.4rem, 12vw, 4.2rem); line-height: 1.1; word-break: keep-all; }
.sign .sub { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; opacity: .8; margin-bottom: 8px; font-weight: 700; }
.sign.konglish { background: #1d1033; color: #ffd6f6; box-shadow: inset 0 0 0 3px #ff5fd2, 0 0 24px rgba(255, 95, 210, .35); }
.sign.konglish .ko { text-shadow: 0 0 10px #ff5fd2, 0 0 22px #ff5fd2; }
.sign.food { background: #2b2118; color: #fff4dd; box-shadow: inset 0 0 0 6px #6a4b2c; }
.sign.food .ko { font-family: var(--font-ko-serif); }
.sign.subway { background: #fff; color: #111; border: 3px solid #1b1b1b; }
.sign.subway .line-dot { width: 44px; height: 44px; border-radius: 50%; background: #00a84d; color: #fff; display: grid; place-items: center; font-weight: 800; margin-bottom: 8px; font-size: 1.2rem; }
.sign.kculture { background: linear-gradient(135deg, #3b1b6e, #b3245d); color: #fff; }
.sign.places { background: #0d6b3c; color: #fff; border: 4px solid #fff; box-shadow: 0 0 0 3px #0d6b3c; }
.sign.flash-ok { animation: flashok .4s; }
.sign.flash-bad { animation: shake .35s; }
@keyframes flashok { 50% { transform: scale(1.03); } }
.type-row { display: flex; gap: 8px; }
.type-row input {
  flex: 1; min-width: 0; min-height: 52px; border-radius: 14px; border: 2px solid var(--line); background: var(--paper); color: var(--ink);
  padding: 0 14px; font: 600 1.2rem var(--font-body);
}
.type-row input:focus { border-color: var(--ink); outline: none; }
.missed-list { display: grid; gap: 6px; margin-top: 10px; text-align: left; }
.missed-list div { display: flex; gap: 12px; align-items: baseline; padding: 8px 12px; border-radius: 10px; background: var(--paper-2); flex-wrap: wrap; }
.missed-list .ko { font-weight: 700; font-size: 1.2rem; }
.hs-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.hs-table th, .hs-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.hs-table td:last-child, .hs-table th:last-child { text-align: right; }

/* ---------- Name seal ---------- */
.name-form { display: flex; gap: 8px; flex-wrap: wrap; }
.name-form input {
  flex: 1 1 220px; min-height: 52px; border-radius: 14px; border: 2px solid var(--line); background: var(--paper); color: var(--ink);
  padding: 0 14px; font: 600 1.15rem var(--font-body);
}
.name-form input:focus { border-color: var(--ink); outline: none; }
.seal-stage { display: grid; gap: 20px; align-items: center; margin-top: 20px; }
@media (min-width: 760px) { .seal-stage { grid-template-columns: 300px 1fr; } }
.seal-box { display: flex; justify-content: center; }
.seal-svg { width: 260px; height: 260px; filter: drop-shadow(0 6px 14px rgba(120, 20, 10, .25)); }
.seal-svg.stamp { animation: stamp .45s cubic-bezier(.2, 1.6, .5, 1); }
@keyframes stamp { from { transform: scale(1.5) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
.name-big { font: 700 clamp(2.6rem, 12vw, 4rem)/1.1 var(--font-ko-serif); color: var(--red); word-break: keep-all; }
.breakdown { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.bd-syl { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; text-align: center; min-width: 92px; }
.bd-syl > b { font: 700 2.2rem/1.1 var(--font-ko); display: block; }
.bd-parts { display: flex; gap: 4px; justify-content: center; margin-top: 4px; }
.bd-parts span { display: flex; flex-direction: column; font: 700 1rem var(--font-ko); }
.bd-parts small { font: 600 .7rem var(--font-body); color: var(--muted); }
.edit-row { margin-top: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.edit-row input { min-height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); padding: 0 12px; font: 700 1.2rem var(--font-ko); width: 200px; max-width: 100%; }
.name-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.name-examples button { border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 5px 12px; cursor: pointer; font: 600 .85rem var(--font-body); }

/* ---------- About / timeline ---------- */
.timeline { position: relative; margin: 20px 0; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: linear-gradient(var(--red), var(--gold), var(--jade)); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before { content: ""; position: absolute; left: -25px; top: 8px; width: 13px; height: 13px; border-radius: 50%; background: var(--paper); border: 3px solid var(--red); }
.tl-item .yr { font: 800 1.2rem var(--font-display); color: var(--red); }
.tl-item h3 { margin: 0 0 4px; font-size: 1.05rem; }
.tl-item p { margin: 0; color: var(--muted); }
.sources li { margin-bottom: 6px; overflow-wrap: anywhere; }
.prose p, .prose li { max-width: 68ch; }
blockquote.pull { margin: 20px 0; padding: 16px 20px; border-radius: var(--radius); background: var(--paper); border-left: 5px solid var(--red); font-family: var(--font-display); font-size: 1.15rem; font-style: italic; }
blockquote.pull cite { display: block; margin-top: 6px; font: 600 .85rem var(--font-body); color: var(--muted); font-style: normal; }

/* ---------- Motion ---------- */
.fade-in { animation: fadein .35s ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .mouth-svg .draw { stroke-dashoffset: 0; }
}
@media (max-width: 420px) {
  .brand-name { display: none; }
  .clock-digital { font-size: 1.2rem; min-width: 84px; }
  .sky-meta { display: none; }
  .lesson-row .letters { display: none; }
  .compose-stage { gap: 6px; }
  .compose-stage .jamo { font-size: 2.2rem; }
  .compose-stage .result { font-size: 4.2rem; }
  .prim { width: 84px; height: 84px; }
}
