/* LinguaLive: mobile-first, light & dark, system fonts only (nothing loaded from other sites). */

:root {
  --bg: #f6f5fb; --card: #ffffff; --soft: #efedfa; --line: #e3e0f0; --text: #1d1a2e; --muted: #6b6785;
  --primary: #5b4bdb; --primary-2: #7a5cff; --on-primary: #fff; --good: #16a765; --good-bg: #e3f7ec;
  --bad: #e5484d; --bad-bg: #fdecec; --warn-bg: #fff4dc; --warn: #8a5a00; --streak: #ff8a3d;
  --radius: 16px; --shadow: 0 1px 2px rgb(30 20 80 / 6%), 0 6px 20px rgb(30 20 80 / 6%);
  --tabbar: 64px; --topbar: 56px; --maxw: 720px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #100e1a; --card: #1a1828; --soft: #242136; --line: #2f2b45; --text: #ecebf5; --muted: #a29fbd;
    --primary: #8b7bff; --primary-2: #a08cff; --good: #3ccf8e; --good-bg: #12301f; --bad: #ff6b6f; --bad-bg: #3a1618;
    --warn-bg: #3a2c0c; --warn: #ffd27a; --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100dvh; -webkit-tap-highlight-color: transparent;
  padding-top: calc(var(--topbar) + env(safe-area-inset-top)); padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
}
body.no-chrome { padding: 0; }
body.no-chrome .topbar, body.no-chrome .tabbar { display: none; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; margin-bottom: 6px; }
p { margin: 0; }
a { color: var(--primary); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary-2); outline-offset: 2px; border-radius: 8px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.block { display: block; }
.center, .center-text { text-align: center; }
.error { color: var(--bad); }
.good-text { color: var(--good); font-weight: 600; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 99; background: var(--card); padding: 8px; }

