/* =========================================================================
   YO DEEJAY

   The interface is deliberately monochrome. Only one thing on screen carries
   colour, and it is --accent, rewritten from the live spectrum several times
   a second. Everything else is white at a controlled opacity against black,
   which is what keeps it from looking like a toy.

   Spacing is a strict 4px scale. Borders are hairlines. Surfaces are solid
   dark rather than heavily blurred glass, which reads cheap at this size.
   ========================================================================= */

:root {
  /* Brand, taken from the logo: neon cyan through to hot magenta. */
  --brand-cyan: #22E0F2;
  --brand-magenta: #FB2BA5;

  --accent-h: 186;
  --accent: hsl(var(--accent-h) 82% 66%);
  --accent-soft: hsl(var(--accent-h) 82% 66% / .14);
  --accent-line: hsl(var(--accent-h) 82% 66% / .42);

  --bg: #000;
  --surface: #0b0b0d;
  --surface-2: #131316;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);

  --t1: rgba(255, 255, 255, .96);
  --t2: rgba(255, 255, 255, .62);
  --t3: rgba(255, 255, 255, .40);

  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px;

  --r1: 3px; --r2: 4px; --r3: 6px; --r4: 8px; --rf: 3px;

  --edge: max(16px, env(safe-area-inset-left));
  --edge-r: max(16px, env(safe-area-inset-right));
  --edge-t: max(14px, env(safe-area-inset-top));
  --edge-b: max(14px, env(safe-area-inset-bottom));

  --ease: cubic-bezier(.2, .7, .3, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  color-scheme: dark;
}

* { box-sizing: border-box; min-width: 0; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
}

/* A background image the listener supplies. It sits behind both canvases,
   which are transparent, and is dimmed so the visuals stay readable. */
#bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
#bg-layer::after {
  content: '';
  position: absolute; inset: 0;
  background: #000;
  opacity: var(--bg-dim, .55);
}

body {
  color: var(--t1);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }
svg { display: block; }
h1, h2, p { margin: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

.grow { flex: 1 1 auto; }
[hidden] { display: none !important; }

/* --------------------------------------------------------------- canvas */

#pulsar, #stage-dj {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
#pulsar { z-index: 0; }

/* The DJ is layered over the visualiser on its own transparent canvas, so
   the two renderers never have to share a WebGL context. */
#stage-dj {
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity .7s var(--ease);
}
#stage-dj.on { opacity: 1; }

#app { z-index: 2; }

#app {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-rows: auto 1fr auto;
  pointer-events: none;
}
#app > * { pointer-events: auto; }

/* --------------------------------------------------------------- topbar */

.topbar {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--edge-t) var(--edge-r) 0 var(--edge);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
  color: inherit;
}
.wm-mark { width: 40px; height: 20px; flex: none; }
.wm-text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.028em;
  color: var(--t1);
}
.wm-text b { color: var(--brand-cyan); font-weight: 700; }
.wordmark i {
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  transition: color .5s var(--ease);
  align-self: center;
}
.wordmark i:empty { display: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--rf);
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--t2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .11em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
button.pill:hover { background: rgba(255, 255, 255, .08); color: var(--t1); border-color: rgba(255,255,255,.34); }
.pill[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: #05050a;
}

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #3ddc84;
  flex: none;
}
.dot.sim { background: rgba(255, 255, 255, .3); }

/* ---------------------------------------------------------------- stage */

.stage {
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 0 var(--edge-r) 0 var(--edge);
  min-height: 0;
  pointer-events: none;
}

.np {
  text-align: center;
  max-width: min(620px, 100%);
  padding-bottom: clamp(10px, 4vh, 34px);
  pointer-events: auto;
}

.np-title {
  text-shadow: 0 2px 22px #000, 0 0 44px #000;
  font-size: clamp(20px, 3.4vw, 32px);
  font-weight: 600;
  letter-spacing: -.021em;
  line-height: 1.16;
  text-wrap: balance;
}
.np-sub {
  text-shadow: 0 1px 16px #000, 0 0 34px #000;
  margin-top: 6px;
  font-size: clamp(13px, 1.6vw, 15px);
  color: var(--t2);
  text-wrap: balance;
}

