/* Bicara — 한 화면에 한 문장. 문장이 주인공이고 나머지는 그 둘레에 작게 선다.
   층표(위에서 아래로, 층마다 크기·굵기·색 중 둘 이상이 다르다)
   문장(인니어)   30px / 700 / ink        Plus Jakarta Sans
   세는 값(점수)  40px / 800 / ink        Plus Jakarta Sans, tabular
   화면 제목      18px / 700 / ink
   항목 이름      17px / 600 / ink
   뜻(한국어)     16px / 500 / ink-2
   발음 안내      14px / 400 / muted
   묶음 안내      14px / 400 / ink-2
   항목 메타      13px / 400 / muted
   묶음 머리      12px / 700 / muted, 자간 0.08em
   주석(※)       12px / 400 / muted, 위 간격 띄움 */
:root {
  --bg: #F5F6F1;
  --surface: #FFFFFF;
  --ink: #16201B;
  --ink-2: #3E4A43;
  --muted: #66726B;
  --line: #DDE2DA;
  --accent: #0B7A57;
  --accent-ink: #FFFFFF;
  --accent-soft: #E1F1EA;
  --good: #1D7F47;
  --good-soft: #E2F3E8;
  --near: #8A5A0B;
  --near-soft: #FBEFD6;
  --miss: #B4361F;
  --miss-soft: #FBE4DE;
  --rec: #D0342C;
  --skel: #E7EAE3;
  --skel-hi: #F3F5F0;

  --font-id: "Plus Jakarta Sans", "Pretendard Variable", system-ui, sans-serif;
  --font-ui: "Pretendard Variable", Pretendard, -apple-system, system-ui, sans-serif;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1512; --surface: #18201C; --ink: #EAF0EC; --ink-2: #C3CDC7; --muted: #8E9A93; --line: #2A342F;
    --accent: #3FBF8C; --accent-ink: #08130E; --accent-soft: #163328;
    --good: #5BCB89; --good-soft: #15301F; --near: #E7B252; --near-soft: #352914; --miss: #F28A73; --miss-soft: #3A1E18;
    --rec: #F0574D; --skel: #1F2924; --skel-hi: #29352F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1512; --surface: #18201C; --ink: #EAF0EC; --ink-2: #C3CDC7; --muted: #8E9A93; --line: #2A342F;
  --accent: #3FBF8C; --accent-ink: #08130E; --accent-soft: #163328;
  --good: #5BCB89; --good-soft: #15301F; --near: #E7B252; --near-soft: #352914; --miss: #F28A73; --miss-soft: #3A1E18;
  --rec: #F0574D; --skel: #1F2924; --skel-hi: #29352F;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Pretendard 가 숫자 사이 x 를 × 로 바꾸는 합자를 페이지 전체에서 끈다 */
  font-variant-ligatures: no-contextual no-common-ligatures;
  font-feature-settings: 'calt' 0, 'liga' 0;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── 머리 ── */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--font-id); font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.back { display: grid; place-items: center; width: 36px; height: 36px; margin-left: -8px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.back:hover { background: var(--skel); }
.top-title { font-size: 18px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back:not([hidden]) ~ .top-title:not(:empty) { margin-left: -2px; }
.streak { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.app { max-width: 640px; margin: 0 auto; padding: 20px 16px calc(env(safe-area-inset-bottom, 0px) + 40px); }

/* ── 처음 화면 ── */
.group { display: grid; gap: 12px; }
.group + .group { margin-top: 32px; }
.group-head { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); }
.group-lede { margin: -6px 0 0; font-size: 14px; color: var(--ink-2); }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .cards { grid-template-columns: 1fr; } }
.card {
  display: grid; gap: 4px; align-content: start;
  min-width: 0; padding: 16px; text-align: left; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); }
.card:active { transform: scale(0.99); }
.card-name { font-size: 17px; font-weight: 600; color: var(--ink); }
.card-meta { font-size: 13px; color: var(--muted); }
.card-id { font-family: var(--font-id); font-size: 14px; font-weight: 600; color: var(--ink-2); margin-top: 8px; }
.meter { display: flex; gap: 3px; margin-top: 10px; }
.meter i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.meter i.on { background: var(--accent); }

