/* Haru Sleep — warm pastel sleep mixer */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,400;9..144,600&family=JetBrains+Mono:wght@400;500&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; }
html { overflow-x: hidden; }

/* Default tokens at :root so body & SVGs always have a usable color even
   before .app mounts. Theme classes on .app override these. */
:root {
  --peach-soft:    oklch(0.94 0.045 50);
  --rose-soft:     oklch(0.93 0.04 25);
  --lavender-soft: oklch(0.93 0.04 290);
  --sage-soft:     oklch(0.94 0.035 150);
  --cream:         oklch(0.97 0.015 80);

  --accent-peach:    oklch(0.78 0.10 50);
  --accent-rose:     oklch(0.78 0.10 20);
  --accent-lavender: oklch(0.75 0.10 290);
  --accent-sage:     oklch(0.78 0.08 150);

  --bg:        oklch(0.985 0.008 70);
  --bg-card:   oklch(1 0 0 / 0.65);
  --bg-card-2: oklch(1 0 0 / 0.85);
  --ink:       oklch(0.24 0.02 60);
  --ink-soft:  oklch(0.45 0.015 60);
  --ink-faint: oklch(0.62 0.012 60);
  --line:      oklch(0.85 0.015 60 / 0.5);
  --line-2:    oklch(0.78 0.02 60 / 0.4);
  --track:     oklch(0.9 0.015 60 / 0.6);
  --shadow:    0 1px 2px rgba(60,40,20,.04), 0 12px 32px rgba(60,40,20,.06);
  --shadow-lift: 0 1px 2px rgba(60,40,20,.06), 0 18px 50px rgba(60,40,20,.12);
}