.np-tags {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--s3);
}
.np-tags > * {
  height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: var(--rf);
  border: 1px solid var(--line-2);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--t3);
  font-variant-numeric: tabular-nums;
}
#m-bpm { transition: color .15s, border-color .15s; }
#m-bpm.hit { color: var(--accent); border-color: var(--accent-line); }
#m-next { cursor: pointer; }
#m-next:hover { color: var(--t1); border-color: var(--line-2); }

.breath {
  margin-top: var(--s4);
  font-size: 11px;
  letter-spacing: .28em;
  text-indent: .28em;
  text-transform: uppercase;
  color: var(--accent);
}

.swap { animation: swap .45s var(--ease); }
@keyframes swap {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ----------------------------------------------------------------- dock */

.dock {
  display: grid;
  gap: var(--s2);
  padding: 0 var(--edge-r) var(--edge-b) var(--edge);
}

.bar {
  display: flex;
  align-items: center;
  gap: var(--s3);
  height: 64px;
  padding: 0 var(--s3);
  border-radius: var(--r3);
  border: 1px solid var(--line);
  background: rgba(10, 10, 12, .82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.play {
  flex: none;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: var(--rf);
  background: #fff;
  color: #000;
  transition: transform .15s var(--ease), background .4s var(--ease);
}
.play:hover { transform: scale(1.05); }
.play:active { transform: scale(.94); }
.play.on { background: var(--accent); }
.play svg { width: 18px; height: 18px; }

.bar-info { flex: 1 1 auto; display: grid; gap: 1px; }
.bar-name {
  font-size: 13.5px;
  font-weight: 550;
  letter-spacing: -.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-sub {
  font-size: 11.5px;
  color: var(--t3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.bar-acts { display: flex; align-items: center; gap: 2px; flex: none; }

.ib {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r1);
  color: var(--t2);
  transition: background .15s, color .15s;
}
.ib:hover { background: rgba(255, 255, 255, .08); color: var(--t1); }
.ib[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent); }
.ib svg { width: 18px; height: 18px; }

.vol { display: flex; align-items: center; gap: var(--s2); flex: none; width: 116px; }
.vol-ic { width: 16px; height: 16px; color: var(--t3); flex: none; }

input[type='range'] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 18px; background: none; cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(to right,
    #fff var(--fill, 75%), rgba(255, 255, 255, .16) var(--fill, 75%));
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 11px; height: 11px; margin-top: -4px;
  border-radius: 50%; background: #fff;
}
input[type='range']::-moz-range-track {
  height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .16);
}
input[type='range']::-moz-range-progress { height: 3px; border-radius: 2px; background: #fff; }
input[type='range']::-moz-range-thumb {
  width: 11px; height: 11px; border: 0; border-radius: 50%; background: #fff;
}

/* ------------------------------------------------------------- reactions */

.reacts {
  display: flex;
  gap: var(--s1);
  justify-content: center;
}
.reacts button {
  width: 40px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r1);
  color: var(--t2);
  transition: color .15s, background .15s, transform .15s var(--ease);
}
.reacts button:hover { color: var(--accent); background: rgba(255, 255, 255, .06); }
.reacts button:active { transform: scale(.88); }
.reacts svg { width: 16px; height: 16px; }

#react-field { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.float {
  position: absolute;
  color: var(--accent);
  animation: rise 3s cubic-bezier(.2, .7, .4, 1) forwards;
}
.float svg { width: 22px; height: 22px; }
@keyframes rise {
  0%   { opacity: 0; transform: translateY(0) scale(.5); }
  14%  { opacity: .95; transform: translateY(-16px) scale(1); }
  100% { opacity: 0; transform: translateY(-42vh) scale(.75) translateX(var(--dx, 0)); }
}

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

.scrim {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(0, 0, 0, .6);
  opacity: 0; pointer-events: none;
  transition: opacity .28s var(--ease);
}
.scrim.open { opacity: 1; pointer-events: auto; }

.panel {
  position: fixed;
  z-index: 11;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: transform .34s var(--ease), opacity .24s var(--ease);
  overflow: hidden;
}

@media (min-width: 880px) {
  .panel {
    top: var(--edge-t); bottom: var(--edge-b); left: var(--edge);
    width: min(420px, 40vw);
    border-radius: var(--r4);
    transform: translateX(calc(-100% - 24px));
    opacity: 0;
  }
  .panel.open { transform: none; opacity: 1; }
  .panel-grab { display: none; }
}

@media (max-width: 879px) {
  .panel {
    left: 0; right: 0; bottom: 0;
    max-height: 88dvh;
    border-radius: var(--r4) var(--r4) 0 0;
    border-bottom: 0;
    transform: translateY(101%);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel.open { transform: none; }
}

.panel-grab {
  width: 34px; height: 4px; flex: none;
  border-radius: 2px;
  background: var(--line-2);
  margin: var(--s2) auto 0;
}

.panel-head {
  display: flex; align-items: center;
  flex: none;
  padding: var(--s4) var(--s4) var(--s3) var(--s5);
}
.panel-head h2 {
  font-size: 13px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--t2);
}

.tabs {
  display: flex; gap: var(--s4); flex: none;
  margin: 0 var(--s5) var(--s4);
  border-bottom: 1px solid var(--line);
}
.tabs button {
  height: 32px;
  padding: 0 1px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--t3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tabs button:hover { color: var(--t2); }
.tabs button[aria-selected='true'] { color: var(--t1); border-bottom-color: var(--accent); }

.panel-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--s5) var(--s6);
}
.tabpanel { display: grid; gap: var(--s5); align-content: start; }

/* --------------------------------------------------------------- blocks */

.block { display: grid; gap: var(--s3); }
.block-head { display: flex; align-items: baseline; gap: var(--s2); }
.label {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--t3);
}
.label-note { font-size: 11.5px; color: var(--t3); opacity: .75; }
.link {
  margin-left: auto;
  font-size: 11.5px; color: var(--t3);
  text-decoration: underline; text-underline-offset: 2px;
}
.link:hover { color: var(--t1); }

