/* ============================================
   Сонник AI — Mobile-first Moon Theme
   ============================================ */

/* --- Reset & Variables --- */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Видим для скринридеров и краулеров, не занимает места в вёрстке.
   НЕ display:none — тот текст выпадает и из доступности, и из индекса. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root {
  --bg-deep:    #000000;
  --bg-night:   #050508;
  --glass:      rgba(255, 255, 255, 0.06);
  --glass-hover:rgba(255, 255, 255, 0.10);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-strong: rgba(10, 10, 25, 0.85);
  --glass-card: rgba(20, 20, 45, 0.65);
  --veil:       rgba(10, 10, 26, 0.45);
  --text:       #f0f0ff;
  --text-muted: #9a9abe;
  /* Было #5a5a7e — 3.07:1 на фоне страницы и 2.87:1 на карточке, то есть
     провал WCAG AA (норма 4.5:1 для текста мельче 24px). Этим токеном
     набраны подписи, метаданные и дисклеймеры — самый мелкий текст в
     продукте. #79799f сохраняет оттенок и насыщенность, поднята только
     светлота: 4.85:1 на фоне, 4.54:1 на карточке (аудит контраста 07.08.2026). */
  --text-dim:   #79799f;
  --accent:     #8b7cf7;
  /* Тот же сиреневый, затемнённый до контраста 4.51:1 с белым текстом.
     Нужен для кнопок с МЕЛКИМ текстом: на --accent белый даёт лишь 3.32:1.
     Крупные кнопки (>=18.66px bold) проходят на обычном --accent по норме
     3:1 для крупного текста и этот токен не используют. */
  --accent-strong: #715ff5;
  --accent-glow: rgba(139, 124, 247, 0.3);
  --moon-color: #f0e8d0;
  --moon-glow:  rgba(240, 232, 208, 0.15);
  --danger:     #e55;
  --success:    #5e5;
  --radius:     16px;
  --radius-sm:  10px;
  --radius-pill: 50px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-deep);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ============================================
   Background: Stars + Moon
   ============================================ */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse at 50% 50%, #06060f 0%, var(--bg-deep) 60%);
  overflow: hidden;
}

/* Stars — три слоя: яркие, средние, мелкие */
.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 7% 12%, rgba(255,255,255,0.9), transparent),
    radial-gradient(1.5px 1.5px at 23% 3%, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 42% 8%, rgba(255,255,255,0.9), transparent),
    radial-gradient(1.5px 1.5px at 68% 5%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 91% 11%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 15% 28%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 82% 22%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 55% 18%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 3% 45%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 35% 38%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 95% 42%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 72% 35%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 12% 62%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 48% 58%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 88% 65%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 28% 72%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 62% 78%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 5% 85%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 78% 88%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 45% 92%, rgba(255,255,255,0.6), transparent),
    radial-gradient(2px 2px at 93% 95%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 18% 95%, rgba(255,255,255,0.5), transparent);
  animation: twinkle 6s ease-in-out infinite alternate;
}

.stars--small {
  background-image:
    radial-gradient(0.5px 0.5px at 8% 22%, rgba(255,255,255,0.5), transparent),
    radial-gradient(0.5px 0.5px at 33% 8%, rgba(255,255,255,0.4), transparent),
    radial-gradient(0.5px 0.5px at 62% 33%, rgba(255,255,255,0.35), transparent),
    radial-gradient(0.5px 0.5px at 78% 72%, rgba(255,255,255,0.4), transparent),
    radial-gradient(0.5px 0.5px at 18% 88%, rgba(255,255,255,0.45), transparent),
    radial-gradient(0.5px 0.5px at 48% 18%, rgba(255,255,255,0.35), transparent),
    radial-gradient(0.5px 0.5px at 88% 38%, rgba(255,255,255,0.5), transparent),
    radial-gradient(0.5px 0.5px at 22% 58%, rgba(255,255,255,0.35), transparent),
    radial-gradient(0.5px 0.5px at 53% 42%, rgba(255,255,255,0.3), transparent),
    radial-gradient(0.5px 0.5px at 73% 52%, rgba(255,255,255,0.4), transparent),
    radial-gradient(0.5px 0.5px at 38% 68%, rgba(255,255,255,0.35), transparent),
    radial-gradient(0.5px 0.5px at 83% 82%, rgba(255,255,255,0.4), transparent),
    radial-gradient(0.5px 0.5px at 13% 48%, rgba(255,255,255,0.3), transparent),
    radial-gradient(0.5px 0.5px at 58% 88%, rgba(255,255,255,0.35), transparent),
    radial-gradient(0.5px 0.5px at 95% 15%, rgba(255,255,255,0.4), transparent),
    radial-gradient(0.5px 0.5px at 42% 5%, rgba(255,255,255,0.3), transparent);
  animation: twinkle 10s ease-in-out infinite alternate-reverse;
}

@keyframes twinkle {
  from { opacity: 0.5; }
  to   { opacity: 1; }
}

/* Moon — real photo centered on screen. Луна висит в фиксированном фоне
   (.bg = position:fixed на весь вьюпорт) независимо от home-desk грида —
   в невысоких/широких окнах фиксированный по ширине размер (320/400/460px)
   легко занимал почти всю высоту и наезжал на приветствие с чипами сверху.
   min(..., Nvh) держит луну соразмерной высоте окна, не только ширине. */
.moon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(320px, 55vh);
  height: min(320px, 55vh);
  border-radius: 50%;
  overflow: hidden;
  z-index: 1;
  box-shadow:
    0 0 1px 1px rgba(180, 190, 220, 0.15),
    0 0 15px 3px rgba(160, 170, 210, 0.08);
}

.moon__glow {
  position: absolute;
  inset: -70%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(180, 190, 220, 0.08) 0%, rgba(140, 150, 200, 0.03) 40%, transparent 65%);
  animation: moonPulse 8s ease-in-out infinite;
}

