/* =========================================================
   Merhaba · 한국인을 위한 튀르키예어
   모바일 우선 디자인 시스템
   ========================================================= */

:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-2: #eef2f4;
  --surface-3: #e2e9ec;
  --border: #dde5e9;
  --text: #0f1c24;
  --text-2: #475864;
  --muted: #7f909b;
  --brand: #0e9f9a;
  --brand-strong: #0a7f7b;
  --brand-soft: #e0f4f2;
  --brand-ink: #06625f;
  --on-brand: #ffffff;
  --accent: #e5484d;
  --accent-soft: #fde9e9;
  --gold: #e99a10;
  --gold-soft: #fff2d6;
  --ok: #15a34a;
  --ok-soft: #e4f6ea;
  --ok-ink: #0d6a30;
  --bad: #e5484d;
  --bad-soft: #fde8e8;
  --bad-ink: #a32428;
  --violet: #7356f0;
  --blue: #2b72e8;
  --orange: #e2700c;
  --pink: #d63f7f;
  --shadow-1: 0 1px 2px rgb(15 28 36 / .06);
  --shadow-2: 0 1px 2px rgb(15 28 36 / .05), 0 8px 24px rgb(15 28 36 / .07);
  --shadow-3: 0 10px 40px rgb(15 28 36 / .18);
  --heat-1: #62c2ba; --heat-2: #2fa69e; --heat-3: #16847d; --heat-4: #0b5c57;
  --r-lg: 22px;
  --r: 16px;
  --r-sm: 12px;
  --r-xs: 8px;
  --topbar-h: 56px;
  --tabbar-h: 62px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: Inter, "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1419;
    --surface: #131e25;
    --surface-2: #1a272f;
    --surface-3: #22333c;
    --border: #263740;
    --text: #e7eff2;
    --text-2: #b2c1c9;
    --muted: #7d909a;
    --brand: #2dc3bc;
    --brand-strong: #5fd8d1;
    --brand-soft: #113431;
    --brand-ink: #93e7e1;
    --on-brand: #04201e;
    --accent: #ff6b70;
    --accent-soft: #3a1b1d;
    --gold: #f6b83b;
    --gold-soft: #3a2c10;
    --ok: #3fcf77;
    --ok-soft: #12301f;
    --ok-ink: #93e7b3;
    --bad: #ff6b70;
    --bad-soft: #3a1b1d;
    --bad-ink: #ffb4b6;
    --violet: #a48fff;
    --blue: #6ea6ff;
    --orange: #ff9f50;
    --pink: #ff7fb2;
    --shadow-1: 0 1px 2px rgb(0 0 0 / .3);
    --shadow-2: 0 1px 2px rgb(0 0 0 / .25), 0 8px 24px rgb(0 0 0 / .3);
    --shadow-3: 0 10px 40px rgb(0 0 0 / .5);
    --heat-1: #236a66; --heat-2: #2c8f89; --heat-3: #3cb7af; --heat-4: #86e5de;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0c1419;
  --surface: #131e25;
  --surface-2: #1a272f;
  --surface-3: #22333c;
  --border: #263740;
  --text: #e7eff2;
  --text-2: #b2c1c9;
  --muted: #7d909a;
  --brand: #2dc3bc;
  --brand-strong: #5fd8d1;
  --brand-soft: #113431;
  --brand-ink: #93e7e1;
  --on-brand: #04201e;
  --accent: #ff6b70;
  --accent-soft: #3a1b1d;
  --gold: #f6b83b;
  --gold-soft: #3a2c10;
  --ok: #3fcf77;
  --ok-soft: #12301f;
  --ok-ink: #93e7b3;
  --bad: #ff6b70;
  --bad-soft: #3a1b1d;
  --bad-ink: #ffb4b6;
  --violet: #a48fff;
  --blue: #6ea6ff;
  --orange: #ff9f50;
  --pink: #ff7fb2;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .3);
  --shadow-2: 0 1px 2px rgb(0 0 0 / .25), 0 8px 24px rgb(0 0 0 / .3);
  --shadow-3: 0 10px 40px rgb(0 0 0 / .5);
  --heat-1: #236a66; --heat-2: #2c8f89; --heat-3: #3cb7af; --heat-4: #86e5de;
  color-scheme: dark;
}

/* ---------- 기본 ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.3; letter-spacing: -.02em; }
h2 { font-size: 20px; line-height: 1.35; letter-spacing: -.015em; }
h3 { font-size: 17px; line-height: 1.4; letter-spacing: -.01em; }
a { color: var(--brand-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
img, svg { display: block; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 10px; }
::selection { background: color-mix(in srgb, var(--brand) 30%, transparent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 부팅 화면 */
.boot { min-height: 100dvh; display: grid; place-content: center; text-align: center; gap: 6px; }
.boot-logo { font-size: 34px; font-weight: 800; color: var(--brand); letter-spacing: -.03em; }
.boot-sub { color: var(--muted); font-size: 14px; }

