@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,800&display=swap");

:root {
  --face: #e3e6e0;      /* console faceplate */
  --panel: #f2f3ef;
  --ink: #1b2330;
  --ink-soft: #4d5663;
  --groove: #a7b0a8;    /* unplayed waveform */
  --needle: #e39a2d;    /* VU amber: markers, focus */
  --needle-deep: #b8741a;
  --line: #c9cec6;
  --ok: #3f7a5a;
  --danger: #a23b2a;
  --radius-s: 6px;
  --radius-l: 14px;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-optical-sizing: auto;
  color: var(--ink);
  background: var(--face);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; line-height: 1.45; font-size: 16px; }
.tnum { font-variant-numeric: tabular-nums; }

.wrap { max-width: 880px; margin: 0 auto; padding: 20px 20px 64px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-weight: 600; font-size: 15px; letter-spacing: 0.01em; color: var(--ink); text-decoration: none; }
.brand span { color: var(--ink-soft); font-weight: 400; }

h1.track {
  font-size: clamp(40px, 9vw, 76px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin: 40px 0 6px;
  word-break: break-word;
}
.artist { font-size: 20px; color: var(--ink-soft); margin: 0 0 28px; }

/* Version switch */
.versions { display: flex; gap: 4px; flex-wrap: wrap; background: var(--panel); padding: 4px; border-radius: 999px; }
.versions button {
  border: 0; background: transparent; font: inherit; font-size: 14px; padding: 6px 14px; border-radius: 999px;
  color: var(--ink-soft); cursor: pointer;
}
.versions button[aria-pressed="true"] { background: var(--ink); color: var(--face); }

/* Player */
.deck { background: var(--panel); border-radius: var(--radius-l); padding: 18px 18px 14px; }
.wave-wrap { position: relative; padding-top: 30px; user-select: none; -webkit-user-select: none; }
.wave { display: block; width: 100%; height: 120px; cursor: pointer; touch-action: none; }
.pins { position: absolute; left: 0; right: 0; top: 0; height: 30px; }
.pin {
  position: absolute; bottom: 2px; transform: translateX(-50%);
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px 11px 11px 2px;
  background: var(--needle); color: var(--ink); border: 0; font: inherit; font-size: 11px; font-weight: 600;
  cursor: pointer; display: grid; place-items: center; transform-origin: bottom left;
}
.pin.resolved { background: var(--groove); }
.pin.admin { background: var(--ink); color: var(--face); }
.pin.draft { background: transparent; border: 2px dashed var(--needle-deep); color: var(--needle-deep); }
.pin:hover, .pin.active { background: var(--needle-deep); color: #fff; }

.transport { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.play {
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--ink); color: var(--face);
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.play:disabled { opacity: 0.4; cursor: default; }
.play svg { width: 22px; height: 22px; }
.clock { font-size: 18px; font-variant-numeric: tabular-nums; }
.clock span { color: var(--ink-soft); }
.transport .spacer { flex: 1; }

.btn {
  font: inherit; font-size: 15px; font-weight: 500; border-radius: var(--radius-s); padding: 10px 16px;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn.primary { background: var(--ink); color: var(--face); }
.btn.mark { background: var(--needle); border-color: var(--needle); color: var(--ink); }
.btn.quiet { border-color: transparent; padding-left: 8px; padding-right: 8px; }
.btn.danger { color: var(--danger); border-color: transparent; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.small { font-size: 13px; padding: 6px 10px; }

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

/* Composer */
.composer { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.composer[hidden] { display: none; }
.composer .at { font-size: 14px; color: var(--needle-deep); font-weight: 600; margin-bottom: 6px; }
textarea, input[type="text"], input[type="password"] {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px;
}
textarea { min-height: 84px; resize: vertical; }
textarea:focus, input:focus { border-color: var(--ink); outline: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.row.end { justify-content: flex-end; }

/* Comment list */
h2 { font-size: 22px; font-weight: 600; margin: 40px 0 12px; letter-spacing: -0.01em; }
.comments { list-style: none; padding: 0; margin: 0; }
.comment { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment .when {
  font: inherit; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--needle-deep);
  background: none; border: 0; padding: 2px 0; text-align: left; cursor: pointer; align-self: start;
}
.comment .when.general { color: var(--ink-soft); font-weight: 400; cursor: default; }
.comment .who { font-weight: 600; font-size: 15px; }
.comment .who small { font-weight: 400; color: var(--ink-soft); margin-left: 6px; }
.comment .body { white-space: pre-wrap; margin-top: 2px; }
.comment.resolved .body { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: var(--groove); }
.comment.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: rgba(227,154,45,0.25); } to { background: transparent; } }
.comment .tools { display: flex; gap: 4px; margin-top: 6px; }
.empty { color: var(--ink-soft); padding: 8px 0; }

.note { font-size: 13px; color: var(--ink-soft); margin-top: 48px; }

/* Name gate */
dialog { border: 0; border-radius: var(--radius-l); padding: 24px; max-width: 420px; width: calc(100% - 32px); color: var(--ink); background: var(--panel); }
dialog::backdrop { background: rgba(27,35,48,0.45); }
dialog h3 { margin: 0 0 6px; font-size: 22px; }
dialog p { margin: 0 0 14px; color: var(--ink-soft); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--face);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 10; max-width: calc(100% - 32px);
}
.toast[hidden] { display: none; }

.loading { color: var(--ink-soft); padding: 60px 0; }
.error-page h1 { font-size: 34px; margin: 60px 0 8px; }

@media (max-width: 560px) {
  .wrap { padding: 16px 14px 56px; }
  h1.track { margin-top: 28px; }
  .deck { padding: 14px 12px 12px; border-radius: 10px; }
  .wave { height: 96px; }
  .comment { grid-template-columns: 52px 1fr; }
}
@media (prefers-reduced-motion: reduce) { .comment.flash { animation: none; } }
