/* ===================== Дизайн-токены (reelfolk-style) ===================== */
:root {
  --bg: #f6f1e7;          /* тёплый кремовый */
  --bg-2: #efe7d6;
  --ink: #1a1714;         /* почти чёрный текст/обводка */
  --ink-soft: #6b6358;
  --ink-mute: #9a9286;
  --card: #fffdf8;        /* поверхность карточек */

  --primary: #ff5a30;     /* оранжево-красный */
  --primary-press: #f04a22;
  --primary-ink: #fffaf6;
  --lime: #cdf24a;        /* лаймовый акцент */
  --blue: #5cc7e8;
  --purple: #6c4cff;

  --radius: 16px;
  --radius-lg: 26px;
  --radius-xl: 34px;
  --border-w: 2px;

  --shadow-sm: 0 6px 0 rgba(26,23,20,0.08);
  --shadow: 0 18px 40px -22px rgba(26,23,20,0.5);
  --pop: 4px 4px 0 var(--ink);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===================== База ===================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; } /* чтобы display у .pill/.modal не перебивал атрибут hidden */
html, body { height: 100%; }
body {
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
#app { min-height: 100dvh; }
.display { font-weight: 800; letter-spacing: -0.03em; line-height: 1.02; }
.muted { color: var(--ink-mute); }
.accent { color: var(--primary); }
.arrow { display: inline-block; transition: transform 0.2s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }

/* ===================== Экраны ===================== */
.screen { display: none; min-height: 100dvh; flex-direction: column; }
.screen.is-active { display: flex; animation: screen-in 0.45s var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ===================== Навигация ===================== */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 18px clamp(16px, 4vw, 44px);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.brand.sm { font-size: 17px; }
.brand-accent { color: var(--primary); }
.brand-logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--primary); color: #fff; border: var(--border-w) solid var(--ink);
}
.brand.sm .brand-logo { width: 26px; height: 26px; }
.nav-links { display: flex; gap: 6px; margin-left: auto; }
.nav-pill {
  font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer;
  padding: 9px 16px; border-radius: 999px; transition: 0.18s var(--ease);
}
.nav-pill:hover { background: rgba(26,23,20,0.06); }
.nav-pill.is-active { background: var(--ink); color: var(--bg); }

/* Бейдж режима у лого */
.mode-badge { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 6px; border: 1.5px solid var(--ink); margin-left: 6px; vertical-align: 2px; background: var(--ink); color: var(--bg); }
.mode-badge[data-mode="prod"] { background: var(--lime); color: var(--ink); }

/* Переключатель режима Админ/Боевая */
.mode-switch { display: inline-flex; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
/* Переключатель режима виден только админу (после входа в защищённый паролем дашборд) */
#mode-switch { display: none; }
body.is-admin #mode-switch { display: inline-flex; }
.ms-opt { font: inherit; font-weight: 700; font-size: 13px; padding: 7px 13px; border: none; background: var(--card); color: var(--ink); cursor: pointer; transition: 0.15s var(--ease); }
.ms-opt.on { background: var(--ink); color: var(--bg); }
.ms-opt:not(.on):hover { background: rgba(26,23,20,0.07); }
/* Боевой режим — прячем админские элементы */
body.prod .admin-only { display: none !important; }
/* …и наоборот: prod-only видно только в боевом режиме */
.prod-only { display: none !important; }
body.prod .prod-only { display: inline-flex !important; }
body.prod .user-box[hidden] { display: none !important; }
.user-box { align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.user-box .uname { display: inline-flex; align-items: center; gap: 6px; }
.user-box .uname::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); border: 1.5px solid var(--ink); }
.btn-logout { font: inherit; font-weight: 700; font-size: 12px; cursor: pointer; padding: 6px 11px; border-radius: 999px; border: 2px solid var(--ink); background: var(--card); color: var(--ink); }
.btn-logout:hover { background: rgba(26,23,20,0.07); }
.talk-nav { border-bottom: var(--border-w) solid var(--ink); }

