/* ============ a lullaby ============ */

:root {
  --font-ui: "Quicksand", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --ease: cubic-bezier(0.33, 1, 0.68, 1);

  /* the girl-artwork peach palette */
  --bg1: #fdf0e6;
  --bg2: #f9d9c6;
  --bg3: #f0b9ac;
  --text: #533c48;
  --text-dim: rgba(83, 60, 72, 0.60);
  --accent: #e2798f;
  --accent-2: #f2a98f;
  --btn-text: #4a2333;
  --card: rgba(255, 252, 249, 0.62);
  --card-border: rgba(255, 255, 255, 0.75);
  --input-bg: rgba(255, 255, 255, 0.7);
  --moon: #fff2d9;
  --moon-glow: rgba(255, 224, 178, 0.55);
  --bunny: #d9958f;

  /* night screen */
  --night-bg: #0c0912;
  --night-ink: rgba(214, 160, 120, 0.4);
  --night-ink-dim: rgba(214, 160, 120, 0.22);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  font-family: var(--font-ui);
  color: var(--text);
  background: linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 55%, var(--bg3) 100%) fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; }

/* ---------- scene ---------- */
.scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.moon {
  position: absolute;
  top: 46px; right: 8vw;
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--moon);
  box-shadow: 0 0 50px 18px var(--moon-glow), 0 0 120px 50px rgba(255, 224, 178, 0.25);
}

.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  opacity: 0.5;
  animation: twinkle var(--tw, 4s) ease-in-out var(--twd, 0s) infinite alternate;
}
@keyframes twinkle { from { opacity: 0.15; } to { opacity: 0.7; } }

.bunny {
  position: absolute;
  bottom: -4px; right: 4vw;
  width: 130px;
  opacity: 0.9;
}
.bunny path:first-child { fill: var(--bunny); stroke: none; opacity: 0.55; }
.bunny-line { stroke: #7a4a52; stroke-width: 1.8; stroke-linecap: round; opacity: 0.7; }
.bunny-cheek { fill: rgba(226, 121, 143, 0.35); stroke: none; }
.bunny-zzz { stroke: #7a4a52; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.45; }

/* ---------- layout ---------- */
.topbar {
  position: relative; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 22px 4px;
  max-width: 430px;
  margin: 0 auto;
}
.brand {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.01em;
}
.brand i { font-style: italic; color: var(--accent); }

.icon-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text-dim);
  transition: color 0.25s, transform 0.25s var(--ease);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:active { transform: scale(0.94); }

.col {
  position: relative; z-index: 10;
  max-width: 430px;
  margin: 0 auto;
  padding: 12px 18px calc(30px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
  gap: 16px;
}

/* ---------- play ---------- */
.play-btn {
  align-self: center;
  margin-top: 10px;
  width: 96px; height: 96px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--btn-text);
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: 0 16px 40px -10px var(--accent), inset 0 2px 0 rgba(255,255,255,0.5);
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.play-btn:active { transform: scale(0.95); }
.play-btn svg { width: 34px; height: 34px; stroke-width: 2; }
.play-btn .i-pause { display: none; }
body.playing .play-btn .i-play { display: none; }
body.playing .play-btn .i-pause { display: block; }
body.playing .play-btn { animation: heartbeat 4s ease-in-out infinite; }
@keyframes heartbeat {
  0%, 100% { box-shadow: 0 16px 40px -10px var(--accent), inset 0 2px 0 rgba(255,255,255,0.5); }
  50% { box-shadow: 0 16px 52px -6px var(--accent), inset 0 2px 0 rgba(255,255,255,0.5); }
}

.status {
  align-self: center;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-align: center;
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 12px 34px -18px rgba(155, 90, 105, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.card h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 17px;
  margin-bottom: 12px;
}

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 13px; font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  color: var(--text-dim);
  transition: background 0.2s, color 0.2s;
}
.chip.active {
  background: linear-gradient(120deg, var(--accent-2), var(--accent));
  color: var(--btn-text);
  border-color: transparent;
}

.check {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 12px;
  cursor: pointer;
}
.check input { accent-color: var(--accent); width: 17px; height: 17px; flex: none; }

/* sound rows */
.sound-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.s-label {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 600;
  color: var(--text-dim);
  min-width: 118px;
}
.s-label svg { width: 20px; height: 20px; flex: none; }
.sound-row.active .s-label { color: var(--accent); }

.vol {
  flex: 1;
  appearance: none; -webkit-appearance: none;
  height: 5px;
  border-radius: 999px;
  background: var(--input-bg);
  outline: none;
}
.vol::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgba(155, 90, 105, 0.5);
  cursor: pointer;
}
.vol::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid #fff;
  cursor: pointer;
}

/* songs */
.song-list { list-style: none; display: flex; flex-direction: column; }
.song {
  width: 100%;
  display: flex; align-items: center; gap: 11px;
  font-size: 14.5px; font-weight: 600;
  color: var(--text-dim);
  padding: 9px 4px;
  border-radius: 12px;
  text-align: left;
  transition: color 0.2s, background 0.2s;
}
.song:active { background: rgba(255, 255, 255, 0.4); }
.song:disabled { opacity: 0.4; cursor: default; }
.song-dot {
  flex: none;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--text-dim);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.song.active { color: var(--accent); }
.song.active .song-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.song.now .song-dot { animation: now-pulse 2.6s ease-in-out infinite; }
@keyframes now-pulse {
  0%, 100% { box-shadow: 0 0 6px var(--accent); }
  50% { box-shadow: 0 0 14px var(--accent); }
}

.song-hint {
  font-size: 11.5px;
  color: var(--text-dim);
  opacity: 0.85;
  margin: 2px 0 8px;
}
.song-list + .sound-row { border-top: 1px solid var(--card-border); margin-top: 8px; padding-top: 14px; }

.safety {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-dim);
  text-align: center;
  opacity: 0.9;
}

/* ---------- night screen ---------- */
.night-screen {
  position: fixed; inset: 0; z-index: 100;
  background: var(--night-bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  animation: night-in 1.6s ease;
  cursor: pointer;
}
@keyframes night-in { from { opacity: 0; } }

.night-moon {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: transparent;
  box-shadow: inset -10px -7px 0 0 var(--night-ink);
  transform: rotate(-18deg);
  margin-bottom: 8px;
}

.night-remaining {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  color: var(--night-ink);
  letter-spacing: 0.04em;
}
.night-clock {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--night-ink-dim);
}
.night-hint {
  position: absolute;
  bottom: calc(26px + env(safe-area-inset-bottom));
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--night-ink-dim);
  opacity: 0.7;
}

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 200;
  bottom: calc(28px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(60, 35, 48, 0.92);
  color: #fff2ea;
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: 999px;
  white-space: nowrap;
  animation: toast-in 0.4s var(--ease);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .star, body.playing .play-btn { animation: none !important; }
}
