/* Общие для всех тем размеры/радиусы */
:root {
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-pill: 999px;
}

/* ===== Тёмная (минимальная, по умолчанию для системной тёмной темы) ===== */
:root,
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --card-bg: #171717;
  --card-border: #2a2a2a;
  --ink: #f5f5f5;
  --muted: #9a9a9a;
  --line: #2a2a2a;
  --glow-1: #f5f5f5;
  --glow-2: #b5b5b5;
  --badge-text: #0a0a0a;
  --title-grad-1: #ffffff;
  --title-grad-2: #a0a0a0;
  --title-glow: 0 0 14px rgba(255, 255, 255, 0.16);
  --danger: #ff6b6b;
  --btn-bg: #f5f5f5;
  --btn-border: rgba(255, 255, 255, 0.14);
  --btn-text: #0a0a0a;
  --nav-bg: rgba(10, 10, 10, 0.92);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 24px rgba(0, 0, 0, 0.45);
  --glass-blur: none;
  --page-bg-image: none;
  --nav-indicator-bg: rgba(255, 255, 255, 0.1);
  --nav-indicator-shadow: none;
}

/* ===== Светлая (минимальная, по умолчанию для системной светлой темы) — оппозитна тёмной ===== */
:root[data-theme="light"] {
  --bg: #ffffff;
  --card-bg: #f6f6f5;
  --card-border: #e5e5e3;
  --ink: #0a0a0a;
  --muted: #6e6e6e;
  --line: #e5e5e3;
  --glow-1: #0a0a0a;
  --glow-2: #4a4a4a;
  --badge-text: #ffffff;
  --title-grad-1: #0a0a0a;
  --title-grad-2: #6e6e6e;
  --title-glow: 0 0 14px rgba(0, 0, 0, 0.14);
  --danger: #ff5c5c;
  --btn-bg: #0a0a0a;
  --btn-border: rgba(10, 10, 10, 0.1);
  --btn-text: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.95);
  --shadow-card: 0 1px 2px rgba(20, 20, 20, 0.04), 0 8px 20px rgba(20, 20, 20, 0.06);
  --glass-blur: none;
  --page-bg-image: none;
  --nav-indicator-bg: rgba(10, 10, 10, 0.07);
  --nav-indicator-shadow: none;
}