body {
  font-family: 'Pretendard', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

/* ── Theme tokens ─────────────────────────────────────────────────────── */
.app {
  min-height: 100%;
  position: relative;
  color: var(--ink);
}

.theme-light {
  --bg:        oklch(0.985 0.008 70);
  --bg-card:   oklch(1 0 0 / 0.65);
  --bg-card-2: oklch(1 0 0 / 0.85);
  --ink:       oklch(0.24 0.02 60);
  --ink-soft:  oklch(0.45 0.015 60);
  --ink-faint: oklch(0.62 0.012 60);
  --line:      oklch(0.85 0.015 60 / 0.5);
  --line-2:    oklch(0.78 0.02 60 / 0.4);
  --track:     oklch(0.9 0.015 60 / 0.6);
  --shadow:    0 1px 2px rgba(60,40,20,.04), 0 12px 32px rgba(60,40,20,.06);
  --shadow-lift: 0 1px 2px rgba(60,40,20,.06), 0 18px 50px rgba(60,40,20,.12);
}

/* Also apply to html so body inherits these — body sits behind the .app
   wrapper but its color/bg need to track the active theme too. */
html:has(.theme-dark), .theme-dark {
  --bg:        oklch(0.22 0.025 280);
  --bg-card:   oklch(0.28 0.03 280 / 0.55);
  --bg-card-2: oklch(0.32 0.035 280 / 0.85);
  --ink:       oklch(0.95 0.015 80);
  --ink-soft:  oklch(0.78 0.015 80);
  --ink-faint: oklch(0.62 0.015 80);
  --line:      oklch(0.45 0.03 280 / 0.4);
  --line-2:    oklch(0.5 0.04 280 / 0.5);
  --track:     oklch(0.4 0.03 280 / 0.4);
  --shadow:    0 1px 2px rgba(0,0,0,.3), 0 12px 32px rgba(0,0,0,.35);
  --shadow-lift: 0 1px 2px rgba(0,0,0,.4), 0 18px 50px rgba(0,0,0,.5);

  --peach-soft:    oklch(0.42 0.06 50);
  --rose-soft:     oklch(0.40 0.06 25);
  --lavender-soft: oklch(0.40 0.06 290);
  --sage-soft:     oklch(0.40 0.05 150);
}

html:has(.theme-sepia), .theme-sepia {
  --bg:        oklch(0.93 0.025 70);
  --bg-card:   oklch(0.96 0.02 70 / 0.7);
  --bg-card-2: oklch(0.98 0.018 70 / 0.9);
  --ink:       oklch(0.30 0.04 50);
  --ink-soft:  oklch(0.45 0.035 50);
  --ink-faint: oklch(0.6 0.025 50);
  --line:      oklch(0.78 0.025 50 / 0.5);
  --line-2:    oklch(0.7 0.03 50 / 0.5);
  --track:     oklch(0.85 0.02 50 / 0.7);
  --shadow:    0 1px 2px rgba(80,50,20,.06), 0 12px 32px rgba(80,50,20,.1);
  --shadow-lift: 0 1px 2px rgba(80,50,20,.08), 0 18px 50px rgba(80,50,20,.18);
}

/* Font pairings */
.font-pretendard { font-family: 'Pretendard', 'Inter', sans-serif; }
.font-serif      { font-family: 'Fraunces', 'Pretendard', serif; }
.font-serif .hero-title, .font-serif .brand-title, .font-serif h1, .font-serif h2, .font-serif h3 { font-family: 'Fraunces', serif; font-weight: 600; }
.font-mono       { font-family: 'JetBrains Mono', 'Pretendard', monospace; }

/* ── Background layer ─────────────────────────────────────────────────── */
.bg-layer {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: -1;
}
.bg-aurora::before, .bg-aurora::after {
  content: ''; position: absolute; inset: -20%; pointer-events: none;
  background:
    radial-gradient(40% 35% at 15% 20%, var(--peach-soft) 0%, transparent 60%),
    radial-gradient(45% 40% at 85% 25%, var(--lavender-soft) 0%, transparent 60%),
    radial-gradient(50% 40% at 30% 90%, var(--rose-soft) 0%, transparent 55%),
    radial-gradient(40% 35% at 80% 85%, var(--sage-soft) 0%, transparent 60%);
  opacity: 0.85;
  filter: blur(40px);
}
.bg-aurora.is-active::before {
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift {
  0%   { transform: translate(0,0) scale(1); }
  100% { transform: translate(3%, -2%) scale(1.05); }
}

.bg-mesh {
  background:
    radial-gradient(60% 60% at 30% 30%, var(--peach-soft) 0%, transparent 70%),
    radial-gradient(60% 60% at 75% 70%, var(--lavender-soft) 0%, transparent 70%),
    var(--bg);
}
.bg-plain { background: var(--bg); }

.bg-stars { background: var(--bg); overflow: hidden; }
.bg-stars .star {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, var(--ink) 0%, transparent 70%);
  opacity: 0.6;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle { 0%,100% { opacity: 0.3; } 50% { opacity: 0.8; } }
.bg-moon {
  position: absolute; top: 8%; right: 10%;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, var(--peach-soft), var(--lavender-soft));
  opacity: 0.5;
  filter: blur(2px);
  box-shadow: 0 0 80px var(--peach-soft);
}

/* ── App frame ────────────────────────────────────────────────────────── */
.app-frame {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 28px 80px;
}
@media (max-width: 720px) {
  .app-frame { padding: 16px 14px 60px; }
}

/* ── Master bar ───────────────────────────────────────────────────────── */
.master-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 0.5px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  gap: 14px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--bg-card-2);
  border: 0.5px solid var(--line);
}
.brand-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.brand-sub   { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }

.master-controls {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; justify-content: flex-end;
  min-width: 0;
}
.master-vol { flex-shrink: 1; min-width: 0; }
.master-slider { min-width: 0; }
@media (max-width: 480px) {
  .master-slider { width: 80px; }
}
.master-vol {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg-card-2);
  border: 0.5px solid var(--line);
  border-radius: 999px;
}
.master-vol-icon { display: flex; color: var(--ink-soft); }
.master-slider {
  width: 110px; height: 4px;
  -webkit-appearance: none; appearance: none;
  background: var(--track);
  border-radius: 999px; outline: none;
}
.master-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--bg-card-2);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.master-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--bg-card-2);
}
.master-vol-num {
  font-size: 11px; color: var(--ink-soft);
  font-variant-numeric: tabular-nums; min-width: 18px;
}

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 0.5px solid var(--line);
  background: var(--bg-card-2);
  color: var(--ink); cursor: pointer;
  display: grid; place-items: center;
  transition: transform .15s, background .15s;
  font-size: 16px;
}
.icon-btn:hover { transform: scale(1.05); background: var(--bg-card-2); }

