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

:root {
  /* ── Dark theme (default) ── */
  --bg:       #080b14;
  --surface:  #0d1220;
  --panel:    #111827;
  --border:   rgba(255,255,255,0.06);
  --teal:     #2dd4bf;
  --teal-dim: rgba(45,212,191,0.12);
  --amber:    #fbbf24;
  --violet:   #a78bfa;
  --rose:     #fb7185;
  --green:    #4ade80;
  --text:     #e2e8f0;
  --muted:    #475569;
  --soft:     #94a3b8;
  --shadow:   rgba(0,0,0,0.4);
  --theme-transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

/* ── Light theme ── */
[data-theme="light"] {
  --bg:       #f0f4f8;
  --surface:  #ffffff;
  --panel:    #e8edf5;
  --border:   rgba(0,0,0,0.08);
  --teal:     #0d9488;
  --teal-dim: rgba(13,148,136,0.10);
  --amber:    #d97706;
  --violet:   #7c3aed;
  --rose:     #e11d48;
  --green:    #16a34a;
  --text:     #0f172a;
  --muted:    #64748b;
  --soft:     #475569;
  --shadow:   rgba(0,0,0,0.12);
}
[data-theme="light"] body { background: var(--bg); }
[data-theme="light"] .ambient { opacity: 0.3; }
[data-theme="light"] .stars { display: none; }
[data-theme="light"] .bottom-bar { background: rgba(240,244,248,0.94); }
[data-theme="light"] .sound-card { box-shadow: 0 2px 8px var(--shadow); }
[data-theme="light"] .header { border-bottom-color: var(--border); }

/* ── AMOLED theme ── */
[data-theme="amoled"] {
  --bg:       #000000;
  --surface:  #0a0a0a;
  --panel:    #111111;
  --border:   rgba(255,255,255,0.07);
  --teal:     #2dd4bf;
  --teal-dim: rgba(45,212,191,0.10);
  --amber:    #fbbf24;
  --violet:   #a78bfa;
  --rose:     #fb7185;
  --green:    #4ade80;
  --text:     #f1f5f9;
  --muted:    #334155;
  --soft:     #64748b;
  --shadow:   rgba(0,0,0,0.8);
}
[data-theme="amoled"] .orb { filter: blur(80px); opacity: 0.6; }
[data-theme="amoled"] .bottom-bar { background: rgba(0,0,0,0.96); }
[data-theme="amoled"] .sound-card.on { box-shadow: 0 0 28px var(--c-shadow, rgba(45,212,191,0.18)); }

/* Global theme transition */
body, .sound-card, .bottom-bar, .header, .modal, .preset-chip,
.tab, .tabs, .share-btn, .play-btn, .timer-pill, .active-tag {
  transition: var(--theme-transition);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── AMBIENT BG ─────────────────────── */
.ambient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  overflow: hidden;
}
.orb {
  position: absolute; border-radius: 50%; filter: blur(80px);
  animation: drift var(--t,20s) ease-in-out infinite alternate;
}
.orb1 { width:500px;height:500px;background:rgba(45,212,191,0.04);top:-100px;right:-100px;--t:25s; }
.orb2 { width:400px;height:400px;background:rgba(167,139,250,0.04);bottom:-50px;left:-80px;--t:18s; }
.orb3 { width:300px;height:300px;background:rgba(251,191,36,0.03);top:40%;left:40%;--t:22s; }
@keyframes drift {
  from { transform: translate(0,0) scale(1); }
  to   { transform: translate(40px,30px) scale(1.1); }
}

.stars { position: fixed; inset:0; z-index:0; pointer-events:none; }
.star {
  position:absolute; background:white; border-radius:50%;
  animation: tw var(--d,3s) ease-in-out infinite alternate;
  animation-delay: var(--dl,0s);
}
@keyframes tw {
  from { opacity:var(--op,.3); }
  to   { opacity:1; }
}

/* ── LAYOUT ─────────────────────────── */
.app {
  position: relative; z-index: 2;
  max-width: 980px; margin: 0 auto;
  padding: 0 20px calc(80px + env(safe-area-inset-bottom));
}

/* ── HEADER ─────────────────────────── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
  flex-wrap: wrap; gap: 16px;
}
.header-left { display:flex; align-items:center; gap:14px; }
.logo {
  width:44px; height:44px; border-radius:12px;
  background: linear-gradient(135deg, #0d3d38, #1a2744);
  border: 1px solid rgba(45,212,191,0.3);
  display:flex; align-items:center; justify-content:center;
  font-size:1.3rem;
  box-shadow: 0 0 20px rgba(45,212,191,0.15);
}
.brand { line-height:1; }
.brand-main {
  font-family:'Syne',sans-serif; font-weight:800;
  font-size:1.15rem; letter-spacing:0.06em;
  color: var(--text);
}
.brand-tagline {
  font-size:0.7rem; letter-spacing:0.3em; text-transform:uppercase;
  color: var(--teal); margin-top:3px;
}

/* Master controls in header */
.header-controls { display:flex; align-items:center; gap:12px; }
.master-vol-wrap { display:flex; align-items:center; gap:8px; }
.master-vol-wrap span { font-size:0.75rem; color:var(--muted); }
input.slim-range {
  -webkit-appearance:none; width:90px; height:3px;
  background: linear-gradient(90deg, var(--teal) var(--val,70%), rgba(255,255,255,0.1) var(--val,70%));
  border-radius:2px; outline:none; cursor:pointer;
}
input.slim-range::-webkit-slider-thumb {
  -webkit-appearance:none; width:13px; height:13px;
  background:var(--teal); border-radius:50%;
  box-shadow:0 0 6px rgba(45,212,191,0.5);
}

/* Timer pill */
.timer-pill {
  display:flex; align-items:center; gap:8px;
  background:var(--panel); border:1px solid var(--border);
  border-radius:50px; padding:6px 14px;
}
.timer-pill span { font-size:0.72rem; letter-spacing:0.2em; text-transform:uppercase; color:var(--muted); }
.timer-btns { display:flex; gap:4px; }
.t-btn {
  background:transparent; border:1px solid transparent;
  color:var(--soft); padding:3px 9px; border-radius:20px;
  cursor:pointer; font-family:'DM Sans',sans-serif;
  font-size:0.68rem; letter-spacing:0.1em; transition:all .25s;
}
.t-btn:hover,.t-btn.on { background:var(--teal-dim); border-color:var(--teal); color:var(--teal); }
#t-display {
  font-family:'Syne',sans-serif; font-weight:700;
  font-size:0.9rem; color:var(--teal); min-width:40px;
}

