/* Ноя Dev — мини-приложение Telegram. Цвета берём из темы Telegram (переменные --tg-theme-*),
   поэтому приложение выглядит «родным» и в светлой, и в тёмной теме. Свои цвета — только у движков. */
:root {
  --bg: #ffffff;
  --bg2: #f1f1f4;
  --section: #ffffff;
  --text: #0e0f12;
  --hint: #8a8d93;
  --link: #2a7fd4;
  --accent: #2a7fd4;
  --accent-text: #ffffff;
  --danger: #e04848;
  --claude: #c96442;
  --codex: #0f9d76;
  --radius: 14px;
  --radius-sm: 10px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-std: cubic-bezier(.2, .8, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Roboto Mono", monospace;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --vh: var(--tg-viewport-height, 100dvh);
  /* Карточки ответов и поле ввода — чуть контрастнее фона чата в ОБЕИХ темах
     (вторичный цвет Telegram в тёмной теме темнее основного — карточки «проваливались»). */
  --card: color-mix(in srgb, var(--text) 5.5%, var(--bg));
  --sheet-bg: var(--bg2);
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg) { --sheet-bg: var(--bg); }
  :root {
    --bg: #17181b; --bg2: #0e0f11; --section: #1d1f23; --text: #eef0f3; --hint: #8b9099;
    --link: #6ab0f3; --accent: #3e8edc; --accent-text: #ffffff; --danger: #ff6b6b;
    --claude: #e08a6a; --codex: #3cc79c;
  }
}
/* Тема Telegram перекрывает запасные цвета, если она есть */
:root.tg {
  --bg: var(--tg-theme-bg-color);
  --bg2: var(--tg-theme-secondary-bg-color, var(--tg-theme-bg-color));
  --section: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color));
  --text: var(--tg-theme-text-color);
  --hint: var(--tg-theme-hint-color);
  --link: var(--tg-theme-link-color);
  --accent: var(--tg-theme-button-color);
  --accent-text: var(--tg-theme-button-text-color);
  --danger: var(--tg-theme-destructive-text-color, #e04848);
}
:root.tg.dark { --claude: #e08a6a; --codex: #3cc79c; --sheet-bg: var(--bg); --card: color-mix(in srgb, var(--text) 8%, var(--bg)); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg2); color: var(--text); font: 16px/1.42 var(--font); -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body { height: var(--vh); overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
svg { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Каркас и экраны ── */
.app { position: relative; height: var(--vh); overflow: hidden; max-width: 820px; margin: 0 auto; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg2); will-change: transform; }
.view.chat { background: var(--bg); }
.view.enter-right { animation: inRight .32s var(--ease-out) both; }
.view.leave-right { animation: outRight .26s var(--ease-std) both; }
.view.under { animation: dimBack .32s var(--ease-out) both; }
.view.back-in { animation: undim .26s var(--ease-std) both; }
@keyframes inRight { from { transform: translateX(100%); } to { transform: none; } }
@keyframes outRight { from { transform: none; } to { transform: translateX(100%); } }
@keyframes dimBack { from { transform: none; } to { transform: translateX(-18%); opacity: .6; } }
@keyframes undim { from { transform: translateX(-18%); opacity: .6; } to { transform: none; opacity: 1; } }

.boot { height: var(--vh); display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--hint); }
.boot-mark { width: 36px; height: 36px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); animation: spin .9s linear infinite; }
.boot-text { font-weight: 600; letter-spacing: .2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Шапка ── */
.top { flex: none; padding: calc(var(--safe-top) + 8px) 12px 8px; display: flex; align-items: center; gap: 8px; background: var(--bg2); position: relative; z-index: 2; }
.chat .top { background: var(--bg); border-bottom: 1px solid var(--sep, rgba(128,128,128,.16)); }
.top-title { flex: 1; min-width: 0; }
.top-title h1 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -.2px; }
.top-title .sub { font-size: 13px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); flex: none; transition: background .15s; }
.icon-btn:active { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.icon-btn svg { width: 22px; height: 22px; }
.branch-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 1px 2px; }
.branch-title .name { max-width: 100%; text-align: left; font-weight: 650; font-size: 17px; line-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.branch-title .sub-row { display: flex; align-items: center; gap: 8px; max-width: 100%; min-width: 0; }
.branch-title .state { font-size: 13px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.branch-title .state.working { color: var(--accent); }
.branch-title .model-pill { height: 24px; padding: 0 9px 0 8px; font-size: 12.5px; border-radius: 12px; }

/* ── Пилюля модели ── */
.model-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px 0 9px; border-radius: 15px; font-size: 13.5px; font-weight: 600; white-space: nowrap; flex: none;
  background: color-mix(in srgb, var(--eng) 13%, transparent); color: var(--eng); transition: transform .12s; }
.model-pill:active { transform: scale(.96); }
.model-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--eng); }
.model-pill .eff { font-weight: 500; opacity: .75; }
.eng-claude { --eng: var(--claude); }
.eng-codex { --eng: var(--codex); }
.tag { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 10px; font-size: 11.5px; font-weight: 600; letter-spacing: .1px;
  background: color-mix(in srgb, var(--eng, var(--hint)) 14%, transparent); color: var(--eng, var(--hint)); white-space: nowrap; }