.view { max-width: var(--maxw); margin: 0 auto; outline: none; }
.page { padding: 16px 16px 32px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.eyebrow { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* ---------- top bar & tab bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 20; height: calc(var(--topbar) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; justify-content: space-between; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.lang-switch { display: flex; gap: 8px; align-items: center; border: 0; background: var(--soft); padding: 6px 12px; border-radius: 999px; }
.lang-switch .flag { font-size: 1.2rem; }
.caret { color: var(--muted); font-size: 0.8rem; }
.top-stats { display: flex; gap: 12px; align-items: center; font-weight: 700; }
.streak { color: var(--muted); }
.streak.lit { color: var(--streak); }
.mini-ring {
  --p: 0; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 0.75rem;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--line) 0);
}
.mini-ring span { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; }
.tabbar {
  position: fixed; inset: auto 0 0; z-index: 20; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: space-around; background: var(--card); border-top: 1px solid var(--line);
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 0.72rem; color: var(--muted); text-decoration: none; }
.tab.on { color: var(--primary); font-weight: 700; }
.tab-icon { font-size: 1.35rem; position: relative; filter: grayscale(0.6); }
.tab.on .tab-icon { filter: none; }
.badge { position: absolute; top: -4px; right: -12px; background: var(--bad); color: #fff; font-style: normal; font-size: 0.65rem; font-weight: 700; border-radius: 999px; padding: 0 5px; min-width: 18px; text-align: center; }

/* ---------- buttons, inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 11px 18px;
  font-weight: 600; text-decoration: none; background: var(--soft); color: var(--text); transition: transform 0.08s, filter 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: var(--on-primary); box-shadow: 0 4px 14px rgb(91 75 219 / 30%); }
.btn.soft { background: var(--soft); color: var(--primary); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.btn.big { padding: 15px 22px; font-size: 1.05rem; width: 100%; }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }
.btn.mic { background: var(--good-bg); color: var(--good); }
.btn.mic.live { background: var(--bad-bg); color: var(--bad); animation: pulse 1.2s infinite; }
.icon-btn { border: 0; background: transparent; font-size: 1.2rem; width: 40px; height: 40px; border-radius: 50%; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--soft); }
.mini { border: 0; background: var(--soft); border-radius: 10px; padding: 4px 9px; font-size: 0.85rem; color: var(--primary); }
.mini.big { font-size: 1.3rem; padding: 8px 12px; }
.linkish { border: 0; background: none; color: var(--primary); padding: 0; text-decoration: underline; }
.input { width: 100%; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 11px 14px; }
.input:focus { border-color: var(--primary); outline: none; }
.chip { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 0.9rem; }
.chip:hover { border-color: var(--primary); }
.pill { display: inline-block; background: var(--soft); color: var(--primary); border-radius: 999px; padding: 1px 9px; font-size: 0.75rem; font-weight: 700; vertical-align: middle; }
.pill.good { background: var(--good-bg); color: var(--good); }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.soft { background: var(--soft); box-shadow: none; }
.card.tip { background: var(--warn-bg); box-shadow: none; }
.card.warn { background: var(--warn-bg); color: var(--warn); box-shadow: none; }
.card ul, .card ol { margin: 0; padding-left: 20px; }

/* ---------- today ---------- */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.ring { --p: 0; flex: none; width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--line) 0); }
.ring > div { width: 78px; height: 78px; border-radius: 50%; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.ring b { font-size: 1.4rem; }
.ring span { font-size: 0.7rem; color: var(--muted); }
.continue { display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: var(--on-primary); background: linear-gradient(135deg, var(--primary-2), var(--primary)); }
.continue .eyebrow { color: rgb(255 255 255 / 80%); }
.continue .go { background: rgb(255 255 255 / 20%); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.plan { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plan-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.plan-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--primary); font-weight: 700; flex: none; font-size: 0.85rem; }
.plan-item.done .plan-num { background: var(--good); color: #fff; }
.plan-item.done .plan-text b { text-decoration: line-through; color: var(--muted); }
.plan-icon { font-size: 1.5rem; }
.plan-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.plan-text small { color: var(--muted); }
.plan-item .go { font-weight: 700; color: var(--primary); font-size: 0.9rem; }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .quick { grid-template-columns: repeat(4, 1fr); } }
.quick-card { display: flex; flex-direction: column; gap: 2px; padding: 14px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.quick-card span { font-size: 1.6rem; }
.quick-card small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week { display: flex; justify-content: space-between; gap: 6px; margin: 12px 0 8px; }
.week .day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 0.75rem; color: var(--muted); }
.week .bar { width: 100%; max-width: 34px; height: 56px; background: var(--soft); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.week .bar i { display: block; width: 100%; background: var(--primary); border-radius: 8px; }
.week .day.hit .bar i { background: var(--streak); }
.week .day.today span { color: var(--primary); font-weight: 700; }

/* ---------- course ---------- */
.unit { display: flex; flex-direction: column; gap: 10px; }
.unit-head { display: flex; gap: 12px; align-items: center; }
.unit-icon { font-size: 2rem; }
.unit-head > div { flex: 1; }
.unit-prog { font-weight: 700; color: var(--primary); }
.meter { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; flex: 1; }
.meter.thin { height: 6px; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-2), var(--primary)); border-radius: 999px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; border: 2px solid transparent; background: var(--card); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); text-decoration: none; color: var(--text); }
.tile:hover { border-color: var(--line); }
.tile-icon { font-size: 1.6rem; }
.tile small { color: var(--muted); }
.tile.done small { color: #e0a100; letter-spacing: 1px; }
.tile.next { border-color: var(--primary); }
.tile.next small { color: var(--primary); font-weight: 700; }
.checklist { list-style: none; padding: 0 !important; display: flex; flex-direction: column; gap: 6px; }
.checklist li::before { content: "◎ "; color: var(--primary); }

/* ---------- talk hub ---------- */
.modes { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .modes { grid-template-columns: repeat(3, 1fr); } }
.mode-card { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: var(--radius); color: #fff; text-decoration: none; }
.mode-card span { font-size: 1.8rem; }
.mode-card small { opacity: 0.85; }
.m1 { background: linear-gradient(135deg, #7a5cff, #4a3bc9); }
.m2 { background: linear-gradient(135deg, #ff8a3d, #e0561b); }
.m3 { background: linear-gradient(135deg, #1fb57a, #0e8a5c); }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1.5px solid var(--line); text-decoration: none; color: var(--text); text-align: left; width: 100%; }
.list-item.current { border-color: var(--primary); }

/* ---------- focus screens (lesson, conversation, review, onboarding) ---------- */
.focus { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; }
.focus-top { display: flex; align-items: center; gap: 12px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; max-width: var(--maxw); width: 100%; margin: 0 auto; }
.focus-title { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.progress { flex: 1; height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--good), #48d597); border-radius: 999px; transition: width 0.35s ease; }
.step-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; min-width: 64px; text-align: right; }
.focus-body { flex: 1; overflow-y: auto; padding: 12px 16px calc(24px + env(safe-area-inset-bottom)); max-width: var(--maxw); width: 100%; margin: 0 auto; display: flex; flex-direction: column; }
.focus-body > .stack { flex: 1; }
.talk-body { padding: 0; }

.loading { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); padding: 24px; }
.loading.big { flex-direction: column; min-height: 50vh; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
.empty { display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; min-height: 40vh; text-align: center; }

.hero-icon { font-size: 3.4rem; text-align: center; }
.lesson-intro h1 { text-align: center; }
.lesson-intro > .muted, .lesson-intro > .eyebrow { text-align: center; }
.phrase-card, .flashcard { background: var(--card); border-radius: 20px; padding: 24px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; text-align: center; }
.flashcard .mini, .flashcard .btn { align-self: center; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade { border: 0; border-radius: 14px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 600; }
.grade small { font-weight: 500; opacity: 0.8; font-size: 0.75rem; }
.grade.g0 { background: var(--bad-bg); color: var(--bad); }
.grade.g1 { background: var(--warn-bg); color: var(--warn); }
.grade.g2 { background: var(--good-bg); color: var(--good); }
.grade.g3 { background: var(--soft); color: var(--primary); }
.card-back { display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--line); padding-top: 12px; }
.target { font-size: 1.7rem; font-weight: 700; line-height: 1.3; }
.rom { color: var(--muted); font-style: italic; font-size: 0.92rem; }
.meaning { font-size: 1.1rem; }
.meaning.big { font-size: 1.4rem; font-weight: 600; }
.note { font-size: 0.9rem; color: var(--muted); background: var(--soft); border-radius: 10px; padding: 8px 10px; }
.say-result:empty { display: none; }
.pron { margin-top: 6px; font-size: 0.85rem; border-radius: 10px; padding: 6px 10px; }
.pron.big { font-size: 1rem; text-align: center; padding: 10px; }
.pron.good { background: var(--good-bg); }
.pron.ok { background: var(--warn-bg); }
.pron.bad { background: var(--bad-bg); }
.w-ok { color: var(--good); font-weight: 600; }
.w-miss { color: var(--bad); font-weight: 600; text-decoration: underline wavy; }
.word-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.word { display: flex; flex-direction: column; text-align: left; border: 0; background: var(--card); border-radius: 12px; padding: 10px; }
.phrase-row { display: flex; gap: 12px; align-items: flex-start; }
.stars { font-size: 2.2rem; color: #f5b400; letter-spacing: 4px; text-align: center; }
.stat-row, .stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--card); border-radius: 14px; padding: 12px 8px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card .stat { background: var(--soft); box-shadow: none; }
.stat b { font-size: 1.3rem; }
.stat span { font-size: 0.78rem; color: var(--muted); }

/* exercises */
.exercise { flex: 1; }
.prompt { display: flex; gap: 12px; align-items: center; font-size: 1.35rem; font-weight: 600; background: var(--card); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.options { display: flex; flex-direction: column; gap: 10px; }
.option { text-align: left; border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 13px 16px; font-size: 1.02rem; display: flex; flex-direction: column; gap: 2px; }
.option:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--line)); }
.option.chosen { border-color: var(--primary); background: var(--soft); }
.option.right { border-color: var(--good); background: var(--good-bg); }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); animation: shake 0.3s; }
.option.matched { opacity: 0.35; border-style: dashed; }
.level-opt small { color: var(--muted); }
.listen-big { font-size: 2.2rem; width: 96px; height: 96px; border-radius: 50%; background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; }
.build-answer { min-height: 58px; border-bottom: 2px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.build-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding-top: 8px; }
.token { border: 2px solid var(--line); border-bottom-width: 4px; background: var(--card); border-radius: 12px; padding: 8px 12px; font-size: 1.05rem; }
.token.used { visibility: hidden; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match .option { align-items: center; text-align: center; padding: 10px; min-height: 52px; justify-content: center; }
.exercise-foot { position: sticky; bottom: 0; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; background: linear-gradient(transparent, var(--bg) 18px); }
.feedback { border-radius: 14px; padding: 12px 14px; }
.feedback.good { background: var(--good-bg); color: var(--good); }
.feedback.bad { background: var(--bad-bg); color: var(--bad); }
.feedback div { color: var(--text); }

/* ---------- conversation ---------- */
.lesson-talk { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.talk-intro { padding: 0 0 6px; text-align: center; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-height: 760px) {
  .orb { width: 72px; height: 72px; }
  .orb-icon { font-size: 1.6rem; }
  .round-btn { width: 44px; height: 44px; font-size: 1.1rem; }
  .convo-buttons { gap: 16px; }
  .chip { padding: 4px 10px; font-size: 0.85rem; }
}
.convo { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.talk-body .convo { padding: 0 16px; }
.convo-goals { background: var(--card); border-radius: 14px; padding: 2px 4px; box-shadow: var(--shadow); margin-bottom: 8px; }
.goals-bar { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; text-align: left; font-size: 0.9rem; }
.dots { display: flex; gap: 4px; flex: none; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--good); }
.goal-now { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goals { list-style: none; margin: 0; padding: 0 10px 10px; display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; }
.goals li { display: flex; gap: 8px; align-items: center; }
.goals li.done { color: var(--muted); text-decoration: line-through; }
.tick { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 0.7rem; font-weight: 700; background: var(--soft); color: var(--primary); flex: none; }
.goals li.done .tick { background: var(--good); color: #fff; }
.convo-banner { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--good-bg); border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; font-weight: 600; }
.convo-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 8px 2px 12px; min-height: 120px; scroll-behavior: smooth; }
.convo-empty { color: var(--muted); text-align: center; margin: auto; }
.bubble { max-width: 88%; border-radius: 18px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.bubble.teacher { align-self: flex-start; background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.bubble.user { align-self: flex-end; background: linear-gradient(135deg, var(--primary-2), var(--primary)); color: #fff; border-bottom-right-radius: 6px; }
.bubble .who { font-size: 0.72rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.05em; }
.bubble .say { font-size: 1.08rem; }
.bubble .tr { color: var(--muted); font-size: 0.92rem; border-left: 3px solid var(--line); padding-left: 8px; }
.bubble .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bubble .drill { background: var(--soft); border-radius: 10px; padding: 6px 10px; font-size: 0.92rem; }
.bubble.user .fix, .bubble.user .pron, .bubble.user .ok-badge { background: rgb(255 255 255 / 95%); color: var(--text); border-radius: 12px; padding: 8px 10px; font-size: 0.9rem; }
@media (prefers-color-scheme: dark) { .bubble.user .fix, .bubble.user .pron, .bubble.user .ok-badge { background: rgb(16 14 26 / 85%); } }
.bubble.user .ok-badge { color: var(--good); font-weight: 700; padding: 4px 10px; align-self: flex-start; }
.fix-label { color: var(--good); font-weight: 700; }
.why { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.via { opacity: 0.7; }
.explain { background: var(--soft); border-radius: 12px; padding: 10px; font-size: 0.92rem; display: flex; flex-direction: column; gap: 6px; }
.explain .words { margin: 0; padding-left: 18px; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
.convo-live { min-height: 1.6em; text-align: center; color: var(--muted); font-style: italic; padding: 2px 8px; }
.convo-tips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; padding-bottom: 6px; }
.tips-label { font-size: 0.8rem; color: var(--muted); width: 100%; text-align: center; }
.convo-controls { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0 4px; }
.convo-buttons { display: flex; align-items: center; gap: 22px; }
.round-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 1.3rem; }
.convo-status { font-size: 0.9rem; color: var(--muted); text-align: center; min-height: 1.4em; }
.convo-type { display: flex; gap: 8px; width: 100%; }
.convo-foot { display: flex; justify-content: center; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }

/* the voice orb */
.orb { --level: 0; position: relative; width: 88px; height: 88px; border: 0; border-radius: 50%; background: none; padding: 0; }
.orb-core { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; z-index: 2; background: radial-gradient(circle at 35% 30%, var(--primary-2), var(--primary) 70%); box-shadow: 0 8px 24px rgb(91 75 219 / 40%); transition: transform 0.12s; transform: scale(calc(1 + var(--level) * 0.12)); }
.orb-icon { font-size: 2rem; filter: brightness(0) invert(1); }
.orb-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--primary-2); opacity: 0; z-index: 1; }
.orb.listening .orb-core { background: radial-gradient(circle at 35% 30%, #ff7a7e, var(--bad) 70%); box-shadow: 0 8px 24px rgb(229 72 77 / 40%); }
.orb.listening .orb-ring { border-color: var(--bad); animation: ripple 1.6s infinite; }
.orb.listening .orb-ring.r2 { animation-delay: 0.8s; }
.orb.thinking .orb-core { background: conic-gradient(from 0deg, var(--primary), var(--primary-2), #48d597, var(--primary)); animation: spin 1.4s linear infinite; }
.orb.thinking .orb-icon { animation: spin 1.4s linear infinite reverse; }
.orb.speaking .orb-core { animation: talk 0.6s ease-in-out infinite alternate; }
.orb.speaking .orb-ring { animation: ripple 2.2s infinite; }

/* ---------- report ---------- */
.report { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.report-head { display: flex; gap: 16px; align-items: center; background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.big-score { font-size: 2.6rem; font-weight: 800; color: var(--primary); line-height: 1; }
.big-score small { font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.report-head p { margin-bottom: 6px; }
.scores { display: flex; flex-direction: column; gap: 8px; background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.score-row { display: grid; grid-template-columns: 90px 1fr 36px; gap: 10px; align-items: center; font-size: 0.9rem; }
.score-row b { text-align: right; }
.mistake { padding: 8px 0; border-bottom: 1px solid var(--line); }
.mistake:last-child { border: 0; }
.mistake .said { color: var(--bad); }

/* ---------- me ---------- */
.stat-grid { grid-template-columns: repeat(3, 1fr); margin: 12px 0; }
.chart { display: flex; gap: 8px; align-items: flex-end; height: 110px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.barwrap { flex: 1; width: 100%; max-width: 34px; display: flex; align-items: flex-end; background: var(--soft); border-radius: 8px; overflow: hidden; }
.barwrap i { width: 100%; background: linear-gradient(var(--primary-2), var(--primary)); border-radius: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.92rem; }
.field input[type="range"] { width: 100%; accent-color: var(--primary); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.95rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background 0.2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 3px rgb(0 0 0 / 20%); }
.switch input:checked + .track { background: var(--good); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--primary-2); outline-offset: 2px; }
.switch.small { font-size: 0.8rem; color: var(--muted); }
.switch.small .track { width: 34px; height: 20px; }
.switch.small .track::after { width: 14px; height: 14px; }
.switch.small input:checked + .track::after { transform: translateX(14px); }

/* ---------- onboarding ---------- */
.onboarding .focus-body { padding-top: 4px; }
.brand-hero { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.logo-big { font-size: 3rem; width: 84px; height: 84px; border-radius: 24px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary-2), var(--primary)); }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.lang-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 0; border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 10px 12px; text-align: left; }
.lang-btn:hover { border-color: var(--primary); }
.lang-btn .flag { font-size: 1.6rem; }
.lang-btn small { color: var(--muted); }
.seg-control { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-control button { border: 2px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; }
.seg-control button.on { border-color: var(--primary); background: var(--soft); color: var(--primary); font-weight: 700; }

/* ---------- sheets & toasts ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: rgb(10 8 20 / 45%); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.18s; }
.sheet-wrap.out { opacity: 0; transition: opacity 0.18s; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 16px 18px calc(22px + env(safe-area-inset-bottom)); animation: up 0.22s ease-out; outline: none; }
@media (min-width: 640px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 22px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
#toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); top: calc(64px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: 0.9rem; font-weight: 600; box-shadow: var(--shadow); animation: drop 0.25s ease-out; transition: opacity 0.4s; text-align: center; }
.toast.xp { background: var(--primary); color: #fff; }
.toast.good { background: var(--good); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ripple { from { transform: scale(1); opacity: 0.7; } to { transform: scale(1.7); opacity: 0; } }
@keyframes talk { from { transform: scale(1); } to { transform: scale(1.08); } }
@keyframes pulse { 50% { opacity: 0.6; } }
@keyframes blink { 50% { opacity: 0.2; } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes drop { from { transform: translateY(-10px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; } }
