/* ============ Whitenoise · Style ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-1: #022c22;
  --bg-2: #064e3b;
  --bg-3: #065f46;
  --emerald:    #34d399;
  --emerald-2:  #6ee7b7;
  --emerald-3:  #a7f3d0;
  --forest:     #047857;
  --butter:     #fde68a;
  --green:      #22c55e;
  --red:        #ef4444;
  --text:       #ecfdf5;
  --muted:      rgba(236,253,245,.55);
  --faint:      rgba(236,253,245,.32);
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bot: env(safe-area-inset-bottom, 0);
}

html, body {
  background: var(--bg-1);
  color: var(--text);
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding-top: calc(58px + var(--safe-top));
  padding-bottom: calc(28px + var(--safe-bot));
}

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -3;
  overflow: hidden;
  background: var(--bg-1);
}
.orb-blur {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .35;
  pointer-events: none;
  will-change: transform;
}
.orb-blur.o1 {
  width: 60vmax; height: 60vmax;
  background: radial-gradient(circle, var(--emerald) 0%, transparent 60%);
  top: -20vh; left: -10vw;
  animation: drift1 28s ease-in-out infinite;
}
.orb-blur.o2 {
  width: 55vmax; height: 55vmax;
  background: radial-gradient(circle, var(--forest) 0%, transparent 60%);
  bottom: -20vh; right: -10vw;
  animation: drift2 32s ease-in-out infinite;
  opacity: .5;
}
@keyframes drift1 { 0%,100%{transform:translate(0,0)scale(1);} 50%{transform:translate(7vw,5vh)scale(1.06);} }
@keyframes drift2 { 0%,100%{transform:translate(0,0)scale(1);} 50%{transform:translate(-6vw,-7vh)scale(.95);} }

/* Top bar */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(58px + var(--safe-top));
  padding-top: var(--safe-top);
  padding-inline: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(2,44,34,.78);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid rgba(110,231,183,.16);
  z-index: 100;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-2));
  display: grid; place-items: center;
  color: var(--bg-1);
  box-shadow: 0 6px 18px rgba(52,211,153,.5);
}
.brand .mark svg { width: 18px; height: 18px; }
.brand span:not(.mark) {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.header-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(110,231,183,.20);
  background: rgba(110,231,183,.06);
  color: var(--text);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 16px;
  transition: background .2s, transform .15s;
}
.icon-btn:hover { background: rgba(110,231,183,.14); }
.icon-btn:active { transform: scale(.92); }
.install-btn {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-2));
  color: var(--bg-1);
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(52,211,153,.5);
}
.hidden { display: none !important; }

main { padding: 16px 18px; max-width: 540px; margin: 0 auto; }

/* Master card */
.master-card {
  background: rgba(110,231,183,.05);
  border: 1px solid rgba(110,231,183,.18);
  border-radius: 22px;
  padding: 18px 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.master-card::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(52,211,153,.18), transparent 60%);
  pointer-events: none;
}

.play-section {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  position: relative;
}
.play-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-2));
  color: var(--bg-1);
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 14px 30px -8px rgba(52,211,153,.55);
  transition: transform .15s, box-shadow .25s;
  flex-shrink: 0;
}
.play-btn:active { transform: scale(.95); }
.play-btn.playing {
  animation: play-pulse 2s ease-in-out infinite;
}
@keyframes play-pulse {
  0%, 100% { box-shadow: 0 14px 30px -8px rgba(52,211,153,.55), 0 0 0 0 rgba(52,211,153,.4); }
  50%      { box-shadow: 0 14px 30px -8px rgba(52,211,153,.55), 0 0 0 18px rgba(52,211,153,0); }
}
.play-icon {
  font-size: 26px;
  font-weight: 700;
  padding-inline-start: 4px;
}
.play-btn.playing .play-icon { padding-inline-start: 0; font-size: 22px; }

