/* =========================================================================
   Остеопатия Души — медитации
   Тёмная неоновая премиум-тема. Mobile-first, строго вертикально.
   ========================================================================= */

:root {
  /* Палитра — разные тона синего, премиум-ночная */
  --bg-0: #07142e;            /* глубокий navy */
  --bg-1: #0c1d3d;
  --bg-2: #142751;
  --card: #15294f;
  --card-hi: #1c3463;
  --border: #243d72;

  --text: #e6f0ff;
  --text-mute: #93a8d0;
  --text-dim: #6679a3;

  --primary: #60a5fa;          /* sky-400, основной */
  --primary-deep: #3b82f6;     /* blue-500 */
  --primary-light: #93c5fd;    /* sky-300 */
  --accent:  #22d3ee;          /* cyan-400, акцент */
  --accent-deep: #0891b2;      /* cyan-700 */
  --indigo:  #818cf8;          /* для разнообразия */
  --teal:    #2dd4bf;          /* teal-400 */
  --gold:    #38bdf8;          /* вместо золотого — sky-светлее */
  --green:   #06b6d4;          /* стало cyan вместо зелёного */
  --danger:  #f87171;

  /* Скругления */
  --r-s: 12px;
  --r-m: 18px;
  --r-l: 24px;

  /* Тени */
  --shadow-card: 0 6px 24px rgba(0, 0, 0, 0.35);
  --glow-primary: 0 0 18px rgba(96, 165, 250, 0.45);
  --glow-accent:  0 0 18px rgba(34, 211, 238, 0.45);

  /* Гриды и отступы */
  --pad: 20px;
  --tabbar-h: calc(64px + env(safe-area-inset-bottom, 0px));
  --top-safe: env(safe-area-inset-top, 0px);
}

/* ----- Reset ----- */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }   /* фикс: класс с display:flex перекрывал атрибут hidden */
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(140% 80% at 50% 0%, #0e2a5a 0%, var(--bg-0) 65%) fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
input, textarea, button, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: var(--primary); text-decoration: none; }

/* Запрещаем масштабирование текста при повороте (iOS) */
html { -webkit-text-size-adjust: 100%; }

/* ----- App shell ----- */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: var(--tabbar-h);
}
.screen {
  padding: calc(var(--top-safe) + 24px) var(--pad) 32px;
  animation: fadeIn 0.28s ease both;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.bottom-spacer { height: 32px; }

/* ----- Headers ----- */
.screen__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}
.screen__header--simple { display: block; }
.screen-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.greeting {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.greeting__sub {
  color: var(--text-mute);
  margin-top: 4px;
  font-size: 13.5px;
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: linear-gradient(135deg, rgba(56,189,248,0.18), rgba(99,102,241,0.18));
  border: 1px solid rgba(56,189,248,0.45);
  border-radius: 999px;
  color: var(--primary-light);
  font-weight: 700;
  font-size: 13px;
}
.streak-pill__icon { font-size: 16px; }
.streak-pill__num { letter-spacing: -0.02em; }

.section-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 26px 0 12px;
}
.section-row {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 26px 0 12px;
}
.section-row .section-title { margin: 0; }
.section-row__hint { font-size: 12px; color: var(--text-dim); }
.section-subtitle { color: var(--text-mute); font-size: 13px; margin-bottom: 14px; }

/* =========================================================================
   STORIES BAR
   ========================================================================= */
.stories {
  display: flex; gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin: 0 calc(var(--pad) * -1) 4px;
  padding: 4px var(--pad) 8px;
  scroll-snap-type: x proximity;
}
.stories::-webkit-scrollbar { display: none; }

