/* ── hero: the piece ── */
.hero { position: relative; height: 100vh; min-height: 620px; overflow: hidden; }
#room { position: absolute; inset: 0; width: 100%; height: 100%; }
#labels { position: absolute; inset: 0; pointer-events: none; }
.lane-label {
  position: absolute; top: 0; left: 0;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; letter-spacing: 0.02em; white-space: nowrap;
  color: var(--fg); opacity: 0; transition: color 0.3s;
}
.lane-label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.lane-label.off { color: var(--faint); }
.lane-label.off .dot { background: transparent; box-shadow: inset 0 0 0 1px var(--c); }

.hero-top {
  position: absolute; top: 84px; left: var(--gutter); right: var(--gutter);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 40px;
  pointer-events: none;
}
.hero-top h1 { font-size: clamp(30px, 3vw, 40px); font-weight: 400; letter-spacing: -0.015em; line-height: 1.1; margin-top: 8px; }
.hero-top .meta { margin-top: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.wall { max-width: 340px; font-size: 13px; line-height: 1.55; color: var(--dim); text-align: right; transition: opacity 0.4s; padding-top: 22px; }

.readout {
  position: absolute; z-index: 5; pointer-events: none;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  padding: 6px 9px; border-radius: 6px; background: var(--panel); color: var(--fg);
  outline: 1px solid var(--line); transform: translate(14px, 14px); white-space: nowrap;
}

/* Only the Listen button takes clicks, so the song buttons and the piece stay usable before playing. */
.gate { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; transition: opacity 1s, visibility 1s; pointer-events: none; }
.gate .button { height: 52px; padding: 0 32px; pointer-events: auto; }
.started .gate { opacity: 0; visibility: hidden; }

.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 var(--gutter) 30px;
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: 'transport chips views';
  align-items: center; gap: 24px;
}
.transport { grid-area: transport; display: flex; align-items: center; gap: 16px; }
.views { grid-area: views; display: flex; align-items: center; gap: 18px; justify-content: flex-end; }
.chips { grid-area: chips; display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.btn {
  font-size: 12px; letter-spacing: 0.04em; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line); transition: border-color 0.2s, background 0.2s;
}
.btn:hover { border-color: var(--faint); }
.btn[aria-pressed='true'] { background: rgba(var(--tint), 0.07); border-color: var(--faint); }
.time { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 80px; }
.chip { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 999px; font-size: 12px; transition: color 0.3s, background 0.2s; }
.chip:hover { background: rgba(var(--tint), 0.05); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); transition: all 0.3s; }
.chip.off { color: var(--faint); }
.chip.off .dot { background: transparent; box-shadow: inset 0 0 0 1px var(--c); }
.chip.solo { background: rgba(var(--tint), 0.07); }

.dial { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.dial input { -webkit-appearance: none; appearance: none; width: 140px; height: 20px; background: transparent; cursor: pointer; }
.dial input::-webkit-slider-runnable-track { height: 1px; background: linear-gradient(90deg, var(--faint), var(--fg)); }
.dial input::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -6px; border-radius: 50%; background: var(--fg); box-shadow: 0 0 12px rgba(var(--tint), 0.5); }
.dial input::-moz-range-track { height: 1px; background: var(--faint); }
.dial input::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: var(--fg); }

/* The stem chips get their own row before they would wrap beside the transport. */
@media (max-width: 1440px) {
  .controls { grid-template-columns: auto 1fr; grid-template-areas: 'chips chips' 'transport views'; row-gap: 14px; }
}
@media (max-width: 1180px) {
  .wall { display: none; }
}