.moon__img {
  position: absolute;
  inset: -9%;
  width: 118%;
  height: 118%;
  border-radius: 50%;
  object-fit: cover;
  /* brightness(0.55): луна засвечивала текст и чипы поверх неё. 0.8 было почти
     неотличимо от исходных 1.6 — уводим свет заметно ниже. Гало-тени тоже
     приглушены, иначе диск снова «горит» по краю. */
  filter: brightness(0.55) contrast(1.15) saturate(0.3);
  box-shadow:
    0 0 30px 5px rgba(220, 220, 240, 0.12),
    0 0 70px 20px rgba(200, 200, 230, 0.06),
    0 0 130px 50px rgba(180, 180, 220, 0.03);
  opacity: 0;
  transition: opacity 1s ease;
}

.moon__img.loaded {
  opacity: 1;
}

@keyframes moonPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.08); opacity: 0.7; }
}

/* ============================================
   App container
   ============================================ */

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  /* Фолбэк для браузеров без interactive-widget=resizes-content (старый iOS
     Safari): --app-height считается в JS через visualViewport и реально
     сжимается при открытии клавиатуры — иначе инпут в чате уезжает под неё
     (100vh/100dvh в таких браузерах не учитывают visual viewport). */
  height: calc(var(--app-height, 100dvh));
  max-width: 480px;
  margin: 0 auto;
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.screen[hidden] { display: none; }
[hidden] { display: none !important; }

/* Вуаль: тёмный blur-слой между луной и текстом.
   Для экранов, где контент лежит прямо на луне без своих подложек —
   луна остаётся на месте, но превращается в мягкое размытое свечение
   (тот же рецепт, что у пузырей чата: тёмный тон + backdrop blur).
   По умолчанию только мобилка (<1024px) — на десктопе (T-2.2, .tool-desk)
   луна стоит в своей колонке, ничего поверх нее не лежит, блюрить нечего.

   Исключение — .screen--veil-desktop (форма ввода матрицы/натальной):
   там форма умышленно центрируется поверх луны и на десктопе тоже —
   блюр остаётся, пока не построена карта/матрица; экран-результат
   (matrixViewScreen/astrologyPreviewScreen) — уже обычный .screen--veil
   без десктоп-блюра, там луна открыта в своей колонке (T-2.x). */
@media (max-width: 1023px) {
  .screen--veil::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--veil);
    backdrop-filter: blur(28px) brightness(0.45);
    -webkit-backdrop-filter: blur(28px) brightness(0.45);
  }
}
.screen--veil-desktop::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--veil);
  backdrop-filter: blur(28px) brightness(0.45);
  -webkit-backdrop-filter: blur(28px) brightness(0.45);
}
.screen--veil,
.screen--veil-desktop {
  position: relative;
  isolation: isolate;
}

/* Форма ввода (матрица/натальная) — на десктопе центрируем по вертикали
   в оставшемся после хедера/лунного бейджа пространстве, чтобы она легла
   на центр луны, а не липла сразу под хедер. auto-márgin в flex-колонке
   забирает всё свободное место сверху/снизу именно у формы, хедер и
   лунный бейдж остаются на своих местах. */
@media (min-width: 1024px) {
  .screen--veil-desktop .matrix-intro {
    margin-top: auto;
    margin-bottom: auto;
  }
}

/* ============================================
   Auth Screen
   ============================================ */

.auth-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  padding-bottom: calc(24px + var(--safe-bottom));
  gap: 14px;
  overflow-y: auto;
}

.auth-logo {
  font-size: 2rem;
  font-weight: 700;
  color: var(--moon-color);
  letter-spacing: 0.5px;
  text-shadow: 0 0 30px var(--moon-glow);
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  padding: 3px;
  width: 100%;
  max-width: 300px;
}

.auth-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.3s;
}

.auth-tab.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.auth-form {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* --- Матовые инпуты --- */
.auth-form input,
.auth-form select,
.profile-form input,
.profile-form select {
  width: 100%;
  padding: 14px 16px;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.auth-form input:focus,
.auth-form select:focus,
.profile-form input:focus,
.profile-form select:focus {
  border-color: var(--accent);
  background: rgba(25, 25, 55, 0.8);
}

.auth-form input::placeholder,
.profile-form input::placeholder {
  color: var(--text-muted);
}

.auth-form select { appearance: none; }
.auth-form select option { background: #151530; color: var(--text); }
.profile-form select option { background: #151530; color: var(--text); }

.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 8px;
  text-align: left;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.auth-consent input { margin-top: 2px; flex-shrink: 0; }
.auth-consent a { color: var(--accent); }

.legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 14px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
}
.legal-links a {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
}
.legal-links a:hover { color: var(--text-muted); }

.field-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-align: center;
}

/* --- Gender picker: матовые карточки ♀ ♂ --- */
.gender-pick {
  width: 100%;
}

.gender-options {
  display: flex;
  gap: 10px;
}

.gender-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.gender-card:active { transform: scale(0.96); }

.gender-card.selected {
  border-color: var(--accent);
  background: rgba(139, 124, 247, 0.12);
  color: var(--text);
  box-shadow: 0 0 15px rgba(139, 124, 247, 0.15);
}

.gender-card.selected svg {
  stroke: var(--accent);
}

/* --- Birth year scroll picker --- */
.birth-pick {
  width: 100%;
}

.scroll-picker {
  position: relative;
  height: 140px;
  overflow: hidden;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  /* Fade edges */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 70%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 70%, transparent 100%);
}

.scroll-picker__highlight {
  position: absolute;
  top: 50%;
  left: 10%;
  right: 10%;
  height: 36px;
  transform: translateY(-50%);
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  pointer-events: none;
  z-index: 1;
}

.scroll-picker__list {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 52px 0;
  overflow-y: auto;
  height: 100%;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.scroll-picker__list::-webkit-scrollbar { display: none; }

.scroll-picker__item {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-dim);
  scroll-snap-align: center;
  flex-shrink: 0;
  transition: color 0.2s, transform 0.2s;
  cursor: pointer;
  width: 100%;
}

.scroll-picker__item.active {
  color: var(--text);
  font-weight: 600;
  transform: scale(1.1);
}

/* --- Кнопки --- */
.btn-primary {
  padding: 14px 24px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-pill);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 0 20px var(--accent-glow);
}