/* ---------- 레이아웃 ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--topbar-h) + var(--safe-t));
  padding: var(--safe-t) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  backdrop-filter: saturate(1.5) blur(14px);
}
.topbar-title { flex: 1; min-width: 0; font-size: 19px; font-weight: 750; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title .logo { color: var(--brand); }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

.view {
  flex: 1; width: 100%; max-width: 760px; margin: 0 auto;
  padding: 8px max(16px, env(safe-area-inset-right)) calc(var(--tabbar-h) + var(--safe-b) + 28px) max(16px, env(safe-area-inset-left));
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding: 0 max(4px, env(safe-area-inset-right)) var(--safe-b) max(4px, env(safe-area-inset-left));
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  backdrop-filter: saturate(1.5) blur(16px);
  border-top: 1px solid var(--border);
}
.tab {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--muted);
  font-size: 11px; font-weight: 600; text-decoration: none;
  transition: color .2s;
}
.tab .ico { transition: transform .25s var(--ease); }
.tab.active { color: var(--brand); }
.tab.active .ico { transform: translateY(-1px) scale(1.06); }
.tab .tab-badge {
  position: absolute; top: 7px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center;
}

body.immersive .topbar, body.immersive .tabbar { display: none; }
body.immersive .view { max-width: none; padding: 0; }

@media (min-width: 1000px) {
  .app { padding-left: 232px; }
  .tabbar {
    top: 0; bottom: 0; right: auto; width: 232px; height: auto;
    padding: 24px 14px; display: flex; flex-direction: column; gap: 4px;
    border-top: 0; border-right: 1px solid var(--border);
  }
  .tabbar::before { content: "Merhaba"; display: block; padding: 4px 14px 22px; font-size: 26px; font-weight: 800; letter-spacing: -.03em; color: var(--brand); }
  .tab { flex-direction: row; justify-content: flex-start; gap: 12px; height: 48px; padding: 0 14px; border-radius: 12px; font-size: 15px; }
  .tab:hover { background: var(--surface-2); }
  .tab.active { background: var(--brand-soft); }
  .tab .tab-badge { position: static; margin-left: auto; }
  .view { padding-bottom: 48px; }
  body.immersive .app { padding-left: 0; }
}

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border-radius: 14px; border: 1px solid transparent;
  font-weight: 700; font-size: 16px; letter-spacing: -.01em;
  background: var(--surface-2); color: var(--text);
  transition: transform .12s var(--ease), background .2s, box-shadow .2s, opacity .2s;
  text-decoration: none;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 3px 0 var(--brand-strong); }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--brand-strong); transform: translateY(2px); }
.btn-ok { background: var(--ok); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--ok) 70%, #000); }
.btn-bad { background: var(--bad); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--bad) 70%, #000); }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-outline { background: var(--surface); border-color: var(--border); }
.btn-danger { background: var(--bad-soft); color: var(--bad-ink); }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 54px; font-size: 17px; border-radius: 16px; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 11px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; border-radius: 12px; border: 0;
  background: transparent; color: var(--text-2);
  transition: background .2s, transform .12s;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.filled { background: var(--surface-2); }

.speak-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--brand-soft); color: var(--brand-ink);
  transition: transform .12s, background .2s;
}
.speak-btn.sm { width: 34px; height: 34px; }
.speak-btn.xl { width: 84px; height: 84px; border-radius: 28px; background: var(--brand); color: var(--on-brand); box-shadow: 0 4px 0 var(--brand-strong); }
.speak-btn.slow { background: var(--surface-2); color: var(--text-2); }
.speak-btn.xl.slow { width: 60px; height: 60px; border-radius: 20px; box-shadow: none; }
.speak-btn:active { transform: scale(.93); }
.speak-btn.playing { animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 40%, transparent); } 50% { box-shadow: 0 0 0 10px transparent; } }

/* ---------- 카드·리스트 ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 18px; }
.card + .card, .section + .section { margin-top: 14px; }
.card.flat { box-shadow: none; border: 1px solid var(--border); }
.card.tap { transition: transform .15s var(--ease); cursor: pointer; }
.card.tap:active { transform: scale(.985); }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.section-title { font-size: 17px; font-weight: 750; letter-spacing: -.015em; }
.section-link { font-size: 14px; color: var(--brand-strong); font-weight: 600; background: none; border: 0; padding: 4px; }

.list { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 64px; padding: 12px 16px;
  border: 0; background: none; text-align: left; text-decoration: none; color: inherit;
}
.list-item + .list-item { border-top: 1px solid var(--border); }
button.list-item:active, a.list-item:active { background: var(--surface-2); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 650; letter-spacing: -.01em; }
.list-item .li-sub { font-size: 13.5px; color: var(--muted); margin-top: 1px; }
.list-item .li-icon { width: 42px; height: 42px; flex: none; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); font-size: 20px; }
.chev { color: var(--muted); flex: none; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ---------- 칩·배지 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 17px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 14px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
.chip.active { background: var(--text); border-color: var(--text); color: var(--bg); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chips-scroll > * { scroll-snap-align: start; flex: none; }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-1); font-weight: 750; font-size: 14px; border: 0; }
.pill.streak { color: var(--orange); }
.pill.streak.off { color: var(--muted); }
.pill.xp { color: var(--gold); }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge.gold { background: var(--gold-soft); color: var(--gold); }
.badge.ok { background: var(--ok-soft); color: var(--ok-ink); }
.badge.bad { background: var(--bad-soft); color: var(--bad-ink); }
.badge.violet { background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet); }

/* ---------- 진행률 ---------- */
.bar { height: 10px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .45s var(--ease); }
.bar.gold > i { background: var(--gold); }
.bar.thin { height: 6px; }