.story {
  flex: 0 0 auto;
  width: 76px;
  text-align: center;
  scroll-snap-align: start;
}
.story__ring {
  width: 70px; height: 70px;
  border-radius: 50%;
  padding: 2.5px;
  background: conic-gradient(from 200deg, var(--primary), var(--accent), var(--teal), var(--primary));
  box-shadow: var(--glow-primary);
  transition: opacity 0.2s, filter 0.2s;
}
.story.is-viewed .story__ring {
  background: linear-gradient(135deg, var(--border), #444070);
  box-shadow: none;
  filter: grayscale(0.5);
}
.story__inner {
  width: 100%; height: 100%;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-1);
  font-size: 28px;
}
.story__lbl {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.story.is-viewed .story__lbl { color: var(--text-dim); }

/* =========================================================================
   STORY VIEWER (overlay)
   ========================================================================= */
.story-viewer {
  position: fixed; inset: 0;
  z-index: 80;
  background: #111;
  display: flex; flex-direction: column;
  padding-top: max(var(--top-safe), 16px);
  animation: fadeIn 0.2s ease both;
  transition: background 0.45s ease;
}
.story-viewer__progress {
  display: flex; gap: 4px;
  padding: 0 12px;
}
.story-viewer__progress > span {
  flex: 1; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,0.25);
  overflow: hidden;
  position: relative;
}
.story-viewer__progress > span > i {
  display: block; height: 100%; width: 0%;
  background: #fff;
  border-radius: 2px;
}
.story-viewer__header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px 0;
}
.story-viewer__id { display: flex; align-items: center; gap: 10px; }
.story-viewer__emoji {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.story-viewer__title { font-weight: 700; }
.story-viewer__close {
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 18px;
}
.story-viewer__content {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 32px;
  text-align: center;
}
@keyframes story-in-right { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes story-in-left  { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
.story-viewer__content.dir-next { animation: story-in-right 0.42s cubic-bezier(.2,.8,.2,1) both; }
.story-viewer__content.dir-prev { animation: story-in-left  0.42s cubic-bezier(.2,.8,.2,1) both; }
.story-viewer__big-emoji { font-size: 64px; margin-bottom: 24px; }
.story-viewer__h { font-size: 26px; font-weight: 700; margin-bottom: 14px; }
.story-viewer__p { font-size: 16px; line-height: 1.5; color: rgba(255,255,255,0.8); }
.story-viewer__taps {
  position: absolute; left: 0; right: 0; top: 90px; bottom: 0;
  display: flex;
}
.story-viewer__tap-l { flex: 1; }
.story-viewer__tap-r { flex: 2; }

/* =========================================================================
   MOOD WIDGET
   ========================================================================= */
.mood { margin-top: 6px; }
.mood__row {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: none;
}
.mood__row::-webkit-scrollbar { display: none; }
.mood__btn {
  flex: 1 0 auto;
  min-width: 64px;
  background: var(--card);
  border-radius: var(--r-m);
  padding: 12px 10px;
  text-align: center;
  border: 1px solid transparent;
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}
.mood__btn:active { transform: scale(0.96); }
.mood__btn.is-selected {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}
.mood__btn-emoji { font-size: 26px; display: block; }
.mood__btn-lbl { color: var(--text-mute); font-size: 11.5px; margin-top: 4px; display: block; }

/* =========================================================================
   INSIGHT CARD (совет дня)
   ========================================================================= */
.insight-card {
  margin-top: 22px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(34,211,238,0.10), rgba(96,165,250,0.10));
  border: 1px solid rgba(34,211,238,0.30);
  border-radius: var(--r-m);
  position: relative;
}
.insight-card__chip {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(34,211,238,0.18);
  color: var(--accent);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.insight-card__text {
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.5;
}

/* =========================================================================
   VIDEOS (тонкая карусель)
   ========================================================================= */
.videos__scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  margin: 0 calc(var(--pad) * -1) 0;
  padding: 4px var(--pad) 8px;
  scrollbar-width: none;
}
.videos__scroll::-webkit-scrollbar { display: none; }
.video-card {
  flex: 0 0 auto;
  width: 160px;
  background: var(--card);
  border-radius: var(--r-m);
  overflow: hidden;
  text-align: left;
  transition: transform 0.15s;
}
.video-card:active { transform: scale(0.98); }
.video-card__thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-2);
  position: relative;
  overflow: hidden;
}
.video-card__thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.video-card__play {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 14px;
}
.video-card__body { padding: 10px 12px 12px; }
.video-card__title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.video-card__author {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 11px;
}

