/* Compare: the transit map look. White ground, black ink, each version a
   coloured line. Barlow for UI, JetBrains Mono for numbers. Three text
   sizes, three radii, one shadow (the popover). */

:root {
  --bg: #ffffff;
  --panel: #f5f5f5;
  --panel-2: #ececec;
  --line: #e2e2e2;
  --ink: #111111;
  --ink-2: #555555;
  --ink-3: #7a7a7a;
  --red: #e4002b;
  --red-2: #c40025;
  --red-soft: rgba(228, 0, 43, 0.08);
  --on-red: #ffffff;
  --warn: #c2410c;
  --focus: #0057b8;
  --sans: "Barlow", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --t-sm: 0.875rem;
  --t-md: 1rem;
  --t-lg: 1.25rem;
  --t-display: clamp(1.9rem, 3.2vw, 2.5rem);
  --r-panel: 10px;
  --r-ctl: 6px;
  --r-pill: 999px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --rail-w: 272px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
  scrollbar-color: #c8c8c8 var(--bg);
}

body {
  font-family: var(--sans);
  font-size: var(--t-md);
  font-weight: 500;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  accent-color: var(--red);
  caret-color: var(--red);
}

::selection {
  background: rgba(228, 0, 43, 0.18);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #c8c8c8;
  border-radius: var(--r-pill);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-track {
  background: transparent;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
}

h1,
h2 {
  line-height: 1.15;
  font-weight: 800;
}

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

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

.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  min-height: 100vh;
}

.rail {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.stage {
  padding: 28px clamp(20px, 4vw, 48px) 64px;
  min-width: 0;
}

/* ---------- rail ---------- */

.brand {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.brand-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  transition: color 0.2s var(--ease-out);
}
.brand-home:hover {
  color: var(--red);
}
.brand-home .icon {
  width: 0.9em;
  height: 0.9em;
  opacity: 0.6;
}

.brand-tool {
  font-size: var(--t-sm);
  color: var(--ink-3);
}

.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.rail-head h2 {
  font-size: var(--t-sm);
  font-weight: 800;
  color: var(--ink-2);
}

.add-slot:empty {
  display: none;
}

.client-list,
.song-list {
  list-style: none;
}

.client-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.rail-empty {
  color: var(--ink-3);
  font-size: var(--t-sm);
  padding: 8px;
}
.rail-error {
  color: var(--warn);
  line-height: 1.45;
}

.client-row,
.song-row {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--r-ctl);
}
.client-row:hover,
.song-row:hover,
.client-row:focus-within,
.song-row:focus-within {
  background: var(--panel-2);
}

.client-name,
.song-name {
  flex: 1;
  text-align: left;
  padding: 8px;
  border-radius: var(--r-ctl);
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
  transition: color 0.15s var(--ease-out);
}
.client.is-active > .client-row .client-name {
  color: var(--ink);
}
.client.is-active > .client-row {
  background: var(--bg);
  border: 1px solid var(--line);
}

.song-list {
  margin: 4px 0 8px 12px;
  padding-left: 8px;
  border-left: 2px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.song-name {
  font-size: var(--t-sm);
  font-weight: 500;
}
.song-name.is-open {
  color: var(--red);
  font-weight: 800;
}

.row-tools {
  display: inline-flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s var(--ease-out);
  padding-right: 4px;
}
.client-row:hover .row-tools,
.song-row:hover .row-tools,
.client-row:focus-within .row-tools,
.song-row:focus-within .row-tools {
  opacity: 1;
}

.tool {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-ctl);
  color: var(--ink-3);
  transition: color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}
.tool:hover {
  color: var(--ink);
  background: var(--panel-2);
}
.tool .icon {
  width: 15px;
  height: 15px;
}

.add-song {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  font-size: var(--t-sm);
  color: var(--ink-3);
  border-radius: var(--r-ctl);
  transition: color 0.15s var(--ease-out);
}
.add-song:hover {
  color: var(--ink);
}

.inline-input {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-ctl);
  padding: 8px;
  margin: 2px 0;
  line-height: 1.3;
}
.inline-input::placeholder {
  color: var(--ink-3);
}
.inline-input:focus {
  border-color: var(--red);
  outline: none;
}

.confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px;
  width: 100%;
}
.confirm-text {
  flex: 1 1 100%;
  font-size: var(--t-sm);
  color: var(--ink-2);
}

.rail-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.storage {
  font-size: var(--t-sm);
  color: var(--ink-3);
  min-height: 1em;
}

.help {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--t-sm);
}
.help div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  align-items: baseline;
}
.help dt {
  font-family: var(--mono);
  font-size: var(--t-sm);
  line-height: 1;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--ink);
  border-radius: var(--r-ctl);
  padding: 4px 6px;
  text-align: center;
  white-space: nowrap;
}
.help dd {
  color: var(--ink-2);
}

/* ---------- shared controls ---------- */