.ring { position: relative; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-bg { stroke: var(--surface-3); }
.ring .ring-fg { stroke: var(--brand); transition: stroke-dashoffset .6s var(--ease); }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }

/* ---------- 홈 ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg); padding: 20px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: var(--on-brand); box-shadow: var(--shadow-2);
}
:root[data-theme="dark"] .hero { background: linear-gradient(135deg, #12807b 0%, #0b5653 100%); color: #f0fffd; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background: linear-gradient(135deg, #12807b 0%, #0b5653 100%); color: #f0fffd; } }
.hero::after {
  content: ""; position: absolute; right: -46px; top: -46px; width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle at 35% 50%, transparent 47px, rgb(255 255 255 / .14) 48px, rgb(255 255 255 / .14) 60px, transparent 61px);
  pointer-events: none;
}
.hero-greet { display: flex; align-items: center; gap: 10px; }
.hero-greet .tr { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.hero-greet .speak-btn { background: rgb(255 255 255 / .2); color: inherit; }
.hero-sub { opacity: .88; font-size: 14.5px; margin-top: 2px; }
.hero-stats { display: flex; align-items: center; gap: 16px; margin-top: 18px; }
.hero-stats .ring .ring-bg { stroke: rgb(255 255 255 / .25); }
.hero-stats .ring .ring-fg { stroke: #fff; }
.hero-stat-text { font-size: 14px; opacity: .92; }
.hero-stat-text b { font-size: 18px; }

.plan-item { display: flex; align-items: center; gap: 14px; }
.plan-check { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--surface-3); flex: none; display: grid; place-items: center; color: #fff; }
.plan-check.done { background: var(--ok); border-color: var(--ok); }

.phrase-card .tr { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.phrase-card .ko { color: var(--text-2); margin-top: 2px; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 14px; border-radius: var(--r); border: 0; text-align: left;
  background: var(--surface); box-shadow: var(--shadow-2); color: inherit; text-decoration: none;
  transition: transform .15s var(--ease);
}
.quick:active { transform: scale(.97); }
.quick .q-ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; }
.quick .q-title { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.quick .q-sub { font-size: 12.5px; color: var(--muted); margin-top: -6px; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 120px; }
.week-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.week-bar { width: 100%; max-width: 30px; border-radius: 7px 7px 4px 4px; background: var(--surface-3); min-height: 4px; transition: height .5s var(--ease); }
.week-bar.hit { background: var(--brand); }
.week-bar.today { outline: 2px solid var(--brand); outline-offset: 2px; }
.week-label { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ---------- 학습 경로 ---------- */
.unit { margin-top: 18px; }
.unit-head {
  position: relative; overflow: hidden;
  padding: 16px 18px; border-radius: var(--r-lg);
  color: #fff; background: var(--unit-color, var(--brand));
  box-shadow: var(--shadow-2);
}
.unit-head .u-kicker { font-size: 12.5px; font-weight: 800; letter-spacing: .06em; opacity: .85; }
.unit-head .u-title { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; }
.unit-head .u-tr { font-size: 14px; opacity: .9; font-weight: 600; }
.unit-head .u-desc { font-size: 13.5px; opacity: .9; margin-top: 6px; }
.unit-head .u-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; font-weight: 700; }
.unit-head .bar { flex: 1; background: rgb(255 255 255 / .28); height: 8px; }
.unit-head .bar > i { background: #fff; }
.unit-head .u-notes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.unit-head .u-note { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 11px; border-radius: 15px; border: 0; background: rgb(255 255 255 / .2); color: #fff; font-size: 13px; font-weight: 650; text-decoration: none; }

.lesson-list { margin-top: 10px; }
.lesson-item {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 12px 14px; margin-top: 8px;
  border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface); text-align: left; color: inherit; text-decoration: none;
  transition: transform .15s var(--ease), border-color .2s;
}
.lesson-item:active { transform: scale(.985); }
.lesson-item.next { border-color: var(--unit-color, var(--brand)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--unit-color, var(--brand)) 18%, transparent); }
.lesson-dot {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2); font-weight: 800; font-size: 16px;
}
.lesson-item.done .lesson-dot { background: var(--unit-color, var(--brand)); color: #fff; }
.lesson-item.next .lesson-dot { background: color-mix(in srgb, var(--unit-color, var(--brand)) 16%, var(--surface)); color: var(--unit-color, var(--brand)); }
.lesson-item .l-title { font-weight: 700; letter-spacing: -.01em; }
.lesson-item .l-sub { font-size: 13.5px; color: var(--muted); }
.stars { display: inline-flex; gap: 1px; color: var(--surface-3); }
.stars .on { color: var(--gold); }

/* ---------- 몰입 스테이지(레슨·복습·드릴) ---------- */
.stage { display: flex; flex-direction: column; min-height: 100dvh; background: var(--bg); }
.stage-head {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: var(--bg);
}
.stage-head .bar { flex: 1; height: 14px; border-radius: 8px; }
.stage-head .bar > i { background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #9df3ee)); }
.stage-head .stage-count { font-size: 13px; color: var(--muted); font-weight: 700; min-width: 40px; text-align: right; }
.stage-body {
  flex: 1; width: 100%; max-width: 640px; margin: 0 auto;
  padding: 12px 18px calc(150px + var(--safe-b));
  display: flex; flex-direction: column;
}
.stage-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 14px 18px calc(14px + var(--safe-b));
  background: var(--bg);
  border-top: 1px solid var(--border);
  transition: background .25s, border-color .25s;
}
.stage-foot-inner { max-width: 640px; margin: 0 auto; }
.stage-foot.ok { background: var(--ok-soft); border-color: transparent; }
.stage-foot.bad { background: var(--bad-soft); border-color: transparent; }
.fb { display: none; margin-bottom: 12px; animation: slideUp .3s var(--ease); }
.stage-foot.ok .fb, .stage-foot.bad .fb { display: block; }
.fb-title { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.stage-foot.ok .fb-title { color: var(--ok-ink); }
.stage-foot.bad .fb-title { color: var(--bad-ink); }
.fb-title .praise-tr { font-weight: 700; font-size: 14px; opacity: .8; }
.fb-body { margin-top: 6px; font-size: 15px; color: var(--text); }
.fb-answer { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-weight: 700; font-size: 17px; }
.fb-why { margin-top: 6px; font-size: 14px; color: var(--text-2); line-height: 1.55; }
.fb-why b { color: var(--text); }
.stage-foot .btn-row { display: flex; gap: 10px; }
.stage-foot .btn-row .btn { flex: 1; }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 문제 공통 ---------- */
.ex { display: flex; flex-direction: column; gap: 18px; animation: fadeIn .35s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ex-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; letter-spacing: .02em; color: var(--brand-strong); }
.ex-label.new { color: var(--violet); }
.ex-q { font-size: 20px; font-weight: 750; letter-spacing: -.02em; line-height: 1.4; }
.ex-prompt { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ex-prompt .big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.25; }
.ex-prompt .ko-big { font-size: 24px; font-weight: 750; letter-spacing: -.02em; }
.ex-center { align-items: center; text-align: center; }

.word-xl { font-size: 40px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.hangul { font-size: 14px; color: var(--muted); font-weight: 600; letter-spacing: .01em; }
.hangul::before { content: "[ "; opacity: .6; }
.hangul::after { content: " ]"; opacity: .6; }
.meaning { font-size: 22px; font-weight: 700; letter-spacing: -.015em; }
.pos { font-size: 12.5px; font-weight: 700; color: var(--muted); }

.intro-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.intro-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.intro-audio { display: flex; gap: 8px; }
.divider { height: 1px; background: var(--border); margin: 2px 0; }

.example { border-radius: var(--r-sm); background: var(--surface-2); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; }
.example .ex-tr { font-weight: 650; }
.example .ex-ko { font-size: 14px; color: var(--text-2); margin-top: 2px; }
.example .speak-btn { margin-top: -2px; }

.note { border-radius: var(--r-sm); padding: 12px 14px; font-size: 14.5px; line-height: 1.6; background: var(--gold-soft); color: var(--text); }
.note b { color: var(--text); }
.note .note-title { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px; color: var(--gold); margin-bottom: 4px; letter-spacing: .02em; }
.note.ko { background: var(--brand-soft); }
.note.ko .note-title { color: var(--brand-ink); }
.note.warn { background: var(--bad-soft); }
.note.warn .note-title { color: var(--bad-ink); }

/* 객관식 */
.options { display: grid; gap: 10px; }
.option {
  position: relative; display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 58px; padding: 12px 16px;
  border-radius: var(--r); border: 2px solid var(--border); border-bottom-width: 4px;
  background: var(--surface); text-align: left; font-size: 17px; font-weight: 650; letter-spacing: -.01em;
  transition: transform .1s, border-color .15s, background .15s;
}
.option:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; margin-bottom: 2px; }
.option .opt-key { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--border); display: grid; place-items: center; font-size: 12.5px; color: var(--muted); font-weight: 700; }
.option .opt-text { flex: 1; }
.option .opt-sub { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.option.sel { border-color: var(--brand); background: var(--brand-soft); }
.option.correct { border-color: var(--ok); background: var(--ok-soft); color: var(--ok-ink); }
.option.correct .opt-key { border-color: var(--ok); color: var(--ok-ink); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); color: var(--bad-ink); animation: shake .35s; }
.option:disabled { cursor: default; }
.option.dim { opacity: .5; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (min-width: 560px) { .options.two-col { grid-template-columns: 1fr 1fr; } }

/* 짝 맞추기 */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.match-btn {
  min-height: 56px; padding: 10px 12px; border-radius: var(--r-sm);
  border: 2px solid var(--border); border-bottom-width: 4px; background: var(--surface);
  font-size: 16px; font-weight: 650; line-height: 1.3;
  transition: all .15s;
}
.match-btn.sel { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.match-btn.done { opacity: 0; transform: scale(.9); pointer-events: none; }
.match-btn.ok-flash { border-color: var(--ok); background: var(--ok-soft); }
.match-btn.bad-flash { border-color: var(--bad); background: var(--bad-soft); animation: shake .35s; }

/* 단어 타일 */
.tiles-prompt { display: flex; gap: 12px; align-items: flex-start; }
.tiles-prompt .bubble {
  position: relative; flex: 1; padding: 14px 16px; border-radius: 18px; border-top-left-radius: 6px;
  background: var(--surface); box-shadow: var(--shadow-2); font-size: 18px; font-weight: 650; line-height: 1.45;
}
.tiles-prompt .avatar { width: 44px; height: 44px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); font-size: 24px; }
.answer-zone {
  min-height: 116px; padding: 8px 0;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 53px, var(--border) 53px, var(--border) 55px);
}
.bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding-top: 6px; }
.tile {
  height: 46px; padding: 0 14px; border-radius: 13px;
  border: 2px solid var(--border); border-bottom-width: 4px; background: var(--surface);
  font-size: 17px; font-weight: 650; letter-spacing: -.005em;
  transition: transform .12s, opacity .15s;
  animation: tileIn .18s var(--ease);
}
.tile:active { transform: translateY(2px); }
.tile.ghost { visibility: hidden; }
.tile.used { background: var(--surface-2); color: transparent; border-color: var(--surface-2); pointer-events: none; animation: none; }
@keyframes tileIn { from { transform: scale(.85); opacity: .3; } to { transform: none; opacity: 1; } }

