/* ============================================================
   «Дао бессмертного» — Глобальные стили
   Восточный стиль Xianxia: изумрудно-золотая гамма,
   матовое стекло (gorilla glass), тёмный фон с fon.webp
   ============================================================ */

/* --- Сброс --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* --- CSS-Переменные --- */
:root {
  /* Тёмная база */
  --bg-dark: #0a0f0a;
  --bg-panel: rgba(10, 30, 20, 0.75);

  /* Золотые акценты */
  --gold: #c9a03a;
  --gold-light: #d4a844;
  --gold-bright: #e8c547;
  --gold-dark: #9a7a2a;
  --gold-glow: rgba(201, 160, 58, 0.4);

  /* Изумрудные акценты */
  --emerald: #2d8a4e;
  --emerald-light: #3ca55c;
  --emerald-glow: rgba(45, 138, 78, 0.3);

  /* Стеклянные эффекты */
  --glass-bg: rgba(10, 30, 20, 0.75);
  --glass-border: rgba(100, 200, 100, 0.2);
  --glass-border-gold: rgba(201, 160, 58, 0.35);
  --glass-blur: blur(20px);
  --glass-shine: rgba(255, 255, 255, 0.04);

  /* Цвета интерфейса */
  --text-primary: #e8e6dc;
  --text-secondary: #8a9a7a;
  --text-hint: #5a6a5a;
  --danger: #e84545;
  --success: #3ca55c;
  --info: #3b82f6;
  --purple: #a855f7;

  /* Геометрия */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 18px;

  /* Raw safe-area insets (устанавливаются через JS фоллбэк или Telegram CSS) */
  --tg-safe-top: var(--tg-safe-area-inset-top, env(safe-area-inset-top, 0px));
  --tg-content-safe-top: var(--tg-content-safe-area-inset-top, 0px);
  --tg-safe-bottom: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --tg-content-safe-bottom: var(--tg-content-safe-area-inset-bottom, 0px);

  /* Комбинированный отступ: вырез камеры + кнопки Telegram */
  --safe-top: calc(var(--tg-safe-top) + var(--tg-content-safe-top));
  --safe-bottom: var(--tg-safe-bottom);

  /* Шрифты */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;

  /* Совместимость с Telegram темой */
  --tg-theme-bg-color: #0a0f0a;
  --tg-theme-text-color: #e8e6dc;
  --tg-theme-button-color: #c9a03a;
  --tg-theme-secondary-bg-color: rgba(10, 30, 20, 0.75);
  --tg-theme-hint-color: #5a6a5a;
  --tg-theme-link-color: #d4a844;
  --tg-theme-button-text-color: #0a0f0a;
}

/* --- Базовые стили --- */
html, body {
  height: 100%;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
}

/* Фоновое изображение с затемнением */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    url('/assets/fon.webp') center / cover no-repeat;
  filter: brightness(0.35) saturate(0.8);
}

/* Дополнительный затемняющий оверлей */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(201, 160, 58, 0.06), transparent 60%),
    radial-gradient(ellipse at 50% 70%, rgba(45, 138, 78, 0.05), transparent 50%),
    linear-gradient(180deg, rgba(10, 15, 10, 0.5), rgba(5, 10, 5, 0.7));
  pointer-events: none;
}

/* --- Контейнер приложения --- */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

/* Шапка и меню скрыты на старте, показываются после загрузки */
#app-header, #bottom-menu { display: none; }
#app.app-loaded #app-header,
#app.app-loaded #bottom-menu { display: flex; }

/* Контент: на загрузке — весь экран, после загрузки — с отступами */
.page-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* На время загрузки — без отступов под шапку/меню */
  padding: var(--safe-top) 14px var(--safe-bottom) 14px;
}
#app.app-loaded .page-content {
  padding: calc(56px + var(--safe-top) + 12px) 14px calc(72px + var(--safe-bottom) + 12px) 14px;
}

/* --- Шапка — стеклянная --- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: calc(56px + var(--safe-top));
  padding: var(--safe-top) 12px 0 12px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
  object-fit: cover;
  background: rgba(201, 160, 58, 0.1);
  flex-shrink: 0;
}

.header-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(201, 160, 58, 0.12);
  flex-shrink: 0;
}

.header-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.header-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.header-stage {
  font-size: 11px;
  color: var(--gold-light);
  font-weight: 500;
  letter-spacing: 0.2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Пинг в шапке */