.chip,
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: var(--r-pill);
  font-size: var(--t-sm);
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--line);
  white-space: nowrap;
  transition: background 0.15s var(--ease-out), border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.toggle {
  border-color: var(--ink);
}
.chip:hover:not(:disabled),
.toggle:hover:not(:disabled) {
  border-color: var(--ink);
}
.chip:disabled,
.toggle:disabled {
  color: var(--ink-3);
  border-color: var(--line);
}
.chip.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.chip.ghost:hover:not(:disabled) {
  color: var(--ink);
  background: var(--panel);
  border-color: transparent;
}
.chip.danger {
  background: transparent;
  border-color: var(--warn);
  color: var(--warn);
}
.chip.danger:hover {
  background: rgba(194, 65, 12, 0.08);
}
.chip[aria-pressed="true"],
.toggle[aria-pressed="true"],
.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.chip[aria-pressed="true"]:hover:not(:disabled),
.toggle[aria-pressed="true"]:hover:not(:disabled) {
  background: #2a2a2a;
  border-color: #2a2a2a;
}

.btn {
  display: inline-block;
  background: var(--red);
  color: var(--on-red);
  padding: 12px 24px;
  border-radius: var(--r-pill);
  text-decoration: none;
  font-weight: 800;
  line-height: 1;
  transition: background 0.2s var(--ease-out);
}
.btn:hover {
  background: var(--red-2);
}

.seg {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
}
.seg-btn {
  padding: 9px 14px;
  border-radius: var(--r-pill);
  font-size: var(--t-sm);
  font-weight: 600;
  line-height: 1;
  color: var(--ink-3);
  transition: color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}
.seg-btn:hover {
  color: var(--ink);
}
.seg-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

select {
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--line);
  border-radius: var(--r-pill);
  padding: 10px 32px 10px 14px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23111111' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
select:disabled {
  color: var(--ink-3);
  cursor: not-allowed;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.check input {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
}

.select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-sm);
  color: var(--ink-3);
}

/* ---------- empty state ---------- */

.empty {
  padding-top: 8vh;
}
.empty-inner {
  max-width: 44ch;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.empty h1 {
  font-size: var(--t-display);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.empty p {
  color: var(--ink-2);
  text-wrap: pretty;
}
.empty .btn {
  margin-top: 8px;
}

/* ---------- song view ---------- */

.song-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1280px;
}

.song-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.song-id {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}
.song-client {
  font-size: var(--t-md);
  font-weight: 600;
  color: var(--ink-2);
}
.song-title {
  font-size: var(--t-display);
  letter-spacing: -0.02em;
  line-height: 1;
  text-wrap: balance;
}
.song-meta {
  font-size: var(--t-sm);
  color: var(--ink-3);
}

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

.player {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  background: var(--panel);
  border-radius: 14px;
}
.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.player .scope-frame {
  background: var(--bg);
}
.player .map-legend {
  background: var(--bg);
}
/* The "how you hear" row sits right under the transport. */
.listen-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.song-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.match-hint {
  flex-basis: 100%;
  font-size: var(--t-sm);
  color: var(--ink-2);
}
.match-hint:empty {
  display: none;
}

/* ---------- details: header, subtabs, panels ---------- */

.details {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 20px;
  border-top: 2px solid var(--ink);
}
.details-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.subtabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.subtab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 4px 14px;
  margin-right: 20px;
  margin-bottom: -1px;
  border-bottom: 3px solid transparent;
  font-size: var(--t-md);
  font-weight: 600;
  line-height: 1;
  color: var(--ink-3);
  transition: color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}
.subtab:hover {
  color: var(--ink);
}
.subtab[aria-selected="true"] {
  color: var(--ink);
  font-weight: 800;
  border-bottom-color: var(--ink);
}
.count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--red);
  color: #fff;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
}
.subtabs .detail-delete {
  margin-left: auto;
}
.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.notes-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.notes-head h2 {
  font-size: var(--t-md);
}

.section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 20px;
  border-top: 2px solid var(--ink);
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.section-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.section-label {
  font-size: var(--t-sm);
  font-weight: 800;
  color: var(--red);
}
.section-title h2 {
  font-size: var(--t-lg);
}
.section-hint {
  font-size: var(--t-sm);
  color: var(--ink-3);
}
.notes-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* simple mode hides the engineer's tools */
body.is-simple .is-advanced {
  display: none !important;
}

/* first-run banner */
.first-run {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 2px solid var(--ink);
  border-radius: var(--r-panel);
  background: var(--panel);
}
.first-run p {
  font-size: var(--t-sm);
  line-height: 1.5;
}
.first-run .chip {
  white-space: nowrap;
}
.first-run kbd {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 1px 5px;
}

/* keys overlay */
.help-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(17, 17, 17, 0.45);
  padding: 20px;
}
.help-card {
  width: min(440px, 100%);
  background: var(--bg);
  border: 2px solid var(--ink);
  border-radius: var(--r-panel);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
}
.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.help-head h2 {
  font-size: var(--t-lg);
}

/* status */
.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.status-row:empty {
  display: none;
}
.status-row .chip {
  border-color: var(--ink);
}
.status-row .chip.ghost {
  border-color: var(--line);
}
.status-chip.is-approved[aria-pressed="true"] {
  background: #0a7a3c;
  border-color: #0a7a3c;
}
.status-chip.is-changes[aria-pressed="true"] {
  background: var(--warn);
  border-color: var(--warn);
}
.status-when {
  font-size: var(--t-sm);
  color: var(--ink-3);
}
.version-status {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  vertical-align: -3px;
  margin-left: 6px;
  color: #fff;
}
.version-status .icon {
  width: 11px;
  height: 11px;
}
.version-status.is-approved {
  background: #0a7a3c;
}
.version-status.is-changes {
  background: var(--warn);
}