.row-split { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
.row-title { font-size: 14px; font-weight: 550; }
.row-note { font-size: 12px; color: var(--t3); margin-top: 1px; }

/* --------------------------------------------------------------- search */

.search { position: relative; }
.search-ic {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--t3);
  pointer-events: none;
}
.search input {
  width: 100%; height: 38px;
  padding: 0 var(--s3) 0 34px;
  border-radius: var(--r1);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  font-size: 13.5px;
}
.search input::placeholder { color: var(--t3); }
.search input:focus { outline: none; border-color: var(--line-2); background: rgba(255, 255, 255, .07); }
.search input::-webkit-search-cancel-button { filter: invert(1); opacity: .4; }

/* ------------------------------------------------------------- mood pad */

.pad {
  position: relative;
  aspect-ratio: 1.5 / 1;
  border-radius: var(--r2);
  border: 1px solid var(--line);
  background:
    radial-gradient(90% 80% at 100% 100%, hsl(16 70% 48% / .22), transparent 66%),
    radial-gradient(90% 80% at 0% 100%, hsl(300 70% 52% / .18), transparent 66%),
    radial-gradient(90% 80% at 0% 0%, hsl(205 70% 52% / .16), transparent 66%),
    radial-gradient(90% 80% at 100% 0%, hsl(96 55% 46% / .14), transparent 66%),
    #08080a;
  cursor: crosshair;
  overflow: hidden;
  touch-action: none;
}
.pad-node {
  position: absolute;
  width: 5px; height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .34);
  transition: background .18s, transform .18s, box-shadow .18s;
  pointer-events: none;
}
.pad-node.near { background: rgba(255, 255, 255, .85); transform: scale(1.5); }
.pad-node.active {
  background: #fff; transform: scale(2);
  box-shadow: 0 0 0 3px hsl(var(--accent-h) 82% 66% / .3);
}
.pad-cursor {
  position: absolute;
  width: 40px; height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .5);
  pointer-events: none;
  transition: transform .08s linear;
}
/* While dragging, the ring becomes the thing you are aiming, so it needs to
   be clearly visible above a fingertip. */
.pad.dragging .pad-cursor {
  width: 54px; height: 54px;
  margin: -27px 0 0 -27px;
  border-color: #fff;
  border-width: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 0 18px 2px var(--accent);
}
.pad.dragging { cursor: grabbing; }
.pad-ax {
  position: absolute;
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255, 255, 255, .28);
  pointer-events: none;
}
.pad-ax.t { left: 9px; top: 7px; }
.pad-ax.b { left: 9px; bottom: 7px; }
.pad-ax.r { right: 9px; bottom: 7px; }
.pad-ax.l { left: 9px; top: 50%; transform: translateY(-50%); }
.pad-ax.r { right: 9px; top: 50%; transform: translateY(-50%); }
.pad-hint {
  font-size: 11.5px; color: var(--t3);
  text-align: center;
  min-height: 1.2em;
}