/* =========================================================================
   MEDITATION CARDS
   ========================================================================= */
.med-card {
  display: block;
  width: 100%;
  text-align: left;
  background: linear-gradient(135deg, var(--card) 0%, var(--card-hi) 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  padding: 16px 18px;
  margin-bottom: 12px;
  transition: transform 0.12s, border-color 0.2s;
  position: relative;
}
.med-card:active { transform: scale(0.99); }
.med-card__row {
  display: flex; align-items: center; gap: 12px;
}
.med-card__chip {
  display: inline-block;
  padding: 3px 9px;
  background: rgba(96,165,250,0.14);
  color: var(--primary);
  border-radius: 999px;
  font-size: 11px;
  margin-bottom: 8px;
}
.med-card__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.med-card__desc { color: var(--text-mute); font-size: 13px; line-height: 1.45; }
.med-card__meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.med-card__meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-dim); }
.med-card__pro {
  position: absolute;
  top: 14px; right: 14px;
  padding: 3px 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #04293a;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

/* Quick-list (плотная строка) */
.quick-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border-radius: var(--r-s);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.quick-row__title { font-weight: 600; }
.quick-row__sub { color: var(--text-mute); font-size: 12px; margin-top: 2px; }
.quick-row__chev { color: var(--primary); font-size: 22px; line-height: 1; }

/* =========================================================================
   GROUPS (medi tab)
   ========================================================================= */
.search {
  position: relative;
  margin-bottom: 14px;
}
.search input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  padding: 12px 14px 12px 40px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search input:focus {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}
.search__icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim);
}

.groups-chips {
  display: flex; gap: 8px;
  overflow-x: auto;
  margin: 0 calc(var(--pad) * -1) 16px;
  padding: 4px var(--pad) 8px;
  scrollbar-width: none;
}
.groups-chips::-webkit-scrollbar { display: none; }
.group-chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.12s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.group-chip:active { transform: scale(0.96); }
.group-chip.is-active {
  color: var(--text);
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(96,165,250,0.18), rgba(34,211,238,0.12));
  box-shadow: var(--glow-primary);
}

.group-hero {
  margin-bottom: 14px;
  padding: 16px 18px;
  border-radius: var(--r-m);
  background: linear-gradient(135deg, rgba(96,165,250,0.16), rgba(34,211,238,0.10));
  border: 1px solid rgba(96,165,250,0.25);
}
.group-hero__title { font-size: 22px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.02em; }
.group-hero__sub { color: var(--text-mute); font-size: 13px; }

.empty-state {
  padding: 28px 20px;
  text-align: center;
  color: var(--text-mute);
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--r-m);
}
.empty-state__emoji { font-size: 28px; display: block; margin-bottom: 8px; }

/* =========================================================================
   PROGRESS TAB
   ========================================================================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  padding: 14px 16px;
}
.stat-box__num {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.stat-box__lbl { color: var(--text-mute); font-size: 12px; margin-top: 2px; }

.report-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--r-m);
  padding: 16px 18px;
  margin-bottom: 6px;
}
.report-card__title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.report-card__text { color: var(--text-mute); font-size: 13.5px; line-height: 1.5; }

.heatmap {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  padding: 12px;
  margin-bottom: 10px;
}
.heatmap__cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
}
.heatmap__cell--l1 { background: rgba(96,165,250,0.25); }
.heatmap__cell--l2 { background: rgba(167,139,250,0.50); }
.heatmap__cell--l3 { background: rgba(167,139,250,0.80); box-shadow: var(--glow-primary); }
.heatmap__legend {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 18px;
}

.state-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.state-card.is-locked { opacity: 0.62; }
.state-card__icon { font-size: 28px; }
.state-card__name { font-weight: 700; font-size: 14.5px; }
.state-card__meta { color: var(--text-dim); font-size: 12px; margin-top: 4px; }
.state-card__bar {
  height: 5px; border-radius: 3px;
  background: rgba(255,255,255,0.08);
  margin-top: 8px;
  overflow: hidden;
}
.state-card__fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 3px; }

/* =========================================================================
   PROFILE TAB
   ========================================================================= */