/* delivery target */
.signs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: -8px;
}
.signs-title {
  font-size: var(--t-sm);
  font-weight: 800;
  color: var(--ink-2);
}
.detail-notes-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 72ch;
}
.detail-stats dd.is-ok {
  color: #7ee0a0;
}
.detail-stats dd.is-near {
  color: #ffd166;
}
.detail-stats dd.is-over {
  color: #ffb26b;
}
.detail-stats dd.is-under {
  color: #9ecbff;
}
.detail-stats dt[title] {
  text-decoration: underline dotted #6a6a6a;
  text-underline-offset: 3px;
  cursor: help;
}

/* feedback pack */
.notes-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.notes-foot-label {
  font-size: var(--t-sm);
  font-weight: 800;
  color: var(--ink-2);
  margin-right: 8px;
}
.fb-status {
  font-size: var(--t-sm);
  color: var(--ink-2);
  margin-left: auto;
}
.fb-status.is-error {
  color: var(--warn);
}

/* ---------- scope: tabs, tools, canvas ---------- */

.scope {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.scope-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg);
  border-radius: var(--r-pill);
}
.tab {
  padding: 10px 16px;
  border-radius: var(--r-pill);
  font-size: var(--t-sm);
  font-weight: 600;
  line-height: 1;
  color: var(--ink-2);
  transition: color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}
.tab:hover {
  color: var(--ink);
  background: var(--panel-2);
}
.tab[aria-selected="true"] {
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
}
.scope-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.scope-frame {
  display: grid;
  grid-template-columns: minmax(280px, 29%) 1fr;
  height: clamp(250px, 34vh, 360px);
  border: 2px solid var(--ink);
  border-radius: var(--r-panel);
  overflow: hidden;
  background: var(--bg);
}
.scope-frame.is-full {
  grid-template-columns: 1fr;
}
.scope-frame.is-full .map-legend {
  display: none;
}
.scope-frame .peaks {
  border: 0;
  border-radius: 0;
  min-height: 0;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}
.wave-wrap {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  user-select: none;
}
.scope-canvas {
  position: relative;
  flex: 1;
  min-height: 0;
  cursor: crosshair;
  touch-action: none;
}
.wave-wrap.is-map .scope-canvas {
  cursor: pointer;
}
.wave-wrap canvas {
  display: block;
  position: absolute;
  inset: 0;
}
.scope-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--t-sm);
  color: var(--ink-3);
  text-align: center;
  max-width: 40ch;
  pointer-events: none;
}

/* listen popover */
.listen-anchor {
  position: relative;
}
.listen {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: min(380px, calc(100vw - 40px));
  background: var(--bg);
  border: 2px solid var(--ink);
  border-radius: var(--r-panel);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow);
  text-align: left;
}
.listen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.listen-head h2 {
  font-size: var(--t-md);
}
.listen-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 8px;
}
.listen-label {
  font-size: var(--t-sm);
  color: var(--ink-3);
}
.listen-flags,
.null-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.null-row select {
  flex: 1;
  min-width: 120px;
}
.system-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.system-row select {
  max-width: 100%;
}
.system-hint {
  font-size: var(--t-sm);
  color: var(--ink-3);
  line-height: 1.4;
}
.sweep {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sweep input {
  flex: 1;
  accent-color: var(--red);
}
.sweep output {
  font-family: var(--mono);
  font-size: var(--t-sm);
  min-width: 7ch;
  text-align: right;
}
.pair-head select {
  width: 100%;
}
.blend output {
  min-width: 10ch;
}
.note-blend {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
  padding: 5px 8px;
  border-radius: var(--r-pill);
  background: var(--panel);
  white-space: nowrap;
}

/* ---------- would anyone notice: memory test ---------- */

.notice-card {
  width: min(480px, 100%);
}
.notice-lead {
  margin: 0;
  font-size: var(--t-lg);
  font-weight: 800;
}
.notice-count {
  font-family: var(--mono);
  color: var(--red);
}
.notice-text {
  margin: 0;
  color: var(--ink-2);
  line-height: 1.45;
}
.notice-text.is-clear {
  color: var(--ok, #15803d);
}
.notice-text.is-marginal {
  color: var(--warn);
}
.notice-text.is-none {
  color: var(--red);
}
.notice-progress {
  display: flex;
  gap: 8px;
}
.notice-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--ink-3);
}
.notice-dot.is-now {
  border-color: var(--red);
  background: var(--red);
}
.notice-dot.is-right {
  border-color: var(--ink);
  background: var(--ink);
}
.notice-dot.is-wrong {
  border-color: var(--ink);
  background: var(--bg);
}
.notice-answers {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.notice-answer {
  flex: 1;
  min-height: 56px;
  font-size: var(--t-md);
  font-weight: 800;
  border-color: var(--ink);
}
.notice-go {
  align-self: flex-start;
}

.listen-hint {
  font-size: var(--t-sm);
  color: var(--ink-3);
}
.listen-foot {
  display: flex;
  justify-content: flex-end;
}

/* ---------- transport ---------- */

/* The transport is the first row of the player so nothing below can move it. */
.transport {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.listen-bar .meter {
  margin-left: auto;
}
.loop-tools:not(.has-loop) #loop-clear {
  display: none; /* nothing to clear yet */
}
.transport .loop-tools {
  margin-left: 0;
}

.play {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--red);
  color: var(--on-red);
  transition: background 0.2s var(--ease-out);
}
.play .icon {
  width: 24px;
  height: 24px;
}
.play:hover:not(:disabled) {
  background: var(--red-2);
}
.play:disabled {
  background: var(--line);
  color: var(--ink-3);
}