/* --------------------------------------------------------------- chips */

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  height: 28px; padding: 0 10px;
  border-radius: var(--rf);
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--t2);
  font-size: 11px; font-weight: 600;
  letter-spacing: .06em;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { background: rgba(255, 255, 255, .09); color: var(--t1); }
.chip[aria-pressed='true'] {
  background: hsl(var(--chip-h, 262) 62% 56%);
  border-color: hsl(var(--chip-h, 262) 62% 56%);
  color: #05050a;
}

/* ---------------------------------------------------------------- rows */

.rows { display: grid; gap: 1px; }

.row {
  display: flex;
  align-items: center;
  width: 100%;
  border-radius: var(--r1);
  border: 1px solid transparent;
  transition: background .14s;
}
.row-hit {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s2) var(--s2) var(--s3);
  text-align: left;
  border-radius: var(--r1);
}
.row:hover { background: rgba(255, 255, 255, .05); }
.row[aria-current='true'] { background: var(--accent-soft); border-color: var(--accent-line); }

.eq { display: flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 2px; border-radius: 1px; background: rgba(255, 255, 255, .28); height: 35%; display: block; }
.row[aria-current='true'] .eq i { background: var(--accent); animation: eq .95s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .2s; }
.eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 0%, 100% { height: 25%; } 50% { height: 100%; } }

.row-main { display: grid; gap: 1px; }
.row-name { font-size: 13.5px; font-weight: 520; }
.row-desc {
  font-size: 11.5px; color: var(--t3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row-side { display: flex; align-items: center; gap: var(--s1); padding-right: 6px; flex: none; }
.count { font-size: 11px; color: var(--t3); font-variant-numeric: tabular-nums; }

.fav {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--r1);
  color: var(--t3);
  transition: color .15s, background .15s;
}
.fav:hover { background: rgba(255, 255, 255, .08); color: var(--t1); }
.fav[aria-pressed='true'] { color: var(--accent); }
.fav svg { width: 14px; height: 14px; }

.empty {
  padding: var(--s5) var(--s4);
  text-align: center;
  font-size: 12.5px;
  color: var(--t3);
}

/* -------------------------------------------------------------- history */

.hrow {
  display: grid; grid-template-columns: 1fr auto;
  gap: var(--s3); align-items: baseline;
  padding: var(--s2) var(--s3);
  border-radius: var(--r1);
}
.hrow:hover { background: rgba(255, 255, 255, .04); }
.hrow .t { font-size: 13px; font-weight: 520; }
.hrow .a { font-size: 11.5px; color: var(--t3); }
.hrow .w { font-size: 11px; color: var(--t3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- scenes */

.scenes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
@media (max-width: 400px) { .scenes { grid-template-columns: repeat(3, 1fr); } }

.scene {
  display: grid; gap: 6px; justify-items: center;
  padding: var(--s3) var(--s1) 9px;
  border-radius: var(--r1);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--t2);
  transition: background .15s, border-color .15s, color .15s;
}
.scene:hover { background: rgba(255, 255, 255, .08); color: var(--t1); }
.scene[aria-pressed='true'] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.scene svg { width: 18px; height: 18px; }
.scene span { font-size: 10.5px; letter-spacing: .01em; }

/* -------------------------------------------------------------- sliders */

.slider { display: grid; gap: 5px; }
.slider label {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: var(--t2);
}
.slider .val { color: var(--t3); font-variant-numeric: tabular-nums; }

.seg {
  display: flex; flex: none;
  border: 1px solid var(--line-2);
  border-radius: var(--rf);
  overflow: hidden;
}
.seg button {
  padding: 6px 12px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--t3);
  border-right: 1px solid var(--line-2);
  transition: background .15s, color .15s;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--t1); }
.seg button[aria-pressed='true'] { background: var(--t1); color: #05050a; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }

/* ------------------------------------------------------------- featured */

.feat {
  display: grid; grid-template-columns: 44px 1fr; gap: var(--s3);
  align-items: center;
  padding: var(--s3);
  border-radius: var(--r2);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: inherit; text-decoration: none;
}
.feat img, .feat .ph {
  width: 44px; height: 44px;
  border-radius: var(--r1);
  object-fit: cover;
  background: rgba(255, 255, 255, .08);
  display: grid; place-items: center;
  color: var(--accent);
}
.feat .badge {
  font-size: 9.5px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--accent);
}
.feat .nm { font-size: 14px; font-weight: 600; margin-top: 1px; }
.feat .tg { font-size: 11.5px; color: var(--t2); }