.profile__header { text-align: center; padding: 8px 0 22px; }
.avatar {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800; color: #fff;
  margin-bottom: 14px;
  box-shadow: var(--glow-primary);
}
.profile__name { font-size: 22px; font-weight: 700; }
.profile__sub { color: var(--text-mute); margin-top: 4px; font-size: 13px; }

.ghost-btn {
  margin-top: 12px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(96,165,250,0.10);
  color: var(--primary);
  font-weight: 600;
  font-size: 12.5px;
  border: 1px solid rgba(96,165,250,0.30);
}

.pro-card {
  margin: 18px 0;
  padding: 20px 20px 18px;
  background: linear-gradient(135deg, #102a55, #163a72);
  border: 1px solid var(--accent);
  border-radius: var(--r-l);
  position: relative;
  overflow: hidden;
}
.pro-card::after {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(34,211,238,0.32), transparent 70%);
  pointer-events: none;
}
.pro-card__chip {
  display: inline-block;
  padding: 3px 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #04293a;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.pro-card__title { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.pro-card__list { list-style: none; padding: 0; margin: 6px 0 16px; }
.pro-card__list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.5;
}
.pro-card__list li::before {
  content: "✦";
  position: absolute; left: 0;
  color: var(--accent);
}
.pro-card__btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  border-radius: 999px;
  box-shadow: var(--glow-accent);
}
.pro-card__hint { text-align: center; color: var(--text-dim); font-size: 11px; margin-top: 10px; }

.card-row { display: flex; flex-direction: column; gap: 8px; }
.row-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  padding: 14px 16px;
  text-align: left;
}
.row-card__icon { font-size: 18px; width: 28px; text-align: center; }
.row-card__body { flex: 1; min-width: 0; }
.row-card__title { font-weight: 600; font-size: 14px; }
.row-card__sub { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.row-card__link { color: var(--primary); font-size: 13px; font-weight: 600; white-space: nowrap; }
.row-card__link--muted { color: var(--text-dim); font-weight: 500; }
.row-card--danger { border-color: rgba(248,113,113,0.30); }
.row-card--danger .row-card__title { color: var(--danger); }

/* =========================================================================
   TAB BAR
   ========================================================================= */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--tabbar-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(13, 11, 31, 0.78);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex;
  z-index: 50;
}
.tabbar__btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 0;
  transition: color 0.2s, transform 0.12s;
}
.tabbar__btn:active { transform: scale(0.94); }
.tabbar__btn.is-active { color: var(--primary); }
.tabbar__icon { font-size: 22px; line-height: 1; }
.tabbar__lbl { letter-spacing: 0.01em; }

/* =========================================================================
   PLAYER (full-screen overlay)
   ========================================================================= */
.player {
  position: fixed; inset: 0;
  z-index: 70;
  /* Очень тёмный, чуть синеватый — для ночного режима */
  background: radial-gradient(120% 80% at 50% 20%, #0c1d3d 0%, #050d1f 75%);
  display: flex; flex-direction: column;
  padding: max(var(--top-safe), 16px) var(--pad) max(env(safe-area-inset-bottom, 16px), 16px);
  animation: fadeIn 0.28s ease both;
}
.player__close {
  position: absolute;
  top: max(var(--top-safe), 16px);
  right: 12px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font-size: 16px;
  z-index: 2;
}

.player__head {
  text-align: center;
  margin-top: 30px;
  margin-bottom: 18px;
}
.player__group {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: rgba(147, 197, 253, 0.65);  /* приглушённый sky */
  font-weight: 700;
  margin-bottom: 6px;
}
.player__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: rgba(230, 240, 255, 0.86);  /* мягкий, не белоснежный */
}
.player__posture {
  margin-top: 6px;
  color: var(--text-mute);
  font-size: 12.5px;
}

