:root {
  --bg: #e8ecf1;
  --surface: #f7f9fb;
  --well: #dde3ea;
  --ink: #172030;
  --muted: #5a6a80;
  --line: #c9d2dd;
  --accent: #b8660f;
  --accent-ink: #fff8ef;
  --accent-soft: rgba(184, 102, 15, 0.14);
  --spectrum: rgba(184, 102, 15, 0.22);
  --spectrum-line: rgba(184, 102, 15, 0.7);
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sky-top: #c6d2e1;
  --sky-low: #e9e3dc;
  --glow: rgba(240, 164, 69, 0.42);
  --hill-back: #bcc8d6;
  --hill-mid: #d2dae4;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1420;
    --surface: #161f2e;
    --well: #0b111b;
    --ink: #dde5ef;
    --muted: #8595ad;
    --line: #263349;
    --accent: #f0a445;
    --accent-ink: #1b1206;
    --accent-soft: rgba(240, 164, 69, 0.14);
    --spectrum: rgba(240, 164, 69, 0.16);
    --spectrum-line: rgba(240, 164, 69, 0.65);
    --sky-top: #070b14;
    --sky-low: #172033;
    --glow: rgba(240, 164, 69, 0.34);
    --hill-back: #1a2436;
    --hill-mid: #141c2b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1420;
  --surface: #161f2e;
  --well: #0b111b;
  --ink: #dde5ef;
  --muted: #8595ad;
  --line: #263349;
  --accent: #f0a445;
  --accent-ink: #1b1206;
  --accent-soft: rgba(240, 164, 69, 0.14);
  --spectrum: rgba(240, 164, 69, 0.16);
  --spectrum-line: rgba(240, 164, 69, 0.65);
  --sky-top: #070b14;
  --sky-low: #172033;
  --glow: rgba(240, 164, 69, 0.34);
  --hill-back: #1a2436;
  --hill-mid: #141c2b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  padding: 0 16px;
}
.wrap { max-width: 980px; margin: 0 auto; }

/* Horizon behind the header and headline. app.js sizes it to end just below the
   top of the player, and the front hill matches the page background. */
.sky {
  position: absolute; top: 0; left: 0; right: 0; z-index: -1;
  background: linear-gradient(to bottom, var(--sky-top), var(--sky-low));
  overflow: hidden;
  pointer-events: none;
}
.sky .glow {
  position: absolute; left: 0; right: 0; bottom: 0; height: 90%;
  background: radial-gradient(50% 70% at 74% 92%, var(--glow), transparent 72%);
  opacity: 0.5;
  transition: opacity 3s ease;
}
.playing .sky .glow { opacity: 1; }
.sky .hills { position: absolute; left: 0; bottom: 0; width: 100%; height: 120px; display: block; }
.sky .back { fill: var(--hill-back); }
.sky .mid { fill: var(--hill-mid); }
.sky .front { fill: var(--bg); }
@media (max-width: 620px) { .sky .hills { height: 90px; } }

header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 18px;
}
.brand {
  font: 700 19px/1 var(--display);
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
}
.brand-mark { width: 26px; height: 18px; display: block; }
.top nav { display: flex; gap: 18px; font-size: 14px; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--ink); }

.intro { padding-block: 12px 22px; max-width: 640px; }
h1 {
  font: 700 clamp(32px, 6vw, 52px)/1.02 var(--display);
  letter-spacing: -0.025em;
  margin: 0 0 12px;
  text-wrap: balance;
}
.intro p { margin: 0; color: var(--muted); font-size: 17px; }

/* Console */
.console {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  display: grid;
  gap: 18px;
}
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: 500 14px/1 var(--body);
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip.scene {
  background-color: var(--surface);
  background-size: cover;
  background-position: center;
  border-color: rgba(23, 32, 48, 0.12);
  font-weight: 600;
}
.chip.scene:hover { border-color: rgba(23, 32, 48, 0.35); }
.chip.scene[aria-pressed="true"] {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip.scene { border-color: rgba(221, 229, 239, 0.16); }
}
:root[data-theme="dark"] .chip.scene { border-color: rgba(221, 229, 239, 0.16); }