/* ===== Космос (дополнительная тема из дроп-меню) — космический туман ===== */
:root[data-theme="cosmic"] {
  --bg: #0b0c2a;
  --card-bg: rgba(255, 255, 255, 0.07);
  --card-border: rgba(255, 255, 255, 0.12);
  --ink: #f5f5f7;
  --muted: #a8a8bf;
  --line: rgba(255, 255, 255, 0.14);
  --glow-1: #8b5cf6;
  --glow-2: #38bdf8;
  --badge-text: #ffffff;
  --title-grad-1: var(--glow-1);
  --title-grad-2: var(--glow-2);
  --title-glow: 0 0 18px rgba(139, 92, 246, 0.35);
  --danger: #ff6b6b;
  --btn-bg: linear-gradient(135deg, rgba(139, 92, 246, 0.7), rgba(56, 189, 248, 0.7));
  --btn-border: rgba(255, 255, 255, 0.25);
  --btn-text: #ffffff;
  --nav-bg: rgba(12, 12, 30, 0.75);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px rgba(0, 0, 0, 0.5);
  --glass-blur: blur(20px);
  --page-bg-image:
    radial-gradient(circle at 18% 20%, rgba(139, 92, 246, 0.55), transparent 42%),
    radial-gradient(circle at 84% 12%, rgba(56, 189, 248, 0.42), transparent 46%),
    radial-gradient(circle at 50% 88%, rgba(236, 72, 153, 0.26), transparent 55%),
    linear-gradient(165deg, #05050f 0%, #0b0c2a 45%, #1a0b2e 100%);
  --nav-indicator-bg: linear-gradient(135deg, rgba(139, 92, 246, 0.45), rgba(56, 189, 248, 0.35));
  --nav-indicator-shadow: 0 0 16px rgba(139, 92, 246, 0.45);
}

/* ===== 5 премиум-тем (добавлено 2026-08-30, за замочком без подписки) =====
   Та же структура переменных, что у Космоса выше — просто другая палитра.
   Разблокировка проверяется в js/theme.js (isPremium из /api/me.php), тут
   только сам вид. */

:root[data-theme="sunset"] {
  --bg: #1a0f0a;
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 180, 120, 0.18);
  --ink: #fff3e8;
  --muted: #d9a889;
  --line: rgba(255, 180, 120, 0.16);
  --glow-1: #ff7e5f;
  --glow-2: #feb47b;
  --badge-text: #2a0f05;
  --title-grad-1: #ff7e5f;
  --title-grad-2: #feb47b;
  --title-glow: 0 0 18px rgba(255, 126, 95, 0.4);
  --danger: #ff5c5c;
  --btn-bg: linear-gradient(135deg, #ff7e5f, #feb47b);
  --btn-border: rgba(255, 255, 255, 0.2);
  --btn-text: #2a0f05;
  --nav-bg: rgba(26, 15, 10, 0.85);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px rgba(0, 0, 0, 0.45);
  --glass-blur: blur(16px);
  --page-bg-image:
    radial-gradient(circle at 20% 15%, rgba(255, 126, 95, 0.5), transparent 45%),
    radial-gradient(circle at 80% 10%, rgba(254, 180, 123, 0.4), transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(200, 60, 90, 0.3), transparent 55%),
    linear-gradient(165deg, #1a0f0a 0%, #2b1410 50%, #3d1a1a 100%);
  --nav-indicator-bg: linear-gradient(135deg, rgba(255, 126, 95, 0.45), rgba(254, 180, 123, 0.35));
  --nav-indicator-shadow: 0 0 16px rgba(255, 126, 95, 0.45);
}

:root[data-theme="ocean"] {
  --bg: #041b23;
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(100, 220, 220, 0.16);
  --ink: #e6fbfb;
  --muted: #8fc9c9;
  --line: rgba(100, 220, 220, 0.14);
  --glow-1: #00c9a7;
  --glow-2: #22a6d8;
  --badge-text: #04222a;
  --title-grad-1: #00c9a7;
  --title-grad-2: #22a6d8;
  --title-glow: 0 0 18px rgba(0, 201, 167, 0.35);
  --danger: #ff6b6b;
  --btn-bg: linear-gradient(135deg, #00c9a7, #22a6d8);
  --btn-border: rgba(255, 255, 255, 0.2);
  --btn-text: #04222a;
  --nav-bg: rgba(4, 27, 35, 0.85);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 34px rgba(0, 0, 0, 0.45);
  --glass-blur: blur(16px);
  --page-bg-image:
    radial-gradient(circle at 15% 20%, rgba(0, 201, 167, 0.4), transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(34, 166, 216, 0.4), transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(10, 80, 120, 0.3), transparent 55%),
    linear-gradient(165deg, #041b23 0%, #06262f 50%, #0a3540 100%);
  --nav-indicator-bg: linear-gradient(135deg, rgba(0, 201, 167, 0.45), rgba(34, 166, 216, 0.35));
  --nav-indicator-shadow: 0 0 16px rgba(0, 201, 167, 0.45);
}

:root[data-theme="forest"] {
  --bg: #0e1a0f;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(140, 200, 120, 0.16);
  --ink: #eef7ea;
  --muted: #a3c79a;
  --line: rgba(140, 200, 120, 0.14);
  --glow-1: #6fbf5c;
  --glow-2: #c9a24b;
  --badge-text: #10230f;
  --title-grad-1: #6fbf5c;
  --title-grad-2: #c9a24b;
  --title-glow: 0 0 16px rgba(111, 191, 92, 0.35);
  --danger: #ff6b6b;
  --btn-bg: linear-gradient(135deg, #6fbf5c, #4c8f45);
  --btn-border: rgba(255, 255, 255, 0.18);
  --btn-text: #0e1a0f;
  --nav-bg: rgba(14, 26, 15, 0.88);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 30px rgba(0, 0, 0, 0.4);
  --glass-blur: blur(14px);
  --page-bg-image:
    radial-gradient(circle at 20% 20%, rgba(111, 191, 92, 0.35), transparent 45%),
    radial-gradient(circle at 80% 15%, rgba(201, 162, 75, 0.28), transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(40, 80, 40, 0.3), transparent 55%),
    linear-gradient(165deg, #0e1a0f 0%, #16241a 50%, #1c2e1c 100%);
  --nav-indicator-bg: linear-gradient(135deg, rgba(111, 191, 92, 0.4), rgba(201, 162, 75, 0.3));
  --nav-indicator-shadow: 0 0 14px rgba(111, 191, 92, 0.4);
}

:root[data-theme="neon"] {
  --bg: #08060f;
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 60, 220, 0.2);
  --ink: #f5eaff;
  --muted: #b090c9;
  --line: rgba(255, 60, 220, 0.18);
  --glow-1: #ff2fd0;
  --glow-2: #35e0ff;
  --badge-text: #14001a;
  --title-grad-1: #ff2fd0;
  --title-grad-2: #35e0ff;
  --title-glow: 0 0 20px rgba(255, 47, 208, 0.5);
  --danger: #ff3860;
  --btn-bg: linear-gradient(135deg, #ff2fd0, #35e0ff);
  --btn-border: rgba(255, 255, 255, 0.25);
  --btn-text: #08060f;
  --nav-bg: rgba(8, 6, 15, 0.85);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 36px rgba(255, 47, 208, 0.15);
  --glass-blur: blur(18px);
  --page-bg-image:
    radial-gradient(circle at 18% 18%, rgba(255, 47, 208, 0.45), transparent 42%),
    radial-gradient(circle at 82% 12%, rgba(53, 224, 255, 0.4), transparent 46%),
    radial-gradient(circle at 50% 92%, rgba(120, 20, 220, 0.3), transparent 55%),
    linear-gradient(165deg, #08060f 0%, #150a24 45%, #1c0b2e 100%);
  --nav-indicator-bg: linear-gradient(135deg, rgba(255, 47, 208, 0.4), rgba(53, 224, 255, 0.35));
  --nav-indicator-shadow: 0 0 18px rgba(255, 47, 208, 0.5);
}

:root[data-theme="sakura"] {
  --bg: #fff5f7;
  --card-bg: #ffe9ee;
  --card-border: #ffd0dc;
  --ink: #4a2530;
  --muted: #a56b7a;
  --line: #ffd0dc;
  --glow-1: #ff8fab;
  --glow-2: #ffc2d1;
  --badge-text: #ffffff;
  --title-grad-1: #ff6f91;
  --title-grad-2: #ff9ab5;
  --title-glow: 0 0 14px rgba(255, 111, 145, 0.25);
  --danger: #e0526b;
  --btn-bg: linear-gradient(135deg, #ff8fab, #ffb3c6);
  --btn-border: rgba(255, 255, 255, 0.4);
  --btn-text: #ffffff;
  --nav-bg: rgba(255, 245, 247, 0.92);
  --shadow-card: 0 1px 2px rgba(200, 100, 130, 0.08), 0 10px 24px rgba(200, 100, 130, 0.12);
  --glass-blur: none;
  --page-bg-image: none;
  --nav-indicator-bg: rgba(255, 143, 171, 0.18);
  --nav-indicator-shadow: none;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  background-image: var(--page-bg-image);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
}

.app-container.with-nav {
  padding-bottom: 104px;
}

/* ===== Главный экран ===== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 28px;
  padding: 12px 14px;
  background: var(--nav-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.header-spacer {
  width: 38px;
  flex-shrink: 0;
}

.header-titles {
  flex: 1;
  text-align: center;
}

.app-header h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.4px;
  background: linear-gradient(90deg, var(--title-grad-1), var(--title-grad-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: var(--title-glow);
}

.theme-toggle,
.volume-mute-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  transition: transform 0.12s ease;
}

.theme-toggle:active,
.volume-mute-btn:active {
  transform: scale(0.92);
}

.theme-toggle svg,
.volume-mute-btn svg {
  width: 18px;
  height: 18px;
}

.local-clock {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
}

.home-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.home-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.level-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.level-emoji {
  font-size: 60px;
  margin-bottom: 14px;
}

.level-title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.2px;
  margin-bottom: 8px;
}

.level-description {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.stats-row {
  display: flex;
  gap: 12px;
}

.stat-box {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.stat-value-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.streak-flame {
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255, 140, 0, 0.65));
}

.prestige-trophy {
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(240, 199, 80, 0.65));
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* 4 плашки статов (после добавления Престижа) на узких телефонах не влезали
   с прежними отступами/шрифтом — крупные числа (например, монеты за 4 цифры)
   вылезали за рамку карточки. */
@media (max-width: 400px) {
  .stats-row {
    gap: 6px;
  }

  .stat-box {
    padding: 12px 6px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-label {
    font-size: 10px;
  }

  .streak-flame,
  .prestige-trophy {
    font-size: 16px;
  }

  /* .home-screen растягивает верх/низ через space-between — раз статы стали
     компактнее на узких экранах, пустого места между ними и кнопкой стало
     больше, и кнопка утекла к самому низу. Фиксируем отступ вместо
     растяжения на всю оставшуюся высоту. */
  .home-screen {
    justify-content: flex-start;
  }

  #start-workout-btn {
    margin-top: 28px;
  }
}

.primary-btn {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-pill);
  padding: 18px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

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

/* .primary-btn нигде в приложении не бывал disabled, кроме кнопки покупки
   премиума за монеты при нехватке баланса (js/premium.js) — без этого
   правила недоступная кнопка выглядела ТАК ЖЕ ярко, как рабочая, и казалась
   кликабельной. .secondary-btn:disabled ниже уже так делает. */
.primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.secondary-btn {
  background: var(--card-bg);
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  width: 100%;
}

.btn-row .secondary-btn {
  flex: 1;
  padding: 12px 8px;
  font-size: 13px;
}

/* ===== Каталог уровней ===== */

.catalog-title {
  font-size: 15px;
  font-weight: 800;
  /* Абсолютное позиционирование, а не просто "средний элемент во flex-ряду":
     .workout-header центрирует его через justify-content:space-between
     между двумя боковыми элементами, но это визуально центрирует заголовок
     ТОЛЬКО когда они одинаковой ширины. На /shop справа не пустой
     .header-spacer, а .coin-balance с текстом ("🦐 1234") — он шире, и
     заголовок "Магазин" из-за этого съезжал влево. Абсолютное позиционирование
     не зависит от ширины соседей вообще, работает одинаково на всех страницах. */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
}

.catalog-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#friends-logged-out {
  text-align: center;
  padding-top: 32px;
}

.catalog-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card);
}

.catalog-card.locked {
  opacity: 0.5;
}

.catalog-emoji {
  font-size: 32px;
  flex-shrink: 0;
}

.locked-emoji {
  font-size: 32px;
  filter: grayscale(85%);
  opacity: 0.8;
}

.catalog-info {
  flex: 1;
}

.catalog-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.catalog-name-locked {
  color: var(--muted);
}

.catalog-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.current-badge {
  background: var(--glow-1);
  color: var(--badge-text);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.catalog-card.clickable {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.catalog-card.clickable:active {
  transform: scale(0.98);
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 4px 10px rgba(20, 20, 20, 0.06);
}

.catalog-arrow {
  font-size: 22px;
  color: var(--muted);
  flex-shrink: 0;
}

.catalog-exercises {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.exercise-chip {
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* ===== Нижний таб-бар (Home / Exercises) ===== */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  background: var(--nav-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--line);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  z-index: 50;
}

.bottom-nav-inner {
  position: relative;
  max-width: 480px;
  width: 100%;
  display: flex;
  padding: 0 20px;
}

.nav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: var(--radius-md);
  background: var(--nav-indicator-bg);
  box-shadow: var(--nav-indicator-shadow);
  pointer-events: none;
  z-index: 0;
}

.nav-item {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 0;
  transition: color 0.12s ease, transform 0.12s ease;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-item:active {
  transform: scale(0.94);
}

.nav-item.active {
  color: var(--ink);
}

/* ===== Дроп-меню темы (Светлая / Тёмная / Космос) ===== */

.theme-popover-wrap {
  position: relative;
}

.theme-popover {
  position: absolute;
  top: 46px;
  right: 0;
  width: 168px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--nav-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  z-index: 60;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: none;
  background: none;
  border-radius: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.theme-option svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.theme-option.active {
  background: var(--card-bg);
}

.theme-option:active {
  opacity: 0.7;
}

.theme-option-lock {
  display: none;
  margin-left: auto;
  font-size: 12px;
  flex-shrink: 0;
}

.theme-option.is-locked {
  color: var(--muted);
}

.theme-option.is-locked .theme-option-lock {
  display: inline;
}

/* ===== Модалка премиума (сравнение + покупка, добавлено 2026-08-30) ===== */

.premium-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.premium-modal-content {
  /* --bg (непрозрачный базовый цвет темы), а не --card-bg — в "стеклянных"
     темах (Космос и 5 премиум-тем) --card-bg полупрозрачный (rgba с alpha
     0.05-0.07) и модалка сливалась с туманным фоном за затемнением.
     Пользователь явно попросил менее прозрачный фон именно из-за этого. */
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 26px 20px;
  max-width: 380px;
  width: 100%;
}

.premium-modal-title {
  font-size: 19px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 16px;
  color: var(--ink);
}

/* Модалка "Отправить отзыв" (/settings) — та же оболочка, что у
   .premium-modal (непрозрачный var(--bg), не var(--card-bg), см. комментарий
   выше про "стеклянные" темы), но со своими классами: содержимое разное
   (текстовое поле, а не сравнение тарифов), общий CSS не выносил специально —
   тот же принцип "не абстрагировать раньше второго реального переиспользования",
   что и у остальных модалок в проекте (ad-modal/first-workout-modal свои). */
.feedback-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.feedback-modal-content {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 26px 20px;
  max-width: 380px;
  width: 100%;
}

.feedback-modal-title {
  font-size: 19px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 10px;
  color: var(--ink);
}

.feedback-modal-hint {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 14px;
  line-height: 1.4;
}

.feedback-textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  padding: 12px;
}

.feedback-modal-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--glow-1);
  text-align: center;
  margin-top: 10px;
}

.feedback-modal-content .btn-row {
  margin-top: 16px;
}

.feedback-modal-content .btn-row .primary-btn,
.feedback-modal-content .btn-row .link-btn {
  flex: 1;
}

.premium-compare {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.premium-compare-col {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 10px;
}

.premium-compare-col.is-premium {
  border-color: var(--glow-1);
}

.premium-compare-header {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  margin-bottom: 10px;
  text-align: center;
}

.premium-compare-col.is-premium .premium-compare-header {
  color: var(--ink);
}

.premium-compare-row {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  line-height: 1.35;
}

.premium-cross {
  color: var(--danger);
  font-weight: 800;
  flex-shrink: 0;
}

.premium-check {
  color: var(--glow-1);
  font-weight: 800;
  flex-shrink: 0;
}

.premium-buy-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.premium-note {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  min-height: 16px;
}

.premium-active-note {
  font-size: 14px;
  color: var(--ink);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 8px;
}

/* ===== Модалка "подписка скоро закончится" (главная, раз в день) =====
   Визуально клон .daily-bonus-modal — та же анимация появления. */

.premium-expiry-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.premium-expiry-modal-content {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px 28px 26px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  animation: daily-bonus-modal-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.premium-expiry-modal-emoji {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 4px;
}

.premium-expiry-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 6px;
}

/* ===== Регулятор громкости (дроп-меню слева от кнопки темы) ===== */

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-popover-wrap {
  position: relative;
}

.volume-popover {
  position: absolute;
  top: 46px;
  right: 0;
  width: 150px;
  padding: 14px;
  background: var(--nav-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  z-index: 60;
}

.volume-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--glow-1);
  cursor: pointer;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--glow-1);
  cursor: pointer;
}

/* ===== Preview-режим на экране тренировки ===== */

.preview-banner {
  background: #fdf1cf;
  color: #8a6a10;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 10px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.complete-note {
  font-size: 14px;
  color: var(--muted);
  margin-top: 8px;
  margin-bottom: 8px;
}

/* ===== Экран тренировки ===== */

.workout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  position: relative;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.progress-dots {
  display: flex;
  gap: 6px;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line);
}

.progress-dot.active {
  background: var(--ink);
}

.progress-dot.done {
  background: var(--muted);
}

.workout-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 20px;
}

.exercise-video-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
}

.exercise-video {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
}

.exercise-youtube-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}

.exercise-youtube-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.exercise-youtube-link:hover {
  color: var(--ink);
}

.exercise-image-wrap {
  width: 100%;
  max-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  overflow: hidden;
  /* Иллюстрации — чёрные линии на прозрачном фоне (сконвертированы из SVG),
     на тёмной теме были бы не видны на var(--card-bg) — поэтому фон всегда
     светлый, независимо от темы, как у самих картинок. */
  background: #f4f4f4;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-card);
  padding: 10px;
}

.exercise-image {
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  display: block;
}

.phase-block {
  width: 100%;
  text-align: center;
}

/* !important — эта служебная utility-класс должна побеждать любые другие
   правила display, независимо от порядка объявления в файле (иначе, например,
   .auth-form.hidden ломался бы .auth-form { display: flex } объявленным ниже). */
.hidden {
  display: none !important;
}

.phase-label {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 12px;
}

.exercise-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.2px;
  margin-bottom: 16px;
}