/* 입력 */
.type-wrap { display: flex; flex-direction: column; gap: 10px; }
.type-input {
  width: 100%; min-height: 58px; padding: 14px 16px;
  border-radius: var(--r); border: 2px solid var(--border); background: var(--surface);
  font-size: 19px; font-weight: 650; letter-spacing: -.005em; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.type-input { min-height: 110px; resize: none; line-height: 1.45; }
.type-input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.type-input.ok { border-color: var(--ok); background: var(--ok-soft); }
.type-input.bad { border-color: var(--bad); background: var(--bad-soft); }
.letter-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.letter-key {
  min-width: 42px; height: 42px; padding: 0 8px; border-radius: 11px;
  border: 1px solid var(--border); border-bottom-width: 3px; background: var(--surface);
  font-size: 18px; font-weight: 700;
}
.letter-key:active { transform: translateY(1px); border-bottom-width: 2px; }
.diff { font-size: 16px; font-weight: 650; letter-spacing: .01em; }
.diff .d-bad { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad-ink); border-radius: 3px; }
.diff .d-miss { color: var(--bad); text-decoration: underline; }

.play-row { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 6px 0 4px; }

.mic-btn {
  width: 92px; height: 92px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; box-shadow: 0 5px 0 color-mix(in srgb, var(--accent) 70%, #000);
  transition: transform .12s;
}
.mic-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 70%, #000); }
.mic-btn.listening { animation: micPulse 1.1s infinite; background: var(--bad); }
@keyframes micPulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 50% { box-shadow: 0 0 0 18px transparent; } }

