/* Дизайн-система «Sabai»: закатный коралл + море, тёплый песок / тропическая ночь */
:root {
    --primary: #FF5A3C;
    --primary-dark: #E8452A;
    --accent: #12A594;
    --grad-sunset: linear-gradient(135deg, #FF5A3C, #FF9D2E);
    --grad-sea: linear-gradient(135deg, #12A594, #0E96B0);
    --bg: #F6F1E7;
    --card: #ffffff;
    --text: #211815;
    --muted: #8C8074;
    --border: #E8DFCF;
    --bub-me: #FFE3D4;
    --bub-ai: #F2EDE3;
    --opt-bg: #FFFFFF;
    --opt-f: #0E9F8C;
    --opt-n: #555;
    --expl: #666;
    --translit: #888;
}

html.dark {
    --primary: #FF8E6E;
    --bg: #101617;
    --card: #1A2224;
    --text: #F0EAE2;
    --muted: #939C99;
    --border: #2A3437;
    --bub-me: #4E2C20;
    --bub-ai: #242D30;
    --opt-bg: #232E30;
    --opt-f: #2BD9C2;
    --opt-n: #B4ADA2;
    --expl: #A89F93;
    --translit: #948D82;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100%;
    overflow: hidden; /* скроллятся только внутренние области — шторка не уезжает */
    overscroll-behavior: none;
}

#app { height: 100%; }

.loading { display: flex; align-items: center; justify-content: center; height: 100vh; color: var(--muted); }

.app-shell { max-width: 640px; margin: 0 auto; height: 100dvh; display: flex; flex-direction: column; }

h1 { font-size: 22px; margin: 0 0 12px; }
/* FocusOnNavigate (App.razor) ставит фокус на h1 при загрузке/навигации — из-за этого после обновления
   страницы виден обвод фокуса на заголовке. Гасим обвод при программном фокусе, но оставляем его
   для навигации с клавиатуры (:focus-visible), чтобы не ломать доступность. */
h1:focus:not(:focus-visible) { outline: none; }
.row { display: flex; align-items: center; gap: 6px; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.err-text { color: #e11d48; font-size: 14px; margin-top: 6px; }
.chev { color: var(--muted); }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 10px;
}

input, select, textarea, button { font-size: 16px; font-family: inherit; color: var(--text); }

input[type=email], input[type=password], input[type=text], textarea, select {
    width: 100%;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    margin-top: 6px;
}
input[type=range] { width: 100%; margin: 6px 0 2px; accent-color: var(--primary); }
textarea { resize: vertical; }
label { font-size: 13px; color: var(--muted); display: block; margin-top: 12px; }
.switch-row { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text); margin-top: 12px; }
.switch-row input { width: auto; margin: 0; accent-color: var(--primary); }

.btn-primary {
    background: var(--grad-sunset); color: #fff; border: none; border-radius: 12px;
    padding: 12px 18px; cursor: pointer; font-weight: 700;
    box-shadow: 0 4px 14px rgba(255,90,60,.28);
}
.btn-primary:disabled { opacity: .5; cursor: default; }
.btn-primary.block { width: 100%; margin-top: 8px; }
/* Есть несохранённые настройки — кнопка становится рыжей (как в приложении) */
.btn-primary.dirty { background: #E67E22; }
.btn-ghost { background: transparent; color: var(--primary); border: none; cursor: pointer; padding: 8px; text-decoration: none; display: inline-block; }
.btn-ghost.danger { color: #e11d48; }
.btn-mini {
    background: var(--grad-sea); color: #fff; border: none; border-radius: 12px;
    padding: 6px 18px; cursor: pointer; margin-top: 8px;
}
.icon-btn { background: transparent; border: none; font-size: 18px; cursor: pointer; padding: 6px 10px; color: var(--text); text-decoration: none; }

/* ===== Чат ===== */
.chat-page { display: flex; flex-direction: column; height: 100dvh; padding: 6px; position: relative; }

.drawer {
    display: flex; align-items: center; gap: 8px;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 6px 10px 6px 50px; margin-bottom: 6px;
}
.credits { font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap; }
.prompt-chip {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    background: var(--bg); border: 1px solid var(--border); border-radius: 19px;
    padding: 8px 14px; cursor: pointer; text-align: left; font-size: 14px;
}
.drawer-toggle {
    position: absolute; top: 10px; left: 12px; z-index: 30;
    width: 42px; height: 42px; border: none; border-radius: 10px;
    background: transparent; font-size: 20px; cursor: pointer; opacity: .6; color: var(--text);
}

.feed-wrap { flex: 1; position: relative; min-height: 0; }
.feed {
    position: absolute; inset: 0; overflow-y: auto; background: var(--card);
    border-radius: 20px; padding: 8px;
}
.feed-inner { display: flex; flex-direction: column; gap: 8px; }

.bub { max-width: 86%; padding: 8px 12px; border-radius: 16px; line-height: 1.35; }
.bub.me { align-self: flex-end; background: var(--bub-me); border-bottom-right-radius: 6px; }
.bub.ai { align-self: flex-start; background: var(--bub-ai); border-bottom-left-radius: 6px; }
.bub.muted { color: var(--muted); }
.user-img { max-width: 200px; max-height: 160px; border-radius: 10px; display: block; margin-bottom: 4px; }

.tr-text { flex: 1; font-size: 1.06em; }
.translit { color: var(--translit); font-size: .82em; }
.expl { color: var(--expl); font-size: .82em; }

.opt {
    display: flex; align-items: flex-start; gap: 4px;
    background: var(--opt-bg); border-radius: 8px; padding: 8px 10px; margin-top: 6px;
}
.opt-text { flex: 1; min-width: 0; cursor: pointer; }
.opt-f { color: var(--opt-f); }
.opt-n { color: var(--opt-n); font-size: .82em; }

.spk { background: transparent; border: none; font-size: 18px; cursor: pointer; padding: 2px 6px; }
.swipeable { touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* Диктовка поверх чата */
.dictation {
    position: absolute; inset: 0;
    background: var(--card); border: 2px solid var(--primary); border-radius: 20px;
    display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto;
}
.dict-text { text-align: center; font-weight: 500; word-break: break-word; }
.dict-text.hint { opacity: .4; } /* блеклая подсказка «Говорите…» до первых слов */

/* Нижняя панель */
.bottom { padding-top: 6px; }
.mode-switch {
    display: flex; gap: 4px; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 8px;
}
.mode-switch button {
    flex: 1; height: 40px; border: none; border-radius: 9px; font-weight: 700; font-size: 15px;
    background: transparent; color: var(--muted); cursor: pointer;
}
.mode-switch button.active { background: var(--card); color: #FF5A3C; box-shadow: 0 1px 6px rgba(33,24,21,.12); }
html.dark .mode-switch button.active { background: #2E3C40; color: #fff; }
/* 🤖 в диктовке на родном: иконка + постоянная мелкая подпись */
.lang-btn.askd { background: #12A594; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.askd-ico { font-size: 24px; line-height: 1; }
.askd-cap { font-size: 10px; font-weight: 400; opacity: .9; }

/* 🤖 в пилюле чата: тумблер с постоянной мелкой подписью */
.ask-pill {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    min-width: 52px; height: 42px; border: none; border-radius: 12px;
    background: transparent; color: var(--muted); cursor: pointer; padding: 2px 6px;
}
.ask-pill span { font-size: 15px; line-height: 1; }
.ask-pill .cap { font-size: 9px; }
.ask-pill.on { background: #12A594; color: #fff; }

/* Переворот текста для собеседника напротив */
.flip { transform: rotate(180deg); }

.lang-bar { display: flex; gap: 10px; height: 76px; }
.lang-btn {
    flex: 1; font-size: 24px; font-weight: 700; border: none; border-radius: 22px;
    background: var(--grad-sunset); color: #fff; cursor: pointer;
    box-shadow: 0 6px 18px rgba(255,90,60,.30);
}
.lang-btn:active { transform: scale(.98); }
.lang-btn.del { background: var(--bub-ai); color: var(--text); font-size: 30px; box-shadow: none; }
.lang-btn.done { background: var(--grad-sea); font-size: 32px; box-shadow: 0 6px 18px rgba(18,165,148,.30); }

.manual-bar { display: flex; flex-direction: column; gap: 8px; }
.img-preview { position: relative; width: 92px; }
.img-preview img { width: 92px; height: 92px; object-fit: cover; border-radius: 14px; display: block; }
.img-x {
    position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 13px;
    border: none; background: rgba(0,0,0,.7); color: #fff; font-size: 12px; cursor: pointer;
}
.input-pill {
    display: flex; align-items: flex-end; gap: 4px;
    background: var(--card); border: 1px solid var(--border); border-radius: 26px; padding: 5px 6px;
}
.input-pill textarea {
    flex: 1; border: none; background: transparent; margin: 0; padding: 10px 4px;
    max-height: 150px; resize: none; outline: none;
}
.attach { width: 42px; height: 42px; border: none; border-radius: 21px; background: transparent; font-size: 19px; cursor: pointer; }
.send {
    width: 42px; height: 42px; border: none; border-radius: 21px;
    background: var(--grad-sunset); color: #fff; font-size: 22px; font-weight: 700; cursor: pointer;
}
.send:disabled { opacity: .45; }

/* Оверлеи */
.overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 50;
    display: flex; align-items: center; justify-content: center;
}
.sheet {
    background: var(--card); border-radius: 16px; padding: 12px;
    width: min(560px, calc(100% - 28px)); max-height: 70dvh; overflow-y: auto;
}
.overlay .sheet.top { align-self: flex-start; margin-top: 66px; }
.overlay .sheet.bottom { align-self: flex-end; width: 100%; max-width: 640px; border-radius: 22px 22px 0 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

.prompt-row {
    display: block; width: 100%; text-align: left; background: transparent; border: none;
    padding: 12px 14px; border-radius: 10px; cursor: pointer; font-size: 15px; color: var(--text);
    text-decoration: none;
}
.prompt-row:hover { background: var(--bg); }
.prompt-row.sel { background: var(--bub-me); font-weight: 700; }

.buy-btn {
    display: block; width: 100%; height: 52px; margin-top: 10px; border: none; border-radius: 14px;
    background: var(--grad-sunset); color: #fff; font-size: 17px; font-weight: 700; cursor: pointer;
    box-shadow: 0 4px 14px rgba(255,90,60,.28);
}

/* Озвучка (караоке) */
/* Говорилка и диктовка — на весь экран, фиксированного размера; текст скроллится внутри (.speak-text: flex+overflow) */
.speak-card {
    background: var(--card); border: none; border-radius: 0;
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
    width: 100%; height: 100%; max-height: none;
    display: flex; flex-direction: column; gap: 14px;
}
.speak-text { flex: 1; overflow-y: auto; text-align: center; font-weight: 700; word-break: break-word; }
.speak-text .spoken { color: var(--primary); }
.speak-text.hint { opacity: .4; } /* блёклая «Говорите…» до первых слов — как в приложении */
.speak-btns { display: flex; gap: 16px; justify-content: center; }
.speak-btn {
    width: 96px; height: 64px; border: none; border-radius: 16px;
    background: var(--grad-sea); color: #fff; font-size: 24px; cursor: pointer;
}
.speak-btn:disabled { opacity: .6; }
.speak-voice {
    align-self: center; font-size: 14px; color: var(--muted); cursor: pointer;
    padding: 5px 12px; border: 1px solid var(--border); border-radius: 999px;
    white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.speak-voice:active { background: var(--border); }
/* Вход через внешние аккаунты — круглые кнопки-логотипы */
.oauth-or { text-align: center; color: var(--muted); font-size: 13px; margin: 14px 0 8px; }
.oauth-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.btn-soc {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; transition: transform .15s;
}
.btn-soc:active { transform: scale(.92); }
.btn-soc svg { width: 24px; height: 24px; }
.btn-soc span { font-weight: 800; font-size: 20px; }
.btn-soc.ya { background: #FC3F1D; } .btn-soc.ya span { color: #fff; }
.btn-soc.vk { background: #0077FF; }
.btn-soc.tid { background: #FFDD2D; } .btn-soc.tid span { color: #333; }
.btn-soc.goo { background: #fff; border: 1px solid #dadce0; }
.btn-soc.fb { background: #1877F2; }
.btn-soc.tg { background: #26A5E4; }
.btn-soc.line { background: #06C755; } .btn-soc.line span { color: #fff; }

/* Кнопка «?» рядом с подписью параметра — открывает описание */
.help-q {
    display: inline-flex; align-items: center; justify-content: center;
    width: 17px; height: 17px; border-radius: 50%; margin-left: 4px;
    background: var(--muted); color: #fff; font-size: 12px; font-weight: 700;
    cursor: pointer; user-select: none; vertical-align: middle;
}
html.dark .help-q { background: #3A4649; }
.help-q:active { background: var(--primary); }
.help-text { margin: 6px 2px 2px; font-size: 15px; line-height: 1.45; }

/* Иностранная фраза внутри ответа ИИ: тапабельная, с 🔊, озвучивается говорилкой */
.frag-f { color: var(--primary); cursor: pointer; }
.frag-f:active { opacity: .7; }

/* Галочка «перевернуть для собеседника» в говорилке/распознавалке */
.flip-check {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 14px; color: var(--muted); cursor: pointer; user-select: none; margin-top: 6px;
}
.flip-check input { width: 18px; height: 18px; accent-color: var(--primary); }
/* В распознавалке текст остаётся по центру, галочка прижата к низу */
.dictation .flip-check { position: absolute; left: 0; right: 0; bottom: 10px; margin: 0; }

/* Всплывающие списания и тосты */
.pops { position: fixed; top: 14px; right: 14px; z-index: 90; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.coin-pop {
    background: #f2b93b; color: #5b3a00; font-weight: 700; border-radius: 14px;
    padding: 6px 12px; animation: pop-fade 2.2s forwards;
}
.toast {
    background: rgba(20,20,20,.9); color: #fff; border-radius: 12px; padding: 8px 16px; font-size: 14px;
    animation: pop-fade 1.8s forwards;
}
@keyframes pop-fade {
    0% { opacity: 0; transform: translateY(-6px); }
    12% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* Настройки / промпты / логин */
.settings-page { padding: 0 14px 14px; overflow-y: auto; height: 100dvh; }
/* Шапка + кнопка сохранения закреплены сверху при прокрутке */
.settings-top {
    position: sticky; top: 0; z-index: 20;
    background: var(--bg); margin: 0 -14px; padding: 12px 14px 6px;
}
.settings-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.settings-head h1 { margin: 0; }
/* Современная круглая кнопка «назад» */
.back-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; flex: 0 0 40px; border-radius: 50%;
    background: var(--card); border: 1px solid var(--border); color: var(--text);
    text-decoration: none; transition: background .15s, transform .05s;
}
.back-btn:hover { background: var(--border); }
.back-btn:active { transform: scale(.92); }

/* Ступенчатый ввод чисел кнопками −/+ (как в приложении) */
.stepper { display: flex; align-items: center; gap: 12px; margin: 2px 0 6px; }
.step-btn {
    width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px;
    border: 1px solid var(--border); background: var(--card); color: var(--text);
    font-size: 24px; line-height: 1; cursor: pointer; user-select: none;
}
.step-btn:active { background: var(--primary); color: #fff; }
.step-val { min-width: 56px; text-align: center; font-size: 17px; font-weight: 700; }
.save-bar { background: var(--bg); }
.link-card { display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: var(--text); margin-top: 6px; }
.prompt-card { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.prompt-card.sel { border-color: var(--primary); }
.prompt-card-name { flex: 1; cursor: pointer; }
.sel-mark { color: var(--primary); margin-left: 8px; }

/* Списки выбора (нейросети/голоса): заголовок вендора с логотипом, строки с выбором */
.lc-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lc-left svg { width: 18px; height: 18px; flex: 0 0 18px; }
.pick-list { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.pick-head { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); margin: 8px 2px 2px; }
.pick-head svg { width: 18px; height: 18px; flex: 0 0 18px; }
.pick-row {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px;
    border-radius: 10px; background: var(--card); border: 1px solid var(--border);
    cursor: pointer; font-size: 15px;
}
.pick-row.sel { border-color: var(--primary); color: var(--primary); font-weight: 700; }
.pick-row .pick-price { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 400; }
.pick-row .sel-mark { color: var(--primary); }
.pick-row:not(:has(.pick-price)) .sel-mark { margin-left: auto; }

.login-page { padding: 24px 16px; }
.auth-tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 12px; }
.auth-tabs button { flex: 1; height: 38px; border: none; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.auth-tabs button.active { background: var(--grad-sunset); color: #fff; }

/* Панель ошибок Blazor: по умолчанию скрыта, фреймворк показывает её сам при сбое */
#blazor-error-ui {
    display: none;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 2000;
    background: #FFF3CD; color: #111; padding: 10px 44px 10px 14px; font-size: 14px;
    box-shadow: 0 -1px 6px rgba(0,0,0,.2);
}
#blazor-error-ui .dismiss { position: absolute; right: 12px; top: 8px; cursor: pointer; text-decoration: none; color: #111; }

/* Поле поиска по настройкам */
.settings-search-input{width:100%;box-sizing:border-box;margin-top:8px;padding:9px 12px;border:1px solid var(--line,#e2ddd6);border-radius:10px;font-size:15px;background:var(--card,#fff);color:inherit;outline:none}
.settings-search-input:focus{border-color:var(--primary,#e0592f)}


/* Контекстное меню «Скопировать» по долгому нажатию на иностранную фразу */
.ctx-backdrop { position: fixed; inset: 0; z-index: 9998; background: transparent; }
.ctx-menu { position: fixed; z-index: 9999; transform: translate(-8px, -115%);
  background: #fff; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.28);
  padding: 4px; min-width: 132px; }
.ctx-menu.below { transform: translate(-8px, 12px); }
.ctx-item { display: block; width: 100%; text-align: left; border: none; background: transparent;
  padding: 11px 18px; font-size: 15px; color: #12181a; cursor: pointer; border-radius: 8px; white-space: nowrap; }
.ctx-item:hover, .ctx-item:active { background: #f0f0f0; }
@media (prefers-color-scheme: dark) {
  .ctx-menu { background: #263133; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
  .ctx-item { color: #e8eceb; }
  .ctx-item:hover, .ctx-item:active { background: #33413f; }
}


/* Официальный сайт — ссылка вверху настроек */
.official-site { padding: 4px 2px 10px; font-size: 14px; color: #6b7674; }
.official-site a { color: #0E9F8C; text-decoration: none; font-weight: 600; }
.official-site a:hover { text-decoration: underline; }
@media (prefers-color-scheme: dark) { .official-site { color: #9aa5a3; } }

/* ==================== Тренажёр произношения (как в приложении) ==================== */
.tr2-page { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 6px; padding: 6px; box-sizing: border-box; background: var(--bg); color: var(--text); max-width: 720px; margin: 0 auto; }
.tr2-menu { position: absolute; top: 10px; left: 12px; z-index: 20; background: transparent; border: none; font-size: 22px; opacity: .6; cursor: pointer; color: var(--text); }
.tr2-drawer { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 6px 10px 6px 50px; }
.tr2-credits { font-weight: 700; font-size: 15px; cursor: pointer; }
.tr2-spacer { flex: 1; }
.tr2-mode { background: var(--bub-ai); border-radius: 12px; padding: 3px; display: flex; gap: 3px; }
.tr2-mode-btn { width: 46px; height: 34px; border: none; border-radius: 8px; background: transparent; font-size: 16px; cursor: pointer; }
.tr2-mode-btn.active { background: var(--card); }
.tr2-gear { font-size: 20px; text-decoration: none; }

.tr2-card { flex: 1; overflow-y: auto; background: var(--card); border-radius: 20px; padding: 12px; text-align: center; }
.tr2-foreign { font-size: 32px; font-weight: 700; margin-top: 28px; word-wrap: break-word; }
.tr2-translit { font-size: 15px; color: #12A594; margin-top: 4px; }
.tr2-native { font-size: 16px; color: var(--muted); margin-top: 8px; }
.tr2-status { font-size: 15px; opacity: .7; color: var(--muted); margin-top: 14px; }
.tr2-rate-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.tr2-word-btns { display: flex; gap: 10px; margin-top: 12px; }
.tr2-word-btns button { flex: 1; height: 52px; border: none; border-radius: 16px; font-size: 16px; font-weight: 600; cursor: pointer; }
.tr2-word-btns .listen { background: var(--bub-ai); color: var(--text); }
.tr2-word-btns .repeat { background: linear-gradient(135deg,#FF5A3C,#E8452A); color: #fff; }
.tr2-word-btns button:disabled { opacity: .55; }
.tr2-score { font-size: 44px; font-weight: 700; margin-top: 8px; }
.tr2-score-details { font-size: 13px; color: var(--muted); }
.tr2-words { display: flex; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.tr2-word { font-size: 27px; font-weight: 700; margin: 2px 5px; cursor: pointer; user-select: none; }
.tr2-word.omit { text-decoration: line-through; }
.tr2-advice { text-align: left; font-size: 15px; margin: 10px 4px; line-height: 1.5; }
.tr2-advice h4 { margin: 8px 0 4px; font-size: 15px; }
.tr2-advice ul { margin: 4px 0; padding-left: 20px; }
.tr2-advice p { margin: 6px 0; }

.tr2-icons { display: flex; gap: 8px; height: 56px; }
.tr2-icon { flex: 1; border: none; border-radius: 18px; font-size: 22px; cursor: pointer; background: var(--bub-ai); color: var(--text); }
.tr2-icon.sea { background: linear-gradient(135deg, #12A594, #0E96B0); color: #fff; }
.tr2-icon.teal { background: #12A594; color: #fff; }
.tr2-record { height: 76px; border: none; border-radius: 22px; font-size: 19px; font-weight: 700; color: #fff; cursor: pointer; background: linear-gradient(135deg, #FF5A3C, #FF9D2E); }

.tr2-fireworks { position: fixed; inset: 0; pointer-events: none; z-index: 90; }
.tr2-fireworks span { position: absolute; font-size: 46px; animation: tr2boom 1.7s ease-out forwards; }
.tr2-fireworks span:nth-child(1) { left: 12%; top: 65%; animation-delay: 0s; }
.tr2-fireworks span:nth-child(2) { left: 78%; top: 60%; animation-delay: .15s; }
.tr2-fireworks span:nth-child(3) { left: 45%; top: 70%; animation-delay: .3s; }
.tr2-fireworks span:nth-child(4) { left: 25%; top: 75%; animation-delay: .45s; }
.tr2-fireworks span:nth-child(5) { left: 62%; top: 72%; animation-delay: .6s; }
.tr2-fireworks span:nth-child(6) { left: 88%; top: 68%; animation-delay: .75s; }
@keyframes tr2boom { 0% { transform: translateY(0) scale(.4); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(-260px) scale(1.5); opacity: 0; } }
.tr2-coin { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-weight: 700; z-index: 95; animation: tr2coin 1.3s ease-out forwards; }
@keyframes tr2coin { 0% { opacity: 0; transform: translate(-50%, 6px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -30px); } }

.tr2-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; }
.tr2-overlay.dark { background: rgba(0,0,0,.62); flex-direction: column; }
.tr2-panel { background: var(--card); border: 1px solid var(--border); border-radius: 24px; padding: 14px; width: 100%; max-width: 560px; max-height: 82vh; overflow-y: auto; }
.tr2-panel.small { max-width: 420px; }
.tr2-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 16px; }
.tr2-x { background: transparent; border: none; font-size: 16px; cursor: pointer; color: var(--text); width: 40px; height: 40px; }
.tr2-panel-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.tr2-btn { border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 12px; height: 44px; padding: 0 14px; font-size: 15px; cursor: pointer; }
.tr2-btn.sunset { background: linear-gradient(135deg, #FF5A3C, #FF9D2E); color: #fff; border: none; font-weight: 700; }
.tr2-btn.danger { color: #E74C3C; }

.tr2-list { display: flex; flex-direction: column; gap: 2px; }
.tr2-empty { text-align: center; padding: 20px 0; }
.tr2-row { display: flex; align-items: stretch; }
.tr2-rail { width: 16px; flex: 0 0 16px; border-left: 1.5px solid var(--border); margin-left: 7px; }
.tr2-folder { flex: 1; display: flex; align-items: center; gap: 6px; background: var(--bub-ai); border-radius: 8px; padding: 8px 4px 8px 8px; }
.tr2-folder.nofolder { background: transparent; }
.tr2-fname { flex: 1; font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer; }
.tr2-phrase { flex: 1; display: flex; align-items: center; gap: 6px; background: var(--opt-bg); border-radius: 10px; padding: 9px 6px 9px 12px; border: 1px solid transparent; }
.tr2-phrase.sel { border-color: #FF5A3C; }
.tr2-ph-text { flex: 1; min-width: 0; cursor: pointer; }
.tr2-ph-foreign { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr2-ph-foreign.b { font-weight: 700; }
.tr2-ph-translit { font-size: 13px; color: #12A594; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr2-ph-native { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr2-check { color: #FF5A3C; font-size: 16px; }
.tr2-mini { background: transparent; border: none; font-size: 15px; color: var(--muted); cursor: pointer; width: 38px; height: 38px; }
.tr2-stars { position: relative; display: inline-block; line-height: 1; color: transparent; }
.tr2-stars-bg { color: #D8CFC0; }
.tr2-stars-fill { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: #F5A623; }

.tr2-label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; text-align: left; }
.tr2-input { width: 100%; box-sizing: border-box; background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 9px 11px; font-size: 15px; font-family: inherit; resize: vertical; }
textarea.tr2-input { min-height: 42px; }
.tr2-frow { display: flex; gap: 8px; align-items: center; }
.tr2-rate { font-size: 14px; width: 48px; }
.tr2-card-stars { margin: 8px 0 2px; }
.tr2-card-scores { font-size: 13px; color: var(--muted); }
.tr2-pick { padding: 12px 10px; border-bottom: 1px solid var(--border); cursor: pointer; text-align: left; }
.tr2-pick:hover { background: var(--bub-ai); }
.tr2-pick.danger { color: #E74C3C; }
.tr2-emoji-btn { width: 48px; height: 44px; font-size: 22px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); cursor: pointer; }
.tr2-emoji-grid { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.tr2-emoji { width: 48px; height: 48px; font-size: 24px; background: transparent; border: none; cursor: pointer; border-radius: 8px; }
.tr2-emoji:hover { background: var(--bub-ai); }

.tr2-bubbles { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; position: absolute; left: 16px; right: 16px; bottom: 150px; }
.tr2-bubble { background: #fff; color: #12181A; border-radius: 14px; padding: 10px 12px; font-size: 14px; font-weight: 700; max-width: 90%; text-align: left; }
.tr2-info-close { width: 200px; height: 58px; border-radius: 29px; position: relative; }
.tr2-word-reps { display: flex; flex-wrap: wrap; justify-content: center; margin: 10px 0; }
.tr2-rep { font-size: 30px; font-weight: 700; margin: 5px 7px; }
/* Тренажёр: доп. элементы (паритет с приложением) */
.tr2-translit-check { cursor: pointer; margin-left: 4px; }
.tr2-main-stars { margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.tr2-best-num { font-size: 13px; color: var(--muted); }
.tr2-btn.sea { background: linear-gradient(135deg, #12A594, #0E96B0); color: #fff; border: none; font-weight: 700; }
.tr2-mini.big { font-size: 18px; width: 48px; height: 44px; }
.tr2-info { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 80; display: flex; flex-direction: column; gap: 6px; padding: 10px 6px 6px; box-sizing: border-box; max-width: 720px; margin: 0 auto; }
.tr2-info-close { width: 180px; height: 50px; border: none; border-radius: 25px; font-size: 17px; font-weight: 700; color: #fff; cursor: pointer; background: linear-gradient(135deg, #FF5A3C, #FF9D2E); align-self: center; margin-top: 8px; }
.tr2-info-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.tr2-info-list .tr2-bubble { max-width: none; font-weight: 400; padding: 11px 14px; }
.tr2-info-pointers { display: flex; gap: 8px; }
.tr2-info-pointers span { flex: 1; text-align: center; font-size: 15px; color: #fff; line-height: 1.2; }
/* Тренажёр: перетаскивание long-press */
.tr2-drag-src { opacity: .35; }
.tr2-drop-hover { outline: 2px solid #FF5A3C; outline-offset: -2px; border-radius: 10px; }
.tr2-list [data-drag] { user-select: none; -webkit-user-select: none; }
/* Шторка переводчика: как в приложении (значок промпта, режим 🌐/🎓) */
.prompt-chip.chip-icon { width: 44px; height: 38px; padding: 0; text-align: center; font-size: 18px; flex: 0 0 44px; }
.prompt-chip.chip-icon .chev { display: none; }
.drawer-spacer { flex: 1; }
.mode-switch2 { background: var(--bub-ai); border-radius: 12px; padding: 3px; display: inline-flex; gap: 3px; }
.mode-btn2 { width: 46px; height: 34px; border: none; border-radius: 8px; background: transparent; font-size: 16px; cursor: pointer; }
.mode-btn2.active { background: var(--card); }
/* Единое поле выпадающего списка (PickSheet) */
.pick-field { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 15px; cursor: pointer; margin: 2px 0 10px; }
.pick-field .pick-field-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-field .chev { color: var(--muted); font-size: 13px; }
.pick-row { display: flex; align-items: center; gap: 8px; }
.pick-row.edit-link { text-decoration: none; color: var(--text); }
/* Карточка фразы: футер в столбик (Сохранить сверху) */
.tr2-panel-foot.col { flex-direction: column; align-items: stretch; }
.tr2-panel-foot.col .tr2-btn.sunset { width: 100%; }
.tr2-foot-row { display: flex; gap: 8px; }
/* Поле выбора нейросети с иконкой вендора */
.pick-field-icon { display: inline-flex; width: 18px; height: 18px; flex: 0 0 18px; }
.pick-field-icon svg { width: 18px; height: 18px; }

/* Индикатор качества связи: виньетка по периметру (порт из приложения) */
.net-vignette { position: fixed; inset: 0; pointer-events: none; z-index: 9999; transition: box-shadow .4s ease; }
.net-vignette.net-pulse { animation: net-pulse .9s ease-in-out infinite; }
@keyframes net-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* Флаг-иконка (flag-icons) в списках языков */
.pick-flag { margin-right: 8px; border-radius: 2px; vertical-align: -1px; }

/* --- Гостевой режим --- */
.guest-bar { position:absolute; top:8px; right:12px; display:flex; align-items:center; gap:10px; z-index:5; }
.guest-left { font-size:12px; color:var(--muted); background:var(--card); padding:4px 10px; border-radius:99px; border:1px solid var(--border); white-space:nowrap; }
.guest-login { font-size:13px; color:var(--primary); text-decoration:none; font-weight:600; }
.guest-soft { display:flex; align-items:center; gap:10px; background:var(--card); border:1px solid var(--border); border-radius:12px; padding:10px 12px; margin:8px 12px; font-size:14px; }
.guest-soft .gs-reg { margin-left:auto; background:var(--primary); color:#fff; border:0; border-radius:8px; padding:6px 12px; font-weight:600; white-space:nowrap; }
.guest-soft .gs-x { background:none; border:0; color:var(--muted); font-size:16px; cursor:pointer; }
.guest-wall-overlay { position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:60; display:flex; align-items:flex-end; justify-content:center; }
.guest-wall { background:var(--card); color:var(--text); border-radius:22px 22px 0 0; padding:22px 18px calc(22px + env(safe-area-inset-bottom)); width:100%; max-width:640px; text-align:center; }
.guest-wall .gw-title { font-size:19px; font-weight:800; margin-bottom:8px; }
.guest-wall .gw-text { font-size:14px; color:var(--muted); margin-bottom:16px; line-height:1.5; }
.guest-wall .block { display:block; width:100%; margin-top:8px; }
.guest-chips { display:flex; flex-wrap:wrap; gap:8px; padding:0 12px 8px; }
.guest-chips .chip { background:var(--card); border:1px solid var(--border); color:var(--text); border-radius:99px; padding:8px 14px; font-size:14px; cursor:pointer; }

