:root {
  --bg-0: #0a0a0f;
  --bg-1: #14141c;
  --bg-2: #1d1d28;
  --line: #2a2a38;
  --text: #ECE7DF;
  --muted: #8a8597;
  --gold: #E8B873;
  --gold-soft: #c79a5a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);

  /* Безопасные зоны (челка/жесты iOS). Минимум 0 — карточка edge-to-edge на всех
     экранах; на устройствах с челкой/жестами отступ = реальная safe-area. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Адаптивные размеры — переопределяются в медиа-запросах ниже */
  --card-pad-x: 20px;       /* левый/правый паддинг карточки */
  --card-pad-top: 22px;
  --card-pad-bottom: 26px;
  --app-gap: 16px;          /* зазор между блоками карточки */
  --stack-gap: 16px;        /* зазор внутри плеера */
  --controls-gap: 22px;     /* между prev/play/next */
  --play-size: 72px;        /* главная кнопка play */
  --ctrl-size: 52px;        /* prev/next */
  --side-size: 40px;        /* плавающие боковые иконки */
  --icon-size: 36px;        /* кнопки в шапке */
  --title-size: 18px;       /* CANDLE PLAYER */
  --track-title: 20px;      /* название трека */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow-x: hidden;             /* без горизонтальной прокрутки/свайпа на телефоне */
  overscroll-behavior-x: none;    /* отключить «жест назад/вперёд» по горизонтали */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(120% 80% at 50% -10%, #20202e 0%, var(--bg-0) 60%) fixed,
    var(--bg-0);
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 100vh;
  min-height: 100dvh;            /* учитывает панели браузера на телефонах */
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.app {
  position: relative;
  z-index: 1;                 /* карточка поверх ambient-света */
  width: 100%;
  max-width: none;            /* фуллскрин на всех экранах (edge-to-edge) */
  margin: 0 auto;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  background-size: cover;
  background-position: center;
  border: none;
  border-radius: 0;
  padding: var(--card-pad-top) var(--card-pad-x) var(--card-pad-bottom);
  display: flex;
  flex-direction: column;
  gap: var(--app-gap);
  overflow: hidden;
  /* Карточка занимает всю доступную высоту (за вычетом безопасных зон) — пустоты снизу нет */
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
}

/* Затемнение поверх фонового изображения для читабельности */
.app--has-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,10,15,0.72), rgba(10,10,15,0.88));
  z-index: 0;
  pointer-events: none;
}

/* --- Зеркальный / водяной пол ------------------------------------------
   Фактура поверхности снизу (за свечой-холстом); само отражение свечи
   рисует визуализатор на canvas. Линия воды ≈ низ свечи (~62% высоты). */
.app--floor-water::after,
.app--floor-mirror::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  top: 60%;
  z-index: 0;
  pointer-events: none;
}
.app--floor-mirror::after {
  /* Тёмная полировка с тонким бликом на линии и мягким градиентом вглубь */
  background:
    linear-gradient(180deg,
      rgba(255,250,235,0.10) 0,
      rgba(255,250,235,0) 2px),
    linear-gradient(180deg,
      rgba(20,22,30,0.30) 0,
      rgba(8,9,14,0.78) 100%);
}
.app--floor-water::after {
  /* Глубокая вода: лёгкие горизонтальные «волны» + затемнение книзу */
  background:
    repeating-linear-gradient(180deg,
      rgba(255,255,255,0.025) 0,
      rgba(255,255,255,0) 3px,
      rgba(0,0,0,0.03) 6px,
      rgba(255,255,255,0) 9px),
    linear-gradient(180deg,
      rgba(18,26,38,0.34) 0,
      rgba(6,10,18,0.82) 100%);
}

.app > * { position: relative; z-index: 1; }

/* По умолчанию обёртка плеера «прозрачна» для раскладки (вертикаль) */
/* Блок плеера — прижат к низу, поверх свечи-фона */
.stack {
  margin-top: auto;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap);
}

/* --- Горизонтальный режим (landscape): свеча сверху на всю ширину
   (свет заливает всё окно, без квадрата), плеер снизу --- */
.app--landscape {
  max-width: none;   /* фуллскрин */
}

/* Тёплая подсветка в фоне карточки (на всех экранах): дышит от музыки (--candle-glow)
   и центрируется на пламени (--glow-x/y). z-index:-1 — над фоном .app, но за холстом-
   свечой, поэтому заполняет тёмные углы, не перекрывая текст/контролы. */
.app::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(72% 66% at var(--glow-x, 50%) var(--glow-y, 42%),
    rgba(232, 184, 115, 0.13) 0%,
    rgba(232, 184, 115, 0.04) 45%,
    rgba(232, 184, 115, 0) 78%);
  opacity: var(--candle-glow, 0);
}
/* Раскладка остаётся вертикальным стеком (свеча flex:1 сверху, плеер внизу).
   Свет свечи заполняет всю верхнюю область до краёв окна. */

