/* The live stage (livestage.js): a booth panel, colour does the talking. Genres keep
   one hue each in both themes; everything else follows the dashboard's tokens. */

:root {
  --g-urbankiz: #e0673a;
  --g-tarraxo: #c93d72;
  --g-tarraxinha: #8f5ad8;
  --g-ghettozouk: #3b8fd9;
  --g-zouk: #26a68a;
  --g-konpa: #d9a632;
  --g-afrobeats: #c9b02e;
  --g-kizomba: #b0703f;
  --g-other: #8a8b84;
  --stage-bg: #121412;
  --stage-ink: #ecebe4;
  --stage-grid: rgba(236, 235, 228, 0.18);
  --stage-planned: rgba(236, 235, 228, 0.04);
  /* the engine's moments on a record (livestage.js stageMarksPaint): hues no genre
     uses, so a mark never reads as a genre's colour; the stage is dark in both themes */
  --stage-pop: #f4e27a;
  --stage-ext: #b7a4ff;
  --stage-break: #7fe3f0;
}

.stage {
  container: stage / inline-size;
  --ink: var(--stage-ink);
  --ink-3: #8d8f86;
  background:
    radial-gradient(120% 140% at 12% -20%, rgba(226, 163, 77, 0.10), transparent 55%),
    linear-gradient(180deg, #161816, var(--stage-bg));
  color: var(--stage-ink);
  border-radius: 10px;
  padding: 14px 16px 12px;
  margin: 0 0 14px;
  display: grid;
  gap: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 8px 24px rgba(0, 0, 0, 0.18);
  animation: stage-in 0.45s ease-out both;
}
@keyframes stage-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* now strip */
.stage-now {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
}
.sn-swatch { align-self: stretch; border-radius: 3px; background: var(--g-other); box-shadow: 0 0 18px currentColor; transition: background 0.6s; }
.sn-main { min-width: 0; }
.sn-name { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-sub { display: flex; gap: 10px; align-items: center; color: var(--ink-3); font: 12px var(--mono); margin-top: 2px; white-space: nowrap; overflow: hidden; }
.sn-next { display: none; color: var(--accent); }
.sn-pips { display: inline-flex; gap: 3px; }
.sn-pips i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.sn-pips i.on { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.sn-bpm { font-family: var(--mono); text-align: right; line-height: 1; }
.sn-bpm b { font-size: 2rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.sn-bpm small { display: block; color: var(--ink-3); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.sn-meters { display: grid; gap: 6px; width: 170px; }
.sn-meter { display: grid; grid-template-columns: 40px minmax(0, 1fr) 36px; align-items: center; gap: 8px; font: 10px var(--mono); color: var(--ink-3); cursor: help; }
.sm-lab { letter-spacing: 0.08em; text-transform: uppercase; }
.sm-bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.sm-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.9s linear; }
.sm-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--stage-ink); }
.sn-lead .sm-bar i { background: #7fbf7a; }
.sn-lead.is-low .sm-bar i { background: var(--bad); }

/* flow */
.stage-flow { position: relative; }
.stage-flow { display: grid; gap: 6px; }
.flow-wrap { position: relative; }
.stage-flow .flow { width: 100%; height: 210px; display: block; cursor: crosshair; touch-action: pan-y; }
.flow-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fb-title { font: 600 10px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.fb-span { font: 11px var(--mono); color: var(--ink-3); margin-right: auto; }
.fb-zoom { display: inline-flex; gap: 4px; }
.fb-zoom button { font: 11px var(--mono); color: var(--ink-3); background: transparent; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 6px; padding: 3px 8px; cursor: pointer; min-width: 30px; }
.fb-zoom button:hover { color: var(--stage-ink); border-color: rgba(255, 255, 255, 0.35); }
.fb-zoom button.is-on { color: var(--stage-bg); background: var(--stage-ink); border-color: var(--stage-ink); }
.flow-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 11px; color: var(--ink-3); }
.lg { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.lg i { width: 12px; height: 9px; border-radius: 2px; display: inline-block; }
.lg-genre i { background: var(--c); }
.lg-played i { background: rgba(236, 235, 228, 0.28); }
.lg-ready i { background: var(--stage-ink); }
.lg-planned i { border: 1px solid var(--stage-ink); background: repeating-linear-gradient(135deg, rgba(236, 235, 228, 0.5) 0 2px, transparent 2px 5px); }
.lg-seam i { background: linear-gradient(90deg, var(--g-urbankiz), var(--g-ghettozouk)); clip-path: polygon(0 100%, 0 40%, 100% 0, 100% 100%); }
.lg-wave i { height: 0; border-top: 2px dashed var(--accent); }
.lg-edge i { width: 0; height: 11px; border-left: 1px dashed var(--ink-3); }
.lg-pop i { background: var(--stage-pop); }
.lg-ext i { height: 6px; background: transparent; border: 2px solid var(--stage-ext); border-bottom: 0; border-radius: 0; }
.lg-break i { width: 2px; height: 11px; background: var(--stage-break); }
.flow-tip .tip-marks { color: var(--stage-ink); }
.sn-marks { order: 0; display: inline-flex; gap: 4px; }
.sn-marks:empty { display: none; }
.sn-marks i { font: 700 10px var(--mono); font-style: normal; padding: 1px 5px; border-radius: 3px; color: var(--stage-bg); background: var(--stage-ink); }
.sn-marks .mk-pop { background: var(--stage-pop); }
.sn-marks .mk-ext { background: var(--stage-ext); }
.sn-marks .mk-break { background: var(--stage-break); }
.lg-sep { width: 1px; height: 12px; background: rgba(255, 255, 255, 0.15); }
.lg-hint { flex-basis: 100%; font-size: 10px; opacity: 0.8; }
.flow-tip {
  position: absolute; pointer-events: none; max-width: 240px;
  background: rgba(10, 11, 10, 0.92); border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px; padding: 6px 8px; font-size: 12px; display: grid; gap: 2px;
}
.flow-tip { max-width: min(460px, 94%); z-index: 5; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
.flow-tip span { font: 11px var(--mono); color: var(--ink-3); line-height: 1.45; }
.flow-tip .tip-time { font: 600 10px var(--mono); color: var(--accent); letter-spacing: 0.04em; }
.flow-tip .tip-pair { color: var(--stage-ink); font: 12px var(--sans); }
.flow-tip .tip-why { margin: 4px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--stage-ink); opacity: 0.85; }

/* knobs */
.stage-knobs { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 10px 18px; align-items: start; }
.kn-sliders { grid-row: span 2; }
.kn-genres, .kn-moods { grid-column: 2; }
.kn-sliders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; }
.kn { display: grid; grid-template-columns: 38px minmax(0, 1fr) 62px; align-items: center; gap: 8px 12px; }
.kn-ico { color: var(--ink-3); font: 600 9px var(--mono); letter-spacing: 0.08em; }
.kn-val { font: 11px var(--mono); color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.kn.is-target .kn-val, .kn.is-pending .kn-val { color: var(--accent); }
.kn-track { position: relative; height: 22px; display: flex; align-items: center; }
.kn-track input { width: 100%; margin: 0; accent-color: var(--accent); background: transparent; }
/* one-handle sliders (stageSlider): the track takes the pointer; the input draws its rail,
   the fill up to the thumb (--f, its value's fraction) and the thumb, as the interval knobs do */
.st-slide { --kn-thumb: 16px; touch-action: pan-y; cursor: pointer; }
.st-slide input {
  -webkit-appearance: none; appearance: none; pointer-events: none; width: 100%; height: var(--kn-thumb); margin: 0;
  background:
    linear-gradient(var(--accent), var(--accent)) 0 50% / calc(var(--kn-thumb) / 2 + (100% - var(--kn-thumb)) * var(--f, 0)) 4px no-repeat,
    linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16)) 0 50% / 100% 4px no-repeat;
}
.mx-track { position: relative; display: flex; align-items: center; height: 22px; min-width: 0; }
.kn-now {
  position: absolute; top: 2px; bottom: 2px; width: 2px; margin-left: -1px; pointer-events: none;
  background: var(--stage-ink); opacity: 0.55; border-radius: 1px;
}
/* interval knobs (tempo, energy): two handles on one rail, the chosen band between */
.kn-range { --kn-thumb: 16px; display: block; touch-action: pan-y; cursor: pointer; }
.kn-range > i { position: absolute; pointer-events: none; }
.kr-rail { left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: rgba(255, 255, 255, 0.12); }
.kr-band { top: 50%; height: 6px; margin-top: -3px; border-radius: 3px; background: var(--accent); opacity: 0.85; }
.kr-now { top: calc(50% + 6px); height: 2px; min-width: 2px; border-radius: 1px; background: var(--stage-ink); opacity: 0.5; }
/* where the wave asks now: a dot on the "plays now" line, under the handles' rail */
.kr-aim { top: calc(50% + 7px); width: 6px; height: 6px; margin: -2px 0 0 -3px; border-radius: 50%;
          background: var(--stage-ink); transition: left 1s linear; }
.kn-range input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: transparent;
  -webkit-appearance: none; appearance: none; pointer-events: none; z-index: 2;
}
.kn-range input::-webkit-slider-runnable-track, .st-slide input::-webkit-slider-runnable-track { background: transparent; border: 0; }
.kn-range input::-moz-range-track, .st-slide input::-moz-range-track { background: transparent; border: 0; }
.kn-range input::-webkit-slider-thumb, .st-slide input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: var(--kn-thumb); height: var(--kn-thumb); border-radius: 50%; background: var(--accent);
  border: 2px solid var(--stage-bg); box-shadow: 0 0 0 1px var(--accent);
}
.kn-range input::-moz-range-thumb, .st-slide input::-moz-range-thumb {
  box-sizing: border-box;
  width: var(--kn-thumb); height: var(--kn-thumb); border-radius: 50%; background: var(--accent);
  border: 2px solid var(--stage-bg); box-shadow: 0 0 0 1px var(--accent);
}
.kn-range input:focus-visible, .st-slide input:focus-visible { outline: none; }
.kn-range input:focus-visible::-webkit-slider-thumb, .st-slide input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--stage-ink); }
.kn-range input:focus-visible::-moz-range-thumb, .st-slide input:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--stage-ink); }
.kn-genres, .kn-moods { display: grid; gap: 6px; align-content: start; }
.gmix { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: rgba(255, 255, 255, 0.08); }
.gmix i { display: block; transition: flex 0.4s ease; }
.mixrows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; }
.mixrow { display: grid; grid-template-columns: 9px 84px minmax(0, 1fr) 34px; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); cursor: pointer; }
.mixrow i { width: 9px; height: 9px; border-radius: 50%; opacity: 0.4; }
.mixrow.is-on { color: var(--stage-ink); }
.mixrow.is-on i { opacity: 1; }
.mx-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx-pct { font: 11px var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.kn-go { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: flex-end; }
.kn-go .cmsg { color: var(--ink-3); font-size: 12px; margin-right: auto; order: -1; }
.kn-count { order: -2; color: var(--stage-ink); font: 11px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kn-count.is-low { color: var(--accent); }                       /* a pool this small runs dry */
.kn-dirty .kn-go {
  position: sticky; bottom: 0; z-index: 5; margin-inline: -12px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--stage-bg) 92%, transparent); backdrop-filter: blur(6px);
  border-top: 1px solid rgba(226, 163, 77, 0.35); box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.35);
}
.kn-glide { display: inline-flex; gap: 3px; margin-right: 6px; }
.kn-glide i { width: 14px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); }
.kn-glide i.on { background: var(--accent); }
.stage .solid { background: var(--accent); color: #1a1208; border: 0; padding: 6px 16px; font-size: 13px; }
.stage .kn-go .ghost { padding: 5px 12px; font-size: 12px; }
/* "go now": the override beside apply, outlined so apply stays the usual step */
.stage .kn-gonow { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); white-space: nowrap; }
.stage .kn-gonow:disabled { opacity: 0.5; }
.stage .ghost { color: var(--stage-ink); border-color: rgba(255, 255, 255, 0.18); }

