/* Listen player (tech/listen.js). Everything is scoped under .lsn so it never leaks into the page.
   The draft page's own language: a big rounded panel, the picture on a softly lit plinth, Manrope,
   each plugin in its accent. Teal means buy, so play controls are white, with the accent kept for
   fine detail (the slider fill, the chosen chip, the glow). */

@property --lsn-accent {
  syntax: '<color>';
  inherits: true;
  initial-value: #4fd1c5;
}

.lsn {
  --lsn-accent: #4fd1c5;
  --lsn-panel: #0e1217;
  --lsn-panel-2: #141a22;
  --lsn-line: #1d252f;
  --lsn-line-hi: #2b3644;
  --lsn-text: #f4f6f9;
  --lsn-text-2: #b9c3cf;
  --lsn-muted: #7d8a99;
  --lsn-ink: #07090c;
  --lsn-sans: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --lsn-label: 'Outfit', 'Manrope', sans-serif;
  position: relative;
  padding: 8px;
  background: var(--lsn-panel);
  border: 1px solid var(--lsn-line);
  border-radius: 36px;
  color: var(--lsn-text);
  font-family: var(--lsn-sans);
  text-align: left;
  transition: --lsn-accent .6s ease;
}
.lsn *, .lsn *::before, .lsn *::after { box-sizing: border-box; }
.lsn p { margin: 0; }
.lsn [hidden] { display: none !important; }

/* ---------- The picture ---------- */
.lsn-screen {
  position: relative;
  height: clamp(260px, 36vw, 520px);
  border-radius: 30px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse 62% 70% at 50% 108%, color-mix(in srgb, var(--lsn-accent) 20%, transparent), transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 38%, rgba(122, 168, 245, 0.045), transparent 70%),
    linear-gradient(180deg, #121821 0%, #0a0e13 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.lsn-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.lsn-axes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease .4s;
}
.lsn.is-gl .lsn-axes { opacity: 1; }
.lsn-tick {
  position: absolute;
  left: 0;
  top: 0;
  font: 500 11px/1 var(--lsn-label);
  letter-spacing: 0.06em;
  color: var(--lsn-muted);
  white-space: nowrap;
  will-change: transform;
}
.lsn-tick-t { opacity: 0.75; }

/* Plugin tabs, over the top left of the picture */
.lsn-tabs {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: 18px;
  background: rgba(7, 9, 12, 0.62);
  border: 1px solid rgba(43, 54, 68, 0.75);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.lsn-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 18px 0 7px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--lsn-text-2);
  font: 700 15px/1 var(--lsn-sans);
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.lsn-tab img { width: 32px; height: 32px; display: block; flex: none; }
.lsn-tab:hover { color: var(--lsn-text); background: rgba(255, 255, 255, 0.04); }
.lsn-tab[aria-pressed="true"] {
  color: var(--lsn-text);
  background: rgba(255, 255, 255, 0.085);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lsn-tab-accent, #fff) 26%, transparent);
}

/* Measured from the impulse response, over the top right of the picture */
.lsn-read {
  position: absolute;
  top: 24px;
  right: 30px;
  z-index: 2;
  display: flex;
  gap: 34px;
  margin: 0;
  text-align: right;
}
.lsn-read div { min-width: 64px; }
/* With the product tabs across the top, the readouts sit just under them instead of on top. */
.lsn-multi .lsn-read { top: 100px; }
.lsn-read dt {
  font: 600 11px/1 var(--lsn-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lsn-muted);
}
.lsn-read dd {
  margin: 9px 0 0;
  font: 700 24px/1 var(--lsn-sans);
  letter-spacing: -0.03em;
  color: var(--lsn-text);
  font-variant-numeric: tabular-nums;
}