.btn-primary:active { transform: scale(0.97); }

.btn-guest {
  width: 100%;
  max-width: 300px;
  padding: 14px 24px;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-guest:active { background: var(--glass-hover); }

.auth-divider {
  width: 100%;
  max-width: 300px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

/* Вход через Яндекс/VK. Блок целиком скрыт, пока провайдер не включён на
   сервере (config/oauth.js) — видимостью управляет app.js. */
.auth-oauth {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.auth-oauth__buttons {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Один включённый провайдер не должен ужиматься в половину строки */
.auth-oauth__buttons:has(> [data-oauth]:only-child),
.auth-oauth__buttons:has(> [data-oauth][hidden]) {
  grid-template-columns: 1fr;
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background: var(--glass-card);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.oauth-btn[hidden] { display: none; }
.oauth-btn:active { background: var(--glass-hover); }
.oauth-btn--yandex:hover { border-color: rgba(252, 63, 29, 0.5); }
.oauth-btn--vk:hover { border-color: rgba(0, 119, 255, 0.5); }

.auth-consent--oauth {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.auth-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.auth-error {
  font-size: 0.8rem;
  color: var(--danger);
  text-align: center;
}

.auth-success {
  font-size: 0.8rem;
  color: var(--success);
  text-align: center;
}

.auth-link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 0;
  align-self: center;
}
.auth-link-btn:hover { color: var(--accent); }

/* ============================================
   Chat Screen
   ============================================ */

.screen-lunar-row {
  display: flex;
  justify-content: center;
  padding: 8px 16px 0;
}

.screen-lunar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(240, 232, 208, 0.08);
  border: 1px solid rgba(240, 232, 208, 0.16);
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:active { background: var(--glass-hover); }

/* Эмоция — кнопками внутри приветственного сообщения чата (раньше был
   отдельный пикер в шапке, оторванный от диалога). */
.chat-emotion-row {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-emotion-row__label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chat-emotion-row__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.emotion-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.25s;
}

.emotion-btn span {
  font-size: 0.75rem;
}

.emotion-btn.selected {
  background: rgba(139, 124, 247, 0.15);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 12px rgba(139, 124, 247, 0.15);
}

.emotion-btn:active { transform: scale(0.93); }

/* Chat messages */
.chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.chat::-webkit-scrollbar { width: 3px; }
.chat::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }

.message {
  max-width: 88%;
  animation: msgIn 0.35s ease-out;
}

.message.user { align-self: flex-end; }
.message.assistant { align-self: flex-start; }

.message-content {
  padding: 12px 16px;
  border-radius: var(--radius);
  line-height: 1.55;
  font-size: 0.9rem;
  word-wrap: break-word;
  color: var(--text);
}

.message.user .message-content {
  background: rgba(139, 124, 247, 0.18);
  border: 1px solid rgba(139, 124, 247, 0.3);
  border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 4px;
}

.message-meta {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
  padding: 0 4px;
}

.message.user .message-meta { text-align: right; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Typing */
.typing {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
}

.typing span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.4s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-8px); }
}

/* Input area */
.input-area {
  padding: 10px 16px;
  padding-bottom: calc(10px + var(--safe-bottom));
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  background: var(--glass-strong);
  border-top: 1px solid var(--glass-border);
}

.input-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 6px 6px 6px 16px;
  transition: border-color 0.3s;
}

.input-form:focus-within { border-color: rgba(139, 124, 247, 0.4); }

.input-form textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  resize: none;
  max-height: 120px;
  padding: 6px 0;
}

.input-form textarea::placeholder { color: var(--text-muted); }

.input-form button[type="submit"] {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: all 0.2s;
  box-shadow: 0 0 12px var(--accent-glow);
}

.input-form button[type="submit"]:active { transform: scale(0.93); }
.input-form button[type="submit"]:disabled { opacity: 0.3; cursor: not-allowed; }

/* ============================================
   Screen Header (diary, dream, profile)
   ============================================ */

.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  background: var(--glass-strong);
  border-bottom: 1px solid var(--glass-border);
}

.screen-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

/* Правая часть единого хедера: контекстная иконка (если есть) + баланс + профиль */
.screen-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
}

/* ============================================
   Diary
   ============================================ */

.diary-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diary-stats {
  padding: 12px 16px 0;
}

.stats-grid {
  display: flex;
  gap: 8px;
}

.stat-card {
  flex: 1;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.stats-summary {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--glass-card);
  border-radius: var(--radius-sm);
}