/* 회화 말풍선 */
.chat { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.bub-row { display: flex; align-items: flex-end; gap: 8px; }
.bub-row.right { flex-direction: row-reverse; }
.bub-av { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 20px; }
.bub { max-width: 82%; padding: 10px 14px; border-radius: 18px; border-bottom-left-radius: 6px; background: var(--surface); box-shadow: var(--shadow-1); transition: box-shadow .2s, transform .2s; }
.bub-row.right .bub { border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; background: var(--brand-soft); }
.bub-row.now .bub { box-shadow: 0 0 0 3px var(--brand); transform: scale(1.02); }
.bub-name { font-size: 12px; font-weight: 750; color: var(--muted); }
.bub-tr { font-size: 17px; font-weight: 700; line-height: 1.4; cursor: pointer; }
.bub-ko { font-size: 14px; color: var(--text-2); margin-top: 3px; transition: filter .2s; }
.bub-ko.blur { filter: blur(5px); cursor: pointer; user-select: none; }

/* 레슨 완료 */
.done-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; padding: 24px 0; }
.done-emoji { font-size: 76px; line-height: 1; animation: pop .6s var(--ease); }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.done-title { font-size: 28px; font-weight: 850; letter-spacing: -.03em; }
.done-sub { color: var(--text-2); }
.done-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 420px; margin-top: 6px; }
.done-stat { border-radius: var(--r); border: 2px solid var(--border); padding: 12px 6px; background: var(--surface); }
.done-stat .v { font-size: 22px; font-weight: 850; letter-spacing: -.02em; }
.done-stat .k { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.done-stat.gold { border-color: var(--gold); } .done-stat.gold .v { color: var(--gold); }
.done-stat.brand { border-color: var(--brand); } .done-stat.brand .v { color: var(--brand); }
.done-stat.ok { border-color: var(--ok); } .done-stat.ok .v { color: var(--ok); }
.big-stars { display: flex; gap: 6px; font-size: 40px; color: var(--surface-3); }
.big-stars .on { color: var(--gold); animation: pop .5s var(--ease) both; }
.big-stars .on:nth-child(2) { animation-delay: .15s; }
.big-stars .on:nth-child(3) { animation-delay: .3s; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; opacity: .9; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- 플래시카드(복습) ---------- */
.flash {
  position: relative; min-height: 300px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-2);
  padding: 56px 20px 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px;
}
.flash .side-tag { position: absolute; top: 14px; left: 16px; }
.flash .reveal { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; animation: fadeIn .3s var(--ease); }
.flash .example { text-align: left; width: 100%; }
.rate-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rate-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-height: 62px; border-radius: 14px; border: 0; font-weight: 750; font-size: 15px;
  border-bottom: 3px solid rgb(0 0 0 / .14);
}
.rate-btn small { font-size: 12px; font-weight: 650; opacity: .85; }
.rate-btn.r1 { background: var(--bad-soft); color: var(--bad-ink); }
.rate-btn.r2 { background: var(--gold-soft); color: var(--gold); }
.rate-btn.r3 { background: var(--ok-soft); color: var(--ok-ink); }
.rate-btn.r4 { background: color-mix(in srgb, var(--blue) 14%, var(--surface)); color: var(--blue); }