.exercise-cue {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.5;
}

.big-timer {
  position: relative;
  font-size: 84px;
  font-weight: 800;
  letter-spacing: -3px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  isolation: isolate;
}

.big-timer::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 140px;
  height: 140px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--glow-1) 0%, var(--glow-2) 55%, transparent 75%);
  filter: blur(38px);
  opacity: 0.28;
  z-index: -1;
}

.complete-emoji {
  font-size: 64px;
  margin-bottom: 16px;
}

#done-reps-btn {
  margin-top: 28px;
  width: 100%;
}

/* ===== Вход / регистрация ===== */

.auth-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.form-field input {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 15px;
  color: var(--ink);
}

.form-field input:focus {
  outline: none;
  border-color: var(--muted);
}

.auth-error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 0;
}

.auth-hint {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  margin-bottom: 16px;
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s ease;
}

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

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

/* ===== Друзья ===== */

.add-friend-form {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.add-friend-form input {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink);
}

.section-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  margin: 20px 0 10px;
}

.friend-row {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.friend-info {
  flex: 1;
}

.friend-name {
  font-size: 14px;
  font-weight: 700;
}

/* Значок премиум-подписки рядом с ником — везде, где ник рендерится текстом
   (топ, друзья, свой профиль/настройки), см. usernameWithPremiumBadge()
   в js/frames.js. Фиксированный золотой цвет, а не var(--glow-1) — тот
   меняется по теме и не всегда читается как "премиум", а этот значок должен
   узнаваться одинаково в любой теме. */
.premium-badge {
  color: #f0c750;
  font-size: 0.85em;
  filter: drop-shadow(0 0 3px rgba(240, 199, 80, 0.65));
}

.friend-level {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.friend-row-actions {
  display: flex;
  gap: 8px;
}

.friend-remove-btn {
  font-size: 16px;
  color: var(--muted);
}

/* ===== Аватарки и лидерборд ===== */

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  flex-shrink: 0;
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.podium {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-top: 4px;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  max-width: 110px;
}

.podium-avatar-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.podium-avatar-wrap .avatar {
  position: relative;
  z-index: 1;
  width: 52px;
  height: 52px;
}

.podium-avatar-wrap .avatar-fallback {
  font-size: 20px;
}

.wreath,
.frame-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.list-avatar-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.list-avatar-wrap .avatar {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
}

.podium-name {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.podium-streak {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.podium-item.is-me .podium-name {
  color: var(--glow-1);
}

.leaderboard-rank {
  width: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.leaderboard-streak {
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.friend-row.is-me {
  border-color: var(--glow-1);
}

.profile-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-username {
  font-size: 17px;
  font-weight: 700;
  margin-top: 2px;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar-picker-label {
  margin: 16px 0 8px;
}

.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.avatar-picker-option {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1.5px solid var(--line);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.12s ease;
}

.avatar-picker-option:active {
  transform: scale(0.92);
}

.avatar-picker-option.is-selected {
  border-color: var(--glow-1);
  border-width: 2px;
}

.profile-card .auth-hint {
  text-align: left;
  margin: 10px 0 0;
  font-size: 12px;
}

.profile-card .btn-row {
  margin-top: 12px;
}

.profile-card .username-form,
#username-form {
  margin-top: 12px;
}

#finish-btn {
  margin-top: 24px;
  width: 100%;
}

/* ===== Магазин ===== */

.coin-balance {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.ad-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.ad-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.ad-card-desc {
  font-size: 12px;
  color: var(--muted);
}

.ad-card .primary-btn {
  padding: 12px 18px;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== Карточки премиума / отключения рекламы в магазине (2026-08-30) =====
   Та же структура, что у .ad-card — просто отдельные классы, чтобы не
   смешивать смысл ("посмотреть рекламу за монеты" vs "купить премиум/
   убрать рекламу"). */

.premium-card,
.ads-removal-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

.premium-card {
  border-color: var(--glow-1);
}

.premium-card-title,
.ads-removal-card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.premium-card-desc,
.ads-removal-card-desc {
  font-size: 12px;
  color: var(--muted);
}

.premium-card .primary-btn,
.ads-removal-card .secondary-btn {
  padding: 12px 18px;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

.ads-removal-card .secondary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ad-card .primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.coinpacks-hint {
  text-align: left;
  margin: -4px 0 12px;
}

.coinpacks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.coinpack-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-card);
}

.coinpack-amount {
  font-size: 14px;
  font-weight: 700;
}

.coinpack-card .secondary-btn {
  padding: 8px 6px;
  font-size: 12px;
  width: 100%;
}

.frames-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.frame-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-card);
}

.frame-card.is-equipped {
  border-color: var(--glow-1);
}

/* Чем дороже рамка, тем заметнее подложка карточки — 3 нарастающие ступени
   поверх базовой (частично дублирует полутон .frame-card.is-equipped, это
   ожидаемо: надетая дорогая рамка получает оба эффекта одновременно). */
.frame-card.rarity-uncommon {
  box-shadow: 0 0 10px rgba(94, 210, 150, 0.25);
}

.frame-card.rarity-rare {
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.35);
  border-color: rgba(139, 92, 246, 0.4);
}

.frame-card.rarity-legendary {
  box-shadow: 0 0 20px rgba(240, 199, 80, 0.45);
  border-color: rgba(240, 199, 80, 0.55);
}

/* Глитч-анимация для cyber_void: лёгкое дрожание + разъезжающиеся
   красно-циановые дубликаты через drop-shadow (классический RGB-split),
   шаговая (steps(1)), а не плавная — так глитч выглядит рублено, не как
   плавное покачивание. */
@keyframes frameGlitchJitter {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-1px, 1px); }
  40% { transform: translate(1px, -1px); }
  60% { transform: translate(-1px, 0); }
  80% { transform: translate(1px, 1px); }
}

.frame-ring.is-glitch {
  animation: frameGlitchJitter 2.2s steps(1) infinite;
  filter: drop-shadow(1px 0 0 #ff003c) drop-shadow(-1px 0 0 #00fff9);
}

.frame-preview {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.frame-preview .avatar {
  position: relative;
  z-index: 1;
  width: 52px;
  height: 52px;
  font-size: 22px;
}

.frame-name {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.frame-card .secondary-btn {
  padding: 8px 14px;
  font-size: 13px;
  width: 100%;
}

.ad-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.ad-modal-content {
  text-align: center;
  color: #fff;
}

.ad-modal-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.6;
  margin-bottom: 20px;
}

.ad-modal-timer {
  font-size: 64px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  margin-bottom: 16px;
}

.ad-modal-note {
  font-size: 13px;
  opacity: 0.7;
  max-width: 260px;
  margin: 0 auto;
}

/* ===== Достижения ===== */

.achv-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}

.achv-card.is-maxed {
  border-color: var(--glow-1);
}

.achv-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.achv-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.achv-name {
  font-size: 15px;
  font-weight: 700;
}

.achv-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.achv-tiers {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 14px;
}

.achv-tier {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.achv-tier-badge {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 3px solid var(--line);
  background: var(--bg);
}

.achv-tier.unlocked .achv-tier-badge {
  border-color: var(--tier-color);
}

.achv-tier.locked .achv-tier-badge {
  filter: grayscale(100%);
  opacity: 0.4;
}

.achv-tier-threshold {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
}

.achv-tier-reward {
  font-size: 9px;
  font-weight: 600;
  color: var(--muted);
  opacity: 0.8;
}

.achv-toast {
  background: var(--card-bg);
  border: 1px solid var(--glow-1);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.achv-progress-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-align: center;
}

.achv-progress-bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}

.achv-progress-fill {
  height: 100%;
  background: var(--glow-1);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

.achv-maxed {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--glow-1);
}

/* Боковые skyscraper-баннеры — только на широких экранах, где реально есть
   свободное место слева/справа от 480px-колонки контента. На телефоне их
   просто нет (display:none по умолчанию), чтобы не перекрывать интерфейс. */
.side-banner-slot {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 160px;
  height: 600px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  color: var(--muted);
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  z-index: 40;
}

.side-banner-left {
  left: 24px;
}

.side-banner-right {
  right: 24px;
}

@media (min-width: 1100px) {
  .side-banner-slot {
    display: flex;
  }
}


/* ===== ИИ-помощник (/assistant) ===== */

.assistant-cta {
  display: block;
  margin-top: 10px;
  text-align: center;
  text-decoration: none;
}

.assistant-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 12px;
}

.assistant-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 0;
}

.assistant-msg {
  max-width: 86%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.assistant-msg-bot {
  align-self: flex-start;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--ink);
}

.assistant-msg-user {
  align-self: flex-end;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--btn-text);
}

