/* Layout: one phone-width column, bottom tab bar; each language tints its own screens. */
:root {
  /* FINENYX: black on white, one accent (ink). Green/amber/red only carry meaning (right, close, wrong). */
  --bg: #F5F5F3;
  --surface: #FFFFFF;
  --ink: #111111;
  --muted: #6B6B6B;
  --line: #E3E3DF;
  --acc: #111111;
  --good: #2D7A4D;
  --warn: #9A6410;
  --bad: #B1261C;
  --tongue: #E59A9A;
  --lip: #D9787A;
  --mouth: #3A1E22;
  --air: #3C8FD6;
  --gold: #C9971A;
  --f-brand: 'Outfit', 'IBM Plex Sans KR', system-ui, sans-serif;
  --f-display: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --f-body: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --f-zh: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --f-ja: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'Consolas', monospace;
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E0E0E; --surface: #1A1A1A; --ink: #F2F2F2; --muted: #A3A3A3; --line: #2E2E2E; --acc: #F2F2F2;
    --good: #6CC48F; --warn: #E2AB4E; --bad: #F08A80; color-scheme: dark;
    --tongue: #C97E80; --lip: #B9696B; --mouth: #0C0607; --air: #7DB8EC; --gold: #F0C04A;
  }
}
:root[data-theme="dark"] {
  --bg: #0E0E0E; --surface: #1A1A1A; --ink: #F2F2F2; --muted: #A3A3A3; --line: #2E2E2E; --acc: #F2F2F2;
  --good: #6CC48F; --warn: #E2AB4E; --bad: #F08A80; color-scheme: dark;
  --tongue: #C97E80; --lip: #B9696B; --mouth: #0C0607; --air: #7DB8EC; --gold: #F0C04A;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--f-body);
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

#app {
  max-width: 640px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: env(safe-area-inset-top, 0px) 24px;
  display: flex; flex-direction: column; gap: 16px;
}

/* top bar */
.top { display: flex; align-items: center; gap: 12px; padding-block: 14px 4px; }
.brand { font-family: var(--f-display); font-size: 1.15rem; letter-spacing: .01em; }
.top-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip, .back {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 14px; font-size: .9rem; white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis;
}
.back { color: var(--acc); }

/* bottom tabs */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
#nav button {
  background: none; border: 0; padding: 10px 2px; font-size: .9rem; color: var(--muted);
  border-radius: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#nav button.on { color: var(--ink); font-weight: 600; background: color-mix(in srgb, var(--acc) 12%, transparent); }
#nav button[data-lang].on { color: var(--acc); }