/* ── TABS ───────────────────────────── */
.tabs {
  display:flex; gap:4px;
  background:var(--panel); border:1px solid var(--border);
  border-radius:14px; padding:5px;
  margin-bottom:28px; overflow-x:auto;
  scrollbar-width:none;
  -webkit-overflow-scrolling:touch;
  /* Fade hint on right edge when scrollable */
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 32px), transparent 100%);
  mask-image: linear-gradient(to right, black calc(100% - 32px), transparent 100%);
}
.tabs::-webkit-scrollbar { display:none; }
/* Remove mask when fully scrolled (JS adds class) */
.tabs.scrolled-end {
  -webkit-mask-image: none;
  mask-image: none;
}
.tab {
  flex:0 0 auto; background:transparent; border:none;
  color:var(--muted); padding:9px 18px; border-radius:10px;
  cursor:pointer; font-family:'DM Sans',sans-serif;
  font-size:0.84rem; letter-spacing:0.08em; font-weight:400;
  transition:all .25s; display:flex; align-items:center; gap:7px;
  white-space:nowrap;
}
.tab:hover { color:var(--text); }
.tab.on {
  background:var(--surface); color:var(--text);
  box-shadow:0 2px 12px rgba(0,0,0,0.3);
}
.tab .dot {
  width:7px; height:7px; border-radius:50%;
  background:var(--cat-color, var(--teal));
  opacity:0.5; transition:opacity .25s;
}
.tab.on .dot { opacity:1; }

/* ── SOUND GRID ─────────────────────── */
.sound-grid {
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap:12px; margin-bottom:28px;
}

.sound-card {
  background:var(--panel); border:1px solid var(--border);
  border-radius:16px; padding:18px 16px 36px;
  cursor:pointer; position:relative; overflow:hidden;
  transition:all .35s cubic-bezier(.4,0,.2,1);
  user-select:none;
}
.sound-card::before {
  content:''; position:absolute; inset:0;
  background:radial-gradient(ellipse at 50% 110%, var(--c-glow, rgba(45,212,191,0.15)), transparent 65%);
  opacity:0; transition:opacity .35s;
}
.sound-card:hover { transform:translateY(-3px); border-color:rgba(255,255,255,0.12); }
.sound-card:hover::before { opacity:.6; }
.sound-card.on {
  border-color: var(--c-border, rgba(45,212,191,0.5));
  background: linear-gradient(160deg, var(--c-bg, rgba(13,61,56,.4)), var(--panel));
  box-shadow: 0 0 24px var(--c-shadow, rgba(45,212,191,0.12));
}
.sound-card.on::before { opacity:1; }

.card-top { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:10px; }
.card-icon { font-size:1.8rem; line-height:1; }
.card-active-dot {
  width:7px; height:7px; border-radius:50%;
  background:var(--c-border, var(--teal));
  opacity:0; transition:opacity .3s;
  margin-top:4px; flex-shrink:0;
}
.sound-card.on .card-active-dot { opacity:1; animation:pulse-soft 3s ease-in-out infinite; }
@keyframes pulse-soft { 0%,100%{opacity:0.6; transform:scale(1)} 50%{opacity:1; transform:scale(1.3)} }

.card-label {
  font-family:'Syne',sans-serif; font-weight:600;
  font-size:0.9rem; letter-spacing:0.03em;
  color:var(--text); margin-bottom:3px;
  line-height:1.3;
}
.card-sub { font-size:0.75rem; letter-spacing:0.12em; text-transform:uppercase; color:var(--muted); line-height:1.4; }

/* Individual volume slider — shows on active */
.card-vol {
  position: absolute; bottom: 12px; left: 16px; right: 16px;
  display:flex; align-items:center; gap:8px;
  opacity:0; transform:translateY(4px);
  transition:all .3s; pointer-events:none;
}
.sound-card.on .card-vol {
  opacity:1; transform:translateY(0);
  pointer-events:auto;
}
.card-vol input {
  -webkit-appearance:none; flex:1; height:3px;
  background:linear-gradient(90deg, var(--c-border, var(--teal)) var(--vv,60%), rgba(255,255,255,0.1) var(--vv,60%));
  border-radius:2px; outline:none; cursor:pointer;
}
.card-vol input::-webkit-slider-thumb {
  -webkit-appearance:none; width:11px; height:11px;
  background:var(--c-border, var(--teal)); border-radius:50%;
}
.card-vol-pct { font-size:0.72rem; color:var(--muted); min-width:24px; text-align:right; }