.clock {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-lg);
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}
.clock-now {
  color: var(--ink);
  min-width: 6.2ch;
}
.clock-sep,
.clock-total {
  color: var(--ink-3);
  font-size: var(--t-sm);
}

.meter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-sm);
  color: var(--ink-3);
  line-height: 1.25;
}
.meter-val {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  min-width: 5ch;
}
.corr-bar {
  position: relative;
  width: 90px;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--warn) 0%, var(--line) 50%, var(--ink-3) 100%);
}
.corr-bar::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -3px;
  width: 1px;
  height: 12px;
  background: var(--ink-3);
}
.corr-bar i {
  position: absolute;
  top: -3px;
  left: 100%;
  width: 3px;
  height: 12px;
  margin-left: -1.5px;
  background: var(--ink);
  transition: left 0.12s linear;
}
.meter.is-warn .meter-val:first-of-type {
  color: var(--warn);
}

.loop-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* volume: listening level only, never touches measurements */
.volume {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.volume-label {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--ink-2);
  cursor: pointer;
}
.volume-label .icon {
  width: 22px;
  height: 22px;
}
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 32px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.volume-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--ink) 0 var(--fill, 100%), var(--line) var(--fill, 100%) 100%);
}
.volume-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
}
.volume-slider::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--ink);
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--ink);
}
.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--ink);
}
.volume-slider:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
  border-radius: 3px;
}
.volume-val {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-sm);
  color: var(--ink);
  min-width: 6ch;
  text-align: right;
}
.volume.is-off .volume-label,
.volume.is-off .volume-val,
.volume.is-dim .volume-label,
.volume.is-dim .volume-val {
  color: var(--warn);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.loop-range {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-sm);
  color: var(--ink-3);
  padding: 0 4px;
}

/* ---------- legend fused into the map frame ---------- */

.map-legend {
  position: relative;
  background: var(--panel);
  border-right: 1px solid var(--line);
  min-width: 0;
}
.legend-rows {
  position: absolute;
  inset: 0;
}
.legend-drop {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 16px;
  border: 2px dashed var(--ink-3);
  border-radius: var(--r-ctl);
  color: var(--ink);
  cursor: pointer;
  background: var(--bg);
  transition: border-color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}
.legend-drop:hover,
.scope-frame.is-over .legend-drop {
  border-color: var(--red);
  background: var(--red-soft);
}
.legend-drop .icon {
  width: 22px;
  height: 22px;
  flex: none;
}
.legend-drop-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: var(--t-md);
  line-height: 1.2;
  min-width: 0;
}
.legend-drop-text strong {
  font-weight: 800;
}
.legend-drop-text span {
  font-size: var(--t-sm);
}
.legend-drop-text span {
  color: var(--ink-3);
  font-weight: 500;
}
.ref-toggle[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.map-legend .import-status {
  position: absolute;
  top: 66px;
  left: 12px;
  right: 12px;
  z-index: 1;
  margin: 0;
  text-align: left;
  max-width: none;
  font-size: 0.75rem;
}
.scope-frame.is-over {
  box-shadow: inset 0 0 0 3px var(--red);
}
.scope-frame.is-busy {
  cursor: progress;
}
.versions-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: var(--t-sm);
}
.version {
  --hue: #e4002b;
  position: absolute;
  left: 8px;
  right: 8px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--r-ctl);
  text-align: left;
  transition: background 0.15s var(--ease-out);
}
.version:hover:not(:disabled) {
  background: var(--panel-2);
}
.version:disabled {
  opacity: 0.7;
}
.version.is-active {
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--line);
}
.version-badge {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--hue);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  line-height: 1;
}
.version-badge {
  position: relative;
  cursor: pointer;
}
.version-badge .icon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  opacity: 0;
  transition: opacity 0.12s var(--ease-out);
}
.version-badge:hover .badge-num,
.version-badge:focus-visible .badge-num {
  opacity: 0;
}
.version-badge:hover .badge-play,
.version-badge:focus-visible .badge-play {
  opacity: 1;
}
.legend-rows.is-playing .version.is-active .version-badge:hover .badge-play {
  opacity: 0;
}
.legend-rows.is-playing .version.is-active .version-badge:hover .badge-pause {
  opacity: 1;
}
.version.is-reference .version-badge {
  font-size: 0.65rem;
  letter-spacing: 0.02em;
}
.version-name {
  font-weight: 600;
  font-size: var(--t-sm);
  line-height: 1.2;
  overflow: hidden;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.map-legend.is-tight .version-name {
  -webkit-line-clamp: 1;
}
.version.is-active .version-name {
  font-weight: 800;
}
.version-meta {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--ink-3);
  white-space: nowrap;
  text-align: right;
}
.version.is-active .version-meta {
  color: var(--ink);
}
.version.is-failed .version-meta {
  color: var(--warn);
  font-family: var(--sans);
}
.version.is-loading .version-badge {
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

/* ---------- detail (station signs) ---------- */

.detail-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.detail-title {
  font-size: var(--t-lg);
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-name .inline-input {
  max-width: 320px;
}
.badge {
  font-size: var(--t-sm);
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  border: 1.5px dashed var(--ink);
  border-radius: var(--r-ctl);
  padding: 4px 7px;
}
.detail-meta {
  font-size: var(--t-sm);
  color: var(--ink-3);
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}
.detail-stats div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-ctl);
  min-height: 96px;
}
.detail-stats dt {
  font-size: var(--t-sm);
  font-weight: 600;
  color: #bdbdbd;
  line-height: 1.25;
}
.detail-stats dd {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--bg);
  line-height: 1.2;
}
.detail-stats dd.stat-sub {
  font-family: var(--sans);
  font-size: var(--t-sm);
  font-weight: 500;
  color: #bdbdbd;
  margin-top: auto;
}
.detail-stats dd.stat-sub:empty {
  display: none;
}
.detail-stats dd.is-warn {
  color: #ffb26b;
}