.assistant-msg-typing {
  opacity: 0.6;
}

.assistant-msg-error {
  color: var(--danger);
}

.assistant-remaining {
  font-size: 12px;
  color: var(--muted);
  min-width: 64px;
  text-align: right;
}

.assistant-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.assistant-chip {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.1s ease, color 0.1s ease;
}

.assistant-chip:active {
  transform: scale(0.97);
  color: var(--ink);
}

.assistant-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.assistant-input {
  flex: 1;
  min-width: 0;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-pill);
  color: var(--ink);
  font-size: 15px;
  padding: 14px 18px;
  outline: none;
}

.assistant-input:focus {
  border-color: var(--glow-2);
}

.assistant-send {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 1px solid var(--btn-border);
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

.assistant-send svg {
  width: 20px;
  height: 20px;
}

.assistant-send:active {
  transform: scale(0.94);
}

.assistant-send:disabled,
.assistant-input:disabled {
  opacity: 0.5;
  cursor: default;
}

.assistant-disclaimer {
  margin: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
}

.assistant-photo-btn {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--ink);
  border: 1px solid var(--card-border);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.assistant-photo-btn svg {
  width: 20px;
  height: 20px;
}

.assistant-photo-btn:active {
  transform: scale(0.94);
}

.assistant-photo-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.assistant-photo-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.assistant-photo-preview img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  flex: 0 0 auto;
}