/* ── PRESETS ────────────────────────── */
.presets-section { margin-bottom:28px; }
.section-title {
  font-family:'Syne',sans-serif; font-weight:600;
  font-size:0.82rem; letter-spacing:0.25em; text-transform:uppercase;
  color:var(--muted); margin-bottom:12px;
  display:flex; align-items:center; gap:8px;
}
.section-title::after {
  content:''; flex:1; height:1px; background:var(--border);
}

.presets-row { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.preset-chip {
  background:var(--panel); border:1px solid var(--border);
  border-radius:50px; padding:7px 16px;
  cursor:pointer; font-family:'DM Sans',sans-serif;
  font-size:0.78rem; color:var(--soft); letter-spacing:0.08em;
  transition:all .25s; display:flex; align-items:center; gap:7px;
}
.preset-chip:hover { border-color:rgba(255,255,255,0.15); color:var(--text); }
.preset-chip.on { border-color:var(--teal); color:var(--teal); background:var(--teal-dim); }
.preset-chip .p-icon { font-size:0.85rem; }

.save-btn {
  background:transparent; border:1px dashed rgba(255,255,255,0.15);
  border-radius:50px; padding:7px 16px;
  cursor:pointer; font-family:'DM Sans',sans-serif;
  font-size:0.72rem; color:var(--muted); letter-spacing:0.08em;
  transition:all .25s; display:flex; align-items:center; gap:6px;
}
.save-btn:hover { border-color:var(--teal); color:var(--teal); }

/* Save modal */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,0.7);
  z-index:100; display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none; transition:opacity .25s;
  backdrop-filter:blur(4px);
}
.modal-overlay.show { opacity:1; pointer-events:auto; }
.modal {
  background:var(--panel); border:1px solid var(--border);
  border-radius:20px; padding:28px; width:320px;
  transform:translateY(10px); transition:transform .25s;
}
.modal-overlay.show .modal { transform:translateY(0); }
.modal h3 { font-family:'Syne',sans-serif; font-size:1rem; margin-bottom:16px; color:var(--text); }
.modal input[type=text] {
  width:100%; background:var(--surface); border:1px solid var(--border);
  border-radius:10px; padding:10px 14px; color:var(--text);
  font-family:'DM Sans',sans-serif; font-size:0.85rem; outline:none;
  transition:border-color .2s;
}
.modal input[type=text]:focus { border-color:var(--teal); }
.modal-btns { display:flex; gap:8px; margin-top:16px; justify-content:flex-end; }
.btn-cancel {
  background:transparent; border:1px solid var(--border);
  color:var(--muted); padding:8px 18px; border-radius:50px;
  cursor:pointer; font-family:'DM Sans',sans-serif; font-size:0.78rem;
  transition:all .2s;
}
.btn-cancel:hover { border-color:var(--soft); color:var(--soft); }
.btn-save-confirm {
  background:var(--teal); border:none; color:#000;
  padding:8px 18px; border-radius:50px;
  cursor:pointer; font-family:'DM Sans',sans-serif;
  font-size:0.78rem; font-weight:600; transition:opacity .2s;
}
.btn-save-confirm:hover { opacity:.85; }

/* ── BOTTOM BAR ─────────────────────── */
.bottom-bar {
  position:fixed; bottom:0; left:0; right:0; z-index:10;
  background:rgba(8,11,20,0.92); backdrop-filter:blur(16px);
  border-top:1px solid var(--border);
  padding:12px 24px calc(12px + env(safe-area-inset-bottom));
}
.bottom-inner {
  max-width:980px; margin:0 auto;
  display:grid;
  grid-template-columns: 1fr 60px 1fr;
  align-items:center;
  gap:8px;
}
.now-playing { display:flex; align-items:center; gap:12px; min-width:0; overflow:hidden; }
.np-waves { display:flex; align-items:flex-end; gap:2px; height:28px; flex-shrink:0; position:relative; }
#vizCanvas {
  display:block; border-radius:4px;
  opacity:0.15; transition:opacity .4s;
}
#vizCanvas.active { opacity:1; }
.np-bar {
  width:3px; background:var(--teal);
  border-radius:2px; opacity:0.25; transform-origin:bottom;
}
.np-bar.on {
  opacity:.8;
  animation:npw var(--s,.7s) ease-in-out infinite alternate;
  animation-delay:var(--dl,0s);
}
@keyframes npw { from{transform:scaleY(0.1)} to{transform:scaleY(1)} }
.np-text { min-width:0; }
.np-label { font-family:'Syne',sans-serif; font-size:0.76rem; font-weight:700; color:var(--text); letter-spacing:0.04em; }
.np-sub { font-size:0.65rem; color:var(--muted); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:220px; line-height:1.4; }