.app__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.app__title {
  font-size: var(--title-size);
  font-weight: 600;
  letter-spacing: clamp(0.5px, 0.4vw, 1.5px);
  text-transform: uppercase;
  white-space: normal;           /* рядом с логотипом разрешаем перенос «CANDLE / PLAYER» (локап) */
  line-height: 1.0;
  background: linear-gradient(90deg, var(--gold), #fff6e6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Левая группа шапки: логотип + название + кнопка свечи + индикатор луны */
.header__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Логотип в левом углу */
.app__logo {
  width: clamp(38px, 11vw, 48px);
  height: clamp(38px, 11vw, 48px);
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 11px;
}

/* Бренд: название + подпись «Pray & Play» столбиком */
.app__brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.05;
}
.app__tagline {
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: clamp(11px, 2.6vw, 14px);
  letter-spacing: 0.4px;
  margin-top: 2px;
  white-space: nowrap;
  background: linear-gradient(90deg, var(--gold-soft, #d6a96a), #fff6e6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.92;
}

/* Premium-чип под названием (слева). Открывает попап подписки. */
.premium-chip {
  align-self: flex-start;
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #1a1206;
  background: linear-gradient(95deg, #f0cf8e, #e8b873);
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(232, 184, 115, 0.35);
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}
.premium-chip:hover { box-shadow: 0 3px 14px rgba(232, 184, 115, 0.55); }
.premium-chip:active { transform: scale(0.96); }
.premium-chip__crown { font-size: 14px; line-height: 1; }
/* Активная подписка — спокойный «золотой» вид */
.premium-chip.is-active { background: linear-gradient(95deg, #ffe6a8, #f0cf8e); }

/* Магазин + достижения — под premium-чипом */
.brand-fabs {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.brand-fab {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--gold);
  background: var(--bg-2);
  border: 1.7px solid var(--gold-soft);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease;
}
.brand-fab svg { display: block; }
.brand-fab:hover { border-color: var(--gold); }
.brand-fab:active { transform: scale(0.92); }

/* Перки премиума */
.premium-perks {
  margin: 6px 0 14px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.35;
}
.premium-perks li { list-style: '✦  '; }
.premium-perks b { color: var(--gold); }

/* Планы подписки */
.plans { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.plan {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-radius: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.12s ease;
}
.plan:hover { border-color: var(--gold-soft); }
.plan:active { transform: scale(0.985); }
.plan--best { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.plan__info { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.plan__name { font-weight: 600; }
.plan__save { font-size: 11px; color: var(--gold-soft, var(--gold)); font-weight: 600; opacity: 0.92; }
.plan__col  { display: flex; flex-direction: column; align-items: flex-end; }
.plan__price { color: var(--gold); font-weight: 700; }
.plan__tag {
  position: absolute;
  top: -9px;
  left: 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #1a1206;
  background: var(--gold);
  padding: 2px 8px;
  border-radius: 999px;
}
.premium-status { font-size: 12px; color: var(--gold); text-align: center; margin: 2px 0 10px; min-height: 14px; }

/* Индикатор спокойного режима в шапке */
.calm-indicator {
  font-size: 16px;
  color: var(--gold);
  opacity: 0.9;
  line-height: 1;
}
.calm-indicator[hidden] { display: none; }

.header__right {
  position: relative;   /* якорь для попапа таймера сна */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;            /* совпадает с gap между кнопками магазина/кубка — равные отступы */
}
.header__right-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.7px solid rgba(255, 255, 255, 0.28);
  background: var(--bg-2);
  color: #e7e7ee;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.icon-btn:active { transform: rotate(45deg); }

/* Кнопка таймера сна (луна) — без вращения, с активной золотой подсветкой и
   бейджем оставшихся минут. */
.icon-btn--sleep { position: relative; }
.icon-btn--sleep:active { transform: scale(0.92); }
.icon-btn--sleep.is-active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(232, 184, 115, 0.14);
}
.icon-btn__badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--gold);
  color: #2a1d0c;
  font-size: 10px;
  font-weight: 800;
  line-height: 17px;
  text-align: center;
}

/* Попап быстрого доступа к таймеру сна (под кнопкой-луной в шапке) */
.sleep-pop {
  position: absolute;
  top: 52px;
  right: 0;
  z-index: 60;
  width: 226px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg-2, #15151c);
  border: 1px solid var(--gold-soft);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
}
.sleep-pop__title {
  font-size: 13px;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 9px;
}
.sleep-pop__left {
  margin-top: 9px;
  font-size: 12px;
  color: #b9b9c4;
  text-align: center;
  min-height: 14px;
  font-variant-numeric: tabular-nums;
}
.seg--sleep { width: 100%; }

/* Плавающие иконки справа под настройками — стиль как у настроек, с золотым кольцом */
.side-fab {
  position: absolute;
  right: 20px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--side-size);
  height: var(--side-size);
  border-radius: 50%;
  border: 1px solid var(--gold-soft);
  background: var(--bg-2);
  color: var(--gold);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease;
}
.side-fab:active { transform: scale(0.92); }
.side-fab:hover { border-color: var(--gold); }
/* Магазин справа вверху, достижения — ровно под ним */
.side-fab--shop { top: 90px; }
.side-fab--ach  { top: 140px; }

/* Каталог — полупрозрачный оверлей, свеча просвечивает сквозь фон */
.browse {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 70px 18px 22px;
  background: rgba(8, 8, 12, 0.40);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.2s ease;
}
.browse[hidden] { display: none; }
.browse > * { width: 100%; max-width: 414px; }

.browse__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.browse__title {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
}
.browse__title { margin-right: auto; }

/* Тумблер «Только любимые» в шапке каталога */
.liked-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.liked-filter:active { transform: scale(0.94); }
.liked-filter.is-on {
  color: var(--gold);
  border-color: var(--gold-soft);
  background: rgba(232, 184, 115, 0.12);
}
.liked-filter.is-on svg { fill: var(--gold); }

.browse__close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.2s ease;
}
.browse__close:active { transform: scale(0.92); }

/* В каталоге список занимает оставшуюся высоту и прокручивается */
.browse .playlist {
  max-height: none;
  flex: 1;
  min-height: 0;                 /* иначе flex-элемент не сжимается и список не скроллится */
  margin-top: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;  /* свайп не «протекает» на фон под оверлеем */
  touch-action: pan-y;           /* вертикальный скролл списка вместо прокрутки страницы */
  -webkit-overflow-scrolling: touch;
}
/* Полупрозрачные карточки — за ними видно свечу */
.browse .track { background: rgba(29, 29, 40, 0.62); }
.browse .track--active { background: linear-gradient(90deg, rgba(232, 184, 115, 0.16), rgba(29, 29, 40, 0.62)); }
.browse .tabs { background: rgba(10, 10, 15, 0.55); }

.side-fab__dot {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff5a5a;
  border: 2px solid var(--bg-2);
  box-shadow: 0 0 6px rgba(255, 90, 90, 0.8);
}
.side-fab__dot[hidden] { display: none; }

/* Список достижений */
.modal__card--wide { max-width: 360px; }
.ach-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}
.ach-list::-webkit-scrollbar { width: 4px; }
.ach-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.ach {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.ach__info { flex: 1; min-width: 0; text-align: left; }
.ach__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.ach__lvl { color: var(--gold); font-weight: 600; }
.ach__desc { margin-top: 2px; font-size: 11px; color: var(--muted); }
.ach__bar {
  margin-top: 7px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.ach__bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  border-radius: 4px;
}

.ach__claim {
  flex-shrink: 0;
  min-width: 78px;
  padding: 9px 10px;
  border: none;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.ach__claim:active { transform: scale(0.95); }
.ach__claim--ready {
  color: #1a1206;
  background: radial-gradient(circle at 35% 30%, #ffe6b8, var(--gold));
  box-shadow: 0 0 14px rgba(232, 184, 115, 0.4);
}
.ach__claim--locked {
  color: var(--muted);
  background: var(--bg-2);
  border: 1px solid var(--line);
  cursor: default;
}
.ach__claim--max {
  color: var(--gold);
  background: rgba(232, 184, 115, 0.10);
  border: 1px solid var(--gold-soft);
  cursor: default;
}

/* Таблица лидеров */
.lb-sub { margin-top: 2px; font-size: 12px; color: var(--muted); }
.lb-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}
.lb-list::-webkit-scrollbar { width: 4px; }
.lb-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.lb-row__rank {
  flex-shrink: 0;
  width: 30px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.lb-row__name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.lb-row__val {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.lb-row__val span { font-size: 12px; opacity: 0.7; margin-left: 3px; }
.lb-row--top1 .lb-row__rank { color: #ffd874; }
.lb-row--top2 .lb-row__rank { color: #d7d7e0; }
.lb-row--top3 .lb-row__rank { color: #e0a26a; }
.lb-row--me {
  background: rgba(232, 184, 115, 0.12);
  border-color: var(--gold-soft);
}
.lb-row--me .lb-row__name { color: var(--gold); }

/* Закреплённая строка игрока (видна на любой странице, если игрок не в текущем срезе) */
.lb-me {
  margin-top: 6px;
}

.lb-pager {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.lb-pager__btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-1);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.lb-pager__btn:hover { border-color: var(--gold); }
.lb-pager__btn:active { transform: scale(0.92); }
.lb-pager__btn:disabled { opacity: 0.35; cursor: default; }
.lb-pager__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  min-width: 48px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Улетающие лайтсы при получении награды */
.fly-light {
  position: fixed;
  z-index: 400;
  color: var(--gold);
  font-size: 18px;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(232, 184, 115, 0.8);
  transition: transform 0.85s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.85s ease;
}

/* Искорки взлетают вверх при лайке текущего трека */
.heart-spark {
  position: fixed;
  z-index: 600;
  color: var(--gold);
  font-size: 14px;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(232, 184, 115, 0.85);
  transform: translate(0, 0);
  opacity: 1;
  will-change: transform, opacity;
  transition: transform 0.7s ease-out, opacity 0.7s ease-out;
}
body.reduced-motion .heart-spark { transition-duration: 0.3s; }

/* Сервисные настройки */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 15px 16px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.settings-row:active { background: var(--bg-2); }
.settings-row__chev { color: var(--muted); font-size: 13px; }

/* Тумблер */
.settings-row--toggle { cursor: default; }
.settings-row--toggle input { display: none; }
.switch {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  flex-shrink: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease;
}
.settings-row--toggle input:checked ~ .switch {
  background: rgba(232, 184, 115, 0.25);
  border-color: var(--gold-soft);
}
.settings-row--toggle input:checked ~ .switch::after {
  transform: translateX(18px);
  background: var(--gold);
}

.settings-version {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 8px 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.5px;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(232, 184, 115, 0.4);
  text-underline-offset: 3px;
}
.settings-version:hover { color: var(--gold); }
.settings-version:active { transform: scale(0.98); }

.settings-site {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.5px;
  text-decoration: underline;
  text-decoration-color: rgba(232, 184, 115, 0.4);
  text-underline-offset: 3px;
}
.settings-site:hover { color: var(--gold); }

/* Сегмент-контрол (Ориентация) */
.settings-row--seg { cursor: default; }
.seg {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.seg__btn {
  padding: 6px 11px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.seg__btn--active {
  background: var(--bg-2);
  color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--line);
}

.light-counter {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 15px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s ease, transform 0.12s ease;
}
.light-counter:active { transform: scale(0.96); }
.light-counter:hover { border-color: var(--gold-soft); }

.light-counter__icon { color: var(--gold); }
.light-counter__value {
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease, text-shadow 0.25s ease, transform 0.25s ease;
}
/* Тонкий прогресс-бар у нижней кромки счётчика: до следующей монетки (золотой)
   или до следующего расхода в ручном режиме (тёплый красный, убывает). */
.light-counter__bar {
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 2.5px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.light-counter__bar.is-on { opacity: 1; }
.light-counter__bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: var(--gold);
}
.light-counter__bar--drain i { background: #d98c6a; }
/* Анимация начисления: цифра на ~1с ярче + лёгкое свечение */
.light-counter__value--pulse {
  color: #fff6e0;
  text-shadow: 0 0 10px rgba(255, 220, 150, 0.95);
  transform: scale(1.12);
}

/* Свеча — фоновый слой на всё окно (свет заливает весь экран), плеер поверх.
   Отрицательные отступы компенсируют padding карточки — свет до краёв. */
.candle {
  position: absolute;
  /* Компенсируем паддинги карточки — свет до самых краёв (без «квадрата») */
  inset: calc(-1 * var(--card-pad-top)) calc(-1 * var(--card-pad-x)) calc(-1 * var(--card-pad-bottom));
  z-index: 0;
  margin: 0;
  /* Свеча кликабельна (ручное зажигание тапом по ней). Реальная зона тапа —
     только тело+пламя (хит-тест в JS), поэтому курсор-указатель не вешаем на
     всю сцену. Шапка/плеер/иконки выше (z-index ≥ 1) — их клики не перехватываются. */
  -webkit-user-select: none;
  user-select: none;
}
.candle:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--gold-soft);
  border-radius: 18px;
}

/* Холст резиновый — заполняет всю зону свечи (свет до краёв, без квадрата) */
#candleCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Строка плеера: [лайк] — [большая кнопка каталога с названием] — [дизлайк] */
.now-playing {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Центр: большая кнопка — нота + название трека + категория = открыть каталог */
.np-browse {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--gold-soft) 35%, transparent);
  background: color-mix(in srgb, var(--bg-2) 45%, transparent);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.np-browse:hover,
.np-browse:active {
  border-color: var(--gold);
  background: var(--bg-2);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 30%, transparent),
              0 4px 18px color-mix(in srgb, var(--gold) 22%, transparent);
}
.np-browse:active { transform: scale(0.98); }
.np-browse svg { flex: 0 0 auto; display: block; color: var(--gold); }
.np-browse__text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.np-browse__name {
  font-size: clamp(15px, 4.6vw, 19px);
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-browse__cat {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gold-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* По краям: лайк (слева) / дизлайк (справа) */
.np-react__btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.np-react__btn svg { display: block; }
.np-react__btn:active { transform: scale(0.88); }
.np-react__btn--like:hover,
.np-react__btn--like:active {
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 30%, transparent);
}
.np-react__btn--dislike:hover,
.np-react__btn--dislike:active {
  color: #d98a8a;
  background: rgba(217, 138, 138, 0.14);
  box-shadow: 0 0 0 1px rgba(217, 138, 138, 0.35);
}
.np-react__btn--like.is-on { color: var(--gold); }
.np-react__btn--like.is-on svg { fill: var(--gold); }
.np-react__btn--dislike.is-on { color: #d98a8a; background: rgba(217, 138, 138, 0.12); }

/* --- Прогресс-бар: тонкий 2px --- */
.progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress__time {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 30px;
  text-align: center;
}

.progress__bar {
  position: relative;
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  cursor: pointer;
}
/* Расширенная зона попадания (тапаемая площадь выше/ниже самой полоски) */
.progress__bar::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  bottom: -12px;
}

.progress__fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  border-radius: 3px;
}

.progress__knob {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px rgba(232, 184, 115, 0.6);
  transition: transform 0.15s ease;
  z-index: 1;
}
.progress__bar:active .progress__knob { transform: translate(-50%, -50%) scale(1.3); }

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--controls-gap);
}

.controls__btn {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  width: var(--ctrl-size);
  height: var(--ctrl-size);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.controls__btn:active { transform: scale(0.92); }
.controls__btn { position: relative; }

/* Боковые иконки в плеере: магазин (слева) и достижения (справа) —
   меньше и «призрачнее» основных кнопок, золотая обводка как у фабов. */
.controls__btn--side {
  width: calc(var(--ctrl-size) - 6px);
  height: calc(var(--ctrl-size) - 6px);
  color: var(--gold);
  border-color: var(--gold-soft);
  background: var(--bg-2);
}
.controls__btn--side:hover { border-color: var(--gold); }

/* SVG-иконки управления (вместо emoji — iOS не подменяет визуал) */
.controls__btn svg { display: block; }
.controls__btn { display: flex; align-items: center; justify-content: center; padding: 0; }
.controls__btn--main .icon-pause { display: none; }
.controls__btn--main.is-playing .icon-play { display: none; }
.controls__btn--main.is-playing .icon-pause { display: block; }

/* Загрузка аудио: крутящееся кольцо вокруг кнопки + прячем иконки */
.controls__btn--main.is-loading .icon-play,
.controls__btn--main.is-loading .icon-pause { visibility: hidden; }
.controls__btn--main.is-loading::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--gold);
  border-right-color: var(--gold);
  animation: ctrl-spin 0.7s linear infinite;
  pointer-events: none;
}
@keyframes ctrl-spin { to { transform: rotate(360deg); } }

.controls__btn--main {
  width: var(--play-size);
  height: var(--play-size);
  font-size: 24px;
  color: #1a1206;
  background: radial-gradient(circle at 35% 30%, #ffe6b8, var(--gold));
  border: none;
  box-shadow: 0 0 24px rgba(232, 184, 115, 0.45);
}

/* Обёртка табов + стрелки листания (удобно мышью на ПК) */
.tabs-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}
.tabs-wrap .tabs { flex: 1 1 auto; min-width: 0; }

.tabs-arrow {
  flex: 0 0 auto;
  align-self: center;
  width: 30px;
  height: 30px;
  margin: 0 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  color: var(--gold);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}
.tabs-arrow:hover { background: rgba(232, 184, 115, 0.14); }
.tabs-arrow[hidden] { display: none; }

.tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  padding: 5px;
  border-radius: 14px;
}

/* Горизонтальный скролл для большого числа категорий */
.tabs--scroll {
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.tabs--scroll::-webkit-scrollbar { display: none; }

.tabs__btn {
  flex: 0 0 auto;
  padding: 9px 16px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tabs__btn--active {
  background: var(--bg-2);
  color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* Пустая категория — неактивна, серая */
.tabs__btn--disabled {
  color: #4a4754;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Платная неоткрытая категория — золотистый замок */
.tabs__btn--locked {
  color: var(--gold);
  opacity: 0.85;
}
.tabs__btn--locked:hover {
  background: rgba(232, 184, 115, 0.08);
  opacity: 1;
}

/* Открытая, но пока пустая категория — приглушена, но кликабельна */
.tabs__btn--empty {
  color: #6a6675;
}

.playlist-empty {
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  padding: 28px 16px;
}
.playlist-empty[hidden] { display: none; }

.playlist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 168px;
  overflow-y: auto;
  padding-right: 2px;
}
.playlist::-webkit-scrollbar { width: 4px; }
.playlist::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.track {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.track:active { background: var(--bg-2); }

.track--active {
  border-color: var(--gold-soft);
  background: linear-gradient(90deg, rgba(232, 184, 115, 0.10), transparent);
}

.track__info { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.track__name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track__category {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}

.track__badge {
  font-size: 16px;
  color: var(--gold);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.track--active .track__badge { opacity: 1; }

/* Лайк / дизлайк в строке каталога */
.track__actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.track__react {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, transform 0.12s ease;
}
.track__react:active { transform: scale(0.88); }
.track__react svg { display: block; }
.track__react--like.is-on { color: var(--gold); }
.track__react--like.is-on svg { fill: var(--gold); }
.track__react--dislike.is-on { color: #d98a8a; background: rgba(217, 138, 138, 0.12); }

/* Дизлайкнутый трек — приглушён, не запускается кликом */
.track--disliked { opacity: 0.45; }
.track--disliked .track__name { text-decoration: line-through; }

/* --- Модальное окно (пейволл) --- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 5, 9, 0.7);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
}
.modal[hidden] { display: none; }

.modal__card {
  width: 100%;
  max-width: 320px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--gold-soft);
  border-radius: 22px;
  padding: 30px 26px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 0 40px rgba(232,184,115,0.12);
  animation: popIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.modal__icon { font-size: 34px; }
.modal__title {
  margin-top: 10px;
  font-size: 16px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
}
.modal__text {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}

/* История изменений */
.modal__card--left { text-align: center; }
.changelog__list {
  list-style: none;
  margin-top: 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.changelog__list::-webkit-scrollbar { width: 4px; }
.changelog__list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.changelog__list li {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  padding-left: 14px;
  border-left: 2px solid var(--gold-soft);
}
.changelog__list b { color: var(--gold); }
.modal__btn {
  margin-top: 22px;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  color: #1a1206;
  background: radial-gradient(circle at 35% 30%, #ffe6b8, var(--gold));
  cursor: pointer;
  transition: transform 0.12s ease;
}
.modal__btn:active { transform: scale(0.96); }

/* Покупка/магазин Light вызываются поверх листа настроек */
#buyModal, #lightModal { z-index: 300; }

/* «Забрать всё» в достижениях — акцентная золотая с мягким сиянием */
.modal__btn--claim-all {
  box-shadow: 0 0 18px rgba(232, 184, 115, 0.5);
}
/* В окне достижений «Закрыть» — вторичная (под акцентной «Забрать всё») */
#achModal #achClose {
  margin-top: 10px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.modal__btn--ghost {
  margin-top: 10px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.modal__btn--nick {
  font-size: 13px;
  padding: 9px;
  margin-top: 14px;
}

/* Ввод ника */
.nick-input {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease;
}
.nick-input::placeholder { color: var(--muted); }
.nick-input:focus { border-color: var(--gold-soft); }

/* Строки в окне подтверждения покупки */
.buy-rows {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.buy-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--muted);
}
.buy-row b { color: var(--text); }
.buy-row__minus { color: #ff7a7a; }
.buy-row--total {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-weight: 600;
}
.buy-row--total b { color: var(--gold); }

/* Магазин Light */
.light-balance {
  margin-top: 14px;
  font-size: 15px;
  color: var(--text);
}
.light-balance b { color: var(--gold); }

.iap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.iap__btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.12s ease;
}
.iap__btn:active { transform: scale(0.98); }
.iap__btn:hover { border-color: var(--gold-soft); }
/* Подсказка: пакет, которого хватит на нужный товар */
.iap__btn--suggest {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(232, 184, 115, 0.35);
}
.iap__info { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.iap__amount { font-size: 15px; font-weight: 600; color: var(--gold); }
.iap__bonus { font-size: 11px; font-weight: 600; color: var(--gold-soft, var(--gold)); opacity: 0.92; }
.iap__price { font-size: 13px; color: var(--muted); }
.iap__tag {
  position: absolute;
  top: -8px;
  right: 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #1a1206;
  background: var(--gold);
  padding: 2px 8px;
  border-radius: 999px;
}

/* --- Нижний лист настроек --- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet[hidden] { display: none; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 9, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.sheet__panel {
  position: relative;
  width: 100%;
  max-width: 450px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  padding: 12px 20px 26px;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
  animation: slideUp 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
  /* Если контент не влезает (мелкий экран / много пунктов) — прокрутка */
  max-height: 88dvh;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;   /* колесо/тач не «утекают» на страницу позади */
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.sheet__panel::-webkit-scrollbar { width: 4px; }
.sheet__panel::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.sheet__handle { display: none; }   /* убрано: «черточка» создавала ощущение свайпа-перезагрузки */

/* Крестик закрытия в углу листов (магазин, настройки) */
.sheet__x {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.12s ease;
}
.sheet__x:hover { color: var(--gold); border-color: var(--gold-soft); }
.sheet__x:active { transform: scale(0.92); }

.sheet__title {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gold);
  margin-bottom: 6px;
}

.sheet__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin: 18px 0 10px;
}

.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));   /* колонки могут сжиматься — без выезда за край */
  gap: 8px;
}

.option {
  position: relative;            /* якорь для значка NEW */
  display: grid;
  grid-template-columns: auto 1fr;   /* иконка | подпись; цена уходит на строку ниже */
  align-items: center;
  gap: 6px 8px;
  min-width: 0;                  /* позволяет тексту/бейджу ужиматься, а не распирать колонку */
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

/* Значок «NEW» на свежих товарах магазина (правый верхний угол) */
.new-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  z-index: 2;
  padding: 1px 5px;
  border-radius: 6px;
  background: linear-gradient(95deg, #ff7a3c, #ffb454);
  color: #2a1402;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.6px;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(255, 122, 60, 0.5);
}
.option:active { background: var(--bg-2); }
.option--active {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold-soft);
}

.option__swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

/* Вкладки-типы эффекта: Свеча / Салют / Цветок / Камин */
.effect-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}
.etab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 9px 4px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.etab .effect-ic { filter: drop-shadow(0 0 4px currentColor); }
.etab:active { background: var(--bg-2); }
.etab--active {
  color: var(--text);
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold-soft);
}

/* Эффект, разбитый по темам: Свеча / Салют / Цветок */
.effect-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.effect-sub-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  margin: 0 0 8px;
}
.effect-group__head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text);
  margin-bottom: 8px;
}
.options--sub { margin: 0; }
.effect-ic {
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 0 5px currentColor);
}

/* Выбор формы свечи — горизонтальный список карточек */
.shapes {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.shapes::-webkit-scrollbar { display: none; }

.shape-card {
  flex: 0 0 auto;
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px 8px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.12s ease;
}
.shape-card:active { transform: scale(0.96); }

.shape-card__thumb {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 54px;
}

.shape-card__name {
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.shape-card--active {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(232, 184, 115, 0.10), transparent);
  color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold-soft);
}

/* Бейдж замка/цены на заблокированных опциях */
.lock-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--gold);
  background: rgba(232, 184, 115, 0.12);
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}
/* Цена — отдельной строкой под подписью товара (единообразно во всех опциях) */
.option .lock-badge { grid-column: 1 / -1; justify-self: start; margin-left: 0; }
/* В карточках формы — компактнее */
.shape-card .lock-badge { padding: 1px 5px; font-size: 9px; }
/* Не хватает Light — приглушить */
.lock-badge--poor {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}
.locked { opacity: 0.85; }
/* Не хватает Light — товар (замочек и цифра) чуть темнее */
.locked--poor { opacity: 0.6; }

/* Тосты: стопка сверху по центру (очередь, не перетирают друг друга) */
.toasts {
  position: fixed;
  left: 50%;
  top: calc(12px + env(safe-area-inset-top, 0px));
  transform: translateX(-50%);
  z-index: 500;                 /* выше всех окон — всегда в самом верху */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 86vw;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 11px 16px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--gold-soft);
  border-radius: 14px;
  color: var(--text);
  font-size: 14px;
  text-align: left;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast--show { opacity: 1; transform: translateY(0); }
.toast__icon { flex-shrink: 0; font-size: 16px; line-height: 1; }
.toast__msg { min-width: 0; }
.toast__action {
  flex-shrink: 0;
  margin-left: 8px;
  padding: 4px 10px;
  background: var(--gold);
  color: #1a1206;
  border: none;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;   /* контейнер тостов не кликабелен — кнопке возвращаем клики */
}
.toast__action:active { transform: scale(0.96); }

/* Типы: цветовой акцент + цвет иконки */
.toast--reward, .toast--achievement { border-color: var(--gold-soft); }
.toast--reward .toast__icon, .toast--achievement .toast__icon { color: var(--gold); }
.toast--info { border-color: var(--line); }
.toast--error { border-color: #b5564f; }
.toast--error .toast__icon { color: #ff7a7a; }

.sheet__close {
  margin-top: 22px;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  color: #1a1206;
  background: radial-gradient(circle at 35% 30%, #ffe6b8, var(--gold));
  cursor: pointer;
  transition: transform 0.12s ease;
}
.sheet__close:active { transform: scale(0.97); }

/* Спокойный режим: убираем выезды/всплытия, оставляем мягкое затухание */
/* Спокойный режим гасит движение пламени (через JS setCalm) и ускоряет полёт
   лайтсов. НЕ трогаем animation у листов/модалок — иначе переключение режима
   при открытом окне повторно проигрывает выезд (окно «дёргается»). */
body.reduced-motion .fly-light { transition-duration: 0.3s; }
body.reduced-motion * { scroll-behavior: auto; }

/* ============================================================
   АДАПТИВ
   Свеча — резиновый фон на всю карточку (inset от паддингов),
   поэтому в медиа меняем только размеры/отступы плеера и шапки,
   а не саму свечу. Цель: всё влезает в экран без скролла.
   ============================================================ */

/* --- Узкий портрет: заголовок «CANDLE PLAYER» не должен переноситься
   и налезать на боковые иконки. Сжимаем шапку. --- */
@media (max-width: 400px) {
  :root {
    --title-size: clamp(13px, 4.1vw, 16px);
    --icon-size: 33px;
    --side-size: 37px;
  }
  .header__left { gap: 7px; }
  .header__right { gap: 9px; }
  .light-counter { padding: 7px 12px; gap: 6px; font-size: 13px; }
  .icon-btn { width: 42px; height: 42px; font-size: 20px; }
  .brand-fab { width: 42px; height: 42px; }
}

/* На совсем узких экранах прячем слово «Light» (остаётся ✦ + число) */
@media (max-width: 340px) {
  .light-counter__label { display: none; }
}

/* --- Горизонтальная ориентация с низкой высотой (телефон лёжа):
   главная проблема — плеер не влезает по высоте. Сжимаем всё,
   свеча получает меньше места, но остаётся фоном. --- */
@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --card-pad-top: 14px;
    --card-pad-bottom: 14px;
    --card-pad-x: 22px;
    --app-gap: 8px;
    --stack-gap: 8px;
    --controls-gap: 18px;
    --play-size: 60px;
    --ctrl-size: 46px;
    --side-size: 38px;
    --icon-size: 33px;
    --title-size: clamp(13px, 3.4vh, 16px);
    --track-title: clamp(15px, 4.2vh, 19px);
  }
  /* Боковые иконки поднимаем — шапка стала ниже */
  .side-fab--shop { top: 60px; }
  .side-fab--ach { top: calc(60px + var(--side-size) + 8px); }
}

/* Очень низкие landscape (≈ iPhone лёжа, 375–430px высоты) — ещё компактнее */
@media (orientation: landscape) and (max-height: 430px) {
  :root {
    --card-pad-top: 10px;
    --card-pad-bottom: 10px;
    --app-gap: 6px;
    --stack-gap: 6px;
    --play-size: 54px;
    --ctrl-size: 42px;
  }
  .side-fab--shop { top: 52px; }
  .side-fab--ach { top: calc(52px + var(--side-size) + 6px); }
}

/* --- Интро при первом входе ------------------------------------------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 40%, rgba(232,184,115,0.10), rgba(5,5,9,0.92) 70%);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
  cursor: pointer;
}
.intro[hidden] { display: none; }
.intro__card {
  position: relative;
  width: 100%;
  max-width: 340px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--gold-soft);
  border-radius: 24px;
  padding: 36px 26px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6), 0 0 50px rgba(232,184,115,0.14);
  animation: popIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.intro__slides { position: relative; min-height: 220px; }
.intro__slide {
  display: none;
  flex-direction: column;
  align-items: center;
}
.intro__slide.is-active {
  display: flex;
  animation: fadeIn 0.35s ease;
}
.intro__icon { font-size: 46px; line-height: 1; }
.intro__title {
  margin-top: 16px;
  font-size: 17px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold);
}
.intro__text {
  margin-top: 14px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
}
.intro__wish {
  margin-top: 16px;
  font-size: 14px;
  line-height: 1.5;
  font-style: italic;
  color: var(--gold);
}
.intro__dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}
.intro__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.2s ease, transform 0.2s ease;
}
.intro__dot.is-active { background: var(--gold); transform: scale(1.25); }
.intro__skip {
  margin-top: 20px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  color: #1a1206;
  background: radial-gradient(circle at 35% 30%, #ffe6b8, var(--gold));
  cursor: pointer;
  transition: transform 0.12s ease;
}
.intro__skip:active { transform: scale(0.96); }
.intro__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--bg-1);
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
.intro__close:hover { color: var(--gold); border-color: var(--gold-soft); }
.intro__close:active { transform: scale(0.9); }

/* --- Попап «Новинка» --------------------------------------------------- */
.whats-new {
  position: fixed; inset: 0; z-index: 610;
  background: rgba(0,0,0,.65); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .25s ease;
}
.whats-new[hidden] { display: none; }
.whats-new__card {
  position: relative;
  background: var(--card-bg, #16141a);
  border: 1px solid var(--gold-soft, rgba(232,184,115,.25));
  border-radius: 24px;
  padding: 36px 28px 28px;
  max-width: 320px; width: 88%;
  text-align: center;
  animation: popIn .3s ease;
}
.whats-new__close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.5); border-radius: 50%;
  width: 28px; height: 28px; font-size: 13px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: color .2s, border-color .2s;
}
.whats-new__close:hover { color: var(--gold); border-color: var(--gold-soft); }
.whats-new__icon { font-size: 42px; margin-bottom: 14px; }
.whats-new__title {
  font-size: 1.25rem; font-weight: 700; letter-spacing: .06em;
  color: var(--gold, #E8B873); text-transform: uppercase; margin-bottom: 12px;
}
.whats-new__text {
  font-size: .92rem; color: rgba(255,255,255,.75); line-height: 1.55; margin-bottom: 24px;
}
.whats-new__btn {
  background: linear-gradient(135deg, var(--gold,#E8B873), #c8943a);
  color: #0a0a0f; border: none; border-radius: 14px;
  padding: 12px 28px; font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: transform .15s, opacity .15s; width: 100%;
}
.whats-new__btn:active { transform: scale(0.96); opacity: .9; }
.whats-new__btn--ghost {
  background: none; color: rgba(255,255,255,.6);
  border: 1px solid rgba(255,255,255,.15); margin-top: 10px;
}
.whats-new__btn--ghost:hover { color: var(--gold); border-color: var(--gold-soft); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes slideFromRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* --- Десктоп: магазин как боковая панель рядом с иконками меню ---------- */
@media (min-width: 700px) {
  #shopSheet {
    align-items: flex-start;
    justify-content: flex-end;
    pointer-events: none;   /* backdrop не блокирует клики по свече */
  }
  #shopSheet .sheet__backdrop {
    display: none;          /* свеча остаётся полностью видна */
  }
  #shopSheet .sheet__panel {
    pointer-events: all;
    position: relative;
    width: 600px;
    max-width: 600px;
    max-height: 82dvh;
    margin-top: 80px;
    margin-right: 70px;     /* правее — 20px+40px(fab) + 10px зазор */
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6), 0 0 0 1px var(--line);
    animation: slideFromRight 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
  }
  #shopSheet .options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  #shopSheet .shapes {
    overflow-x: visible;
    flex-wrap: wrap;
  }
  #shopSheet .shape-card {
    flex: 1 1 calc(33% - 8px);
  }
}

/* === Баннер согласия на аналитику ====================================== */
.consent {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 600;                 /* над окнами, как тосты */
  display: flex;
  justify-content: center;
  padding: 14px;
  pointer-events: none;
  animation: consentUp 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.consent[hidden] { display: none; }
.consent__card {
  pointer-events: auto;
  max-width: 460px;
  width: 100%;
  background: rgba(24, 20, 16, 0.96);
  border: 1px solid var(--gold-soft);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
}
.consent__text {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #e7ddcf;
}
.consent__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.consent__btn {
  border: none;
  cursor: pointer;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #1a1410;
  background: linear-gradient(90deg, var(--gold), #fff6e6);
}
.consent__btn--ghost {
  background: transparent;
  color: #cbbfae;
  border: 1px solid var(--line, rgba(255,255,255,0.14));
}
.consent__btn:hover { filter: brightness(1.05); }
@keyframes consentUp {
  from { transform: translateY(120%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
