/* === Noise Mixer additions === */

/* Overall volume — one control to bring the whole mix up or down at once */
.master {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 0.9rem 1.25rem 1.1rem;
  box-shadow: var(--shadow);
  margin: 0 0 0.85rem;
}

.master label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.master-val {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 600;
  color: var(--primary-dark);
}

.channels {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0 0 1rem;
}

.channel {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 1rem 1.25rem 1.25rem;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease;
}

.channel.active {
  border-color: var(--pick-border);
}

.channel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.channel h2 {
  margin: 0;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--ink);
}

.channel-desc {
  margin: 0.1rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.channel-value {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--muted);
  min-width: 2.8rem;
  text-align: right;
  transition: color 0.2s ease;
}

.channel.active .channel-value {
  color: var(--primary-dark);
}

/* The input itself is a tall (48px) transparent strip — a comfortable touch
   target — while the visible track is drawn on the track pseudo-elements. */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 48px;
  background: transparent;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  margin: 0;
}

.slider::-webkit-slider-runnable-track {
  height: 8px;
  background: var(--pick-bg);
  border-radius: 999px;
}

.slider::-moz-range-track {
  height: 8px;
  background: var(--pick-bg);
  border-radius: 999px;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -10px; /* center the thumb on the 8px track */
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 107, 157, 0.4);
  transition: transform 0.15s ease;
}

.slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider::-webkit-slider-thumb:active { transform: scale(1.08); }

.slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255, 107, 157, 0.4);
  transition: transform 0.15s ease;
}

.slider::-moz-range-thumb:hover { transform: scale(1.15); }

.slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px var(--pick-bg), 0 2px 8px rgba(255, 107, 157, 0.4);
}

.slider:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px var(--pick-bg), 0 2px 8px rgba(255, 107, 157, 0.4);
}

.timer-status {
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
}

.timer-status strong {
  color: var(--primary-dark);
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 600;
  font-size: 1.05em;
}

/* === Channel sub-controls (rain, waves) === */

/* Hidden with the `hidden` attribute rather than collapsed to max-height: 0.
   A zero-height, zero-opacity panel is still in the tab order, so a keyboard user
   used to land on four rain sliders that were not on screen and did nothing. */
.sub-options {
  margin-top: 1rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.9rem;
  animation: sub-in 0.28s ease;
}

.sub-options[hidden] { display: none; }

@keyframes sub-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: none; }
}

.sub-control { margin-bottom: 0.85rem; }

.sub-control label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.sub-val {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 600;
  color: var(--primary-dark);
}

.slider-sm { height: 44px; }

.slider-sm::-webkit-slider-runnable-track { height: 6px; }
.slider-sm::-moz-range-track { height: 6px; }

.slider-sm::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -8px; /* center the thumb on the 6px track */
  border-width: 2px;
}

.slider-sm::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-width: 2px;
}

.sub-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 0.2rem;
}

.rain-switch {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: var(--pick-bg);
  cursor: pointer;
  transition: background 0.2s ease;
}

/* Invisible halo so the tap target clears 44px without growing the visual */
.rain-switch::after {
  content: "";
  position: absolute;
  inset: -9px -6px;
}

.rain-switch[aria-checked="true"] { background: var(--primary); }

.rain-switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: left 0.2s ease;
}

.rain-switch[aria-checked="true"] i { left: 25px; }

.rain-switch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--pick-bg);
}

/* === Preset chips — one-tap starting mixes over the channel sliders === */

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0 0 0.85rem;
}

.preset-chip {
  min-height: 44px;
  padding: 0.5rem 1.15rem;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  background: var(--card);
  box-shadow: var(--shadow);
}

/* pills sit inside var(--card) panels — same lighter surface as base pills in dark */
html.dark .preset-chip { background: var(--btn); }

/* === Sleep-timer extras === */

/* timer pills get a comfier tap height (this sheet only loads on the mixer page) */
#timer-options .pill { min-height: 44px; }

.chime-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  margin-top: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.chime-row input {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.timer-note {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* tiny hint under Play after a hardware-back press pauses the mix */
.back-hint {
  margin: 0.6rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* === Your mixes === */

.saved {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 1rem 1.25rem 1.15rem;
  box-shadow: var(--shadow);
  margin: 0 0 1rem;
}

.saved h2 {
  margin: 0 0 0.75rem;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--ink);
}

.saved-add { display: flex; gap: 0.5rem; margin-bottom: 0.7rem; }

.saved-add input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0.5rem 0.95rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--btn);
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
}

.mini {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.5rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 700;
  background: var(--btn);
  color: var(--muted);
}

.mini:hover { border-color: var(--primary); color: var(--primary-dark); }

.saved-list { display: flex; flex-direction: column; gap: 0.45rem; }

.saved-row { display: flex; gap: 0.4rem; }

.saved-go {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  text-align: left;
  min-height: 44px;
  padding: 0.5rem 0.95rem;
  border-radius: 14px;
  background: var(--btn);
}

.saved-go b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-go small { margin-left: auto; flex: 0 0 auto; color: var(--muted); font-weight: 700; font-size: 0.75rem; }
.saved-go:hover { border-color: var(--primary); }

.saved-x {
  flex: 0 0 auto;
  width: 44px;
  padding: 0;
  border-radius: 14px;
  background: var(--btn);
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
}

.saved-x:hover { border-color: var(--primary); color: var(--primary-dark); }

.saved-empty { margin: 0; font-size: 0.85rem; color: var(--muted); }
.saved-empty[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .sub-options { animation: none; }
  .slider::-webkit-slider-thumb { transition: none; }
  .slider::-moz-range-thumb { transition: none; }
}
