/* Mojipad — draft styles. Mobile first, no framework. */
:root {
  --ink: #1f2a44;
  --ink-2: #4a5468;
  --muted: #6b7385;
  --paper: #faf7f2;
  --card: #ffffff;
  --line: #e4ddd2;
  --accent: #c8432f;
  --accent-2: #a8331f;
  --soft: #f3ece2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 42, 68, .06), 0 6px 18px rgba(31, 42, 68, .07);
  --font: "Noto Sans KR", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.65 var(--font); }
img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }
a { color: var(--accent-2); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.75rem, 4.6vw, 2.6rem); font-weight: 800; }
h2 { font-size: clamp(1.25rem, 2.6vw, 1.6rem); font-weight: 800; }
.h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.ic { width: 1.15em; height: 1.15em; flex: none; }

.draft { background: #fff4d6; color: #5a4300; border-bottom: 1px solid #f0d998; font-size: .76rem; line-height: 1.45; padding: 6px 16px; text-align: center; }
.draft b { background: #5a4300; color: #fff4d6; border-radius: 4px; padding: 1px 6px; margin-right: 6px; font-size: .75rem; letter-spacing: .04em; }

/* header */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand svg { width: 38px; height: 38px; flex: none; }
.brand b { display: block; font-size: 1.08rem; font-weight: 800; line-height: 1.1; }
.brand small { display: block; color: var(--muted); font-size: .78rem; }
.nav { display: flex; gap: 2px; flex-wrap: nowrap; overflow-x: auto; width: 100%; margin: 0 -6px; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .95rem; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a[aria-current] { background: var(--ink); color: #fff; }

/* buttons, chips */
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: #fff; text-decoration: none; font-weight: 700;
  padding: 12px 18px; border-radius: 10px; border: 2px solid var(--accent); line-height: 1.2; }
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn small { font-weight: 500; opacity: .85; font-size: .8em; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: #fff; }
.btn.small { padding: 8px 12px; font-size: .92rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.chip { font-size: .76rem; font-weight: 700; color: var(--ink-2); background: var(--soft); border-radius: 999px; padding: 3px 10px; }
.chip.key { background: #e6efe7; color: #2f5a35; }
.pill { display: inline-block; border: 1px solid var(--line); background: var(--card); color: var(--ink); text-decoration: none;
  border-radius: 999px; padding: 6px 14px; font-weight: 500; }

/* hero */
.hero { padding: 40px 0 28px; }
.hero-in { display: grid; gap: 28px; align-items: center; }
.eyebrow { color: var(--accent-2); font-weight: 700; font-size: .85rem; letter-spacing: .02em; margin-bottom: 10px; }
.lead { font-size: 1.08rem; color: var(--ink-2); max-width: 62ch; }
.ticks { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; color: var(--ink-2); }
.ticks li { display: flex; gap: 8px; align-items: center; }
.ticks .ic { color: #2f7a3e; }
.fan { position: relative; height: 330px; max-width: 460px; margin: 0 auto; width: 100%; }
.fan img { position: absolute; width: 56%; border-radius: 6px; box-shadow: var(--shadow); background: #fff; border: 1px solid var(--line); }
.fan img:nth-child(1) { left: 0; top: 26px; transform: rotate(-5deg); }
.fan img:nth-child(2) { left: 22%; top: 0; z-index: 2; }
.fan img:nth-child(3) { right: 0; top: 30px; transform: rotate(5deg); }

/* sections */
.sec { padding: 36px 0; }
.sec.tight { padding: 22px 0; }
.sec.alt { background: #f4efe7; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sec-head { margin-bottom: 18px; }
.sec-head p { color: var(--ink-2); max-width: 70ch; }
.sec-head h2 a { color: inherit; text-decoration: none; }
.two { display: grid; gap: 24px; }
.page-head { padding: 22px 0 6px; }

.path { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.path a { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; text-decoration: none; color: var(--ink); }
.path a:hover { border-color: var(--ink); }
.path .n { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 800; }
.path b { display: block; }
.path small { display: block; color: var(--muted); font-size: .86rem; }
.path.small a { padding: 9px 12px; }

.hubs { display: grid; gap: 12px; }
.hub { display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); text-decoration: none; }
.hub:hover { border-color: var(--ink); }
.hub-ic { grid-row: 1 / 3; width: 56px; height: 56px; border-radius: 12px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 1.6rem; font-weight: 700; }
.hub span:last-child { color: var(--muted); font-size: .9rem; }

/* cards */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); text-decoration: none;
  display: flex; flex-direction: column; box-shadow: var(--shadow); }
.card:hover { border-color: var(--ink); }
.card-img { background: #f1ede6; padding: 10px 10px 0; aspect-ratio: 1 / 1; overflow: hidden; }
.card-img img { border-radius: 4px 4px 0 0; box-shadow: 0 0 0 1px var(--line); background: #fff; }
.card-body { padding: 10px 12px 14px; }
.card-title { display: block; font-weight: 700; font-size: .95rem; line-height: 1.35; }
.more { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 22px; color: var(--muted); }

/* sheet page */
.crumbs { font-size: .85rem; color: var(--muted); margin: 14px 0 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--muted); }
.detail { display: grid; gap: 24px; padding-bottom: 40px; }
.detail .info { order: -1; }
.preview .main { border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); background: #fff; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.thumbs img { border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.info h1 { font-size: clamp(1.5rem, 3.6vw, 2.1rem); }
.dl { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 16px 0; }
.dl-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.dl-row.main .btn { flex: 1 1 240px; justify-content: center; }
.dl-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; margin-right: 4px; }
.paper { display: inline-flex; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.paper button { font: inherit; font-weight: 700; border: 0; background: transparent; color: var(--ink); padding: 6px 14px; cursor: pointer; }
.paper button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.fine { font-size: .86rem; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.box h2 { font-size: 1.1rem; }
.steps { margin: 0; padding-left: 1.3em; }
.steps li { margin: 4px 0; }
.letters { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.letters li { display: flex; gap: 10px; align-items: center; font-size: .92rem; }
.letters .big { font-size: 1.5rem; font-weight: 700; width: 1.6em; text-align: center; }
.words { margin: 0; padding-left: 1.1em; columns: 2 220px; }
.words .rr { color: var(--muted); font-style: italic; margin-right: 4px; }
.sib { display: flex; flex-wrap: wrap; gap: 8px; }
.sib a { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; text-decoration: none; color: var(--ink); font-size: .92rem; }
.sib a:hover { border-color: var(--ink); }
.prose { max-width: 760px; padding-bottom: 40px; }
.prose h2 { margin-top: 1.4em; }

/* footer */
.foot { background: var(--ink); color: #d9deea; padding: 32px 0 26px; margin-top: 20px; }
.foot a { color: #fff; }
.foot h2 { font-size: .95rem; color: #fff; margin-bottom: 6px; }
.foot ul { list-style: none; padding: 0; margin: 0; }
.foot li { margin: 3px 0; }
.foot-grid { display: grid; gap: 22px; }
.foot .fine { color: #aab3c6; display: block; margin-top: 22px; border-top: 1px solid #36415c; padding-top: 14px; }

@media (min-width: 720px) {
  .top { position: sticky; top: 0; z-index: 5; }
  .nav { width: auto; margin: 0; }
  .draft { font-size: .86rem; }
  .hero-in { grid-template-columns: 1.1fr .9fr; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr 1fr; gap: 40px; }
  .hubs { grid-template-columns: repeat(3, 1fr); }
  .path { grid-template-columns: repeat(2, 1fr); }
  .detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: start; }
  .detail .info { order: 0; }
  .preview { position: sticky; top: 84px; }
  .foot-grid { grid-template-columns: 2fr 1fr 1fr; }
}
@media (min-width: 1000px) {
  .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .path { grid-template-columns: repeat(4, 1fr); }
}
@media print {
  .top, .foot, .draft, .dl, .nav { display: none; }
}

/* ---------- on-screen tools (name, trace, typing, quiz, listen) ---------- */
.tool { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.tool label { font-weight: 700; display: block; margin-bottom: 6px; }
.tool input[type=text] { font: inherit; font-size: 1.2rem; width: 100%; max-width: 420px; padding: 10px 12px; border: 2px solid var(--ink);
  border-radius: 10px; background: #fff; color: var(--ink); }
.cands { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.cand { font: inherit; font-size: 1.5rem; font-weight: 700; padding: 6px 16px; border-radius: 10px; border: 2px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; }
.cand.on { border-color: var(--accent); color: var(--accent-2); }
.notice { background: #fff4d6; border: 1px solid #f0d998; color: #5a4300; border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; }
.seg button { font: inherit; font-weight: 700; border: 0; background: transparent; color: var(--ink); padding: 6px 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.row-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
button.btn { cursor: pointer; font: inherit; font-weight: 700; }

.name-sheet { background: #fff; color: #111; border: 1px solid var(--line); box-shadow: var(--shadow); margin: 16px auto; padding: 8mm 9mm;
  max-width: 216mm; font-family: "Noto Sans KR", sans-serif; overflow: hidden; }
.name-sheet .empty { color: var(--muted); }
.ns-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; flex-wrap: wrap; gap: 6px; }
.ns-head .pill { background: #111; color: #fff; border-radius: 999px; padding: 2px 10px; font-weight: 700; font-size: 10px; }
.ns-title { font-size: 22px; margin: 10px 0 2px; }
.ns-big { font-size: 54px; font-weight: 700; margin: 0; line-height: 1.2; }
.ns-en { margin: 0 0 6px; color: #444; }
.ns-parts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; margin: 0 0 8px; }
.ns-label { font-weight: 700; margin: 10px 0 4px; font-size: 13px; }
.name-sheet .row { display: flex; flex-wrap: wrap; gap: 6mm; margin-bottom: 3mm; }
.name-sheet .rep { display: inline-flex; }
.name-sheet .nbox { width: 18mm; height: 18mm; border: 1px solid #333; margin-right: -1px; display: inline-grid; place-items: center;
  font-size: 12.5mm; line-height: 1; font-weight: 400;
  background: linear-gradient(#ccc, #ccc) center / 100% 1px no-repeat, linear-gradient(#ccc, #ccc) center / 1px 100% no-repeat; }
.name-sheet .nbox.trace { color: #a0a0a0; }
.name-sheet .nbox.blank { color: transparent; }
.name-sheet .gap { width: 7mm; display: inline-block; }
.ns-foot { font-size: 9px; color: #555; margin-top: 8px; }
@media print {
  body * { visibility: hidden !important; }
  #name-sheet, #name-sheet * { visibility: visible !important; }
  #name-sheet { position: absolute; left: 0; top: 0; margin: 0; border: 0; box-shadow: none; padding: 0; max-width: none; width: 100%; }
}

.picker { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.picker button { font: inherit; font-size: 1.25rem; min-width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); cursor: pointer; }
.picker button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.picker button.done { border-color: #2f7a3e; }
.trace-wrap { display: grid; gap: 16px; }
.trace-canvas { width: 100%; max-width: 420px; aspect-ratio: 1 / 1; background: #fff; border: 2px solid var(--ink); border-radius: 14px;
  touch-action: none; display: block; }
.status { font-weight: 700; min-height: 1.6em; }
.kbd { display: grid; gap: 6px; margin: 14px 0; max-width: 640px; }
.kbd .krow { display: flex; gap: 5px; justify-content: center; }
.kbd .key { flex: 1 1 0; max-width: 54px; min-width: 26px; height: 48px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  display: grid; place-items: center; font-size: 1.1rem; position: relative; cursor: pointer; user-select: none; }
.kbd .key small { position: absolute; left: 4px; top: 2px; font-size: .62rem; color: var(--muted); }
.kbd .key.next { background: #ffe7a8; border-color: #d39a00; }
.kbd .key.wide { max-width: 260px; flex-grow: 5; }
.target { font-size: clamp(1.6rem, 6vw, 2.4rem); font-weight: 700; letter-spacing: .04em; margin: 8px 0; }
.target .ok { color: #2f7a3e; } .target .bad { color: var(--accent); text-decoration: underline; } .target .cur { background: #ffe7a8; }
.typed { font-size: 1.4rem; min-height: 2em; border-bottom: 2px solid var(--ink); padding: 4px 0; }
.quiz-q { font-size: clamp(1.8rem, 8vw, 3rem); font-weight: 700; margin: 10px 0; }
.quiz-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-width: 560px; }
.quiz-opts button { font: inherit; font-size: 1.1rem; padding: 12px; border-radius: 10px; border: 2px solid var(--line); background: #fff;
  color: var(--ink); cursor: pointer; text-align: center; }
.quiz-opts button.right { border-color: #2f7a3e; background: #e6efe7; } .quiz-opts button.wrong { border-color: var(--accent); background: #fbe7e3; }
.listen { display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 2px 9px; font: inherit; font-size: .85rem; cursor: pointer; color: var(--ink); vertical-align: middle; }
.listen:hover { border-color: var(--ink); }
.synth { font-size: .8rem; color: var(--muted); }
.lock { background: #fde2dd; color: #7a1d10; border-bottom: 1px solid #f2b3a7; font-size: .8rem; padding: 6px 16px; text-align: center; font-weight: 700; }
@media (min-width: 720px) { .trace-wrap { grid-template-columns: minmax(280px, 420px) 1fr; align-items: start; } }