/* ── Список веток ── */
.scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.home-body { padding: 4px 12px calc(var(--safe-bottom) + 96px); }
.search { display: flex; align-items: center; gap: 8px; height: 38px; margin: 2px 0 14px; padding: 0 12px; border-radius: 11px; background: var(--section); color: var(--hint); }
.search svg { width: 17px; height: 17px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--text); }
.search input::placeholder { color: var(--hint); }
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--hint); margin: 18px 6px 7px; display: flex; justify-content: space-between; align-items: center; }
.list { background: var(--section); border-radius: var(--radius); overflow: hidden; }
.row { position: relative; display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 11px 14px 11px 14px; transition: background .12s; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.row + .row::before { content: ''; position: absolute; top: 0; left: 40px; right: 0; height: 1px; background: rgba(128,128,128,.16); }
.row:active, .row.pressed { background: color-mix(in srgb, var(--hint) 12%, transparent); }
.row .lead { width: 14px; flex: none; display: grid; place-items: center; height: 22px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: transparent; }
.status-dot.busy { background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); animation: pulse 1.6s var(--ease-std) infinite; }
.status-dot.queued { border: 2px solid var(--accent); }
.status-dot.idle { background: rgba(128,128,128,.28); width: 6px; height: 6px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.row .main { flex: 1; min-width: 0; }
.row .line1 { display: flex; align-items: center; gap: 7px; min-width: 0; }
.row .bname { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.row .when { margin-left: auto; font-size: 13px; color: var(--hint); flex: none; font-variant-numeric: tabular-nums; }
.row .line2 { margin-top: 2px; font-size: 14px; color: var(--hint); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.row .line2.live { color: var(--text); -webkit-line-clamp: 1; }
.row .line2.live b { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.in-chat { font-size: 11px; color: var(--hint); border: 1px solid rgba(128,128,128,.35); border-radius: 6px; padding: 0 5px; line-height: 16px; flex: none; }
.empty { text-align: center; color: var(--hint); padding: 48px 24px; }
.empty .big { font-size: 17px; color: var(--text); font-weight: 600; margin-bottom: 6px; }

.fab { position: absolute; right: 16px; bottom: calc(var(--safe-bottom) + 18px); height: 52px; padding: 0 20px 0 16px; border-radius: 26px; display: flex; align-items: center; gap: 8px;
  background: var(--accent); color: var(--accent-text); font-weight: 600; font-size: 16px; box-shadow: 0 6px 20px rgba(0,0,0,.18); transition: transform .14s var(--ease-std); z-index: 3; }
.fab:active { transform: scale(.95); }
.fab svg { width: 22px; height: 22px; }

/* ── Чат ветки ── */
.msgs { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.load-more { align-self: center; font-size: 14px; color: var(--link); padding: 6px 12px; }
.msg { max-width: 100%; animation: msgIn .28s var(--ease-out) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.user { align-self: flex-end; max-width: 86%; }
.msg.user .bubble { background: var(--accent); color: var(--accent-text); padding: 9px 13px; border-radius: 18px 18px 6px 18px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; }
.msg.user .bubble a { color: inherit; text-decoration: underline; }
.msg.user .meta { text-align: right; }
.msg.user.queued .bubble { opacity: .62; }
.msg.user.failed .bubble { background: color-mix(in srgb, var(--danger) 85%, black); }
.msg .meta { font-size: 12px; color: var(--hint); margin-top: 4px; padding: 0 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.msg.user .meta { justify-content: flex-end; }
.msg.bot { align-self: stretch; }
.msg.bot .card { background: var(--section); border-radius: 16px; padding: 12px 14px; border: 1px solid rgba(128,128,128,.12); }
.chat .msg.bot .card { background: var(--card); border-color: transparent; }
.msg.bot.err .card { background: color-mix(in srgb, var(--danger) 9%, var(--bg)); }
.msg.bot.stopped .card { opacity: .85; }
.msg.sys { align-self: center; max-width: 92%; text-align: center; font-size: 13px; color: var(--hint); padding: 2px 10px; white-space: pre-wrap; }
.truncated { font-size: 12.5px; color: var(--hint); margin-top: 6px; font-style: italic; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin-top: 10px; }
.photos img { width: 100%; border-radius: 10px; display: block; background: rgba(128,128,128,.12); aspect-ratio: 4/3; object-fit: cover; }

details.progress { margin-top: 10px; border-top: 1px solid rgba(128,128,128,.16); padding-top: 8px; }
details.progress summary { font-size: 13.5px; color: var(--hint); cursor: pointer; list-style: none; display: flex; gap: 6px; align-items: center; }
details.progress summary::-webkit-details-marker { display: none; }
details.progress summary::before { content: ''; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .2s; margin-right: 2px; }
details.progress[open] summary::before { transform: rotate(45deg); }
details.progress .notes { margin-top: 8px; display: grid; gap: 8px; font-size: 14px; color: var(--hint); }

/* Живой ход */
.live { align-self: stretch; animation: msgIn .28s var(--ease-out) both; }
.live .card { background: var(--card); border-radius: 16px; padding: 12px 14px; position: relative; overflow: hidden; }
.live .card::before { content: ''; position: absolute; left: 0; top: 0; height: 2px; width: 40%; background: linear-gradient(90deg, transparent, var(--eng, var(--accent)), transparent); animation: sweep 1.8s ease-in-out infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.live-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--hint); }
.live-head .act { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.live-head .time { font-variant-numeric: tabular-nums; flex: none; }
.live .wait { margin-top: 8px; font-size: 14px; color: var(--hint); }
.live .preview { margin-top: 8px; }
.live .preview:empty { display: none; }
.caret::after { content: ''; display: inline-block; width: 7px; height: 1.05em; margin-left: 2px; vertical-align: -2px; background: var(--eng, var(--accent)); border-radius: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.live-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn { height: 34px; padding: 0 14px; border-radius: 17px; font-size: 14.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; transition: transform .12s, background .15s; }
.btn:active { transform: scale(.96); }
.btn svg { width: 16px; height: 16px; }
.btn.ghost { background: color-mix(in srgb, var(--hint) 14%, transparent); }
.btn.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 11%, transparent); }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.wide { width: 100%; justify-content: center; height: 48px; border-radius: 13px; font-size: 16px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ── Markdown ответа ── */
.md { font-size: 15.5px; line-height: 1.5; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 16px 0 8px; line-height: 1.3; }
.md h1, .md h2 { font-size: 18px; } .md h3 { font-size: 16.5px; } .md h4, .md h5, .md h6 { font-size: 15.5px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li > ul, .md li > ol { margin: 3px 0 0; }
.md blockquote { margin: 0 0 10px; padding: 2px 0 2px 12px; border-left: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); color: var(--hint); }
.md hr { border: 0; border-top: 1px solid rgba(128,128,128,.25); margin: 14px 0; }
.md code { font-family: var(--mono); font-size: .87em; background: color-mix(in srgb, var(--hint) 16%, transparent); padding: 1px 5px; border-radius: 5px; }
.md .code { margin: 0 0 10px; border-radius: 11px; overflow: hidden; background: color-mix(in srgb, var(--text) 6%, var(--bg)); border: 1px solid rgba(128,128,128,.16); }
.md .code-head { display: flex; justify-content: space-between; align-items: center; padding: 5px 8px 5px 12px; font-size: 12px; color: var(--hint); border-bottom: 1px solid rgba(128,128,128,.14); }
.md .code-head button { color: var(--link); font-size: 12.5px; padding: 3px 6px; border-radius: 6px; }
.md pre { margin: 0; padding: 10px 12px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.md pre code { background: none; padding: 0; font-size: 13px; line-height: 1.5; white-space: pre; }
.md pre.log code { font-size: 11.5px; white-space: pre-wrap; word-break: break-word; }
.md .table { overflow-x: auto; margin: 0 0 10px; -webkit-overflow-scrolling: touch; }
.md table { border-collapse: collapse; font-size: 14px; min-width: 100%; }
.md th, .md td { border: 1px solid rgba(128,128,128,.22); padding: 6px 9px; text-align: left; vertical-align: top; }
.md th { background: color-mix(in srgb, var(--hint) 10%, transparent); font-weight: 600; }
.md input[type=checkbox] { margin: 0 4px 0 0; vertical-align: -1px; }

/* ── Поле ввода ── */
.composer { flex: none; background: var(--bg); border-top: 1px solid rgba(128,128,128,.16); padding: 8px 10px calc(var(--safe-bottom) + 8px); position: relative; z-index: 2; }
.composer .mode { display: flex; gap: 6px; margin: 0 0 8px; }
.composer .mode button { height: 30px; padding: 0 12px; border-radius: 15px; font-size: 13.5px; font-weight: 600; background: color-mix(in srgb, var(--hint) 13%, transparent); color: var(--hint); }
.composer .mode button.on { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.composer .files { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 30px; padding: 0 6px 0 10px; border-radius: 15px; background: color-mix(in srgb, var(--hint) 14%, transparent); font-size: 13.5px; }
.chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.chip button { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--hint); }
.chip button svg { width: 14px; height: 14px; }
.chip.uploading span::after { content: ' …'; }
.chip.failed { color: var(--danger); }
.compose-row { display: flex; align-items: flex-end; gap: 6px; }
.compose-row .icon-btn { width: 40px; height: 40px; color: var(--hint); }
.input-wrap { flex: 1; min-width: 0; background: var(--card); border-radius: 20px; padding: 9px 14px; display: flex; }
.input-wrap textarea { flex: 1; border: 0; outline: 0; background: transparent; resize: none; max-height: 168px; min-height: 22px; line-height: 22px; font-size: 16px; padding: 0; display: block; }
.input-wrap textarea::placeholder { color: var(--hint); }
.send { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent); color: var(--accent-text); transition: transform .14s var(--ease-std), opacity .14s; }
.send:active { transform: scale(.92); }
.send svg { width: 20px; height: 20px; }
.send.mic { background: transparent; color: var(--hint); }
.send.mic svg { width: 24px; height: 24px; }
.slash { position: absolute; left: 10px; right: 10px; bottom: calc(100% + 6px); max-height: 240px; overflow-y: auto; background: var(--section); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; animation: msgIn .2s var(--ease-out) both; }
.slash button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 9px; font-size: 15px; }
.slash button:active, .slash button.sel { background: color-mix(in srgb, var(--accent) 12%, transparent); }

/* Запись голоса */
.rec { display: flex; align-items: center; gap: 10px; height: 40px; width: 100%; min-width: 0; }
.rec .send, .rec .icon-btn { flex: none; }
.rec .red { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s steps(1) infinite; flex: none; }
.rec .t { font-variant-numeric: tabular-nums; font-weight: 600; width: 44px; flex: none; }
.rec .level { flex: 1; min-width: 0; height: 28px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.rec .level i { display: block; width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 70%, transparent); flex: none; transition: height .08s; }
.rec .busy { flex: 1; color: var(--hint); font-size: 15px; }

/* ── Нижние листы ── */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.38); z-index: 20; animation: fadeIn .22s ease both; }
.backdrop.out { animation: fadeOut .2s ease both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-width: 820px; margin: 0 auto; max-height: calc(var(--vh) - 40px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--sheet-bg); border-radius: 18px 18px 0 0; padding: 8px 14px calc(var(--safe-bottom) + 16px); animation: sheetIn .36s var(--ease-out) both; }
.sheet.out { animation: sheetOut .22s var(--ease-std) both; }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetOut { from { transform: none; } to { transform: translateY(100%); } }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: rgba(128,128,128,.4); margin: 0 auto 10px; }
.sheet h2 { font-size: 19px; margin: 4px 4px 4px; line-height: 1.25; }
.sheet .lead-text { color: var(--hint); font-size: 14px; margin: 0 4px 14px; }
.group { background: var(--section); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.group-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--hint); margin: 14px 6px 7px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; position: relative; }
.opt + .opt::before { content: ''; position: absolute; top: 0; left: 14px; right: 0; height: 1px; background: rgba(128,128,128,.16); }
.opt:active { background: color-mix(in srgb, var(--hint) 10%, transparent); }
.opt .ot { flex: 1; min-width: 0; }
.opt .ot b { display: block; font-weight: 600; }
.opt .ot small { display: block; color: var(--hint); font-size: 13.5px; margin-top: 1px; }
.opt .check { width: 22px; height: 22px; color: var(--accent); flex: none; opacity: 0; transform: scale(.6); transition: opacity .18s, transform .22s var(--ease-out); }
.opt.on .check { opacity: 1; transform: none; }
.opt.danger { color: var(--danger); }
.opt svg.ic { width: 22px; height: 22px; color: var(--accent); flex: none; }
.opt.danger svg.ic { color: var(--danger); }
.seg { display: flex; background: color-mix(in srgb, var(--hint) 14%, transparent); border-radius: 11px; padding: 3px; position: relative; margin-bottom: 14px; }
.seg button { flex: 1; height: 34px; border-radius: 9px; font-weight: 600; font-size: 14.5px; color: var(--hint); position: relative; z-index: 1; transition: color .2s; }
.seg button.on { color: var(--text); }
.seg .thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; border-radius: 9px; background: var(--section); box-shadow: 0 1px 4px rgba(0,0,0,.12); transition: transform .3s var(--ease-out), width .3s var(--ease-out); }
.efforts { display: flex; flex-wrap: wrap; gap: 7px; padding: 12px 14px; }
.efforts button { height: 34px; min-width: 52px; padding: 0 12px; border-radius: 17px; font-weight: 600; font-size: 14px; background: color-mix(in srgb, var(--hint) 13%, transparent); transition: background .15s, color .15s, transform .12s; }
.efforts button:active { transform: scale(.95); }
.efforts button.on { background: var(--accent); color: var(--accent-text); }
.efforts-hint { padding: 0 14px 12px; font-size: 13px; color: var(--hint); margin-top: -4px; }
.switch { width: 50px; height: 30px; border-radius: 15px; background: rgba(128,128,128,.32); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .25s var(--ease-out); }
.switch.on { background: #34c759; }
.switch.on::after { transform: translateX(20px); }
.field { display: block; width: 100%; height: 46px; border: 0; outline: 0; background: var(--section); border-radius: 12px; padding: 0 14px; font-size: 16px; margin-bottom: 14px; }
.note { font-size: 13px; color: var(--hint); margin: -6px 6px 14px; }
.bar { height: 6px; border-radius: 3px; background: rgba(128,128,128,.2); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .6s var(--ease-out); }
.bar i.warn { background: #f5a524; }
.bar i.full { background: var(--danger); }
.usage-row { padding: 12px 14px; }
.usage-row + .usage-row { border-top: 1px solid rgba(128,128,128,.16); }
.usage-row .top-line { display: flex; justify-content: space-between; gap: 8px; font-size: 14.5px; }
.usage-row .top-line span:last-child { color: var(--hint); font-variant-numeric: tabular-nums; }

/* ── Тосты и баннер связи ── */
.toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-top) + 8px); z-index: 40; display: grid; justify-items: center; gap: 6px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; max-width: 520px; background: color-mix(in srgb, var(--text) 88%, transparent); color: var(--bg); padding: 10px 14px; border-radius: 13px; font-size: 14.5px; box-shadow: 0 8px 24px rgba(0,0,0,.22);
  animation: toastIn .3s var(--ease-out) both; }
.toast.out { animation: toastOut .2s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }
.netbar { flex: none; font-size: 13px; text-align: center; padding: 5px 12px; background: color-mix(in srgb, #f5a524 18%, var(--bg)); color: var(--text); }

.gate { height: var(--vh); display: grid; place-content: center; text-align: center; padding: 24px; gap: 10px; }
.gate h2 { margin: 0; font-size: 20px; }
.gate p { margin: 0; color: var(--hint); max-width: 320px; }

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