/* ---------------------------------------------------------------- forms */

form { display: grid; gap: var(--s3); }
.field { display: grid; gap: 5px; }
.field label { font-size: 12px; color: var(--t2); }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 38px;
  padding: 9px var(--s3);
  border-radius: var(--r1);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  font-size: 13.5px;
  transition: border-color .15s, background .15s;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--line-2); background: rgba(255, 255, 255, .07);
}
.field select option { background: var(--surface-2); }

.btn {
  height: 40px; padding: 0 var(--s5);
  border-radius: var(--rf);
  background: #fff; color: #000;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  transition: opacity .15s, transform .1s;
}
.btn:hover { opacity: .88; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-lg { height: 48px; padding: 0 var(--s6); font-size: 12.5px; }

.note, .form-note { font-size: 12px; line-height: 1.55; color: var(--t3); }
.note {
  padding: var(--s3);
  border-radius: var(--r1);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
}

/* --------------------------------------------------------------- toasts */

#toasts {
  position: fixed;
  left: 50%; top: calc(var(--edge-t) + 46px);
  transform: translateX(-50%);
  z-index: 40;
  display: grid; gap: 6px; justify-items: center;
  pointer-events: none;
  width: max-content; max-width: min(92vw, 420px);
}
.toast {
  padding: 8px 14px;
  border-radius: var(--rf);
  border: 1px solid var(--line-2);
  background: rgba(20, 20, 24, .95);
  backdrop-filter: blur(12px);
  font-size: 12.5px;
  text-align: center;
  animation: toast .25s var(--ease);
}
.toast.warn { border-color: rgba(255, 190, 110, .4); color: #ffd9a8; }
@keyframes toast {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* ----------------------------------------------------------------- home */

#home {
  position: fixed; inset: 0; z-index: 60;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255,255,255,.04), transparent 58%),
    rgba(0, 0, 0, .86);
  transition: opacity .55s var(--ease), visibility .55s;
}

/* The player chrome must not read through the landing page. It is still in
   the DOM and still bound, it simply has nothing to say until audio starts. */
body.home #app { opacity: 0; pointer-events: none; }
body.home #app, body #app { transition: opacity .5s var(--ease); }
#home.gone { opacity: 0; visibility: hidden; }

.home-inner {
  min-height: 100%;
  display: grid;
  align-content: start;
  gap: var(--s6);
  max-width: 660px;
  margin: 0 auto;
  padding: var(--edge-t) var(--edge-r) calc(var(--edge-b) + var(--s6)) var(--edge);
}

.home-top { display: flex; align-items: center; gap: var(--s3); padding-top: var(--s2); }
.home-top .wm-mark { width: 54px; height: 27px; }
.home-top .wm-text { font-size: 22px; }
.home-top .pill { margin-left: auto; }

.home-hero { display: grid; justify-items: start; gap: var(--s3); }
.home-title {
  font-size: clamp(30px, 7vw, 52px);
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.02;
}
.home-lede {
  font-size: clamp(14px, 2.3vw, 16.5px);
  line-height: 1.55;
  color: var(--t2);
  max-width: 44ch;
}
.home-lede b { color: var(--t1); font-weight: 600; }
.home-hero .btn { margin-top: var(--s2); }

.resume {
  display: grid; gap: 1px; text-align: left;
  padding: 10px var(--s4);
  border-radius: var(--r2);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  transition: background .15s, border-color .15s;
}
.resume:hover { background: rgba(255, 255, 255, .09); border-color: var(--line-2); }
.resume-label { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--t3); }
.resume-name { font-size: 14px; font-weight: 600; }
.home-stats { font-size: 12px; color: var(--t3); }

.home-block { display: grid; gap: var(--s3); }
.home-label {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--t3);
}