.header-ping {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  letter-spacing: 0.3px;
}

.header-ping.low    { color: #3ca55c; }
.header-ping.medium { color: #d4a844; }
.header-ping.high   { color: #e84545; }
.header-ping.offline { color: #e84545; }

.header-balance {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.3px;
}

.header-settings-btn {
  background: none;
  border: none;
  color: var(--text-hint);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s, transform 0.2s;
  line-height: 1;
}
.header-settings-btn:active {
  color: var(--gold-light);
  transform: rotate(30deg);
}

/* Кастомный скроллбар */
.page-content::-webkit-scrollbar {
  width: 3px;
}
.page-content::-webkit-scrollbar-track {
  background: transparent;
}
.page-content::-webkit-scrollbar-thumb {
  background: rgba(201, 160, 58, 0.2);
  border-radius: 2px;
}

/* --- Нижнее меню — стеклянное --- */
.bottom-menu {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: calc(66px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--glass-border);
}

.bottom-menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  padding: 6px 4px;
  background: none;
  border: none;
  color: var(--text-hint);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.25s, text-shadow 0.25s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  border-radius: var(--radius-sm);
  position: relative;
}

.bottom-menu-btn:active {
  transform: scale(0.94);
}

.bottom-menu-btn.active {
  color: var(--gold-bright);
  text-shadow: 0 0 18px var(--gold-glow);
}

.bottom-menu-btn.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
  box-shadow: 0 0 10px var(--gold-glow);
}

.bottom-menu-btn-icon {
  font-size: 22px;
  line-height: 1;
  transition: transform 0.2s;
}

.bottom-menu-btn.active .bottom-menu-btn-icon {
  transform: translateY(-2px);
}

.bottom-menu-btn-label {
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.2px;
}

/* --- Toast-уведомления — стеклянные --- */
#toast-container {
  position: fixed;
  top: calc(56px + var(--safe-top) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  opacity: 0;
  transform: translateY(-20px);
  animation: toastSlideIn 0.35s ease forwards;
  pointer-events: auto;
  max-width: 320px;
  text-align: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.2px;
}

.toast.success {
  background: linear-gradient(135deg, rgba(45, 138, 78, 0.85), rgba(60, 165, 92, 0.85));
  border-color: rgba(60, 165, 92, 0.3);
  box-shadow: 0 4px 24px rgba(45, 138, 78, 0.3);
}
.toast.error {
  background: linear-gradient(135deg, rgba(185, 28, 28, 0.85), rgba(239, 68, 68, 0.85));
  border-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 4px 24px rgba(239, 68, 68, 0.3);
}
.toast.warning {
  background: linear-gradient(135deg, rgba(201, 160, 58, 0.85), rgba(212, 168, 68, 0.85));
  color: #0a0f0a;
  border-color: rgba(212, 168, 68, 0.3);
  box-shadow: 0 4px 24px rgba(201, 160, 58, 0.3);
}
.toast.info {
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.85), rgba(59, 130, 246, 0.85));
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 4px 24px rgba(59, 130, 246, 0.3);
}

@keyframes toastSlideIn {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastFadeOut {
  to { opacity: 0; transform: translateY(-20px); }
}

/* --- Модальное окно — стеклянное --- */
#modal-container {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#modal-container.active {
  pointer-events: auto;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease;
}

.modal-window {
  position: relative;
  background: linear-gradient(135deg, rgba(15, 40, 25, 0.95), rgba(10, 25, 15, 0.95));
  border: 1px solid var(--glass-border-gold);
  border-radius: var(--radius-lg);
  padding: 28px 22px 22px;
  min-width: 280px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalScaleIn 0.3s ease;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6), 0 0 30px rgba(201, 160, 58, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 18px;
  text-align: center;
  letter-spacing: 0.5px;
}

.modal-body {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.7;
  margin-bottom: 22px;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* --- Прогресс-бар — золотой градиент --- */
.progress-bar {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.progress-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-bright));
  box-shadow: 0 0 12px var(--gold-glow);
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 500;
}

/* --- Стеклянная панель --- */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
}

.glass-panel-gold {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-gold);
  border-radius: var(--radius);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3), 0 0 20px rgba(201, 160, 58, 0.06);
}