.assistant-photo-remove {
  margin-left: auto;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.assistant-msg-image img {
  display: block;
  max-width: 220px;
  max-height: 220px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
}

.assistant-msg-image-caption {
  margin-top: 8px;
}


/* ===== Модалка дневного/недельного бонуса за вход (главная) ===== */

.daily-bonus-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.daily-bonus-modal-content {
  position: relative;
  isolation: isolate;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px 28px 26px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  animation: daily-bonus-modal-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.daily-bonus-modal-emoji {
  position: relative;
  font-size: 56px;
  line-height: 1;
  margin-bottom: 14px;
}

.daily-bonus-modal-emoji::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 130px;
  height: 130px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--glow-1) 0%, var(--glow-2) 55%, transparent 75%);
  filter: blur(32px);
  opacity: 0.3;
  z-index: -1;
}

.daily-bonus-modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 6px;
}

.daily-bonus-modal-streak {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 16px;
}

.daily-bonus-modal-weekly {
  display: inline-block;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  margin-bottom: 20px;
}

.daily-bonus-modal-close {
  width: 100%;
}

@keyframes daily-bonus-modal-in {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* ===== Челлендж с другом (страница друзей) ===== */

.challenge-win-text {
  color: var(--ink);
  font-weight: 700;
}

/* ===== Модалка подтверждения (удаление друга, отмена челленджа) ===== */
/* Тот же язык, что у .daily-bonus-modal — только тревожный акцент вместо
   праздничного: красное свечение за эмодзи и danger-кнопка подтверждения. */

.confirm-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.confirm-modal-content {
  position: relative;
  isolation: isolate;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px 28px 26px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  animation: daily-bonus-modal-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.confirm-modal-emoji {
  position: relative;
  font-size: 56px;
  line-height: 1;
  margin-bottom: 14px;
}

.confirm-modal-emoji::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 130px;
  height: 130px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--danger) 0%, transparent 75%);
  filter: blur(32px);
  opacity: 0.3;
  z-index: -1;
}