/* ── label ── */
.label-grid { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: clamp(40px, 8vw, 120px); align-items: start; }
.museum-label { border-top: 1px solid var(--line); padding-top: 18px; font-size: 13px; line-height: 1.7; color: var(--dim); }
.museum-label h2 { font-size: 22px; font-weight: 400; color: var(--fg); letter-spacing: -0.01em; margin-bottom: 2px; }
.museum-label p + p { margin-top: 10px; }
.museum-label .m { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.story-note { margin-top: 28px; }
#story .s, #entries .s { white-space: nowrap; }
/* When each stem comes in: one per line, the time in a narrow column on the left. */
.entries { list-style: none; margin: 32px 0 0; padding: 0; max-width: 560px; border-top: 1px solid var(--hair); }
.entries li { display: grid; grid-template-columns: 76px 1fr; align-items: baseline; padding: 13px 0; border-bottom: 1px solid var(--hair); font-size: 22px; letter-spacing: -0.01em; }
.entries time { font-family: var(--mono); font-size: 13px; letter-spacing: 0.06em; color: var(--dim); }
#story .s i, #entries .s i { display: inline-block; width: 0.42em; height: 0.42em; border-radius: 50%; background: var(--c); margin: 0 0.12em 0.12em 0.04em; vertical-align: middle; box-shadow: 0 0 12px var(--c); }

/* ── specimens ── */
.specimens { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 28px; }
.specimen { outline: 1px solid var(--hair); padding: 26px 26px 24px; display: flex; flex-direction: column; gap: 22px; }
.specimen header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.specimen .cat { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--faint); }
.specimen h3 { margin-top: 6px; font-size: 24px; font-weight: 400; letter-spacing: -0.01em; display: flex; align-items: center; gap: 12px; }
.specimen h3 i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 14px var(--c); }
.specimen .alone { flex: none; }
.specimen.soloed .alone { background: rgba(var(--tint), 0.08); border-color: var(--faint); }
.plates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plates figure, .presence { display: flex; flex-direction: column; gap: 8px; }
.plates .frame, .plates canvas { width: 100%; aspect-ratio: 1; background: var(--plate); outline: 1px solid var(--hair); }
.plates .frame svg { width: 100%; height: 100%; }
.plates figcaption, .presence figcaption { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.presence canvas { width: 100%; height: 26px; }
.specimen dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; font-size: 13px; }
.specimen dt { color: var(--faint); }
.specimen dd { color: var(--fg); }

/* ── tokens ── */
.token-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 24px; }
.token-row .frame svg { width: 100%; height: 100%; }

.next-prev { display: flex; justify-content: space-between; border-top: 1px solid var(--hair); font-size: 14px; }
.next-prev a { color: var(--dim); transition: color 0.2s; }
.next-prev a:hover { color: var(--fg); }
.next-prev small { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--faint); text-transform: uppercase; margin-bottom: 4px; }

@media (max-width: 960px) {
  .specimens { grid-template-columns: 1fr; }
  .label-grid { grid-template-columns: 1fr; }
}

/* ── the mixer panel ── */
.chip.missing { opacity: 0.4; }
.mixer-panel { position: absolute; z-index: 6; right: var(--gutter); bottom: 96px; width: min(380px, calc(100% - 2 * var(--gutter))); max-height: calc(100% - 260px); overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.mixer-panel[hidden] { display: none; }
.mhead { display: flex; justify-content: space-between; align-items: center; }
.mhead b { font-weight: 400; font-size: 15px; }
.mixer-panel .x { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); color: var(--dim); }
.rows { display: flex; flex-direction: column; gap: 4px; }
.mrow { display: grid; grid-template-columns: minmax(0, 1fr) 28px 28px 110px; gap: 6px; align-items: center; font-size: 13px; padding: 4px 0; }
.mrow.missing { color: var(--faint); }
.mname { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mname i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.mrow.missing .mname i { background: transparent; box-shadow: inset 0 0 0 1px var(--c); }
.mbtn { height: 26px; border-radius: 7px; border: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--dim); }
.mbtn.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.mbtn:disabled { opacity: 0.3; }
.mrow input[type=range] { width: 100%; accent-color: var(--fg); }
.mnote { grid-column: 1 / -1; font-size: 11px; color: var(--faint); margin-top: -4px; }
.mine { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--dim); padding-top: 10px; border-top: 1px solid var(--hair); }
.mine input { accent-color: var(--fg); }
.mine-note { font-size: 12px; color: var(--faint); line-height: 1.5; }