/* type */
h1 { font-family: var(--f-display); font-size: clamp(1.6rem, 6vw, 2.1rem); line-height: 1.25; margin: 0; text-wrap: balance; }
h2 { font-size: 1.05rem; margin: 0; }
h3 { font-size: 1.1rem; margin: 0; text-wrap: balance; }
p { margin: 0; }
.eyebrow, .label { font-size: .75rem; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.label { display: block; margin-bottom: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.intro { color: var(--muted); max-width: 62ch; }
.notice { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: var(--r); padding: 10px 14px; font-size: .9rem; }
.han { font-family: var(--f-zh); }
[data-lang="ja"] .han, .han:lang(ja) { font-family: var(--f-ja); }
.han.big { font-size: clamp(1.7rem, 7vw, 2.3rem); line-height: 1.35; }
.py { font-family: var(--f-mono); color: var(--acc); font-size: .95rem; }
.en-text { font-size: 1.3rem; font-weight: 500; line-height: 1.4; }
.word { font-size: 1.2rem; font-weight: 600; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* blocks */
.hero { display: flex; flex-direction: column; gap: 12px; padding-block: 8px; }
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.meters { display: grid; gap: 10px; }
.meter-head { display: flex; justify-content: space-between; font-size: .9rem; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--acc); border-radius: 99px; transition: width .4s; }
.bar.wide { height: 10px; }
.streak { font-size: .9rem; color: var(--muted); }
.cp-title { font-family: var(--f-display); font-size: 1.15rem; }
.fc { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.fc li { padding-left: 12px; border-left: 3px solid var(--acc); }
.link { background: none; border: 0; padding: 0; color: var(--acc); font-weight: 600; text-align: left; }

.pill { font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.pill.now { color: var(--acc); }
.pill.done { color: var(--good); }
.pill.missed { color: var(--bad); }
.pill.next { color: var(--muted); }

/* tasks / drill list */
.tasks { display: grid; gap: 10px; }
.task {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px;
}
.task:hover { border-color: var(--acc); }
.task .tag { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--acc) 14%, transparent); color: var(--acc); font-weight: 700; }
.task-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task-text small { color: var(--muted); font-size: .85rem; line-height: 1.4; }
.task .last { font-family: var(--f-mono); color: var(--acc); font-size: .9rem; }

/* plan */
.quarter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 12px; }
.quarter.now { border-color: var(--ink); }
.quarter.missed { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.q-num { font-family: var(--f-mono); font-size: .85rem; color: var(--muted); }
.crit ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.crit li, .crit label { display: flex; gap: 10px; align-items: flex-start; }
.crit .label { color: var(--acc); }
.crit input { width: 1.15rem; height: 1.15rem; margin-top: .2rem; accent-color: var(--acc); flex: none; }
.autobox { flex: none; width: 1.15rem; height: 1.15rem; margin-top: .2rem; border: 1.5px dashed var(--acc); border-radius: 4px; display: grid; place-items: center; font-size: .75rem; color: var(--acc); }
.crit li.met .autobox { background: var(--acc); color: var(--surface); border-style: solid; }
.crit em { font-style: normal; color: var(--muted); font-size: .85rem; }
.know { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.know .label { width: 100%; }
.kchip { font-size: .8rem; padding: 2px 10px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); }

/* quiz */
.quiz { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.q-progress { color: var(--muted); font-size: .9rem; }
.q-prompt { font-weight: 600; }
.play.big { font-size: 1.1rem; padding: 18px; border-radius: var(--r); background: var(--acc); color: var(--surface); border: 0; font-weight: 600; }
.choices { display: grid; gap: 10px; }
.choices.four { grid-template-columns: repeat(2, 1fr); }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.choice.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--surface)); }
.choice.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.choice:disabled { cursor: default; }
.tone-ico { width: 44px; height: 36px; fill: none; stroke: var(--acc); stroke-width: 3; stroke-linecap: round; }
.reveal { display: flex; flex-direction: column; gap: 10px; border-radius: var(--r); padding: 14px; background: var(--surface); border: 1px solid var(--line); }
.verdict { font-weight: 700; }
.reveal.good .verdict { color: var(--good); }
.reveal.bad .verdict { color: var(--bad); }
.quiz.done { text-align: center; align-items: center; padding-block: 24px; }
.score { font-size: 3.2rem; font-weight: 500; color: var(--acc); line-height: 1.1; }

