/* Reson. One quiet, precise interface over the artwork: a single contemporary sans for everything,
   a tightly set title, soft rounded off-white controls with hairline borders, small grey
   sentence-case labels and one orange accent. A dark tone takes over for Sleep and for the older
   dark visual styles.

   Font: Geist, self-hosted, SIL Open Font License (see THIRD_PARTY_NOTICES.md). */
@font-face { font-family: "Geist"; src: url(assets/fonts/geist.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --font: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --accent: #ff4a1c;
  --accent-text: #c4360d;   /* the accent as small text: 4.9:1 on white */
  --accent-fill: #d9370c;   /* behind white text: 4.7:1 */
  --text: #0c0c0c;
  --muted: rgba(12, 12, 12, 0.68);
  --faint: rgba(12, 12, 12, 0.58);
  --line: rgba(12, 12, 12, 0.12);
  --bg: #e9eef2;
  --block: #fbf9f4;
  --block-hover: #fff;
  --surface: #fbf9f4;
  --surface-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 18px 50px rgba(20, 40, 80, 0.16);
  --card: #fff;
  --chip: rgba(12, 12, 12, 0.055);
  --chip-hover: rgba(12, 12, 12, 0.1);
  --on: #0c0c0c;
  --on-ink: #fff;
  --track: rgba(12, 12, 12, 0.14);
  --strong: #0c0c0c;
  --strong-ink: #fff;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dock: 0px;

  /* Type and shape. Everything typographic reads these, so a direction (or a prototype UI) can
     restyle the whole page by overriding tokens. */
  --font-display: var(--font);
  --title-size: clamp(56px, 9.4vw, 152px);
  --title-size-phone: clamp(50px, 16vw, 92px);
  --title-weight: 600;
  --title-stretch: normal;
  --title-track: -0.04em;
  --title-leading: 0.92;
  --title-case: none;
  --title-style: normal;
  --title-vars: normal;
  --title-measure: 11ch;
  --sub-size: 18px;
  --sub-weight: 450;
  --label-weight: 550;
  --label-track: -0.005em;
  --label-case: none;
  --label-size: 13px;
  --brand-font: var(--font);
  --brand-size: 19px;
  --brand-weight: 650;
  --brand-stretch: normal;
  --brand-track: -0.04em;
  --scene-font: var(--font);
  --scene-size: 18px;
  --scene-weight: 600;
  --scene-stretch: normal;
  --scene-track: -0.025em;
  --r: 10px;         /* controls and chips */
  --r-card: 12px;
  --r-panel: 18px;
  --ctl-h: 48px;     /* the transport row */
  --hairline: inset 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.04);
  color-scheme: light;
}
:root[data-tone="dark"] {
  --accent-text: #ff7a52;
  --text: #f3f2ee;
  --muted: rgba(243, 242, 238, 0.72);
  --faint: rgba(243, 242, 238, 0.56);
  --line: rgba(243, 242, 238, 0.14);
  --bg: #0d0d12;
  --block: #1a1920;
  --block-hover: #25242d;
  --surface: #17161d;
  --surface-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --card: rgba(243, 242, 238, 0.06);
  --chip: rgba(243, 242, 238, 0.08);
  --chip-hover: rgba(243, 242, 238, 0.14);
  --on: #f3f2ee;
  --on-ink: #0c0c0c;
  --track: rgba(243, 242, 238, 0.2);
  --strong: #f3f2ee;
  --strong-ink: #0c0c0c;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; }
[hidden] { display: none !important; }

#visual { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.no-webgl body { background: linear-gradient(#cfe3f2, #f4efe6); }

/* ---------------------------------------------------------------- layout */

.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  pointer-events: none;
  transition: right 0.5s var(--ease);
}
/* no slide-in on first load: the saved layout should simply be there */
.booting .app, .booting .panel { transition: none !important; }
/* read by screen readers (and search engines), not shown */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* docked panel: everything re-centres in the space left of it (the width comes from ui.js) */
.docked .app { right: var(--dock); }
.app > * { pointer-events: auto; }
/* Safari can leave children that sit on their own GPU layer (over the WebGL canvas) visible
   while their parent fades, so each faded block is one layer, and turns invisible once faded */