.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-tile { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-2); padding: 14px 12px; }
.stat-tile .v { font-size: 26px; font-weight: 850; letter-spacing: -.03em; line-height: 1.1; }
.stat-tile .k { font-size: 12.5px; color: var(--muted); font-weight: 700; margin-top: 4px; }
.stat-tile.brand .v { color: var(--brand); }
.stat-tile.gold .v { color: var(--gold); }
.stat-tile.accent .v { color: var(--accent); }

/* ---------- 시트·모달·토스트 ---------- */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgb(6 14 18 / .45); animation: fadeOnly .2s; display: flex; align-items: flex-end; justify-content: center; }
@keyframes fadeOnly { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-width: 640px; max-height: 88dvh; overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-3);
  padding: 8px 20px calc(20px + var(--safe-b));
  animation: sheetIn .3s var(--ease);
}
@keyframes sheetIn { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 4px auto 12px; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { flex: 1; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }
@media (min-width: 700px) {
  .backdrop { align-items: center; }
  .sheet { border-radius: 24px; max-height: 84dvh; padding-bottom: 22px; }
}
.toast-wrap { position: fixed; left: 0; right: 0; top: calc(var(--safe-t) + 12px); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { max-width: 520px; padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-size: 14.5px; font-weight: 600; box-shadow: var(--shadow-3); animation: toastIn .3s var(--ease); pointer-events: auto; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(-8px); transition: all .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- 폼 ---------- */
.field { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 60px; }
.field.stack { flex-wrap: wrap; gap: 10px; }
.field.stack > .seg { width: 100%; }
.field.stack > .seg button { flex: 1; }
.field select.select { max-width: 52%; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "▾"; float: right; color: var(--muted); transition: transform .2s; }
details[open] > summary::after { transform: rotate(180deg); }
.field + .field { border-top: 1px solid var(--border); }
.field .f-main { flex: 1; min-width: 0; }
.field .f-title { font-weight: 650; }
.field .f-sub { font-size: 13px; color: var(--muted); margin-top: 1px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--surface-3); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .22s var(--ease); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); gap: 2px; flex-wrap: wrap; }
.seg button { height: 34px; padding: 0 12px; border-radius: 9px; border: 0; background: none; font-size: 14px; font-weight: 650; color: var(--text-2); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.range { width: 100%; accent-color: var(--brand); height: 28px; }
select.select { height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); padding: 0 10px; max-width: 100%; }
.search {
  display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 14px;
  border-radius: 15px; background: var(--surface); box-shadow: var(--shadow-1); border: 1px solid var(--border);
}
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; }
.search .ico { color: var(--muted); }