.stop-all-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px; height: 36px;
  border-radius: 999px; border: 0;
  background: var(--ink); color: var(--bg);
  font: inherit; font-weight: 600; font-size: 13px;
  cursor: pointer;
  transition: transform .15s, opacity .15s;
}
.stop-all-btn:disabled {
  opacity: 0.35; cursor: not-allowed;
}
.stop-all-btn.is-active {
  background: linear-gradient(135deg, var(--accent-peach), var(--accent-rose));
  color: white;
}
.stop-all-btn:hover:not(:disabled) { transform: scale(1.03); }
.stop-icon { font-size: 11px; }
.stop-count {
  background: rgba(255,255,255,.25);
  padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 28px;
  margin-top: 24px;
  align-items: stretch;
}
@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; }
  .hero-right { order: -1; }
}
.hero-left {
  display: flex; flex-direction: column; gap: 18px;
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 0.5px solid var(--line);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.hero-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.hero-badge {
  font-size: 11px; padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-card-2);
  color: var(--ink-soft);
  border: 0.5px solid var(--line);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.hero-title {
  font-size: 26px; font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
  max-width: 14em;
}
@media (max-width: 720px) { .hero-title { font-size: 21px; } }

.hero-right {
  display: grid; place-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 0.5px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
}

/* ── Circular Timer ────────────────────────────────────────────────────── */
.timer-dial-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--ink);
}
.timer-dial {
  cursor: grab;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.05));
}
.timer-dial.dragging { cursor: grabbing; }
.timer-dial.running { cursor: default; }
.timer-cancel {
  font: inherit; font-size: 12px; font-weight: 500;
  padding: 6px 14px; border-radius: 999px;
  background: var(--bg-card-2); color: var(--ink-soft);
  border: 0.5px solid var(--line);
  cursor: pointer;
}
.timer-cancel:hover { color: var(--ink); }

/* ── Now Playing ──────────────────────────────────────────────────────── */
.now-playing { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.now-playing.empty {
  flex-direction: row; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card-2);
  border: 1px dashed var(--line-2);
  border-radius: 18px;
}
.np-empty-icon { color: var(--ink-faint); flex-shrink: 0; }
.np-empty-title { font-size: 14px; font-weight: 600; }
.np-empty-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.np-header { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.np-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-soft);
}
.np-pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-peach);
  box-shadow: 0 0 0 0 var(--accent-peach);
  animation: np-pulse 1.6s ease-in-out infinite;
}
@keyframes np-pulse {
  0%   { box-shadow: 0 0 0 0 oklch(0.78 0.10 50 / .6); }
  70%  { box-shadow: 0 0 0 8px oklch(0.78 0.10 50 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.78 0.10 50 / 0); }
}
.np-count { font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.np-list { display: flex; flex-direction: column; gap: 6px; }
.np-row {
  display: grid;
  grid-template-columns: auto 1fr 120px auto auto;
  align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card-2);
  border: 0.5px solid var(--line);
  border-radius: 14px;
}
.np-emoji { font-size: 20px; }
.np-name { font-size: 14px; font-weight: 500; }
.np-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 3px;
  background: var(--track); border-radius: 999px;
  outline: none;
}
.np-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent-peach);
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.np-vol { font-size: 11px; color: var(--ink-faint); width: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.np-remove {
  width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink-soft);
  cursor: pointer; font-size: 16px; line-height: 1;
}
.np-remove:hover { background: var(--bg-card-2); color: var(--ink); }

@media (max-width: 540px) {
  .np-row { grid-template-columns: auto 1fr auto auto; }
  .np-slider { display: none; }
}

/* ── Section titles ────────────────────────────────────────────────────── */
.section-title {
  font-size: 18px; font-weight: 700;
  letter-spacing: -0.01em;
}
.section-hint {
  font-size: 12px; color: var(--ink-soft);
  margin-top: 2px;
}