/* Play button */
.play-btn {
  width:52px; height:52px; border-radius:50%; flex-shrink:0;
  background:var(--teal); border:none;
  color:#000; font-size:1.3rem;
  cursor:pointer; transition:all .3s;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 0 20px rgba(45,212,191,0.3);
}
.play-btn:hover { transform:scale(1.08); box-shadow:0 0 32px rgba(45,212,191,0.5); }
.play-btn.on { animation:pb-pulse 4s ease-in-out infinite; }
@keyframes pb-pulse {
  0%,100%{box-shadow:0 0 20px rgba(45,212,191,0.3)}
  50%{box-shadow:0 0 40px rgba(45,212,191,0.55)}
}

/* Active sounds summary */
.bottom-right { display:flex; align-items:center; justify-content:flex-end; gap:8px; min-width:0; overflow:hidden; }
.active-summary { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.active-tag {
  background:var(--surface); border:1px solid var(--border);
  border-radius:20px; padding:3px 10px;
  font-size:0.62rem; color:var(--soft); letter-spacing:0.1em;
  display:flex; align-items:center; gap:4px;
}

/* Onboarding */
#onboardingOverlay {
  position:fixed; inset:0; background:rgba(0,0,0,0.85);
  z-index:300; display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none; transition:opacity .35s;
  backdrop-filter:blur(8px);
}
#onboardingOverlay.show { opacity:1; pointer-events:auto; }
.ob-modal {
  background:var(--panel); border:1px solid var(--border);
  border-radius:24px; padding:32px 28px 28px;
  width:100%; max-width:420px; position:relative;
  transform:translateY(16px); transition:transform .35s;
}
#onboardingOverlay.show .ob-modal { transform:translateY(0); }
.ob-dots {
  display:flex; gap:6px; justify-content:center; margin-bottom:24px;
}
.ob-dot {
  width:6px; height:6px; border-radius:50%;
  background:var(--muted); transition:all .25s;
}
.ob-dot.on { background:var(--teal); width:20px; border-radius:4px; }
.ob-step { display:none; }
.ob-step.on { display:block; }
.ob-icon { font-size:2.8rem; text-align:center; margin-bottom:16px; }
.ob-title {
  font-family:'Syne',sans-serif; font-weight:700;
  font-size:1.1rem; text-align:center; color:var(--text); margin-bottom:8px;
}
.ob-desc { font-size:0.82rem; color:var(--soft); text-align:center; line-height:1.7; margin-bottom:20px; }
.ob-features { display:grid; gap:10px; margin-bottom:20px; }
.ob-feature {
  display:flex; align-items:center; gap:10px;
  background:var(--surface); border:1px solid var(--border);
  border-radius:10px; padding:10px 14px;
  font-size:0.8rem; color:var(--text);
}
.ob-feature .ob-feat-icon { font-size:1.2rem; flex-shrink:0; }
.ob-steps-list { display:grid; gap:10px; margin-bottom:20px; }
.ob-step-item {
  display:flex; align-items:center; gap:12px;
  font-size:0.82rem; color:var(--soft);
}
.ob-step-num {
  width:28px; height:28px; border-radius:50%; flex-shrink:0;
  background:var(--teal-dim); border:1px solid rgba(45,212,191,.3);
  color:var(--teal); font-family:'Syne',sans-serif; font-weight:700;
  font-size:0.8rem; display:flex; align-items:center; justify-content:center;
}
.ob-btn-primary {
  width:100%; background:linear-gradient(135deg,#4ade80,#22c55e);
  border:none; color:#000; padding:13px; border-radius:50px;
  cursor:pointer; font-family:'Syne',sans-serif; font-weight:700;
  font-size:0.88rem; letter-spacing:0.04em; transition:opacity .2s;
  margin-bottom:10px;
}
.ob-btn-primary:hover { opacity:.88; }
.ob-btn-secondary {
  width:100%; background:transparent; border:1px solid var(--border);
  color:var(--muted); padding:10px; border-radius:50px;
  cursor:pointer; font-family:'DM Sans',sans-serif; font-size:0.78rem;
  transition:all .2s;
}
.ob-btn-secondary:hover { border-color:var(--soft); color:var(--soft); }
.ob-nav { display:flex; gap:8px; }
.ob-nav .ob-btn-primary { flex:1; margin-bottom:0; }
.ob-nav .ob-btn-secondary { flex:0 0 auto; width:auto; padding:10px 18px; }

/* Share button */
.share-btn {
  background:transparent; border:1px solid rgba(45,212,191,0.3);
  color:var(--teal); padding:7px 14px; border-radius:50px;
  cursor:pointer; font-family:'DM Sans',sans-serif;
  font-size:0.72rem; letter-spacing:0.08em; transition:all .25s;
  display:flex; align-items:center; gap:6px; flex-shrink:0;
}
.share-btn:hover { background:var(--teal-dim); border-color:var(--teal); }

/* Share toast */
#shareToast {
  position:fixed; bottom:90px; left:50%; transform:translateX(-50%) translateY(10px);
  background:var(--panel); border:1px solid rgba(45,212,191,0.4);
  color:var(--teal); padding:10px 20px; border-radius:50px;
  font-size:0.78rem; letter-spacing:0.08em;
  opacity:0; transition:all .3s; pointer-events:none; z-index:50;
  white-space:nowrap;
}
#shareToast.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* ── MEDITATION CARDS ───────────────────────────── */
.med-card {
  background:var(--panel); border:1px solid var(--border);
  border-radius:16px; padding:18px 16px 14px;
  cursor:pointer; position:relative; overflow:hidden;
  transition:all .35s cubic-bezier(.4,0,.2,1);
  user-select:none;
  --c-glow: rgba(167,139,250,0.15);
  --c-border: rgba(167,139,250,0.5);
}
.med-card::before {
  content:''; position:absolute; inset:0;
  background:radial-gradient(ellipse at 50% 110%, var(--c-glow), transparent 65%);
  opacity:0; transition:opacity .35s;
}
.med-card:hover { transform:translateY(-3px); border-color:rgba(255,255,255,0.12); }
.med-card:hover::before { opacity:.6; }
.med-card.premium-locked { opacity:0.55; }
.med-card-top { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:10px; }
.med-card-icon { font-size:1.8rem; line-height:1; }
.med-card-label { font-family:'Syne',sans-serif; font-weight:600; font-size:0.88rem; letter-spacing:0.05em; color:var(--text); margin-bottom:2px; }
.med-card-sub { font-size:0.78rem; letter-spacing:0.15em; text-transform:uppercase; color:var(--muted); margin-bottom:12px; }
.med-start-btn {
  width:100%; background:rgba(167,139,250,0.15); border:1px solid rgba(167,139,250,0.4);
  color:#a78bfa; padding:7px 4px; border-radius:10px;
  cursor:pointer; font-family:'DM Sans',sans-serif; font-size:0.76rem;
  transition:all .25s; display:flex; align-items:center; justify-content:center; gap:4px;
  white-space:nowrap; min-width:0; overflow:hidden;
}
.med-start-btn:hover { background:rgba(167,139,250,0.25); }

