/* Tapes: calm, dark, warm. One accent; cover art brings the colour. */
:root {
  color-scheme: dark;
  --bg: #141312;
  --surface: #1c1b19;
  --raised: #252321;
  --hover: #2d2a27;
  --line: rgba(255, 240, 225, 0.08);
  --line-strong: rgba(255, 240, 225, 0.15);
  --text: #eeeae5;
  --muted: #a39d95;
  --faint: #716b64;
  --accent: #e2aa76;
  --accent-ink: #20150b;
  --danger: #e2826f;
  --good: #9fbf95;
  --wash: transparent;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --player-h: 0px;
}
body.has-player { --player-h: 68px; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  overflow-x: clip;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }

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

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px calc(var(--player-h) + var(--safe-bottom) + 40px);
  position: relative;
  isolation: isolate;
}
.wash {
  position: absolute;
  top: 0;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  height: 420px;
  background: linear-gradient(to bottom, var(--wash), transparent);
  pointer-events: none;
  z-index: -1;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  margin-bottom: 8px;
}
.topbar .grow { flex: 1; }
.brand { font-size: 22px; font-weight: 680; letter-spacing: -0.01em; display: flex; align-items: center; gap: 9px; }
.brand svg { width: 26px; height: 26px; color: var(--accent); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--raised);
  font-weight: 560;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.btn.primary:hover { background: #ebb685; }
.btn.danger { color: var(--danger); }
.btn.quiet { background: transparent; border-color: transparent; }
.btn.quiet:hover { background: var(--raised); }
.btn.big { min-height: 48px; padding: 0 22px; font-size: 16px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  color: var(--text);
  flex: none;
}
.icon-btn:hover { background: var(--raised); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.small { width: 34px; height: 34px; }
.icon-btn.small svg { width: 19px; height: 19px; }
.play-btn {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: transform 0.1s;
}
.play-btn:active { transform: scale(0.95); }
.play-btn svg { width: 24px; height: 24px; }

/* ---------- tabs ---------- */

.tabs { display: flex; gap: 4px; margin: 4px 0 18px; }
.tab {
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 560;
  border: 1px solid transparent;
}
.tab:hover { color: var(--text); }
.tabs { align-items: center; }
.tabs .grow { flex: 1; }
p.m, span.m { color: var(--muted); }
.tab.on { background: var(--raised); color: var(--text); border-color: var(--line); }

/* ---------- covers ---------- */

.cover {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--tone, var(--raised));
  flex: none;
}
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .blank {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 245, 235, 0.32);
}
.cover .blank svg { width: 38%; height: 38%; }
.cover.s40 { width: 40px; border-radius: 6px; }
.cover.s48 { width: 48px; border-radius: 7px; }