.top > :not(.brand), .bottom { will-change: opacity; transition: opacity 0.9s var(--ease), visibility 0s; }
.idle .top > :not(.brand), .idle .bottom { opacity: 0; visibility: hidden; transition: opacity 0.9s var(--ease), visibility 0s linear 0.9s; }
/* the logo stays through idle: its block melts away and it sits quietly on the artwork */
.brand { will-change: opacity; transition: background 0.9s var(--ease), box-shadow 0.9s var(--ease), opacity 0.9s var(--ease); }
.idle .brand { background: transparent; box-shadow: none; opacity: 0.82; }
/* idle with the panel open: it fades too, and the artwork takes the whole screen like a poster */
.idle .panel.open { opacity: 0; visibility: hidden; pointer-events: none; transition: transform 0.5s var(--ease), opacity 0.9s var(--ease), visibility 0s linear 0.9s; }
.idle, .idle * { cursor: none; }

/* ---------------------------------------------------------------- header: where am I */

.top { display: flex; align-items: stretch; gap: 8px; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 10px;
  font-family: var(--brand-font);
  font-size: var(--brand-size);
  font-weight: var(--brand-weight);
  font-stretch: var(--brand-stretch);
  letter-spacing: var(--brand-track);
  color: var(--text);
  background: var(--block);
  border-radius: var(--r);
  box-shadow: var(--hairline);
}
.brand .mark { width: 22px; height: 22px; flex: none; }
.modes { display: flex; gap: 2px; padding: 3px; background: var(--block); border-radius: var(--r); box-shadow: var(--hairline); }
.mode {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: max(var(--r) - 1px, 0px);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-track);
  text-transform: var(--label-case);
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
}
.mode-num { display: none; }
.mode:hover { color: var(--text); background: var(--chip); }
.mode[aria-selected="true"] { color: var(--on-ink); background: var(--on); }

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--block);
  transition: background 0.2s;
}
.icon-btn:not(.small) { box-shadow: var(--hairline); }
.icon-btn:hover { background: var(--block-hover); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.small { width: 34px; height: 34px; background: var(--chip); }
.icon-btn.small:hover { background: var(--chip-hover); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

/* ---------------------------------------------------------------- hero: what's playing */

.hero { margin-top: auto; padding: 0 4px; pointer-events: none; }
.hero-kicker { display: flex; align-items: center; gap: 10px; margin: 0; font-size: calc(var(--label-size) + 1px); font-weight: var(--label-weight); letter-spacing: var(--label-track); text-transform: var(--label-case); }
.hero-kicker { color: var(--muted); }
.hero-kicker::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
/* one line, always: the listening time joins it without moving anything else */
.kicker-line { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kicker-time { pointer-events: auto; }
.kicker-time b { font-weight: 600; color: var(--text); }
/* the credit for a track by a person: quiet, but always readable and always there while it plays */
.hero-credit { margin: 10px 0 0; min-height: 1.45em; font-size: 13px; line-height: 1.45; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: auto; }
.hero-credit a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.hero-credit a:hover { color: var(--text); text-decoration-color: currentColor; }
/* made with Stable Audio: said plainly and small */
.ai-tag { display: inline-block; margin-left: 2px; padding: 0 5px; border-radius: 4px; font-size: 10px; font-weight: 650; line-height: 16px; letter-spacing: 0.04em; vertical-align: 1px; text-transform: none; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
/* the sentence interface credits the track in its own track line */
.ui-sentence.s-on .hero-credit { display: none; }
.s-track-meta a { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 2px; }
.s-track-meta a:hover { color: var(--text); text-decoration-color: currentColor; }
.hero-title {
  margin: 6px 0 14px -0.04em;
  max-width: var(--title-measure);
  font-family: var(--font-display);
  font-size: var(--title-size);
  font-weight: var(--title-weight);
  font-stretch: var(--title-stretch);
  font-style: var(--title-style);
  font-variation-settings: var(--title-vars);
  line-height: var(--title-leading);
  letter-spacing: var(--title-track);
  text-transform: var(--title-case);
  text-wrap: balance;
}
.hero-sub { max-width: 32ch; margin: 0; font-size: var(--sub-size); font-weight: var(--sub-weight); line-height: 1.3; }
/* what Reson is, for a first look: gone once the music starts */
.hero-pitch { max-width: 46ch; margin: 0 0 18px; font-size: 16px; font-weight: 550; line-height: 1.35; color: var(--text); text-wrap: balance; }
.hero-pitch[hidden] { display: none; }

/* ---------------------------------------------------------------- transport: what can I tap */

.bottom { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.now { margin: 0; min-height: 1.45em; padding-left: 4px; font-size: var(--label-size); font-weight: calc(var(--label-weight) - 100); letter-spacing: var(--label-track); text-transform: var(--label-case); color: var(--muted); }
.controls { display: flex; align-items: center; gap: 8px; }
.controls .left { position: relative; order: 2; display: flex; align-items: center; gap: 8px; }
.controls .right { order: 3; margin-left: auto; display: flex; gap: 8px; }

.play {
  order: 1;
  height: var(--ctl-h);
  padding: 0 26px 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--r);
  font-size: calc(var(--label-size) + 2px);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-track);
  text-transform: var(--label-case);
  color: #fff;
  background: var(--accent-fill);
  transition: background 0.2s, color 0.2s;
}
.play:hover { color: var(--strong-ink); background: var(--strong); }

/* Play is the one accent button: most first visits never pressed it while Next was the orange
   one (MJL-359). Next is the strong one beside it; Back sits beside Play */
.skip, .back {
  order: 1;
  height: var(--ctl-h);
  display: inline-flex;
  align-items: center;
  border-radius: var(--r);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.skip {
  padding: 0 26px 0 20px;
  gap: 12px;
  min-width: 170px;
  font-size: calc(var(--label-size) + 2px);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-track);
  text-transform: var(--label-case);
  color: var(--strong-ink);
  background: var(--strong);
}
.skip:hover { color: #fff; background: var(--accent-fill); }
.back { width: var(--ctl-h); justify-content: center; color: var(--text); background: var(--block); box-shadow: var(--hairline); }
.back:hover { color: #fff; background: var(--strong); }
.skip svg, .back svg { width: 18px; height: 18px; }
.play svg { width: 18px; height: 18px; }

.pill {
  height: var(--ctl-h);
  padding: 0 18px;
  border-radius: var(--r);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: calc(var(--label-size) + 1px);
  font-weight: var(--label-weight);
  letter-spacing: calc(var(--label-track) * 0.66);
  text-transform: var(--label-case);
  white-space: nowrap;
  color: var(--text);
  background: var(--block);
  transition: background 0.2s;
  font-variant-numeric: tabular-nums;
}
.pill { box-shadow: var(--hairline); }
.pill:hover { background: var(--block-hover); }
.pill svg { width: 17px; height: 17px; }
.volume { padding-right: 20px; }
.volume input { width: 112px; }

.menu {
  position: absolute;
  bottom: 60px;
  left: 0;
  z-index: 10;
  min-width: 190px;
  /* eight lengths: a short phone screen scrolls them */
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  padding: 6px;
  border-radius: 3px;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--surface-shadow);
}
.menu-title { padding: 6px 12px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 2px; font-size: 14px; font-weight: 600; color: var(--muted); }
.menu button:hover { color: var(--text); background: var(--chip); }
.menu button[aria-checked="true"] { color: var(--on-ink); background: var(--on); }

/* ---------------------------------------------------------------- panel */

.panel {
  --dock-gap: 12px;
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  width: 390px;
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  color: var(--text);
  border-radius: var(--r-panel);
  background: var(--surface);
  box-shadow: var(--surface-shadow);
  transform: translateX(calc(100% + 32px));
  transition: transform 0.5s var(--ease), opacity 0.9s var(--ease);
}
.panel.open { transform: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px 6px 22px; }
.panel-tabs { display: flex; gap: 20px; }
.panel-tab { position: relative; padding: 8px 0; font-size: var(--label-size); font-weight: var(--label-weight); letter-spacing: var(--label-track); text-transform: var(--label-case); color: var(--muted); }
.panel-tab:hover { color: var(--text); }
.panel-tab[aria-selected="true"] { color: var(--text); }
.panel-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: var(--accent); }
.panel-body { flex: 1; overflow-y: auto; padding: 0 22px 24px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--track) transparent; }

.section { padding: 18px 0 14px; border-top: 1px solid var(--line); }
.view > .section:first-child { border-top: 0; padding-top: 12px; }
.section h3 { margin: 0 0 12px; font-size: calc(var(--label-size) - 1px); font-weight: var(--label-weight); letter-spacing: var(--label-track); text-transform: var(--label-case); color: var(--muted); }
.section h3 small { margin-left: 6px; font-size: 12px; font-weight: 450; letter-spacing: 0; text-transform: none; color: var(--faint); }
.field-label { margin: 4px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field-label:not(:first-of-type) { margin-top: 14px; }
.shortcuts { margin: 18px 0 0; font-size: 12px; color: var(--faint); text-align: center; }
.credits { margin: 6px 0 0; font-size: 12px; text-align: center; color: var(--faint); }
.credits a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.credits a:hover { color: var(--text, inherit); }

/* scenes */
.scenes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.scene {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 78px;
  padding: 11px 13px;
  text-align: left;
  border-radius: var(--r-card);
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background 0.2s, color 0.2s;
}
.scene:hover { background: var(--block-hover); }
.scene-num { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--accent-text); }
.scene.on .scene-num { color: var(--accent); }
.scene-name { font-family: var(--scene-font); font-size: var(--scene-size); font-weight: var(--scene-weight); font-stretch: var(--scene-stretch); line-height: 1.05; letter-spacing: var(--scene-track); }
.scene-feel { font-size: 12px; line-height: 1.35; color: var(--muted); }
.scene.on { color: var(--on-ink); background: var(--on); box-shadow: none; }
.scene.on .scene-feel { color: color-mix(in srgb, var(--on-ink) 72%, transparent); }
.scenes:has(> :only-child) { grid-template-columns: 1fr; }

/* under a finished track: why some controls stepped aside */
.track-note { margin: 4px 0 14px; padding: 10px 12px; border-radius: var(--r); font-size: 13px; line-height: 1.4; color: var(--muted); background: var(--chip); }

/* the simple view's plain choices */
.choices { display: grid; gap: 16px; }
.choice h3 { margin-bottom: 8px; }

/* history */
.history-track { display: flex; align-items: center; gap: 10px; }
.history-dots { flex: 1; min-width: 0; display: flex; align-items: center; overflow: hidden; }
.history-dot { position: relative; flex: none; width: 22px; height: 22px; display: grid; place-items: center; }
.history-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); transition: transform 0.2s, background 0.2s; }
.history-dot + .history-dot::after { content: ""; position: absolute; right: 15px; width: 14px; height: 1px; background: var(--line); }
.history-dot:hover::before { transform: scale(1.3); background: var(--text); }
.history-dot.current::before { width: 11px; height: 11px; background: var(--accent); }
.history-dot.future::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--faint); }
.history-buttons { display: flex; gap: 6px; }
.history-label { margin-top: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* mood pad */
.xy {
  position: relative;
  aspect-ratio: 1.7;
  border-radius: var(--r-card);
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%), linear-gradient(90deg, #8fc0ea, #b8cde8 40%, #f6c8a8 75%, #ff8a5c);
  box-shadow: inset 0 0 0 1px var(--line);
}
:root[data-tone="dark"] .xy { background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 70%), linear-gradient(90deg, #26346a, #3a3f78 40%, #7a4a6a 75%, #a8463a); }
.xy-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(0, 0, 0, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 0, 0, 0.07) 1px, transparent 1px);
  background-size: 25% 25%;
  background-position: -1px -1px;
}
.xy-label { position: absolute; font-size: 12px; font-weight: 550; color: var(--text); opacity: 0.75; pointer-events: none; }
.xy-label.l { left: 10px; top: 50%; transform: translateY(-50%); }
.xy-label.r { right: 10px; top: 50%; transform: translateY(-50%); }
.xy-label.t { top: 8px; left: 50%; transform: translateX(-50%); }
.xy-label.b { bottom: 8px; left: 50%; transform: translateX(-50%); }
.xy-puck {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--strong);
  transition: left 0.25s var(--ease), top 0.25s var(--ease);
  pointer-events: none;
}
.xy.dragging .xy-puck { transition: none; }