/* Orb wrap */
.orb-wrap {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  margin: 8px 0;
  min-height: 240px;
}
.orb-canvas {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1;
  height: auto;
  display: block;
}
.orb-time {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.orb-time__pill {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 18px;
  background: rgba(7, 20, 46, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 22px;
  color: #cfe2ff;
  text-shadow: 0 1px 8px rgba(0,0,0,0.55);
}
.orb-time__sep { color: rgba(207, 226, 255, 0.45); font-weight: 500; font-size: 18px; }

/* Scrubber */
.player__scrubber {
  position: relative;
  margin: 4px 4px 18px;
}
.player__progress-bg {
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: 2px;
  overflow: hidden;
}
.player__progress-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(96,165,250,0.55), rgba(34,211,238,0.55));
  width: 0%;
  border-radius: 2px;
  /* без glow — ночью не слепит */
  transition: width 0.1s linear;
}
.player__scrubber input[type="range"] {
  position: absolute;
  inset: -10px 0;
  width: 100%;
  height: 24px;
  -webkit-appearance: none; appearance: none;
  background: transparent;
  outline: none;
  margin: 0;
}
.player__scrubber input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: rgba(207, 226, 255, 0.85);
  cursor: pointer;
}
.player__scrubber input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border: 0;
  border-radius: 50%;
  background: rgba(207, 226, 255, 0.85);
  cursor: pointer;
}

/* Controls */
.player__controls {
  display: flex; align-items: center; justify-content: center;
  gap: 32px;
  margin-bottom: 18px;
}
.player__btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s, background 0.2s;
}
.player__btn:active { transform: scale(0.92); background: rgba(255,255,255,0.12); }
.player__btn-arrow {
  font-size: 46px;
  line-height: 1;
  font-weight: 300;
}
.player__btn-num {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -42%);
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.02em;
  pointer-events: none;
}
.player__play {
  width: 80px; height: 80px;
  border-radius: 50%;
  /* приглушённый бледно-синий, не слепит ночью */
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.42), rgba(34, 211, 238, 0.42));
  color: rgba(230, 240, 255, 0.95);
  font-size: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  /* без яркого glow */
  transition: transform 0.12s;
}
.player__play:active { transform: scale(0.94); }

/* Bottom chips (sleep, restart) */
.player__bottom {
  display: flex; justify-content: center; gap: 10px;
  margin-bottom: 6px;
}
.player__chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 999px;
  color: rgba(230, 240, 255, 0.75);
  font-size: 12.5px;
  font-weight: 600;
}
.player__chip.is-active {
  border-color: rgba(96, 165, 250, 0.50);
  color: rgba(147, 197, 253, 0.90);
  background: rgba(96, 165, 250, 0.08);
}

.player__hint {
  text-align: center;
  color: rgba(147, 197, 253, 0.55);
  font-size: 12px;
  height: 18px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.4s;
}
.player.is-playing .player__hint { opacity: 0.7; }

/* =========================================================================
   SHEET (sleep timer и т.д.)
   ========================================================================= */
.sheet {
  position: fixed; inset: 0;
  z-index: 90;
  display: flex; align-items: flex-end;
}
.sheet__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  animation: fadeIn 0.18s ease both;
}
.sheet__panel {
  position: relative;
  width: 100%;
  background: var(--bg-1);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 12px 18px max(env(safe-area-inset-bottom, 16px), 24px);
  border: 1px solid var(--border);
  border-bottom: 0;
  animation: slideUp 0.24s cubic-bezier(.2,.9,.3,1.05) both;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet__handle {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.18);
  margin: 0 auto 14px;
}
.sheet__title { font-size: 18px; font-weight: 700; }
.sheet__sub { color: var(--text-mute); font-size: 13px; margin: 4px 0 12px; }
.sheet__list { display: flex; flex-direction: column; gap: 6px; }
.sheet__row {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-m);
  font-weight: 600;
  font-size: 14.5px;
}
.sheet__row.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(96,165,250,0.10);
}
.sheet__row--danger { color: var(--danger); }