/* ── MEDITATION PANEL ───────────────────────────── */
#medPanel {
  position:fixed; bottom:76px; left:0; right:0; z-index:20;
  background:rgba(11,14,26,0.97); backdrop-filter:blur(16px);
  border-top:1px solid rgba(167,139,250,0.3);
  padding:14px 20px 16px;
  transform:translateY(calc(100% + 80px)); transition:transform .35s cubic-bezier(.4,0,.2,1);
  pointer-events:none;
}
#medPanel.show { transform:translateY(0); pointer-events:auto; }
.med-panel-inner { max-width:980px; margin:0 auto; }
.med-panel-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.med-panel-title { font-family:'Syne',sans-serif; font-weight:600; font-size:0.9rem; color:var(--text); display:flex; align-items:center; gap:8px; }
.med-panel-close { background:none; border:none; color:var(--muted); font-size:1.1rem; cursor:pointer; padding:2px 6px; }
.med-panel-close:hover { color:var(--text); }
.med-prog-bar-wrap { background:rgba(255,255,255,0.08); border-radius:4px; height:5px; margin-bottom:10px; overflow:hidden; }
.med-prog-bar { height:100%; background:linear-gradient(90deg,#a78bfa,#7c3aed); border-radius:4px; width:0%; transition:width .5s linear; }
.med-time { font-size:0.72rem; color:var(--muted); text-align:right; margin-bottom:10px; }
.med-controls { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.med-ctrl-btn {
  background:transparent; border:1px solid rgba(167,139,250,0.3);
  color:#a78bfa; padding:6px 16px; border-radius:50px;
  cursor:pointer; font-family:'DM Sans',sans-serif; font-size:0.78rem; transition:all .2s;
  display:flex; align-items:center; gap:5px;
}
.med-ctrl-btn:hover { background:rgba(167,139,250,0.15); }
.med-speed-label { font-size:0.68rem; color:var(--muted); margin-left:8px; }
.med-speed-btn {
  background:transparent; border:1px solid rgba(255,255,255,0.1);
  color:var(--muted); padding:4px 10px; border-radius:20px;
  cursor:pointer; font-family:'DM Sans',sans-serif; font-size:0.7rem; transition:all .2s;
}
.med-speed-btn.on { border-color:rgba(167,139,250,0.5); color:#a78bfa; background:rgba(167,139,250,0.12); }
.med-speed-btn:hover { border-color:rgba(167,139,250,0.3); color:#a78bfa; }
.med-phrase { font-size:0.8rem; color:var(--soft); line-height:1.5; min-height:20px; margin-top:8px; font-style:italic; }
/* ── LIGHT THEME OVERRIDES ──────────────────────────────── */
[data-theme="light"] .sound-card { background: var(--surface); }
[data-theme="light"] .sound-card:hover { border-color: rgba(0,0,0,0.14); }
[data-theme="light"] .tabs { background: var(--panel); }
[data-theme="light"] .tab.on { background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
[data-theme="light"] .preset-chip { background: var(--surface); }
[data-theme="light"] .modal { background: var(--surface); }
[data-theme="light"] .ob-modal { background: var(--surface); }
[data-theme="light"] .np-bar { background: var(--teal); }
[data-theme="light"] #shareToast { background: var(--surface); color: var(--teal); }
[data-theme="light"] input.slim-range { background: linear-gradient(90deg, var(--teal) var(--val,70%), rgba(0,0,0,0.1) var(--val,70%)); }
[data-theme="light"] .card-vol input { background: linear-gradient(90deg, var(--c-border,var(--teal)) var(--vv,60%), rgba(0,0,0,0.1) var(--vv,60%)); }
[data-theme="light"] .med-panel-inner { background: var(--panel); }
[data-theme="light"] #medPanel { background: rgba(240,244,248,0.97); border-top-color: var(--border); }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .app { padding: 0 14px 80px; }
  .header { padding: 18px 0 22px; gap: 10px; }
  .header-controls { gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
  .master-vol-wrap { order: 10; width: 100%; justify-content: center; }
  .timer-pill { order: 11; width: 100%; justify-content: center; }
  .sound-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 9px; }
  .sound-card { padding: 14px 12px 12px; }
  .card-icon { font-size: 1.5rem; }
  .card-label { font-size: 0.84rem; }
  .bottom-inner { grid-template-columns: 1fr 52px 1fr; gap: 6px; padding: 0 4px; }
  .play-btn { width: 46px; height: 46px; font-size: 1.1rem; }
  .np-sub { max-width: 150px; }
  .active-tag { display: none; }
  #shareToast { font-size: 0.72rem; padding: 8px 16px; }
}

@media (max-width: 480px) {
  .brand-main { font-size: 1rem; }
  .sound-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .presets-row { gap: 6px; }
  .preset-chip { padding: 6px 12px; font-size: 0.73rem; }
  #learnBtn { display: none !important; }
  .bottom-inner { grid-template-columns: auto 46px auto; }
}
/* ── BREATHING HINT BANNER ─────────────── */
@keyframes breathHintIn  { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:translateY(0)} }
@keyframes breathHintGlow{ 0%,100%{opacity:1;background:rgba(45,212,191,0.10)} 50%{opacity:.75;background:rgba(45,212,191,0.20)} }
@keyframes breathDotPing { 0%{box-shadow:0 0 0 0 rgba(45,212,191,0.65)} 70%{box-shadow:0 0 0 8px rgba(45,212,191,0)} 100%{box-shadow:0 0 0 0 rgba(45,212,191,0)} }
#breathHint { animation:breathHintIn .35s ease both; }
#breathHintBtn {
  background:rgba(45,212,191,0.10); border:1px solid rgba(45,212,191,0.35);
  animation:breathHintGlow 2s ease-in-out infinite;
  transition:border-color .2s;
}
#breathHintBtn:hover { border-color:rgba(45,212,191,0.7); background:rgba(45,212,191,0.18); }
.breath-hint-dot {
  width:9px; height:9px; border-radius:50%; flex-shrink:0;
  background:var(--teal);
  animation:breathDotPing 1.5s ease-in-out infinite;
}

/* ── BREATHING MODAL ─────────────────────── */
.breath-overlay {
  position:fixed; inset:0; z-index:180;
  background:rgba(0,0,0,0.88); backdrop-filter:blur(18px);
  display:none; align-items:center; justify-content:center;
}
.breath-overlay.show { display:flex; }
.breath-modal {
  width:100%; max-width:400px; margin:16px;
  background:linear-gradient(160deg,#0d1525,#0a1020);
  border:1px solid rgba(45,212,191,0.2); border-radius:28px;
  padding:28px 24px 24px;
  display:flex; flex-direction:column; align-items:center;
  position:relative; overflow:hidden;
}
.breath-modal::before {
  content:''; position:absolute; inset:0;
  background:radial-gradient(ellipse at 50% 0%, rgba(45,212,191,0.06), transparent 60%);
  pointer-events:none;
}
.breath-close {
  position:absolute; top:14px; right:14px;
  background:none; border:none; color:var(--muted);
  font-size:1.1rem; cursor:pointer; padding:4px 8px;
  border-radius:8px; transition:all .2s; z-index:2;
}
.breath-close:hover { color:var(--text); }
.breath-tabs {
  display:flex; gap:3px; background:rgba(255,255,255,0.04);
  border:1px solid rgba(255,255,255,0.06); border-radius:50px;
  padding:4px; margin-bottom:20px; z-index:2;
}
.breath-tab {
  background:none; border:none; color:var(--muted);
  padding:5px 12px; border-radius:50px; cursor:pointer;
  font-family:'DM Sans',sans-serif; font-size:0.7rem;
  letter-spacing:0.04em; transition:all .22s; white-space:nowrap;
}
.breath-tab.on { background:rgba(45,212,191,0.15); color:var(--teal); border:1px solid rgba(45,212,191,0.3); }
.breath-sphere-wrap {
  position:relative; width:200px; height:200px;
  display:flex; align-items:center; justify-content:center;
  margin-bottom:18px; flex-shrink:0;
}
.breath-ring {
  position:absolute; border-radius:50%;
  border:1px solid rgba(45,212,191,0.12);
}
.breath-ring-1 { width:190px; height:190px; }
.breath-ring-2 { width:158px; height:158px; border-color:rgba(45,212,191,0.08); }
.breath-sphere {
  width:82px; height:82px; border-radius:50%;
  background:radial-gradient(circle at 38% 38%, rgba(100,220,210,0.9), rgba(45,212,191,0.55) 50%, rgba(13,61,56,0.8));
  box-shadow:0 0 35px rgba(45,212,191,0.3), inset 0 0 25px rgba(255,255,255,0.08);
  transform:scale(1.0);
}
.breath-sphere.inhale {
  transition:transform var(--bin,4s) cubic-bezier(.4,0,.2,1), box-shadow var(--bin,4s) ease, background var(--bin,4s) ease;
  transform:scale(1.9);
  background:radial-gradient(circle at 38% 38%, rgba(120,240,225,0.95), rgba(45,212,191,0.7) 50%, rgba(13,80,70,0.85));
  box-shadow:0 0 65px rgba(45,212,191,0.55), inset 0 0 35px rgba(255,255,255,0.12);
}
.breath-sphere.hold {
  transition:transform .4s ease, box-shadow .4s ease, background .4s ease;
  transform:scale(1.9);
  background:radial-gradient(circle at 38% 38%, rgba(200,180,255,0.95), rgba(167,139,250,0.7) 50%, rgba(40,20,80,0.85));
  box-shadow:0 0 65px rgba(167,139,250,0.55), inset 0 0 30px rgba(255,255,255,0.1);
}
.breath-sphere.hold2 {
  transition:transform .4s ease, box-shadow .4s ease, background .4s ease;
  transform:scale(1.0);
  background:radial-gradient(circle at 38% 38%, rgba(255,220,100,0.95), rgba(251,191,36,0.65) 50%, rgba(60,40,0,0.85));
  box-shadow:0 0 30px rgba(251,191,36,0.4), inset 0 0 20px rgba(255,255,255,0.06);
}
.breath-sphere.exhale {
  transition:transform var(--bout,8s) cubic-bezier(.4,0,.2,1), box-shadow var(--bout,8s) ease, background var(--bout,8s) ease;
  transform:scale(1.0);
  background:radial-gradient(circle at 38% 38%, rgba(120,150,255,0.85), rgba(99,102,241,0.5) 50%, rgba(15,20,60,0.8));
  box-shadow:0 0 28px rgba(99,102,241,0.3), inset 0 0 18px rgba(255,255,255,0.04);
}
.breath-pulse {
  position:absolute; width:82px; height:82px; border-radius:50%;
  border:2px solid rgba(45,212,191,0.35);
  animation:bpulse 2s ease-in-out infinite;
}
@keyframes bpulse { 0%,100%{transform:scale(1);opacity:.5} 50%{transform:scale(1.2);opacity:.12} }
.breath-phase {
  font-family:'Syne',sans-serif; font-weight:700;
  font-size:1rem; letter-spacing:0.12em; text-transform:uppercase;
  color:var(--teal); min-height:26px; text-align:center; z-index:2; transition:color .4s;
}
.breath-phase.holding { color:#a78bfa; }
.breath-phase.holding2 { color:#fbbf24; }
.breath-count {
  font-family:'Syne',sans-serif; font-weight:800;
  font-size:2.8rem; color:var(--text); opacity:.9;
  min-height:52px; line-height:1; text-align:center; z-index:2; margin:4px 0;
}
.breath-cycles { font-size:0.7rem; letter-spacing:0.15em; text-transform:uppercase; color:var(--muted); z-index:2; }
.breath-desc {
  font-size:0.74rem; color:var(--soft); line-height:1.65; text-align:center;
  z-index:2; margin-bottom:16px;
  background:rgba(255,255,255,0.03); border:1px solid rgba(255,255,255,0.06);
  border-radius:10px; padding:9px 13px; max-width:300px;
}
.breath-controls { display:flex; gap:9px; z-index:2; margin-top:8px; }
.breath-btn-start {
  background:var(--teal); border:none; color:#000;
  padding:10px 28px; border-radius:50px; cursor:pointer;
  font-family:'Syne',sans-serif; font-weight:700; font-size:0.82rem;
  letter-spacing:0.05em; transition:opacity .2s;
}
.breath-btn-start:hover { opacity:.88; }
.breath-btn-stop {
  background:transparent; border:1px solid rgba(255,255,255,0.12);
  color:var(--muted); padding:10px 20px; border-radius:50px;
  cursor:pointer; font-family:'DM Sans',sans-serif; font-size:0.8rem; transition:all .22s;
}
.breath-btn-stop:hover { border-color:rgba(251,113,133,0.4); color:#fb7185; }
@media(max-width:480px){
  .breath-modal { padding:22px 16px 20px; }
  .breath-sphere-wrap { width:175px; height:175px; }
  .breath-sphere, .breath-pulse { width:72px; height:72px; }
  .breath-ring-1 { width:168px; height:168px; }
  .breath-ring-2 { width:138px; height:138px; }
}

/* ── AI SOUND ADVISOR ────────────────────── */
.ai-fab {
  position:fixed; bottom:calc(90px + env(safe-area-inset-bottom)); right:20px; z-index:15;
  width:50px; height:50px; border-radius:50%;
  background:linear-gradient(135deg,#a78bfa,#7c3aed);
  border:none; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  flex-direction:column; gap:1px;
  box-shadow:0 4px 20px rgba(167,139,250,0.45);
  transition:all .3s; color:white;
}
.ai-fab:hover { transform:scale(1.1); }
.ai-fab-icon { font-size:1.15rem; line-height:1; }
.ai-fab-lbl { font-size:0.44rem; letter-spacing:0.12em; font-family:'Syne',sans-serif; font-weight:700; opacity:.85; }
@keyframes aipulse {
  0%,100%{box-shadow:0 4px 20px rgba(167,139,250,0.45)}
  50%{box-shadow:0 4px 36px rgba(167,139,250,0.75),0 0 0 8px rgba(167,139,250,0.08)}
}
.ai-fab.pulse { animation:aipulse 2.5s ease-in-out infinite; }
.ai-panel {
  position:fixed; bottom:80px; right:20px; z-index:25;
  width:318px; max-height:475px;
  background:var(--panel); border:1px solid rgba(167,139,250,0.3);
  border-radius:20px; display:flex; flex-direction:column;
  box-shadow:0 8px 40px rgba(0,0,0,0.55);
  transform:translateY(14px) scale(0.97); opacity:0; pointer-events:none;
  transition:all .28s cubic-bezier(.4,0,.2,1); overflow:hidden;
}
.ai-panel.show { transform:translateY(0) scale(1); opacity:1; pointer-events:auto; }
.ai-panel-hdr {
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 14px 10px; border-bottom:1px solid rgba(167,139,250,0.1);
  background:linear-gradient(180deg,rgba(167,139,250,0.06),transparent); flex-shrink:0;
}
.ai-panel-title { font-family:'Syne',sans-serif; font-weight:700; font-size:0.84rem; color:var(--text); display:flex; align-items:center; gap:6px; }
.ai-badge { font-size:0.57rem; padding:2px 6px; border-radius:20px; font-family:'DM Sans',sans-serif; }
.ai-badge.free { background:rgba(74,222,128,0.1); border:1px solid rgba(74,222,128,0.28); color:#4ade80; }
.ai-badge.prem { background:rgba(251,191,36,0.1); border:1px solid rgba(251,191,36,0.28); color:#fbbf24; }
.ai-close { background:none; border:none; color:var(--muted); cursor:pointer; font-size:1rem; padding:4px 6px; border-radius:6px; transition:all .2s; }
.ai-close:hover { color:var(--text); }
.ai-suggests { display:flex; flex-wrap:wrap; gap:5px; padding:8px 11px 0; flex-shrink:0; }
.ai-suggest {
  background:var(--surface); border:1px solid var(--border);
  border-radius:20px; padding:5px 10px; font-size:0.7rem; color:var(--soft);
  cursor:pointer; font-family:'DM Sans',sans-serif; transition:all .2s; white-space:nowrap;
}
.ai-suggest:hover { border-color:rgba(167,139,250,0.4); color:#a78bfa; background:rgba(167,139,250,0.06); }
.ai-msgs {
  flex:1; overflow-y:auto; padding:10px 11px; display:flex; flex-direction:column; gap:8px;
  scrollbar-width:thin; scrollbar-color:rgba(255,255,255,0.07) transparent;
}
.ai-msg { max-width:92%; font-size:0.77rem; line-height:1.6; padding:8px 11px; border-radius:12px; }
.ai-msg.user { background:rgba(45,212,191,0.1); border:1px solid rgba(45,212,191,0.18); color:var(--text); align-self:flex-end; border-radius:12px 12px 3px 12px; }
.ai-msg.bot  { background:rgba(167,139,250,0.08); border:1px solid rgba(167,139,250,0.15); color:var(--text); align-self:flex-start; border-radius:3px 12px 12px 12px; }
.ai-chips { display:flex; flex-wrap:wrap; gap:5px; margin-top:8px; }
.ai-chip { display:inline-flex; align-items:center; gap:4px; padding:3px 8px; border-radius:20px; font-size:0.66rem; font-family:'DM Sans',sans-serif; border:1px solid; }
.ai-chip.free { background:rgba(74,222,128,0.1); border-color:rgba(74,222,128,0.3); color:#4ade80; }
.ai-chip.prem { background:rgba(251,191,36,0.1); border-color:rgba(251,191,36,0.3); color:#fbbf24; }
.ai-apply { width:100%; margin-top:8px; background:rgba(167,139,250,0.12); border:1px solid rgba(167,139,250,0.3); color:#a78bfa; padding:7px; border-radius:9px; cursor:pointer; font-family:'DM Sans',sans-serif; font-size:0.73rem; transition:all .2s; display:flex; align-items:center; justify-content:center; gap:5px; }
.ai-apply:hover { background:rgba(167,139,250,0.22); }
.ai-input-row { display:flex; gap:7px; padding:10px 11px; border-top:1px solid rgba(255,255,255,0.05); flex-shrink:0; }
.ai-input-row input { flex:1; background:var(--surface); border:1px solid var(--border); border-radius:9px; padding:8px 10px; color:var(--text); font-family:'DM Sans',sans-serif; font-size:0.77rem; outline:none; transition:border-color .2s; }
.ai-input-row input:focus { border-color:rgba(167,139,250,0.4); }
.ai-input-row input::placeholder { color:var(--muted); }
.ai-send { width:34px; height:34px; border-radius:9px; flex-shrink:0; background:rgba(167,139,250,0.15); border:1px solid rgba(167,139,250,0.28); color:#a78bfa; cursor:pointer; font-size:1rem; display:flex; align-items:center; justify-content:center; transition:all .2s; }
.ai-send:hover { background:rgba(167,139,250,0.28); }
.ai-send:disabled { opacity:.4; cursor:not-allowed; }
@media(max-width:480px){
  .ai-panel { right:0; left:0; bottom:76px; width:100%; border-radius:18px 18px 0 0; max-height:68vh; }
  .ai-fab { bottom:94px; right:14px; width:44px; height:44px; }
}