/* ── Presets ──────────────────────────────────────────────────────────── */
.presets {
  margin-top: 28px;
  display: flex; flex-direction: column; gap: 14px;
}
.presets-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 14px; padding: 0 4px;
}
.save-mix-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; height: 34px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 0.5px solid var(--line);
  font: inherit; font-weight: 500; font-size: 12.5px;
  color: var(--ink); cursor: pointer;
  transition: all .15s;
}
button { color: inherit; }
.save-mix-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.save-mix-btn:not(:disabled):hover {
  background: var(--ink); color: var(--bg); border-color: transparent;
}
.save-mix-btn span:first-child { font-size: 14px; line-height: 1; }

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  padding: 4px;
}
.presets-subheader {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-soft);
  padding: 14px 4px 0;
}
.presets-subheader-count {
  font-size: 10px; padding: 1px 7px; border-radius: 999px;
  background: var(--bg-card-2); border: 0.5px solid var(--line);
  color: var(--ink-faint); letter-spacing: 0;
}
.preset-chip {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px 10px 10px;
  border-radius: 18px;
  background: var(--bg-card);
  border: 0.5px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: all .15s;
  position: relative;
  min-width: 0;
}
.preset-chip.custom {
  background: linear-gradient(135deg, var(--bg-card), var(--rose-soft));
}
.preset-chip:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent-peach);
}
.preset-chip-icon {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 20px;
  background: linear-gradient(135deg, var(--peach-soft), var(--lavender-soft));
  flex-shrink: 0;
}
.preset-chip-body { min-width: 0; flex: 1; }
.preset-chip-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preset-chip-mix {
  display: flex; gap: 2px; margin-top: 3px;
  font-size: 11px;
}
.preset-chip-more {
  font-size: 10px; color: var(--ink-faint); padding-left: 2px;
  align-self: center;
}
.preset-chip-del {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px; color: var(--ink-faint);
  opacity: 0; transition: opacity .15s;
  background: var(--bg-card-2);
}
.preset-chip:hover .preset-chip-del { opacity: 1; }
.preset-chip-del:hover { color: var(--ink); }

/* ── Sounds Section ───────────────────────────────────────────────────── */
.sounds-section { margin-top: 32px; }
.sounds-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 14px; padding: 0 4px 14px;
}
.filter-tabs {
  display: flex; gap: 4px;
  padding: 4px;
  background: var(--bg-card);
  border: 0.5px solid var(--line);
  border-radius: 999px;
}
.filter-tab {
  border: 0; background: transparent; color: var(--ink-soft);
  padding: 6px 14px; border-radius: 999px;
  font: inherit; font-weight: 500; font-size: 12.5px;
  cursor: pointer; transition: all .15s;
}
.filter-tab:hover { color: var(--ink); }
.filter-tab.active {
  background: var(--ink); color: var(--bg);
}

/* ── Sounds Grid ──────────────────────────────────────────────────────── */
.sounds-grid {
  display: grid;
  gap: 12px;
}
.sounds-grid.density-comfy   { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.sounds-grid.density-compact { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }

@media (max-width: 540px) {
  .sounds-grid.density-comfy   { grid-template-columns: repeat(3, 1fr); }
  .sounds-grid.density-compact { grid-template-columns: repeat(4, 1fr); }
}

/* ── Sound Card ───────────────────────────────────────────────────────── */
.sound-card {
  position: relative;
  border: 0;
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 0.5px solid var(--line);
  cursor: pointer;
  font: inherit; color: var(--ink);
  padding: 0;
  overflow: hidden;
  transition: transform .2s cubic-bezier(.3,.7,.4,1), box-shadow .2s, border-color .2s;
  aspect-ratio: 1 / 1;
}
.sound-card.shape-rounded { border-radius: 22px; }
.sound-card.shape-tile    { border-radius: 8px; }
.sound-card.shape-circle  { border-radius: 50%; }

.sound-card.density-compact { aspect-ratio: 1; }

.sound-card:hover:not(.active) {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lift);
  border-color: var(--line-2);
}

.sound-card-glow {
  position: absolute; inset: 0;
  opacity: 0; transition: opacity .3s;
  pointer-events: none;
  border-radius: inherit;
}
.sound-card.hue-peach    .sound-card-glow { background: radial-gradient(circle at 50% 60%, var(--peach-soft), transparent 70%); }
.sound-card.hue-rose     .sound-card-glow { background: radial-gradient(circle at 50% 60%, var(--rose-soft), transparent 70%); }
.sound-card.hue-lavender .sound-card-glow { background: radial-gradient(circle at 50% 60%, var(--lavender-soft), transparent 70%); }
.sound-card.hue-sage     .sound-card-glow { background: radial-gradient(circle at 50% 60%, var(--sage-soft), transparent 70%); }

