/* Calm Noise — styles. Come Alone family (Nunito, rounded cards), dark low-light night theme by default. */
:root {
  --bg: #0e0d16;
  --surface: #171523;
  --surface-2: #221f31;
  --text: #e9e6f2;
  --muted: #9a94ab;
  --line: rgba(233,230,242,.09);
  --accent: #a99cff;      /* moonlight lavender */
  --accent-2: #6fc9c1;    /* calm water teal */
  --accent-ink: #120f1f;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 20px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 500;
  background: radial-gradient(120% 60% at 50% -10%, #1d1934 0%, var(--bg) 60%) no-repeat, var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 900; letter-spacing: -.01em; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; max-width: 720px; width: 100%; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 900; font-size: 1.15rem; }
.brand-mark { width: 32px; height: 32px; color: var(--accent); }
.lang-wrap select { font-weight: 700; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; }

/* Main */
.app { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 8px 16px 32px; }
.hero { padding: 8px 0 16px; }
.hero h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); }
.hero p { color: var(--muted); margin-top: 8px; font-size: 1.02rem; }

/* Transport (sticky so play/pause is always reachable) */
.transport {
  position: sticky; top: 8px; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  background: rgba(23,21,35,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow);
}
.play {
  flex: 0 0 60px; width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
  transition: transform .12s ease, box-shadow .3s ease;
}
.play svg { width: 28px; height: 28px; }
.play:active { transform: scale(.95); }
body.is-playing .play { box-shadow: 0 0 0 6px rgba(169,156,255,.16), 0 0 30px rgba(169,156,255,.25); }
.transport-mid { flex: 1; min-width: 0; }
.now { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.master { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--muted); }
.vol-ico svg { width: 20px; height: 20px; display: block; }
.msg { min-height: 1.4em; margin: 10px 2px 0; color: var(--accent); font-weight: 700; font-size: .95rem; }

/* Range sliders */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: var(--surface-2); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 6px; background: var(--surface-2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: var(--text); border: 0; }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--text); border: 0; }
input[type=range]:focus-visible { outline-offset: 0; }

/* Blocks */
.block { margin-top: 22px; }
.block > h2 { font-size: 1.1rem; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; }
.block > h2 small { color: var(--muted); font-weight: 700; font-size: .85rem; }
.hint { color: var(--muted); font-size: .9rem; margin-top: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 10px 16px;
  font-weight: 700; cursor: pointer; min-height: 44px;
}
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* Sound cards */
.sounds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 560px) { .sounds { grid-template-columns: 1fr 1fr 1fr; } }
.sound {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 12px 8px; transition: border-color .2s ease, background .2s ease;
}
.sound.on { border-color: rgba(169,156,255,.55); background: linear-gradient(180deg, #221e38, var(--surface)); }
.sound-toggle {
  display: flex; align-items: center; gap: 10px; width: 100%; background: transparent; border: 0;
  padding: 2px 0 6px; cursor: pointer; text-align: left; min-height: 48px;
}
.sound .ico { flex: 0 0 40px; width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); transition: background .2s ease, color .2s ease; }
.sound .ico svg { width: 24px; height: 24px; }
.sound.on .ico { background: var(--accent); color: var(--accent-ink); }
.sname { font-weight: 800; font-size: .98rem; line-height: 1.2; }
.sound:not(.on) input[type=range] { opacity: .55; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 16px; padding: 14px 20px; font-weight: 900; font-size: 1.02rem;
  cursor: pointer; background: var(--surface-2); color: var(--text); text-decoration: none; min-height: 48px;
  transition: transform .12s ease;
}
.btn:active { transform: scale(.97); }
.btn.small { padding: 10px 14px; font-size: .92rem; min-height: 44px; border-radius: 14px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.block { width: 100%; margin-top: 22px; }

.row { display: flex; gap: 8px; align-items: center; }
.custom-row { margin-top: 10px; }
.row input[type=text], .num {
  flex: 1; min-width: 0; font-weight: 700; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); min-height: 44px;
}
.num { flex: 0 0 120px; }
.num[aria-invalid=true] { border-color: #ff8a8a; }
.timer-left { margin-top: 10px; font-weight: 800; color: var(--accent-2); min-height: 1.2em; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; cursor: pointer; font-size: .95rem; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: 0 0 20px; }

/* Mixes */
.mix-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.mix-list li { display: flex; gap: 6px; align-items: stretch; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.mix-play { flex: 1; min-width: 0; background: transparent; border: 0; text-align: left; padding: 10px 14px; cursor: pointer; }
.mix-name { display: block; font-weight: 800; }
.mix-sub { display: block; color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { flex: 0 0 48px; border: 0; background: transparent; color: var(--muted); font-size: 1.5rem; cursor: pointer; border-radius: 0 16px 16px 0; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

.help { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.help summary { cursor: pointer; font-weight: 800; }
.help ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.help li + li { margin-top: 6px; }
.free { text-align: center; color: var(--muted); font-size: .9rem; margin-top: 18px; }

/* Footer (modest) */
.foot { max-width: 720px; width: 100%; margin: 0 auto; padding: 20px 16px 36px; color: var(--muted); font-size: .9rem; text-align: center; border-top: 1px solid var(--line); }
.foot-city a { color: var(--text); font-weight: 700; text-decoration-color: rgba(169,156,255,.5); text-underline-offset: 3px; }
.foot-line { margin-top: 8px; }
.foot-line.small { font-size: .82rem; opacity: .85; }

@media (prefers-reduced-motion: reduce) { .play, .btn, .sound, .sound .ico { transition: none; } }
