/* ============================================================
   WESTERA — «звёздное королевство»: фэнтези + будущее
   Ночное небо, туманности, золото рун, бирюза магии.
   Движение: короткое и отзывчивое (Emil Kowalski):
   ease-out на появление, нажатие 0.97, только transform/opacity.
   ============================================================ */

:root {
  color-scheme: dark;
  --bg0: #06051a;
  --bg1: #0d0a2b;
  --bg2: #171140;
  --ink: #f4efff;
  --ink2: #c4bce6;
  --ink3: #8a82b4;
  --line: rgba(246, 207, 122, .16);
  --line2: rgba(246, 207, 122, .32);
  --gold: #f6cf7a;
  --gold2: #e2a548;
  --teal: #5ff2dc;
  --violet: #a98bff;
  --rose: #ff7eb8;
  --ember: #ff9b5a;
  --ok: #7cf0a6;
  --bad: #ff6b8b;
  --panel: linear-gradient(165deg, rgba(52, 40, 118, .62), rgba(18, 13, 52, .78));
  --panel-solid: #191345;
  --glow-gold: 0 0 24px rgba(246, 207, 122, .28);
  --glow-teal: 0 0 26px rgba(95, 242, 220, .35);
  --r: 22px;
  --r-sm: 14px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --f-display: "Cormorant Garamond", "Times New Roman", serif;
  --f-ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;
  --tabbar-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg0); }
body {
  margin: 0; min-height: 100dvh;
  background: radial-gradient(120% 80% at 50% -10%, #241a63 0%, var(--bg1) 45%, var(--bg0) 100%) fixed;
  color: var(--ink);
  font: 500 16px/1.5 var(--f-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  font-variant-numeric: lining-nums;
}
svg text, b, .stat b, .result-big, .orb-num b, .flame b { font-variant-numeric: lining-nums proportional-nums; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea {
  width: 100%;
  background: rgba(8, 6, 30, .55);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
input::placeholder, textarea::placeholder { color: var(--ink3); }
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(246, 207, 122, .14); }
textarea { resize: vertical; min-height: 140px; line-height: 1.55; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- небо ---------- */
.sky { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.nebula {
  position: absolute; border-radius: 50%;
  will-change: transform;
}
.nebula.n1 { width: 120vmax; height: 120vmax; left: -50vmax; top: -40vmax;
  background: radial-gradient(closest-side, rgba(126, 87, 255, .38), rgba(126, 87, 255, 0)); animation: drift1 48s ease-in-out infinite alternate; }
.nebula.n2 { width: 100vmax; height: 100vmax; right: -45vmax; top: 10vh;
  background: radial-gradient(closest-side, rgba(255, 110, 180, .22), rgba(255, 110, 180, 0)); animation: drift2 56s ease-in-out infinite alternate; }
.nebula.n3 { width: 110vmax; height: 90vmax; left: -20vmax; bottom: -55vmax;
  background: radial-gradient(closest-side, rgba(70, 230, 210, .22), rgba(70, 230, 210, 0)); animation: drift3 62s ease-in-out infinite alternate; }
.nebula.n4 { width: 60vmax; height: 60vmax; right: -10vmax; bottom: 5vh;
  background: radial-gradient(closest-side, rgba(246, 190, 100, .14), rgba(246, 190, 100, 0)); animation: drift1 70s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate3d(12vw, 8vh, 0) scale(1.12); } }
@keyframes drift2 { to { transform: translate3d(-14vw, 10vh, 0) scale(.92); } }
@keyframes drift3 { to { transform: translate3d(10vw, -12vh, 0) scale(1.08); } }
#stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.sky::after { /* виньетка */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(130% 90% at 50% 40%, transparent 55%, rgba(3, 2, 14, .75) 100%);
}

/* ---------- каркас ---------- */
#app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; min-height: 100dvh;
  padding: calc(var(--safe-t) + 12px) 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); }

#topbar { display: flex; align-items: center; justify-content: space-between; height: 52px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-star { width: 26px; height: 26px; filter: drop-shadow(0 0 8px rgba(246, 207, 122, .7)); animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand-word {
  font: 700 26px/1 var(--f-display); letter-spacing: .06em;
  background: linear-gradient(100deg, #fff4d6 0%, var(--gold) 40%, #ffd9a0 60%, var(--rose) 120%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.net-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink3); margin-left: 2px; transition: background 300ms ease, box-shadow 300ms ease; }
.net-dot.is-on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font: 700 18px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at 35% 30%, #4a3aa8, #1a1350 70%);
  border: 1px solid var(--line2);
  box-shadow: 0 0 18px rgba(169, 139, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .15);
  transition: transform 160ms var(--ease-out);
}
.avatar:active { transform: scale(.94); }

/* ---------- экраны ---------- */
.screen { display: none; }
.screen.is-active { display: block; }
.screen.is-active > .enter { animation: rise 420ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.eyebrow {
  margin: 26px 2px 10px;
  font: 600 12px/1 var(--f-ui); letter-spacing: .18em; text-transform: uppercase;
  color: var(--gold); opacity: .85;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line2), transparent); }