/* --- Карточка элемента коллекции --- */
.card-item {
  position: relative;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.2s, box-shadow 0.25s, border-color 0.25s;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.card-item:active {
  transform: scale(0.97);
}

.card-item.rarity-common    { border-color: rgba(156, 163, 175, 0.3); }
.card-item.rarity-uncommon  { border-color: rgba(60, 165, 92, 0.35);  box-shadow: 0 0 14px rgba(60, 165, 92, 0.1); }
.card-item.rarity-rare      { border-color: rgba(59, 130, 246, 0.35); box-shadow: 0 0 18px rgba(59, 130, 246, 0.15); }
.card-item.rarity-epic      { border-color: rgba(168, 85, 247, 0.4);  box-shadow: 0 0 24px rgba(168, 85, 247, 0.2); }
.card-item.rarity-legendary { border-color: rgba(212, 168, 68, 0.5);  box-shadow: 0 0 28px rgba(212, 168, 68, 0.3); }

.card-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.card-item-icon {
  font-size: 30px;
}

.card-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.card-item-rarity {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.card-item-stats {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.card-item-stat {
  display: flex;
  align-items: center;
  gap: 3px;
}

/* --- Кнопки — золотой градиент --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  line-height: 1.2;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 60%);
  pointer-events: none;
  border-radius: inherit;
}

.btn:active {
  transform: scale(0.95);
}

/* Основная золотая кнопка */
.btn-primary {
  background: linear-gradient(135deg, #8a6a20, #c9a03a, #d4a844);
  color: #0a0f0a;
  box-shadow: 0 3px 16px rgba(201, 160, 58, 0.35);
  border: 1px solid rgba(212, 168, 68, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 22px rgba(201, 160, 58, 0.5);
}

.btn-primary:active {
  box-shadow: 0 2px 10px rgba(201, 160, 58, 0.25);
}

/* Вторичная стеклянная кнопка */
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
  border-color: rgba(201, 160, 58, 0.3);
  box-shadow: 0 2px 12px rgba(201, 160, 58, 0.15);
}

/* Изумрудная кнопка */
.btn-success {
  background: linear-gradient(135deg, #1a5c30, #2d8a4e, #3ca55c);
  color: #fff;
  box-shadow: 0 3px 16px rgba(45, 138, 78, 0.35);
  border: 1px solid rgba(60, 165, 92, 0.3);
}

/* Опасная кнопка */
.btn-danger {
  background: linear-gradient(135deg, #7f1d1d, #991b1b, #dc2626);
  color: #fff;
  box-shadow: 0 3px 16px rgba(220, 38, 38, 0.35);
  border: 1px solid rgba(220, 38, 38, 0.3);
}

.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-block { width: 100%; }
.btn-icon { width: 42px; height: 42px; padding: 0; border-radius: 50%; }

.btn:disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(0.5);
}

/* --- Бейджи --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
}

.badge-gold {
  background: rgba(201, 160, 58, 0.15);
  color: var(--gold-light);
  border-color: rgba(201, 160, 58, 0.25);
}

.badge-green {
  background: rgba(60, 165, 92, 0.12);
  color: var(--emerald-light);
  border-color: rgba(60, 165, 92, 0.2);
}

.badge-blue {
  background: rgba(59, 130, 246, 0.12);
  color: #4a9eff;
  border-color: rgba(59, 130, 246, 0.2);
}

.badge-purple {
  background: rgba(168, 85, 247, 0.12);
  color: #a855f7;
  border-color: rgba(168, 85, 247, 0.2);
}

/* --- Ресурсная карточка — стеклянная --- */
.resource-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.resource-card:hover {
  border-color: var(--glass-border-gold);
  box-shadow: 0 0 20px rgba(201, 160, 58, 0.08);
}

.resource-card-title {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
}

.resource-card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.3px;
}

/* --- Заглушка «В разработке» --- */
.stub-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  min-height: 360px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-gold);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.stub-page-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
  filter: drop-shadow(0 0 12px var(--gold-glow));
}

.stub-page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.stub-page-desc {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 300px;
  line-height: 1.7;
}

.stub-page-badge {
  margin-top: 20px;
  padding: 10px 18px;
  background: rgba(201, 160, 58, 0.08);
  border: 1px solid rgba(201, 160, 58, 0.2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--gold-light);
  font-weight: 600;
  letter-spacing: 0.3px;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* --- Анимированный тайцзи (инь-ян) --- */
.yin-yang {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold-light) 50%, var(--emerald-light) 50%, var(--emerald-light) 100%);
  position: relative;
  animation: yinYangSpin 4s linear infinite;
  box-shadow: 0 0 30px var(--gold-glow), 0 0 60px var(--emerald-glow);
}

.yin-yang::before {
  content: '';
  position: absolute;
  width: 50%;
  height: 50%;
  background: var(--emerald-light);
  border-radius: 50%;
  top: 25%;
  left: 0;
  box-shadow: inset 0 0 0 5px var(--gold-light);
}

.yin-yang::after {
  content: '';
  position: absolute;
  width: 50%;
  height: 50%;
  background: var(--gold-light);
  border-radius: 50%;
  top: 25%;
  right: 0;
  box-shadow: inset 0 0 0 5px var(--emerald-light);
}

@keyframes yinYangSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* --- Карточки сект --- */
.sect-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.15s;
  cursor: pointer;
}