.detail-notes-label {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
}
.detail-notes {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 10px 14px;
  resize: vertical;
  min-height: 72px;
}
.detail-notes::placeholder {
  color: var(--ink-3);
}
.detail-notes:focus {
  border-color: var(--ink);
  outline: none;
}
.detail-notes:disabled {
  color: var(--ink-3);
}
.detail-delete {
  display: flex;
  justify-content: flex-end;
}
.detail-delete .confirm {
  justify-content: flex-end;
  width: auto;
}
.detail-delete .confirm-text {
  flex-basis: auto;
}

/* ---------- timed notes (stations) ---------- */


.note-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}
.note {
  --hue: #111111;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  transition: background 0.2s var(--ease-out);
}
.note.is-hot {
  background: var(--panel);
}
.note-empty {
  color: var(--ink-3);
  font-size: var(--t-sm);
  padding: 12px 4px;
}
.note-time {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-sm);
  line-height: 1;
  color: var(--bg);
  background: var(--ink);
  padding: 6px 8px;
  border-radius: var(--r-ctl);
  white-space: nowrap;
}
.note-time:hover {
  background: #2a2a2a;
}
.note-version {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-sm);
  font-weight: 600;
  line-height: 1;
  color: var(--ink-2);
  padding: 5px 8px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-version::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--hue);
  flex: none;
}
.note-version.is-song::before {
  background: var(--ink-3);
}
button.note-version:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.note-text {
  text-align: left;
  padding: 4px 6px;
  border-radius: var(--r-ctl);
  color: var(--ink);
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-text:hover {
  background: var(--panel);
}
.note-text.is-empty {
  color: var(--ink-3);
  font-weight: 500;
}
.note-input {
  margin: 0;
  flex: 1;
}
.note-delete {
  opacity: 0;
}
.note:hover .note-delete,
.note:focus-within .note-delete {
  opacity: 1;
}

.note-device {
  display: inline-flex;
  color: var(--ink-2);
  flex: none;
}
.note-device .icon {
  width: 18px;
  height: 18px;
}
.voice-btn.is-playing {
  background: var(--red);
  color: var(--on-red);
  border-color: var(--red);
}

/* ---------- note strip: signs on the timeline ---------- */

.note-strip {
  position: relative;
  height: 36px;
  flex: none;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.note-strip.is-empty {
  display: none;
}
.sign {
  --hue: #111111;
  position: absolute;
  top: 7px;
  transform: translateX(-50%);
  height: 24px;
  min-width: 28px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--r-ctl);
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 0 0 2px var(--bg);
  transition: background 0.15s var(--ease-out);
}
.sign::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top: 0;
  border-bottom-color: var(--ink);
}
.sign .icon {
  width: 14px;
  height: 14px;
}
.sign:hover {
  background: #2a2a2a;
  z-index: 2;
}
.sign.is-now {
  background: var(--red);
  z-index: 1;
}
.sign.is-now::before {
  border-bottom-color: var(--red);
}
.sign.is-playing {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

/* ---------- note bar: what plays now, and the composer ---------- */

.note-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 4px;
  flex-wrap: wrap;
}
.note-bar-add {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.note-bar-now {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.note-time.is-general {
  background: var(--panel-2);
  color: var(--ink);
}
button.note-bar-time {
  cursor: pointer;
}
button.note-bar-time:hover {
  background: #2a2a2a;
}
button.note-bar-time.is-general:hover {
  background: var(--line);
}
.note-bar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.note-bar-hint {
  color: var(--ink-3);
  font-size: var(--t-sm);
}
.now-sign {
  --hue: #111111;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px 0 0;
  border-radius: var(--r-ctl);
  background: var(--ink);
  color: var(--bg);
  max-width: 100%;
  overflow: hidden;
  text-align: left;
}
.now-sign:hover {
  background: #2a2a2a;
}
.now-time {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--t-sm);
  background: var(--red);
  color: var(--on-red);
  padding: 0 10px;
  align-self: stretch;
  display: flex;
  align-items: center;
  white-space: nowrap;
}
.now-sign .icon {
  width: 18px;
  height: 18px;
  flex: none;
}
.now-version {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-sm);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
}
.now-version::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--hue);
}
.now-text {
  font-weight: 600;
  min-width: 0;
  line-height: 1.3;
  padding: 8px 0;
  overflow-wrap: anywhere; /* long notes wrap instead of being cut off */
}
.note-bar.is-composing {
  background: var(--bg);
  border: 2px solid var(--ink);
  border-radius: var(--r-panel);
  padding: 8px 10px;
}
.note-bar-time {
  flex: none;
}
.note-bar-version {
  flex: none;
}
.note-bar-input {
  flex: 1;
  min-width: 160px;
  margin: 0;
}
.rec-btn.is-recording {
  background: var(--red);
  color: var(--on-red);
  border-color: var(--red);
}
.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  animation: rec-pulse 1s ease-in-out infinite;
}
@keyframes rec-pulse {
  50% {
    opacity: 0.25;
  }
}
.rec-time {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.rec-taken {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-sm);
  color: var(--ink-2);
  white-space: nowrap;
}
.rec-taken .icon {
  width: 16px;
  height: 16px;
}
.save-btn {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.save-btn:hover {
  background: #2a2a2a;
}
.note-bar-error {
  color: var(--warn);
  font-size: var(--t-sm);
  flex-basis: 100%;
}
.note-bar-error:empty {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .rec-dot {
    animation: none;
  }
}

/* ---------- ledger: every note, attached to the timeline ---------- */

.ledger {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px 16px 10px;
  background: var(--bg);
}
.tab .count {
  height: 20px;
  min-width: 20px;
  font-size: 0.75rem;
}
.ledger-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ledger-title {
  font-size: var(--t-md);
  font-weight: 800;
  margin: 0;
}
.ledger-hint {
  color: var(--ink-3);
  font-size: var(--t-sm);
  margin-left: auto;
}
.ledger .note-list {
  border-top: 1px solid var(--line);
}
.ledger .notes-foot {
  padding-top: 4px;
}
.note.is-now .note-time {
  background: var(--red);
  color: var(--on-red);
}
.ledger-toggle.is-on {
  border-color: var(--ink);
}
.sign.is-hot {
  background: #2a2a2a;
  transform: translateX(-50%) scale(1.15);
  z-index: 2;
}
.detail-notes-hint {
  margin: 6px 0 0;
  color: var(--ink-3);
  font-size: var(--t-sm);
}

.version-ab {
  display: none;
}
.scope-frame.has-ab .version-ab {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-left: -2px;
  border-radius: 50%;
  border: 2px solid var(--line);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: transparent;
  transition: border-color 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.version:hover .version-ab {
  border-color: var(--ink-3);
  color: var(--ink-3);
}
.version-ab[role="button"]:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.version-ab.is-a {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.version-ab.is-b {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.scope-note {
  font-size: var(--t-sm);
  color: var(--ink-3);
}

/* ---------- compare: A against B ---------- */

.compare {
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
}
.compare-empty,
.compare-lead {
  margin: 0;
  color: var(--ink-3);
  font-size: var(--t-sm);
}
.pair-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pair-tag {
  --hue: #111111;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  min-width: 0;
}
.pair-letter {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: #fff;
  background: var(--ink);
}
.pair-letter.is-b {
  background: var(--red);
}
.pair-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--hue);
}
.pair-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}
.pair-swap .icon {
  width: 18px;
  height: 18px;
}
.pair-pick {
  margin-left: auto;
  max-width: 220px;
}
.compare-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: start;
}
.compare-label {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
  padding-top: 8px;
}
.compare-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.compare-hint {
  margin: 0;
  font-size: var(--t-sm);
  color: var(--ink-3);
  line-height: 1.4;
  max-width: 60ch;
}
.blend-fader {
  --hue-a: #111111;
  --hue-b: #e4002b;
  display: flex;
  align-items: center;
  gap: 10px;
}
.blend-end {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
}
.blend-end.is-a {
  background: var(--ink);
}
.blend-end.is-b {
  background: var(--red);
}
.blend-fader input {
  flex: 1;
  height: 32px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}