.home-now { display: grid; gap: 1px; }
.nowrow {
  display: grid;
  grid-template-columns: minmax(84px, 24%) 1fr 20px;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 46px;
  padding: 9px var(--s3);
  border-radius: var(--r1);
  text-align: left;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.nowrow:hover { background: rgba(255, 255, 255, .06); border-color: var(--line); }
.nowrow-station {
  font-size: 12px; font-weight: 600; color: var(--accent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nowrow-track {
  font-size: 13.5px; color: var(--t3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nowrow-track.live { color: var(--t1); }
.nowrow-go { color: var(--t3); opacity: 0; transition: opacity .15s; }
.nowrow:hover .nowrow-go { opacity: 1; }

.home-moods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (max-width: 620px) { .home-moods { grid-template-columns: repeat(2, 1fr); } }
.mood {
  display: grid; gap: 3px; align-content: start;
  text-align: left; min-height: 74px;
  padding: var(--s3);
  border-radius: var(--r2);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .035);
  transition: background .15s, border-color .15s, transform .15s var(--ease);
}
.mood:hover { background: rgba(255, 255, 255, .09); border-color: var(--line-2); transform: translateY(-2px); }
.mood:active { transform: translateY(0); }
.mood-label { font-size: 14px; font-weight: 600; }
.mood-note { font-size: 11.5px; color: var(--t3); line-height: 1.35; }

.home-foot {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4);
  font-size: 11.5px; color: var(--t3);
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
}

.swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch {
  width: 30px; height: 30px;
  border-radius: var(--rf);
  border: 1px solid var(--line-2);
  position: relative;
  transition: transform .14s var(--ease), border-color .14s;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-pressed='true'] {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .22);
}
.swatch.auto {
  background: conic-gradient(from 0deg,
    hsl(0 80% 60%), hsl(60 80% 60%), hsl(120 80% 60%),
    hsl(180 80% 60%), hsl(240 80% 60%), hsl(300 80% 60%), hsl(360 80% 60%));
}
.swatch.auto::after {
  content: '';
  position: absolute; inset: 7px;
  border-radius: 1px;
  background: var(--surface);
}

.confirm {
  display: grid; gap: var(--s3);
  padding: var(--s3);
  border-radius: var(--r2);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
}
.confirm p { font-size: 12.5px; line-height: 1.55; color: var(--t2); }
.confirm-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.confirm .btn { height: 34px; font-size: 13px; }

/* ------------------------------------------------------------ discovery */

.seg-wide { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.seg-wide button { text-align: center; }

.disc-row { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s3); }
.disc-ic { width: 15px; height: 15px; color: var(--t3); flex: none; }
#country-select {
  flex: 1; height: 36px; padding: 0 var(--s3);
  border-radius: var(--r1);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04);
  font-size: 13px;
}
#country-select option { background: var(--surface-2); }
.disc-note { font-size: 11.5px; line-height: 1.5; color: var(--t3); margin-top: var(--s2); }

/* -------------------------------------------------------------- palette */

.palette-scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .62); }
.palette {
  position: fixed; z-index: 71;
  top: 12vh; left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - var(--s5) * 2));
  max-height: 70vh;
  display: flex; flex-direction: column;
  border-radius: var(--r3);
  border: 1px solid var(--line-2);
  background: var(--surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
  overflow: hidden;
  animation: pop .18s var(--ease);
}
@keyframes pop {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(.98); }
  to   { opacity: 1; transform: translateX(-50%); }
}
.palette-field {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
  flex: none;
}
.palette-ic { width: 16px; height: 16px; color: var(--t3); flex: none; }
.palette-field input { flex: 1; border: 0; background: none; font-size: 15px; outline: none; }
.palette-field kbd {
  font: inherit; font-size: 10px;
  padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--line-2); color: var(--t3);
}
.palette-results { overflow-y: auto; padding: 6px; }
.pal {
  display: flex; align-items: center; gap: var(--s3);
  width: 100%; padding: 9px var(--s3);
  border-radius: var(--r1); text-align: left;
}
.pal[aria-selected='true'] { background: rgba(255, 255, 255, .09); }
.pal-name { font-size: 13.5px; font-weight: 520; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-meta { font-size: 11.5px; color: var(--t3); margin-left: auto; white-space: nowrap; }
.pal-kind {
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); width: 48px; flex: none;
}

/* ------------------------------------------------------------------ zen */

/*
 * Zen is its own place, not the music screen with extras bolted on. The
 * track steps back to a quiet credit, the beat furniture disappears, and
 * the breathing prompt becomes the thing you are looking at.
 */
body.zen .np-tags,
body.zen .reacts,
body.zen #btn-mix,
body.zen #btn-roulette { display: none; }