/* ---------- grids and lists ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 22px 16px;
}
@media (max-width: 420px) { .grid { grid-template-columns: 1fr 1fr; gap: 20px 14px; } }
.card { display: block; min-width: 0; }
.card .cover { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset; transition: transform 0.15s; }
.card:hover .cover { transform: translateY(-2px); }
.card .t { margin-top: 9px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .m { color: var(--muted); font-size: 13px; }

.list { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 8px;
  margin: 0 -8px;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
}
.row:hover { background: var(--surface); }
.row .n { width: 22px; text-align: right; color: var(--faint); font-size: 14px; flex: none; }
.row .main { flex: 1; min-width: 0; }
.row .t { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .m { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .d { color: var(--muted); font-size: 13px; flex: none; }
.row.playing .t, .row.playing .n { color: var(--accent); }
.row.dragging { background: var(--raised); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); z-index: 2; }
.handle {
  touch-action: none;
  cursor: grab;
  color: var(--faint);
  display: grid;
  place-items: center;
  width: 32px;
  height: 40px;
  flex: none;
}
.handle svg { width: 20px; height: 20px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  vertical-align: 1px;
}
.row .m .badge { margin-right: 2px; }
.badge.accent { color: var(--accent); border-color: rgba(226, 170, 118, 0.4); }
.badge svg { width: 12px; height: 12px; }

.search {
  width: 100%;
  min-height: 42px;
  padding: 0 14px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
}
.search:focus { border-color: var(--line-strong); }

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.empty p { margin: 0 0 18px; }

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

.hero { display: flex; gap: 22px; align-items: flex-end; margin: 8px 0 22px; }
.hero .cover { width: 200px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); }
.hero .info { min-width: 0; flex: 1; }
.hero .kind { color: var(--muted); font-size: 13px; font-weight: 560; margin-bottom: 4px; }
.hero h1 { margin: 0; font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.hero .desc { margin: 8px 0 0; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.hero .meta { margin-top: 8px; color: var(--muted); font-size: 13px; }
@media (max-width: 600px) {
  .hero { flex-direction: column; align-items: center; text-align: center; gap: 16px; }
  .hero .cover { width: min(64vw, 260px); }
  .hero h1 { font-size: 25px; }
}
.actions { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; flex-wrap: wrap; }
.actions .grow { flex: 1; }
@media (max-width: 600px) { .actions { justify-content: center; gap: 8px; flex-wrap: nowrap; } .actions .grow { display: none; } .actions .btn { padding: 0 14px; } }
@media (max-width: 400px) { .actions { gap: 5px; } .actions .btn { padding: 0 8px; } }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 4px; }
.section-head .section-title { margin: 0; }
.section-title { margin: 30px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.notes {
  white-space: pre-wrap;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  overflow-wrap: anywhere;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.chip:hover { background: var(--raised); }
.back { color: var(--muted); }

/* ---------- forms and dialogs ---------- */