.play-meta { flex: 1; min-width: 0; }
.play-status {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--emerald-2);
}
.play-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  margin-top: 2px;
}

.master-vol-row {
  display: grid;
  grid-template-columns: auto 1fr 32px;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  position: relative;
}
.vol-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}
.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(110,231,183,.14);
  border-radius: 2px;
  outline: none;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--emerald);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(52,211,153,.5);
}
.vol-slider::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--emerald);
  border-radius: 50%;
  cursor: pointer;
  border: 0;
}
.vol-slider.master {
  height: 6px;
  background: linear-gradient(90deg, rgba(52,211,153,.30), rgba(110,231,183,.55));
}
.vol-slider.master::-webkit-slider-thumb {
  width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-2));
  box-shadow: 0 4px 12px rgba(52,211,153,.6);
}
.vol-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: center;
  font-weight: 600;
}

.timer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  position: relative;
}
.timer-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-transform: uppercase;
}
.timer-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.timer-chip {
  padding: 5px 11px;
  background: rgba(110,231,183,.05);
  border: 1px solid rgba(110,231,183,.14);
  color: var(--muted);
  border-radius: 999px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.timer-chip:hover { color: var(--text); }
.timer-chip.active {
  background: rgba(52,211,153,.18);
  border-color: rgba(52,211,153,.5);
  color: var(--emerald-2);
}

/* Section heading */
.section-h {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 12px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Channels */
.channels {
  display: grid;
  gap: 8px;
}
.channel-card {
  background: rgba(110,231,183,.04);
  border: 1px solid rgba(110,231,183,.12);
  border-radius: 14px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 12px;
  align-items: center;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.channel-card.active {
  background: rgba(52,211,153,.10);
  border-color: rgba(52,211,153,.35);
}
.channel-card .ch-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(110,231,183,.10);
  display: grid; place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.channel-card.active .ch-icon {
  background: rgba(52,211,153,.20);
  box-shadow: 0 0 16px rgba(52,211,153,.35);
}
.channel-card .ch-info { min-width: 0; }
.channel-card .ch-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.channel-card .ch-slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.channel-card .ch-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: rgba(110,231,183,.10);
  border-radius: 2px;
  outline: none;
}
.channel-card .ch-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: var(--emerald-2);
  border-radius: 50%;
  cursor: pointer;
}
.channel-card .ch-slider::-moz-range-thumb {
  width: 16px; height: 16px;
  background: var(--emerald-2);
  border-radius: 50%;
  cursor: pointer;
  border: 0;
}
.channel-card .ch-vol {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  min-width: 26px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.channel-card.active .ch-vol { color: var(--emerald-2); font-weight: 600; }
.channel-card .ch-toggle {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(110,231,183,.20);
  background: rgba(110,231,183,.05);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: all .2s;
  display: grid; place-items: center;
}
.channel-card .ch-toggle:hover { background: rgba(110,231,183,.12); }
.channel-card.active .ch-toggle {
  background: var(--emerald);
  border-color: var(--emerald);
  color: var(--bg-1);
}

/* Live audio bars indicator (animated when active) */
.channel-card .ch-bars {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  width: 100%;
  background: linear-gradient(90deg, var(--emerald), var(--emerald-2), var(--emerald));
  background-size: 200% 100%;
  opacity: 0;
  animation: bar-flow 4s linear infinite;
}
.channel-card.active .ch-bars { opacity: 1; }
@keyframes bar-flow { from { background-position: 0 0; } to { background-position: 200% 0; } }

/* Quick presets */
.quick-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.quick-preset {
  background: rgba(110,231,183,.05);
  border: 1px solid rgba(110,231,183,.14);
  color: var(--text);
  padding: 18px 8px;
  border-radius: 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all .2s;
}
.quick-preset:hover { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.35); }
.quick-preset:active { transform: scale(.96); }
.quick-preset .qp-icon { font-size: 28px; }

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(2,44,34,.78);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: grid;
  place-items: end center;
  animation: modal-in .25s ease;
}
@keyframes modal-in { from{opacity:0;} to{opacity:1;} }
.modal-card {
  background: rgba(6,78,59,.96);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(110,231,183,.20);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  padding: 24px 22px calc(28px + var(--safe-bot));
  width: 100%;
  max-width: 540px;
  animation: sheet-up .35s cubic-bezier(.2,.9,.3,1.05);
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes sheet-up { from{transform:translateY(100%);} to{transform:translateY(0);} }
.modal-card .handle { width: 38px; height: 4px; background: rgba(110,231,183,.30); border-radius: 2px; margin: -8px auto 16px; }
.modal-card h3 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.modal-card p { color: var(--muted); font-size: 13px; margin-bottom: 18px; line-height: 1.7; }
.modal-card p strong { color: var(--emerald-2); }
.mark-big {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-2));
  margin: 0 auto 14px;
  display: grid; place-items: center;
  color: var(--bg-1);
  box-shadow: 0 10px 30px rgba(52,211,153,.55);
}
.mark-big svg { width: 28px; height: 28px; }