.eyebrow.first { margin-top: 8px; }
h1.title { font: 700 34px/1.08 var(--f-display); margin: 10px 0 6px; letter-spacing: .01em; }
h1.title em { font-style: italic; font-weight: 600; color: var(--gold); }
.sub { color: var(--ink2); margin: 0; font-size: 15px; }
.muted { color: var(--ink3); }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.row-flex { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }

/* ---------- панели с рунными уголками ---------- */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.runes::before, .runes::after {
  content: ""; position: absolute; width: 9px; height: 9px;
  border: 1px solid var(--gold); transform: rotate(45deg);
  background: var(--bg1); box-shadow: 0 0 8px rgba(246, 207, 122, .6);
}
.runes::before { top: -5px; left: 50%; margin-left: -5px; }
.runes::after { bottom: -5px; left: 50%; margin-left: -5px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 16px;
  font-weight: 700; font-size: 16px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  transition: transform 160ms var(--ease-out), background-color 200ms ease, opacity 200ms ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-gold {
  color: #2a1a00;
  background: linear-gradient(180deg, #ffe4a6, var(--gold) 45%, var(--gold2));
  border-color: rgba(255, 236, 190, .8);
  box-shadow: 0 8px 26px -8px rgba(246, 190, 90, .7), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.btn-magic {
  background: linear-gradient(120deg, rgba(95, 242, 220, .22), rgba(169, 139, 255, .3));
  border-color: rgba(95, 242, 220, .45);
  box-shadow: var(--glow-teal);
}
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  background: rgba(95, 242, 220, .1); border: 1px solid rgba(95, 242, 220, .3); color: var(--teal);
  transition: transform 160ms var(--ease-out), background-color 200ms ease;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.is-playing { background: rgba(95, 242, 220, .28); box-shadow: var(--glow-teal); }
.link { color: var(--teal); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: var(--ink2);
  transition: transform 160ms var(--ease-out), background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}
.chip:active { transform: scale(.96); }
.chip.is-on { background: rgba(246, 207, 122, .16); border-color: var(--gold); color: var(--gold); }

/* ---------- вход ---------- */
.gate { min-height: calc(100dvh - 140px); display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 24px 6px; }
.gate-sigil { width: 168px; height: 168px; margin: 0 auto 10px; }
.gate-sigil .ring1 { transform-origin: 50% 50%; animation: spin 60s linear infinite; }
.gate-sigil .ring2 { transform-origin: 50% 50%; animation: spin 38s linear infinite reverse; }
.gate h1 { font: 700 52px/1 var(--f-display); letter-spacing: .08em; margin: 6px 0 10px;
  background: linear-gradient(100deg, #fff4d6, var(--gold) 45%, var(--rose)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gate p { color: var(--ink2); max-width: 340px; margin: 0 auto 26px; }
.gate form { display: grid; gap: 12px; max-width: 360px; margin: 0 auto; width: 100%; }
.gate input { text-align: center; font-size: 18px; letter-spacing: .06em; }
.gate .err { color: var(--bad); min-height: 22px; font-size: 14px; }

/* ---------- главная: шар энергии ---------- */
.hero { display: grid; grid-template-columns: 148px 1fr; gap: 18px; align-items: center; padding: 20px 18px; margin-top: 18px; }
.orb { position: relative; width: 148px; height: 148px; }
.orb svg { width: 100%; height: 100%; overflow: visible; }
.orb .wave { animation: wave 5.5s linear infinite; }
.orb .wave2 { animation: wave 8s linear infinite reverse; opacity: .55; }
@keyframes wave { to { transform: translateX(-120px); } }
.orb-level { transition: transform 900ms var(--ease-out); }
.orb-num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.orb-num b { font: 800 38px/1 var(--f-ui); letter-spacing: -.03em; text-shadow: 0 2px 12px rgba(0, 0, 0, .6); }
.orb-num span { text-shadow: 0 1px 6px rgba(0,0,0,.7); color: #fff !important; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink2); }
.orb.is-full { filter: drop-shadow(0 0 22px rgba(95, 242, 220, .55)); }
.hero-side { display: grid; gap: 12px; }
.flame { display: flex; align-items: center; gap: 10px; }
.flame svg { width: 30px; height: 34px; filter: drop-shadow(0 0 10px rgba(255, 155, 90, .7)); transform-origin: 50% 90%; animation: flicker 2.4s ease-in-out infinite; }
@keyframes flicker { 50% { transform: scale(1.06, .96) rotate(-2deg); } }
.flame b { font: 800 28px/1 var(--f-ui); color: var(--ember); }
.flame span { color: var(--ink2); font-size: 14px; line-height: 1.2; }
.goal-line { font-size: 14px; color: var(--ink2); }
.goal-line b { color: var(--teal); }
.partner { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink2); }
.partner .mini { width: 28px; height: 28px; font-size: 13px; }
.partner-bar { flex: 1; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.partner-bar i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--violet), var(--rose)); transform-origin: left; transition: transform 900ms var(--ease-out); }

/* ---------- задания дня ---------- */
.quests { display: grid; gap: 12px; }
.quest {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: center;
  width: 100%; text-align: left; padding: 14px 16px 14px 14px;
  transition: transform 160ms var(--ease-out), border-color 200ms ease;
}
.quest:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .quest:hover { border-color: var(--line2); } }
.gem {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .25), transparent 55%), var(--c, var(--violet));
  box-shadow: 0 6px 22px -6px var(--c, var(--violet)), inset 0 -6px 12px rgba(0, 0, 0, .25);
  color: #120c33;
}
.gem svg { width: 24px; height: 24px; }
.q-title { font-weight: 700; font-size: 17px; }
.q-meta { font-size: 13.5px; color: var(--ink2); line-height: 1.35; margin-top: 2px; }
.q-go { font: 700 13px/1 var(--f-ui); color: var(--gold); white-space: nowrap; }
.quest.is-done { opacity: .62; }
.quest.is-done .q-go { color: var(--ok); }
.line-quote { font: italic 600 19px/1.35 var(--f-display); color: var(--ink2); margin: 6px 2px 0; }