dialog {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(440px, calc(100vw - 24px));
  max-height: calc(100dvh - 40px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
dialog::backdrop { background: rgba(8, 7, 6, 0.6); }
dialog.sheet { margin-bottom: max(12px, var(--safe-bottom)); }
@media (max-width: 600px) { dialog.sheet { margin: auto auto max(12px, var(--safe-bottom)); } }
.dlg { padding: 20px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100dvh - 40px); overflow: auto; }
.dlg h2 { margin: 0; font-size: 18px; font-weight: 650; }
.dlg p { margin: 0; color: var(--muted); }
.dlg .buttons { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.sheet-actions { display: flex; flex-direction: column; padding: 8px; }
.sheet-actions .title { padding: 10px 12px 6px; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-actions button {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}
.sheet-actions button:hover { background: var(--raised); }
.sheet-actions button svg { width: 20px; height: 20px; color: var(--muted); }
.sheet-actions button.danger { color: var(--danger); }
.sheet-actions button.danger svg { color: var(--danger); }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 560; }
.field input, .field textarea {
  min-height: 44px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  font-weight: 400;
  outline: none;
  resize: vertical;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 36px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.error-text { color: var(--danger); font-size: 14px; min-height: 0; }

.pick-list { display: flex; flex-direction: column; max-height: 50dvh; overflow: auto; margin: 0 -8px; }
.pick-list label { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.pick-list label:hover { background: var(--raised); }
.pick-list input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.pick-list .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.link-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.link-item .url { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.link-item .row-btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.link-item .row-btns .btn { min-height: 34px; padding: 0 12px; font-size: 14px; }

/* ---------- login ---------- */

.center-card {
  max-width: 380px;
  margin: 12vh auto 0;
  padding: 28px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.center-card .brand { justify-content: center; font-size: 26px; }
.center-card p { margin: 0; color: var(--muted); text-align: center; }

/* ---------- uploads tray ---------- */

.tray {
  position: fixed;
  right: 16px;
  bottom: calc(var(--player-h) + var(--safe-bottom) + 14px);
  width: min(360px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  z-index: 30;
  overflow: hidden;
}
.tray-head { display: flex; align-items: center; padding: 8px 8px 8px 14px; font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--line); }
.tray-head .grow { flex: 1; }
.tray-list { max-height: 40vh; overflow: auto; padding: 6px 0; }
.up { padding: 8px 14px; display: flex; flex-direction: column; gap: 5px; }
.up .top { display: flex; gap: 8px; font-size: 14px; }
.up .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up .state { color: var(--muted); font-size: 13px; flex: none; }
.up .state.bad { color: var(--danger); }
.up .state.ok { color: var(--good); }
.bar { height: 3px; border-radius: 3px; background: var(--line-strong); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.drop-hint {
  position: fixed;
  inset: 12px;
  border: 2px dashed var(--accent);
  border-radius: 20px;
  background: rgba(20, 19, 18, 0.85);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 600;
  z-index: 50;
  pointer-events: none;
}

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

.mini {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 0 10px calc(var(--safe-bottom) + 8px);
  pointer-events: none;
}
.mini-inner {
  pointer-events: auto;
  max-width: none;
  margin: 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 0 8px;
  background: rgba(37, 35, 33, 0.94);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.mini .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; }
.mini .progress > i { display: block; height: 100%; width: 0; background: var(--accent); }
.mini .main { flex: 1; min-width: 0; }
.mini .t { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini .m { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.np {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 24px calc(var(--safe-bottom) + 28px);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  visibility: hidden;
  overflow: hidden;
  isolation: isolate;
}
.np.open { transform: none; visibility: visible; }
.np .wash { height: 70%; }
.np-top { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.np-top .ctx { color: var(--muted); font-size: 13px; font-weight: 560; text-align: center; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 8px; }
.np-body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 22px; width: 100%; margin: 0 auto; }
.np-info { width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 22px; }
.np .cover { width: min(100%, max(140px, calc(100dvh - 400px))); margin: 0 auto; border-radius: 14px; box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55); }
.np-title { font-size: 22px; font-weight: 680; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.np-sub { color: var(--muted); }
.scrub { display: flex; flex-direction: column; gap: 4px; }
.scrub .times { display: flex; justify-content: space-between; color: var(--muted); font-size: 12.5px; }
input[type=range].seek {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  margin: 0;
  cursor: pointer;
  --pct: 0%;
}
input[type=range].seek::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--text) var(--pct), var(--line-strong) var(--pct));
}
input[type=range].seek::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-strong); }
input[type=range].seek::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--text); }
input[type=range].seek::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); margin-top: -5px; border: 0; }
input[type=range].seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 0; }
.np-controls { display: flex; align-items: center; justify-content: center; gap: 28px; }
.np-controls .icon-btn { width: 56px; height: 56px; }
.np-controls .icon-btn svg { width: 30px; height: 30px; }
.np-controls .play-btn { width: 72px; height: 72px; }
.np-controls .play-btn svg { width: 32px; height: 32px; }
/* A wide window: the cover fills the height on the left, the controls take the rest. */
@media (min-width: 860px) and (min-aspect-ratio: 5/4) {
  .np { padding-left: 48px; padding-right: 48px; }
  .np-body { flex-direction: row; gap: clamp(32px, 5vw, 80px); }
  .np .cover { width: min(calc(100dvh - 140px), 50vw); margin: 0; flex: none; }
  .np-info { flex: 1; max-width: 640px; gap: 28px; }
  .np-title { font-size: clamp(24px, 2.6vw, 40px); }
  .np .scrub-track.has-wave { height: 96px; }
}

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

.toasts {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}
.toast {
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 11px 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  font-size: 14px;
  animation: toast-in 0.2s ease-out;
}
.toast.bad { border-color: rgba(226, 130, 111, 0.5); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

.spinner { width: 14px; height: 14px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }

.footer-note { margin-top: 40px; text-align: center; color: var(--faint); font-size: 12.5px; }
.footer-note a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- waveform, modes ---------- */

.scrub-track { position: relative; height: 24px; }
.scrub-track .seek { position: relative; z-index: 1; }
.scrub-track.has-wave { height: 64px; }
.scrub-track.has-wave .seek { position: absolute; inset: 0; height: 100%; opacity: 0; }
.scrub-track:has(.seek:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
.wave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  --wave-on: var(--text);
  --wave-off: rgba(255, 240, 225, 0.2);
  --wave-mark: var(--accent);
}
.scrub-track:not(.has-wave) .wave { display: none; }
.icon-btn.mode { color: var(--faint); width: 44px; height: 44px; position: relative; }
.icon-btn.mode svg { width: 22px; height: 22px; }
.icon-btn.mode.on { color: var(--accent); }
.icon-btn.mode.on::after { content: ''; position: absolute; bottom: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--accent); }
.np-controls { gap: 14px; }
@media (min-width: 400px) { .np-controls { gap: 20px; } }
.np-extra { display: flex; justify-content: center; gap: 8px; min-height: 0; }
.np-extra:empty { display: none; }
.resume-hint { color: var(--muted); font-size: 13px; margin: -8px 0 16px; }
@media (max-width: 600px) { .resume-hint { text-align: center; } }
.resume-hint button { background: none; border: 0; color: var(--accent); padding: 0; cursor: pointer; font-weight: 560; }
.archived-head { margin: 28px 0 12px; }
.grid.archived .card { opacity: 0.75; }

