:root {
  --bg: #f6f4ef;
  --panel: #fffdf8;
  --fg: #1b1a17;
  --muted: #6b675e;
  --line: #d9d4c8;
  --soft: #ece8de;
  --wave: #c9c2b3;
  --accent: #8a3f78;
  --accent-soft: rgba(138, 63, 120, .14);
  --warn: #b42318;
  --ok: #2e7d4f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #211720;
    --panel: #2a1e29;
    --fg: #f1e7ee;
    --muted: #ae9aa9;
    --line: #43313f;
    --soft: #30232f;
    --wave: #5a4656;
    --accent: #e08ccb;
    --accent-soft: rgba(224, 140, 203, .16);
    --warn: #f97066;
    --ok: #6fcf97;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
button, select, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
kbd { font: inherit; font-size: .8em; padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* ---- header ---- */

.top { padding: 28px 0 14px; }
.crumbs { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.band { margin: 0; font-size: .8rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.band a { text-decoration: none; }
.band a:hover { color: var(--fg); }
.top h1 { margin: 2px 0 0; font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; cursor: default; }
.top h1.editable { cursor: text; }
.me { font-size: .85rem; }

/* ---- buttons ---- */

.pill {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); cursor: pointer;
  font-size: .9rem; font-weight: 600; white-space: nowrap;
}
.pill:hover:not(:disabled) { border-color: var(--fg); }
.pill:disabled { opacity: .4; cursor: default; }
.pill.primary { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.pill.quiet { border-color: transparent; background: none; color: var(--muted); }
.pill.on { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.link { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: .85rem; }
.link:hover { color: var(--fg); }
.link.danger:hover { color: var(--warn); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.small-actions { gap: 16px; margin-top: 10px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.empty { color: var(--muted); }

/* ---- album ---- */

.songs { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.songs li { border-bottom: 1px solid var(--line); }
.songs a { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 14px 4px; text-decoration: none; }
.songs a:hover { background: var(--soft); }
.songs .name { font-weight: 700; font-size: 1.05rem; }
.songs .sub { grid-column: 1; color: var(--muted); font-size: .85rem; }
.songs .count { grid-row: 1 / span 2; grid-column: 2; align-self: center; text-align: right; font-size: .85rem; color: var(--muted); }
.songs .count strong { display: block; font-size: 1.2rem; color: var(--fg); font-variant-numeric: tabular-nums; }
.songs .count.clear strong { color: var(--ok); }
.new-song { display: flex; gap: 8px; margin-top: 16px; }
.new-song input {
  flex: 1; min-width: 0; padding: 8px 14px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel);
}

/* ---- versions ---- */

.versions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills button {
  min-width: 44px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel);
  cursor: pointer; font-weight: 700; font-variant-numeric: tabular-nums;
}
.pills button[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.pills button:hover:not([aria-selected="true"]) { border-color: var(--fg); }

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

.player { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 10px; }
.wave { position: relative; height: 112px; margin-bottom: 26px; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.wave canvas { display: block; width: 100%; height: 100%; }
.selection { position: absolute; top: 0; bottom: 0; background: var(--accent-soft); border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); pointer-events: none; }
.hover-time {
  position: absolute; top: -4px; transform: translateX(-50%); padding: 1px 6px; border-radius: 6px;
  background: var(--fg); color: var(--bg); font-size: .75rem; font-variant-numeric: tabular-nums; pointer-events: none;
}
.markers { position: absolute; left: 0; right: 0; bottom: -24px; height: 22px; }
.marker {
  position: absolute; bottom: 0; transform: translateX(-50%);
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--panel); padding: 0;
  background: var(--c); color: #fff; font-size: .65rem; font-weight: 800; line-height: 16px; text-align: center; cursor: pointer;
}
.marker.carried { background: var(--panel); color: var(--c); border-color: var(--c); }
.marker.resolved { opacity: .35; }
.marker:hover, .marker.hot { transform: translateX(-50%) scale(1.25); z-index: 2; }
.marker .tick { position: absolute; left: 50%; bottom: 100%; width: 2px; height: 6px; margin-left: -1px; background: var(--c); }
.transport { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.play {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--fg); color: var(--bg); cursor: pointer;
  display: grid; place-items: center;
}
.play svg { width: 20px; height: 20px; fill: currentColor; }
.skip {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); cursor: pointer;
  font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; padding: 0;
}
.skip:hover { border-color: var(--fg); }
.transport { gap: 8px 10px; }
@media (max-width: 480px) { #noteBtn { flex: 1 0 100%; padding: 11px 14px; } }
.clock { margin-left: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); flex: 1; }
.keys { margin: 10px 0 0; color: var(--muted); font-size: .78rem; }
@media (hover: none) { .keys { display: none; } }

/* ---- composer ---- */

.composer { margin-top: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--accent); border-radius: 14px; }
.composer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.composer-head strong { font-variant-numeric: tabular-nums; }
select { padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); resize: vertical;
}
textarea:focus, input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.composer .row { margin-top: 8px; }

/* ---- version info ---- */

.version-info { margin-top: 16px; }
.meta { margin: 0; color: var(--muted); font-size: .9rem; }
.vnote { margin: 6px 0 0; white-space: pre-wrap; }
.vnote:empty { display: none; }

/* ---- notes ---- */

.notes { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 14px; }
.notes-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notes-head h2 { margin: 0; font-size: 1.1rem; }
.filter { display: flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.filter button { border: 0; background: var(--panel); padding: 4px 12px; cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--muted); }
.filter button.on { background: var(--fg); color: var(--bg); }

.note-list { list-style: none; margin: 10px 0 0; padding: 0; }
.note { padding: 12px 10px 12px 14px; border-left: 3px solid var(--c); border-radius: 0 10px 10px 0; margin-bottom: 8px; background: var(--panel); transition: background .2s; }
.note.hot { background: var(--accent-soft); }
.note.resolved { opacity: .6; }
.note-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: .85rem; color: var(--muted); }
.note-head .who { font-weight: 700; color: var(--fg); }
.at {
  border: 0; padding: 1px 8px; border-radius: 6px; background: var(--soft); cursor: pointer;
  font-weight: 700; font-variant-numeric: tabular-nums; color: var(--fg); font-size: .85rem;
}
.at:hover { background: var(--accent-soft); }
.tag { padding: 0 7px; border-radius: 6px; border: 1px solid var(--line); font-size: .78rem; }
.badge { font-size: .78rem; font-weight: 600; }
.badge.fixed { color: var(--ok); }
.note-body { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.replies { list-style: none; margin: 8px 0 0; padding: 0 0 0 12px; border-left: 1px solid var(--line); }
.replies li { margin-top: 6px; font-size: .92rem; }
.replies .who { font-weight: 700; }
.reply-form { margin-top: 8px; }
.reply-form textarea { font-size: .92rem; }
.reply-form .row { margin-top: 6px; }

/* ---- upload ---- */

.dialog {
  width: min(480px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 16px; padding: 18px;
  background: var(--panel); color: var(--fg);
}
.dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog h2 { margin: 0 0 12px; font-size: 1.2rem; }
.drop {
  display: block; padding: 22px 12px; border: 2px dashed var(--line); border-radius: 12px; text-align: center; cursor: pointer;
  color: var(--muted); overflow-wrap: anywhere;
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--fg); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.field { display: block; margin-top: 12px; font-size: .9rem; font-weight: 600; }
.field textarea { margin-top: 4px; font-weight: 400; }
.progress { height: 6px; margin-top: 12px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.dialog .row { margin-top: 12px; }
body.dragging::after {
  content: "Drop to upload a new version"; position: fixed; inset: 12px; z-index: 20; display: grid; place-items: center;
  border: 3px dashed var(--accent); border-radius: 18px; background: var(--accent-soft); font-weight: 700; font-size: 1.2rem;
  pointer-events: none;
}

/* ---- toast ---- */

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: var(--fg); color: var(--bg);
  font-size: .9rem; box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}

main { padding-bottom: 60px; }