.confirm-modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 6px;
}

.confirm-modal-message {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 22px;
}

.confirm-modal-actions {
  display: flex;
  gap: 10px;
}

.confirm-modal-actions .secondary-btn,
.confirm-modal-actions .danger-btn {
  flex: 1;
}

.danger-btn {
  background: var(--danger);
  color: #fff;
  border: 1px solid var(--danger);
  border-radius: var(--radius-pill);
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

.danger-btn:active {
  transform: scale(0.97);
  opacity: 0.85;
}

/* ===== Модалка после первой тренировки (workout.html) ===== */
/* Тот же язык, что у .daily-bonus-modal — праздничный акцент, только с
   несколькими кнопками вместо одной (платформо-зависимое действие + опция
   поставить на рабочий стол + "может позже"). */

.first-workout-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.first-workout-modal-content {
  position: relative;
  isolation: isolate;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px 28px 26px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  animation: daily-bonus-modal-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.first-workout-modal-emoji {
  position: relative;
  font-size: 56px;
  line-height: 1;
  margin-bottom: 4px;
}

.first-workout-modal-emoji::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 130px;
  height: 130px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--glow-1) 0%, var(--glow-2) 55%, transparent 75%);
  filter: blur(32px);
  opacity: 0.3;
  z-index: -1;
}