/* =========================================================================
   TOAST
   ========================================================================= */
.toast {
  position: fixed;
  bottom: calc(var(--tabbar-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 11, 31, 0.92);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13.5px;
  z-index: 100;
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
  animation: toastIn 0.22s ease both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* =========================================================================
   DIALOG (кастомный confirm / prompt)
   ========================================================================= */
.dialog {
  position: fixed; inset: 0;
  z-index: 110;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.dialog__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.16s ease both;
}
.dialog__panel {
  position: relative;
  width: 100%;
  max-width: 360px;
  background: linear-gradient(135deg, var(--bg-1), var(--card-hi));
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  padding: 20px 20px 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  animation: dialogIn 0.22s cubic-bezier(.2,.9,.3,1.05) both;
}
@keyframes dialogIn { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }
.dialog__title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.dialog__msg   { color: var(--text-mute); font-size: 14px; line-height: 1.5; margin-bottom: 12px; }
.dialog__input {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-s);
  padding: 11px 13px;
  color: var(--text);
  margin-bottom: 14px;
  outline: none;
}
.dialog__input:focus { border-color: var(--primary); box-shadow: var(--glow-primary); }
.dialog__actions { display: flex; gap: 8px; justify-content: flex-end; }
.dialog__btn {
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.12s, opacity 0.2s;
}
.dialog__btn:active { transform: scale(0.96); }
.dialog__btn--ghost {
  background: rgba(255,255,255,0.06);
  color: var(--text-mute);
  border: 1px solid var(--border);
}
.dialog__btn--primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: var(--glow-primary);
}
.dialog__btn--danger {
  background: linear-gradient(135deg, #f87171, #ef4444);
  color: #fff;
  box-shadow: 0 0 18px rgba(248,113,113,0.45);
}

/* =========================================================================
   ORIENTATION LOCK (косметический — без поворотов)
   ========================================================================= */
@media (orientation: landscape) and (max-height: 500px) {
  body::before {
    content: "Поверни телефон вертикально 🔄";
    position: fixed; inset: 0;
    background: var(--bg-0);
    color: var(--text);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 700;
    padding: 20px;
    text-align: center;
    z-index: 999;
  }
  body > * { display: none !important; }
}

/* =========================================================================
   MVP: продолжить, фильтры, избранное, уровень, вход, онбординг
   ========================================================================= */

.med-card { cursor: pointer; }
.med-card:active { transform: scale(0.99); }
a.row-card { text-decoration: none; color: inherit; }

/* ----- Виджет настроения: активное состояние ----- */
.mood__btn.is-active {
  border-color: var(--primary);
  box-shadow: var(--glow-primary);
}

/* ----- Продолжить с места ----- */
.cont-card {
  display: block; width: 100%; text-align: left;
  background: linear-gradient(135deg, rgba(34,211,238,0.14), rgba(96,165,250,0.14));
  border: 1px solid rgba(34,211,238,0.35);
  border-radius: var(--r-m);
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 0.12s;
}
.cont-card:active { transform: scale(0.99); }
.cont-card__top { display: flex; align-items: center; gap: 12px; }
.cont-card__title { font-weight: 650; font-size: 15.5px; }
.cont-card__sub { color: var(--text-mute); font-size: 12.5px; margin-top: 2px; }
.cont-card__play {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--primary); color: #06142c;
  font-size: 14px; padding-left: 2px;
  box-shadow: var(--glow-primary);
}
.cont-card__bar {
  height: 4px; border-radius: 4px; margin-top: 12px;
  background: rgba(255,255,255,0.12); overflow: hidden;
}
.cont-card__fill { height: 100%; background: var(--accent); border-radius: 4px; }