.blend-fader input::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--hue-a), var(--hue-b));
}
.blend-fader input::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--hue-a), var(--hue-b));
}
.blend-fader input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--ink);
}
.blend-fader input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--ink);
}
.blend-fader output {
  font-family: var(--mono);
  font-size: var(--t-sm);
  min-width: 12ch;
}
.compare-foot {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
}

/* ---------- blind test sheet ---------- */

.player.is-blind .tab {
  opacity: 0.35;
  pointer-events: none;
}
.blind {
  position: relative;
  height: 100%;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--bg);
}
.blind-sheet {
  position: relative;
  padding: 0 14px;
}
.blind-cols {
  position: absolute;
  left: 22px;
  right: 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.blind-mini {
  min-height: 26px;
  padding: 2px 10px;
  font-size: var(--t-sm);
}
.blind-scrub {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 6px;
  height: 20px;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}
.blind-scrub::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  border-radius: 3px;
  background: var(--line);
}
.blind-loop {
  position: absolute;
  top: 2px;
  bottom: 2px;
  background: var(--loop-fill, rgba(228, 0, 43, 0.14));
  border-left: 1.5px solid var(--red);
  border-right: 1.5px solid var(--red);
  border-radius: 3px;
}
.blind-loop.is-draft {
  border-style: dashed;
}
.blind-head {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  margin-left: -1px;
  background: var(--ink);
  pointer-events: none;
}
.blind-col-label {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: var(--t-sm);
  font-weight: 800;
  white-space: nowrap;
}
.blind-col-label .blind-hint {
  font-weight: 500;
}
.blind-progress {
  font-family: var(--mono);
  font-size: var(--t-sm);
  color: var(--ink-3);
}
.blind-line {
  position: absolute;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 8px;
  border-radius: var(--r-ctl);
  cursor: pointer;
}
.blind-line::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  border-bottom: 1px dashed var(--line);
}
.blind-line:hover,
.blind-line.is-active {
  background: var(--panel);
}
.blind-line.is-active::before {
  border-bottom-style: solid;
  border-color: var(--ink);
}
.blind-line.is-winner {
  background: var(--red-soft, #fbe9ec);
}
.blind-note {
  font-size: var(--t-sm);
  color: var(--ink-3);
}
.blind-rank {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--ink);
  min-width: 5ch;
}
.blind-line.is-winner .blind-rank {
  color: var(--red);
}
.blind-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* stars */
.stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--ink);
}
.star-cell {
  position: relative;
  width: 28px;
  height: 28px;
  color: var(--line);
}
.star-cell.is-lit {
  color: var(--ink);
}
.star-cell .star {
  width: 28px;
  height: 28px;
  display: block;
}
.star-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}
.star-hit.is-l {
  left: 0;
}
.star-hit.is-r {
  right: 0;
}
.star-hit:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: -2px;
  border-radius: 4px;
}
.stars:hover .star-cell {
  color: var(--ink-3);
}
.stars:hover .star-cell.is-lit {
  color: var(--ink);
}
.stars-val {
  font-family: var(--mono);
  font-size: var(--t-sm);
  min-width: 3ch;
  margin-left: 6px;
  color: var(--ink-2);
}