/* The DJ steps away in Zen. */
body.zen #stage-dj { opacity: 0 !important; }

body.zen .np-title {
  font-size: clamp(13px, 1.6vw, 15px);
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--t3);
  order: 2;
  margin-top: var(--s4);
}
body.zen .np-sub { display: none; }
body.zen .np { display: flex; flex-direction: column; align-items: center; }

body.zen .breath {
  order: 1;
  margin: 0;
  font-size: clamp(22px, 4.2vw, 40px);
  font-weight: 300;
  letter-spacing: .34em;
  text-indent: .34em;
  text-transform: uppercase;
  color: var(--t1);
  opacity: .92;
  transition: opacity 1.1s var(--ease);
}

.zen-nature {
  order: 3;
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: .75;
}

/* With no breathing guide running, the station name stays the headline. */
body.zen.no-breath .np-title {
  font-size: clamp(20px, 3.4vw, 30px);
  font-weight: 600;
  color: var(--t1);
  order: 1;
  margin-top: 0;
}

/* ------------------------------------------------------------- car mode */

/*
 * Built for a glance, not for reading. Three targets, each enormous, high
 * contrast, and placed where a thumb reaches. No station list, no settings,
 * nothing that needs a second look away from the road.
 */
#car {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--s4);
  padding: var(--edge-t) var(--edge-r) var(--edge-b) var(--edge);
  background: #000;
}
#car[hidden] { display: none; }

.car-top { display: flex; align-items: center; justify-content: space-between; }
.car-brand { font-size: 15px; font-weight: 700; letter-spacing: -.02em; color: var(--t3); }
.car-brand b { color: var(--brand-cyan); }
.car-exit {
  height: 44px; padding: 0 var(--s4);
  border: 1px solid var(--line-2);
  border-radius: var(--rf);
  font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--t2);
}

.car-now {
  display: grid; align-content: center; justify-items: center;
  text-align: center; gap: var(--s3);
  min-height: 0;
}
.car-station {
  font-size: clamp(30px, 7vw, 62px);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.04;
  text-wrap: balance;
}
.car-track {
  font-size: clamp(15px, 2.6vw, 22px);
  color: var(--accent);
  text-wrap: balance;
}

.car-controls {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: var(--s3);
  align-items: stretch;
}
.car-btn {
  display: grid; place-items: center;
  min-height: clamp(96px, 20vh, 150px);
  border: 1px solid var(--line-2);
  border-radius: var(--r3);
  background: rgba(255, 255, 255, .05);
  color: var(--t1);
}
.car-btn:active { background: rgba(255, 255, 255, .16); }
.car-btn svg { width: 38px; height: 38px; }
.car-play { background: #fff; color: #000; border-color: #fff; }
.car-play:active { background: #d6d6dd; }
.car-play svg { width: 46px; height: 46px; }

/* ------------------------------------------------------ ambient + kids */

/* Ambient hides every control. Moving the pointer or touching brings the
   chrome back for a few seconds, so it is never a trap. */
body.ambient .topbar,
body.ambient .dock,
body.ambient .np-tags { opacity: 0; pointer-events: none; transition: opacity .5s var(--ease); }
body.ambient.awake .topbar,
body.ambient.awake .dock,
body.ambient.awake .np-tags { opacity: 1; pointer-events: auto; }
body.ambient { cursor: none; }
body.ambient.awake { cursor: auto; }

/* Kids mode: fewer, larger targets. */
body.kids .np-title { font-size: clamp(24px, 5vw, 40px); }
body.kids .bar { height: 76px; }
body.kids .play { width: 54px; height: 54px; }
body.kids .play svg { width: 22px; height: 22px; }
body.kids .ib { width: 46px; height: 46px; }
body.kids .ib svg { width: 22px; height: 22px; }
body.kids .reacts { display: none; }
body.kids .row { min-height: 58px; }
body.kids .row-name { font-size: 15px; }
body.kids #btn-mix, body.kids #btn-share, body.kids #btn-shot { display: none; }


/* ------------------------------------------------------------- mobile */

/*
 * Everything below exists because a phone is the primary device for this,
 * not an afterthought. Touch targets are at least 44px, nothing depends on
 * hover, and the panel can be thrown away with a swipe.
 */

@media (pointer: coarse) {
  /* Hover styling on a touch device sticks after a tap and looks broken. */
  .ib:hover, .chip:hover, .row:hover, .fav:hover,
  .reacts button:hover, .scene:hover, .tabs button:hover,
  button.pill:hover, .link:hover, .hrow:hover {
    background: inherit;
    color: inherit;
  }
  .row:active { background: rgba(255, 255, 255, .09); }
  .chip:active, .scene:active { background: rgba(255, 255, 255, .12); }

  .row:active { background: rgba(255, 255, 255, .09); }
  .chip { height: 34px; padding: 0 14px; }
  .scene { padding: var(--s4) var(--s1) var(--s3); }
  .tabs button { height: 36px; }
  .seg button { padding: 8px 13px; }
  input[type='range'] { height: 32px; }
  input[type='range']::-webkit-slider-thumb { width: 15px; height: 15px; margin-top: -6px; }
  input[type='range']::-moz-range-thumb { width: 15px; height: 15px; }
}

/*
 * Comfortable hit areas, applied unconditionally.
 *
 * This used to sit behind @media (pointer: coarse), which was a mistake:
 * hybrid laptops report both pointer types and some mobile browsers report
 * fine, so the phones that needed it most were the ones missing out. The
 * visual box stays small and the touchable box is grown with a pseudo
 * element, so no layout moves and a mouse user simply gets a target that is
 * easier to hit.
 */
.ib, .fav, .reacts button, .tabs button, .seg button, .play { position: relative; }

.ib::after, .reacts button::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 44px; height: 44px;
  transform: translate(-50%, -50%);
}

/* The favourite sits next to the row's own button, so its target is kept to
   40px: any larger and it would start swallowing taps meant for the row. */
.fav::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  width: 40px; height: 40px;
  transform: translate(-50%, -50%);
}