/* ---------- таб-бар ---------- */
#tabbar {
  position: fixed; z-index: 20; left: 50%; bottom: calc(10px + var(--safe-b));
  transform: translateX(-50%);
  width: min(528px, calc(100% - 20px)); height: var(--tabbar-h);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 8px; border-radius: 26px;
  background: rgba(16, 12, 46, .82);
  -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .07);
}
#tabbar.is-hidden { transform: translate(-50%, 140%); }
#tabbar { transition: transform 300ms var(--ease-drawer); }
.tab-glow {
  position: absolute; top: 8px; left: 8px; height: calc(100% - 16px); width: calc((100% - 16px) / 5);
  border-radius: 18px;
  background: radial-gradient(80% 70% at 50% 0%, rgba(246, 207, 122, .3), rgba(169, 139, 255, .14) 70%, transparent);
  border: 1px solid rgba(246, 207, 122, .32);
  transition: transform 340ms var(--ease-out);
  pointer-events: none;
}
.tab { position: relative; display: grid; place-items: center; align-content: center; gap: 4px; color: var(--ink3); font-size: 11.5px; font-weight: 700; transition: color 200ms ease, transform 160ms var(--ease-out); }
.tab:active { transform: scale(.94); }
.tab svg { width: 24px; height: 24px; }
.tab.is-active { color: var(--gold); }
.tab-talk svg { color: var(--teal); }
.tab.is-active.tab-talk svg { filter: drop-shadow(0 0 8px var(--teal)); }