/* ---------- measurements: one row per version, on the map's lanes ---------- */

.measure {
  --measure-col: 132px;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  background: var(--bg);
}
/* Floats in the label band at the top right, like the map's key. */
.measure-tools {
  position: absolute;
  top: 6px;
  right: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 0 10px;
  background: var(--bg);
}
.measure-tools select {
  min-height: 32px;
}
.measure-hint {
  margin-left: auto;
  min-width: 0;
  text-align: right;
  color: var(--ink-3);
  font-size: var(--t-sm);
}
.measure-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.measure-empty {
  margin: 0;
  padding: 24px 16px;
  color: var(--ink-3);
  font-size: var(--t-sm);
}
.measure-sheet {
  position: relative;
  min-width: max-content;
  padding: 0 14px;
}
.measure-cols {
  position: absolute;
  left: 14px;
  display: grid;
  gap: 0;
}
.measure-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  padding: 0 8px;
  min-width: 0;
}
.measure-col-group {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.measure-col-label {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
  cursor: help;
  text-decoration: underline dotted rgba(0, 0, 0, 0.35);
  text-underline-offset: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.measure-line {
  position: absolute;
  left: 14px;
  display: grid;
  align-items: center;
  border-radius: var(--r-ctl);
  cursor: pointer;
}
.measure-line::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  border-bottom: 1px dashed var(--line);
}
.measure-line:hover {
  background: var(--panel);
}
.measure-line.is-active {
  background: var(--panel);
}
.measure-line.is-active::before {
  border-bottom-style: solid;
  border-color: var(--ink);
}
.measure-cell {
  padding: 0 8px;
  min-width: 0;
}
.measure-val {
  display: block;
  font-family: var(--mono);
  font-size: var(--t-md);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.measure-line.is-active .measure-val {
  font-weight: 700;
}
.measure-val.is-muted {
  color: var(--ink-3);
  font-weight: 400;
}
.measure-val.is-ok {
  color: var(--ok, #15803d);
}
.measure-val.is-near {
  color: var(--warn);
}
.measure-val.is-over,
.measure-val.is-under {
  color: var(--red);
}
.detail-changelog {
  gap: 12px;
}
.detail-changelog .detail-delete {
  display: flex;
  justify-content: flex-end;
}

/* ---------- true peaks: one row per version, on the map's lanes ---------- */

.peaks {
  position: relative;
  height: 100%;
  min-width: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--bg);
}
.peaks-empty {
  margin: 0;
  padding: 24px 16px;
  color: var(--ink-3);
  font-size: var(--t-sm);
}
.peaks-sheet {
  position: relative;
  min-width: max-content;
  padding: 0 14px;
}
.peaks-cols {
  position: absolute;
  left: 14px;
  display: grid;
  grid-template-columns: 200px auto;
}
.peaks-col-label {
  padding: 0 8px;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
  cursor: help;
  text-decoration: underline dotted rgba(0, 0, 0, 0.35);
  text-underline-offset: 3px;
  white-space: nowrap;
}
.peaks-line {
  position: absolute;
  left: 14px;
  right: 14px;
  min-width: max-content;
  display: grid;
  grid-template-columns: 200px auto;
  align-items: center;
  border-radius: var(--r-ctl);
  cursor: pointer;
}
.peaks-line::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  border-bottom: 1px dashed var(--line);
}
.peaks-line:hover,
.peaks-line.is-active {
  background: var(--panel);
}
.peaks-line.is-active::before {
  border-bottom-style: solid;
  border-color: var(--ink);
}
.peaks-max {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 8px;
  white-space: nowrap;
}
.peaks-val {
  font-family: var(--mono);
  font-size: var(--t-md);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--ink);
}
.peaks-line.is-active .peaks-val {
  font-weight: 700;
}
.peaks-val.is-over {
  color: var(--red);
}
.peaks-val.is-muted {
  color: var(--ink-3);
  font-weight: 400;
}
.peaks-count {
  font-size: var(--t-sm);
  color: var(--ink-3);
}
.peaks-list {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  white-space: nowrap;
}
.peak-chip {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  line-height: 1;
  color: var(--bg);
  background: var(--ink);
  padding: 5px 7px;
  border-radius: var(--r-ctl);
}
.peak-chip:hover {
  background: var(--red);
}
.peaks-more {
  font-size: var(--t-sm);
  color: var(--ink-3);
}