.sound-card.active {
  border-color: transparent;
  box-shadow: 0 0 0 1.5px var(--accent-peach), var(--shadow-lift);
}
.sound-card.active.hue-peach    { box-shadow: 0 0 0 1.5px var(--accent-peach),    var(--shadow-lift); }
.sound-card.active.hue-rose     { box-shadow: 0 0 0 1.5px var(--accent-rose),     var(--shadow-lift); }
.sound-card.active.hue-lavender { box-shadow: 0 0 0 1.5px var(--accent-lavender), var(--shadow-lift); }
.sound-card.active.hue-sage     { box-shadow: 0 0 0 1.5px var(--accent-sage),     var(--shadow-lift); }
.sound-card.active .sound-card-glow { opacity: 1; }

/* Active animations */
.sound-card.active.anim-breathe { animation: breathe 4s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.025); }
}
.sound-card.active.anim-glow .sound-card-glow {
  animation: glow-pulse 2.5s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1; }
}
.sound-card.active.anim-static .sound-card-glow { opacity: 1; }

.sound-card-body {
  position: relative; z-index: 1;
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 14px 10px;
}
.sound-emoji {
  font-size: 32px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.08));
}
.sound-card.density-compact .sound-emoji { font-size: 26px; }
.sound-label {
  font-size: 12.5px; font-weight: 600;
  text-align: center;
  color: var(--ink);
}
.sound-card.density-compact .sound-label { font-size: 11.5px; }

.sound-waveform {
  display: flex; gap: 2px; align-items: end; height: 14px; margin-top: 2px;
}
.sound-waveform span {
  display: block; width: 2px; height: 100%;
  background: var(--accent-peach);
  border-radius: 999px;
  animation: wave-bar 0.8s ease-in-out infinite alternate;
}
.sound-card.hue-rose     .sound-waveform span { background: var(--accent-rose); }
.sound-card.hue-lavender .sound-waveform span { background: var(--accent-lavender); }
.sound-card.hue-sage     .sound-waveform span { background: var(--accent-sage); }
@keyframes wave-bar {
  0%   { transform: scaleY(0.25); }
  100% { transform: scaleY(1); }
}

.sound-volume-bar {
  position: absolute; left: 14px; right: 14px; bottom: 10px;
  height: 3px; border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}
.sound-volume-fill {
  height: 100%; border-radius: 999px;
  background: var(--accent-peach);
  transition: width .15s;
}
.sound-card.hue-rose     .sound-volume-fill { background: var(--accent-rose); }
.sound-card.hue-lavender .sound-volume-fill { background: var(--accent-lavender); }
.sound-card.hue-sage     .sound-volume-fill { background: var(--accent-sage); }

/* Volume popover */
.sound-vol-popover {
  position: absolute; inset: 8px;
  background: var(--bg-card-2);
  backdrop-filter: blur(20px);
  border-radius: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  padding: 14px;
  z-index: 2;
  border: 0.5px solid var(--line);
}
.sound-vol-label { font-size: 11px; color: var(--ink-soft); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.sound-vol-popover input[type=range] {
  width: 100%; -webkit-appearance: none; appearance: none;
  height: 4px; background: var(--track); border-radius: 999px; outline: none;
}
.sound-vol-popover input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent-peach);
}
.sound-vol-close {
  border: 0; background: var(--ink); color: var(--bg);
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; font-size: 14px;
}

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  z-index: 1000;
  animation: fade-in .15s;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg);
  color: var(--ink);
  border-radius: 22px;
  padding: 24px;
  width: min(420px, 92vw);
  border: 0.5px solid var(--line);
  box-shadow: var(--shadow-lift);
  display: flex; flex-direction: column; gap: 14px;
}
.modal h3 { font-size: 18px; font-weight: 700; }
.modal-mix {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.modal-mix-chip {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--bg-card-2); border: 0.5px solid var(--line);
}
.modal-input {
  width: 100%; height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--bg-card-2);
  font: inherit; color: inherit;
  outline: none;
}
.modal-input:focus { border-color: var(--accent-peach); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-primary, .btn-secondary {
  height: 38px; padding: 0 18px; border-radius: 12px;
  font: inherit; font-weight: 600; font-size: 13px;
  cursor: pointer; border: 0;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-secondary { background: var(--bg-card-2); color: var(--ink); border: 0.5px solid var(--line); }

/* ── Custom sounds bar (📁 / 🎤) ────────────────────────────────────────── */
.custom-sounds-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 4px 4px 14px;
}
.custom-add-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; height: 36px;
  border-radius: 14px;
  background: var(--bg-card);
  border: 1px dashed var(--line-2);
  color: var(--ink); cursor: pointer;
  font: inherit; font-weight: 500; font-size: 13px;
  transition: all .15s;
}
.custom-add-btn:hover {
  background: var(--bg-card-2);
  border-style: solid;
  border-color: var(--accent-rose);
}

