@font-face {
  font-family: Onest;
  /* woff2 втрое легче: 67 КБ против 189 КБ. TTF оставлен запасным —
     браузер без поддержки woff2 возьмёт его и ничего не потеряет. */
  src: url('./fonts/Onest-Variable.woff2') format('woff2'),
       url('./fonts/Onest-Variable.ttf') format('truetype');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #FAFAFA;
  --text: #1D1D1F;
  --accent: #0A66FF;
  --muted: #86868B;
  --dark-bg: #121214;
  --dark-text: #F5F5F7;
  --dark-accent: #0A84FF;
  --dark-muted: #98989D;
  --line: #e5e5e7;
  --surface: #f0f0f2;
  /* Токены ниже добавлены, чтобы тёмная тема (theme.css) переопределяла
     значения, а не дублировала правила: раньше белый фон плавающих
     панелей, цвет рамок полей и служебные оттенки были вписаны прямо в
     правила, и тёмная палитра из DESIGN.md §5 физически не могла
     примениться. */
  --card: #fff;                 /* плавающие поверхности: нижняя панель, поле ввода, панель истории */
  --on-accent: #fff;            /* текст и значки поверх акцентной заливки */
  --field-border: #b7b7bd;
  --track: #dcdce0;             /* незаполненная часть полосы прогресса */
  --accent-soft: #eaf1ff;
  --accent-soft-hover: #dce9ff;
  --accent-tint: rgba(10, 102, 255, .12);
  --danger: #D64545;
  --text-dim: #66666d;
  --text-faint: #77777d;
  --row-hover: #f0f4fc;
  --up: #187453;
  --down: #b93636;
  --shadow: rgba(0, 0, 0, .08);
  --shadow-strong: rgba(0, 0, 0, .12);
  --scrim: rgba(0, 0, 0, .28);
  --accent-hover: #2376ff;
  --chart-grid: #e4e4e8;
  --chart-up: #118c6e;
  --chart-down: #d54b55;
  /* Стекло (§8 DESIGN.md): в светлой теме — белая полупрозрачная заливка,
     в тёмной белым осветлять нельзя, поверхность станет молочной. */
  --glass-solid: rgba(255, 255, 255, .94);
  --glass-nav: rgba(255, 255, 255, .55);
  --glass-panel: rgba(255, 255, 255, .7);
  --glass-border: rgba(255, 255, 255, .35);
  --glass-highlight: rgba(255, 255, 255, .4);
  --glass-inner-light: rgba(255, 255, 255, .5);
  --nav-hover: rgba(240, 240, 242, .82);
  --accent-tint-strong: rgba(10, 102, 255, .14);
  --z-navigation: 10;
  font-family: Onest, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
/* textarea и select шрифт страницы сами не наследуют — без этого поле
   чата и форма поддержки набирались моноширинным. */
button, input, textarea, select { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { line-height: 1.6; }
.shell { max-width: 760px; margin-inline: auto; padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) calc(120px + env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 650; letter-spacing: -.8px; min-height: 44px; }
.brand-symbol { display: grid; place-items: center; width: 32px; height: 32px; background: var(--accent); color: var(--on-accent); border-radius: 10px; font-size: 25px; padding-bottom: 4px; }
.edition { color: var(--text); font-size: 12px; }
.page-heading { padding: 48px 0 42px; }
.eyebrow { font-size: 12px; font-weight: 500; letter-spacing: .03em; margin-bottom: 18px; }
h1 { font-size: clamp(32px, 8.8vw, 52px); font-weight: 550; line-height: 1.08; letter-spacing: -.055em; }
h1 span { color: var(--accent); }
.intro { font-size: 15px; margin-top: 22px; max-width: 38ch; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
h2 { font-size: 19px; letter-spacing: -.035em; font-weight: 600; }
.text-button { border: 0; padding: 10px 0 10px 10px; min-height: 44px; background: transparent; color: var(--accent); font-size: 13px; font-weight: 550; }
/* inline-block обязателен: у строчного элемента transform не применяется,
   а значок обновления вращается (см. spinRefresh в app.js). */
.text-button { display: inline-flex; align-items: center; gap: 7px; }
.text-button span { display: inline-block; font-size: 20px; vertical-align: -1px; }
/* Значок нарисован штрихом, как иконки навигации и чата, а не взят символом
   из шрифта: у текстовых глифов вроде «↻» своя толщина и своя оптика, рядом
   с 13px-подписью они выглядят тяжёлыми и чужеродными. */
.text-button .btn-icon { display: inline-flex; width: 15px; height: 15px; }
.text-button .btn-icon svg { width: 100%; height: 100%; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters button { min-height: 44px; padding: 10px 16px; border-radius: 12px; border: 0; color: var(--text); background: var(--surface); font-size: 13px; }
.filters button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.news-item { padding: 20px 0 12px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.news-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 11px; font-weight: 500; }
.news-meta .category { color: var(--accent); }
.news-meta time::before { content: '·'; margin-right: 8px; }
.news-item h3 { font-size: 21px; line-height: 1.35; letter-spacing: -.035em; font-weight: 550; text-wrap: pretty; }
.news-body { font-size: 14px; margin-top: 14px; white-space: pre-line; }
/* Действия карточки — тихие значки справа (iconAction в app.js). */
.news-actions { display: flex; justify-content: flex-end; align-items: center; gap: 2px; margin-top: 6px; margin-right: -8px; }
.news-action { display: inline-grid; place-items: center; width: 40px; height: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; transition: color 160ms ease, background-color 160ms ease; }
.news-action svg { width: 19px; height: 19px; }
.news-action:hover { background: var(--surface); color: var(--text); text-decoration: none; }
/* Отметки — как у сообщений в чате (.msg-action-btn.liked / .disliked). */
.news-action[data-value="like"][aria-pressed="true"] { color: var(--accent); }
.news-action[data-value="dislike"][aria-pressed="true"] { color: var(--danger); }
.feedback-group { display: flex; gap: 2px; margin-left: 6px; padding-left: 6px; border-left: 1px solid var(--line); }
/* Раскрывающийся заголовок: стрелка вместо строки «Читать подробнее». */
.news-expand > .news-headline { display: block; list-style: none; cursor: pointer; }
.news-expand > .news-headline::-webkit-details-marker { display: none; }
.news-expand > .news-headline::before { display: none; }
.news-chevron { display: inline-block; width: 8px; height: 8px; margin-left: 8px; vertical-align: .18em; border-right: 1.8px solid var(--muted); border-bottom: 1.8px solid var(--muted); transform: rotate(45deg); transition: transform 280ms cubic-bezier(.4, 0, .2, 1); }
.news-expand[open] .news-chevron, .news-expand[data-anim="open"] .news-chevron { transform: rotate(-135deg) translate(-2px, -2px); }
@media (prefers-reduced-motion: reduce) { .news-chevron, .news-action { transition: none; } }
.source-link { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; text-decoration: none; }
.source-link::after { content: '↗'; font-size: 14px; line-height: 1; }
.source-link:hover { background: var(--accent-soft-hover); text-decoration: none; }
details { margin-top: 12px; font-size: 13px; }
/* Нативный маркер ::marker повернуть нельзя, поэтому он скрыт, а треугольник
   рисуется сами — его вращение см. в motion.css. */
summary { cursor: pointer; padding: 12px 0; min-height: 44px; display: flex; align-items: center; gap: 9px; list-style: none; }
summary::-webkit-details-marker { display: none; }
/* Стрелка-шеврон, как у групп настроек и новостей (раньше — треугольник). */
summary::before { content: ''; flex: 0 0 auto; width: 7px; height: 7px; margin: 0 3px 0 1px; border-right: 1.8px solid var(--muted); border-bottom: 1.8px solid var(--muted); }
.endnote { margin-top: 30px; font-size: 12px; text-align: center; }
.daily-summary { padding: 24px; border-radius: 20px; background: var(--surface); display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px 12px; margin-bottom: 28px; }
.daily-summary h2 { font-size: 16px; }
.daily-summary p:not(.progress-number) { font-size: 12px; margin-top: 6px; }
.progress-number { line-height: 1; font-size: 46px; font-weight: 500; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.progress-total { font-size: 22px; color: var(--muted); letter-spacing: -.04em; }
progress { grid-column: 1 / -1; width: 100%; height: 4px; border: 0; border-radius: 4px; background: var(--track); appearance: none; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: var(--track); border-radius: 4px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 4px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 4px; }
.habit-row { display: grid; grid-template-columns: 48px 1fr 44px; gap: 12px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--line); }
.habit-check { position: relative; display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border-radius: 50%; border: 1px solid var(--field-border); background: transparent; color: var(--on-accent); }
.habit-check:disabled { opacity: 1; cursor: default; }
.habit-check[aria-pressed="true"] { border-color: var(--accent); }
/* Заливка — отдельный круг: при отметке он растёт из центра. */
.habit-check::before { content: ''; position: absolute; inset: -1px; border-radius: 50%; background: var(--accent); transform: scale(0); }
.habit-check[aria-pressed="true"]::before { transform: scale(1); }
/* Волна, расходящаяся от кружка в момент отметки. */
.habit-check::after { content: ''; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; pointer-events: none; }
.habit-check svg { position: relative; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 18; stroke-dashoffset: 18; }
.habit-check[aria-pressed="true"] svg { stroke-dashoffset: 0; }
#done-count { display: inline-block; }
.habit-row h3 { font-size: 16px; font-weight: 550; letter-spacing: -.025em; overflow-wrap: anywhere; }
.habit-row p { font-size: 12px; margin-top: 4px; }
.delete-habit { min-height: 44px; width: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 22px; }
.delete-confirm { grid-column: 1 / -1; font-size: 13px; padding-top: 8px; }
.delete-confirm p { margin-bottom: 6px; }
.habit-remind { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 4px 0; margin-top: 4px; font-size: 12px; }
.habit-remind svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.habit-remind-form { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 8px; }
.habit-remind-form input[type=time] { min-height: 44px; flex: 0 1 160px; }
.momentum { display: flex; gap: 16px; margin-top: 32px; padding: 22px 0; }
.momentum-symbol { color: var(--accent); font-size: 27px; }
.momentum h3 { font-weight: 500; font-size: 14px; }
.momentum p { font-size: 12px; margin-top: 6px; }
.bottom-nav { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: min(calc(100% - 32px), 460px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 7px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; z-index: var(--z-navigation); }
.bottom-nav a { display: flex; justify-content: center; align-items: center; gap: 9px; min-height: 52px; border-radius: 13px; color: var(--text); font-size: 12px; font-weight: 550; }
.bottom-nav a[aria-current="page"] { color: var(--accent); }
/* Подложка активной вкладки — отдельный слой, который переезжает между
   вкладками (см. motion.js), а не перекрашивается на месте. */
/* Подложка активной вкладки берёт акцентный цвет в слабой заливке, а не
   нейтральный серый: серая читалась как «неактивное», хотя означает выбор. */
.nav-indicator { position: absolute; top: 5px; bottom: 5px; left: 0; width: 0; border-radius: 13px; background: var(--accent-tint); pointer-events: none; }
.bottom-nav svg { width: 22px; height: 22px; flex: 0 0 auto; }
.status { font-size: 13px; margin: 14px 0; }
.status:empty { display: none; }
.empty { padding: 28px 0; }
.empty h3 { font-size: 20px; margin-bottom: 8px; }
.empty p { font-size: 14px; max-width: 42ch; }
.habit-form { padding: 20px 0; border-block: 1px solid var(--line); }
label { display: block; font-size: 13px; margin-bottom: 10px; }
input { width: 100%; min-height: 48px; border-radius: 10px; border: 1px solid var(--field-border); background: var(--card); color: var(--text); padding: 12px; font-size: 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.primary { min-height: 48px; border: 0; padding: 12px 18px; border-radius: 12px; background: var(--accent); color: var(--on-accent); font-weight: 550; font-size: 14px; }
.auth-retry { margin: 4px 0 24px; }
.demo-banner { padding-top: 14px; font-size: 10px; }
/* Состояние сети. Стоит в потоке под шапкой, а не поверх контента: в
   полноэкранном режиме сверху уже висят плавающие кнопки Telegram, и
   ещё один слой там перекрывал бы их. */
.net-banner {
  margin-top: 12px; padding: 9px 14px; border-radius: 12px;
  font-size: 12px; line-height: 1.4;
  background: var(--surface); color: var(--text);
  border-left: 3px solid var(--muted);
}
.net-banner[data-state="offline"] { border-left-color: var(--danger); }
.net-banner[data-state="online"] { border-left-color: var(--accent); color: var(--accent); }

/* Указатель обновления жестом. Свайп вниз у Telegram отключён (иначе он
   сворачивает окно), поэтому привычное «потянуть, чтобы обновить» мы
   делаем сами — см. app.js. */
.pull-refresh {
  position: fixed; top: calc(var(--host-inset-top, 0px) + 6px); left: 50%;
  z-index: var(--z-navigation);
  pointer-events: none; opacity: 0;
  transform: translate(-50%, calc(var(--pull, 0px) - 16px));
  transition: opacity 160ms ease;
}
.pull-refresh[data-visible="true"] { opacity: 1; }
.pull-refresh-ring {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 6px 20px var(--shadow); color: var(--muted);
}
.pull-refresh-ring svg { width: 17px; height: 17px; transform: rotate(var(--pull-turn, 0deg)); }
.pull-refresh.is-ready .pull-refresh-ring { color: var(--accent); border-color: var(--accent); }
.pull-refresh.is-busy .pull-refresh-ring { color: var(--accent); }
.pull-refresh.is-busy .pull-refresh-ring svg { animation: pullSpin .9s linear infinite; }
@keyframes pullSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pull-refresh.is-busy .pull-refresh-ring svg { animation-duration: 1.8s; } }
.skip-link { position: fixed; top: 8px; left: 8px; background: var(--bg); padding: 16px; z-index: 20; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

/* ---- Chat ---- */
#chat { padding-bottom: 76px; }
.section-heading-actions { display: flex; align-items: center; gap: 4px; }
/* Кнопка истории стоит на месте бывшего заголовка раздела, поэтому
   выравнивается по левому краю, а не по правому, как обычные text-button. */
.chat-history-button { display: inline-flex; align-items: center; gap: 7px; padding-left: 0; }
.chat-history-button svg { width: 18px; height: 18px; }
.chat-icon-btn { flex: 0 0 auto; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--text); border-radius: 12px; display: grid; place-items: center; }
.chat-icon-btn svg { width: 19px; height: 19px; }
.chat-messages { display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 82%; padding: 12px 16px; border-radius: 18px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.msg.user { margin-left: auto; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; }
.msg.user:has(.msg-image) { background: transparent; color: var(--text); padding: 0; max-width: 70%; }
.msg.assistant { background: var(--surface); border-bottom-left-radius: 6px; }
.msg.assistant a { color: inherit; text-decoration: underline; }
.msg-image { display: block; width: 100%; border-radius: 14px; }
.msg-image-caption { margin-top: 6px; font-size: 13px; }
.msg-row { display: flex; gap: 10px; align-items: flex-start; }
.msg-avatar { flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: 13px; font-weight: 650; }
.msg-content-col { display: flex; flex-direction: column; gap: 6px; max-width: 84%; min-width: 0; }
.msg-content-col .msg { max-width: none; }
.msg-actions { display: flex; gap: 2px; }
.msg-action-btn, .msg-speak-btn { min-height: 32px; min-width: 32px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; display: grid; place-items: center; }
.msg-action-btn.liked { color: var(--accent); }
.msg-action-btn.disliked { color: var(--danger); }
.msg-speak-btn.playing { color: var(--accent); }
.typing-bubble { display: inline-flex; gap: 4px; align-items: center; background: var(--surface); border-bottom-left-radius: 6px; padding: 14px 16px; }
.typing-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: typingPulse 1.1s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes typingPulse { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.chat-sidebar-backdrop { position: fixed; inset: 0; border: 0; margin: 0; padding: 0; background: var(--scrim); z-index: 11; }
.chat-sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: min(84vw, 320px); z-index: 12; padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; overflow-y: auto; background: var(--card); box-shadow: 8px 0 32px var(--shadow-strong); }
/* Панель истории выезжает, поэтому глобальное [hidden]{display:none} для неё
   и затемнения отключено: display:none нельзя анимировать. Роль "скрыто"
   играет visibility (убирает из фокуса и из дерева доступности) плюс сдвиг
   за левый край. Атрибут hidden остаётся единственным признаком состояния —
   на него по-прежнему смотрит весь JS. */
.chat-sidebar[hidden] { display: flex !important; }
.chat-sidebar-backdrop[hidden] { display: block !important; }
.chat-sidebar { transform: translateX(-100%); visibility: hidden; }
.chat-sidebar:not([hidden]) { transform: translateX(0); visibility: visible; }
.chat-sidebar-backdrop { opacity: 0; visibility: hidden; }
.chat-sidebar-backdrop:not([hidden]) { opacity: 1; visibility: visible; }
.chat-sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.chat-list-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 10px; border-radius: 10px; font-size: 13px; }
.chat-list-item.active { background: var(--surface); color: var(--accent); }
.chat-list-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list-item-delete { flex: 0 0 auto; min-width: 28px; min-height: 28px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; display: grid; place-items: center; }
.chat-form { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(90px + env(safe-area-inset-bottom)); width: min(calc(100% - 32px), 700px); z-index: var(--z-navigation); }
.chat-input-wrap { display: flex; align-items: flex-end; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 6px; box-shadow: 0 8px 24px var(--shadow); }
.chat-tool-btn { flex: 0 0 auto; min-width: 40px; min-height: 40px; border: 0; background: transparent; color: var(--muted); border-radius: 50%; display: grid; place-items: center; }
.chat-tool-btn svg { width: 18px; height: 18px; }
.chat-tool-btn.recording { color: var(--danger); }
.chat-input-pill { flex: 1 1 auto; display: flex; align-items: flex-end; gap: 6px; min-width: 0; }
.chat-input-pill textarea { flex: 1 1 auto; min-width: 0; border: 0; background: transparent; resize: none; max-height: 140px; padding: 9px 4px; font-size: 16px; line-height: 1.4; color: var(--text); }
.chat-input-pill textarea:focus-visible { outline: none; }
.send-btn { flex: 0 0 auto; width: 36px; height: 36px; margin-bottom: 2px; border: 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.send-btn:disabled { background: var(--line); color: var(--muted); }
.chat-attach-status { font-size: 11px; margin-top: 6px; text-align: center; color: var(--muted); min-height: 14px; }
.chat-attach-status:empty { display: none; }

@media (hover: hover) { button:hover, .source-link:hover { text-decoration: underline; } .bottom-nav a:hover { background: var(--surface); } .chat-icon-btn:hover, .chat-tool-btn:not(:disabled):hover, .msg-action-btn:hover, .msg-speak-btn:hover, .chat-list-item:hover { background: var(--surface); color: var(--text); text-decoration: none; } }
@media (min-width: 640px) { .shell { padding-inline: 48px; } .page-heading { padding-top: 68px; } .news-item { padding-block: 30px; } .intro { font-size: 17px; } }
@media (max-width: 340px) { .shell { padding-inline: 18px; } .edition { font-size: 10px; } .daily-summary { padding: 18px; } .habit-row { gap: 8px; } .msg, .msg-content-col { max-width: 90%; } }

/* Кнопка входа через Google. Фирменные цвета логотипа в значке — требование
   Google к оформлению кнопки входа; сама кнопка нейтральная, чтобы не
   спорить с палитрой (DESIGN.md §5). */
.google-login {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; margin: 4px 0 24px; padding: 0 18px;
  border: 1px solid var(--field-border); border-radius: 12px;
  background: var(--card); color: var(--text);
  font-size: 14px; font-weight: 550;
}
.google-login svg { width: 17px; height: 17px; flex: 0 0 auto; }
@media (hover: hover) { .google-login:hover { text-decoration: none; background: var(--surface); } }

/* Экран входа (body.signed-out, см. resetSession в app.js). Один столбец
   по центру: знак, заголовок, фраза, одна кнопка — ни пустого дайджеста,
   ни шапки, ни нижней панели, которые без входа всё равно не работают. */
body.signed-out .masthead,
body.signed-out .bottom-nav,
body.signed-out .demo-banner,
body.signed-out main > section:not(.signin) { display: none !important; }
body.signed-out .shell { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.signin {
  display: flex; flex-direction: column; justify-content: center;
  min-height: calc(100svh - 2 * max(24px, env(safe-area-inset-top)));
  max-width: 440px; margin-inline: auto; padding-block: 32px;
}
.signin-symbol {
  display: grid; place-items: center; width: 52px; height: 52px; padding-bottom: 6px;
  border-radius: 16px; background: var(--accent); color: var(--on-accent);
  font-size: 38px; font-weight: 650; letter-spacing: -.04em;
}
.signin h1 { margin-top: 40px; font-size: clamp(34px, 9.5vw, 48px); }
.signin-lead { margin-top: 20px; max-width: 32ch; color: var(--text-dim); font-size: 16px; line-height: 1.55; }
.signin-lead a { color: var(--accent); text-decoration: underline; }
.signin-status { margin-top: 16px; font-size: 14px; color: var(--text); }
.signin-status:empty { display: none; }
.signin-actions { display: flex; flex-direction: column; align-items: stretch; gap: 12px; margin-top: 40px; max-width: 320px; }
.signin-cta { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; border-radius: 16px; font-size: 16px; }
.signin-cta svg { width: 20px; height: 20px; flex: 0 0 auto; }
.signin-already { display: grid; gap: 12px; margin-top: 32px; max-width: 320px; }
.signin-already[hidden] { display: none; }
.signin-already p { font-size: 16px; }
.signin-switch { min-height: 48px; border: 0; background: none; color: var(--accent); font: inherit; font-size: 14px; font-weight: 550; }
.signin-form { display: grid; gap: 12px; }
.signin-form[hidden] { display: none; }
.signin-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface); }
.signin-tabs button { min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--text-dim); font: inherit; font-size: 14px; font-weight: 550; }
.signin-tabs button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.signin-field { display: grid; gap: 6px; font-size: 13px; color: var(--text-dim); }
.signin-field[hidden] { display: none; }
.signin-field input { color: var(--text); }
.signin-note { font-size: 12px; color: var(--text-dim); line-height: 1.45; }
.signin-note a { color: var(--accent); }
.signin-or { display: flex; align-items: center; gap: 12px; margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.signin-or::before, .signin-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.signin-or[hidden] { display: none; }
.telegram-widget { display: grid; gap: 10px; margin-top: 8px; }
.telegram-widget[hidden] { display: none; }
.telegram-widget-caption { font-size: 13px; color: var(--text-dim); }
.telegram-widget-slot { min-height: 48px; }
.signin-actions .google-login { justify-content: center; margin: 0; min-height: 54px; border-radius: 16px; }
.signin-foot { align-self: flex-start; margin-top: 28px; color: var(--muted); font-size: 14px; }
@media (hover: hover) { .signin-cta:hover { text-decoration: none; } .signin-foot:hover { color: var(--text); } }

/* Появление: сверху вниз, пружинный отклик (DESIGN.md §7). Кнопки нажимаются
   с первого кадра — анимируется только вид, не доступность. */
@keyframes signin-reveal { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.signin:not([hidden]) > * { animation: signin-reveal .55s var(--motion-spring) both; }
.signin > :nth-child(2) { animation-delay: 60ms; }
.signin > :nth-child(3) { animation-delay: 120ms; }
.signin > :nth-child(4), .signin > :nth-child(5) { animation-delay: 180ms; }
.signin > :nth-child(6) { animation-delay: 240ms; }
@media (prefers-reduced-motion: reduce) {
  @keyframes signin-fade { from { opacity: 0; } to { opacity: 1; } }
  .signin:not([hidden]) > * { animation: signin-fade .15s ease-out both; animation-delay: 0ms; }
}

/* Знак «г.» рисуется не буквой шрифта, а контуром из официального логотипа
   (brand/gerodot-g-glyph.svg) — буква садилась по базовой линии и выглядела
   смещённой вниз, а подгонка отступом зависела от шрифта. Контур занимает
   квадрат целиком с теми же полями, что у иконки приложения. Текст «г.»
   остаётся в разметке, но не виден. */
.brand-symbol, .signin-symbol, .onb-mark:not(.onb-mark-done), .promo-push-icon, .msg-avatar { position: relative; font-size: 0 !important; padding: 0 !important; color: transparent; }
.brand-symbol::before, .signin-symbol::before, .onb-mark:not(.onb-mark-done)::before, .promo-push-icon::before, .msg-avatar::before {
  content: ''; position: absolute; inset: 0; background: var(--on-accent, #fff);
  -webkit-mask: url('/static/brand/gerodot-g-glyph.svg') center / 100% 100% no-repeat;
  mask: url('/static/brand/gerodot-g-glyph.svg') center / 100% 100% no-repeat;
}

/* Восстановление пароля на экране входа. */
.signin-link { align-self: center; min-height: 40px; padding: 0 8px; border: 0; background: transparent; color: var(--accent); font-size: 14px; font-weight: 500; }
.signin-form-title { margin: 0 0 4px; font-size: 15px; line-height: 1.45; color: var(--text); }

/* Готовые вопросы в пустом чате. */
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chat-suggestion { min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--text); font-size: 14px; text-align: left; }
@media (hover: hover) { .chat-suggestion:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; } }