/* ---------- списки ---------- */
.list { display: grid; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px 16px; border-radius: 18px;
  background: rgba(30, 22, 80, .5); border: 1px solid rgba(255, 255, 255, .06);
  transition: transform 160ms var(--ease-out), border-color 200ms ease;
}
button.item:active { transform: scale(.98); }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 700; }
.item-sub { font-size: 13.5px; color: var(--ink2); }
.item.is-locked { opacity: .5; }
.tag { font: 600 12px/1 var(--f-mono); padding: 6px 8px; border-radius: 8px; color: var(--gold); background: rgba(246, 207, 122, .12); border: 1px solid var(--line); white-space: nowrap; }
.tag.teal { color: var(--teal); background: rgba(95, 242, 220, .1); border-color: rgba(95, 242, 220, .3); }
.tag.rose { color: var(--rose); background: rgba(255, 126, 184, .1); border-color: rgba(255, 126, 184, .3); }
.check { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(124, 240, 166, .16); color: var(--ok); flex: none; }
.check svg { width: 15px; height: 15px; }
.bar { height: 6px; margin-top: 8px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; transform-origin: left; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--violet)); }

.word-en { font-weight: 700; font-size: 17px; }
.word-en small { font: 500 12.5px var(--f-mono); color: var(--ink3); margin-left: 8px; }
.word-ru { color: var(--ink2); font-size: 14px; }

.stat3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 14px 10px; text-align: center; }
.stat b { display: block; font: 800 26px/1.15 var(--f-ui); letter-spacing: -.02em; color: var(--gold); }
.stat span { font-size: 12.5px; color: var(--ink2); line-height: 1.25; display: block; }
.search { margin: 14px 0 12px; }

/* ---------- тренировки ---------- */
.run-top { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 12px; }
.run-count { font: 600 14px var(--f-mono); color: var(--ink2); }
.run-count b { color: var(--gold); }
.run-quit { color: var(--ink3); font-weight: 600; font-size: 14px; padding: 8px 4px; }
.progress { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-bottom: 18px; }
.progress i { display: block; height: 100%; width: 100%; transform-origin: left; background: linear-gradient(90deg, var(--gold), var(--rose)); transition: transform 400ms var(--ease-out); border-radius: inherit; }
.q-card { padding: 22px 20px; }
.q-topic { display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 600 12px/1.2 var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--teal); margin-bottom: 12px; }
.q-text { font-size: 22px; line-height: 1.4; font-weight: 600; }
.gap { display: inline-block; min-width: 56px; border-bottom: 2px solid var(--gold); color: transparent; }
.opts { display: grid; gap: 10px; margin-top: 16px; }
.opt {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 15px 16px; border-radius: 16px; font-size: 17px; font-weight: 600;
  background: rgba(30, 22, 80, .55); border: 1px solid rgba(255, 255, 255, .08);
  transition: transform 160ms var(--ease-out), border-color 200ms ease, background-color 200ms ease, opacity 200ms ease;
}
.opt:active { transform: scale(.98); }
.opt-key { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font: 600 13px var(--f-mono); color: var(--ink3); border: 1px solid rgba(255, 255, 255, .12); flex: none; }
.opt.is-ok { border-color: var(--ok); background: rgba(124, 240, 166, .14); }
.opt.is-ok .opt-key { color: var(--ok); border-color: var(--ok); }
.opt.is-bad { border-color: var(--bad); background: rgba(255, 107, 139, .12); animation: shake 320ms var(--ease-out); }
.opt.is-dim { opacity: .45; }
@keyframes shake { 25% { transform: translateX(-5px); } 60% { transform: translateX(4px); } }