.row { min-height: 48px; }

/* The chrome should never be selectable or long-press-callout-able. */
.topbar, .dock, .panel-head, .tabs, .wordmark, .bar-info, .np-tags {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Swipe-to-dismiss. The panel is dragged by transform while the finger is
   down, so the transition is suppressed to stop it fighting the gesture. */
.panel.dragging { transition: none; }

/* ----------------------------------------------------------- responsive */

@media (max-width: 879px) {
  /* iOS routes volume to the hardware buttons and ignores the API, so the
     slider would be a dead control. */
  .vol { display: none; }
  .np { padding-bottom: var(--s2); }

  .dock { gap: 6px; }
  .reacts { gap: 2px; }
}

@media (max-width: 560px) {
  :root { --edge: max(12px, env(safe-area-inset-left)); --edge-r: max(12px, env(safe-area-inset-right)); }
  .sm-hide { display: none; }

  .bar { height: 62px; gap: var(--s2); padding: 0 10px; border-radius: var(--r3); }
  .play { width: 42px; height: 42px; }
  .play svg { width: 17px; height: 17px; }
  .ib { width: 38px; height: 38px; }
  .ib svg { width: 19px; height: 19px; }
  .bar-name { font-size: 13px; }
  .bar-sub { font-size: 11px; }

  .wm-mark { width: 32px; height: 16px; }
  .wm-text { font-size: 15px; }
  .pill { height: 28px; padding: 0 10px; font-size: 11.5px; }

  .panel-head { padding: var(--s3) var(--s4) var(--s2); }
  .tabs { margin: 0 var(--s4) var(--s3); }
  .panel-body { padding: 0 var(--s4) var(--s6); }
  .tabpanel { gap: var(--s4); }

  .np-title { font-size: 21px; }
  .np-sub { font-size: 13px; }

  .reacts button { width: 38px; height: 32px; }
  .reacts svg { width: 16px; height: 16px; }

  /* Taller than wide-screen so there is room to aim, and the nodes are
     bigger because a fingertip is not a mouse pointer. */
  .pad { aspect-ratio: 1 / 1; }
  .pad-node { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; }
  .pad-hint { min-height: 2.4em; font-size: 12.5px; }
}

/* Very narrow phones: drop the shuffle button so the station name survives. */
@media (max-width: 370px) {
  #btn-roulette { display: none; }
  .bar { gap: 6px; }
}

/* Short landscape phones: the now-playing block must not collide with the dock. */
@media (max-height: 520px) {
  .np-tags, .breath { display: none; }
  .np-title { font-size: 18px; }
  .np-sub { display: none; }
  .reacts { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