.first-workout-modal-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
}

.first-workout-modal-body {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 6px;
}

/* ===== Настройки (/settings) ===== */

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Строка подписки в карточке "Аккаунт" — отделяем её от блока
   логина/аватара чуть заметнее, чем стандартный gap внутри .profile-card,
   иначе аккаунт и подписка визуально сливались в один пункт. */
.settings-row-subscription {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.language-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-pill);
  padding: 3px;
}

.language-toggle-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}

.language-toggle-btn.active {
  background: var(--btn-bg);
  color: var(--btn-text);
}

.settings-row-time {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.settings-time-input {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-pill);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  font-family: inherit;
}

.settings-row-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.settings-hint {
  margin-top: 8px;
}

.faq-link-btn {
  display: block;
  text-align: center;
  text-decoration: none;
}

/* Простой переключатель вкл/выкл поверх обычного чекбокса — стандартный
   приём (чекбокс визуально скрыт, стилизуем соседний span через :checked). */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.toggle-switch-track {
  position: absolute;
  inset: 0;
  background: var(--card-border);
  border-radius: var(--radius-pill);
  transition: background 0.2s ease;
  pointer-events: none;
}

.toggle-switch-track::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch input:checked + .toggle-switch-track {
  background: var(--btn-bg);
}

.toggle-switch input:checked + .toggle-switch-track::before {
  transform: translateX(20px);
}

