/* ============================================================
   gotosleepbitch.com — styles
   Apple sub-nav icon bar + Nintendo Wii Channel tactile styling.
   ============================================================ */

:root {
  --bg: #F4F7FA;
  --surface: #FFFFFF;
  --surface-hover: #F0F5FA;
  --text-primary: #1D1D1F;
  --text-secondary: #6B7280;
  --border-soft: rgba(27, 31, 39, 0.07);
  --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.06);
  --shadow-soft-hover: 0 16px 32px rgba(0, 0, 0, 0.12);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.6);
  --radius-card: 24px;
  --radius-round: 999px;
  --font-family: "Quicksand", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #10141C;
  --surface: #1B2130;
  --surface-hover: #222A3C;
  --text-primary: #F2F6FB;
  --text-secondary: #9AA5B9;
  --border-soft: rgba(255, 255, 255, 0.08);
  --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.45);
  --shadow-soft-hover: 0 16px 32px rgba(0, 0, 0, 0.55);
  --glass-bg: rgba(27, 33, 48, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text-primary);
  transition: background-color 0.35s ease, color 0.35s ease;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 120px; /* keep content clear of the fixed glass player */
}

button {
  font-family: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

/* ---------- App shell ---------- */

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 24px 0;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, #00A8FF, #A55EEA);
  color: #ffffff;
  flex-shrink: 0;
}

.brand-icon svg {
  width: 22px;
  height: 22px;
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-dot {
  color: #00A8FF;
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  position: relative;
  width: 60px;
  height: 32px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-round);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
  transition: background-color 0.35s ease;
}

.theme-toggle-icon {
  display: flex;
  width: 15px;
  height: 15px;
  color: var(--text-secondary);
  position: relative;
  z-index: 1;
}

.theme-toggle-icon svg {
  width: 100%;
  height: 100%;
}

.theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00A8FF, #A55EEA);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

html[data-theme="dark"] .theme-toggle-thumb {
  transform: translateX(28px);
}

/* ---------- Main / nav views ---------- */

.app-main {
  position: relative;
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px auto 8px;
  padding: 12px 22px 12px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-round);
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-soft);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.back-button svg {
  width: 18px;
  height: 18px;
}

.back-button:hover {
  box-shadow: var(--shadow-soft-hover);
  transform: translateY(-2px);
}

.back-button:active {
  transform: translateY(1px);
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin: 4px 0 4px;
  text-align: center;
}

/* ---------- Apple-style icon nav bar ---------- */

.sound-category-bar {
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 1;
  transform: translateY(0) scale(1);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 26px;
  padding: 20px 0 16px;
  width: 100%;
}

.sound-category-bar.is-leaving,
.sound-category-bar.is-entering {
  opacity: 0;
  transform: translateY(14px) scale(0.98);
}

.nav-icon-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 150px;
  padding: 8px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: center;
}

.nav-icon-pill:focus-visible {
  outline: none;
}

.icon-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  color: #ffffff;
  margin-bottom: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08), inset 0 2px 4px rgba(255, 255, 255, 0.6);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.nav-icon-pill:hover .icon-bubble,
.nav-icon-pill:focus-visible .icon-bubble {
  transform: translateY(-6px) scale(1.08);
}

.nav-icon-pill:active .icon-bubble {
  transform: translateY(1px) scale(1.02);
}

.icon-bubble svg {
  width: 32px;
  height: 32px;
}

.bg-blue { background: #00A8FF; }
.bg-purple { background: #A55EEA; }
.bg-mint { background: #26DE81; }

.pill-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.pill-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ---------- Sound sub-pills (secondary, smaller) ---------- */

.nav-icon-pill--sound {
  width: 124px;
  padding: 8px 10px;
}

.nav-icon-pill--sound .icon-bubble {
  width: 56px;
  height: 56px;
  border-radius: 18px;
}

.nav-icon-pill--sound .icon-bubble svg {
  width: 24px;
  height: 24px;
}

.nav-icon-pill--sound .pill-title {
  font-size: 14px;
}

.nav-icon-pill--sound.is-active .icon-bubble {
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.1), 0 10px 24px rgba(0, 0, 0, 0.08), inset 0 2px 4px rgba(255, 255, 255, 0.6);
}

.pill-indicator {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav-icon-pill--sound.is-active .pill-indicator {
  opacity: 1;
}

.pill-indicator span {
  width: 3px;
  border-radius: 2px;
  background: var(--text-secondary);
  height: 30%;
}

.nav-icon-pill--sound.is-playing .pill-indicator span {
  background: var(--text-primary);
  animation: eq-bounce 0.9s ease-in-out infinite;
}

.pill-indicator span:nth-child(1) { animation-delay: 0s; }
.pill-indicator span:nth-child(2) { animation-delay: 0.2s; }
.pill-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes eq-bounce {
  0%, 100% { height: 30%; }
  50% { height: 100%; }
}

/* ---------- Floating glass player ---------- */

.player-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 160%);
  width: min(400px, calc(100% - 32px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-round);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  padding: 8px 8px 8px 12px;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 20;
}

.player-bar.is-visible {
  transform: translate(-50%, 0);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.player-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  color: #ffffff;
  background: #00A8FF;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
}

.player-icon svg {
  width: 19px;
  height: 19px;
}

.player-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.player-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.player-track {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #00A8FF, #A55EEA);
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.player-toggle:hover {
  transform: scale(1.06);
}

.player-toggle:active {
  transform: scale(0.96);
}

.player-toggle svg {
  width: 19px;
  height: 19px;
}

.player-toggle .icon-pause {
  display: none;
}

.player-bar.is-playing .player-toggle .icon-play {
  display: none;
}

.player-bar.is-playing .player-toggle .icon-pause {
  display: flex;
}

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
  .app {
    padding: 24px 16px 0;
  }

  .brand-name {
    font-size: 18px;
  }

  .nav-icon-pill {
    width: 108px;
    padding: 16px 8px 14px;
  }

  .icon-bubble {
    width: 52px;
    height: 52px;
  }

  .nav-icon-pill--sound {
    width: 96px;
  }

  .player-bar {
    width: calc(100% - 24px);
    bottom: 14px;
  }
}