/* ---------- 단어장 ---------- */
.word-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; background: none; text-align: left; color: inherit; }
.word-row + .word-row { border-top: 1px solid var(--border); }
.word-row:active { background: var(--surface-2); }
.word-row .w-main { flex: 1; min-width: 0; }
.word-row .w-tr { font-weight: 750; font-size: 17px; letter-spacing: -.01em; }
.word-row .w-ko { font-size: 14px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.word-row .w-hg { font-size: 12px; color: var(--muted); margin-left: 6px; font-weight: 600; }
.srs-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--surface-3); }
.srs-dot.learning { background: var(--gold); }
.srs-dot.young { background: var(--brand); }
.srs-dot.mature { background: var(--ok); }
.forms { display: grid; grid-template-columns: auto 1fr auto; gap: 0; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--border); font-size: 15px; }
.forms > div { padding: 9px 12px; border-top: 1px solid var(--border); display: flex; align-items: center; }
.forms > div:nth-child(-n+3) { border-top: 0; }
.forms .f-k { color: var(--muted); font-size: 13px; font-weight: 700; background: var(--surface-2); }
.forms .f-v { font-weight: 700; }
.forms .f-ko { color: var(--text-2); font-size: 13.5px; justify-content: flex-end; text-align: right; }

/* ---------- 알파벳 ---------- */
.letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.letter-cell {
  aspect-ratio: 1; border-radius: 16px; border: 2px solid var(--border); border-bottom-width: 4px; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  transition: transform .12s;
}
.letter-cell:active { transform: translateY(2px); }
.letter-cell .lc-big { font-size: 26px; font-weight: 800; line-height: 1.05; }
.letter-cell .lc-ko { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.letter-cell.special { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.letter-cell.special .lc-big { color: var(--accent); }
.letter-cell.seen { background: var(--brand-soft); }
.pair-card { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.pair-side { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: var(--r); background: var(--surface-2); text-align: center; }
.pair-side .p-tr { font-size: 22px; font-weight: 800; }
.pair-side .p-ko { font-size: 13px; color: var(--text-2); }
.pair-vs { font-weight: 800; color: var(--muted); font-size: 13px; }

/* ---------- 문법·본문 ---------- */
.prose { font-size: 16px; line-height: 1.7; color: var(--text); }
.prose > * + * { margin-top: 12px; }
.prose h3 { margin-top: 22px; font-size: 18px; }
.prose ul { padding-left: 20px; margin: 8px 0 0; }
.prose li + li { margin-top: 4px; }
.prose .tr { font-weight: 700; color: var(--brand-ink); cursor: pointer; text-decoration: underline dotted color-mix(in srgb, var(--brand) 55%, transparent); text-underline-offset: 3px; }
.prose .tr:active { opacity: .6; }
.ex-line .ex-gloss { word-break: break-word; }
.gtable { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; font-size: 14.5px; background: var(--surface); }
.gtable th, .gtable td { padding: 9px 10px; text-align: left; border-top: 1px solid var(--border); vertical-align: top; }
.gtable tr:first-child th, .gtable tr:first-child td { border-top: 0; }
.gtable th { background: var(--surface-2); font-size: 13px; color: var(--text-2); font-weight: 750; }
.gtable td.tr, .gtable .tr { font-weight: 700; color: var(--text); white-space: nowrap; }
.gtable th, .gtable td { overflow-wrap: normal; word-break: keep-all; }
.table-scroll { overflow-x: auto; margin: 0 -2px; padding: 0 2px; }
.ex-list { display: grid; gap: 8px; }
.ex-line { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.ex-line .ex-tr { font-weight: 700; }
.ex-line .ex-ko { font-size: 14px; color: var(--text-2); }
.ex-line .ex-gloss { font-size: 13px; color: var(--muted); margin-top: 2px; }

.clock { color: var(--text); }
.clock .face { fill: var(--surface); stroke: var(--border); }
.clock .ticks line { stroke: var(--text-2); }
.clock .nums text { fill: var(--text-2); }
.clock .hour { stroke: var(--text); }
.clock .min { stroke: var(--brand); }
.clock .pin { fill: var(--brand); }

/* 통계 차트 (단일 색상 · 4px 둥근 끝 · 2px 간격) */
.viz { position: relative; }
.viz-cols { position: relative; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--border); }
.viz-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; cursor: pointer; outline: none; }
.viz-col:hover .viz-bar, .viz-col:focus-visible .viz-bar { filter: brightness(1.12); }
.viz-col:focus-visible .viz-bar { outline: 2px solid var(--text); outline-offset: 2px; }
.viz-bar { width: 100%; max-width: 24px; background: var(--brand); border-radius: 4px 4px 0 0; }
.viz-bar.zero { background: var(--surface-3); }
.viz-cap { font-size: 11px; font-weight: 750; color: var(--text-2); margin-bottom: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.viz-goal { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid color-mix(in srgb, var(--muted) 60%, transparent); pointer-events: none; }
.viz-goal span { position: absolute; right: 0; top: -17px; padding: 0 4px; border-radius: 4px; background: var(--surface); font-size: 11px; font-weight: 700; color: var(--muted); }
.viz-axis { display: flex; gap: 2px; margin-top: 5px; }
.viz-axis > div { flex: 1; min-width: 0; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: visible; font-variant-numeric: tabular-nums; }
.viz-tip { position: absolute; z-index: 5; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 10px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 12px; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-3); }
.viz-tip b { font-size: 14px; }
.viz-table > summary { margin-top: 12px; font-size: 13px; color: var(--muted); cursor: pointer; }
.heat { display: grid; gap: 3px; align-items: center; }
.heat-wd { font-size: 10.5px; font-weight: 700; color: var(--muted); }
.heat-cell { aspect-ratio: 1; border-radius: 4px; background: var(--surface-3); outline: none; }
.heat-cell.l1 { background: var(--heat-1); }
.heat-cell.l2 { background: var(--heat-2); }
.heat-cell.l3 { background: var(--heat-3); }
.heat-cell.l4 { background: var(--heat-4); }
.heat-cell.future { background: transparent; }
.heat-cell.today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.heat-cell:focus-visible { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 12px; font-size: 11px; color: var(--muted); }
.heat-legend i { width: 12px; height: 12px; }

/* 형태소 색상 */.m { font-weight: 800; }
.m-stem { color: var(--text); }
.m-pl { color: var(--violet); }
.m-case { color: var(--blue); }
.m-poss { color: var(--orange); }
.m-tense { color: var(--brand-strong); }
.m-pers { color: var(--pink); }
.m-neg { color: var(--accent); }
.m-q { color: var(--gold); }
.m-buf { color: var(--muted); }
.morph-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 12.5px; font-weight: 700; }

/* ---------- 유틸 ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
.bold { font-weight: 750; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.hidden { display: none !important; }
.ico { display: inline-grid; place-items: center; flex: none; line-height: 0; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .e-emoji { font-size: 44px; margin-bottom: 8px; }
.kbd { display: inline-block; padding: 0 6px; border-radius: 5px; border: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.footer-note { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 28px; }
.page-head { margin: 6px 2px 16px; }
.page-head p { color: var(--text-2); margin-top: 4px; font-size: 15px; }

.action-bar {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 70;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  width: min(560px, calc(100% - 24px));
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px;
  border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-3); border: 1px solid var(--border);
  font-size: 14.5px; font-weight: 600; animation: slideUp .3s var(--ease);
}
body.immersive .action-bar { bottom: calc(var(--safe-b) + 96px); }
@media (min-width: 1000px) { .action-bar { bottom: 24px; } }

/* 오프라인 저장 진행 칩 · 설치 안내 */
.offline-chip {
  position: fixed; right: 12px; z-index: 65; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  padding: 8px 14px; border-radius: 20px; background: var(--brand); color: #fff; font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-3); text-decoration: none; font-variant-numeric: tabular-nums;
}
body.immersive .offline-chip { bottom: calc(var(--safe-b) + 96px); }
@media (min-width: 1000px) { .offline-chip { bottom: 24px; } }
.steps { margin: 12px 0 0; padding-left: 22px; display: grid; gap: 8px; color: var(--text-2); font-size: 14.5px; line-height: 1.55; }
.steps li::marker { color: var(--brand); font-weight: 800; }
.install-hint { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.install-hint .ih-ico { font-size: 28px; flex: none; }
.install-hint .ih-x { margin-left: auto; flex: none; }

/* 온보딩 */
.onb { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--safe-t) + 20px) 20px calc(var(--safe-b) + 20px); max-width: 560px; margin: 0 auto; }
.onb-body { flex: 1; display: flex; flex-direction: column; gap: 16px; justify-content: center; }
.onb-hero { font-size: 64px; text-align: center; }
.onb-title { font-size: 28px; font-weight: 850; letter-spacing: -.03em; text-align: center; line-height: 1.3; }
.onb-sub { text-align: center; color: var(--text-2); }
.onb-points { display: grid; gap: 10px; margin-top: 8px; }
.onb-point { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1); }
.onb-point .op-ico { font-size: 22px; }
.onb-point b { display: block; }
.onb-point span { font-size: 14px; color: var(--text-2); }
.onb-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.onb-dots i { width: 7px; height: 7px; border-radius: 4px; background: var(--surface-3); transition: all .25s; }
.onb-dots i.on { width: 22px; background: var(--brand); }

@media (max-width: 360px) {
  .word-xl { font-size: 34px; }
  .ex-prompt .big { font-size: 26px; }
  .option { font-size: 16px; min-height: 54px; }
  .tile { font-size: 16px; height: 44px; padding: 0 12px; }
  .stat-tile .v { font-size: 22px; }
  .rate-btn { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