.toggle-switch input:disabled {
  cursor: default;
}

.toggle-switch input:disabled + .toggle-switch-track {
  opacity: 0.5;
}

/* ===== FAQ (/faq) ===== */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faq-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  padding: 14px 16px;
  cursor: pointer;
}

.faq-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.faq-question.is-open .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 16px 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

/* ===== Вкладки категорий (/exercises, добавлено 2026-08-30) ===== */

.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  /* Скроллится по горизонтали на узких экранах, но без видимого скроллбара —
     та же логика, что и остальной UI на телефон-первом дизайне.
     min-width:0 обязателен: без него флекс-контейнер внутри .app-container
     (тоже flex-column) считает свою ширину по содержимому вместо того,
     чтобы сжаться и скроллиться — вкладки не листались, а раздвигали всю
     страницу вбок ("интерфейс съезжает"). */
  min-width: 0;
  scrollbar-width: none;
}

/* Переключатель Друзья/Общий на лидерборде — те же .category-tabs, но их
   всего два и они всегда влезают, поэтому по центру, а не прижаты к левому
   краю как категории тренировок (которых больше и они скроллятся). */
#leaderboard-scope-tabs {
  justify-content: center;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.category-tab-icon {
  font-size: 16px;
  line-height: 1;
}

.category-tab.active {
  color: var(--ink);
  border-color: var(--glow-1);
}

.category-tab-badge {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  background: var(--btn-bg);
  color: var(--btn-text);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}
