/* ============================================================
   ТЕМА ОФОРМЛЕНИЯ "ЗВЁЗДНОЕ НЕБО" — покупается в магазине (js/shop-ui.js),
   включается/выключается через POST /api/site-theme. Применяется как
   класс .theme-starry на <html> (см. js/theme-starry.js) — грузится ПОСЛЕ
   всех остальных стилей на каждой странице сайта, поэтому здесь можно
   просто переопределять те же самые фоновые градиенты через тот же
   уровень специфичности + !important (страницы дублируют один и тот же
   светлый градиент в нескольких CSS-файлах и инлайновых <style>, единого
   общего источника для фона пока нет — этот файл переопределяет их все
   разом, не трогая сами оригиналы).
============================================================ */

html.theme-starry body {
  background: linear-gradient(160deg, #0a0e2a 0%, #151238 35%, #1e1550 70%, #0d0a24 100%) !important;
}

/* Экраны-контейнеры (menu-screen и т.п.) обычно САМИ рисуют непрозрачный
   фон поверх всего (position:fixed;inset:0), из-за чего канвас со звёздами
   (z-index:0, см. ниже) оказался бы под ними и никогда не был виден.
   Делаем их прозрачными в этой теме — тёмный градиент и звёзды видны
   сквозь них с уровня body/canvas. */
html.theme-starry .menu-screen,
html.theme-starry .spider-screen,
html.theme-starry .monopoly-screen,
html.theme-starry .mafia-screen,
html.theme-starry .modal-screen,
html.theme-starry .standalone-intro {
  background: transparent !important;
}

/* Лендинговые страницы игр (games/ИМЯ-ИГРЫ/index.html — "Монополия онлайн...",
   "Мафия онлайн..." и т.д., отдельные от самого игрового экрана) держат
   свою карточку-описание в .standalone-intro-card — та же "стеклянная"
   логика, что и у .menu-card/.game-card ниже (объединено с той же
   группой селекторов намеренно). Заголовки h1/h2 внутри неё объединены с
   группой .hero-title ниже (не отдельным правилом) — по необъяснённой
   причине браузер иногда молча "теряет" отдельно стоящее правило с этим
   конкретным селектором при парсинге (воспроизведено и подтверждено:
   rule count в разобранной таблице стилей на 1 меньше, чем количество
   правил в самом файле) — объединение с уже работающей группой надёжно
   обходит эту особенность. */
html.theme-starry .standalone-home-link,
html.theme-starry .standalone-footnote {
  color: #a89cd8 !important;
}

/* Ночные оттенки карточек/панелей — те же полупрозрачные "стеклянные"
   блоки, что и в светлой теме, просто на тёмной подложке с холодным
   лунным акцентом вместо тёплого сиреневого. */
html.theme-starry .menu-card,
html.theme-starry .game-card,
html.theme-starry .rating-panel,
html.theme-starry .auth-modal-card,
html.theme-starry .profile-modal-card,
html.theme-starry .standalone-intro-card {
  background: rgba(30, 26, 60, 0.55) !important;
  border-color: rgba(150, 160, 255, 0.18) !important;
  box-shadow: 0 10px 40px rgba(5, 5, 20, 0.4) !important;
  color: #e4e2f8;
}

html.theme-starry .header-balance {
  background: rgba(30, 26, 60, 0.55) !important;
  border-color: rgba(150, 160, 255, 0.25) !important;
}

html.theme-starry .header-logo {
  background: linear-gradient(135deg, #c8b8ff, #8a9bff) !important;
  -webkit-background-clip: text !important;
}

html.theme-starry .hero-title,
html.theme-starry .profile-header-name,
html.theme-starry .game-name,
html.theme-starry .standalone-intro-card h1,
html.theme-starry .standalone-intro-card h2 {
  color: #e8e6ff !important;
}

html.theme-starry .hero-sub,
html.theme-starry .game-desc,
html.theme-starry .game-players {
  color: #a8a4d8;
}

/* ============================================================
   ПОЛНЫЙ ПРОХОД ПО ТЕКСТУ И ОСТАВШИМСЯ СВЕТЛЫМ БЛОКАМ
   ------------------------------------------------------------
   Правило темы: тёмный фон -> весь текст интерфейса белый/светлый,
   светлый фон -> весь текст тёмный (как было). До этого раздела
   переопределялись только несколько заметных мест — здесь собраны ВСЕ
   оставшиеся классы сайта с жёстко заданным тёмно-фиолетовым (#3a2a4a и
   похожие) или приглушённо-серым (#9080b0 и похожие) текстом, из-за
   которых на тёмном фоне буквы становились еле видны или сливались
   совсем (ровно баг с никами в рейтинге и цифрами баланса на скриншотах).
   Карт самих игр (.spider-card, доска монополии и т.п.) это НЕ касается —
   у них всегда свой белый фон независимо от темы сайта, трогать не нужно.
============================================================ */

/* -- Заголовочный текст (был тёмно-фиолетовым #3a2a4a) -> светлый -- */
html.theme-starry .menu-title,
html.theme-starry .auth-form-title,
html.theme-starry .auth-account-name,
html.theme-starry .header-avatar-menu-name,
html.theme-starry .header-balance .balance-amount,
html.theme-starry .header-avatar-menu-profile,
html.theme-starry .rating-title,
html.theme-starry .rname,
html.theme-starry .spider-title,
html.theme-starry .promo-mycode-history-code,
html.theme-starry .shop-item-name,
html.theme-starry #mafiaRoomCodeDisplay,
html.theme-starry .mafia-count-value,
html.theme-starry .mafia-lobby-player-row,
html.theme-starry .mafia-lobby-room-host {
  color: #eceaff !important;
}

/* -- Приглушённый серо-сиреневый текст (подписи, метки, второстепенные
      строки) -> светлее, чтобы не терялся на тёмном фоне -- */
html.theme-starry .menu-sub,
html.theme-starry .auth-switch-link,
html.theme-starry .auth-why-note,
html.theme-starry .auth-tiny-note,
html.theme-starry .auth-modal-close,
html.theme-starry .auth-account-balance,
html.theme-starry .nick-row label,
html.theme-starry .games-label,
html.theme-starry .site-version-footer,
html.theme-starry .footer-telegram-link,
html.theme-starry .back-link,
html.theme-starry .hero-welcome,
html.theme-starry .profile-loading,
html.theme-starry .profile-tab,
html.theme-starry .profile-empty-note,
html.theme-starry .profile-history-date,
html.theme-starry .rating-empty,
html.theme-starry .rmeta,
html.theme-starry .rrank,
html.theme-starry .rating-my-rank,
html.theme-starry .spider-topbar-stats,
html.theme-starry .promo-hint,
html.theme-starry .promo-mycode-desc,
html.theme-starry .promo-empty,
html.theme-starry .shop-empty-text,
html.theme-starry .shop-item-cat,
html.theme-starry .shop-item-desc,
html.theme-starry .standalone-intro-card p,
html.theme-starry .mafia-switch-label,
html.theme-starry .mafia-role-chip-label,
html.theme-starry .lobby-list-title,
html.theme-starry .lobby-list-empty,
html.theme-starry .mafia-lobby-room-meta {
  color: #b8b4e0 !important;
}
html.theme-starry .mafia-role-chip:has(input:checked) .mafia-role-chip-label {
  color: #d8b8ff !important;
}
html.theme-starry .rating-my-rank b {
  color: #c8b8ff !important;
}

/* -- Поля ввода (логин/пароль/ник/промокод) — были белыми с тёмным
      текстом, теперь та же лунная "стеклянная" подложка -- */
html.theme-starry .auth-input,
html.theme-starry .nick-input,
html.theme-starry .promo-input {
  background: rgba(20, 18, 46, 0.5) !important;
  border-color: rgba(150, 160, 255, 0.3) !important;
  color: #eceaff !important;
}

/* -- Оставшиеся непрозрачные светлые "коробки" — карточка аккаунта,
      строки рейтинга, выпадающее меню аватарки, карточки магазина,
      кнопка "Назад" в играх, верхняя панель Пасьянса, неактивные вкладки
      рейтинга -- все переводим на тот же лунный полупрозрачный стиль -- */
html.theme-starry .auth-account-card,
html.theme-starry .rrow,
html.theme-starry .header-avatar-menu,
html.theme-starry .shop-item-card,
html.theme-starry .mono-back,
html.theme-starry .spider-topbar,
html.theme-starry .spider-undo-btn,
html.theme-starry .net-auth-required-box,
html.theme-starry .net-btn,
html.theme-starry .lang-toggle-btn,
html.theme-starry .mafia-settings-section,
html.theme-starry .mafia-role-chip,
html.theme-starry .mafia-lobby-room-card,
html.theme-starry .mafia-lobby-player-row,
html.theme-starry .mafia-count-btn,
html.theme-starry .room-row,
html.theme-starry .net-player-row,
html.theme-starry #netRoomCodeDisplay,
html.theme-starry .net-shuffle-btn,
html.theme-starry .panel,
html.theme-starry .inp,
html.theme-starry .btn-ghost,
html.theme-starry .mafia-add-bot-btn {
  background: rgba(30, 26, 60, 0.55) !important;
  border-color: rgba(150, 160, 255, 0.22) !important;
  color: #eceaff !important;
}
html.theme-starry .panel-title,
html.theme-starry .room-name {
  color: #eceaff !important;
}
html.theme-starry .or-divider {
  color: #b8b4e0 !important;
}
html.theme-starry .or-divider::before,
html.theme-starry .or-divider::after {
  background: rgba(150, 160, 255, 0.22) !important;
}
html.theme-starry .net-auth-required-text,
html.theme-starry .net-lobby-hint,
html.theme-starry .net-player-order-label,
html.theme-starry .room-meta,
html.theme-starry .room-players,
html.theme-starry .online-label {
  color: #b8b4e0 !important;
}
html.theme-starry .net-player-name {
  color: #eceaff !important;
}
html.theme-starry .game-pill,
html.theme-starry .header-back-link {
  background: rgba(144, 96, 200, 0.18) !important;
  border-color: rgba(150, 160, 255, 0.3) !important;
  color: #d0b8ff !important;
}
html.theme-starry .room-icon {
  background: rgba(150, 160, 255, 0.12) !important;
}
html.theme-starry .room-join {
  background: rgba(144, 96, 200, 0.25) !important;
  color: #d0b8ff !important;
}
html.theme-starry .online-count {
  color: #eceaff !important;
}

/* Экран выбора сложности в Пасьянсе — своя отдельная светлая "стеклянная"
   коробка карточек выбора, отдельная от всего перечисленного выше. */
html.theme-starry .spider-difficulty-screen h1 {
  color: #eceaff !important;
}
html.theme-starry .spider-difficulty-screen p,
html.theme-starry .spider-diff-btn .diff-sub {
  color: #b8b4e0 !important;
}
html.theme-starry .spider-diff-btn {
  background: rgba(30, 26, 60, 0.55) !important;
  border-color: rgba(150, 160, 255, 0.22) !important;
}
html.theme-starry .spider-diff-btn .diff-label {
  color: #eceaff !important;
}
html.theme-starry .spider-win-card {
  background: rgba(30, 26, 60, 0.92) !important;
}
html.theme-starry .spider-win-card h2 {
  color: #eceaff !important;
}
html.theme-starry .spider-win-card p {
  color: #b8b4e0 !important;
}
html.theme-starry .rrow.top1 {
  background: linear-gradient(135deg, rgba(245, 200, 66, 0.16), rgba(245, 200, 66, 0.05)) !important;
  border-color: rgba(224, 160, 32, 0.3) !important;
}
html.theme-starry .rrow.me {
  background: rgba(144, 96, 200, 0.16) !important;
  border-color: rgba(180, 150, 255, 0.4) !important;
}
html.theme-starry .rtab {
  background: rgba(150, 160, 255, 0.14) !important;
  color: #c8c4ec !important;
}
html.theme-starry .rtab:hover {
  background: rgba(150, 160, 255, 0.24) !important;
}
html.theme-starry .rtab.active {
  color: #fff !important;
}
html.theme-starry .spider-topbar-stats b,
html.theme-starry .spider-back-btn {
  color: #eceaff !important;
}
html.theme-starry .promo-section-title {
  color: #d8d4f4 !important;
}
html.theme-starry .promo-mycode {
  background: rgba(150, 160, 255, 0.12) !important;
  border-color: rgba(150, 160, 255, 0.4) !important;
  color: #c8b8ff !important;
}
html.theme-starry .promo-copy-btn,
html.theme-starry .shop-item-btn-owned,
html.theme-starry .promo-redemption-reward {
  background: rgba(150, 160, 255, 0.14) !important;
  color: #c8b8ff !important;
}
html.theme-starry .auth-logout-btn,
html.theme-starry .spider-restart-btn {
  background: rgba(224, 96, 96, 0.14) !important;
  border-color: rgba(224, 96, 96, 0.4) !important;
}

/* Полотно падающих/мерцающих звёзд — рисуется в js/theme-starry.js,
   растянуто на весь экран позади контента (z-index ниже любого
   интерфейсного элемента), клики сквозь него не блокируются. */
#starryThemeCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: none;
}
html.theme-starry #starryThemeCanvas {
  display: block;
}
/* Контентные слои сайта и так уже позиционированы поверх (menu-screen
   и т.д. используют z-index:500+), поэтому канвасу достаточно z-index:0 —
   он ложится прямо на фон, под всем остальным. */