/* the rest of the live band folds away under the stage */
.livemore > summary { cursor: pointer; color: var(--ink-3); font-size: 12px; padding: 4px 0; }

@media (max-width: 760px) {
  .stage { padding: 12px; }
  .stage-now { grid-template-columns: 5px minmax(0, 1fr) auto; }
  .sn-meters { grid-column: 2 / -1; grid-row: 2; width: auto; grid-template-columns: 1fr 1fr; gap: 12px; }
  .stage-knobs, .kn-sliders, .mixrows { grid-template-columns: minmax(0, 1fr); }
  .kn-genres, .kn-moods { grid-column: 1; }
  .stage-flow .flow { height: 180px; }
  .lg-hint { display: none; }
}

/* by the stage's own width: beside the knobs the mixes left a tablet's sliders 0-40 px
   of track (KIZ-28), so below a desktop's width the mixes go under the knobs */
@container stage (max-width: 1100px) {
  .stage-knobs { grid-template-columns: minmax(0, 1fr); }
  .kn-sliders { grid-row: auto; }
  .kn-genres, .kn-moods { grid-column: 1; }
}
@container stage (max-width: 620px) {
  .kn-sliders, .mixrows { grid-template-columns: minmax(0, 1fr); }
}

/* touch: every control at least 44 px tall, the slider thumbs big enough for a thumb */
@media (pointer: coarse) {
  .mixrow { min-height: 44px; }
  .kn-track, .mx-track { height: 44px; }
  .kn-range, .st-slide { --kn-thumb: 26px; }
  .sn-skip, .sn-btn, .sn-when, .fb-zoom button, .fb-party, .stage .kn-go button { min-height: 44px; }
  .fb-zoom button { min-width: 44px; }
}
.sn-genre { order: 0; } .sn-next { order: 1; } .sn-key { order: 2; } .sn-pips { order: 3; }

