[hidden] { display: none !important; }
:root {
  --bg: #f6f4ee;
  --panel: #fffdf8;
  --paper: #efece3;
  --paper-2: #e5e1d5;
  --line: #e0dbcd;
  --text: #121212;
  --muted: #6f6b62;
  --faint: #b3aea2;
  --ghost: #e4e0d4;
  --accent: #2b3dff;
  --accent-soft: #e7e9ff;
  --hi: #d7ff3c;
  --hi-soft: #f1ffc4;
  --warn: #ff5a1f;
  --ok: #0f8a4f;
  --spotify: #1ed760;
  --radius: 6px;
  --display: 'Inter Tight', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.4 var(--display); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.label-caps, .rs-label, .nav-item, .nav-tag, .tl-head, .fact small { text-transform: uppercase; letter-spacing: 0.02em; font-weight: 600; }

/* ---------- masthead ---------- */
.rule { height: 6px; background: var(--accent); }
.masthead { padding: 0 20px; }
.wordmark {
  margin: 0; font-weight: 900; text-transform: uppercase; color: var(--ghost);
  font-size: clamp(24px, calc((100vw - 40px) / 9.9), 200px); line-height: 0.86; letter-spacing: -0.055em;
  white-space: nowrap; overflow: hidden; padding-top: 0.08em; margin-left: -0.04em;
}
.topnav { display: flex; align-items: center; gap: 12px 40px; padding: 14px 0 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.nav-tag { font-size: 14px; color: var(--accent); }
.nav-item { font-size: 14px; color: var(--muted); }
.account { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.badge { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.badge.live { color: var(--ok); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--text); background: var(--bg); color: var(--text); border-radius: var(--radius);
  padding: 9px 16px; cursor: pointer; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap;
  transition: background 0.12s, color 0.12s, transform 0.08s;
}
.btn:hover:not(:disabled) { background: var(--text); color: var(--bg); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.primary { background: var(--text); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.btn.spotify { background: var(--text); color: #fff; }
.btn.spotify:hover:not(:disabled) { background: var(--spotify); border-color: var(--spotify); color: #000; }
.btn.subtle { border-color: var(--line); }
.btn.subtle:hover:not(:disabled) { border-color: var(--text); }
.btn.small { padding: 6px 11px; font-size: 12px; }
.btn.icon { width: 38px; height: 38px; padding: 0; }
.btn.small.icon { width: 30px; height: 30px; font-size: 15px; }
.btn.full { width: 100%; padding: 15px; font-size: 14px; }

/* ---------- run strip: pink band, red type ---------- */
.run-strip {
  margin: 20px; padding: 18px 22px; border-radius: var(--radius);
  background: var(--hi); color: var(--accent);
  display: flex; align-items: flex-end; gap: 16px 28px; flex-wrap: wrap;
}
.rs-label { font-size: 13px; margin-bottom: 8px; }
.run-strip .rs-label { color: var(--accent); }
.rs-op { font-weight: 800; font-size: 28px; line-height: 44px; letter-spacing: -0.04em; }
.dist-picker { display: flex; gap: 0; flex-wrap: wrap; border: 2px solid var(--accent); border-radius: var(--radius); overflow: hidden; }
.dist-picker button { border: 0; border-right: 2px solid var(--accent); background: transparent; color: var(--accent); padding: 0 14px; height: 40px; cursor: pointer; font-weight: 800; font-size: 16px; letter-spacing: -0.02em; }
.dist-picker button:hover { background: rgba(43, 61, 255, 0.12); }
.dist-picker button.active, .dist-picker .custom.active { background: var(--accent); color: var(--hi); }
.dist-picker .custom { display: flex; align-items: center; gap: 2px; padding: 0 12px 0 4px; height: 40px; color: var(--accent); cursor: text; }
.dist-picker .custom input { width: 64px; border: 0; background: transparent; color: inherit; font-weight: 800; font-size: 16px; text-align: right; padding: 0 4px; -moz-appearance: textfield; }
.dist-picker .custom input::-webkit-inner-spin-button { -webkit-appearance: none; }
.dist-picker .custom input:focus { outline: none; }
.dist-picker .custom span { font-weight: 700; font-size: 14px; }
.pace-input { display: flex; align-items: center; gap: 2px; border: 2px solid var(--accent); border-radius: var(--radius); padding: 0 12px 0 6px; height: 44px; font-weight: 700; font-size: 14px; }
.pace-input input { width: 64px; border: 0; background: transparent; color: var(--accent); font-weight: 800; font-size: 20px; text-align: right; padding: 0 4px; letter-spacing: -0.02em; }
.pace-input input:focus { outline: none; }
.finish-time { font-size: 56px; line-height: 44px; font-weight: 900; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; padding-top: 4px; }
.seg { margin-left: auto; display: inline-flex; border: 2px solid var(--accent); border-radius: var(--radius); overflow: hidden; align-self: center; }
.seg button { border: 0; background: transparent; color: var(--accent); padding: 6px 12px; cursor: pointer; font-weight: 800; font-size: 13px; text-transform: uppercase; }
.seg button.active { background: var(--accent); color: var(--hi); }

/* ---------- layout ---------- */
.workspace { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; gap: 20px; padding: 0 20px 40px; align-items: start; }
.panel { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.side { display: grid; gap: 12px; position: sticky; top: 16px; }
.side > * { min-width: 0; }
@media (max-width: 1200px) {
  .workspace { grid-template-columns: 280px minmax(0, 1fr); }
  .side { grid-column: 1 / -1; position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}
@media (max-width: 760px) {
  .masthead { padding: 0 16px; }
  .topnav { gap: 10px 18px; }
  .nav-item { display: none; }
  .run-strip { margin: 16px; }
  .workspace { grid-template-columns: 1fr; padding: 0 16px 32px; }
  .seg { margin-left: 0; }
  .rs-op { display: none; }
  .finish-time { font-size: 44px; }
  .dist-picker button { padding: 0 10px; }
}

/* ---------- library ---------- */
.library { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; max-height: calc(100vh - 32px); padding: 0; border: 0; }
@media (max-width: 760px) { .library { position: static; max-height: 440px; } }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px 4px; cursor: pointer; font-weight: 700; font-size: 13px; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--text); border-bottom-color: var(--text); }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 12px; color: var(--muted); }
.search:focus-within { border-color: var(--text); }
.search input { flex: 1; border: 0; background: transparent; padding: 10px 0; min-width: 0; }
.search input:focus { outline: none; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.hint b { color: var(--text); }
.hint.small { font-size: 12px; }
.song-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 120px; border-top: 1px solid var(--line); }
.song { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); cursor: grab; user-select: none; touch-action: pan-y; }
.song:hover { background: var(--paper); }
.song .handle { color: var(--faint); touch-action: none; padding: 6px 0 6px 2px; cursor: grab; display: grid; }
.song .art { width: 36px; height: 36px; border-radius: 2px; flex: none; display: grid; place-items: center; font-weight: 900; font-size: 15px; object-fit: cover; background: var(--paper-2) !important; color: var(--text); }
.song:nth-child(3n+1) .art { background: var(--hi) !important; color: var(--accent); }
.song:nth-child(3n+2) .art { background: var(--accent) !important; color: var(--hi); }
.song .meta { flex: 1; min-width: 0; }
.song .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.song .a { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .d { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.song .used { width: 7px; height: 7px; background: var(--accent); flex: none; }
.song .add { width: 28px; height: 28px; border-radius: var(--radius); border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 16px; line-height: 1; flex: none; }
.song .add:hover { background: var(--text); color: #fff; border-color: var(--text); }
.empty { color: var(--muted); padding: 24px 8px; text-align: center; }

/* ---------- timeline ---------- */
.timeline-card { padding: 0; border: 0; }
.tl-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.tl-toolbar h2 { margin: 0; font-size: 34px; font-weight: 900; letter-spacing: -0.05em; line-height: 0.9; text-transform: uppercase; }
.tl-tools { display: flex; align-items: center; gap: 4px; }
.zoom { display: flex; gap: 4px; margin-left: 6px; }
.tl-head { display: grid; grid-template-columns: 56px 48px 1fr; font-size: 11px; color: var(--muted); padding: 0 0 6px; }
.tl-head span { padding-left: 8px; }
.tl-scroll { border-top: 2px solid var(--text); position: relative; }
.tl-inner { position: relative; }
.axis { position: absolute; top: 0; bottom: 0; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; }
.axis.time { left: 0; width: 56px; font-weight: 600; color: var(--text); }
.axis.km { left: 56px; width: 48px; }
.axis .tick { position: absolute; left: 0; right: 0; height: 0; }
.axis .tick span { position: absolute; top: -8px; padding: 0 8px; white-space: nowrap; }
.axis.km .tick.major span { color: var(--accent); font-weight: 700; }
.lane { position: absolute; top: 0; bottom: 0; left: 104px; right: 0; border-left: 1px solid var(--line); cursor: crosshair; }
.gridline { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); pointer-events: none; }
.finish-line { position: absolute; left: -104px; right: 0; height: 0; border-top: 3px solid var(--accent); z-index: 3; pointer-events: none; }
.finish-line span { position: absolute; right: 0; top: 6px; font-size: 13px; font-weight: 900; letter-spacing: -0.02em; color: var(--accent); text-transform: uppercase; }
.beyond { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, transparent 0 7px, var(--paper) 7px 14px); pointer-events: none; }
.gap-zone {
  position: absolute; left: 8px; right: 8px; border: 1.5px dashed var(--accent); border-radius: var(--radius);
  color: var(--accent); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em;
  display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; cursor: pointer; background: rgba(43, 61, 255, 0.03);
}
.block {
  position: absolute; left: 8px; right: 8px; border-radius: var(--radius); padding: 9px 12px; overflow: hidden;
  cursor: grab; user-select: none; touch-action: pan-y;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--paper); border: 1px solid var(--line);
  transition: top 0.2s cubic-bezier(.2,.8,.2,1), height 0.2s;
}
.block:hover { border-color: var(--text); }
.block.pinned { background: var(--hi); border-color: var(--hi); color: var(--accent); }
.block.pinned .a, .block.pinned .when { color: var(--accent); opacity: 0.85; }
.block.drifted { background: var(--bg); border: 1.5px dashed var(--accent); color: var(--accent); }
.block.dragging { opacity: 0.3; transition: none; }
.block.is-selected { outline: 2px solid var(--text); outline-offset: 1px; z-index: 2; }
.block .grip { color: var(--faint); touch-action: none; display: grid; padding-top: 3px; }
.block.pinned .grip { color: var(--accent); opacity: 0.5; }
.block .body { flex: 1; min-width: 0; }
.block .t { font-weight: 800; font-size: 15px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block .a { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block .when { text-align: right; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.block .when b { color: inherit; font-weight: 800; display: block; font-size: 15px; letter-spacing: -0.02em; }
.block .when b { color: var(--text); }
.block.pinned .when b, .block.drifted .when b { color: var(--accent); }
.block .pin { margin-left: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; }
.block.compact { padding-top: 0; padding-bottom: 0; align-items: center; }
.block.compact .a, .block.compact .when span { display: none; }
.block.compact .body { display: flex; gap: 8px; align-items: baseline; }
.block.compact .when b { display: inline; }
.block.tiny .body, .block.tiny .when, .block.tiny .grip { display: none; }
.target-mark { position: absolute; left: 0; right: 0; height: 0; border-top: 2px dotted var(--accent); pointer-events: none; z-index: 1; }
.target-mark span { position: absolute; right: 8px; top: -9px; font-size: 10px; font-weight: 800; color: var(--hi); background: var(--accent); padding: 1px 5px; text-transform: uppercase; }
.drop-ind { position: absolute; left: -104px; right: 0; height: 0; border-top: 2px solid var(--text); z-index: 5; pointer-events: none; }
.drop-ind .label { position: absolute; left: 0; top: -12px; background: var(--text); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; white-space: nowrap; }
.drop-ind .preview { position: absolute; left: 112px; right: 8px; top: 0; border-radius: var(--radius); border: 2px dashed var(--text); background: rgba(0,0,0,0.03); }
.scrubber { position: absolute; left: -104px; right: 0; height: 0; border-top: 1.5px solid var(--accent); z-index: 4; pointer-events: none; }
.scrubber .label { position: absolute; left: 0; top: -12px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; white-space: nowrap; }
.scrubber .add { position: absolute; left: 55%; transform: translate(-50%, -50%); background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; padding: 5px 12px; border-radius: var(--radius); text-transform: uppercase; white-space: nowrap; }
.lane-empty { position: absolute; left: 0; right: 0; top: 48px; text-align: center; color: var(--muted); padding: 0 16px; pointer-events: none; }
.lane-empty b { display: block; color: var(--text); font-size: 26px; font-weight: 900; letter-spacing: -0.04em; text-transform: uppercase; margin-bottom: 6px; line-height: 1; }
.drag-ghost { position: fixed; z-index: 50; pointer-events: none; padding: 8px 14px; background: var(--text); color: #fff; font-weight: 700; font-size: 13px; transform: translate(12px, 12px); white-space: nowrap; border-radius: var(--radius); }

/* ---------- side panel ---------- */
.status { display: grid; gap: 12px; border: 0; padding: 0; }
.cov-head { display: flex; justify-content: space-between; align-items: flex-end; border-top: 2px solid var(--text); padding-top: 10px; }
.cov-head .rs-label { margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.cov-time { font-size: 44px; font-weight: 900; letter-spacing: -0.05em; line-height: 0.95; font-variant-numeric: tabular-nums; }
.cov-time .of { color: var(--faint); font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.cov-count { color: var(--muted); font-size: 13px; padding-bottom: 4px; font-weight: 600; text-transform: uppercase; }
.progress { height: 10px; background: var(--paper-2); overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width 0.3s ease; }
.progress.done .bar { background: var(--ok); }
.progress-label { font-size: 13px; color: var(--muted); }
.progress-label.done { color: var(--ok); font-weight: 700; }

.selected { display: grid; gap: 10px; border: 2px solid var(--text); }
.selected .head { display: flex; gap: 12px; align-items: flex-start; }
.selected .head .info { flex: 1; min-width: 0; }
.selected .head b { display: block; font-size: 20px; font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; }
.selected .head span { color: var(--muted); font-size: 13px; }
.selected .close { border: 0; background: transparent; color: var(--text); cursor: pointer; font-size: 22px; line-height: 1; padding: 0 2px; }
.selected .facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.selected .fact { background: var(--paper); padding: 8px 10px; font-size: 12.5px; }
.selected .fact small { display: block; color: var(--muted); font-size: 11px; }
.selected .fact b { font-variant-numeric: tabular-nums; font-size: 15px; }
.selected .move { display: flex; gap: 6px; }
.selected .move input { flex: 1; width: 0; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.selected .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.issues { display: grid; gap: 10px; }
.issue { padding: 12px 14px; border: 1.5px solid var(--accent); border-radius: var(--radius); display: grid; gap: 10px; }
.issue .msg { font-size: 14px; }
.issue .msg b { color: var(--accent); font-weight: 800; }
.issue .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.issue .acts .btn { white-space: normal; text-align: left; line-height: 1.25; }
.issue .acts .btn.primary { background: var(--accent); border-color: var(--accent); }
.issue .acts .btn.primary:hover { background: var(--text); border-color: var(--text); }
.issue.ok { border-color: var(--ok); }
.issue.ok .msg b { color: var(--ok); }
.issue.info { border: 0; background: var(--hi-soft); }
.issue.info .msg b { color: var(--accent); }

/* ---------- dialogs ---------- */
.dialog { border: 2px solid var(--text); border-radius: var(--radius); background: var(--bg); color: var(--text); padding: 22px; width: min(460px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(18, 18, 18, 0.45); }
.dialog h3 { margin: 0 0 14px; font-size: 26px; font-weight: 900; letter-spacing: -0.04em; line-height: 1; text-transform: uppercase; }
.dialog .choice { display: grid; gap: 12px; margin: 10px 0 18px; }
.dialog .choice label { display: flex; align-items: center; gap: 8px; }
.dialog input[type=radio] { accent-color: var(--accent); }
.dialog .choice input[type=text], .dialog .choice input[type=number] { padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.dialog .stack { display: grid; gap: 6px; font-size: 12px; color: var(--muted); margin: 10px 0; font-weight: 600; text-transform: uppercase; }
.dialog .stack input { padding: 11px 12px; border: 1px solid var(--text); border-radius: var(--radius); font-size: 16px; font-weight: 600; text-transform: none; color: var(--text); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.codebox { display: block; padding: 10px 12px; background: var(--paper); margin: 10px 0; word-break: break-all; font-size: 13px; }
.match-list { font-size: 13px; max-height: 180px; overflow: auto; margin: 8px 0; padding-left: 18px; }
.match-list .miss { color: var(--accent); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 11px 18px; font-size: 14px; font-weight: 600; z-index: 60; max-width: calc(100vw - 32px); border-radius: var(--radius); }

.dialog.pick { width: min(520px, calc(100vw - 32px)); padding: 20px; }
.pick-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.pick-head h3 { margin: 0 0 4px; }
.pick .search { margin: 14px 0 8px; }
.pick .song-list { max-height: min(420px, 55vh); }
.pick .song { cursor: pointer; }
.fit { font-size: 11px; font-weight: 800; padding: 2px 6px; text-transform: uppercase; }
.fit.yes { background: var(--hi); color: var(--accent); }
.fit.no { background: var(--paper); color: var(--muted); }
.copybox { width: 100%; background: var(--paper); border: 1px solid var(--line); color: var(--text); padding: 8px; font: 12px/1.4 ui-monospace, monospace; }

.export-warning { margin: 12px 0; padding: 12px 14px; border: 1.5px solid var(--accent); border-radius: var(--radius); font-size: 13.5px; }
.export-warning p { margin: 0 0 6px; }
.export-warning b { color: var(--accent); }
.export-warning ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.dialog.save { width: min(480px, calc(100vw - 32px)); }
.save-options { display: grid; gap: 8px; margin: 14px 0 4px; }
.save-opt { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--text); background: var(--bg); cursor: pointer; transition: background 0.12s, color 0.12s; }
.save-opt:hover:not(:disabled) { background: var(--text); color: #fff; }
.save-opt:hover:not(:disabled) small { color: #bbb; }
.save-opt:disabled { opacity: 0.5; cursor: progress; }
.save-opt .ico { width: 40px; height: 40px; display: grid; place-items: center; background: var(--spotify); color: #000; font-size: 18px; flex: none; border-radius: 50%; }
.save-opt .txt { display: grid; gap: 2px; }
.save-opt b { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.save-opt small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.save-more { margin: 14px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--text); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--accent); }
#export-spotify:not(:empty) { margin-top: 10px; }


/* ---------- v3: own palette, cobalt + volt ---------- */
.masthead { padding: 22px 20px 6px; }
.brand-row { display: flex; align-items: flex-end; gap: 10px 24px; flex-wrap: wrap; }
.wordmark { color: var(--text); font-size: clamp(26px, min(7.4vw, 5.4vw + 12px), 84px); line-height: 0.9; letter-spacing: -0.05em; padding: 0; margin: 0; white-space: normal; overflow: visible; }
.wordmark span { color: transparent; -webkit-text-stroke: 2px var(--accent); }
.tagline { margin: 0 0 6px; color: var(--muted); font-size: 15px; max-width: 260px; line-height: 1.3; }
.account { margin-left: auto; padding-bottom: 6px; }

.run-strip { background: var(--accent); color: var(--hi); border-radius: 10px; }
.run-strip .rs-label { color: var(--hi); display: flex; align-items: center; gap: 10px; }
.dist-picker, .pace-input, .seg { border-color: rgba(215, 255, 60, 0.55); }
.dist-picker button { border-right-color: rgba(215, 255, 60, 0.55); color: var(--hi); }
.dist-picker button:hover { background: rgba(215, 255, 60, 0.12); }
.dist-picker button.active, .dist-picker .custom.active, .seg button.active { background: var(--hi); color: var(--accent); }
.dist-picker .custom, .pace-input input { color: var(--hi); }
.pace-input { color: var(--hi); }
.seg { margin: 0; border-width: 1.5px; }
.seg button { color: var(--hi); padding: 2px 9px; font-size: 11px; }

.btn.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.song:nth-child(3n+1) .art { background: var(--hi) !important; color: var(--text); }
.song:nth-child(3n+2) .art { background: var(--accent) !important; color: var(--hi); }
.song .used { background: var(--accent); border-radius: 50%; }
.dialog::backdrop { background: rgba(18, 18, 18, 0.45); }

/* timeline columns: tinted time + distance */
.tl-head span:nth-child(1) { background: var(--paper); }
.tl-head span:nth-child(2) { background: var(--accent-soft); color: var(--accent); }
.tl-head span { padding: 6px 8px; }
.tl-head { padding: 0; }
.axis.time { background: var(--paper); }
.axis.km { background: var(--accent-soft); color: var(--accent); }
.axis.km .tick.major span { color: var(--accent); }
.axis .tick::after { content: ''; position: absolute; right: 0; top: 0; width: 8px; border-top: 1.5px solid currentColor; opacity: 0.55; }
.axis .tick.minor::after { width: 4px; opacity: 0.35; }
.axis.km .tick:not(.major)::after { width: 5px; opacity: 0.4; }
.lane { background: var(--panel); cursor: pointer; }
.lane .block { cursor: grab; }
.gridline { border-top-color: rgba(18, 18, 18, 0.06); }

.block { background: var(--bg); }
.block.pinned { background: var(--hi); border-color: #c3ec25; color: var(--text); }
.block.pinned .a, .block.pinned .when { color: var(--text); opacity: 0.7; }
.block.pinned .when b { color: var(--text); }
.block.pinned .grip { color: var(--text); opacity: 0.35; }
.block.drifted { border-color: var(--warn); color: var(--warn); }
.block.drifted .when b { color: var(--warn); }
.target-mark { border-top-color: var(--warn); }
.target-mark span { background: var(--warn); color: #fff; }
.finish-line { border-top-color: var(--text); }
.finish-line span { color: var(--text); }
.scrubber .add { background: var(--accent); }
.scrubber { border-top-color: var(--accent); }
.scrubber .label { background: var(--accent); }

.gap-zone { flex-direction: column; gap: 8px; border-color: var(--accent); color: var(--accent); background: rgba(43, 61, 255, 0.04); cursor: pointer; }
.gap-zone.slim { flex-direction: row; gap: 12px; }
.gap-acts { display: flex; gap: 6px; }
.gap-acts button { border: 1.5px solid var(--accent); background: var(--panel); color: var(--accent); border-radius: 99px; padding: 4px 11px; font: inherit; font-size: 11.5px; font-weight: 800; text-transform: uppercase; cursor: pointer; }
.gap-acts button:hover { background: var(--accent); color: #fff; }
.gap-acts button + button { background: var(--accent); color: #fff; }
.gap-acts button + button:hover { background: var(--text); border-color: var(--text); }

.zoom { align-items: center; }
.zoom-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); margin-right: 2px; }

.cov-head { border-top-color: var(--text); }
.progress .bar { background: var(--accent); }
.issue { border-color: var(--accent); background: var(--panel); }
.issue .msg b { color: var(--accent); }
.issue .acts .btn.primary { background: var(--accent); border-color: var(--accent); }
.issue.info { background: var(--hi-soft); }
.issue.info .msg b { color: var(--text); }
.selected { background: var(--panel); }
.fit.yes { background: var(--hi); color: var(--text); }
.export-warning { border-color: var(--warn); background: #fff4ee; }
.export-warning b, .export-warning .hd { color: var(--warn); font-weight: 800; }
.export-warning p { margin: 0 0 6px; }
.export-warning p:last-child { margin-bottom: 0; }
.panel { background: var(--panel); }
.library, .timeline-card, .status { background: transparent; }
.search, .selected .move input, .dialog .stack input { background: var(--panel); }
.dialog { background: var(--panel); }
@media (max-width: 760px) { .tagline { display: none; } .account { margin-left: 0; } }

/* ---------- v4: pastel, square, one button style ---------- */
:root {
  --bg: #f7f5f0;
  --panel: #fdfcf9;
  --paper: #efede6;
  --paper-2: #e6e3da;
  --line: #e3e0d7;
  --line-strong: #cfcbc0;
  --text: #24252c;
  --muted: #77756e;
  --faint: #b9b6ad;
  --ink-soft: #2e3366;
  --accent: #6d7bd9;
  --accent-soft: #e5e8fb;
  --hi: #eaf4c2;
  --hi-soft: #f3f8dd;
  --warn: #d9784f;
  --ok: #4f9a6e;
  --radius: 2px;
}
* { border-radius: 0; }
.btn, .save-opt, .search, .dist-picker, .pace-input, .seg, .run-strip, .block, .gap-zone, .issue, .dialog, .panel, .toast, .drag-ghost, .export-warning, .song .art, .song .add, .gap-acts button, .selected .move input, .dialog .stack input { border-radius: var(--radius) !important; }

/* buttons: one style everywhere */
.btn, .gap-acts button, .song .add {
  background: var(--panel); color: var(--text); border: 1px solid var(--line-strong);
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; padding: 8px 14px;
}
.btn:hover:not(:disabled), .gap-acts button:hover, .song .add:hover { background: var(--panel); color: var(--text); border-color: var(--text); }
.btn.primary, .btn.spotify { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover:not(:disabled), .btn.spotify:hover:not(:disabled) { background: #3a3c46; color: var(--bg); border-color: #3a3c46; }
.btn.subtle { background: var(--panel); border-color: var(--line-strong); }
.btn.small, .gap-acts button { padding: 6px 10px; font-size: 11px; }
.gap-acts button + button { background: var(--panel); color: var(--text); }
.issue .acts .btn.primary { background: var(--text); border-color: var(--text); }
.song .add { padding: 0; font-size: 15px; }
.btn.full { padding: 14px; font-size: 13px; }

/* header */
.wordmark { color: var(--text); }
.wordmark span { -webkit-text-stroke: 1.5px var(--accent); }

/* run strip: soft periwinkle */
.run-strip { background: var(--accent-soft); color: var(--ink-soft); }
.run-strip .rs-label { color: var(--ink-soft); opacity: 0.75; }
.dist-picker, .pace-input, .seg { border: 1px solid rgba(46, 51, 102, 0.25); background: rgba(255,255,255,0.45); }
.dist-picker button { color: var(--ink-soft); border-right: 1px solid rgba(46, 51, 102, 0.18); }
.dist-picker button:hover { background: rgba(255,255,255,0.6); }
.dist-picker button.active, .dist-picker .custom.active, .seg button.active { background: var(--ink-soft); color: var(--accent-soft); }
.dist-picker .custom, .pace-input, .pace-input input, .seg button { color: var(--ink-soft); }
.rs-op { color: var(--accent); }
.finish-time { color: var(--ink-soft); }

/* library swatches: pastel */
.song .art, .song:nth-child(3n+1) .art, .song:nth-child(3n+2) .art { color: var(--ink-soft); }
.song:nth-child(4n+1) .art { background: #e5e8fb !important; }
.song:nth-child(4n+2) .art { background: #eaf4c2 !important; }
.song:nth-child(4n+3) .art { background: #fbe3d7 !important; }
.song:nth-child(4n+4) .art { background: #efe6f8 !important; }
.song .used { background: var(--accent); }

/* timeline */
.tl-scroll { border-top: 1px solid var(--text); }
.axis.time, .tl-head span:nth-child(1) { background: var(--paper); }
.axis.km, .tl-head span:nth-child(2) { background: var(--accent-soft); color: var(--accent); }
.axis.km .tick.major span { color: var(--ink-soft); }
.lane { background: var(--panel); }
.block { background: var(--c, var(--paper)); border: 1px solid rgba(0, 0, 0, 0.06); color: var(--text); padding-right: 40px; }
.block:hover { border-color: rgba(0, 0, 0, 0.35); }
.block .a, .block .when { color: rgba(36, 37, 44, 0.62); }
.block .when b { color: var(--text); }
.block .grip { color: rgba(36, 37, 44, 0.3); }
.block.is-selected { outline: 1.5px solid var(--text); }
.del { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid transparent; background: transparent; color: rgba(36, 37, 44, 0.45); cursor: pointer; border-radius: var(--radius); opacity: 0; transition: opacity 0.12s; }
.block:hover .del, .block.is-selected .del { opacity: 1; }
.del:hover { color: var(--text); border-color: rgba(0,0,0,0.25); background: rgba(255,255,255,0.5); }
@media (hover: none) { .del { opacity: 1; } }
.block.compact .del { top: 50%; transform: translateY(-50%); }
.block.tiny .del { display: none; }
.lane.is-dragging .gap-zone { opacity: 0.25; }
.lane.is-dragging .block { transition: top 0.18s cubic-bezier(.2,.8,.2,1); }
.gap-zone { border: 1px dashed var(--accent); color: var(--accent); background: rgba(109, 123, 217, 0.05); }
.finish-line { border-top: 2px solid var(--ink-soft); }
.finish-line span { color: var(--ink-soft); }
.scrubber, .scrubber .label, .scrubber .add { border-color: var(--accent); }
.scrubber .label, .scrubber .add { background: var(--accent); }
.drop-ind { border-top-color: var(--ink-soft); }
.drop-ind .label { background: var(--ink-soft); }
.drop-ind .preview { border: 1.5px dashed var(--ink-soft); }

/* side */
.progress .bar { background: var(--accent); }
.progress.done .bar { background: var(--ok); }
.issue { border: 1px solid var(--line-strong); background: var(--panel); }
.issue .msg b { color: var(--ink-soft); }
.issue.info { background: var(--hi-soft); border-color: transparent; }
.issue.ok { border-color: var(--ok); }
.issue.ok .msg b { color: var(--ok); }
.export-warning { border: 1px solid var(--warn); background: #fdf1ea; }
.export-warning b, .export-warning .hd { color: var(--warn); }
.save-opt { border: 1px solid var(--line-strong); }
.save-opt:hover:not(:disabled) { background: var(--panel); color: var(--text); border-color: var(--text); }
.save-opt:hover:not(:disabled) small { color: var(--muted); }
.dialog { border: 1px solid var(--line-strong); }
.dialog::backdrop { background: rgba(46, 51, 102, 0.25); }
.fit.yes { background: var(--hi); color: var(--ink-soft); }

/* ---------- v5: wider axis columns, aligned labels, slim gaps ---------- */
:root { --tw: 68px; --kw: 52px; --aw: calc(var(--tw) + var(--kw)); }
.tl-head { grid-template-columns: var(--tw) var(--kw) 1fr !important; }
.axis.time { width: var(--tw); }
.axis.km { left: var(--tw); width: var(--kw); }
.lane { left: var(--aw) !important; cursor: pointer; }
.finish-line, .drop-ind, .scrubber { left: calc(-1 * var(--aw)) !important; }
.gridline { left: 0; }
.drop-ind .preview { left: calc(var(--aw) + 8px) !important; }
.axis .tick span { padding: 0 14px 0 8px; }
.lt, .lk { position: absolute; top: -11px; height: 22px; display: grid; place-items: center; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; }
.lt { left: 0; width: var(--tw); }
.lk { left: var(--tw); width: var(--kw); }
.scrubber .lt, .scrubber .lk { background: var(--accent); }
.drop-ind .lt, .drop-ind .lk { background: var(--ink-soft); }
.lk { border-left: 1px solid rgba(255,255,255,0.35); }

/* start time + km on one line along the top edge of each song */
.block .when { display: flex; gap: 6px; align-items: baseline; }
.block .when b { display: inline; font-size: 13.5px; }
.block .when span { font-size: 12px; }
.block.compact .when span { display: inline; }

/* small gaps: thin dashed band with a visible close pill */
.gap-zone.slim { overflow: visible; flex-direction: row; justify-content: center; z-index: 3; }
.gap-zone.slim .gap-acts button { background: var(--accent); color: #fff; border-color: var(--accent); padding: 4px 9px; white-space: nowrap; }
.gap-zone.slim .gap-acts button:hover { background: var(--ink-soft); border-color: var(--ink-soft); color: #fff; }

/* custom distance */
.custom-btn { border: 0; background: transparent; color: var(--ink-soft); padding: 0 14px; height: 40px; cursor: pointer; font-weight: 800; font-size: 16px; letter-spacing: -0.02em; font-family: inherit; }
.custom-btn:hover { background: rgba(255,255,255,0.6); }


/* phone: presets stay on one row; custom fills the leftover space */
@media (max-width: 560px) {
  .dist-picker { flex-wrap: nowrap; }
  .dist-picker button { padding: 0 9px; font-size: 15px; flex: 1 1 auto; }
  .dist-picker .custom-btn { padding: 0 9px; }
  .dist-picker .custom { padding: 0 8px 0 2px; }
  .dist-picker .custom input { width: 48px; }
}

/* ---------- v6: calmer songs, floating controls, unit labels ---------- */
:root { --tone-a: #e3e7fb; --tone-b: #cfd5f4; --kw: 64px; }
.song .art, .song:nth-child(n) .art { background: var(--accent-soft) !important; color: var(--ink-soft); }
.block { border-color: rgba(46, 51, 102, 0.1); }

.axis.km .tick span i { font-style: normal; font-weight: 600; font-size: 0.82em; opacity: 0.6; margin-left: 2px; }
.axis .tick span { padding: 0 12px 0 6px; }

.scrubber.over-song .add { display: none; }
.scrubber.over-song { border-top-color: transparent; }

#clear-btn.armed { background: var(--warn); border-color: var(--warn); color: #fff; }

.timeline-card { position: relative; }
.tl-float { position: sticky; bottom: 20px; z-index: 20; margin: 14px auto 0; width: max-content; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--ink-soft); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(46, 51, 102, 0.25); }
.fbtn { display: inline-flex; align-items: center; gap: 6px; height: 34px; min-width: 34px; justify-content: center; padding: 0 10px; border: 0; background: transparent; color: var(--accent-soft); font: inherit; font-size: 12px; font-weight: 800; text-transform: uppercase; cursor: pointer; border-radius: var(--radius); }
.fbtn.icon { font-size: 20px; padding: 0; font-weight: 600; }
.fbtn:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.fbtn:disabled { opacity: 0.4; cursor: default; background: transparent; }
.fsep { width: 1px; height: 20px; background: rgba(255, 255, 255, 0.2); margin: 0 4px; }
@media (max-width: 560px) {
  :root { --tw: 54px; --kw: 44px; }
  .axis.km .tick span i { display: none; }
  .axis .tick span { padding: 0 10px 0 4px; font-size: 11px; }
  .block .when span { display: none; }
  .block { padding-right: 30px; }
}

/* ---------- v7: add-song spots, island, livelier songs ---------- */
:root { --tone-a: #e9f3c2; --tone-b: #dcebA6; }
.block { border: 1px solid rgba(46, 51, 102, 0.12); color: var(--ink-soft); }
.block .a, .block .when { color: rgba(46, 51, 102, 0.7); }
.block .when b, .block .t { color: var(--ink-soft); }
.block .grip { color: rgba(46, 51, 102, 0.35); }

/* everything centred on the lane, so gap buttons and the scrubber's add button line up */
.scrubber .add { left: calc(var(--aw) + (100% - var(--aw)) / 2) !important; }
.gap-zone { flex-direction: row; gap: 14px; }
.gap-acts { gap: 6px; }
.gap-acts button, .gap-zone.slim .gap-acts button { padding: 4px 10px; background: var(--panel, #fff); color: var(--accent); border: 1px solid var(--accent); }
.gap-acts button + button, .gap-zone.slim .gap-acts button + button { background: var(--accent); color: #fff; }
.gap-acts button:hover, .gap-zone.slim .gap-acts button:hover { background: var(--ink-soft); border-color: var(--ink-soft); color: #fff; }
.gap-zone.slim .gap-label { display: none; }

.add-after { position: absolute; left: 8px; right: 8px; height: 40px; border: 1px dashed var(--accent); background: rgba(109, 123, 217, 0.05); color: var(--accent); font: inherit; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em; cursor: pointer; border-radius: var(--radius); z-index: 2; }
.add-after:hover { background: var(--accent); color: #fff; border-style: solid; }
.lane.is-dragging .add-after { opacity: 0; }

/* floating island */
.tl-float { bottom: 24px; padding: 6px; gap: 4px; box-shadow: 0 10px 30px rgba(46, 51, 102, 0.3), 0 0 0 1px rgba(255,255,255,0.08) inset; }
.fbtn { height: 38px; min-width: 38px; padding: 0 12px; font-size: 12.5px; }
.fbtn.icon { font-size: 22px; }
.flabel { font-size: 11px; font-weight: 800; text-transform: uppercase; color: rgba(229, 232, 251, 0.6); padding: 0 2px 0 6px; }
.scrubber.in-gap .add { display: none; }

/* ---------- v8: bin, gap labels, aqua songs ---------- */
:root { --tone-a: #d9f0f1; --tone-b: #c3e7e9; }
.del { opacity: 0.55 !important; top: 7px; color: var(--ink-soft); }
.del:hover { opacity: 1 !important; color: #b4462a; border-color: rgba(180, 70, 42, 0.35); background: rgba(255,255,255,0.7); }
.lane.at-edge .block { cursor: pointer; }
.gap-label { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--accent); }
.gap-zone.slim .gap-label { display: inline-block; background: var(--bg); padding: 3px 6px; border-radius: var(--radius); }
.block .when b { font-size: 15px; }
.block .when span { font-weight: 600; }

/* ---------- v9: song length when zoomed out; timeline-only scrolling on wide screens ---------- */
.block .d { display: none; }
.block.compact .d { display: inline; color: rgba(46, 51, 102, 0.65); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.block.compact .t { flex: 0 1 auto; min-width: 0; }

@media (min-width: 1201px) and (min-height: 620px) {
  html, body { height: 100%; }
  body { display: flex; flex-direction: column; overflow: hidden; }
  body > *:not(.workspace) { flex: none; }
  .workspace { flex: 1; min-height: 0; align-items: stretch; padding-bottom: 20px; }
  .library { position: static; max-height: none; min-height: 0; }
  .side { position: static; overflow-y: auto; align-content: start; min-height: 0; }
  .timeline-card { display: flex; flex-direction: column; min-height: 0; }
  .tl-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .tl-float { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); margin: 0; }
  .tl-inner { padding-bottom: 80px; box-sizing: content-box; }
}

/* ---------- v10: hover card, mini songs, selection, small gaps ---------- */
.block.is-selected { outline: none !important; box-shadow: inset 4px 0 0 var(--accent), 0 2px 10px rgba(46, 51, 102, 0.12); border-color: rgba(109, 123, 217, 0.6) !important; z-index: 2; }

.block.mini { padding: 0 34px 0 10px; align-items: center; gap: 8px; }
.block.mini .grip { display: none; }
.block.mini .t { font-size: 12.5px; }
.block.mini .d, .block.mini .when span { font-size: 11px; }
.block.mini .when b { font-size: 12.5px; }
.block.mini .del { width: 22px; height: 22px; }

.hovercard { position: fixed; z-index: 60; width: 260px; background: var(--ink-soft); color: #fff; border-radius: 6px; padding: 12px 14px; box-shadow: 0 14px 34px rgba(46, 51, 102, 0.35); pointer-events: none; font-size: 13px; animation: hc-in 0.12s ease-out; }
@keyframes hc-in { from { opacity: 0; transform: translateY(4px); } }
.hc-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.hc-head img, .hc-art { width: 38px; height: 38px; flex: none; border-radius: 3px; object-fit: cover; }
.hc-art { display: grid; place-items: center; background: var(--tone-a); color: var(--ink-soft); font-weight: 900; font-size: 16px; }
.hc-head b { display: block; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.hc-head small { color: rgba(229, 232, 251, 0.7); font-size: 12.5px; }
.hc-grid { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 12px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,0.14); border-bottom: 1px solid rgba(255,255,255,0.14); font-variant-numeric: tabular-nums; }
.hc-grid span { color: rgba(229, 232, 251, 0.6); font-size: 11px; font-weight: 700; text-transform: uppercase; align-self: center; }
.hc-grid b { font-weight: 800; }
.hc-grid em { font-style: normal; color: rgba(229, 232, 251, 0.75); text-align: right; }
.hc-hint { margin-top: 8px; font-size: 11.5px; color: rgba(229, 232, 251, 0.6); }

/* very small gaps: no squashed box, just a tinted band with a floating control row */
.gap-zone.slim { border: 0 !important; background: repeating-linear-gradient(135deg, rgba(109,123,217,0.16) 0 4px, transparent 4px 8px) !important; }
.gap-zone.slim .gap-label { background: transparent; padding: 0; }
.gap-zone.slim .gap-acts, .gap-zone.slim .gap-label { position: relative; z-index: 1; }
.gap-zone.slim { gap: 0; }
.gap-zone.slim::after { content: none; }
.gap-zone.slim > .gap-label, .gap-zone.slim > .gap-acts { background: var(--bg); }
.gap-zone.slim > .gap-label { padding: 5px 4px 5px 10px; border: 1px solid rgba(109,123,217,0.4); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); }
.gap-zone.slim > .gap-acts { padding: 3px 4px 3px 8px; border: 1px solid rgba(109,123,217,0.4); border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; box-shadow: 6px 2px 10px rgba(46,51,102,0.08); }
.gap-acts button { font-size: 11px; }
/* tiny gaps: just a small label; the buttons appear when you point at it */
.gap-zone.tinygap > .gap-acts { display: none; }
.gap-zone.tinygap > .gap-label { border-right: 1px solid rgba(109,123,217,0.4); border-radius: var(--radius); padding: 3px 8px; font-size: 11px; cursor: pointer; }
.gap-zone.tinygap:hover > .gap-acts { display: flex; }
.gap-zone.tinygap:hover > .gap-label { border-right: 0; border-radius: var(--radius) 0 0 var(--radius); }

/* ---------- v11: toolbar controls, gap hover, add-anywhere-in-gap ---------- */
.tl-inner { padding-bottom: 24px !important; }
.tl-tools { gap: 6px; }
.scrubber .add-here { display: none; position: absolute; left: calc(var(--aw) + (100% - var(--aw)) / 2); transform: translate(-50%, -50%); background: var(--accent); color: #fff; font-size: 12px; font-weight: 800; padding: 5px 12px; border-radius: var(--radius); text-transform: uppercase; white-space: nowrap; box-shadow: 0 3px 10px rgba(46,51,102,0.2); }
.scrubber.in-gap .add-here { display: block; }
.gap-zone { cursor: copy; transition: background 0.15s; }
.gap-zone.hovering { background: rgba(109, 123, 217, 0.1); }
.gap-zone.hovering > .gap-label, .gap-zone.hovering > .gap-acts { opacity: 0.2; transition: opacity 0.15s; }
.gap-zone.hovering > .gap-acts:hover { opacity: 1; }
/* tiny gaps: the label turns into the buttons rather than sitting beside them */
.gap-zone.tinygap:hover > .gap-label { display: none; }
.gap-zone.tinygap:hover > .gap-acts { border-left: 1px solid rgba(109,123,217,0.4); border-radius: var(--radius); padding: 3px 4px; opacity: 1; }
.gap-zone.tinygap.hovering > .gap-label { opacity: 1; }
.block.mini .del, .block.compact .del { right: 8px; top: 50% !important; transform: translateY(-50%); }

/* ---------- v12: one song list, previews, sharper picker ---------- */
.lib-head { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; padding: 8px 0; border-bottom: 2px solid var(--text); }
.list-head { list-style: none; padding: 12px 4px 6px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); border-bottom: 1px solid var(--line); }
.song .play { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink-soft); border-radius: 50% !important; cursor: pointer; padding: 0 0 0 2px; }
.song .play:hover, .song .play.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.player { position: fixed; inset: auto auto 20px 20px; margin: 0; width: 320px; padding: 0; border: 0; background: transparent; overflow: visible; }
.player-frame, .player iframe { display: block; width: 100%; height: 80px; border: 0; border-radius: 12px; box-shadow: 0 12px 32px rgba(46, 51, 102, 0.3); }
.player-close { position: absolute; top: -10px; right: -10px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--ink-soft); color: #fff; font-size: 16px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }

/* add-song dialog: crisper header, tighter rows */
.dialog.pick { padding: 0; width: min(540px, calc(100vw - 32px)); border: 1px solid var(--ink-soft) !important; box-shadow: 0 24px 60px rgba(46, 51, 102, 0.28); overflow: hidden; }
.dialog.pick form { display: flex; flex-direction: column; max-height: min(640px, 85vh); }
.pick .pick-head { padding: 18px 20px 14px; background: var(--accent-soft); border-bottom: 1px solid rgba(46, 51, 102, 0.15); align-items: center; }
.pick .pick-head h3 { font-size: 22px; margin: 0 0 6px; }
.pick-sub { margin: 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); }
.pick-at { display: inline-flex; border: 1px solid var(--ink-soft); border-radius: var(--radius); overflow: hidden; font-variant-numeric: tabular-nums; }
.pick-at b { background: var(--ink-soft); color: #fff; padding: 3px 8px; font-weight: 800; }
.pick-at span { padding: 3px 8px; font-weight: 700; background: var(--panel); }
.pick-note { color: rgba(46, 51, 102, 0.75); }
.pick .search { margin: 14px 20px 6px; }
.pick .song-list { max-height: none; flex: 1; overflow-y: auto; padding: 0 12px 12px; border-top: 0; }
.pick .song { padding: 7px 8px; gap: 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick .song:hover { background: var(--accent-soft); }
.pick .song .art { width: 32px; height: 32px; font-size: 13px; }
.pick .song .t { font-size: 14.5px; }
.pick .song .a { font-size: 12.5px; }
.pick .list-head { padding: 10px 8px 6px; }
.player { z-index: 70; }
.player.in-dialog { position: relative; inset: auto; width: auto; margin: 0 20px 16px; flex: none; }
.player.in-dialog .player-close { top: -9px; right: -9px; }
.finish-time .colon, .cov-time .colon { display: inline-block; margin: 0 0.07em; letter-spacing: 0; position: relative; top: -0.06em; }

/* ---------- v13: added marker, marquee, touch scrubber, phone layout ---------- */
.song .used { width: auto !important; height: auto !important; background: none !important; border-radius: 0 !important; color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.mq { display: inline-block; animation: mq var(--mqd, 4s) ease-in-out 0.4s infinite alternate; }
@keyframes mq { 0%, 15% { transform: translateX(0); } 85%, 100% { transform: translateX(var(--mq)); } }
.lane-empty .touch { display: none; }
@media (hover: none) { .lane-empty .touch { display: inline; } .lane-empty .desk { display: none; } }

.scrubber .grab { display: none; }
.scrubber.pinned { border-top-width: 2px; }
.scrubber.pinned .lt, .scrubber.pinned .lk, .scrubber.pinned .grab, .scrubber.pinned .add { pointer-events: auto; touch-action: none; cursor: grab; }
.scrubber.pinned .add { display: block !important; cursor: pointer; padding: 8px 14px; font-size: 13px; }
.scrubber.pinned .add-here { display: none !important; }
.scrubber.pinned .grab { display: block; position: absolute; left: calc(var(--aw) + 4px); top: -14px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); box-shadow: 0 2px 8px rgba(46,51,102,0.35); }
.scrubber.pinned .grab::before { content: ''; position: absolute; inset: 9px 8px; border-top: 2px solid #fff; border-bottom: 2px solid #fff; }

@media (max-width: 760px) {
  input, select, textarea { font-size: 16px !important; } /* stops iOS zooming in on focus */
  html { -webkit-text-size-adjust: 100%; }
  .lane, .axis { touch-action: pan-y; }
  .library { display: none !important; }
  .workspace { padding-bottom: 96px; }
  .side { position: fixed !important; top: auto !important; left: 0; right: 0; bottom: 0; z-index: 40; display: block !important; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line-strong); box-shadow: 0 -6px 20px rgba(46,51,102,0.08); }
  .side > :not(.status) { display: none !important; }
  .side .status { border: 0 !important; padding: 0; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "head btn" "bar btn"; gap: 6px 14px; align-items: center; background: transparent; }
  .side .status .cov-head { grid-area: head; }
  .side .status .cov-head .rs-label, .side .status .cov-count, .side .status .progress-label { display: none; }
  .side .status .cov-time { font-size: 24px; }
  .side .status .progress { grid-area: bar; margin: 0; }
  .side .status #export-btn { grid-area: btn; width: auto; padding: 0 16px; height: 44px; margin: 0; }
  .player { left: 12px; right: 12px; width: auto; bottom: 86px; }
  .dialog.pick { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0 !important; }
  .dialog.pick form { max-height: 100dvh; height: 100%; }
  .pick .song .play { width: 34px; height: 34px; }
}
.lt, .lk { white-space: nowrap; }
@media (max-width: 760px) {
  .lk { font-size: 11px; }
  .block .when span { display: none !important; }
  .gap-zone { flex-wrap: wrap; align-content: center; gap: 6px 10px; padding: 4px; }
  .gap-acts button { padding: 6px 9px; }
}

/* ---------- v14: one gap bar, consistent grips, centred bin, mobile handle ---------- */
.gap-zone { justify-content: center; align-items: center; }
.gap-zone .gap-label, .gap-zone .gap-acts { display: none !important; }
.gap-bar { display: inline-flex; align-items: center; gap: 4px; padding: 3px; background: var(--panel); border: 1px solid rgba(109, 123, 217, 0.45); border-radius: var(--radius); box-shadow: 0 2px 8px rgba(46, 51, 102, 0.08); position: relative; z-index: 1; white-space: nowrap; transition: opacity 0.15s; }
.gap-len { padding: 0 8px 0 6px; font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--accent); font-variant-numeric: tabular-nums; }
.gap-btn { height: 26px; padding: 0 10px; font: inherit; font-size: 11px; font-weight: 800; text-transform: uppercase; cursor: pointer; border-radius: var(--radius); border: 1px solid var(--accent); background: var(--panel); color: var(--accent); }
.gap-btn.primary { background: var(--accent); color: #fff; }
.gap-btn:hover { background: var(--ink-soft); border-color: var(--ink-soft); color: #fff; }
.gap-zone.hovering > .gap-bar { opacity: 0.25; }
.gap-zone.hovering > .gap-bar:hover { opacity: 1; }
.gap-zone.tinygap .gap-btn { display: none; }
.gap-zone.tinygap .gap-len { padding: 2px 6px; font-size: 11px; }
.gap-zone.tinygap .gap-bar { padding: 2px; }
.gap-zone.tinygap:hover .gap-btn { display: inline-block; }
.gap-zone.tinygap.hovering > .gap-bar { opacity: 1; }

/* every song gets a drag handle, including slim zoomed-out rows */
.block.mini .grip { display: grid !important; padding-top: 0; }
.block .grip svg { display: block; }
/* bin: no stray button padding, icon dead-centre */
.del { padding: 0 !important; display: grid !important; place-items: center; line-height: 0; }
.del svg { display: block; }
.block .del { top: 50% !important; transform: translateY(-50%); }
.block:not(.compact) .del { top: 8px !important; transform: none; }

/* picker rows: an explicit + so it's clear the row adds the song */
.pick .song .add { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border: 1px solid var(--accent); color: var(--accent); font-weight: 700; font-size: 16px; border-radius: var(--radius); }
.pick .song:hover .add { background: var(--accent); color: #fff; }

@media (max-width: 760px) {
  .lt, .lk { font-size: 10.5px; overflow: hidden; }
  .scrubber.pinned .grab { left: auto; right: 10px; width: 34px; height: 34px; top: -17px; }
  .scrubber.pinned .grab::before { inset: 11px 10px; }
  .block .grip { padding: 6px 8px 6px 2px; margin: -6px 0 -6px -6px; }
  .block.mini .grip { padding: 2px 8px 2px 2px; margin: -2px 0 -2px -6px; }
  .pick .song .add { width: 34px; height: 34px; font-size: 18px; }
  .gap-btn { height: 30px; }
}
.attrib { display: block; margin-top: 6px; font-size: 11px; opacity: 0.75; }

/* compact and mini rows are both single-line: give them one identical layout */
.block.compact, .block.mini { padding: 0 34px 0 10px !important; align-items: center !important; gap: 8px; }
.block.compact .grip, .block.mini .grip { display: grid !important; padding: 0 !important; margin: 0 !important; align-self: center; }
.block.compact .body, .block.mini .body { display: flex; gap: 8px; align-items: baseline; }
.block.compact .t, .block.mini .t { font-size: 13.5px !important; }
.block.compact .d, .block.mini .d, .block.compact .when span, .block.mini .when span { font-size: 11.5px !important; }
.block.compact .when b, .block.mini .when b { font-size: 13.5px !important; }
.block.compact .when, .block.mini .when { align-self: center; }
@media (max-width: 760px) {
  .block.compact .grip, .block.mini .grip { padding: 4px 6px 4px 0 !important; }
}
.block.compact .del, .block.mini .del { width: 24px !important; height: 24px !important; right: 8px !important; }
.site-links { margin-left: auto; display: flex; gap: 16px; align-self: flex-start; padding-top: 6px; }
.site-links a { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; color: var(--ink-soft); text-decoration: none; opacity: 0.7; }
.site-links a:hover { opacity: 1; text-decoration: underline; }
@media (max-width: 760px) { .site-links { margin-left: 0; width: 100%; order: 3; padding-top: 0; } }

/* v15: finish shown on both axes, gap bar at the start of the run stays inside the timeline */
.finish-line { z-index: 4; }
.finish-line > span:not(.lt):not(.lk) { display: none; }
.finish-line .lt, .finish-line .lk { text-transform: none; background: var(--ink-soft); color: #fff; top: -15px; height: 30px; line-height: 1.05; }
.finish-line .lt { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.finish-line .lt small { font-size: 8.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.75; }
/* slim gaps get a slimmer bar so it sits inside the gap instead of spilling over its edges */
@media (min-width: 761px) {
  .gap-zone.slim .gap-bar { padding: 2px; }
  .gap-zone.slim .gap-btn { height: 22px; padding: 0 9px; }
}
/* at the start of the run the bar must not poke above the timeline */
.gap-zone.at-start { align-items: safe center; }

/* ---------- v16: footer links, roomier mobile axes and gap bar ---------- */
.site-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 10px 20px 14px; font-size: 11.5px; color: var(--muted); }
.site-foot nav { display: flex; gap: 14px; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--ink-soft); text-decoration: underline; }
@media (min-width: 1201px) and (min-height: 620px) {
  .workspace { padding-bottom: 0 !important; }
  .site-foot { padding: 8px 20px 10px; }
}
.pick-credit { margin: 6px 0 0; font-size: 11px; color: var(--muted); text-align: center; }

@media (max-width: 760px) {
  .workspace { padding-bottom: 8px !important; }
  .site-foot { flex-direction: column; align-items: flex-start; padding: 8px 16px calc(100px + env(safe-area-inset-bottom)); }
  /* gap bar: a bit of air on both sides, shorter labels */
  .gap-zone { padding: 4px 6px !important; }
  .gap-bar { max-width: 100%; gap: 6px; padding: 3px; }
  .gap-len { padding: 0 2px 0 6px; }
  .gap-len .gw { display: none; }
  .gap-btn { padding: 0 8px; font-size: 10.5px; }
}
@media (max-width: 560px) {
  :root { --tw: 50px; --kw: 58px; }
  .axis.km .tick span i { display: inline; margin-left: 2px; }
  .axis .tick span { padding: 0 8px 0 4px; }
  .lt, .lk { font-size: 10.5px; letter-spacing: -0.01em; }
  .finish-line .lt { font-size: 10px; }
  .finish-line .lt small { font-size: 7.5px; }
}
@media (max-width: 400px) {
  .finish-time { font-size: clamp(30px, 11vw, 44px); }
}
.on-phone { display: none; }
@media (max-width: 760px) {
  .on-desk { display: none; }
  .on-phone { display: inline; }
  .gap-btn .gw { display: inline; }
  /* the pill sits left of the drag handle instead of under it */
  .scrubber.pinned .add { left: auto !important; right: 54px; transform: translateY(-50%); }
}
@media (max-width: 370px) {
  .gap-btn .gw { display: none; }
  .gap-len { padding: 0 2px 0 4px; }
  .side .status .cov-time { font-size: 19px !important; white-space: nowrap; }
  .side .status #export-btn { padding: 0 12px !important; }
  .block.compact .d, .block.mini .d { display: none; }
  .dist-picker button { padding: 0 7px !important; font-size: 13.5px; }
  .run-strip { padding: 16px; }
}
@media (max-width: 400px) { .scrubber.pinned .add { padding: 8px 10px; font-size: 12px; right: 50px; } }

/* ---------- v17: two-step TuneMyMusic hand-off ---------- */
.tmm { border: 1px solid var(--line-strong, var(--line)); border-radius: var(--radius); padding: 14px 16px; margin: 6px 0 4px; display: grid; gap: 4px; }
.tmm-title { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.tmm-sub { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.tmm-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tmm-steps li { display: flex; align-items: center; gap: 12px; padding: 10px 0 0; border-top: 1px solid var(--line); }
.tmm-steps .n { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--ink-soft); font-weight: 800; font-size: 13px; }
.tmm-steps .tx { flex: 1; min-width: 0; display: grid; gap: 1px; }
.tmm-steps .tx b { font-size: 14px; }
.tmm-steps .tx small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.tmm-steps .btn { flex: none; min-width: 84px; justify-content: center; text-align: center; text-decoration: none; }
.tmm-steps .btn.done { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--ink-soft); }
#tmm-fallback .copybox { margin-top: 8px; }
.sp-link { flex: none; display: grid; place-items: center; width: 24px; height: 24px; color: #1db954; opacity: 0.75; border-radius: 50%; }
.sp-link:hover { opacity: 1; background: rgba(29, 185, 84, 0.1); }
@media (max-width: 760px) { .pick .sp-link { width: 32px; height: 32px; } }

/* ---------- v18: phones get a compact settings strip pinned to the top ---------- */
@media (max-width: 760px) {
  .masthead { padding-bottom: 10px; }
  .run-strip {
    position: sticky; top: 0; z-index: 35; margin: 0 0 12px !important; padding: 8px 12px 10px !important;
    border-radius: 0 !important; box-shadow: 0 4px 14px rgba(46, 51, 102, 0.1);
    display: grid !important; grid-template-columns: auto 1fr; grid-template-areas: "dist dist" "pace fin"; gap: 8px 12px; align-items: end;
  }
  .run-strip > .rs-field:nth-child(1) { grid-area: dist; min-width: 0; }
  .run-strip > .rs-field:nth-child(3) { grid-area: pace; }
  .run-strip > .rs-field:nth-child(5) { grid-area: fin; text-align: right; justify-self: end; }
  .run-strip .rs-label { font-size: 10px; margin-bottom: 4px; letter-spacing: 0.04em; }
  /* the "Distance" word goes; its km/mi toggle stays, at the end of the row */
  .run-strip > .rs-field:nth-child(1) .rs-label { font-size: 0; margin: 0; order: 2; flex: none; }
  .run-strip #unit-toggle { margin: 0; }
  .run-strip #unit-toggle button { font-size: 11.5px; height: 28px; padding: 0 8px; }
  /* distance row: presets + unit toggle on one line */
  .run-strip > .rs-field:nth-child(1) { display: flex; align-items: center; gap: 8px; }
  .dist-picker { flex: 0 1 auto; min-width: 0; margin-right: auto; display: flex; overflow-x: auto; scrollbar-width: none; }
  .dist-picker::-webkit-scrollbar { display: none; }
  .dist-picker button, .dist-picker .custom { height: 32px !important; padding: 0 9px !important; font-size: 13.5px !important; flex: none; white-space: nowrap; }
  .dist-picker .custom input { width: 46px; font-size: 16px; }
  .pace-input { height: 34px; padding: 0 8px 0 2px; }
  .pace-input input { width: 54px; font-size: 17px; }
  .finish-time { font-size: 28px !important; line-height: 30px; padding: 0; }
  .tl-head span:nth-child(3) { background: var(--bg); }
  /* timeline column header sticks just under the strip */
  /* Undo / Clear / Zoom stay pinned under the strip, then the column headings under them */
  .tl-toolbar { position: sticky; top: var(--strip-h, 96px); z-index: 31; background: var(--bg); height: 48px; margin: 0 -16px !important; padding: 0 16px; align-items: center !important; flex-wrap: nowrap !important; }
  .tl-toolbar h2 { font-size: 20px !important; }
  .tl-tools { gap: 4px; }
  .tl-tools .btn { height: 32px; padding: 0 10px; }
  .zoom { margin-left: 2px; }
  .zoom-label { display: none; }
  .tl-head { position: sticky; top: calc(var(--strip-h, 96px) + 48px); z-index: 30; background: var(--bg); }
}
@media (max-width: 760px) { .dist-picker > button:last-of-type:not([hidden]) { border-right: 0; } }

/* ---------- v19: unit toggle by pace, steady custom box, intro ---------- */
.rs-label .seg { margin-left: 8px; }
/* the Custom button and the custom input take the same space, so nothing jumps when you type */
.dist-picker .custom-btn, .dist-picker .custom { width: 112px; justify-content: center; box-sizing: border-box; }
.dist-picker .custom { padding: 0 10px 0 4px !important; }
.dist-picker .custom input { width: 56px; }
.foot-link { font: inherit; font-weight: inherit; color: var(--muted); text-decoration: none; }
.foot-link:hover { color: var(--ink-soft); text-decoration: underline; }
.dialog.intro { width: min(480px, calc(100vw - 32px)); }
.intro h3 { margin: 0 0 6px; font-size: 26px; line-height: 1; letter-spacing: -0.04em; text-transform: uppercase; }
.intro-sub { margin: 0 0 16px; color: var(--muted); }
.intro-steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 12px; }
.intro-steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.4; }
.intro-steps .n { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--ink-soft); font-weight: 800; font-size: 13px; }
.intro-tip { font-size: 12.5px; color: var(--muted); margin: 0 0 16px; padding: 8px 10px; background: var(--paper); border-radius: var(--radius); }
.on-touch-i { display: none; }
@media (hover: none) { .on-touch-i { display: inline; } .on-desk-i { display: none; } }
@media (max-width: 760px) {
  /* Distance gets its heading back; pace row carries the km/mi switch */
  .run-strip { grid-template-areas: "dist dist" "pace fin" !important; }
  .run-strip > .rs-field:nth-child(1) { display: block !important; }
  .run-strip > .rs-field:nth-child(1) .rs-label { font-size: 10px !important; margin: 0 0 4px !important; order: 0; }
  .run-strip .rs-label .seg { margin-left: 6px; }
  .run-strip #unit-toggle button { font-size: 10.5px; height: 20px; padding: 0 7px; }
  .run-strip > .rs-field:nth-child(3) .rs-label { display: flex; align-items: center; }
  .dist-picker { width: max-content; max-width: 100%; }
  .dist-picker .custom-btn, .dist-picker .custom { width: 92px; }
  .dist-picker .custom input { width: 44px; }
}
/* headings start exactly where the numbers below them start */
.tl-head span { padding-left: 6px !important; padding-right: 0 !important; box-sizing: border-box; }
@media (max-width: 560px) { .tl-head span { padding-left: 4px !important; } }
/* no grey divider between the km column and the lane: it made the column look wider than its heading */
.lane { border-left: 0 !important; }
@media (max-width: 760px) {
  .run-strip > .rs-field:nth-child(1) .rs-label { display: flex !important; align-items: center; }
}

/* ---------- v21 ---------- */
/* Custom is the last cell: its divider doubled up with the box edge */
.dist-picker .custom-btn { border-right: 0 !important; }
/* pace box: unusable pace shows a red edge until fixed or left */
.pace-input.bad { border-color: #c4495b !important; box-shadow: inset 0 0 0 1px #c4495b; }
.pace-input.bad input { color: #c4495b !important; }