.modal-input {
  width: 100%;
  background: var(--bg-1);
  border: 1px solid rgba(110,231,183,.18);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  margin-bottom: 14px;
}
.modal-input:focus { outline: 2px solid var(--emerald); outline-offset: 2px; }

.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-mini {
  padding: 12px;
  background: rgba(110,231,183,.06);
  border: 1px solid rgba(110,231,183,.18);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s;
}
.btn-mini:hover { background: rgba(110,231,183,.12); }
.btn-primary {
  padding: 14px;
  background: linear-gradient(135deg, var(--emerald), var(--emerald-2));
  color: var(--bg-1);
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 12px 26px -8px rgba(52,211,153,.5);
  transition: transform .15s;
}
.btn-primary:active { transform: scale(.97); }
.btn-secondary {
  padding: 12px;
  background: rgba(110,231,183,.06);
  border: 1px solid rgba(110,231,183,.18);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  border-radius: 12px;
  cursor: pointer;
}
.btn-secondary:hover { background: rgba(110,231,183,.12); }

/* Presets list */
.presets-list { max-height: 50vh; overflow-y: auto; }
.preset-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: rgba(110,231,183,.05);
  border: 1px solid rgba(110,231,183,.12);
  border-radius: 12px;
  margin-bottom: 8px;
}
.preset-item .p-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: rgba(52,211,153,.18);
  display: grid; place-items: center;
  font-size: 20px;
}
.preset-item .info .name { font-weight: 600; font-size: 14px; }
.preset-item .info .meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.preset-actions { display: flex; flex-direction: column; gap: 4px; }
.preset-actions button {
  background: transparent;
  border: 1px solid rgba(110,231,183,.18);
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.preset-actions button.load { color: var(--emerald-2); border-color: rgba(52,211,153,.4); }
.preset-actions button.del:hover { color: var(--red); border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.08); }

.empty-state {
  text-align: center;
  padding: 30px 20px;
  color: var(--muted);
}
.empty-state .ico { font-size: 40px; margin-bottom: 12px; opacity: .55; }

/* Toast */
.toast {
  position: fixed;
  top: calc(70px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(6,78,59,.96);
  border: 1px solid rgba(110,231,183,.30);
  color: var(--text);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  z-index: 300;
  box-shadow: 0 18px 40px rgba(0,0,0,.5);
  backdrop-filter: blur(10px);
  animation: toast-in .25s ease;
}
@keyframes toast-in { from{opacity:0; transform:translate(-50%, -16px);} to{opacity:1; transform:translate(-50%, 0);} }
.toast.success { color: var(--green); border-color: rgba(34,197,94,.5); }
.toast.error { color: var(--red); border-color: rgba(239,68,68,.5); }