.fix { margin-top: 14px; padding: 14px 16px; border-radius: 16px; background: rgba(255, 107, 139, .08); border: 1px solid rgba(255, 107, 139, .3); animation: rise 300ms var(--ease-out) both; }
.fix.is-good { background: rgba(124, 240, 166, .08); border-color: rgba(124, 240, 166, .3); }
.fix-line { font-weight: 700; }
.fix-line s { color: var(--bad); text-decoration-thickness: 2px; }
.fix-line .ok { color: var(--ok); }
.fix-why { color: var(--ink2); font-size: 14.5px; margin-top: 4px; }

.result { text-align: center; padding: 30px 8px; }
.result-big { font: 800 78px/1 var(--f-ui); letter-spacing: -.04em; background: linear-gradient(180deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-big small { font-size: 34px; }
.result-word { font: 700 28px/1.2 var(--f-display); margin-top: 6px; }
.result-sub { color: var(--ink2); margin-top: 6px; }
.result .btn { margin-top: 10px; }

/* ---------- карточки слов ---------- */
.deck { perspective: 1400px; margin: 4px 0 16px; }
.card3d { position: relative; height: 340px; transform-style: preserve-3d; transition: transform 560ms var(--ease-out); cursor: pointer; }
.card3d.is-flipped { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 26px 22px; border-radius: 26px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(246, 207, 122, .16), transparent 60%),
    linear-gradient(165deg, #2a1f72, #120d3c);
  border: 1px solid var(--line2);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .85), inset 0 0 0 6px rgba(246, 207, 122, .04), inset 0 1px 0 rgba(255, 255, 255, .12);
  overflow: hidden;
}
.face::before { /* внутренняя рамка-руна */
  content: ""; position: absolute; inset: 12px; border-radius: 18px; border: 1px dashed rgba(246, 207, 122, .2); pointer-events: none;
}
.face-back { transform: rotateY(180deg); }
.face .shine { position: absolute; inset: -40%; background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .09) 50%, transparent 60%); transform: translateX(-60%); animation: shine 5s var(--ease-in-out) infinite; pointer-events: none; }
@keyframes shine { 60%, 100% { transform: translateX(60%); } }
.card-word { font: 700 44px/1.08 var(--f-display); letter-spacing: .01em; }
.card-ipa { font: 500 15px var(--f-mono); color: var(--teal); margin-top: 10px; }
.card-pos { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink3); margin-top: 6px; }
.card-ru { font: 700 30px/1.2 var(--f-display); color: var(--gold); }
.card-ex { font-size: 16px; color: var(--ink); margin-top: 14px; line-height: 1.45; }
.card-ex button { color: var(--teal); }
.card-mn { margin-top: 14px; font-size: 14px; color: var(--ink2); padding: 10px 14px; border-radius: 12px; background: rgba(255, 126, 184, .08); border: 1px solid rgba(255, 126, 184, .22); }
.card-mn b { display: block; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--rose); margin-bottom: 3px; }
.card-hint { position: absolute; bottom: 20px; font-size: 12.5px; color: var(--ink3); letter-spacing: .04em; }
.card-say { position: absolute; top: 20px; right: 20px; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.grade { display: grid; gap: 3px; padding: 12px 4px; border-radius: 16px; font-weight: 700; font-size: 14.5px; border: 1px solid; transition: transform 160ms var(--ease-out), opacity 200ms ease; }
.grade:active { transform: scale(.95); }
.grade small { font: 500 11.5px var(--f-mono); opacity: .8; }
.grade.g1 { color: var(--bad); border-color: rgba(255, 107, 139, .45); background: rgba(255, 107, 139, .08); }
.grade.g2 { color: var(--ember); border-color: rgba(255, 155, 90, .45); background: rgba(255, 155, 90, .08); }
.grade.g3 { color: var(--teal); border-color: rgba(95, 242, 220, .45); background: rgba(95, 242, 220, .08); }
.grade.g4 { color: var(--gold); border-color: rgba(246, 207, 122, .5); background: rgba(246, 207, 122, .1); }
.grades.is-wait .grade { opacity: .35; pointer-events: none; }

/* ---------- разговор ---------- */
.talk-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; }
.aria { width: 56px; height: 56px; border-radius: 50%; position: relative; flex: none; }
.aria::before { content: ""; position: absolute; inset: -3px; border-radius: 50%; background: conic-gradient(from 0deg, var(--teal), var(--violet), var(--rose), var(--gold), var(--teal)); animation: spin 6s linear infinite; }
.aria::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff 0, #c8f9ff 8%, #6c5bd8 40%, #1a1150 75%); }
.aria.is-thinking::before { animation-duration: 1.4s; }
.talk-name { font: 700 24px/1 var(--f-display); }
.talk-scn { font-size: 13px; color: var(--teal); margin-top: 3px; }
.scn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scn { text-align: left; padding: 14px; display: grid; gap: 4px; transition: transform 160ms var(--ease-out), border-color 200ms ease; }
.scn:active { transform: scale(.97); }
.scn-ico { font-size: 22px; line-height: 1; }
.scn b { font-size: 15px; }
.scn span { font-size: 12.5px; color: var(--ink2); line-height: 1.3; }
.chat { display: grid; gap: 12px; padding-bottom: 8px; }
.msg { max-width: 88%; padding: 12px 15px; border-radius: 20px; animation: pop 260ms var(--ease-out) both; transform-origin: var(--o, left bottom); }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }
.msg-ai { justify-self: start; background: linear-gradient(160deg, rgba(95, 242, 220, .13), rgba(169, 139, 255, .16)); border: 1px solid rgba(95, 242, 220, .28); border-bottom-left-radius: 6px; }
.msg-me { justify-self: end; --o: right bottom; background: linear-gradient(160deg, rgba(246, 207, 122, .2), rgba(226, 165, 72, .12)); border: 1px solid rgba(246, 207, 122, .3); border-bottom-right-radius: 6px; }
.msg-en { font-size: 17px; line-height: 1.45; }
.msg-ru { font-size: 14px; color: var(--ink2); margin-top: 6px; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 6px; }
.msg-tools { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.msg-tools .icon-btn { width: 34px; height: 34px; }
.msg-tools .chip { padding: 6px 11px; font-size: 12.5px; }
.msg-fix { justify-self: end; max-width: 92%; margin-top: -4px; }
.msg-fix .fix { margin-top: 0; padding: 10px 13px; font-size: 14.5px; }
.typing { display: inline-flex; gap: 5px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); animation: blink 1.1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 50% { opacity: .25; transform: translateY(-3px); } }