/* What the picture shows, for screen readers. */
.lsn-caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- The deck under the picture ---------- */
.lsn-deck {
  display: grid;
  gap: 26px;
  padding: 26px 24px 24px;
}
.lsn-head {
  display: flex;
  align-items: center;
  gap: 22px;
}
.lsn-now { flex: 1 1 auto; min-width: 0; }
.lsn-name {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--lsn-text);
}
.lsn-pname-letter, .lsn-pname-all { color: var(--lsn-accent); }
.lsn-status {
  margin-top: 9px !important;
  font-size: 16px;
  line-height: 1.4;
  color: var(--lsn-text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Play: a big white circle. Loading turns a thin arc round it; playing shows stop and a soft halo
   that breathes with the level. */
.lsn-play {
  --lsn-level: 0;
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--lsn-text);
  color: var(--lsn-ink);
  cursor: pointer;
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.45),
    0 0 0 calc(var(--lsn-level) * 9px) color-mix(in srgb, var(--lsn-accent) 20%, transparent);
  transition: transform .2s ease, background .2s ease;
}
.lsn-play:hover { transform: scale(1.04); }
.lsn-play:active { transform: scale(0.97); }
.lsn-play:disabled { cursor: default; opacity: 0.45; transform: none; }
.lsn-ico { grid-area: 1 / 1; width: 30px; height: 30px; fill: currentColor; transition: opacity .15s, transform .2s; }
.lsn-ico-play { transform: translateX(2px); }
.lsn-ico-stop { opacity: 0; transform: scale(0.6); }
.lsn-play.is-playing .lsn-ico-play,
.lsn-play.is-loading .lsn-ico-play { opacity: 0; transform: translateX(2px) scale(0.6); }
.lsn-play.is-playing .lsn-ico-stop,
.lsn-play.is-loading .lsn-ico-stop { opacity: 1; transform: none; }
.lsn-ring {
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  border: 2px solid transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.lsn-play.is-loading .lsn-ring {
  opacity: 1;
  border-top-color: var(--lsn-accent);
  border-right-color: color-mix(in srgb, var(--lsn-accent) 35%, transparent);
  animation: lsn-spin .9s linear infinite;
}
@keyframes lsn-spin { to { transform: rotate(360deg); } }

/* Dry | processed, and the mix */
.lsn-ctrl {
  display: flex;
  align-items: center;
  gap: 26px;
  flex: none;
}
.lsn-ab {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 4px;
  border-radius: 15px;
  background: var(--lsn-panel-2);
  border: 1px solid var(--lsn-line-hi);
}
.lsn-ab label { position: relative; display: block; cursor: pointer; }
.lsn-ab input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.lsn-ab span {
  display: block;
  min-width: 78px;
  padding: 12px 18px;
  border-radius: 11px;
  font: 700 15px/1 var(--lsn-sans);
  text-align: center;
  color: var(--lsn-text-2);
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.lsn-ab label:hover span { color: var(--lsn-text); }
.lsn-ab input:checked + span { background: var(--lsn-text); color: var(--lsn-ink); }
.lsn-ab input:focus-visible + span { outline: 2px solid var(--lsn-text); outline-offset: 3px; }

.lsn-mix {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--lsn-text-2);
}
.lsn-mix-out {
  min-width: 40px;
  font-variant-numeric: tabular-nums;
  color: var(--lsn-text);
}
.lsn-mix input {
  --lsn-fill: 50%;
  width: 150px;
  height: 28px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.lsn-mix input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--lsn-accent) var(--lsn-fill), var(--lsn-line-hi) var(--lsn-fill));
}
.lsn-mix input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: 0;
  border-radius: 50%;
  background: var(--lsn-text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}
.lsn-mix input::-moz-range-track { height: 4px; border-radius: 2px; background: var(--lsn-line-hi); }
.lsn-mix input::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--lsn-accent); }
.lsn-mix input::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--lsn-text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}
.lsn-mix input:focus-visible { outline: 2px solid var(--lsn-text); outline-offset: 6px; border-radius: 6px; }

