/* New Life Hypnosis app - a calm, night-blue design that is easy on the eyes
   at bedtime, with the brand blues of the logo as accents. */
:root {
  --bg: #0b1330;
  --bg-2: #111b40;
  --card: #16224d;
  --card-2: #1c2a5c;
  --line: rgba(160, 190, 255, 0.14);
  --text: #eef2ff;
  --muted: #a9b4d6;
  --faint: #7b87ad;
  --accent: #29b6e8;
  --accent-2: #1a56c4;
  --gold: #e9c46a;
  --danger: #ff8a8a;
  --radius: 16px;
  --tabs-h: 64px;
  --mini-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(120% 60% at 50% 0%, #182660 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.app { max-width: 640px; margin: 0 auto; min-height: 100vh; padding-bottom: calc(var(--tabs-h) + var(--safe-b) + 16px); }
.app.has-mini { padding-bottom: calc(var(--tabs-h) + var(--mini-h) + var(--safe-b) + 24px); }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 10px;
}
.topbar__brand img { height: 26px; width: auto; filter: brightness(1.35) saturate(1.1); }
.topbar__site { font-size: 0.85rem; color: var(--muted); text-decoration: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; }

.view { padding: 0 16px; outline: none; }
.view h1 { font-size: 1.6rem; line-height: 1.2; margin: 10px 0 6px; font-weight: 700; letter-spacing: -0.01em; }
.view h2 { font-size: 1.1rem; margin: 26px 0 10px; font-weight: 700; }
.lead { color: var(--muted); margin: 0 0 8px; }
.empty { color: var(--muted); text-align: center; padding: 40px 12px; }
.small { font-size: 0.85rem; color: var(--faint); }

/* Cards and art */
.art {
  position: relative; overflow: hidden; border-radius: 14px;
  background: linear-gradient(145deg, hsl(var(--h) 70% 42%), hsl(calc(var(--h) + 35) 65% 18%));
}
.art svg { position: absolute; inset: -12%; width: 124%; height: 124%; opacity: 0.55; }
.art--spin svg { animation: spin 60s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .art--spin svg { animation: none; } }

.continue {
  display: flex; gap: 14px; align-items: center; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer;
}
.continue .art { width: 64px; height: 64px; flex: none; }
.continue__text { min-width: 0; flex: 1; }
.continue__text strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue__text span { color: var(--muted); font-size: 0.85rem; }

.rail { display: flex; align-items: flex-start; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail-item { flex: 0 0 148px; scroll-snap-align: start; text-align: left; background: none; border: 0; padding: 0; cursor: pointer; }
.rail-item .art { width: 148px; height: 148px; margin-bottom: 8px; }
.rail-item strong { display: block; font-size: 0.92rem; line-height: 1.3; }
.rail-item span { font-size: 0.8rem; color: var(--muted); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.coll {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.coll .art { height: 96px; border-radius: 0; }
.coll__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.coll__body strong { font-size: 0.98rem; line-height: 1.25; }
.coll__body span { font-size: 0.8rem; color: var(--muted); }

.badge { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; padding: 2px 8px; border-radius: 999px; background: rgba(41, 182, 232, 0.16); color: #8fdcf7; white-space: nowrap; }
.badge--gold { background: rgba(233, 196, 106, 0.16); color: var(--gold); }
.badge--muted { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.coll .badge { align-self: flex-start; margin-top: auto; }

.promo {
  margin-top: 22px; padding: 18px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(41, 182, 232, 0.22), rgba(26, 86, 196, 0.35)); border: 1px solid rgba(41, 182, 232, 0.35);
}
.promo h2 { margin: 0 0 4px; }
.promo p { margin: 0 0 12px; color: var(--muted); }

/* Collection page */
.hero { margin: 4px -16px 0; padding: 26px 16px 18px; position: relative; overflow: hidden; }
.hero .art { position: absolute; inset: 0; border-radius: 0; opacity: 0.85; }
.hero__inner { position: relative; }
.hero h1 { margin-top: 0; }
.hero p { color: rgba(255, 255, 255, 0.85); margin: 0 0 14px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 0.9rem; margin-bottom: 8px; }

.tracks { list-style: none; margin: 8px 0 0; padding: 0; }
.track {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 4px; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer;
}
.track__icon {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--card-2); color: var(--accent);
}
.track__icon svg { width: 18px; height: 18px; }
.track.is-locked .track__icon, .track.is-soon .track__icon { color: var(--faint); }
.track__text { flex: 1; min-width: 0; }
.track__text strong { display: block; font-weight: 600; line-height: 1.3; }
.track__text span { font-size: 0.82rem; color: var(--muted); }
.track__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.track.is-playing strong { color: var(--accent); }
.track__progress { height: 3px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.track__progress span { display: block; height: 100%; background: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; border: 0; cursor: pointer; text-decoration: none;
  font-weight: 700; font-size: 0.95rem; background: var(--accent); color: #05223a;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.icon-btn { background: none; border: 0; padding: 8px; cursor: pointer; border-radius: 50%; display: inline-grid; place-items: center; color: var(--text); }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn--lg svg { width: 32px; height: 32px; }
.icon-btn.is-on { color: #ff7aa8; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 0.88rem; }
.chip svg { width: 18px; height: 18px; }
.chip.is-on { border-color: var(--accent); color: var(--accent); }

/* Shop */
.offer {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  padding: 14px; margin-bottom: 10px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--card);
}
.offer input { accent-color: var(--accent); width: 20px; height: 20px; flex: none; }
.offer__text { flex: 1; }
.offer__text strong { display: block; }
.offer__text span { font-size: 0.84rem; color: var(--muted); }
.offer__price { font-weight: 800; font-size: 1.05rem; }
.offer.is-selected { border-color: var(--accent); background: var(--card-2); }
.offer.is-owned { opacity: 0.55; cursor: default; }

.field { display: block; margin: 16px 0 6px; font-weight: 600; font-size: 0.92rem; }
.input {
  width: 100%; padding: 13px 14px; font-size: 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
}
.note { font-size: 0.84rem; color: var(--muted); margin: 10px 0; }
.error { color: var(--danger); font-size: 0.9rem; margin: 8px 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.panel h2 { margin-top: 0; }
.panel ul, .panel ol { padding-left: 1.2rem; margin: 6px 0; color: var(--muted); }

/* Mini player */
.mini {
  position: fixed; left: 50%; transform: translateX(-50%); width: min(640px, 100% - 16px);
  bottom: calc(var(--tabs-h) + var(--safe-b) + 8px); height: var(--mini-h); z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: 0 8px; overflow: hidden;
  background: rgba(28, 42, 92, 0.96); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: blur(12px);
}
.mini__open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.mini__art { width: 44px; height: 44px; flex: none; border-radius: 10px; overflow: hidden; }
.mini__art .art { width: 100%; height: 100%; border-radius: 10px; }
.mini__text { min-width: 0; display: flex; flex-direction: column; }
.mini__text strong { font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini__text span { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini__play svg { width: 30px; height: 30px; }
.mini__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line); }
.mini__bar span { display: block; height: 100%; width: 0; background: var(--accent); }

/* Tab bar */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center; height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: rgba(11, 19, 48, 0.94); border-top: 1px solid var(--line); backdrop-filter: blur(12px);
}
.tabs a {
  flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); text-decoration: none; font-size: 0.72rem; font-weight: 600;
}
.tabs a svg { width: 24px; height: 24px; }
.tabs a.is-active { color: var(--accent); }

/* Full player */
.player {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 20px calc(var(--safe-b) + 24px);
  background: linear-gradient(180deg, #16245a 0%, var(--bg) 70%);
  animation: rise 0.25s ease-out;
}
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.player > * { width: 100%; max-width: 440px; }
.player__top { display: flex; align-items: center; justify-content: space-between; }
.player__label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; text-align: center; flex: 1; }
.player__art { aspect-ratio: 1; margin: 14px 0 20px; max-width: min(440px, 46vh); }
.player__art .art { width: 100%; height: 100%; border-radius: 22px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45); }
.player__title { font-size: 1.35rem; margin: 0 0 4px; text-align: center; }
.player__desc { color: var(--muted); text-align: center; margin: 0 0 16px; font-size: 0.92rem; }
.scrub input { width: 100%; accent-color: var(--accent); height: 28px; }
.scrub__times { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: center; gap: 28px; margin: 14px 0 18px; }
.play-btn { width: 76px; height: 76px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; background: var(--text); color: var(--bg); }
.play-btn svg { width: 34px; height: 34px; }
.player__extras { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* Sheet (dialogs) */
.sheet { position: fixed; inset: 0; z-index: 60; background: rgba(3, 7, 20, 0.6); display: flex; align-items: flex-end; justify-content: center; }
.sheet__panel {
  width: min(640px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(var(--safe-b) + 20px); animation: rise 0.2s ease-out;
}
.sheet__panel h2 { margin: 0 0 8px; font-size: 1.2rem; }
.sheet__panel p { color: var(--muted); }
.sheet__panel ul { color: var(--muted); padding-left: 1.2rem; }
.options { display: grid; gap: 8px; margin: 14px 0; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 70;
  bottom: calc(var(--tabs-h) + var(--mini-h) + var(--safe-b) + 20px); width: min(560px, 100% - 32px);
  padding: 12px 16px; border-radius: 12px; background: #e9f6ff; color: #0b1330; font-weight: 600; font-size: 0.92rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.player-open .toast { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 64px); }

.spinner { width: 40px; height: 40px; margin: 30px auto; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }

@media (min-width: 560px) {
  .grid { grid-template-columns: 1fr 1fr 1fr; }
}