.talk-dock {
  position: fixed; z-index: 21; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + var(--safe-b)); width: min(528px, calc(100% - 20px));
  padding: 10px; border-radius: 26px;
  background: rgba(16, 12, 46, .9); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--line); box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .8);
}
.hints { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.hints::-webkit-scrollbar { display: none; }
.hints .chip { white-space: nowrap; font-size: 13px; }
.dock-row { display: flex; gap: 10px; align-items: flex-end; }
.dock-row textarea { overflow: hidden; min-height: 50px; max-height: 120px; padding: 13px 14px; border-radius: 18px; resize: none; }
.mic {
  width: 58px; height: 58px; border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center; color: #08261f;
  background: radial-gradient(circle at 35% 30%, #e8fffb, var(--teal) 45%, #1ea793);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25) inset, 0 8px 26px -6px rgba(95, 242, 220, .8);
  transition: transform 160ms var(--ease-out);
}
.mic:active { transform: scale(.93); }
.mic svg { width: 26px; height: 26px; }
.mic.is-live { background: radial-gradient(circle at 35% 30%, #ffe1ee, var(--rose) 45%, #c43c78); color: #3a0018; box-shadow: 0 8px 26px -6px rgba(255, 126, 184, .9); }
.mic.is-live::before, .mic.is-live::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--rose); animation: ripple 1.6s var(--ease-out) infinite; }
.mic.is-live::after { animation-delay: .8s; }
@keyframes ripple { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(1.9); } }
.send { width: 50px; height: 50px; border-radius: 50%; flex: none; display: grid; place-items: center; color: var(--gold); border: 1px solid var(--line2); transition: transform 160ms var(--ease-out); }
.send:active { transform: scale(.92); }
.send svg { width: 22px; height: 22px; }
.screen-talk-pad { height: 150px; }
.live-text { font-size: 14px; color: var(--rose); padding: 0 4px 8px; }
.live-text:empty { display: none; }

/* ---------- произношение и диктант ---------- */
.say-card { padding: 24px 20px; text-align: center; }
.say-text { font: 600 26px/1.4 var(--f-display); }
.say-text .w { display: inline-block; padding: 0 2px; border-radius: 6px; transition: color 300ms ease, background-color 300ms ease; }
.say-text .w.is-ok { color: var(--ok); }
.say-text .w.is-bad { color: var(--bad); background: rgba(255, 107, 139, .12); }
.say-ru { color: var(--ink2); margin-top: 8px; font-size: 15px; }
.say-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.say-big-mic { margin: 22px auto 6px; width: 92px; height: 92px; }
.say-big-mic svg { width: 36px; height: 36px; }
.score-ring { font: 800 42px/1 var(--f-ui); color: var(--gold); margin-top: 6px; }
.heard { font-size: 14px; color: var(--ink2); margin-top: 6px; }

/* ---------- путь ---------- */
.map { position: relative; padding: 10px 0 0; }
.map svg { width: 100%; height: auto; display: block; overflow: visible; }
.map .path-glow { stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 2.4s var(--ease-out) .2s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.map .node-pulse { transform-box: fill-box; transform-origin: center; animation: pulse 2.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(1.35); } }
.map text { font-family: var(--f-display); }
.map text.num, .map text.sub { font-family: var(--f-ui); }
.days14 { display: grid; grid-template-columns: repeat(14, 1fr); gap: 5px; }
.day { aspect-ratio: 1; border-radius: 6px; background: rgba(255, 255, 255, .06); display: grid; place-items: center; font: 500 9.5px var(--f-mono); color: var(--ink3); }
.day.l1 { background: rgba(95, 242, 220, .25); color: var(--ink); }
.day.l2 { background: rgba(95, 242, 220, .5); color: #04211c; }
.day.l3 { background: var(--teal); color: #04211c; box-shadow: var(--glow-teal); }
.relics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.relic { text-align: center; padding: 14px 8px; }
.relic-glyph { font-size: 30px; line-height: 1.1; filter: drop-shadow(0 0 10px rgba(246, 207, 122, .6)); }
.relic b { display: block; font-size: 13px; margin-top: 6px; line-height: 1.2; }
.relic span { display: block; font-size: 11.5px; color: var(--ink3); margin-top: 3px; line-height: 1.25; }
.relic.is-locked { opacity: .38; filter: grayscale(.8); }
.relic.is-locked .relic-glyph { filter: none; }

/* ---------- чтение и письмо ---------- */
.read-text { padding: 20px 18px; font-size: 17.5px; line-height: 1.65; }
.read-text p { margin: 0 0 14px; }
.read-text p:last-child { margin: 0; }
.w-score { display: flex; gap: 16px; align-items: center; }
.w-score b { font: 800 50px/1 var(--f-ui); color: var(--gold); }
.improved { white-space: pre-wrap; line-height: 1.6; }

/* ---------- шторки ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-back { position: absolute; inset: 0; background: rgba(3, 2, 14, .6); opacity: 0; transition: opacity 280ms ease; }
.sheet-panel {
  position: absolute; left: 50%; bottom: 0; width: min(560px, 100%);
  max-height: 88dvh; overflow: auto;
  padding: 10px 18px calc(24px + var(--safe-b));
  border-radius: 28px 28px 0 0;
  background: linear-gradient(180deg, #221a5e, #120d3a);
  border: 1px solid var(--line2); border-bottom: 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .6);
  transform: translate(-50%, 100%);
  transition: transform 420ms var(--ease-drawer);
}
.sheet.is-open .sheet-back { opacity: 1; }
.sheet.is-open .sheet-panel { transform: translate(-50%, 0); }
.sheet.is-closing .sheet-panel { transition-duration: 220ms; }
.grab { width: 44px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .2); margin: 4px auto 14px; }
.sheet h2 { font: 700 28px/1.1 var(--f-display); margin: 0 0 6px; }
.sheet .note { color: var(--ink2); font-size: 14.5px; margin: 0 0 14px; }
.sheet form { display: grid; gap: 10px; }
.profile-pick { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px; border-radius: 18px; text-align: left; border: 1px solid transparent; transition: transform 160ms var(--ease-out), border-color 200ms ease, background-color 200ms ease; }
.profile-pick:active { transform: scale(.98); }
.profile-pick.is-active { border-color: var(--gold); background: rgba(246, 207, 122, .08); }
.profile-pick small { display: block; color: var(--ink2); font-size: 13px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.switch.stack { flex-direction: column; align-items: flex-start; }
.switch input[type=checkbox] { width: auto; accent-color: var(--teal); transform: scale(1.3); }

/* ---------- всплывающее ---------- */
#toast {
  position: fixed; z-index: 60; left: 50%; top: calc(var(--safe-t) + 14px);
  transform: translate(-50%, -140%); opacity: 0;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 16px;
  background: rgba(30, 22, 82, .96); border: 1px solid var(--line2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .6), var(--glow-gold);
  font-weight: 600; font-size: 15px; text-align: center;
  transition: transform 380ms var(--ease-out), opacity 380ms var(--ease-out);
  pointer-events: none;
}
#toast.is-show { transform: translate(-50%, 0); opacity: 1; }

/* искры при успехе */
.spark { position: fixed; z-index: 70; width: 8px; height: 8px; border-radius: 50%; pointer-events: none; background: var(--c, var(--gold)); box-shadow: 0 0 10px var(--c, var(--gold)); }

.empty { text-align: center; color: var(--ink2); padding: 28px 10px; }
.offline-note { font-size: 13.5px; color: var(--ember); margin-top: 8px; }
.fab { position: fixed; z-index: 19; right: max(18px, calc(50% - 262px)); bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); width: 58px; height: 58px; border-radius: 50%; font-size: 30px; font-weight: 400; }

@media (max-width: 380px) {
  .hero { grid-template-columns: 120px 1fr; gap: 12px; padding: 16px 14px; }
  .orb { width: 120px; height: 120px; }
  h1.title { font-size: 30px; }
  .card-word { font-size: 38px; }
  .tab { font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .card3d, .sheet-panel, .tab-glow, #tabbar { transition-duration: .01ms !important; }
  .nebula { animation: none !important; }
  #toast { transition: opacity 200ms ease !important; }
}