/* ── 따라 말하기 ── */
.steps { display: flex; gap: 4px; margin-bottom: 20px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.steps i.done { background: var(--accent); }
.steps i.now { background: var(--ink); }
.phrase { display: grid; gap: 6px; padding: 28px 20px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.phrase-id { margin: 0; font-family: var(--font-id); font-size: 30px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; text-wrap: balance; }
.phrase-say { font-size: 14px; color: var(--muted); }
.phrase-ko { font-size: 16px; font-weight: 500; color: var(--ink-2); margin-top: 6px; }
.note { margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
.listen { display: flex; gap: 8px; margin-top: 18px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg); cursor: pointer; font-size: 14px; font-weight: 600;
}
.chip-btn:hover { border-color: var(--ink-2); }
.chip-btn svg { width: 16px; height: 16px; }
.chip-btn.playing { border-color: var(--accent); background: var(--accent-soft); }

.mic-zone { display: grid; justify-items: center; gap: 10px; margin: 28px 0 8px; }
.mic {
  position: relative; display: grid; place-items: center; width: 84px; height: 84px; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; box-shadow: 0 6px 20px -8px var(--accent);
  transition: transform .15s, background .15s;
}
.mic svg { width: 32px; height: 32px; }
.mic:active { transform: scale(0.96); }
.mic.rec { background: var(--rec); box-shadow: 0 6px 20px -8px var(--rec); }
.mic.rec::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--rec);
  animation: ring 1.2s ease-out infinite;
}
.mic.busy { background: var(--skel); color: var(--muted); box-shadow: none; cursor: progress; }
@keyframes ring { from { opacity: .7; transform: scale(.92); } to { opacity: 0; transform: scale(1.18); } }
.mic-label { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 21px; }