/* ---------- comments ---------- */

.comments { display: flex; flex-direction: column; gap: 10px; }
.thread { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px; }
.comment .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.comment .who { font-weight: 650; font-size: 14px; }
.comment .when { color: var(--faint); }
.comment .at {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(226, 170, 118, 0.4);
  background: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.comment .at svg { width: 11px; height: 11px; }
.comment .body { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment.reply { margin-left: 14px; padding-left: 12px; border-left: 2px solid var(--line-strong); }
.comment .tools { display: flex; gap: 14px; margin-top: 4px; }
.comment .tools button { background: none; border: 0; padding: 0; color: var(--muted); font-size: 13px; font-weight: 560; cursor: pointer; }
.comment .tools button:hover { color: var(--text); }
.comments-empty { margin: 4px 0; }
.comment-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.comment-form .row-btns { display: flex; align-items: center; gap: 8px; }
.comment-form .grow { flex: 1; }
.check.small { font-size: 14px; color: var(--muted); min-height: 32px; }
.check.small input { width: 18px; height: 18px; }

/* ---------- notices ---------- */

.bell { position: relative; }
.bell .dot {
  position: absolute;
  top: 5px;
  right: 4px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}
.notice { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 10px; background: none; border: 0; cursor: pointer; width: 100%; }
.notice:hover { background: var(--raised); }
.notice .t { font-size: 14px; }
.notice .t strong { font-weight: 650; }
.notice .m { color: var(--muted); font-size: 13px; }
.notice.new .t::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 1px; }
.notice-list { display: flex; flex-direction: column; max-height: 60dvh; overflow: auto; margin: 0 -8px; }
.field select {
  min-height: 44px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  font-size: 16px;
  font-weight: 400;
}
.plays-line { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--accent); font-size: 13px; font-weight: 560; cursor: pointer; }
.plays-line.quiet { color: var(--faint); cursor: default; }
.badge.bad { color: var(--danger); border-color: rgba(226, 130, 111, 0.45); }
.row.static { cursor: default; }
.row.static:hover { background: none; }
.inline-form { display: flex; align-items: flex-end; gap: 8px; margin-top: 12px; max-width: 460px; }
.inline-form .field { flex: 1; }
.actions.sub { margin-top: -6px; }
.actions.sub .btn { min-height: 34px; padding: 0 12px; font-size: 14px; background: transparent; }
.btn.saved { color: var(--good); border-color: rgba(159, 191, 149, 0.35); }
.share-comments { margin-top: 28px; }

/* ---------- tappable cover ---------- */