/* Choices: sounds, rooms, presets */
.lsn-groups {
  display: grid;
  gap: 14px;
  padding-top: 24px;
  border-top: 1px solid var(--lsn-line);
}
.lsn-groups:empty { display: none; }
.lsn-group {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}
.lsn-label {
  padding-top: 15px;
  font: 600 11px/1 var(--lsn-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lsn-muted);
}
.lsn-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.lsn-chip { position: relative; display: block; cursor: pointer; }
.lsn-chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.lsn-chip-box {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid var(--lsn-line-hi);
  background: rgba(255, 255, 255, 0.015);
  color: var(--lsn-text-2);
  transition: border-color .18s, background .18s, color .18s;
}
.lsn-chip-box b { font-size: 14px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.lsn-chip-box small { font-size: 12px; font-weight: 500; line-height: 1.2; color: var(--lsn-muted); white-space: nowrap; }
.lsn-chip:hover .lsn-chip-box { border-color: var(--lsn-text-2); color: var(--lsn-text); }
.lsn-chip input:checked + .lsn-chip-box {
  color: var(--lsn-text);
  border-color: color-mix(in srgb, var(--lsn-accent) 60%, var(--lsn-line-hi));
  background: color-mix(in srgb, var(--lsn-accent) 12%, transparent);
}
.lsn-chip input:checked + .lsn-chip-box small { color: color-mix(in srgb, var(--lsn-accent) 55%, var(--lsn-text-2)); }
.lsn-chip input:focus-visible + .lsn-chip-box { outline: 2px solid var(--lsn-text); outline-offset: 3px; }
.lsn-chip-spin {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  opacity: 0;
  transition: opacity .2s;
}
.lsn-chip.is-loading .lsn-chip-spin {
  opacity: 1;
  border-top-color: var(--lsn-accent);
  border-right-color: var(--lsn-accent);
  animation: lsn-spin .8s linear infinite;
}

.lsn-tab:focus-visible,
.lsn-play:focus-visible { outline: 2px solid var(--lsn-text); outline-offset: 4px; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1100px) {
  .lsn-head { flex-wrap: wrap; }
  .lsn-ctrl { flex: 1 1 100%; justify-content: space-between; }
}
@media (max-width: 760px) {
  .lsn-read { gap: 22px; }
  .lsn-read dd { font-size: 20px; }
}
@media (max-width: 640px) {
  .lsn { border-radius: 26px; padding: 6px; }
  .lsn-screen { height: clamp(240px, 64vw, 300px); border-radius: 21px; }
  .lsn-tabs { top: 10px; left: 10px; padding: 4px; border-radius: 15px; }
  .lsn-tab { height: 40px; padding: 0 13px 0 5px; gap: 8px; font-size: 14px; border-radius: 11px; }
  .lsn-tab img { width: 28px; height: 28px; }
  .lsn-read { top: auto; bottom: 14px; left: 16px; right: 16px; justify-content: space-between; text-align: left; gap: 10px; }
  .lsn-read div { min-width: 0; }
  .lsn-read dt { font-size: 9.5px; letter-spacing: 0.12em; }
  .lsn-read dd { margin-top: 6px; font-size: 17px; }
  .lsn-tick { display: none; }
  .lsn-deck { gap: 20px; padding: 20px 12px 16px; }
  .lsn-head { gap: 16px; }
  .lsn-play { width: 64px; height: 64px; }
  .lsn-ico { width: 26px; height: 26px; }
  .lsn-name { font-size: 24px; }
  .lsn-status { font-size: 14px; white-space: normal; }
  .lsn-ctrl { gap: 14px; flex-wrap: wrap; }
  .lsn-ab { flex: 1 1 auto; }
  .lsn-ab span { min-width: 0; padding: 11px 12px; font-size: 14px; }
  .lsn-mix { flex: 1 1 100%; }
  .lsn-mix input { flex: 1; width: auto; }
  .lsn-groups { padding-top: 18px; gap: 16px; }
  .lsn-group { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .lsn-label { padding-top: 0; }
  /* Chips run sideways in their own row instead of stacking up the page. */
  .lsn-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -12px;
    padding: 2px 12px 6px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .lsn-chips::-webkit-scrollbar { display: none; }
  .lsn-chip { flex: none; scroll-snap-align: start; }
}

@media (prefers-reduced-motion: reduce) {
  .lsn, .lsn * { transition-duration: 0s !important; }
  .lsn-play.is-loading .lsn-ring { animation: none; border-right-color: var(--lsn-accent); }
  .lsn-chip.is-loading .lsn-chip-spin { animation: none; }
}

/* Each plugin's own 3D world (tech/shapes3d.js) in place of the waveform */
.lsn-world { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity .7s ease; }
.lsn-world.is-on { opacity: 1; }
.is-world .lsn-canvas { opacity: 0; transition: opacity .5s ease; }