.result { display: grid; gap: 14px; margin-top: 18px; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
.score-row { display: flex; align-items: baseline; gap: 10px; }
.score { font-family: var(--font-id); font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.score small { font-size: 16px; font-weight: 700; margin-left: 2px; }
.verdict { font-size: 14px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.verdict.pass { background: var(--good-soft); color: var(--good); }
.verdict.retry { background: var(--near-soft); color: var(--near); }
.words { display: flex; flex-wrap: wrap; gap: 6px; }
.word { font-family: var(--font-id); font-size: 17px; font-weight: 600; padding: 4px 10px; border-radius: 8px; }
.word.ok { background: var(--good-soft); color: var(--good); }
.word.near { background: var(--near-soft); color: var(--near); }
.word.miss { background: var(--miss-soft); color: var(--miss); text-decoration: underline wavy; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.heard { font-size: 14px; color: var(--ink-2); }
.heard b { font-family: var(--font-id); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; vertical-align: 1px; }
.legend .l-ok::before { background: var(--good); }
.legend .l-near::before { background: var(--near); }
.legend .l-miss::before { background: var(--miss); }
.actions { display: flex; gap: 8px; }
.btn {
  flex: 1; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }

/* ── 뼈대(흐르는 스켈레톤) — 투명 글자로 실제 폭을 잡는다 ── */
.skel {
  color: transparent !important; border-radius: 8px;
  background: linear-gradient(90deg, var(--skel) 0%, var(--skel-hi) 50%, var(--skel) 100%) 0 0 / 200% 100%;
  animation: flow 1.3s linear infinite;
}
.skel * { visibility: hidden; }
@keyframes flow { to { background-position: -200% 0; } }

/* ── 상황극 ── */
.goal { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.goal b { font-weight: 600; color: var(--ink-2); }
.goal .done { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--good-soft); color: var(--good); }
/* 아래 여백은 입력 칸의 실제 높이로 app.js 가 채운다(제안 줄이 생기면 높아진다) */
.thread { display: grid; gap: 14px; padding-bottom: var(--dock-h, 180px); }
.msg { display: grid; gap: 6px; max-width: 86%; min-width: 0; }
.msg.ai { justify-self: start; }
.msg.me { justify-self: end; justify-items: end; }
.bubble { padding: 12px 14px; border-radius: 16px; min-width: 0; overflow-wrap: anywhere; }
.ai .bubble { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 6px; }
.me .bubble { background: var(--ink); color: var(--bg); border-top-right-radius: 6px; }
.bubble-id { font-family: var(--font-id); font-size: 18px; font-weight: 600; line-height: 1.4; }
.bubble-ko { font-size: 14px; color: var(--muted); margin-top: 4px; }
.me .bubble-id { font-size: 17px; }
.msg-tools { display: flex; gap: 6px; }
.mini {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 999px; background: transparent; font-size: 13px; color: var(--muted); cursor: pointer;
}
.mini svg { width: 14px; height: 14px; }
.mini.playing { color: var(--ink); border-color: var(--accent); background: var(--accent-soft); }
.fix { max-width: 100%; padding: 10px 12px; border-radius: 12px; background: var(--near-soft); text-align: left; }
.fix-head { font-size: 12px; font-weight: 700; color: var(--near); }
.fix-id { font-family: var(--font-id); font-size: 16px; font-weight: 600; color: var(--ink); }
.fix-note { font-size: 13px; color: var(--ink-2); }
.fix.ok { background: transparent; padding: 0 2px; }
.fix.ok .fix-head { color: var(--good); font-weight: 600; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 14px);
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.dock-in { max-width: 640px; margin: 0 auto; display: grid; gap: 10px; }
.sugs-head { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); }
.sugs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.sugs::-webkit-scrollbar { display: none; }
.sug {
  flex: none; display: grid; gap: 1px; text-align: left; padding: 8px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; max-width: 260px;
}
.sug-id { font-family: var(--font-id); font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug-ko { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-row { display: flex; align-items: center; gap: 10px; }
.dock-row .mic { width: 64px; height: 64px; flex: none; }
.dock-row .mic svg { width: 26px; height: 26px; }
.type-form { flex: 1; display: flex; gap: 8px; min-width: 0; }
.type-form input {
  flex: 1; min-width: 0; height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 15px;
}
@media (max-width: 480px) { .type-form input { font-size: 16px; } }
.type-form button { height: 48px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--ink); color: var(--bg); font-weight: 600; cursor: pointer; }
.dock-hint { font-size: 12px; color: var(--muted); text-align: center; min-height: 18px; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); z-index: 10; transform: translateX(-50%);
  max-width: min(92vw, 440px); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 14px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.4);
}
.empty { padding: 32px 0; text-align: center; color: var(--muted); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .skel, .mic.rec::after { animation: none; }
  .card, .mic { transition: none; }
}

/* ── 게임 층(시안 A·B·C 를 합친 것) ──
   큰 보상 숫자   40px / 800 / ink          (점수 · 획득 XP · 받은 루피아)
   띄움 보상      18px / 800 / good|gold|flame
   게임 수치 칩   14px / 700 / ink, tabular (불꽃 · XP · Rp — 아이콘만 색)
   보상 칩        13px / 700 / ink, gold-soft 바탕
   노드 이름      13px / 600 / ink-2
   장소 머리      12px / 700 / muted, 자간 */
:root { --gold: #C98A00; --gold-soft: #FBF0D2; --flame: #D9480F; --flame-soft: #FDE6DA; --sky: #2563A8; --sky-soft: #E1ECF8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --gold: #F2C14E; --gold-soft: #3A2F12; --flame: #FF8A4C; --flame-soft: #3D2116; --sky: #7FB2EA; --sky-soft: #172739; } }
:root[data-theme="dark"] { --gold: #F2C14E; --gold-soft: #3A2F12; --flame: #FF8A4C; --flame-soft: #3D2116; --sky: #7FB2EA; --sky-soft: #172739; }

.stats { margin-left: auto; display: flex; gap: 6px; flex: none; }
.stat { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 9px; border-radius: 999px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.stat svg { width: 15px; height: 15px; }
.stat.flame svg { color: var(--flame); } .stat.xp svg { color: var(--sky); } .stat.rp svg { color: var(--gold); }
.stat.off { color: var(--muted); } .stat.off svg { color: var(--muted); }

.say-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 56px; border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-ink); font-size: 17px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 60%, #000); transition: transform .08s, box-shadow .08s; }
.say-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 60%, #000); }
.say-btn svg { width: 22px; height: 22px; }
.say-btn.gold { background: var(--gold); color: #1d1600; box-shadow: 0 4px 0 color-mix(in srgb, var(--gold) 55%, #000); }

.float { position: fixed; left: 50%; top: 38%; z-index: 20; transform: translate(-50%, 0); font-family: var(--font-id); font-size: 18px; font-weight: 800; pointer-events: none; animation: rise 1.1s ease-out forwards; white-space: nowrap; padding: 4px 12px; border-radius: 999px; background: var(--surface); box-shadow: 0 6px 20px -8px rgba(0,0,0,.3); }
.float.good { color: var(--good); } .float.gold { color: var(--gold); } .float.flame { color: var(--flame); }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.8); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.18); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* 처음 화면: 내 레벨 · 복습 · 지도 · 도감 */
.me-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.ava { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-family: var(--font-id); font-weight: 800; font-size: 18px; flex: none; }
.ava.me { background: var(--accent); color: var(--accent-ink); }
.lv { flex: 1; min-width: 0; display: grid; gap: 6px; }
.lv-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lv-top b { color: var(--ink); font-size: 15px; }
.prog { flex: 1; height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width .4s; }
.arcade-cta { display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px; border: 0; border-radius: 18px; background: var(--ink); color: var(--bg); text-align: left; cursor: pointer; text-decoration: none; }
.arcade-cta .k { font-size: 12px; font-weight: 700; letter-spacing: .08em; opacity: .7; }
.arcade-cta .t { font-size: 17px; font-weight: 700; }
.arcade-cta .m { font-size: 13px; opacity: .75; }
.arcade-cta .go { margin-left: auto; width: 44px; height: 44px; border-radius: 50%; background: var(--gold); color: #1d1600; display: grid; place-items: center; flex: none; }
.arcade-cta .go svg { width: 20px; height: 20px; }
.arcade-cta.lock { background: var(--surface); color: var(--ink); border: 1px dashed var(--line); cursor: default; }
.arcade-cta.lock .go { background: var(--skel); color: var(--muted); }
.map { display: grid; gap: 22px; padding: 8px 0; }
.city { justify-self: center; font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--ink); /* 묶음 머리(muted)와 같은 회색이면 층이 안 갈린다 */ padding: 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.stop { display: grid; justify-items: center; gap: 4px; width: 132px; text-decoration: none; color: inherit; }
.stop.l { justify-self: start; margin-left: 12%; } .stop.r { justify-self: end; margin-right: 12%; } .stop.c { justify-self: center; }
.node { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--muted); box-shadow: 0 5px 0 var(--line), inset 0 0 0 2px var(--line); transition: transform .12s; }
a.stop:active .node { transform: translateY(3px); }
.node svg { width: 28px; height: 28px; }
.node.done, .node.now { background: var(--accent); color: var(--accent-ink); box-shadow: 0 5px 0 color-mix(in srgb, var(--accent) 55%, #000); }
.node.now { box-shadow: 0 5px 0 color-mix(in srgb, var(--accent) 55%, #000), 0 0 0 6px var(--accent-soft); animation: bob 1.6s ease-in-out infinite; }
.node.quest { border-radius: 22px; }
.node.quest.open { background: var(--sky-soft); color: var(--sky); box-shadow: 0 5px 0 color-mix(in srgb, var(--sky) 45%, transparent), inset 0 0 0 2px var(--sky); }
.node.quest.done { background: var(--sky); color: var(--surface); box-shadow: 0 5px 0 color-mix(in srgb, var(--sky) 55%, #000); }
@keyframes bob { 50% { transform: translateY(-5px); } }
.stop-name { font-size: 13px; font-weight: 600; color: var(--ink-2); text-align: center; }
.stop-stars { display: flex; gap: 2px; color: var(--line); } .stop-stars svg { width: 14px; height: 14px; } .stop-stars .on { color: var(--gold); }
.reward { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 700; color: var(--ink); background: var(--gold-soft); padding: 3px 8px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.reward svg { width: 13px; height: 13px; color: var(--gold); }
.dex-cta { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; }
.dex-cta b { font-size: 17px; font-weight: 600; } .dex-cta span { font-size: 13px; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }

/* 레슨: 진도 · 별 · 콤보 */
.lsn-top { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.combo { font-size: 14px; font-weight: 800; color: var(--flame); font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.stars-big { display: flex; justify-content: center; gap: 8px; }
.stars-big svg { width: 44px; height: 44px; color: var(--line); }
.stars-big svg.on { color: var(--gold); animation: pop .45s ease-out both; }
.stars-big svg.on:nth-child(2) { animation-delay: .12s; } .stars-big svg.on:nth-child(3) { animation-delay: .24s; }
.result.st3, .result.st2 { background: var(--good-soft); border-color: transparent; }
.result.st1, .result.st0 { background: var(--near-soft); border-color: transparent; }
.result .word { background: var(--surface); }
.verdict-line { text-align: center; font-size: 17px; font-weight: 700; }
.verdict-line span { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.end { display: grid; justify-items: center; gap: 16px; text-align: center; padding-top: 20px; }
.end .score { font-size: 40px; }
.tally { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.tally div { padding: 12px 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 2px; }
.tally b { font-family: var(--font-id); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tally span { font-size: 12px; color: var(--muted); }
.end .card { width: 100%; }
.end .actions { width: 100%; }

/* 60초 복습 */
.timer { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; margin-bottom: 14px; }
.timer i { display: block; height: 100%; background: var(--ink); transition: width 1s linear; }
.timer i.low { background: var(--rec); }
.timer.paused i { opacity: .45; }
.hud { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.hud .pts { font-family: var(--font-id); font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.mult { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--flame-soft); color: var(--flame); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.mult svg { width: 15px; height: 15px; }
.mult.hot { animation: pop .35s ease-out; }
.arc-card { padding: 28px 18px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); text-align: center; display: grid; gap: 6px; }
.arc-card .phrase-id { font-size: 28px; }
.arc-card.hit { animation: pop .3s ease-out; border-color: var(--good); }
.arc-card.miss { animation: shake .3s; border-color: var(--miss); }
.queue { display: flex; gap: 6px; justify-content: center; margin: 14px 0 6px; }
.queue i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.queue i.ok { background: var(--good); } .queue i.no { background: var(--miss); }
.hero { padding: 22px 18px; border-radius: 22px; background: var(--ink); color: var(--bg); display: grid; gap: 10px; }
.hero .k { font-size: 12px; font-weight: 700; letter-spacing: .08em; opacity: .7; }
.hero .big { font-family: var(--font-id); font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.hero .meta { font-size: 13px; opacity: .75; }
.rank { display: grid; gap: 6px; }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.rank-row b { font-family: var(--font-id); font-variant-numeric: tabular-nums; margin-left: auto; }

/* 퀘스트: 미션 칸 · 보상 */
.missions { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 57px); z-index: 3; display: grid; gap: 6px; padding: 12px 14px; margin-bottom: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.missions-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.missions-head span:first-child { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--muted); }
.mrow { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.mrow .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: var(--surface); }
.mrow .box svg { width: 12px; height: 12px; }
.mrow.on .box { background: var(--good); border-color: var(--good); animation: pop .35s ease-out; }
.mrow.on .mt { color: var(--muted); text-decoration: line-through; }
.loot-layer { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); }
.loot { width: min(100%, 420px); display: grid; justify-items: center; gap: 14px; text-align: center; padding: 28px 18px 18px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 20px 50px -24px rgba(0,0,0,.4); }
.coin { width: 84px; height: 84px; border-radius: 50%; background: var(--gold); color: #1d1600; display: grid; place-items: center; font-family: var(--font-id); font-weight: 800; font-size: 22px; animation: pop .5s ease-out; box-shadow: inset 0 -6px 0 rgba(0,0,0,.15); }
.loot .big { font-family: var(--font-id); font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.loot .actions { width: 100%; }

/* 도감 */
.dex { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dex-card { aspect-ratio: 3 / 4; border-radius: 14px; padding: 10px; display: grid; align-content: space-between; text-align: left; font-family: var(--font-id); font-size: 13px; font-weight: 700; line-height: 1.3; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; overflow: hidden; }
.dex-card.got { background: var(--sky-soft); border-color: transparent; }
.dex-card.quest.got { background: var(--gold-soft); }
.dex-card.no { color: var(--muted); font-family: var(--font-ui); font-weight: 600; place-items: center; cursor: default; text-align: center; }
.dex-card small { font-family: var(--font-ui); font-weight: 400; font-size: 12px; color: var(--ink-2); }
.dex-card.no small { color: var(--muted); }
.dex-card.new { animation: pop .4s ease-out; border-color: var(--gold); }

@media (prefers-reduced-motion: reduce) { .node.now, .float, .stars-big svg.on, .coin, .dex-card.new, .arc-card.hit, .arc-card.miss, .mult.hot, .mrow.on .box { animation: none; } }
/* 버튼 모양 링크(지도로) — 링크 기본색 파랑 · 밑줄을 버튼 글자색으로 */
a.btn { display: grid; place-items: center; color: var(--ink); text-decoration: none; }
a.btn.primary { color: var(--bg); }

/* ── 선생님 ──
   층: 단어(큰 글자) 36px / 800 / ink · 단어 뜻 18px / 600 / ink-2 · 선생님 말 15px / 500 / ink
       단어 순서 13px / 600 / muted · 선생님 이름표 · 배지 12px / 700 */
.teacher { display: grid; gap: 4px; padding: 12px 14px; border-radius: 16px; border-top-left-radius: 6px; background: var(--accent-soft); }
.teacher-who { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--ink-2); }
.teacher p { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.55; color: var(--ink); }
.teacher b { font-weight: 700; }
.wstep { margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.teacher + .wcard, .teacher + .phrase { margin-top: 12px; }
.wcard { display: grid; justify-items: center; gap: 6px; padding: 28px 20px 20px; margin: 12px 0 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.wcard .w { font-family: var(--font-id); font-size: 36px; font-weight: 800; line-height: 1.2; letter-spacing: -0.01em; }
.wcard .wsay { font-size: 14px; color: var(--muted); }
.wcard .wko { font-size: 18px; font-weight: 600; color: var(--ink-2); margin-top: 4px; }
.wcard .note { justify-self: stretch; }
.wbadge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.wbadge.new { background: var(--gold-soft); color: var(--ink); }
.wbadge.recall { background: var(--sky-soft); color: var(--sky); }
.from { justify-self: stretch; margin: 4px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--sky-soft); font-size: 13px; color: var(--ink); text-align: left; }
.from b { font-family: var(--font-id); }
.gloss { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; padding: 10px 0 2px; border-top: 1px dashed var(--line); }
.gloss .g { display: grid; gap: 0; }
.gloss .g b { font-family: var(--font-id); font-size: 16px; font-weight: 700; color: var(--ink); }
.gloss .g span { font-size: 12px; color: var(--muted); }
.result .teacher { background: var(--surface); }
.welcome { display: grid; gap: 14px; margin-bottom: 24px; padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.how { display: grid; gap: 10px; margin: 0; padding-left: 22px; }
.how li { padding-left: 2px; }
.how li::marker { font-weight: 800; color: var(--ink-2); }
.how b { display: block; font-size: 15px; font-weight: 700; }
.how span { display: block; font-size: 14px; color: var(--ink-2); }
.thread > .teacher { max-width: 92%; }

/* ── 오리 · 까까 (만보오리에서 빌린 캐릭터) ──
   층: 이야기 15px / 500 / ink-2 · 도장 글자 13px / 800 · 가게 이름 16px / 600 / ink · 가게 설명 13px / 400 / muted */
.brand { display: inline-flex; align-items: center; gap: 6px; font-size: 17px; white-space: nowrap; }
.brand img { width: 26px; height: auto; }
.teacher { grid-template-columns: 44px minmax(0, 1fr); align-items: start; column-gap: 10px; }
.teacher .kaka { width: 44px; height: auto; margin-top: 2px; }
.teacher > div { display: grid; gap: 2px; min-width: 0; }
.ava-duck { width: 48px; height: auto; flex: none; }
.node { position: relative; }
.duck-here { position: absolute; right: -40px; bottom: -6px; width: 40px; height: auto; animation: hop 1.6s ease-in-out infinite; pointer-events: none; }
@keyframes hop { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-8px); } }
.duck-react { display: block; width: 76px; height: auto; margin: 0 auto -4px; animation: pop .45s ease-out; }
.pair { display: flex; justify-content: center; align-items: flex-end; gap: 8px; }
.duck-pair { width: 72px; height: auto; } .kaka-pair { width: 66px; height: auto; }
.story { margin: 0; font-size: 15px; font-weight: 500; color: var(--ink-2); line-height: 1.55; text-wrap: balance; }

/* 여권 도장 */
.stamp { display: grid; justify-items: center; align-content: center; gap: 2px; width: 132px; height: 132px; border-radius: 50%; border: 3px double var(--miss); color: var(--miss); transform: rotate(-12deg); text-align: center; padding: 10px; font-variant-numeric: tabular-nums; }
.stamp b { font-family: var(--font-id); font-size: 13px; font-weight: 800; letter-spacing: .04em; line-height: 1.2; }
.stamp span { font-size: 12px; font-weight: 700; }
.stamp .stamp-in { font-size: 11px; letter-spacing: .2em; border: 1.5px solid currentColor; border-radius: 4px; padding: 0 6px; }
.stamp.fresh { animation: stampIn .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes stampIn { 0% { transform: rotate(-12deg) scale(2.2); opacity: 0; } 60% { opacity: 1; } 100% { transform: rotate(-12deg) scale(1); } }
.stamp-wrap { display: grid; place-items: center; height: 150px; }
.passport { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.pp-slot { display: grid; justify-items: center; gap: 8px; padding: 10px 0; }
.pp-slot .stamp { width: 112px; height: 112px; }
.pp-blank { display: grid; place-items: center; width: 112px; height: 112px; border-radius: 50%; border: 2px dashed var(--line); color: var(--muted); font-size: 22px; font-weight: 700; }
.pp-city { font-size: 13px; font-weight: 600; color: var(--ink-2); }

/* 오리 방 · 상자 */
.room { display: grid; gap: 12px; margin-top: 28px; padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.room-head { display: flex; justify-content: space-between; align-items: baseline; }
.room-head span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.shelf { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; padding: 10px 8px 8px; border-radius: 12px; background: var(--bg); border-bottom: 6px solid color-mix(in srgb, var(--gold) 45%, var(--line)); }
.shelf-item { display: grid; place-items: center; aspect-ratio: 1; }
.shelf-item svg { width: 100%; max-width: 44px; height: auto; }
.shelf-item.empty::before { content: ""; width: 60%; aspect-ratio: 1; border-radius: 50%; border: 1.5px dashed var(--line); }
.box-cta { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--gold); background: var(--gold-soft); text-align: left; cursor: pointer; color: var(--ink); }
.box-cta img { width: 64px; height: auto; flex: none; }
.box-cta b { display: block; font-size: 15px; } .box-cta small { font-size: 13px; color: var(--ink-2); }
.box-cta.tap img { animation: shake .3s; }
.box-cta.opened { cursor: default; }
.room-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.room-links .btn { height: 44px; font-size: 14px; }

/* 기념품 가게 */
.shop { display: grid; gap: 8px; margin-top: 16px; }
.shop-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.shop-row.lock { opacity: .6; }
.shop-icon svg { width: 52px; height: 52px; }
.shop-txt { display: grid; min-width: 0; }
.shop-txt b { font-size: 16px; font-weight: 600; }
.shop-txt span { font-size: 13px; color: var(--muted); }
.shop-row .btn, .shop-row .owned { grid-column: 1 / -1; }
.shop-row .btn { height: 44px; font-size: 15px; }
.owned { font-size: 13px; font-weight: 600; color: var(--muted); text-align: center; padding: 6px 0; }
@media (prefers-reduced-motion: reduce) { .duck-here, .duck-react, .stamp.fresh, .box-cta.tap img { animation: none; } }
.room-head .reward { color: var(--ink); } /* .room-head span 의 muted 가 루피아 칩 글자까지 덮었다 */