.sect-card:active {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(201, 160, 58, 0.2);
  transform: scale(0.98);
}

.sect-card-emoji { font-size: 38px; margin-bottom: 8px; }
.sect-card-name { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.sect-card-bonus { font-size: 12px; color: var(--gold-light); font-weight: 500; }

/* --- Карточки локаций --- */
.location-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.location-card:active {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(201, 160, 58, 0.15);
}

.location-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.location-card-level {
  font-size: 11px;
  color: var(--gold-light);
  margin-left: auto;
  font-weight: 600;
}

.location-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Экран загрузки --- */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 20px;
  text-align: center;
}

.loading-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--gold-light);
  margin-top: 24px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.loading-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-weight: 500;
}

.loading-tip {
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 20px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
  max-width: 290px;
  transition: opacity 0.3s;
}

.loading-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 14px;
  font-weight: 500;
}

.loading-version {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 0.5px;
  font-weight: 600;
}

.loading-channel {
  position: fixed;
  bottom: calc(6px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--text-hint);
  text-decoration: none;
  font-weight: 500;
}

.loading-ping {
  position: fixed;
  top: calc(16px + var(--safe-top));
  right: 16px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
}

.loading-ping.low    { color: var(--emerald-light); }
.loading-ping.medium { color: var(--gold-light); }
.loading-ping.high   { color: var(--danger); }

/* --- Инпут --- */
.input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}

.input::placeholder {
  color: var(--text-hint);
}

/* --- Сетки --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }

/* --- Флексы --- */
.flex-row { display: flex; align-items: center; gap: 8px; }
.flex-col { display: flex; flex-direction: column; gap: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* --- Спейсеры --- */
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* --- Текстовые стили --- */
.text-center { text-align: center; }
.text-gold { color: var(--gold-light); }
.text-hint { color: var(--text-hint); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 10px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 26px; }
.font-bold { font-weight: 700; }

/* --- Страница ошибки --- */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  color: var(--danger);
  font-weight: 500;
}

.template-error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* --- Анимация фона ци (летающие частицы) --- */
.qi-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.qi-particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--gold-light);
  border-radius: 50%;
  opacity: 0;
  animation: qiFloat linear infinite;
  box-shadow: 0 0 8px var(--gold-glow);
}

@keyframes qiFloat {
  0%   { opacity: 0; transform: translateY(100vh) scale(0); }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.1; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

/* --- Анимация пульсации фона --- */
.bg-pulse {
  position: relative;
  overflow: hidden;
}

.bg-pulse::before {
  content: '';
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle at 50% 50%, var(--gold-glow), transparent 70%);
  animation: pulseBg 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulseBg {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.15); }
}

/* --- Адаптивность --- */
@media (max-width: 360px) {
  .page-content {
    padding-left: 10px;
    padding-right: 10px;
  }
  .bottom-menu-btn-icon { font-size: 20px; }
  .bottom-menu-btn-label { font-size: 9px; }
  .resource-card-value { font-size: 22px; }
  .modal-window { padding: 22px 16px; }
  .btn { padding: 10px 16px; font-size: 13px; }
  .header-name { max-width: 90px; }
}

@media (min-width: 768px) {
  .page-content {
    max-width: 480px;
    margin: 0 auto;
  }
  .bottom-menu {
    max-width: 480px;
    margin: 0 auto;
  }
  .header {
    max-width: 480px;
    margin: 0 auto;
  }
}