/* say buttons */
.set { display: flex; flex-wrap: wrap; gap: 8px; }
.say { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); min-width: 3.4rem; }
.say .han { font-size: 1.5rem; line-height: 1.2; }
.say.hit { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
.say.line { align-items: flex-start; text-align: left; width: 100%; }
.say.line .han { font-size: 1.25rem; }

/* buttons */
.primary { background: var(--ink); color: var(--bg); border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 600; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.ghost:disabled { opacity: .4; cursor: default; }
.ghost.danger { color: var(--bad); }
.ghost.danger.armed { background: var(--bad); color: var(--surface); border-color: var(--bad); }

/* shadowing */
.shadow { display: flex; flex-direction: column; gap: 12px; }
.sent { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.sent.veiled > * { filter: blur(7px); user-select: none; }
.meaning { color: var(--muted); }
.casual .label, .sounds .label { display: inline; margin-right: 8px; }
.sounds { font-size: .95rem; }
.tip { font-size: .88rem; border-top: 1px dashed var(--line); padding-top: 8px; }
.ctrl { display: flex; flex-wrap: wrap; gap: 8px; }
.ctrl .say { flex-direction: row; padding: 10px 16px; background: var(--surface); font-weight: 600; }
.rec { border: 0; border-radius: 12px; padding: 10px 18px; font-weight: 700; background: var(--acc); color: var(--surface); }
.rec.on { background: var(--bad); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .7; } }
.pitch { width: 100%; height: 150px; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.result { display: flex; flex-direction: column; gap: 10px; }
.scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.scorebox { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; }
.scorebox .big { font-size: 1.8rem; }
.scorebox.good .big { color: var(--good); }
.scorebox.warn .big { color: var(--warn); }
.scorebox.bad .big { color: var(--bad); }
.heard .label { display: inline; margin-right: 8px; }
.steps { font-size: .9rem; color: var(--muted); }
.tagrow, .who { display: flex; flex-wrap: wrap; gap: 8px; }
.tagbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 14px; font-size: .9rem; }
.tagbtn.on { background: var(--acc); color: var(--surface); border-color: var(--acc); }
.who .tagbtn.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid20 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cell { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 2px; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.cell .han { font-size: 1.15rem; }
.cell .combo { font-size: .7rem; color: var(--muted); }
.cell.on { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }

/* mouth */
.mirror { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.mirror video { width: 100%; max-width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); transform: scaleX(-1); display: none; }
.mirror video.live { display: block; }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.mcard h3 { color: var(--acc); font-size: 1.4rem; }

/* topics */
.topic { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.tl { display: flex; flex-direction: column; gap: 8px; padding-left: 12px; border-left: 3px solid var(--acc); }
.tl > .label { color: var(--acc); }
.facts p { font-size: .92rem; }
.facts p + p { margin-top: 6px; }

/* forms + sheet */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field span { font-size: .85rem; color: var(--muted); }
.field input { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.field-row .field span { color: var(--acc); font-weight: 600; }
.sheet-wrap { position: fixed; inset: 0; z-index: 20; background: color-mix(in srgb, var(--ink) 40%, transparent); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--surface); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  border-radius: 18px 18px 0 0; display: flex; flex-direction: column; gap: 12px;
  padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.voices { display: flex; flex-direction: column; gap: 2px; }
.sheet-actions { display: flex; justify-content: space-between; gap: 10px; padding-top: 6px; }

.center { text-align: center; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--ink); }
.roles { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.roles legend { margin-bottom: 6px; }
.roles .tagbtn { cursor: pointer; position: relative; }
.roles .tagbtn.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.roles input { position: absolute; opacity: 0; pointer-events: none; }
.roles .tagbtn:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* sign-in */
.who-screen { display: flex; flex-direction: column; gap: 14px; padding-block: 28px; }
.who-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.who-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.who-card small { color: var(--muted); font-size: .8rem; line-height: 1.35; }
.who-card.add { border-style: dashed; }
.face { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--acc) 16%, var(--surface)); color: var(--acc); font-weight: 700; font-family: var(--f-zh); }
.face.big { width: 3.2rem; height: 3.2rem; font-size: 1.4rem; background: color-mix(in srgb, var(--ink) 8%, var(--surface)); color: var(--ink); font-family: var(--f-display); }

/* level / streak / quests */
.game-hero { gap: 14px; }
.lv { display: flex; gap: 14px; align-items: center; }
.lv-badge { flex: none; width: 4.2rem; height: 4.2rem; border-radius: 18px; background: var(--ink); color: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.lv-badge small { font-size: .7rem; letter-spacing: .06em; opacity: .8; }
.lv-badge b { font-size: 1.6rem; }
.lv-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lv-text .bar span { background: var(--gold); }
.streak-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flame { width: 22px; height: 22px; fill: #E2572B; }
.quest { display: flex; flex-direction: column; gap: 6px; }
.quest .bar span { background: var(--gold); }
.quest.done { color: var(--muted); }
.quest.done .bar span { background: var(--good); }
.task .go { color: var(--acc); font-size: 1.1rem; }
.task.weak .tag { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.kchip.badge { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--surface)); }

/* journey map */
.map { display: flex; flex-direction: column; gap: 18px; }
.region-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.path { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.node-row { display: flex; align-items: center; gap: 12px; padding-left: var(--off); }
.node { flex: none; width: 3.6rem; height: 3.6rem; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--acc) 85%, var(--surface)); color: var(--surface); font-weight: 700; font-size: 1.1rem; box-shadow: 0 5px 0 color-mix(in srgb, var(--acc) 60%, var(--ink)); display: grid; place-items: center; }
.node:disabled { background: var(--line); color: var(--muted); box-shadow: 0 5px 0 color-mix(in srgb, var(--line) 70%, var(--ink)); cursor: default; }
.node.cleared { background: var(--gold); box-shadow: 0 5px 0 color-mix(in srgb, var(--gold) 65%, var(--ink)); color: var(--ink); }
.node.boss { width: 4.4rem; height: 4.4rem; border-radius: 22px; }
.node.boss svg { width: 1.9rem; height: 1.9rem; fill: currentColor; }
.node.current { outline: 4px solid color-mix(in srgb, var(--acc) 30%, transparent); outline-offset: 4px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.node:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in srgb, var(--acc) 60%, var(--ink)); }
.node-label { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.node-label b { font-size: .95rem; }
.mini-stars { color: var(--gold); letter-spacing: .1em; }
.node-go { color: var(--acc); font-weight: 600; }
.region.soon { border-top: 1px dashed var(--line); padding-top: 12px; }
.soon-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; color: var(--muted); font-size: .9rem; }

/* stage */
.stage-top .grow { flex: 1; }
.xp-chip { font-size: .85rem; color: var(--gold); font-weight: 600; white-space: nowrap; }
.back.armed { background: var(--bad); border-color: var(--bad); color: var(--surface); }
.stage-name { font-size: .85rem; color: var(--muted); margin-top: -8px; }
.card { display: flex; flex-direction: column; gap: 14px; }
.retry-tag { align-self: flex-start; font-size: .75rem; font-weight: 600; color: var(--bad); border: 1px solid currentColor; border-radius: 99px; padding: 2px 10px; }
.fb-good { text-align: center; font-size: 1.2rem; color: var(--good); }
.fb-good .han { font-size: 1.8rem; }
.speed-prompt { font-family: var(--f-display); font-size: 1.5rem; line-height: 1.35; }
.timer { height: 6px; }
.timer span { background: var(--bad); transition: none; }
.into { font-size: 1.05rem; }
.into .label { display: inline; margin-right: 8px; }
.into b { color: var(--acc); }
.into-end { font-weight: 700; color: var(--acc); }
.friend { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; text-align: left; }
.friend.sm { padding: 8px 12px; }
.friend .han { font-size: 1.15rem; }

/* finish */
.finish { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding-block: 28px; }
.stars { display: flex; gap: 10px; }
.star svg { width: 3.4rem; height: 3.4rem; fill: var(--line); }
.star.on svg { fill: var(--gold); }
.star.on { animation: pop .5s both; }
@keyframes pop { 0% { transform: scale(0.3); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
.xp-gain { font-size: 1.3rem; font-weight: 600; color: var(--gold); }
.badge-new { font-weight: 600; color: var(--gold); }
.finish .row-actions { justify-content: center; }

/* mouth animation */
.mouth { display: flex; flex-direction: column; gap: 8px; }
.mouth-views { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; align-items: center; }
.mouth-views svg { width: 100%; height: auto; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.m-face, .m-palate, .m-wall { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.m-nasal { fill: color-mix(in srgb, var(--air) 7%, transparent); stroke: var(--line); stroke-width: 1; }
.m-velum { fill: none; stroke: var(--muted); stroke-width: 6; stroke-linecap: round; }
.m-tongue { fill: var(--tongue); stroke: color-mix(in srgb, var(--tongue) 65%, var(--ink)); stroke-width: 1; }
.m-tooth, .f-teeth { fill: var(--surface); stroke: var(--muted); stroke-width: 1; }
.m-lip, .f-lip { fill: var(--lip); }
.f-in { fill: var(--mouth); }
.m-air { fill: var(--air); }
.m-voice path { fill: none; stroke: var(--acc); stroke-width: 1.6; }
.m-beat { font: 600 20px var(--f-mono); fill: var(--acc); }
.mouth-focus { font-size: .95rem; }
.mouth-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mouth-legend { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.mouth-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-left: 6px; }
.lg-t { background: var(--tongue); }
.lg-a { background: var(--air); }
.lg-v { background: var(--acc); border-radius: 2px !important; height: 3px !important; }
.anim-slot { margin-block: 4px; }
.topic.other { opacity: .75; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px)); max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .9rem;
}

/* cloud scoring: words coloured by sound accuracy */
.cloudbox { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.cloudbox .field-row { align-items: end; }
.awords { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; font-size: 1.25rem; line-height: 1.3; }
.aw { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; padding: 6px 10px; min-height: 44px; font: inherit; cursor: pointer; }
.aw.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.aw.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.aw.bad { color: var(--bad); border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); font-weight: 600; }
.aw.omit { color: var(--muted); text-decoration: line-through; border-style: dashed; }
.aw.ins { color: var(--muted); font-style: italic; border-style: dotted; }
.aw.sel { outline: 2px solid var(--ink); outline-offset: 2px; }
.awdetail:empty { display: none; }
.awdetail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin-top: 10px; display: grid; gap: 10px; }
.aph { display: flex; flex-wrap: wrap; gap: 6px; }
.ph { display: inline-flex; flex-direction: column; align-items: center; min-width: 44px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); }
.ph b { font-size: 1.15rem; font-weight: 600; }
.ph small { font-size: .75rem; }
.ph.good { color: var(--good); } .ph.warn { color: var(--warn); } .ph.bad { color: var(--bad); border-color: var(--bad); }
.scores.tight { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 6px; }
.scores.tight .scorebox { padding: 8px 10px; }
.scores.tight .big { font-size: 1.35rem; }
.cloudbox .field-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.cloudbox .field-row .field { min-width: 0; }
.cloudbox .field-row input { width: 100%; }
.notice .linkbtn { margin-left: 6px; }

/* ---------- 0.4: short screens with tabs ---------- */
.seg { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: color-mix(in srgb, var(--line) 55%, transparent); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .92rem; padding: 8px 12px; min-height: 40px; border-radius: 9px; white-space: nowrap; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px color-mix(in srgb, var(--ink) 15%, transparent); }
.mini-hero { display: flex; align-items: center; gap: 12px; padding-block: 4px; }
.mini-hero .lv-text b { font-size: .98rem; }
.lv-badge.sm { width: 3.2rem; height: 3.2rem; border-radius: 14px; }
.lv-badge.sm b { font-size: 1.25rem; }
.streak-pill { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
.streak-pill .flame { width: 1rem; height: 1rem; }
.block.tight { padding: 12px 14px; gap: 8px; }
.block.tight .task { padding-block: 10px; }
.ppanel { display: flex; flex-direction: column; gap: 10px; }
.ppanel[hidden] { display: none; }
.sheet-actions { justify-content: flex-end; }
.sheet .ppanel .ghost.danger { align-self: flex-start; }
.ascore { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.atotal { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 4rem; height: 4rem; border-radius: 50%; border: 3px solid currentColor; }
.atotal b { font-size: 1.45rem; line-height: 1; }
.atotal small { font-size: .7rem; color: var(--muted); }
.atotal.good { color: var(--good); } .atotal.warn { color: var(--warn); } .atotal.bad { color: var(--bad); }
.minis { display: flex; flex-wrap: wrap; gap: 6px; }
.mini { font-size: .82rem; padding: 4px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.mini b { color: var(--ink); }
.mini.good b { color: var(--good); } .mini.warn b { color: var(--warn); } .mini.bad b { color: var(--bad); }
.quarter .seg, .topic .seg { margin: 4px 0; }
.mini-hero .lv-text .num { font-size: .72rem; white-space: nowrap; }

.path { gap: 6px; }
.node { width: 2.9rem; height: 2.9rem; font-size: 1rem; box-shadow: 0 4px 0 color-mix(in srgb, var(--acc) 60%, var(--ink)); }
.node.boss { width: 3.4rem; height: 3.4rem; border-radius: 18px; }
.node:disabled + .node-label b { color: var(--muted); font-weight: 500; }
.region-head { margin-bottom: 4px; }
.missed { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; }
.missed-item { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; background: var(--surface); }
.missed-item .muted.small { display: none; }
.filebtn { display: inline-flex; align-items: center; cursor: pointer; }
.sheet-actions { align-items: center; justify-content: space-between; }

/* FINENYX brand mark in the header */
.brand { font-family: var(--f-brand); font-weight: 400; font-size: 1.45rem; letter-spacing: -.005em; white-space: nowrap; line-height: 1; }
.brand b { font-weight: 700; }
.brand .bf { display: inline-block; height: .72em; aspect-ratio: 1.1257; margin-right: -.03em; background: currentColor; -webkit-mask: url(mark.svg) left bottom / contain no-repeat; mask: url(mark.svg) left bottom / contain no-repeat; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* language switch in the header: one language on screen at a time */
.lsw { margin-left: auto; display: flex; gap: 2px; padding: 3px; border-radius: 99px; background: color-mix(in srgb, var(--line) 60%, transparent); }
.lsw button { border: 0; background: transparent; color: var(--muted); min-width: 40px; height: 34px; padding: 0 8px; border-radius: 99px; font-weight: 600; font-size: .9rem; }
.lsw button.on { background: var(--ink); color: var(--bg); }
.top .lsw + .chip { margin-left: 8px; }
.notice.good { border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 10%, var(--surface)); }

/* no double-tap zoom on iPhone (taps on Listen twice used to zoom the page) */
html, body, button, a, input, label { touch-action: manipulation; }