/* ----- Фильтр по длительности ----- */
.filter-row {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-mute);
  font-size: 13px;
  white-space: nowrap;
}
.filter-chip.is-active {
  background: var(--primary); border-color: var(--primary);
  color: #06142c; font-weight: 650;
}

/* ----- Сердечко на карточке ----- */
.med-card__fav {
  position: absolute; right: 12px; bottom: 12px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 17px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.05);
}
.med-card__fav.is-active { color: #fb7185; background: rgba(251,113,133,0.14); }
.med-card__fav:active { transform: scale(0.9); }

.quick-row__pro {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.4px;
  color: var(--accent); border: 1px solid var(--accent);
  border-radius: 4px; padding: 1px 4px; vertical-align: middle;
}

/* ----- Текущий уровень (Прогресс) ----- */
.level-hero {
  display: flex; gap: 14px; align-items: center;
  background: linear-gradient(135deg, rgba(129,140,248,0.16), rgba(34,211,238,0.12));
  border: 1px solid rgba(129,140,248,0.35);
  border-radius: var(--r-l);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.level-hero__icon { font-size: 38px; line-height: 1; }
.level-hero__body { flex: 1; min-width: 0; }
.level-hero__lbl { font-size: 11.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.6px; }
.level-hero__name { font-size: 20px; font-weight: 700; margin: 2px 0 8px; }
.level-hero__bar { height: 5px; border-radius: 5px; background: rgba(255,255,255,0.12); overflow: hidden; }
.level-hero__fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 5px; transition: width 0.4s; }
.level-hero__meta { font-size: 12.5px; color: var(--text-mute); margin-top: 7px; }

.state-card__desc { font-size: 12.5px; color: var(--text-mute); margin: 3px 0 7px; }

/* ----- Переключатель ----- */
.switch {
  width: 46px; height: 27px; flex: 0 0 46px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  position: relative;
  transition: background 0.2s;
}
.switch i {
  position: absolute; top: 3px; left: 3px;
  width: 21px; height: 21px; border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.switch.is-on { background: var(--primary); }
.switch.is-on i { transform: translateX(19px); }

/* ----- Кнопка в сторис ----- */
.story-viewer__cta {
  position: relative; z-index: 5;
  margin-top: 26px;
  padding: 13px 26px;
  border-radius: 999px;
  background: rgba(255,255,255,0.95);
  color: #0b1a36;
  font-weight: 650; font-size: 15px;
  box-shadow: 0 8px 26px rgba(0,0,0,0.35);
}
.story-viewer__cta:active { transform: scale(0.97); }

/* =========================================================================
   WELCOME / ВХОД
   ========================================================================= */
.welcome {
  position: fixed; inset: 0; z-index: 90;
  background: radial-gradient(120% 70% at 50% 0%, #123566 0%, var(--bg-0) 70%);
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--pad) + var(--top-safe)) var(--pad) var(--pad);
}
.welcome__inner { width: 100%; max-width: 420px; text-align: center; }
.welcome__logo {
  width: 96px; height: 96px; margin: 0 auto 22px;
  border-radius: 28px;
  display: grid; place-items: center;
  font-size: 46px;
  background: linear-gradient(150deg, #1b3f7a, #0b1f45);
  border: 1px solid rgba(96,165,250,0.4);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45), var(--glow-primary);
  overflow: hidden;
}
.welcome__logo img { width: 100%; height: 100%; object-fit: cover; }
.welcome__title { font-size: 26px; font-weight: 700; letter-spacing: -0.3px; }
.welcome__sub { color: var(--text-mute); font-size: 14.5px; margin-top: 8px; margin-bottom: 34px; }
.welcome__step { display: flex; flex-direction: column; gap: 10px; }
.welcome__btn {
  width: 100%; padding: 15px;
  border-radius: var(--r-m);
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); font-size: 15.5px; font-weight: 600;
}
.welcome__btn--primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  border-color: transparent; color: #06142c;
  box-shadow: var(--glow-primary);
}
.welcome__btn--ghost { background: none; border-color: transparent; color: var(--text-mute); }
.welcome__btn:active { transform: scale(0.98); }
.welcome__hint { color: var(--text-dim); font-size: 12.5px; margin-top: 12px; line-height: 1.5; }
.welcome__input {
  width: 100%; padding: 15px 16px;
  border-radius: var(--r-m);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text); font-size: 16px;
  text-align: center;
}
.welcome__input::placeholder { color: var(--text-dim); }