.board {
  position: relative;
  background: var(--well);
  border-radius: 10px;
  padding: 18px 8px 12px;
  overflow: hidden;
}
#spectrum {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.faders {
  position: relative;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 2px;
}
.band { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.band .db {
  font: 400 11px/1 var(--mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-height: 11px;
}
.band input[type="range"] {
  writing-mode: vertical-lr;
  direction: rtl;
  -webkit-appearance: none;
  appearance: none;
  width: 34px;
  height: 220px;
  background: transparent;
  cursor: ns-resize;
  margin: 0;
}
.band input[type="range"]::-webkit-slider-runnable-track {
  width: 4px; background: var(--line); border-radius: 2px;
}
.band input[type="range"]::-moz-range-track {
  width: 4px; background: var(--line); border-radius: 2px;
}
.band input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px; height: 14px;
  margin-left: -13px;
  border-radius: 3px;
  background: var(--ink);
  border: 0;
  box-shadow: inset 0 -2px 0 var(--accent);
}
.band input[type="range"]::-moz-range-thumb {
  width: 30px; height: 14px; border-radius: 3px; border: 0;
  background: var(--ink);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.band input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.band label {
  font: 500 11px/1 var(--mono);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.transport {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 30px;
}
/* Play and volume first, Drift and the sleep timer second, then a quiet row of
   occasional actions. */
.level { gap: 8px; }
.step {
  width: 36px; height: 36px; padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  font: 500 20px/1 var(--body);
  cursor: pointer;
}
.step:hover:not(:disabled) { border-color: var(--muted); }
.step:disabled { opacity: 0.35; cursor: default; }
.step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.main-controls, .settings { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }
.actions {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.actions .text-btn { font-size: 14px; }
.play {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 16px/1 var(--body);
  padding: 14px 22px 14px 18px;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
.play svg { width: 16px; height: 16px; fill: currentColor; }
.play:focus-visible, .chip:focus-visible, .ghost:focus-visible, select:focus-visible, .toggle input:focus-visible + span {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 14px; color: var(--muted); }
.ctl input[type="range"] { width: 130px; accent-color: var(--accent); }
select {
  font: 500 14px var(--body);
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--muted); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle span.sw {
  width: 34px; height: 20px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s;
}
.toggle span.sw::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); transition: transform .2s;
}
.toggle input:checked + span.sw { background: var(--accent); }
.toggle input:checked + span.sw::after { transform: translateX(14px); }
.drift { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.info {
  width: 20px; height: 20px; padding: 0;
  border-radius: 50%; border: 1px solid var(--line);
  background: none; color: var(--muted);
  font: italic 600 12px/1 Georgia, serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.info:hover, .info[aria-expanded="true"] { color: var(--ink); border-color: var(--muted); }
.info:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tip {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 5;
  width: min(280px, calc(100vw - 32px));
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--ink); color: var(--surface);
  font-size: 13px; line-height: 1.45;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.custom-time { display: inline-flex; align-items: center; gap: 6px; }
.custom-time[hidden] { display: none; }
.custom-time input, .save-form input {
  font: 500 14px var(--body);
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.custom-time input { width: 70px; }
.save-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.save-form[hidden] { display: none; }
.save-form input { flex: 1; min-width: 160px; max-width: 280px; }
.mixes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mixes[hidden] { display: none; }
.mixes-label { font-size: 13px; color: var(--muted); margin-right: 2px; }
.mix { display: inline-flex; align-items: center; }
.mix .chip { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.mix .del {
  font: 500 15px/1 var(--body);
  padding: 8px 10px 9px;
  border: 1px solid var(--line); border-left: 0;
  border-radius: 0 999px 999px 0;
  background: transparent; color: var(--muted); cursor: pointer;
}
.mix .del:hover { color: var(--ink); border-color: var(--muted); }
.blackout {
  position: fixed; inset: 0; z-index: 1000;
  background: #000; cursor: none;
  display: flex; align-items: flex-end; justify-content: center;
}
.blackout[hidden] { display: none; }
.blackout p { margin: 0 0 32px; color: #555; font-size: 14px; animation: dim 4s forwards; }
@keyframes dim { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
.countdown { font: 500 13px var(--mono); color: var(--accent); font-variant-numeric: tabular-nums; min-width: 44px; }
.ghost {
  font: 500 14px var(--body);
  background: none; border: 1px solid var(--line); color: var(--ink);
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
}
.status { font-size: 13px; color: var(--muted); min-height: 1em; }
.status:empty { display: none; }

/* Content */
main section.copy { padding-block: 44px 0; }
.copy h2 {
  font: 700 26px/1.15 var(--display);
  letter-spacing: -0.015em;
  margin: 0 0 12px;
  text-wrap: balance;
}
.copy p { max-width: 65ch; margin: 0 0 12px; }
.colors {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px 28px;
  margin-top: 18px;
}
.colors div { border-top: 1px solid var(--line); padding-top: 12px; }
.colors h3 { margin: 0 0 4px; font: 600 16px var(--body); display: flex; justify-content: space-between; gap: 8px; }
.colors h3 small { font: 400 12px var(--mono); color: var(--muted); }
.colors p { margin: 0; color: var(--muted); font-size: 15px; }
details { border-top: 1px solid var(--line); padding-block: 12px; max-width: 70ch; }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); margin: 8px 0 0; }
footer { padding-block: 48px 32px; color: var(--muted); font-size: 13px; }

/* Support note, gear picks, links to the other generators */
.support {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 14px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--accent-soft);
  font-size: 14px;
}
.support p { margin: 0; flex: 1; }
.support a, footer a, .copy a { color: var(--ink); text-underline-offset: 2px; }
.support .close {
  border: 0; background: none; color: var(--muted);
  font-size: 20px; line-height: 1; padding: 0 2px; cursor: pointer;
}
.picks {
  list-style: none; margin: 18px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 28px;
}
.picks li { border-top: 1px solid var(--line); padding-top: 12px; }
.picks h3 { margin: 0 0 4px; font: 600 16px var(--body); }
.picks p { margin: 0 0 8px; color: var(--muted); font-size: 15px; }
.picks .buy { font-weight: 600; }
.disclosure { margin-top: 18px; font-size: 13px; color: var(--muted); }
.chart { margin: 20px 0 18px; max-width: 720px; }
.chart img { display: block; width: 100%; height: auto; border-radius: 14px; }
.chart figcaption { margin-top: 8px; max-width: 65ch; font-size: 13px; color: var(--muted); }
.steps { max-width: 65ch; padding-left: 1.3em; margin: 0; }
.steps li { margin-bottom: 6px; }
.more ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.more a {
  display: inline-block; padding: 9px 13px;
  border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; font-size: 14px;
}
.more a:hover { border-color: var(--muted); }
.top nav a[aria-current="page"] { color: var(--ink); }
.top .right { display: flex; align-items: center; gap: 18px; }
.coffee {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font: 600 14px/1 var(--body);
  text-decoration: none;
  white-space: nowrap;
}
.coffee:hover { border-color: var(--accent); }
.coffee:focus-visible, .thanks a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.text-btn {
  flex: none;
  background: none; border: 0; padding: 0;
  font: 500 13px var(--body); color: var(--muted);
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.text-btn:hover { color: var(--ink); }
.text-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.install {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 14px rgba(15, 25, 45, 0.12);
  font-size: 13px; color: var(--muted);
}
.install img { border-radius: 9px; flex: none; }
.install-text { flex: 1; display: grid; gap: 1px; line-height: 1.3; }
.install-text strong { color: var(--ink); font-weight: 600; font-size: 15px; }
.install .close { border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 6px 4px; cursor: pointer; flex: none; }
.install-btn {
  flex: none;
  border: 0; border-radius: 999px;
  padding: 8px 16px;
  background: var(--accent); color: var(--accent-ink);
  font: 600 14px var(--body); cursor: pointer;
}
.install-btn:focus-visible, .install .close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.install-sheet {
  position: fixed; inset: 0; z-index: 950;
  background: rgba(8, 12, 20, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 520px;
  display: grid; gap: 12px; justify-items: start;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  background: var(--surface); color: var(--ink);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 30px rgba(8, 12, 20, 0.2);
}
.sheet:focus { outline: none; }
.sheet img { border-radius: 12px; }
.sheet h2 { margin: 0; font: 700 21px/1.2 var(--display); letter-spacing: -0.01em; }
.sheet p { margin: 0; color: var(--muted); font-size: 15px; }
.install-steps { list-style: none; counter-reset: step; margin: 4px 0; padding: 0; display: grid; gap: 10px; width: 100%; }
.install-steps li { counter-increment: step; display: flex; align-items: center; gap: 12px; font-size: 15px; line-height: 1.35; }
.install-steps li::before { content: counter(step); flex: none; width: 12px; font: 600 13px var(--body); color: var(--muted); }
.step-icon {
  flex: none; width: 36px; height: 36px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--well); color: var(--ink);
}
.step-icon svg { width: 18px; height: 18px; }
.step-add { font-weight: 600; font-size: 14px; color: #0a84ff; }
.more-dots { color: var(--ink); font-weight: 700; letter-spacing: 1px; }
.sheet .done { justify-self: stretch; padding: 12px; font-size: 15px; }
.thanks { margin: 12px 2px 0; font-size: 14px; color: var(--muted); }
.thanks a { color: var(--ink); font-weight: 600; text-underline-offset: 2px; }

@media (max-width: 620px) {
  .top nav { display: none; }
  .coffee { padding: 7px 11px; font-size: 13px; }
  .brand { font-size: 17px; gap: 8px; }
  .console { padding: 12px; }
  .board { padding-inline: 2px; }
  .band input[type="range"] { height: 180px; width: 28px; }
  .band input[type="range"]::-webkit-slider-thumb { width: 24px; margin-left: -10px; }
  .band input[type="range"]::-moz-range-thumb { width: 24px; }
  .band label { font-size: 9.5px; }
  .band .db { font-size: 9.5px; }
  .ctl input[type="range"] { width: 100px; }
  /* Tighter header, shorter intro and faders so more of the player fits above the fold. */
  header.top { padding-block: 12px; }
  h1 { font-size: 30px; margin-bottom: 8px; }
  .intro { padding-block: 4px 16px; }
  .intro p { font-size: 16px; }
  .intro-extra { display: none; }
  .band input[type="range"] { height: 150px; }
  .main-controls, .settings { width: 100%; }
  .play { flex: 1 1 100%; justify-content: center; }
  .settings { justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