/* ── Custom Sound Card ─────────────────────────────────────────────────── */
.custom-sound-card { position: relative; padding: 0; aspect-ratio: 1 / 1; }
.custom-sound-card .sound-card-clickarea {
  display: block; width: 100%; height: 100%;
  border: 0; background: transparent; padding: 0; color: inherit;
  cursor: pointer; border-radius: inherit; position: relative;
}
.custom-sound-card .sound-card-clickarea > .sound-card-glow,
.custom-sound-card .sound-card-clickarea > .sound-card-body {
  border-radius: inherit;
}
.custom-gear-btn {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px; border-radius: 50%;
  border: 0.5px solid var(--line);
  background: var(--bg-card-2);
  color: var(--ink-soft);
  font-size: 13px; line-height: 1;
  cursor: pointer; padding: 0;
  display: grid; place-items: center;
  z-index: 3;
}
.custom-gear-btn:hover { color: var(--ink); background: var(--bg-card); }

.custom-settings-popover {
  inset: 6px;
  padding: 12px 14px;
  gap: 10px;
  align-items: stretch;
  justify-content: flex-start;
  overflow-y: auto;
}
.custom-field {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; color: var(--ink-soft);
  text-align: left;
}
.custom-field > span { font-weight: 600; letter-spacing: 0.02em; }
.custom-field input[type="text"],
.custom-field input[type="number"],
.custom-field select {
  width: 100%; height: 28px;
  padding: 0 8px;
  border: 0.5px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit; font-size: 12px;
  outline: none;
}
.custom-field input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--track); border-radius: 999px; outline: none;
  margin: 4px 0;
}
.custom-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent-rose);
}
.custom-settings-actions {
  display: flex; justify-content: space-between; gap: 6px; margin-top: 4px;
}
.custom-settings-actions .btn-primary,
.custom-settings-actions .btn-secondary {
  height: 30px; padding: 0 12px; font-size: 12px; border-radius: 9px;
}
.custom-none-hint {
  grid-column: 1 / -1;
  text-align: center; font-size: 13px; color: var(--ink-soft);
  padding: 24px 12px;
  border: 1px dashed var(--line-2);
  border-radius: 14px;
  background: var(--bg-card-2);
}

/* ── Recording Modal ──────────────────────────────────────────────────── */
.rec-modal { gap: 12px; }
.rec-hint { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.rec-display {
  text-align: center; font-size: 32px; font-weight: 300;
  font-variant-numeric: tabular-nums; letter-spacing: 0.1em;
  margin: 4px 0; color: var(--ink);
}
.rec-dot {
  display: inline-block; width: 12px; height: 12px;
  border-radius: 50%; background: #ff5050;
  margin-right: 8px; vertical-align: middle;
  animation: rec-pulse 1s infinite;
}
@keyframes rec-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ── Update banner (PWA) ──────────────────────────────────────────────── */
.update-banner {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px;
  padding: 10px 14px;
  background: linear-gradient(135deg, var(--peach-soft), var(--lavender-soft));
  border: 0.5px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  font-size: 13px;
}
.update-banner-text { flex: 1; }
.update-banner-btn {
  border: 0; background: var(--ink); color: var(--bg);
  font: inherit; font-weight: 600; font-size: 12px;
  height: 30px; padding: 0 14px; border-radius: 999px;
  cursor: pointer;
}

/* ── Status / fade-out banner ─────────────────────────────────────────── */
.status-msg, .fade-out-banner {
  font-size: 12px; color: var(--ink-soft);
  padding: 8px 12px;
  background: var(--bg-card-2);
  border: 0.5px solid var(--line);
  border-radius: 12px;
  margin-top: 8px;
}
.fade-out-banner {
  background: linear-gradient(135deg, var(--peach-soft), var(--rose-soft));
  color: var(--ink);
  font-weight: 500;
}
