/* v499 Sound Bath. Light type, bright gold, 44px targets.
   The night sky is drawn on a canvas. Motion stops under reduced motion.
   The panel stays above the fixed tab bar, including the safe-area inset.
   Focusing Play uses scroll padding so it clears that bar.
   Five length pills sit on one line and wrap in the center when the row is tight. */

html {
  scroll-padding-bottom: calc(6.85rem + env(safe-area-inset-bottom, 0px));
}

.tool-tab[data-tool-tab="sound-bath"] {
  width: 5.15rem;
  min-width: 5.15rem;
}

.tool-tab[data-tool-tab="sound-bath"] .tool-label {
  max-width: 4.7rem;
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.1;
  white-space: normal;
}

.sound-bath {
  box-sizing: border-box;
  text-align: center;
  font-family: Outfit, system-ui, sans-serif;
  font-weight: 300;
  /* The fixed tab bar is about 6.85rem plus the home-indicator inset.
     The panel fills the space under the sticky header and scrolls inside it,
     so Play, the length pills, and Close can sit fully above that bar. */
  max-height: calc(100svh - var(--sit-header) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 6.85rem);
  overflow-x: hidden;
  overflow-y: auto;
  scroll-margin-top: calc(var(--sit-header) + env(safe-area-inset-top, 0px) + 6px);
  scroll-padding-bottom: calc(6.85rem + env(safe-area-inset-bottom, 0px));
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.9rem);
  -webkit-overflow-scrolling: touch;
}

.sound-bath .sb-title {
  color: #f6d77a;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.sb-copy {
  margin: 0.15rem auto 0;
  max-width: 26rem;
  color: rgba(244, 239, 230, 0.86);
  font-family: Outfit, system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.45;
}

.sb-sky {
  position: relative;
  height: 232px;
  margin: 0.85rem 0 0.15rem;
  border-radius: 18px;
  overflow: hidden;
  background: #07060f;
  border: 1px solid rgba(246, 215, 122, 0.22);
}

.sb-sky canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.sb-audio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.sb-lengths {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.75rem auto 0.7rem;
  max-width: 22rem;
}

.sb-pill,
.sb-close,
.sound-bath .sb-play {
  font-family: Outfit, system-ui, sans-serif;
  font-weight: 300;
  cursor: pointer;
  touch-action: manipulation;
}

.sb-pill {
  box-sizing: border-box;
  flex: 1 1 2.75rem;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.3rem;
  border-radius: 999px;
  border: 1px solid rgba(246, 215, 122, 0.72);
  background: transparent;
  color: #f6d77a;
  font-size: 0.92rem;
  letter-spacing: 0;
  white-space: nowrap;
}

.sb-pill[aria-pressed="true"],
.sb-pill.is-on {
  background: linear-gradient(180deg, #f8e3a6 0%, #e8c15a 55%, #c9962e 100%);
  color: #1a1204;
  border-color: #f6d77a;
}

.sound-bath .sb-play {
  width: 100%;
  min-height: 52px;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.16em;
}

.sb-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 0.65rem;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid rgba(246, 215, 122, 0.65);
  background: transparent;
  color: #f6d77a;
  font-size: 1rem;
  letter-spacing: 0.08em;
}

.sb-pill:focus-visible,
.sb-close:focus-visible,
.sound-bath .sb-play:focus-visible {
  outline: 2px solid #f6d77a;
  outline-offset: 3px;
}

@media (max-height: 780px) {
  .sb-sky {
    height: 156px;
    margin-top: 0.45rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sb-pill,
  .sb-close,
  .sound-bath .sb-play,
  .sb-sky {
    transition: none;
    animation: none;
  }
}