.sn-skip {
  font: 600 12px var(--sans); letter-spacing: 0.02em; padding: 9px 14px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--stage-ink); border: 1px solid rgba(255, 255, 255, 0.22);
  transition: background 0.2s, border-color 0.2s;
}
.sn-skip:hover { border-color: var(--accent); color: var(--accent); }
.sn-skip.is-busy { opacity: 0.6; animation: skip-pulse 1.2s ease-in-out infinite; }
@keyframes skip-pulse { 50% { border-color: var(--accent); } }
/* the note keeps its line whether it says something or not, and the help floats over
   it: both used to come and go inside the layout and pushed the stage down */
.stage-now { position: relative; }
.sn-note { grid-column: 2 / -1; font: 12px var(--mono); color: var(--ink-3); margin-top: -4px; min-height: 1.5em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sn-note[hidden] { display: block; visibility: hidden; }
.sn-help {
  position: absolute; left: 20px; right: 0; top: calc(100% - 4px); z-index: 6; font-size: 12px; line-height: 1.4; color: var(--stage-ink);
  background: rgba(10, 11, 10, 0.95); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 6px; padding: 6px 9px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.sn-note.is-set { color: var(--accent); }
@media (max-width: 760px) {
  .stage-now { grid-template-columns: 5px minmax(0, 1fr) auto auto; }
  .sn-skip { padding: 10px 12px; min-height: 44px; }
  /* the name keeps two lines: one line of 97 px showed "Júnior N…" */
  .sn-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 1.05rem; line-height: 1.2; }
}

/* phones: the live view runs edge to edge (the page, its pane and the live band each
   added 16-20 px a side and left the stage 277 px of a 393 px screen), and a live run's
   pane comes first, above the compose box and the run list (the stage sat 1200 px down) */
@media (max-width: 760px) {
  main:has(.djlive) { display: flex; flex-direction: column; }
  main:has(.djlive) > .pane:has(.djlive) { order: -1; }
  .djlive { padding-inline: 0; margin-inline: -36px; }   /* main 16 px + pane 20 px */
  .djlive > :not(.stage) { margin-inline: 12px; max-width: calc(100% - 24px); box-sizing: border-box; }
  .djlive .stage { border-radius: 0; margin-inline: 0; }
}

/* the knobs' help line */
.kn-help { grid-column: 1 / -1; font-size: 12px; line-height: 1.4; color: var(--ink-3); min-height: 2.8em; }
.kn-help.is-on { color: var(--stage-ink); }

/* the live bar (live.js): the stream's transport above the stage */
.livebar {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px;
  background: #161816; color: var(--stage-ink); border-radius: 10px; padding: 8px 14px; margin: 0 0 8px;
}
.livebar button { background: transparent; color: var(--stage-ink); border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px; cursor: pointer; }
.livebar .lb-play { width: 40px; height: 40px; font-size: 14px; border-color: var(--accent); color: var(--accent); }
.livebar .lb-mute { width: 36px; height: 36px; font-size: 14px; flex: none; }
.lb-vol { display: inline-flex; align-items: center; gap: 6px; }
.lb-volume { width: 90px; accent-color: var(--accent); }
.livebar .lb-live { padding: 6px 12px; font-size: 12px; border-color: var(--accent); color: var(--accent); }
.lb-track { position: relative; height: 24px; cursor: pointer; }
.lb-track::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); }
.lb-fill { position: absolute; left: 0; top: 10px; height: 4px; border-radius: 2px; background: var(--accent); }
.lb-tip {
  position: absolute; bottom: calc(100% + 6px); transform: translateX(-50%); white-space: nowrap; pointer-events: none; z-index: 7;
  max-width: 60vw; overflow: hidden; text-overflow: ellipsis;
  background: rgba(10, 11, 10, 0.95); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 6px; padding: 4px 8px; font: 11px var(--mono); color: var(--stage-ink);
}
.lb-knob { position: absolute; top: 6px; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--stage-ink); pointer-events: none; }
.lb-state { font: 12px var(--mono); color: var(--ink-3, #8d8f86); min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }
.lb-state.is-live { color: #e25555; }
@media (max-width: 760px) {
  .djlive > .livebar { border-radius: 0; margin-inline: 0; max-width: none; }
  .livebar { gap: 8px; padding: 8px 12px; grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .lb-vol { grid-column: 1 / -1; }
  .lb-volume { flex: 1; width: auto; }
  .livebar .lb-play { width: 44px; height: 44px; }
}

/* the records the engine offers to go to next (dj_pick): one row of chips under the
   note, as wide as the strip; two columns on a phone */
.sn-picks { grid-column: 2 / -1; display: grid; gap: 6px; margin-top: -6px; }
.sn-picks[hidden] { display: none; }
/* one row per point of the chain: "next" out of the record playing, then "then after"
   each planned next record (session._chain_points) */
.sp-row { display: grid; grid-template-columns: 7.5em minmax(0, 1fr); align-items: start; gap: 10px; }
.sp-lab { font: 10px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding-top: 9px; min-width: 0; }
.sp-from { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--stage-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.sp-chip {
  display: grid; grid-template-columns: 4px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  text-align: left; padding: 6px 9px 6px 6px; border-radius: 6px; cursor: pointer; min-width: 0;
  background: rgba(255, 255, 255, 0.04); color: var(--stage-ink); border: 1px solid rgba(255, 255, 255, 0.12);
  transition: border-color 0.2s, background 0.2s;
}
.sp-chip:hover, .sp-chip:focus-visible, .sp-chip.is-armed { border-color: var(--accent); background: rgba(255, 255, 255, 0.08); }
.sp-chip.is-busy { animation: skip-pulse 1.2s ease-in-out infinite; }
.sp-chip:disabled { opacity: 0.55; cursor: default; }
.sp-sw { grid-row: 1 / 3; align-self: stretch; border-radius: 2px; background: var(--sw, var(--g-other)); }
.sp-name { font: 600 12px var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-meta { display: flex; justify-content: space-between; gap: 8px; font: 10px var(--mono); color: var(--ink-3); min-width: 0; }
.sp-info { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sp-when { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--accent); }
.sp-chk { white-space: nowrap; margin-left: auto; color: var(--ink-3); }
.sp-chk:empty { display: none; }
.sp-chip.is-smooth .sp-chk { color: var(--accent); }
@media (max-width: 760px) {
  .sn-picks { grid-column: 1 / -1; gap: 8px; }
  .sp-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .sp-lab { padding-top: 0; }
  .sp-from { display: inline; }
  /* one strip per row, swiped sideways: two columns of eleven chips took the screen */
  .sp-chips { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 46%; overflow-x: auto;
              scroll-snap-type: x proximity; padding-bottom: 4px; overscroll-behavior-x: contain; }
  .sp-chip { scroll-snap-align: start; }
  .sp-chip { min-height: 44px; }
}

/* planned knob changes: what the knobs set (now, or a change later), and its time and glide */
.kn-plan { grid-column: 1 / -1; display: grid; gap: 6px; }
.kp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.kp-chip { font: 11px var(--mono); padding: 5px 10px; border-radius: 999px; cursor: pointer; background: transparent;
           color: var(--stage-ink); border: 1px solid rgba(255, 255, 255, 0.16); max-width: 100%; white-space: nowrap;
           overflow: hidden; text-overflow: ellipsis; }
.kp-chip.is-on { border-color: var(--accent); color: var(--accent); background: rgba(255, 255, 255, 0.06); }
.kp-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font: 12px var(--mono); color: var(--ink-3); }
.kp-edit[hidden] { display: none; }
.kp-edit .kin { width: 5.5em; padding: 3px 6px; }
.stage-knobs.is-planning .kn-sliders, .stage-knobs.is-planning .kn-genres, .stage-knobs.is-planning .kn-moods {
  outline: 1px dashed var(--accent); outline-offset: 4px; border-radius: 6px; }
@media (pointer: coarse) { .kp-chip { min-height: 44px; min-width: 44px; } }

/* knob presets: pick one (its values go on the knobs, unsent), save, rename, overwrite, delete */
.kn-presets { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.kpr-head { color: var(--ink-3); font: 600 9px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.stage .kpr-pick { flex: 1 1 12em; min-width: 0; max-width: 22em; min-height: 0; padding: 4px 8px; font: 12px var(--mono);
  color: var(--stage-ink); background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.16); }
.kpr-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.stage .kn-presets .ghost { min-height: 0; padding: 4px 10px; font-size: 12px; }
.kpr-msg { flex: 1 1 100%; color: var(--ink-3); font-size: 12px; }
.kpr-msg:empty { display: none; }
@media (pointer: coarse) { .stage .kn-presets .ghost, .stage .kpr-pick { min-height: 44px; } }

/* the party link: its QR code to show at the party, the link, what the floor asks for */
.fb-party { margin-left: auto; font: 600 11px var(--sans); padding: 5px 10px; border-radius: 999px; cursor: pointer;
            background: transparent; color: var(--stage-ink); border: 1px solid rgba(255, 255, 255, 0.2); }
.party-box { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px;
             border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 10px; font: 12px var(--mono); color: var(--ink-3); }
.party-box[hidden] { display: none; }
.pb-qr { background: #fff; border-radius: 8px; padding: 6px; line-height: 0; }
.pb-qr svg { width: 100%; height: auto; }
.pb-side { display: grid; gap: 6px; min-width: 0; }
.pb-url { color: var(--accent); overflow-wrap: anywhere; font-size: 13px; }
.pb-tally { color: var(--stage-ink); }
@media (max-width: 760px) { .party-box { grid-template-columns: 110px minmax(0, 1fr); } }

/* the library's newest records (live.js djLiveNews): ten rows high, the rest scrolls */
.livenews { margin-top: 10px; }
.livenews > summary { cursor: pointer; color: var(--ink-2); font-size: 12px; padding: 4px 0; }
.livenews .ln-now { font-size: 12px; color: var(--ink-2); margin: 2px 0 4px; }
.livenews .ln-now:empty { display: none; }
.livenews .ln-list { list-style: none; margin: 0; padding: 0; max-height: calc(10 * 2.6em); overflow-y: auto;
                     border: 1px solid var(--line-soft, var(--line)); border-radius: 8px; }
.livenews .ln-item { border-bottom: 1px solid var(--line-soft, var(--line)); }
.livenews .ln-item:last-child { border-bottom: 0; }
.livenews .ln-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 2px 8px; align-items: center;
                    padding: 5px 10px; font-size: 13px; min-height: 2.6em; cursor: pointer; list-style: none; }
.livenews .ln-row::-webkit-details-marker { display: none; }
.livenews .ln-det[open] > .ln-row { background: var(--panel-2, transparent); }
.livenews .ln-raw { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; padding: 6px 10px 10px 26px;
                    font-size: 11px; color: var(--ink-2); }
.livenews .ln-raw .ln-k { color: var(--ink-3); font-family: var(--mono, monospace); }
.livenews .ln-raw > :not(.ln-k) { overflow-wrap: anywhere; min-width: 0; }
.livenews .ln-raw a { color: inherit; }
.livenews .ln-sw { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.livenews .ln-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livenews .ln-meta { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.livenews .ln-todo { grid-column: 2 / -1; font-size: 11px; color: var(--ink-3); font-style: italic; }
.livenews .ln-sub { font-size: 12px; color: var(--ink-3); margin-top: 6px; overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .livenews .ln-row { grid-template-columns: 8px minmax(0, 1fr); }
  .livenews .ln-meta { grid-column: 2; white-space: normal; }
}

/* the timed button: closing, now or in N minutes, and what is pending */
.sn-timed { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: -6px; min-width: 0; }
.sn-when { font: 12px var(--sans); color: var(--stage-ink); background: transparent; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 999px; padding: 6px 10px; }
.sn-when option { color: #111; }
.sn-btn {
  font: 600 12px var(--sans); padding: 7px 12px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--stage-ink); border: 1px solid rgba(255, 255, 255, 0.22);
}
.sn-btn:hover { border-color: var(--accent); color: var(--accent); }
.sn-btn.is-busy { opacity: 0.6; }
.sn-pend { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; flex: 1 1 200px; }
.sn-chip {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; font: 12px var(--mono); color: var(--accent);
  border: 1px solid rgba(226, 163, 77, 0.35); border-radius: 999px; padding: 3px 4px 3px 10px;
}
.sn-chip-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sn-chip-x { background: transparent; border: 0; color: var(--stage-ink); cursor: pointer; font-size: 12px; padding: 2px 6px; border-radius: 999px; }
.sn-chip-x:hover { background: rgba(255, 255, 255, 0.1); }
@media (max-width: 760px) {
  .sn-timed { grid-column: 1 / -1; }
  .sn-btn, .sn-when { min-height: 44px; }
  .sn-chip-x { min-width: 32px; min-height: 32px; }
}

/* the break's look under its rate (break_style, break_bars, break_echo): segmented
   buttons and a toggle, in the knob panel */
/* the breaks group: in songs beside at hand-overs, each a rate, its effects (filter
   chips) and, in songs, the length (a segment) with the echo (a toggle) */
.kn-group {
  grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 6px 20px;
  min-width: 0; margin: 8px 0 0; padding: 6px 12px 10px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 10px;
}
.kn-group > legend { padding: 0 6px; color: var(--ink-3); font: 600 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.kn-col { display: grid; gap: 6px; align-content: start; min-width: 0; }
.kn-colhead { color: var(--stage-ink); font: 11px var(--mono); }
.kn-brk { display: grid; gap: 6px; min-width: 0; }
.kn-sub { align-items: start; }                          /* a label beside wrapped chips sits on their first row */
.kn-sub > .kn-ico { padding-top: 8px; }
.kn-sub > :last-child { grid-column: 2 / -1; min-width: 0; }
.kn-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.kn-seg { display: inline-flex; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px; overflow: hidden; min-width: 0; }
.kn-seg button, .kn-tog {
  font: 11px var(--mono); color: var(--ink-3); background: transparent; border: 0; padding: 5px 10px; cursor: pointer; white-space: nowrap;
}
.kn-seg button + button { border-left: 1px solid rgba(255, 255, 255, 0.12); }
.kn-seg button:hover, .kn-tog:hover { color: var(--stage-ink); }
.kn-seg button.is-on { color: var(--stage-bg); background: var(--stage-ink); }
.kn-tog { border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px; }
.kn-tog.is-on { color: var(--stage-bg); background: var(--stage-ink); border-color: var(--stage-ink); }
.kn-chips { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.kn-chip { display: inline-flex; align-items: center; line-height: 1.2; }        /* the tick must not move the label off its line */
.kn-chip.is-on::before { content: "\2713\00a0"; }       /* the tick: selection not by colour alone */
.kn-tog:focus-visible, .kn-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* by the knob panel's own width, not the screen's: a tablet's panel is narrow on a wide
   screen, and two columns there clipped the length segment */
.kn-sliders { container: knobs / inline-size; }
@container knobs (max-width: 640px) {
  .kn-group { grid-template-columns: minmax(0, 1fr); gap: 12px; }      /* in songs, then at hand-overs */
}
@container knobs (max-width: 340px) {
  /* a phone of 320: the label over its control, the control the row's whole width */
  .kn-sub { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .kn-sub > .kn-ico { padding-top: 0; }
  .kn-sub > :last-child { grid-column: 1; }
}
.kn-brk.is-pending .kn-seg button.is-on, .kn-brk.is-pending .kn-tog.is-on,
.kn-sub.is-pending .kn-tog.is-on { background: var(--accent); border-color: var(--accent); }
@media (pointer: coarse) {
  .kn-seg button, .kn-tog { min-height: 44px; }
}

/* cover art (livestage.js stageArtImg): every image sits on its genre's swatch at a
   fixed size and fades in once loaded, so a missing or broken one leaves the swatch */
.art-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.3s; border-radius: inherit; }
.art-img.is-on { opacity: 1; }
.sn-main { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; }
.sn-text { min-width: 0; }
.sn-art { position: relative; width: 52px; height: 52px; border-radius: 6px; background: var(--sw, var(--g-other)); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); }
.sn-art-next {
  position: absolute; right: -6px; bottom: -6px; width: 24px; height: 24px; border-radius: 4px; overflow: hidden;
  background: var(--sw, var(--g-other)); box-shadow: 0 0 0 2px var(--stage-bg); opacity: 0; transform: scale(0.6);
  transition: opacity 0.4s, transform 0.4s;
}
.sn-art-next.is-on { opacity: 1; transform: none; }
.sn-artist { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 3px; color: var(--ink-3); font: 12px var(--sans); text-decoration: none; }
.sn-artist[hidden] { display: none; }
.sn-artist[href]:hover .sn-about { color: var(--stage-ink); text-decoration: underline; }
.sn-face { position: relative; flex: none; width: 20px; height: 20px; border-radius: 50%; overflow: hidden; background: var(--ink-3); }
.sn-face::before { content: attr(data-i); position: absolute; inset: 0; display: grid; place-items: center; font: 600 8px var(--sans); color: var(--stage-bg); }
.sn-about { min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; overflow-wrap: anywhere; }
.sp-chip { grid-template-columns: 30px minmax(0, 1fr); }
.sp-sw { position: relative; align-self: center; width: 30px; height: 30px; border-radius: 4px; overflow: hidden; }
.tip-art { display: flex; align-items: center; gap: 10px; margin: 2px 0 4px; min-width: 0; }
.tip-cover { position: relative; flex: none; width: 64px; height: 64px; border-radius: 5px; overflow: hidden; background: var(--sw, var(--g-other)); }
.tip-artists { display: flex; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.tip-artist { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.flow-tip .tip-face {
  position: relative; flex: none; width: 28px; height: 28px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; font: 600 10px var(--sans); color: var(--stage-bg); background: var(--ink-3);
}
.flow-tip .tip-an { color: var(--stage-ink); font: 12px var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.flow-tip .art-img { transition: none; }
@media (max-width: 760px) {
  .sn-main { gap: 10px; }
  .sn-art { width: 44px; height: 44px; }
  .sn-art-next { width: 20px; height: 20px; }
}

/* a phone: the help sat below every slider, off screen; it rides the bottom of the view */
@media (max-width: 760px) {
  .kn-help.is-on { position: sticky; bottom: 0; z-index: 2; background: var(--stage-bg); padding: 8px 0; min-height: 0; }
}