/* ===================== Кнопки ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  border: var(--border-w) solid var(--ink); border-radius: 14px; padding: 12px 20px;
  transition: transform 0.14s var(--ease), box-shadow 0.18s, background 0.18s;
  background: var(--card); color: var(--ink);
}
.btn:active { transform: translate(1px, 1px); }
.btn-sm { padding: 9px 16px; font-size: 14px; border-radius: 12px; }
.btn-lg { padding: 16px 26px; font-size: 17px; border-radius: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { box-shadow: var(--pop); transform: translate(-1px, -1px); }
.btn-primary:active { background: var(--primary-press); box-shadow: 1px 1px 0 var(--ink); transform: translate(1px, 1px); }
.btn-outline { background: var(--card); }
.btn-outline:hover { box-shadow: var(--pop); transform: translate(-1px, -1px); }

/* ===================== Пилюли / бейджи ===================== */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
  padding: 8px 14px; border-radius: 999px; border: var(--border-w) solid var(--ink);
  background: var(--card);
}
.pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.pill-lime { background: var(--lime); }
.pill-dark { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.hint-inline { font-size: 13px; color: var(--ink-soft); margin-top: 12px; }
.hint-inline.center { text-align: center; }

/* ===================== Лендинг: hero ===================== */
.hero {
  display: grid; grid-template-columns: 1.05fr 0.95fr; align-items: center;
  gap: clamp(28px, 5vw, 80px); max-width: 1520px; width: 100%; margin: 0 auto;
  padding: clamp(28px, 6vh, 80px) clamp(20px, 5vw, 72px);
}
.hero h1 { font-size: clamp(42px, 6.2vw, 94px); margin: 20px 0 22px; }
.lead { font-size: clamp(17px, 1.5vw, 21px); color: var(--ink-soft); line-height: 1.6; max-width: 520px; font-weight: 500; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 26px; }

.trust { display: flex; align-items: center; gap: 14px; }
.avatars { display: flex; }
.avatars span {
  width: 36px; height: 36px; border-radius: 50%; border: var(--border-w) solid var(--ink);
  display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff; margin-left: -10px;
}
.avatars span:first-child { margin-left: 0; }
.trust-txt { font-size: 14px; line-height: 1.3; }
.stars { color: var(--primary); letter-spacing: 1px; }
.trust-txt .muted { display: block; font-size: 13px; }

/* hero-art: коллаж с живым персонажем */
.hero-art { position: relative; display: grid; place-items: center; min-height: 420px; }
.art-blob { position: absolute; border-radius: 50%; filter: blur(8px); z-index: 0; }
.art-blob-1 { width: 280px; height: 280px; background: var(--lime); opacity: 0.55; top: 4%; right: 6%; }
.art-blob-2 { width: 240px; height: 240px; background: var(--blue); opacity: 0.5; bottom: 2%; left: 4%; }
.char-card {
  position: relative; z-index: 1; width: clamp(300px, 30vw, 470px); padding: 24px 24px 20px;
  background: var(--card); border: var(--border-w) solid var(--ink); border-radius: var(--radius-xl);
  box-shadow: var(--pop); transform: rotate(-2deg);
}
.hero-avatar { width: 100%; }
.card-tag {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font-size: 12.5px; font-weight: 700; background: var(--card); color: var(--ink);
  border: var(--border-w) solid var(--ink); border-radius: 999px; padding: 6px 12px;
}
.card-tag .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); border: 1px solid var(--ink); }
.float-badge {
  position: absolute; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; padding: 9px 14px; border-radius: 999px;
  border: var(--border-w) solid var(--ink); box-shadow: var(--pop); white-space: nowrap;
}
.badge-orange { background: var(--primary); color: #fff; top: 8%; right: 0%; transform: rotate(4deg); }
.badge-lime { background: var(--lime); color: var(--ink); bottom: 5%; left: -2%; right: auto; transform: rotate(-3deg); }

/* ===================== Лендинг: как это работает ===================== */
.how { max-width: 1520px; width: 100%; margin: 0 auto; padding: clamp(24px, 4vw, 56px) clamp(20px, 5vw, 72px) 8px; }
.how .pill-dark { margin-bottom: 20px; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.how-card {
  background: var(--card); border: var(--border-w) solid var(--ink); border-radius: var(--radius-lg);
  padding: 26px; transition: 0.22s var(--ease);
}
.how-card:hover { transform: translate(-2px, -2px); box-shadow: var(--pop); }
.how-num {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 18px;
  background: var(--lime); border: var(--border-w) solid var(--ink); margin-bottom: 14px;
}
.how-card:nth-child(2) .how-num { background: var(--blue); }
.how-card:nth-child(3) .how-num { background: var(--primary); color: #fff; }
.how-card h3 { font-size: 18px; margin-bottom: 8px; }
.how-card p { font-size: 14.5px; color: var(--ink-soft); line-height: 1.55; font-weight: 500; }
.foot { text-align: center; font-size: 13px; color: var(--ink-mute); padding: 30px 20px 38px; font-weight: 600; }

/* ===================== Экран настройки ===================== */
.setup { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: clamp(10px, 2vw, 24px) clamp(16px, 4vw, 28px) 56px; display: flex; flex-direction: column; }
.setup-title { font-size: clamp(30px, 5vw, 44px); margin-bottom: 28px; }
.setup-block { margin-bottom: 26px; }
.setup-label { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-mute); font-weight: 800; margin-bottom: 12px; }
.choice-row { display: grid; gap: 14px; }
#lang-row { grid-template-columns: repeat(3, 1fr); }
#mode-row { grid-template-columns: repeat(2, 1fr); }
.choice {
  position: relative; text-align: left; cursor: pointer; font-family: inherit; color: var(--ink);
  background: var(--card); border: var(--border-w) solid var(--ink); border-radius: var(--radius-lg);
  padding: 18px; display: flex; flex-direction: column; gap: 6px; transition: 0.18s var(--ease);
}
.choice:hover:not(.is-disabled) { transform: translate(-2px, -2px); box-shadow: var(--pop); }
.choice.is-selected { background: #fff2ec; box-shadow: var(--pop); }
.choice.is-selected::after { content: "✓"; position: absolute; top: 12px; right: 14px; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 13px; border: var(--border-w) solid var(--ink); }
.choice.is-disabled { opacity: 0.5; cursor: not-allowed; }
.choice-name { font-weight: 800; font-size: 16px; }
.choice-desc { font-size: 13.5px; color: var(--ink-soft); line-height: 1.45; font-weight: 500; }
.choice-tag { position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 800; color: var(--ink); background: var(--lime); padding: 3px 10px; border-radius: 999px; border: 1.5px solid var(--ink); }
.choice-tag.muted { background: var(--bg-2); color: var(--ink-mute); }
.flag { font-size: 30px; }
.mode-emoji { font-size: 28px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { font-family: inherit; font-size: 14px; font-weight: 700; color: var(--ink); cursor: pointer; background: var(--card); border: var(--border-w) solid var(--ink); border-radius: 999px; padding: 10px 16px; transition: 0.16s var(--ease); }
.chip:hover { transform: translateY(-2px); }
.chip.is-selected { background: var(--lime); }
.setup-go { margin-top: 8px; align-self: flex-start; }

/* Выбор персонажа */
.char-row { grid-template-columns: repeat(3, 1fr); }
.char-pick { padding: 12px 10px 14px; align-items: center; text-align: center; gap: 8px; }
.char-pick .choice-name { font-size: 14px; }
.char-prev { width: 100%; height: 102px; overflow: hidden; display: flex; justify-content: center; align-items: flex-start; border-radius: 12px; background: radial-gradient(circle at 50% 40%, #fff, #f3ecdc); }
.char-prev svg { width: 94px !important; height: auto !important; margin-top: 4px; }
.char-prev canvas { max-width: 96px !important; max-height: 96px !important; margin-top: 3px; }
.char-emoji { position: relative; font-size: 44px; align-items: center; justify-content: center; }
.badge-tech { position: absolute; top: 8px; right: 10px; font-size: 10px; font-weight: 800; background: var(--lime); border: 1.5px solid var(--ink); border-radius: 6px; padding: 1px 5px; }

/* Статус загрузки тяжёлых персонажей (Live2D/VRM) */
.avx-status { display: grid; place-items: center; min-height: 240px; text-align: center; color: var(--ink-soft); font-weight: 700; font-size: 14.5px; padding: 24px; line-height: 1.5; }
.avx-status span { display: block; font-weight: 500; font-size: 12.5px; color: var(--ink-mute); margin-top: 8px; }
.avx-error { color: var(--primary); }

/* ===================== Экран разговора ===================== */
.talk { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr minmax(320px, 400px); gap: 16px; padding: 16px clamp(16px, 3vw, 28px) 20px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* — Сцена с персонажем — */
.stage {
  position: relative; overflow: hidden;
  background: var(--card); border: var(--border-w) solid var(--ink); border-radius: var(--radius-xl);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 12px; padding: 22px 24px 18px;
}
/* Центрирующая зона: аватар + статус + субтитр. Занимает всё свободное место и
   обрезает лишнее по высоте — поэтому контролы внизу никогда не перекрываются. */
.stage-center { flex: 1 1 auto; min-height: 0; width: 100%; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.stage-bg { position: absolute; inset: 0; z-index: 0; }
.blob { position: absolute; border-radius: 50%; filter: blur(14px); }
.blob-1 { width: 300px; height: 300px; background: var(--lime); opacity: 0.4; top: -40px; left: -40px; }
.blob-2 { width: 280px; height: 280px; background: var(--blue); opacity: 0.38; bottom: -30px; right: -30px; }
.blob-3 { width: 220px; height: 220px; background: var(--primary); opacity: 0.18; top: 40%; left: 55%; }
.stage-glow { position: absolute; top: 42%; left: 50%; width: 360px; height: 360px; transform: translate(-50%, -50%); border-radius: 50%; filter: blur(26px); opacity: 0.6; pointer-events: none; z-index: 0; background: radial-gradient(circle, rgba(108,76,255,0.35), transparent 65%); transition: background 0.5s; }
.stage-glow[data-state="listening"], .stage-glow[data-state="recording"] { background: radial-gradient(circle, rgba(205,242,74,0.6), transparent 65%); }
.stage-glow[data-state="thinking"], .stage-glow[data-state="loading"] { background: radial-gradient(circle, rgba(92,199,232,0.55), transparent 65%); }
.stage-glow[data-state="speaking"] { background: radial-gradient(circle, rgba(255,90,48,0.4), transparent 65%); }
.avatar-mount { position: relative; z-index: 1; width: clamp(200px, 24vw, 340px); }

.state-chip { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; background: var(--card); border: var(--border-w) solid var(--ink); border-radius: 999px; padding: 8px 16px; }
.state-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-mute); }
.state-chip[data-state="listening"] .state-pulse, .state-chip[data-state="recording"] .state-pulse { background: #7bbf17; box-shadow: 0 0 0 0 rgba(123,191,23,0.6); animation: pulse 1.3s infinite; }
.state-chip[data-state="thinking"] .state-pulse, .state-chip[data-state="loading"] .state-pulse { background: var(--blue); animation: blink 1s infinite; }
.state-chip[data-state="speaking"] .state-pulse { background: var(--primary); box-shadow: 0 0 0 0 rgba(255,90,48,0.6); animation: pulse 1s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes blink { 50% { opacity: 0.35; } }

.subtitle { position: relative; z-index: 1; text-align: center; max-width: 540px; font-size: clamp(17px, 2vw, 22px); font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; min-height: 30px; }

.controls { position: relative; z-index: 2; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 16px calc(6px + env(safe-area-inset-bottom)); }
.mic { width: 72px; height: 72px; border-radius: 50%; cursor: pointer; color: #fff; display: grid; place-items: center; background: var(--primary); border: var(--border-w) solid var(--ink); box-shadow: var(--pop); transition: transform 0.14s var(--ease), background 0.25s; }
.mic:hover:not(:disabled) { transform: translate(-1px, -1px); }
.mic:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.mic:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.mic.is-listening { background: var(--lime); color: var(--ink); animation: mic-pulse 1.2s infinite; }
@keyframes mic-pulse { 0% { box-shadow: var(--pop), 0 0 0 0 rgba(123,191,23,0.5); } 70% { box-shadow: var(--pop), 0 0 0 18px rgba(123,191,23,0); } 100% { box-shadow: var(--pop), 0 0 0 0 rgba(123,191,23,0); } }
.mic.is-busy { background: var(--ink-soft); }
.mic-hint { font-size: 13px; color: var(--ink-soft); font-weight: 600; text-align: center; }

/* Подсказки-чипы «что ответить» + 🆘 */
.suggest-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 36px; max-width: 92%; }
.suggest-row .chip { font-size: 13px; padding: 8px 14px; background: var(--card); }
.suggest-row .chip.sugg:hover { background: var(--lime); }
.suggest-row .sos-chip { background: #ffe9c2; }
.sos { display: flex; gap: 8px; width: min(92%, 520px); }
.sos input { flex: 1; font: inherit; font-weight: 600; font-size: 14px; padding: 10px 14px; border: 2px solid var(--ink); border-radius: 12px; background: var(--card); }

/* «✨ красивее» под репликой ученика */
.msg .fix { font-size: 12px; font-weight: 700; color: #4a8a16; padding: 3px 6px 0; }

/* Итог сессии */
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 12px; }
.sum-cell { background: var(--bg); border: 2px solid var(--ink); border-radius: 14px; padding: 10px; }
.sum-cell b { display: block; font-size: 26px; letter-spacing: -0.02em; }
.sum-label { font-size: 11px; color: var(--ink-mute); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.sum-cap { font-size: 12px; color: var(--ink-mute); font-weight: 700; margin: 8px 0 4px; }
.sum-phr { font-size: 14px; font-weight: 600; text-align: left; margin: 3px 0; }
.sum-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.latency { font-size: 11.5px; padding: 4px 10px; }
.dbg { font-size: 11px; color: var(--ink-mute); font-weight: 600; text-align: center; max-width: 92%; min-height: 13px; font-variant-numeric: tabular-nums; }

/* — Чат-переписка — */
.chat { min-height: 0; display: flex; flex-direction: column; background: var(--card); border: var(--border-w) solid var(--ink); border-radius: var(--radius-xl); overflow: hidden; }
.chat-head { display: flex; align-items: baseline; gap: 8px; padding: 16px 18px; border-bottom: var(--border-w) solid var(--ink); }
.chat-title { font-weight: 800; font-size: 17px; }
.chat-sub { font-size: 12px; color: var(--ink-mute); font-weight: 600; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.chat-log:empty::before { content: "Здесь появится вся переписка — твои реплики и ответы тутора."; color: var(--ink-mute); font-size: 13.5px; font-weight: 500; line-height: 1.5; margin: auto; text-align: center; max-width: 220px; }
body.prod .chat-log:empty::before { content: "Your conversation will appear here — your lines and the tutor's replies."; }
.chat-log::-webkit-scrollbar { width: 8px; }
.chat-log::-webkit-scrollbar-thumb { background: rgba(26,23,20,0.16); border-radius: 99px; }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 86%; animation: msg-in 0.3s var(--ease); }
.msg-user { align-self: flex-end; align-items: flex-end; }
.msg-tutor { align-self: flex-start; align-items: flex-start; }
.who { font-size: 11px; font-weight: 800; color: var(--ink-mute); padding: 0 6px; }
.bubble { padding: 10px 14px; border-radius: 16px; border: var(--border-w) solid var(--ink); font-size: 14.5px; font-weight: 600; line-height: 1.4; word-break: break-word; }
.msg-tutor .bubble { background: #fff; border-bottom-left-radius: 5px; }
.msg-user .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===================== Тост и модалка ===================== */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: var(--bg); border: var(--border-w) solid var(--ink); padding: 13px 20px; border-radius: 14px; font-size: 14px; font-weight: 700; box-shadow: var(--pop); z-index: 50; max-width: 90vw; text-align: center; animation: screen-in 0.3s var(--ease); }
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(26,23,20,0.55); backdrop-filter: blur(5px); padding: 20px; animation: screen-in 0.3s var(--ease); }
.modal[hidden] { display: none; }
.modal-card { background: var(--card); border: var(--border-w) solid var(--ink); border-radius: var(--radius-lg); padding: 36px 32px; max-width: 380px; text-align: center; box-shadow: var(--pop); }
.modal-emoji { font-size: 44px; margin-bottom: 14px; }
.modal-card h3 { font-size: 23px; margin-bottom: 10px; }
.modal-card p { font-size: 15px; color: var(--ink-soft); line-height: 1.6; margin-bottom: 24px; font-weight: 500; }

/* ===================== Современные «переливающиеся» акценты ===================== */
/* Плавный градиентный акцент в заголовке */
.accent {
  background: linear-gradient(100deg, #ff5a30 0%, #ff3d8b 34%, #6c4cff 68%, #ff5a30 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: flow 7s ease-in-out infinite;
}
@keyframes flow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* Радужный переливающийся ореол ЗА белой карточкой (внешнее свечение) */
.char-glow {
  position: absolute; z-index: 0; top: 50%; left: 50%;
  width: clamp(330px, 36vw, 540px); height: clamp(440px, 56vh, 620px); border-radius: 48px;
  filter: blur(34px); opacity: 0.8; pointer-events: none;
  background: conic-gradient(from 0deg, #ff5a30, #cdf24a, #5cc7e8, #6c4cff, #ff3d8b, #ff5a30);
  transform: translate(-50%, -50%); animation: spinc 9s linear infinite;
}
@keyframes spinc { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* Блик-«пробежка» по основной кнопке */
.btn-primary { position: relative; overflow: hidden; isolation: isolate; }
.btn-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -70%; width: 42%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.5), transparent);
  transform: skewX(-18deg); animation: shine 4s ease-in-out infinite;
}
@keyframes shine { 0% { left: -70%; } 55%, 100% { left: 160%; } }

/* «Аврора»: дрейф + смена оттенка у размытых пятен */
.art-blob, .blob { animation: drift 13s ease-in-out infinite alternate; will-change: transform, filter; }
.art-blob-2, .blob-2 { animation-duration: 16s; animation-delay: -5s; }
.blob-3 { animation-duration: 19s; animation-delay: -9s; }
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1);      filter: blur(16px) hue-rotate(0deg); }
  100% { transform: translate(20px, -16px) scale(1.14); filter: blur(22px) hue-rotate(45deg); }
}

/* ===================== Адаптив ===================== */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-copy { order: 2; display: flex; flex-direction: column; align-items: center; }
  .hero-art { order: 1; min-height: 320px; }
  .lead { margin-left: auto; margin-right: auto; }
  .hero-cta, .trust { justify-content: center; }
  .how-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }

  /* разговор: персонаж сверху, чат снизу */
  .talk { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1.1fr) minmax(0, 1fr); }
  .stage { padding-bottom: 16px; }
  .avatar-mount { width: clamp(150px, 38vw, 220px); }
}
@media (max-width: 560px) {
  #lang-row, #mode-row { grid-template-columns: 1fr; }
  .float-badge { font-size: 11.5px; padding: 7px 11px; }
  .char-card { width: clamp(220px, 70vw, 300px); }
  .card-tag { display: none; }
  .char-row { grid-template-columns: repeat(2, 1fr); } /* чтобы не перекрывалось с бейджами на узком экране */
}
/* ===================== Большие мониторы (≥1800px) ===================== */
/* На широких экранах интерфейс не «концентрируется в центре», а растёт:
   шире контейнеры, крупнее персонаж, заголовки, чат. */
@media (min-width: 1800px) {
  .nav { padding-left: 56px; padding-right: 56px; }

  /* лендинг */
  .hero { max-width: 2080px; gap: 96px; }
  .hero h1 { font-size: 110px; }
  .lead { font-size: 22px; max-width: 620px; }
  .hero-cta .btn-lg { font-size: 19px; padding: 18px 32px; }
  .char-card { width: 620px; }
  .char-glow { width: 700px; height: 800px; }
  .float-badge { font-size: 15px; padding: 11px 18px; }
  .art-blob-1 { width: 380px; height: 380px; }
  .art-blob-2 { width: 330px; height: 330px; }
  .how { max-width: 2080px; }
  .how-card { padding: 34px; }
  .how-card h3 { font-size: 21px; }
  .how-card p { font-size: 16px; }

  /* экран настройки */
  .setup { max-width: 1080px; }
  .choice-name { font-size: 18px; }
  .char-prev { height: 128px; }
  .char-prev svg { width: 116px !important; }
  .char-prev canvas { max-width: 120px !important; max-height: 120px !important; }

  /* экран разговора */
  .talk { max-width: 2080px; grid-template-columns: 1fr minmax(420px, 560px); gap: 24px; }
  .avatar-mount { width: clamp(320px, 22vw, 580px); }
  .stage { gap: 24px; }
  .stage-glow { width: 560px; height: 560px; }
  .blob-1 { width: 460px; height: 460px; }
  .blob-2 { width: 420px; height: 420px; }
  .blob-3 { width: 340px; height: 340px; }
  .state-chip { font-size: 16px; padding: 10px 20px; }
  .subtitle { font-size: 30px; max-width: 820px; }
  .mic { width: 92px; height: 92px; }
  .mic-hint { font-size: 15px; }
  .chat-head { padding: 20px 22px; }
  .chat-title { font-size: 20px; }
  .chat-log { padding: 20px; gap: 16px; }
  .bubble { font-size: 16.5px; padding: 12px 16px; }
  .who { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ============ Экран входа / регистрации (боевой режим) ============ */
.auth { flex: 1; display: grid; place-items: center; padding: clamp(16px, 4vw, 40px) 18px 56px; }
.auth-card { width: 100%; max-width: 420px; background: var(--card); border: var(--border-w) solid var(--ink); border-radius: 24px; box-shadow: var(--pop); padding: clamp(22px, 4vw, 34px); text-align: center; }
.auth-emoji { font-size: 40px; line-height: 1; }
.auth-title { font-size: clamp(24px, 4vw, 30px); margin: 12px 0 4px; }
.auth-sub { color: var(--ink-soft); font-weight: 600; font-size: 14px; margin-bottom: 20px; }
.auth-tabs { display: inline-flex; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; margin-bottom: 22px; }
.auth-tab { font: inherit; font-weight: 700; font-size: 14px; padding: 9px 22px; border: none; background: var(--card); color: var(--ink); cursor: pointer; transition: 0.15s var(--ease); }
.auth-tab.on { background: var(--ink); color: var(--bg); }
.auth-tab:not(.on):hover { background: rgba(26,23,20,0.07); }
.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field > span { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-mute); }
.auth-field input { font: inherit; font-size: 15px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 12px; background: var(--bg); color: var(--ink); }
.auth-field input:focus { outline: none; box-shadow: 0 0 0 3px var(--lime); }
.auth-error { background: #ffe3da; border: 2px solid var(--primary); color: #a3260c; font-weight: 700; font-size: 13.5px; padding: 9px 12px; border-radius: 12px; margin: 0; }
.auth-go { width: 100%; justify-content: center; margin-top: 4px; }
.google-btn { display: flex; justify-content: center; margin: 4px 0 2px; min-height: 40px; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--ink-mute); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; margin: 16px 0 4px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 2px; background: rgba(26,23,20,0.12); }

/* ============ Панель: продолжить диалоги + прогресс ============ */
.home-panel { display: grid; grid-template-columns: 1fr 230px; gap: 16px; margin-bottom: 28px; }
.home-h { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-mute); font-weight: 800; margin-bottom: 12px; }
.resume-list { display: flex; flex-direction: column; gap: 10px; }
.resume-empty { color: var(--ink-soft); font-weight: 600; font-size: 14px; }
.resume-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; background: var(--card); border: 2px solid var(--ink); border-radius: 14px; padding: 11px 14px; cursor: pointer; box-shadow: 2px 2px 0 var(--ink); transition: transform 0.14s var(--ease), background 0.18s; }
.resume-card:hover { background: var(--lime); transform: translate(-1px, -1px); }
.rc-emoji { font-size: 22px; }
.rc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rc-title { font-weight: 800; font-size: 15px; }
.rc-sub { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-go { color: var(--primary); font-weight: 800; font-size: 13px; }
.home-stats { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 14px 16px; align-self: start; }
.stat-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(26,23,20,0.1); }
.stat-row:last-child { border-bottom: none; }
.stat-ic { font-size: 20px; width: 24px; text-align: center; }
.stat-row b { font-size: 22px; letter-spacing: -0.02em; min-width: 1.4em; }
.stat-lbl { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
@media (max-width: 760px) { .home-panel { grid-template-columns: 1fr; gap: 12px; } }