/* =========================================================================
   ОНБОРДИНГ
   ========================================================================= */
.onb {
  position: fixed; inset: 0; z-index: 92;
  background: radial-gradient(120% 70% at 50% 0%, #123566 0%, var(--bg-0) 70%);
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--pad) + var(--top-safe)) var(--pad) var(--pad);
}
.onb__inner { width: 100%; max-width: 420px; }
.onb__progress { height: 4px; border-radius: 4px; background: rgba(255,255,255,0.12); overflow: hidden; }
.onb__progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.35s; }
.onb__step { color: var(--text-dim); font-size: 12.5px; margin-top: 16px; }
.onb__q { font-size: 24px; font-weight: 700; letter-spacing: -0.3px; margin: 6px 0 26px; }
.onb__options { display: flex; flex-direction: column; gap: 10px; }
.onb__opt {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  padding: 16px 18px;
  border-radius: var(--r-m);
  background: var(--card); border: 1px solid var(--border);
  font-size: 15.5px; font-weight: 550;
  transition: transform 0.12s, border-color 0.2s;
}
.onb__opt:active { transform: scale(0.98); border-color: var(--primary); }
.onb__opt-emoji { font-size: 24px; }
.onb__skip {
  display: block; margin: 26px auto 0;
  color: var(--text-dim); font-size: 13.5px;
  padding: 8px 16px;
}

/* =========================================================================
   ПРАЗДНОВАНИЕ УРОВНЯ
   ========================================================================= */
.levelup { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: var(--pad); }
.levelup__backdrop { position: absolute; inset: 0; background: rgba(4, 10, 24, 0.82); backdrop-filter: blur(6px); }
.levelup__panel {
  position: relative;
  width: 100%; max-width: 340px;
  background: linear-gradient(150deg, #1b3f7a, #0d2149);
  border: 1px solid rgba(129,140,248,0.45);
  border-radius: var(--r-l);
  padding: 30px 24px 24px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  animation: levelup-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes levelup-in {
  from { opacity: 0; transform: scale(0.86) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.levelup__icon {
  font-size: 54px; line-height: 1;
  animation: levelup-pulse 2.4s ease-in-out infinite;
}
@keyframes levelup-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}
.levelup__lbl {
  font-size: 11.5px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--accent); margin-top: 14px;
}
.levelup__name { font-size: 24px; font-weight: 700; margin: 4px 0 10px; }
.levelup__desc { color: var(--text-mute); font-size: 14px; line-height: 1.55; }
.levelup__btn {
  width: 100%; margin-top: 22px; padding: 14px;
  border-radius: var(--r-m);
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #06142c; font-weight: 650; font-size: 15.5px;
  box-shadow: var(--glow-primary);
}

/* Компактнее на невысоких экранах */
@media (max-height: 620px) {
  .welcome__logo { width: 72px; height: 72px; font-size: 34px; margin-bottom: 14px; }
  .welcome__sub { margin-bottom: 22px; }
  .onb__q { font-size: 21px; margin-bottom: 18px; }
}

/* Строки-списки — на всю ширину (button по умолчанию сжимается по содержимому) */
.quick-row { width: 100%; text-align: left; }
.row-card { text-align: left; }