.dream-card {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.dream-card:active { background: var(--glass-hover); transform: scale(0.98); }

.dream-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.dream-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dream-card-meta {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.dream-card-text {
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.4;
}

.diary-footer {
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  text-align: center;
}

.diary-empty,
.loading-text {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 40px 20px;
}

/* .tool-side — общая боковая панель со списком (дневник снов, разборы карт) */
.tool-side__title {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 0 4px;
}
.tool-side__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}
.tool-side__list .dream-card { padding: 10px 12px; }
.tool-side__list .dream-card-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tool-side__action {
  margin-top: 12px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  text-align: left;
  padding: 4px;
  cursor: pointer;
}
.tool-side__action:hover { color: #c4b5fd; }

/* Дневник снов растягивается на всю высоту колонки (родитель — flex-column
   на весь рост, см. .chat-diary-side ниже) — размер списка через flex, а не
   вручную вычисленный vh. */
#chatDiaryList {
  flex: 1;
  min-height: 0;
}

/* ============================================
   Dream Detail
   ============================================ */

.dream-detail {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.dream-chat-meta {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding: 6px 14px;
  background: var(--glass);
  border-radius: var(--radius-pill);
  display: inline-block;
  width: auto;
  margin-left: auto;
  margin-right: auto;
  display: block;
}

.dream-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dream-bridge {
  margin: 14px 16px 4px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(248, 217, 132, 0.2);
  background: rgba(248, 217, 132, 0.08);
}

.dream-bridge__title {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text);
}

.dream-bridge__text {
  margin-top: 6px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.dream-bridge__actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

/* Глубокий разбор сна (платный второй слой, SKU dreamDeep).
   Тише моста по фону: мост зовёт в другой инструмент и может быть ярким, а
   это предложение стоит под каждым сном — постоянный крикливый блок в чате
   быстро надоедает. */
.dream-deep {
  margin: 14px 16px 4px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: var(--glass-card);
}

.dream-deep__title {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text);
}

.dream-deep__text {
  margin-top: 6px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.dream-deep__actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

/* Заголовок над купленным разбором в карточке сна */
.dream-deep__done {
  margin: 16px 0 6px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--moon-color);
}

.dream-card-deep {
  color: var(--moon-color);
}


/* ============================================
   Profile
   ============================================ */

.profile-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-card {
  text-align: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
}

.profile-name { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.profile-email { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.profile-balance { font-size: 0.9rem; color: var(--accent); margin-top: 8px; }

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.upgrade-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 8px;
}

.btn-secondary {
  padding: 12px 24px;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:active { background: var(--glass-hover); }

.btn-danger {
  padding: 12px 24px;
  background: none;
  border: 1px solid rgba(238, 85, 85, 0.25);
  border-radius: var(--radius-pill);
  color: var(--danger);
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}

.btn-danger:active { background: rgba(238, 85, 85, 0.1); }

.topup-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topup-intro,
.topup-package {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}

.topup-intro {
  padding: 18px 16px;
  text-align: center;
}

.topup-intro__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.topup-intro__text,
.topup-intro__context {
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.topup-intro__context {
  color: rgba(248, 217, 132, 0.92);
}

.topup-packages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topup-package {
  padding: 16px;
}

.topup-package__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.topup-package__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.topup-package__price {
  font-size: 0.92rem;
  color: rgba(248, 217, 132, 0.95);
  white-space: nowrap;
}

.topup-package__amount {
  margin-top: 8px;
  font-size: 1rem;
  color: rgba(245, 240, 255, 0.95);
}

.topup-package__hint {
  margin: 8px 0 14px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.topup-package__actions {
  display: flex;
  gap: 10px;
}

.topup-package__actions .btn-primary,
.topup-package__actions .btn-secondary {
  width: 100%;
}

.topup-disabled-note,
.topup-package__error {
  margin-top: 10px;
  font-size: 0.8rem;
  color: #ffb4b4;
  line-height: 1.45;
}

/* ============================================
   Tablet / Desktop (480px+)
   ============================================ */

@media (min-width: 480px) {
  .moon {
    width: 380px;
    height: 380px;
  }

  .message { max-width: 80%; }
  .message-content { font-size: 0.95rem; }
  .dream-bridge__actions { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 768px) {
  .app { max-width: 520px; }
}

/* На широком экране даём матрице и таро всю ширину — иначе их
   двухколоночный лейаут (canvas слева, чат справа) сжимается в полоску. */
@media (min-width: 900px) {
  .app:has(#matrixViewScreen:not([hidden])),
  .app:has(#tarotSpreadScreen:not([hidden])) {
    max-width: 1100px;
  }
}

/* ============================================
   Общий десктоп-каркас экрана инструмента (T-2.2)
   ============================================
   Фундамент для матрицы/таро/астрологии/сонника: на ≥1024px экран
   распахивается на всю ширину (как home), хедер растягивается по краям,
   а тело экрана превращается в 3-колоночный grid вокруг центральной оси
   (визуал/канвас по центру, доп. панели по бокам). Конкретная раскладка —
   какой блок куда попадает — задаётся в CSS каждого инструмента через
   класс-модификатор (matrix.css/tarot.css/astrology.css), сам каркас
   не дублируется. Мобайл (<1024px) не затронут — правила только внутри
   медиа-запроса. */
@media (min-width: 1024px) {
  /* Широкий экран — по маркеру .screen--wide, а не по перечню id: новый
     инструмент-экран на 3-колоночном каркасе помечается классом и получает
     полную ширину без правки этого файла. Маркер обязательно вешается на
     тот же элемент, чей [hidden] переключает showScreen()/showHub() —
     .tool-desk сам по себе не годится: это внутренний div, у него никогда
     не появляется [hidden] (переключается только на обёртке-экране), и
     :has() увидел бы такой .tool-desk даже у скрытого экрана.
     matrixIntroScreen и форма новой карты натальной умышленно узкие и
     центрированные поверх заблюренной луны (.screen--veil-desktop) — маркер
     на них не ставим. astrologyIntroScreen — два под-состояния
     (T-2.x доработка): маркер стоит на #astrologyHub (сам переключает
     свой [hidden]), а не на всём экране — иначе оба под-состояния получили
     бы одну и ту же ширину.
     Селектор через #app (id), а не .app (class): в блоке выше (900px)
     живёт свой .app:has(#id...) для matrixView/tarotSpread с специфичностью
     ID — при равной специфичности здесь побеждает более поздний по
     исходнику; на классе класс мы бы проиграли этому более старому
     ID-правилу на любой ширине ≥1024px. */
  #app:has(.screen--wide:not([hidden])) {
    max-width: none;
  }

  /* Хедер экрана инструмента — на всю ширину, как .home-header */
  .screen-header {
    padding: 1.5rem 2.5rem;
  }

  /* Каркас: левая/правая колонка — доп. панели (легенда, инфо, чат),
     центральная — главный визуал (октаграмма, карты, портрет карты). */
  .tool-desk {
    display: grid;
    grid-template-areas: "left center right";
    grid-template-columns: minmax(220px, 1fr) minmax(auto, 640px) minmax(280px, 1fr);
    align-items: start;
    gap: 0 2rem;
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 2rem 3rem;
    overflow: hidden;
  }
  .tool-desk__left   { grid-area: left; min-width: 0; }
  .tool-desk__center { grid-area: center; min-width: 0; }
  .tool-desk__right  {
    grid-area: right;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  /* Чат-панель инструмента (матрица/таро/натальная) в рамке — на мобиле
     чат просто продолжает поток экрана (верхний бордер вместо рамки). */
  .tool-desk__right .matrix-chat {
    margin-top: 0;
    border-top: none;
    border-radius: 18px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
  }

  /* Сонник (T-2.x доработка): дневник снов слева — только десктоп. */
  .chat-diary-side {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
  }
}

/* Мобилка (<1024px): .tool-desk у сонника — просто колонка на всю высоту
   экрана (чат как и раньше, без боковой панели дневника). Обязательно
   внутри max-width — иначе (ID+class) перебивает .tool-desk{display:grid}
   из блока выше на ЛЮБОЙ ширине, а не только на мобиле. */
@media (max-width: 1023px) {
  #chatScreen .tool-desk {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  #chatScreen .tool-desk__right {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  .chat-diary-side { display: none; }
}

@media (min-width: 768px) {

  .moon {
    width: min(400px, 58vh);
    height: min(400px, 58vh);
  }
}

@media (min-width: 1024px) {
  .moon { width: min(460px, 62vh); height: min(460px, 62vh); }
}

/* ============================================
   HOME (Hub) screen
   ============================================ */

#homeScreen {
  position: relative;
  min-height: 100dvh;
}

/* Шапка — оверлей поверх рабочего стола, чтобы home-desk занимал всю высоту
   экрана и его центр совпадал с центром fixed-луны (иначе высота хедера
   смещала бы окно-луну вниз) */
.home-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1rem;
}

.home-logo {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #f8d984 0%, #c69cff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-actions { display: flex; gap: 0.5rem; align-items: center; }

/* Чип баланса в шапке: всегда на виду, тап → пополнение */
.home-balance-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.home-balance-chip:active { background: var(--glass-hover); }

/* Рабочий стол — grid-раскладка (мобила):
   приветствие + мысль дня прижаты вверх; «luna» — пустой гибкий простор под
   большую луну (fixed-фон), он опускает чипы ниже диска; «gap» — второй простор
   под чипами, чтобы они висели в полосе ПОД луной, а не липли к лунному блоку.
   Лунный блок + док прижаты к низу. */
.home-desk {
  display: grid;
  grid-template-areas:
    "greet"
    "lunar"
    "luna"
    "chips"
    "gap"
    "aside"
    "dock"
    "seo";
  grid-template-rows: auto auto 1.4fr auto 1fr auto auto auto;
  justify-items: center;
  align-items: center;
  height: 100dvh;
  /* сверху — клиренс под оверлей-шапку, снизу — safe-area */
  padding: 5rem 1rem calc(1.5rem + var(--safe-bottom));
  gap: 14px;
}

.home-greeting {
  grid-area: greet;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  /* Текст нередко ложится поверх яркой луны — без тени сливается со светом */
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

/* .home-guide и .home-thought удалены (docs/HOME-SCREEN.md §2): «здравствуй»,
   совет гида и мысль дня были тремя абзацами подряд, и экран читался как
   поток, а не как обращение. Теперь это одна строка .home-greeting, которую
   собирает app.js::composeHomeLine. */

/* Строка T1 Lumiora-агента на интро-экранах инструментов (Этап С3) —
   вне грида home, поэтому без grid-area, но тот же тёплый курсивный тон. */
.agent-line {
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  margin: -12px 0 20px;
}

/* «Разобрать без этой темы» — отказ от контекста, приехавшего по мосту.
   Приглушённая ссылка под строкой прибытия: заметна тому, кто её ищет, и
   не спорит за внимание с основным действием экрана. */
.agent-line__drop {
  display: block;
  margin: 6px auto 0;
  padding: 2px 6px;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.8rem;
  font-style: normal;
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.75;
  cursor: pointer;
}
.agent-line__drop:hover,
.agent-line__drop:focus-visible {
  opacity: 1;
  color: var(--text);
}

/* Строка T2 Lumiora-агента, пока стримится разбор (Этап С3) — живёт
   внутри message-content первого чанка стрима, исчезает с первым токеном. */
.stream-hint {
  display: block;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* .tool-bridge остался для мостов ВНУТРИ сонника (renderDreamBridge): у него
   свой механизм с переносом темы сна. Мост «что дальше» после разбора отсюда
   уехал в карточку на главной (05.08.2026). */
.tool-bridge {
  margin: 16px 16px 4px;
  padding: 14px;
  border: 1px solid rgba(248, 217, 132, 0.2);
  border-radius: 14px;
  background: rgba(248, 217, 132, 0.08);
}
.tool-bridge__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(245, 240, 255, 0.96);
}
.tool-bridge__text {
  margin-top: 6px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: rgba(220, 220, 240, 0.72);
}
.tool-bridge__btn {
  width: 100%;
  margin-top: 12px;
}

/* Продолжения разговора под последним ответом в чате инструмента
   (AgentUI.renderFollowUps). Не легенда позиций слева — та описывает карту,
   а это следующий вопрос словами человека. Вертикальный список, а не чипы
   в строку: вопросы длинные, в nowrap-чип не помещаются. */
.chat-followups {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 16px 4px;
}
.chat-followup {
  padding: 10px 14px;
  border: 1px solid rgba(248, 217, 132, 0.22);
  border-radius: 14px;
  background: rgba(248, 217, 132, 0.06);
  color: rgba(245, 240, 255, 0.9);
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.chat-followup:hover {
  background: rgba(248, 217, 132, 0.13);
  border-color: rgba(248, 217, 132, 0.38);
}
.chat-followup__cost {
  margin-left: 6px;
  font-size: 0.78rem;
  color: rgba(220, 220, 240, 0.6);
  white-space: nowrap;
}

/* Чипы Lumiora-агента: контекстные «следующие шаги» под приветствием */
.home-chips {
  grid-area: chips;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 420px;
}

.home-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--glass-card);
  /* Затемняющий бэкдроп: чипы часто ложатся на яркий
     диск луны — без brightness(0.6) стеклянная кнопка выцветает и тонет. */
  backdrop-filter: blur(16px) brightness(0.6);
  -webkit-backdrop-filter: blur(16px) brightness(0.6);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.home-chip:active { background: var(--glass-hover); transform: scale(0.97); }

/* Стили поля разговора на home (.home-talk*) удалены 05.08.2026 вместе с самим
   полем — docs/LUMIORA.md §4: разговор с Люмиорой идёт в чате инструмента. */

/* Строка Люмиоры при входе в чат инструмента (docs/LUMIORA.md §5) — сказать,
   кто сейчас отвечает. Слева, а не по центру: она стоит над полем ввода. */
.chat-agent-line {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 8px;
  line-height: 1.4;
}
/* Согласие на витрине для анонима: мелко, но до первого действия. */
.home-consent {
  margin: -4px 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  text-align: center;
  color: var(--text-muted);
  max-width: 420px;
}
.home-consent a { color: inherit; text-decoration: underline; }

/* Подпись «зачем аккаунт» над вкладками входа: гость пришёл сюда с пейволла,
   и первое, что он должен прочитать, — что разбор никуда не денется. */
.auth-reason {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--glass-card);
  border: 1px solid var(--glass-border);
  font-size: 0.84rem;
  line-height: 1.45;
  text-align: center;
  color: var(--text-soft, inherit);
}

/* Инфо-панель: лунный день + продолжить (на мобиле над доком, на десктопе справа) */
.home-aside {
  grid-area: aside;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}


/* «Где ты остановился» (docs/HOME-SCREEN.md §4) — единственная сущность
   правой колонки. Не пилюля-виджет, как прежние блоки: это карточка про
   человека, поэтому крупнее и с выравниванием по левому краю — колонка
   должна читаться как «твоё», а не как ещё одна кнопка в ряду.

   Веса внутри карточки (05.08.2026). Раньше тёплый акцент был на всём сразу:
   рамка и фон самой карточки, коробочки вопросов, кнопка шага — три яруса
   кричали одинаково, и колонка выглядела отдельным продуктом внутри продукта.
   Теперь акцент один и достаётся кнопке «что дальше» — единственному
   настоящему действию. Оправа карточки — обычное тёмное стекло с тёплым
   волоском, чтобы она читалась своей, но не спорила с луной.

   Кликабельность на заголовке, а не на всей карточке: клик по фону ничего не
   делает, а курсор-палец обещал обратное. */
.home-spot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  max-width: 360px;
  padding: 14px 16px;
  border: 1px solid rgba(248, 217, 132, 0.12);
  border-radius: var(--radius);
  background: var(--glass-card);
  backdrop-filter: blur(16px) brightness(0.6);
  -webkit-backdrop-filter: blur(16px) brightness(0.6);
  color: var(--text);
  font-family: inherit;
  text-align: left;
}
.home-spot__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.home-spot__title {
  font-weight: 600;
  font-size: 0.98rem;
  transition: color 0.15s ease;
}
.home-spot__head:hover .home-spot__title,
.home-spot__head:focus-visible .home-spot__title {
  color: rgba(248, 217, 132, 0.95);
}
.home-spot__head:active { transform: scale(0.99); }
.home-spot__note {
  font-size: 0.8rem;
  line-height: 1.35;
  color: rgba(230, 228, 245, 0.7);
}

/* Средний ярус карточки (Этап 3) — строчки с тёплой точкой-маркером, ровно как
   в наброске docs/HOME-SCREEN.md §4.2. Это заготовки реплик, а не
   кнопки-действия, и вес у них соответствующий: куда именно ведёт клик —
   вопрос поправки §11, на оформление он не влияет.
   Коробки с рамкой и фоном (были до 05.08.2026) делали из двух-трёх вопросов
   стопку кнопок и перетягивали внимание с настоящего действия — кнопки
   «что дальше» ярусом ниже. Маркер нужен для тача: там нет hover, и без него
   строчка не читалась бы как нажимаемая. */
.home-spot__questions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.home-spot__questions:not(:empty) {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(248, 217, 132, 0.15);
}
.home-spot__q {
  width: 100%;
  /* padding держит палец: строчка тонкая, а цель нажатия должна остаться
     крупной (мобила — основной экран) */
  padding: 7px 0 7px 14px;
  position: relative;
  border: 0;
  background: none;
  color: rgba(240, 240, 255, 0.8);
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s ease;
}
.home-spot__q::before {
  content: '·';
  position: absolute;
  left: 2px;
  color: rgba(248, 217, 132, 0.55);
}
.home-spot__q:hover,
.home-spot__q:focus-visible {
  color: rgba(248, 236, 205, 0.98);
  outline: none;
}
.home-spot__q:hover::before,
.home-spot__q:focus-visible::before {
  color: rgba(248, 217, 132, 0.95);
}

/* «Что дальше» — третий ярус карточки. Бывший мост из-под разбора: визуально
   отделён линией, потому что это уже не про то, что человек сделал, а про
   следующий шаг. Единственный тёплый акцент в карточке — остальные ярусы
   намеренно приглушены, чтобы эта кнопка читалась как её вывод. */
.home-spot__next {
  width: 100%;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(248, 217, 132, 0.15);
}
.home-spot__next-say {
  font-size: 0.8rem;
  line-height: 1.4;
  color: rgba(230, 228, 245, 0.72);
}
.home-spot__next-btn {
  width: 100%;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(248, 217, 132, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(248, 217, 132, 0.12);
  color: rgba(248, 236, 205, 0.95);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.home-spot__next-btn:hover { background: rgba(248, 217, 132, 0.2); }

/* Фаза луны — подпись, не кнопка (docs/HOME-SCREEN.md §2). Кнопкой она вела
   в сонник, и это была загадка: почему «убывающая луна» открывает разгадку
   снов. Совет по фазе теперь говорит Люмиора словами.
   Стоит сразу под её репликой, а не внизу экрана: низ отдан ряду SEO-ссылок
   (владелец, 05.08.2026), а фаза относится к зоне «что сейчас» — туда же,
   где и лунный совет, и рядом связь читается сама собой.
   Блоки .home-card-of-day и .home-continue удалены вместе с элементами:
   карта дня уехала в таро, возврат заменит карточка продолжения справа. */
.home-lunar-caption {
  grid-area: lunar;
  margin-top: -6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(230, 228, 245, 0.72);
  text-align: center;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  transition: color 0.3s ease;
}

/* Реплика Люмиоры сейчас про луну (Этап 4): подпись фазы берёт тот же тёплый
   акцент, что и чипы, — глаз связывает совет с фазой, из которой он взялся. */
.home-lunar-caption--active {
  color: rgba(248, 217, 132, 0.9);
}

/* SEO-крючки: ряд внутренних ссылок в самом низу главной. Тихий, приглушённый
   ряд — он не конкурирует ни с голосом Люмиоры, ни с инструментами, но даёт
   и человеку вход в готовый контент, и поисковику ссылки с главной на
   посадочные (docs/SEO-LANDINGS.md). Разметка статическая — см. index.html. */
.home-seo {
  grid-area: seo;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 14px;
  width: 100%;
  padding-top: 4px;
}
.home-seo__link {
  color: rgba(200, 200, 225, 0.45);
  font-size: 0.74rem;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.home-seo__link:hover {
  color: rgba(248, 217, 132, 0.8);
}

/* Док инструментов: flex, чтобы 3 или 4 значка центровались одинаково */
.home-dock {
  grid-area: dock;
  display: flex;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding-bottom: var(--safe-bottom);
}

.dock-item {
  flex: 1;
  max-width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 4px 10px;
  border: 1px solid rgba(198, 156, 255, 0.18);
  border-radius: 18px;
  background: var(--glass-card);
  /* brightness гасит яркую луну под значком, вокруг она остаётся полной */
  backdrop-filter: blur(20px) brightness(0.55);
  -webkit-backdrop-filter: blur(20px) brightness(0.55);
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s;
  animation: dockItemIn 0.5s ease-out backwards;
}
.dock-item:nth-child(2) { animation-delay: 0.05s; }
.dock-item:nth-child(3) { animation-delay: 0.10s; }
.dock-item:nth-child(4) { animation-delay: 0.15s; }

@keyframes dockItemIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dock-item:active {
  transform: scale(0.95);
  border-color: rgba(248, 217, 132, 0.4);
}

.dock-item:hover,
.dock-item:focus-visible {
  border-color: rgba(248, 217, 132, 0.45);
  outline: none;
}
.dock-item:hover .dock-item__icon,
.dock-item:focus-visible .dock-item__icon {
  border-color: rgba(248, 217, 132, 0.55);
  box-shadow:
    0 0 0 1px rgba(240, 232, 208, 0.3) inset,
    0 0 16px 3px var(--moon-glow),
    0 0 22px 6px var(--accent-glow);
  transform: scale(1.06);
}

/* Лунный диск: круглая оправа с тонким кольцом и свечением, как у самой луны на home */
.dock-item__icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(248, 217, 132, 0.22), rgba(198, 156, 255, 0.16) 60%, rgba(20, 20, 45, 0.4) 100%);
  border: 1px solid rgba(240, 232, 208, 0.25);
  box-shadow:
    0 0 0 1px rgba(240, 232, 208, 0.12) inset,
    0 0 10px 1px var(--moon-glow);
  color: #f8d984;
  transition: box-shadow 0.25s, border-color 0.25s, transform 0.25s;
}
.dock-item__icon svg { width: 26px; height: 26px; }
.dock-item--tarot .dock-item__icon { color: #c69cff; }
.dock-item--dreams .dock-item__icon { color: #9ec5ff; }
.dock-item__icon { position: relative; }

/* «Мой путь» (Этап С4) — компактный бейдж состояния поверх иконки дока,
   без роста высоты home-desk. done — тёплая галочка; partial — точка. */
.dock-item__badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  background: rgba(20, 20, 45, 0.92);
  border: 1px solid rgba(240, 232, 208, 0.3);
}
.dock-item__badge--done {
  color: #6ee7a0;
  border-color: rgba(110, 231, 160, 0.5);
}
.dock-item__badge--partial {
  color: #f8d984;
  border-color: rgba(248, 217, 132, 0.5);
}
.dock-item__badge--done::before { content: '✓'; }
.dock-item__badge--partial::before { content: '•'; }

.dock-item__label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

@media (min-width: 480px) {
  .dock-item { max-width: 104px; }
  .dock-item__icon { width: 50px; height: 50px; }
  .dock-item__icon svg { width: 30px; height: 30px; }
}

/* Десктоп-home (≥1024): отдельный трёхзонный лейаут, не «мобила по центру».
   Хедер на весь экран; слева — крупные инструменты колонкой, центр — большая
   луна, справа — инфо-панель (лунный день + продолжить, место под «Сегодня»).
   Должен стоять ПОСЛЕ базовых .home-* правил, иначе мобильный grid перекроет. */
@media (min-width: 1024px) {
  /* Home распахивается на всю ширину экрана (только когда home активен) */
  .app:has(#homeScreen:not([hidden])) { max-width: none; }

  .home-header { padding: 1.5rem 2.5rem; }

  .home-desk {
    grid-template-areas:
      "dock greet aside"
      "dock lunar aside"
      "dock chips aside"
      "dock luna  aside"
      "seo  seo   seo";
    grid-template-columns: minmax(240px, 1fr) minmax(auto, 640px) minmax(240px, 1fr);
    grid-template-rows: auto auto auto 1fr auto;
    padding: 4.5rem 3rem 2.5rem;
    gap: 0 2rem;
  }

  .home-greeting {
    align-self: end;
    font-size: 1.5rem;
    margin-bottom: 0.6rem;
  }

  .home-chips {
    max-width: none;
    justify-content: center;
    /* Отделяем чипы от блока приветствия+мысли — иначе читаются как его
       продолжение. Опускаем их отдельной строкой ниже. */
    margin-top: 1.6rem;
    margin-bottom: 0.6rem;
  }

  /* Док слева — вертикальная колонка крупных плиток (иконка + подпись в строку) */
  .home-dock {
    flex-direction: column;
    justify-content: center;
    align-self: center;
    width: 100%;
    max-width: 300px;
    gap: 12px;
    padding-bottom: 0;
  }
  .dock-item {
    flex: none;
    flex-direction: row;
    max-width: none;
    width: 100%;
    justify-content: flex-start;
    gap: 16px;
    padding: 16px 20px;
  }
  .dock-item__icon { width: 52px; height: 52px; }
  .dock-item__icon svg { width: 30px; height: 30px; }
  .dock-item__label { font-size: 15px; }

  /* Инфо-панель справа */
  .home-aside {
    align-self: center;
    align-items: stretch;
    max-width: 300px;
    gap: 12px;
  }
}

/* --- Cookie/аналитика consent-баннер (T-9.2) --- */
.cookie-consent-banner {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 1280;
  width: calc(100% - 32px);
  max-width: 640px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--glass-strong);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  box-sizing: border-box;
}
.cookie-consent-banner__text { flex: 1 1 280px; min-width: 180px; color: var(--text-muted); }
.cookie-consent-banner__text a { color: var(--accent); text-decoration: underline; }
.cookie-consent-banner__actions { display: flex; gap: 8px; flex: 0 0 auto; }
.cookie-consent-banner button {
  cursor: pointer;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  font-family: inherit;
}
/* --accent-strong, а не --accent: текст кнопки 14px полужирный, для него
   норма 4.5:1, и на обычном акценте белый давал 3.32:1. Кегль здесь поднять
   нельзя — баннер узкий (аудит контраста 07.08.2026). */
.cookie-consent-banner__accept { background: var(--accent-strong); color: #fff; }
.cookie-consent-banner__decline { background: transparent; color: var(--text-muted); border: 1px solid var(--glass-border); }
@media (max-width: 560px) {
  .cookie-consent-banner { bottom: 10px; width: calc(100% - 20px); padding: 10px 12px; gap: 6px 10px; }
  .cookie-consent-banner__text { flex: 1 1 100%; min-width: 0; }
  .cookie-consent-banner__actions { flex: 1 1 100%; justify-content: flex-end; }
}

/* ===== Карточка сохранённого разбора =====
   Общая для «Твоих разборов» (натальные) и «Твоих матриц» —
   один вид списка в двух инструментах, поэтому стиль здесь, а не
   в css/astrology.css или css/matrix.css. */
.reading-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 14px 16px;
  border: 1px solid rgba(142, 202, 230, 0.18);
  border-radius: 14px;
  background: var(--glass-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: inherit;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.reading-card:active {
  transform: scale(0.985);
  border-color: rgba(142, 202, 230, 0.4);
}
.reading-card__date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.reading-card__signs {
  font-size: 14px;
  font-weight: 600;
}
/* Правая часть карточки разбора: метка разговора и бейдж. Обе — про
   состояние, поэтому стоят вместе и не расталкивают заголовок. */
.reading-card__meta {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* «3 вопроса» — в этом разборе уже был разговор (docs/LUMIORA.md §10.1).
   Тише бейджа: это не статус покупки, а след, и спорить с ним не должен. */
.reading-card__chat {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.reading-card__badge {
  flex-shrink: 0;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(142, 202, 230, 0.12);
  color: #8ecae6;
  white-space: nowrap;
}

/* ===== Подборщик субъекта «Кого разбираем?» (ЭТАП A4, PLAN-SPINE-MODE2.md)
   Общий для матрицы (#matrixSubjectPicker) и натальной (#astrologySubjectPicker) —
   прогрессивный профиль, выбор субъекта аккаунта перед формой даты. ===== */
.subject-picker {
  margin-bottom: 1rem;
}
.subject-picker:empty {
  display: none;
}
.subject-picker__title {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.subject-picker__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.subject-picker__chip {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(142, 202, 230, 0.18);
  background: var(--glass-card);
  color: inherit;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}
.subject-picker__chip span {
  color: var(--text-muted);
  font-size: 12px;
}
.subject-picker__chip.is-active {
  border-color: var(--accent);
  background: rgba(142, 202, 230, 0.14);
}
.subject-picker__add-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.subject-picker__add-btn {
  align-self: flex-start;
  background: none;
  border: none;
  color: #8ecae6;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}
.subject-picker__add-form {
  display: flex;
  gap: 8px;
}
.subject-picker__add-input {
  flex: 1;
  min-width: 0;
}
.subject-picker__add-error {
  font-size: 12px;
  color: #f27979;
}

/* ===== Хаб инструмента: список сохранённых разборов + «рассчитать новое»
   Общий для натальных карт (#astrologyHub) и матрицы (#matrixHub):
   слева список, по кнопке — форма нового расчёта по центру. ===== */
.tool-hub-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px;
}
@media (min-width: 1024px) {
  .tool-hub-side { padding: 0; }
  /* Левая колонка хаба скроллится сама, а не тянет весь экран. */
  .tool-hub .tool-desk__left {
    height: 100%;
    overflow-y: auto;
  }
}
/* Список не растянут на всю высоту колонки (родитель — не flex на весь
   рост, см. .tool-hub .tool-desk__left), поэтому размер — через max-height,
   а не flex, в отличие от .tool-side__list дневника снов. */
.tool-hub-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
  margin-bottom: 16px;
}