/* ---------- import ---------- */

.dropzone {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: 2px dashed var(--line);
  border-radius: var(--r-panel);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out), background 0.2s var(--ease-out);
}
.dropzone:hover,
.dropzone.is-over {
  border-color: var(--ink);
  background: var(--panel);
  color: var(--ink);
}
.dropzone.is-over {
  border-style: solid;
}
.dropzone.is-busy {
  border-color: var(--red);
  cursor: progress;
}
.dropzone:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.dropzone-icon {
  width: 22px;
  height: 22px;
  color: var(--ink);
  flex: none;
}
.dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dropzone-title {
  font-weight: 800;
  line-height: 1.25;
}
.dropzone-body {
  font-size: var(--t-sm);
  color: var(--ink-3);
}
.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.import-status {
  margin-left: auto;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
  text-align: right;
  max-width: 40ch;
}
.import-status.is-error {
  color: var(--warn);
}
.import-status:empty {
  display: none;
}


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

@media (max-width: 1100px) {
  .scope-frame {
    grid-template-columns: 56px 1fr;
  }
  .version {
    grid-template-columns: 34px;
    left: 4px;
    right: 4px;
    justify-items: center;
  }
  .version-name,
  .version-meta,
  .version-ab,
  .legend-drop-text,
  .map-legend .import-status {
    display: none;
  }
  .legend-drop {
    left: 6px;
    right: 6px;
    justify-content: center;
    min-height: 44px;
    padding: 8px 0;
  }
}

@media (max-width: 960px) {
  .match-hint {
    text-align: left;
  }
}

@media (max-width: 880px) {
  .app {
    grid-template-columns: 1fr;
  }
  .rail {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 16px;
  }
  .client-list {
    max-height: 40vh;
  }
  .stage {
    padding: 24px 16px 48px;
  }
  .song-head {
    align-items: flex-start;
  }
  .player {
    padding: 8px;
    border-radius: 12px;
  }
  .loop-tools {
    margin-left: 0;
    width: 100%;
  }
  .scope-frame {
    height: 260px;
  }
  .meter {
    display: none;
  }
  .volume {
    margin-left: 0;
    width: 100%;
  }
  .volume-slider {
    flex: 1;
    height: 44px;
  }
  .play {
    width: 64px;
    height: 64px;
  }
  .chip,
  .toggle,
  .tab,
  select {
    min-height: 44px;
  }
  .version {
    min-height: 44px;
  }
  .first-run {
    flex-direction: column;
    align-items: flex-start;
  }
  .subtabs .detail-delete {
    margin-left: 0;
    flex-basis: 100%;
    justify-content: flex-start;
    padding-bottom: 8px;
  }
  .scope-head {
    gap: 8px;
  }
  .tabs {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tab {
    white-space: nowrap;
  }
  .note {
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 10px 4px;
  }
  .note-text {
    white-space: normal;
    flex-basis: 100%;
    order: 10;
    padding: 0 2px;
  }
  .note-input {
    flex-basis: 100%;
    order: 10;
  }
  .note-delete {
    opacity: 1;
    margin-left: auto;
  }
  .note-version {
    font-size: 0;
    line-height: 0;
    gap: 0;
    padding: 6px;
  }
  .loop-range {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .ledger-hint {
    display: none;
  }
  .compare-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .compare-label {
    padding-top: 0;
  }
  .pair-pick {
    margin-left: 0;
    width: 100%;
    max-width: none;
  }
  .measure-tools .select-wrap > span {
    display: none;
  }
  .measure-tools select {
    min-height: 36px;
  }
  .now-sign {
    width: 100%;
    min-height: 44px;
  }
  .note-strip {
    height: 46px;
  }
  .sign {
    top: 9px;
    height: 32px;
    min-width: 36px;
  }
  .sign .icon {
    width: 18px;
    height: 18px;
  }
  .note-bar-add {
    order: 2;
  }
  .note-bar-now {
    order: 1;
    flex-basis: 100%;
  }
  .note-bar-tools {
    order: 3;
    margin-left: auto;
  }
  .note-bar-tools .seg-btn {
    min-height: 36px;
  }
  .dropzone {
    flex-wrap: wrap;
  }
  .import-status {
    margin-left: 0;
    text-align: left;
  }
}

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