.cover-edit { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 10px; flex: none; }
.hero .cover-edit { width: 200px; }
.hero .cover-edit .cover { width: 100%; }
@media (max-width: 600px) { .hero .cover-edit { width: min(64vw, 260px); } }
.cover-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: rgba(20, 19, 18, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.cover-badge svg { width: 15px; height: 15px; }
.cover-edit:hover .cover-badge { opacity: 1; }

/* ---------- lyrics ---------- */

.lyrics {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.65;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.lyrics.clamped { max-height: 23em; overflow: hidden; }
.lyrics.read { background: none; border: 0; padding: 0; max-height: none; }
.lyrics.read.small { font-size: 14px; max-height: 40vh; overflow: auto; background: var(--bg); padding: 10px 12px; border-radius: 10px; }
.lyrics-empty { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.head-btns { display: flex; gap: 2px; }
.head-btns .btn { min-height: 34px; padding: 0 10px; font-size: 14px; }
.small-note { font-size: 13px; margin: 8px 0 0; }
.page-title { margin: 4px 0 14px; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.lyrics-editor {
  display: block;
  width: 100%;
  min-height: 60vh;
  field-sizing: content;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  resize: vertical;
  outline: none;
  margin-bottom: 12px;
}
.lyrics-editor:focus { border-color: var(--accent); }
.lyrics-actions { margin-top: 12px; justify-content: flex-start !important; }
.save-state { font-size: 13px; }
.draft-note { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 8px 8px 14px; margin-bottom: 12px; border: 1px solid rgba(226, 170, 118, 0.35); border-radius: 12px; font-size: 14px; color: var(--muted); }

/* ---------- tabs bar, lyrics list, files ---------- */

.tab-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -6px 0 18px; }
.tab-bar .m { font-size: 13px; flex: 1; min-width: 200px; }
a.row { color: inherit; }
.row .d .when { color: var(--faint); font-size: 12px; text-align: right; margin-top: 3px; }
.row .d .badge { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.file-icon { width: 40px; height: 48px; flex: none; display: grid; place-items: center; position: relative; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.file-icon svg { width: 22px; height: 22px; }
.file-icon .ext { position: absolute; bottom: 3px; font-size: 8.5px; font-weight: 700; letter-spacing: 0.02em; color: var(--accent); }
.sheet-title { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 6px 0 10px; margin: 4px 0 12px; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); outline: none; }
.sheet-title:focus { border-bottom-color: var(--accent); }
.sheet-link { margin-bottom: 12px; }
.sheet-link-inner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sheet-link-inner .check { width: 100%; }
.pick-row { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border: 0; border-radius: 10px; background: none; cursor: pointer; text-align: left; width: 100%; }
.pick-row:hover { background: var(--raised); }
.pick-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-wave { margin: -6px 0 18px; height: 72px; }
@media (min-width: 601px) { .page-wave { height: 84px; } }

/* ---------- reordering ---------- */

.move-btns { display: flex; gap: 2px; flex: none; }
.icon-btn.off { opacity: 0.25; pointer-events: none; }
.list.reordering .row { cursor: default; }
.list.reordering .row:hover { background: var(--surface); }
.section-head .btn.primary { min-height: 34px; padding: 0 12px; }

/* ---------- visualizer ---------- */

.viz { display: block; width: 100%; height: 64px; }
@media (min-width: 860px) and (min-aspect-ratio: 5/4) { .viz { height: 132px; } }
body[data-viz="off"] .viz, body[data-viz="off"] .mini-eq { display: none; }
.np .cover { width: min(100%, max(140px, calc(100dvh - 480px))); }
@media (min-width: 860px) and (min-aspect-ratio: 5/4) { .np .cover { width: min(calc(100dvh - 140px), 50vw); } }
.mini-eq { width: 18px; height: 16px; flex: none; margin-left: -2px; }
body:not(.is-playing) .mini-eq { opacity: 0.35; }

/* The playing row: its number turns into three dancing bars. */
.row .n { position: relative; }
.row .n .eq { display: none; }
.row.playing .n { color: transparent; }
.row.playing .n .eq { display: flex; position: absolute; right: 2px; top: 50%; transform: translateY(-50%); gap: 2px; align-items: flex-end; height: 14px; }
.eq i { display: block; width: 3px; height: 100%; border-radius: 2px; background: var(--accent); transform-origin: bottom; transform: scaleY(0.3); }
body.is-playing .eq i { animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s !important; animation-duration: 0.7s !important; }
.eq i:nth-child(3) { animation-delay: -0.6s !important; animation-duration: 1.1s !important; }
@keyframes eq { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
body[data-viz="off"] .row.playing .n { color: var(--accent); }
body[data-viz="off"] .row.playing .n .eq { display: none; }

/* A track hidden on a tape: still yours to play, dimmed so it reads as left out of the links. */
.row.is-hidden .t, .row.is-hidden .s48, .row.is-hidden .cover { opacity: 0.5; }