/* ── moving between songs ── */
.song-nav { display: flex; gap: 6px; margin-top: 16px; pointer-events: auto; }
.song-nav .btn { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; background: var(--panel); }
.song-nav .btn[aria-expanded='true'] { background: rgba(var(--tint), 0.07); border-color: var(--faint); }
.song-drawer { position: absolute; z-index: 7; left: var(--gutter); top: 236px; bottom: 96px; width: min(400px, calc(100% - 2 * var(--gutter)));
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.song-drawer[hidden] { display: none; }
.song-drawer .x { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); color: var(--dim); }
.song-drawer input[type=search] { font: inherit; font-size: 13px; color: var(--fg); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; }
.song-drawer input[type=search]::placeholder { color: var(--faint); }
.dlist { flex: 1; overflow: auto; margin: 0 -8px; padding: 0 8px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.dalbum + .dalbum { margin-top: 18px; }
.dalbum .kicker { margin-bottom: 6px; }
.drow { display: grid; grid-template-columns: 22px minmax(0, 1fr) 72px 16px; gap: 10px; align-items: center; padding: 7px 8px; margin: 0 -8px; border-radius: 8px; font-size: 13px; color: var(--dim); }
.drow:hover { background: rgba(var(--tint), 0.04); color: var(--fg); }
.drow[aria-current] { background: rgba(var(--tint), 0.07); color: var(--fg); }
.drow .no, .drow .ct { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.drow .ct { text-align: right; }
.drow .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drow canvas { width: 100%; height: 14px; }
.dhint { font-size: 11px; line-height: 1.5; color: var(--faint); }
.upnext { position: absolute; z-index: 7; left: 50%; bottom: 100px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--dim); white-space: nowrap; }
.upnext[hidden] { display: none; }
.upnext b { font-weight: 400; color: var(--fg); margin: 0 6px 0 10px; }
.upnext small { font-family: var(--mono); font-size: 10px; color: var(--faint); margin-right: 6px; }

/* ── phones ── */
@media (max-width: 700px) {
  .hero { height: 100svh; min-height: 660px; }
  .hero-top { top: 76px; }
  .hero-top h1 { font-size: 30px; }
  .controls { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'chips' 'views' 'transport'; padding-bottom: 18px; gap: 12px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 8px 10px; }
  .views { justify-content: space-between; gap: 8px; }
  .dial { flex: 1; min-width: 0; gap: 8px; }
  .dial input { width: 100%; min-width: 0; }
  .transport { justify-content: space-between; }
  /* Phone: the dot leads, and the label sits just above its own lane's line, readable over the waveform. */
  .lane-label { font-size: 11px; margin-top: -5px; gap: 7px; flex-direction: row-reverse; text-shadow: 0 0 6px var(--bg), 0 0 2px var(--bg); }
  .mixer-panel { left: 12px; right: 12px; width: auto; bottom: 12px; max-height: 72%; z-index: 8; }
  .song-drawer { left: 12px; right: 12px; width: auto; top: 68px; bottom: 12px; z-index: 8; }
  .upnext { bottom: 190px; padding: 8px 8px 8px 14px; gap: 6px; font-size: 12px; }
  .upnext b { margin: 0 4px 0 6px; }
  .mrow { grid-template-columns: minmax(0, 1fr) 30px 30px 90px; }
  .next-prev { flex-wrap: wrap; gap: 18px 24px; }
  .next-prev a:nth-child(2) { order: 3; flex-basis: 100%; text-align: left !important; }
  .plates { gap: 8px; }
  .specimen { padding: 20px 16px; }
}

/* While the song loads: its outline from the catalogue, faint and breathing, where the piece will be. */
.ghost {
  position: absolute; left: max(10%, 170px); top: 50%; width: calc(100% - 2 * max(10%, 170px)); height: 44vh; transform: translateY(-50%);
  opacity: 0.35; pointer-events: none; animation: ghost 2.4s ease-in-out infinite; transition: opacity 0.8s;
}
.ghost.gone { opacity: 0; animation: none; }
@keyframes ghost { 50% { opacity: 0.18; } }
@media (max-width: 760px) { .ghost { left: 18px; width: calc(100% - 36px); } }
#entries .s i { margin-right: 0.45em; }