/* sliders */
input[type="range"] {
  --p: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--strong) var(--p), var(--track) var(--p)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--strong); box-shadow: 0 0 0 2px var(--surface); transition: transform 0.15s; }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.2); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--strong); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--strong); box-shadow: 0 0 0 2px var(--surface); }

.range { display: grid; grid-template-columns: 96px 1fr; align-items: center; column-gap: 12px; margin: 4px 0 6px; }
.range-label { font-size: 14px; font-weight: 600; }
.range-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.range-ends { grid-column: 2; display: flex; justify-content: space-between; margin-top: -3px; font-size: 11px; color: var(--faint); }
.range.hue input::-webkit-slider-runnable-track { background: linear-gradient(90deg, #4bd3c8, #6b7cff, #d36bff, #ff6b8b, #ffb347, #b8e05a, #4bd3c8); }
.range.hue input::-moz-range-track { background: linear-gradient(90deg, #4bd3c8, #6b7cff, #d36bff, #ff6b8b, #ffb347, #b8e05a, #4bd3c8); }
.range.hue input::-moz-range-progress { background: transparent; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  padding: 7px 12px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--chip);
  transition: color 0.2s, background 0.2s;
}
.chip:hover { background: var(--chip-hover); }
.chip.on { color: var(--on-ink); background: var(--on); }
.chips.small .chip { padding: 5px 10px; font-size: 12px; }
.chips.keys { display: grid; grid-template-columns: repeat(6, 1fr); }
.chips.keys .chip { padding: 6px 0; text-align: center; }
/* segmented: a row of equal options */
.chips.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.chips.seg .chip { padding: 9px 0; text-align: center; }

/* layers */
.layer { padding: 10px 0 6px; }
.layer + .layer { border-top: 1px solid var(--line); }
.layer-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.layer-name { min-width: 58px; font-size: 14px; font-weight: 700; }
.power { width: 26px; height: 26px; border-radius: 2px; display: grid; place-items: center; background: var(--chip); }
.power:hover { background: var(--chip-hover); }
.lock { width: 26px; height: 26px; margin-left: auto; border-radius: 2px; display: grid; place-items: center; color: var(--faint); opacity: 0.55; }
.lock svg { width: 14px; height: 14px; }
.lock:hover { opacity: 1; background: var(--chip-hover); }
.lock[aria-pressed="true"] { color: var(--accent); opacity: 1; }
.lock .shut, .lock[aria-pressed="true"] .open { display: none; }
.lock[aria-pressed="true"] .shut { display: inline; }
.led { width: 8px; height: 8px; background: var(--accent); opacity: 0.65; transition: opacity 0.5s; }
.led.hit { opacity: 1; transition: none; }
.layer.off .led { background: var(--faint); opacity: 0.6; }
.layer.off .layer-name, .layer.off .chips, .layer.off input { opacity: 0.42; }
.layer input[type="range"] { margin-top: 4px; }

/* switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 14px; font-weight: 600; }
.switch small { display: block; font-size: 12px; font-weight: 450; color: var(--faint); }
.switch button { position: relative; flex: none; width: 42px; height: 24px; border-radius: 2px; background: var(--track); transition: background 0.2s; }
.switch button::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 1px; background: #fff; transition: transform 0.25s var(--ease); }
.switch button[aria-checked="true"] { background: var(--accent); }
.switch button[aria-checked="true"]::after { transform: translateX(18px); }

/* buttons */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.view > .actions { padding-top: 18px; border-top: 1px solid var(--line); }
.btn {
  height: 44px;
  padding: 0 14px;
  border-radius: var(--r);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  background: var(--chip);
  transition: background 0.2s, color 0.2s;
}
.btn:hover { background: var(--chip-hover); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { color: var(--strong-ink); background: var(--strong); }
.btn.primary:hover { color: #fff; background: var(--accent-fill); }
.btn.wide { grid-column: 1 / -1; }
.btn.quiet { background: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--text); background: var(--chip); }

/* mixes */
.save-row { display: flex; gap: 6px; }
.save-row input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border-radius: 2px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--chip);
  border: 0;
}
.save-row input::placeholder { color: var(--faint); }
.mix-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.mix { display: flex; align-items: center; gap: 4px; border-radius: 2px; background: var(--chip); }
.mix-load { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; text-align: left; border-radius: 2px; }
.mix-load:hover { background: var(--chip-hover); }
.mix-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.mix-mode { font-size: 12px; color: var(--faint); }
.mix-del { width: 34px; height: 34px; margin-right: 4px; border-radius: 2px; display: grid; place-items: center; color: var(--faint); }
.mix-del:hover { color: var(--text); background: var(--chip-hover); }
.mix-del svg { width: 14px; height: 14px; }
.empty { padding: 8px 2px; font-size: 13px; color: var(--faint); }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 720px) {
  .volume { display: none; }
}
@media (max-width: 640px) {
  /* phones show the mark alone, beside the modes */
  .brand { padding: 0 10px; }
  .brand .word { display: none; }
  .modes { flex: 1; }
  .mode { flex: 1; justify-content: center; padding: 0 4px; font-size: 11px; letter-spacing: 0.06em; }
  .hero-title { font-size: var(--title-size-phone); }
  .hero-sub { font-size: 16px; }
  .hero-pitch { font-size: 15px; margin-bottom: 14px; }
  .play, .pill { height: calc(var(--ctl-h) - 4px); }
  /* the transport row is full: Back and Play keep their size, Next takes what's left */
  .back, .play, .pill { flex: none; }
  .skip { flex: 1 1 auto; min-width: 0; justify-content: center; }
  .panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-width: none;
    height: min(80vh, 720px);
    transform: translateY(calc(100% + 24px));
  }
  .panel.open { transform: none; }
}
@media (max-width: 420px) {
  #fullscreen { display: none; }
  .pill span, .play-label { display: none; }
  .play { padding: 0 18px; }
  .pill { padding: 0 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .panel, .app, .top, .bottom, .xy-puck { transition: none; }
}

/* blind look comparison (tools/compare.html): no panel, no names */
.comparing #panel, .comparing #tune-btn { display: none !important; }

/* ♥ save this song: beside Next, quiet until it's on */
.like { order: 1; width: 52px; height: 52px; display: inline-grid; place-items: center; border-radius: var(--radius, 12px); color: var(--muted); background: var(--chip, #fff); box-shadow: inset 0 0 0 1px var(--line); transition: color 0.2s, background 0.2s; }
.like:hover { color: var(--accent-fill); }
.like.on { color: var(--accent-fill); }
.like svg { width: 20px; height: 20px; }
/* share sits beside ♥ and stays as quiet; only Play is loud */
.share:hover { color: var(--text); }

/* a short confirmation above the control that triggered it ("Link copied") */
.note {
  position: fixed;
  z-index: 30;
  margin: 0;
  padding: 7px 12px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  color: var(--text);
  background: var(--block);
  box-shadow: var(--hairline), 0 6px 20px rgba(0, 0, 0, 0.08);
  transform: translate(-50%, 4px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease), visibility 0s linear 0.9s;
}
.note.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0s; }

/* opened from a shared link: a note above Play, and Play ringed in the accent, until it's pressed */
.controls { position: relative; }
.landing-hint {
  position: absolute;
  left: var(--x, 0px);
  bottom: calc(100% + 12px);
  max-width: min(420px, calc(100vw - var(--x, 0px) - 32px));
  margin: 0;
  padding: 9px 14px;
  border-radius: var(--r);
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
  background: var(--block);
  box-shadow: var(--hairline), 0 8px 24px rgba(0, 0, 0, 0.08);
  pointer-events: none;
}
.landing-hint b { font-weight: 650; }
.landing-hint::after { content: ""; position: absolute; left: var(--caret, 22px); bottom: -6px; width: 12px; height: 12px; background: inherit; transform: rotate(45deg); box-shadow: 1px 1px 0 var(--line); }
.landing .play { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.idle .landing-hint { opacity: 0; }
