/* Dark studio look: near-black violet ground, magenta-to-orange accents, violet buttons. */
:root {
  color-scheme: dark;
  --bg: #0b0812;
  --bg-glow: #2a0f4a;
  --surface: #150f22;
  --surface-2: #1d1530;
  --surface-3: #261c3d;
  --line: #2f2449;
  --line-strong: #43356a;
  --text: #f5f0ff;
  --muted: #a99cc6;
  --violet: #7c5cff;
  --violet-hi: #9479ff;
  --magenta: #e040fb;
  --orange: #ff7a3d;
  --grad: linear-gradient(100deg, #e040fb 0%, #ff4d9d 50%, #ff7a3d 100%);
  --comment: #b69cff;
  --idea: #ff9a5c;
  --danger: #ff6b81;
  --ok: #5ee39a;
  --focus: #c4b2ff;
  --radius: 14px;
  --radius-sm: 9px;
  --display: "Archivo", "Arial Black", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --wave-a: #e040fb;
  --wave-b: #ff7a3d;
  --wave-dim: #3b2d5c;
  --wave-hover: #6a55a3;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 16px/1.55 var(--body);
  background:
    radial-gradient(1100px 420px at 85% -120px, var(--bg-glow), transparent 70%),
    radial-gradient(700px 300px at 0% -80px, #1e0b33, transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--comment); }
a:hover { color: #d6c9ff; }
h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; }
h2 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: #6b3fd6; color: #fff; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface-2); padding: 8px 12px; z-index: 20; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.stack { display: grid; gap: 18px; }

/* ---------- Header ---------- */
.top {
  display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-between;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(10px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
  font-family: var(--display); font-stretch: 112%; font-weight: 700; font-size: 1.05rem; letter-spacing: .01em; }
.brand svg { width: 26px; height: 26px; fill: var(--magenta); }
.top nav { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.top nav a, .navlink {
  color: var(--muted); text-decoration: none; padding: 6px 12px; border-radius: 99px; font-size: .95rem; font-weight: 500;
  background: none; border: 0; font-family: inherit; cursor: pointer;
}
.top nav a:hover, .navlink:hover { color: var(--text); background: var(--surface-2); }
.top nav a[aria-current="page"] { color: var(--text); background: var(--surface-3); }

main { max-width: 980px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 96px max(16px, env(safe-area-inset-left, 0px)); }
.studio-page main { max-width: 1360px; }
section { margin: 28px 0; }

/* ---------- Type ---------- */
.display {
  font-family: var(--display); font-stretch: 125%; font-weight: 900; text-transform: uppercase;
  font-size: clamp(2rem, 5.2vw, 3.6rem); line-height: .98; letter-spacing: -.005em; overflow-wrap: anywhere;
}
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.label { font-family: var(--display); font-stretch: 112%; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; font-size: .9rem; color: var(--text); margin-bottom: 12px; display: flex; gap: 8px; align-items: baseline; }
.kicker { font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--idea); }
.page-hero { display: grid; gap: 10px; margin: 8px 0 26px; }
.lede { font-size: 1.05rem; color: var(--muted); max-width: 62ch; }
.crumbs { font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 20px 0; }
.card > h2 + p, .card > h2 + form { margin-top: 8px; }
.card > * + * { margin-top: 12px; }
.narrow { max-width: 480px; margin: 48px auto; }
.flash { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ok) 50%, transparent);
  color: var(--text); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.error, .form-error { color: var(--danger); font-weight: 600; }

/* ---------- Forms ---------- */
label { display: block; margin: 0 0 12px; font-weight: 600; font-size: .92rem; }
input, textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 11px 13px; font: inherit; font-weight: 400;
  color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
input::placeholder, textarea::placeholder { color: #7d6f9c; }
input:focus, textarea:focus, select:focus { border-color: var(--violet-hi); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--violet) 35%, transparent); }
textarea { resize: vertical; }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: 1.05em; height: 1.05em; margin: 0 8px 0 0; vertical-align: -2px; accent-color: var(--violet); box-shadow: none; }
label.check { font-weight: 500; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 600; font-size: .92rem; margin-bottom: 8px; padding: 0; }
.radios label { font-weight: 400; margin-bottom: 8px; }
button, .btn {
  font: inherit; font-size: .94rem; font-weight: 600; padding: 10px 18px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, border-color .15s, transform .1s;
}
button:hover, .btn:hover { border-color: var(--violet-hi); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: default; transform: none; }
.primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.primary:hover { background: var(--violet-hi); border-color: var(--violet-hi); }
.ghost { background: transparent; }
.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.danger:hover { border-color: var(--danger); }
.small-btn { padding: 6px 12px; font-size: .85rem; }
button.link { background: none; border: 0; padding: 2px 4px; border-radius: 4px; color: var(--comment); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
button.link:hover { color: #e0d6ff; }
.danger-link, button.danger-link { color: var(--danger); }
form.inline { display: inline; margin: 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.row.center { justify-content: center; align-items: center; }
.row label { margin-bottom: 0; }
.row .grow { flex: 1 1 220px; min-width: 0; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details.card > summary { display: flex; justify-content: space-between; align-items: center; }
details.card > summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--muted); }
details.card[open] > summary::after { content: "\2212"; }
details.card[open] > summary { margin-bottom: 14px; }
details.card form + form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- Home tiles ---------- */
.new-project { background: linear-gradient(135deg, #1c1033, #160e27); }
.tiles { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tiles a {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; padding: 16px; aspect-ratio: 1 / 1; max-width: 100%;
  border-radius: var(--radius); text-decoration: none; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(150deg, #8b2cf5, #e040fb 55%, #ff7a3d);
  transition: transform .15s;
}
.tiles li:nth-child(4n+2) a { background: linear-gradient(150deg, #5b2bd9, #b83cf0 60%, #ff4d9d); }
.tiles li:nth-child(4n+3) a { background: linear-gradient(150deg, #c026d3, #ff4d6d 55%, #ff9a3d); }
.tiles li:nth-child(4n+4) a { background: linear-gradient(150deg, #3b1d8f, #7c5cff 60%, #e040fb); }
.tiles a::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(10, 4, 20, .55)); }
.tiles a > * { position: relative; }
.tiles a:hover { transform: translateY(-3px); }
.tiles strong { font-family: var(--display); font-stretch: 112%; font-weight: 800; text-transform: uppercase; font-size: 1.05rem; line-height: 1.1; overflow-wrap: anywhere; }
.tiles span { color: rgba(255, 255, 255, .85); font-size: .88rem; }

.feed { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.feed > li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.feed a { text-decoration: none; color: var(--text); }
.feed a:hover strong { text-decoration: underline; }
.feed p { color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }

/* ---------- Studio layout: player + songs on the left, notes on the right ---------- */
.studio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 24px; align-items: start; }
.studio.no-notes { grid-template-columns: minmax(0, 1fr); }
.studio-main { min-width: 0; }
.studio-main > section:first-child, .studio-main > .player { margin-top: 0; }

.player {
  position: relative; border-radius: 18px; padding: 22px; margin: 0 0 24px;
  background: linear-gradient(160deg, #22153d, #140d24 60%);
  border: 1px solid var(--line-strong);
  box-shadow: 0 20px 60px -30px rgba(160, 60, 255, .55);
}
.now { display: flex; align-items: center; gap: 16px; }
.play {
  width: 64px; height: 64px; border-radius: 50%; padding: 0; justify-content: center; flex: none;
  background: var(--grad); border: 0; color: #fff; box-shadow: 0 8px 24px -8px rgba(255, 77, 157, .7);
}
.play:hover { filter: brightness(1.08); }
.play svg { width: 28px; height: 28px; fill: currentColor; }
.play .i-pause, .is-playing .play .i-play { display: none; }
.is-playing .play .i-pause { display: block; }
.meta { flex: 1; min-width: 0; }
.meta .title { font-family: var(--display); font-stretch: 112%; font-weight: 800; font-size: 1.25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .92rem; }
.meta .sep { opacity: .5; }
.player-tools { display: flex; gap: 8px; }
.icon-btn { width: 42px; height: 42px; padding: 0; justify-content: center; border-radius: 50%; background: var(--surface-3); color: var(--text); border: 1px solid var(--line-strong); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
a.icon-btn { display: inline-flex; align-items: center; }
a.icon-btn:hover { border-color: var(--violet-hi); color: var(--text); }

.wave-wrap { position: relative; margin-top: 30px; height: 104px; }
.wave { display: block; width: 100%; height: 100%; }
.seek { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; border: 0; }
.wave-wrap:focus-within { outline: 3px solid var(--focus); outline-offset: 6px; border-radius: 8px; }
.markers { position: absolute; left: 0; right: 0; top: -26px; height: 22px; z-index: 2; }
.marker {
  position: absolute; transform: translateX(-50%); width: 20px; height: 20px; padding: 0; border-radius: 50%;
  font-size: .62rem; font-weight: 800; justify-content: center; color: #160c26; border: 2px solid #160c26;
  background: var(--comment);
}
.marker.suggestion { background: var(--idea); }
.marker::after { content: ""; position: absolute; left: 50%; top: 18px; width: 2px; height: 10px; margin-left: -1px; background: inherit; opacity: .7; }
.marker:hover { transform: translateX(-50%) scale(1.15); }

/* Song list */
.songs { margin: 0 0 24px; }
.tracks { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.tracks > li { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); }
.tracks > li:first-child { border-top: 0; }
.tracks > li:hover { background: var(--surface-2); }
.tracks > li.playing { background: linear-gradient(90deg, color-mix(in srgb, var(--magenta) 16%, transparent), transparent 70%); }
.play-track { width: 38px; height: 38px; padding: 0; border-radius: 50%; justify-content: center; flex: none; background: transparent; border-color: transparent; color: var(--muted); }
.play-track .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.play-track svg { width: 16px; height: 16px; fill: currentColor; display: none; }
.tracks > li:hover .play-track .num, .tracks > li.playing .play-track .num, .play-track:focus-visible .num { display: none; }
.tracks > li:hover .play-track svg, .tracks > li.playing .play-track svg, .play-track:focus-visible svg { display: block; }
.tracks > li.playing .play-track { background: var(--grad); color: #fff; }
.t-main { flex: 1 1 200px; display: flex; flex-direction: column; min-width: 0; }
.t-title { color: var(--text); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.t-title:hover { color: var(--text); text-decoration: underline; }
.t-sub { color: var(--muted); font-size: .86rem; font-variant-numeric: tabular-nums; }
.has-notes { color: var(--idea); }
.t-edit summary { color: var(--muted); font-size: .9rem; padding: 4px 10px; border-radius: 99px; }
.t-edit summary:hover { color: var(--text); background: var(--surface-3); }
.t-edit[open] { flex-basis: 100%; }
.t-edit-body { display: grid; gap: 12px; padding: 12px 0 4px; }
.t-tools { gap: 6px; }

/* Notes column */
.notes-col {
  position: sticky; top: 16px; display: flex; flex-direction: column; min-width: 0;
  height: calc(100vh - 32px); max-height: 980px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; overflow: hidden;
}
.notes-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 18px 10px; }
.notes-head h2 { font-family: var(--display); font-stretch: 112%; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; font-size: 1rem; }
.notes-head .count { font-family: var(--body); text-transform: none; letter-spacing: 0; font-weight: 500; font-size: .85rem; }
.notes-head label { font-weight: 500; margin: 0; color: var(--muted); }
.composer-slot { padding: 0 18px 14px; border-bottom: 1px solid var(--line); }
.notes { list-style: none; margin: 0; padding: 12px 12px 18px; flex: 1; overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 10px; align-content: start; }
.notes .empty { padding: 18px 8px; text-align: center; }

.composer { display: grid; gap: 10px; }
.composer .pin { font-size: .9rem; color: var(--muted); }
.composer .pin strong { color: var(--text); font-variant-numeric: tabular-nums; }
.kind { display: flex; gap: 6px; }
.kind label { margin: 0; font-weight: 500; font-size: .88rem; }
.kind input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kind span { display: inline-block; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--muted); cursor: pointer; }
.kind input:checked + span { color: #160c26; background: var(--comment); border-color: var(--comment); font-weight: 600; }
.kind label:last-child input:checked + span { background: var(--idea); border-color: var(--idea); }
.kind input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.composer textarea { margin: 0; }
.composer-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.composer-actions .rec { margin-right: auto; padding: 8px 14px; }
.rec .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.recording .rec { border-color: var(--danger); color: var(--danger); }
.recording .rec .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .recording .rec .dot { animation: none; } }
.clip { display: grid; gap: 4px; justify-items: start; }
.clip audio, .voice audio { width: 100%; height: 36px; }

.note { border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--comment); transition: background .2s; }
.note.suggestion { border-left-color: var(--idea); }
.note.done { opacity: .55; }
.note.near { background: var(--surface-3); border-color: var(--line-strong); }
.note.flash-note { background: color-mix(in srgb, var(--magenta) 18%, var(--surface-2)); }
.note-card { padding: 12px 12px 8px; display: grid; gap: 6px; }
.note-top { display: flex; align-items: center; gap: 10px; }
.note-meta { flex: 1; min-width: 0; font-size: .9rem; overflow-wrap: anywhere; }
.note-meta .muted { font-size: .8rem; }
.avatar { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem;
  background: var(--surface-3); color: var(--comment); border: 1px solid var(--line-strong); }
.avatar.band { background: var(--grad); color: #fff; border: 0; }
.pill { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 1px 7px; border-radius: 99px;
  background: color-mix(in srgb, var(--magenta) 22%, transparent); color: #f3b8ff; vertical-align: 1px; margin-left: 4px; }
.jump { flex: none; padding: 3px 10px; font-size: .82rem; font-variant-numeric: tabular-nums; background: var(--bg); border-color: var(--line-strong); }
.note-tags { display: flex; gap: 6px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 9px; border-radius: 99px; color: var(--comment); border: 1px solid currentColor; }
.badge.suggestion { color: var(--idea); }
.badge.reply { color: var(--muted); }
.badge.done-badge { color: var(--ok); }
.note-body { overflow-wrap: anywhere; font-size: .95rem; }
.voice { display: grid; gap: 4px; }
.voice-tag { font-size: .78rem; font-weight: 600; color: var(--magenta); }
.note-tools { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.note-tools button { font-size: .82rem; padding: 2px 2px; }
.replies { list-style: none; margin: 0 12px 8px 26px; padding: 0 0 0 12px; border-left: 2px solid var(--line-strong); display: grid; gap: 4px; }
.reply .note-card { padding: 8px 4px 4px; }
.reply .avatar { width: 24px; height: 24px; font-size: .72rem; }
.reply-slot:not(:empty) { padding: 0 12px 12px 12px; }
.reply-composer textarea { font-size: .92rem; }

/* Uploads */
.drop {
  display: grid; gap: 12px; justify-items: center; text-align: center; padding: 26px 16px;
  border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--bg);
}
.drop.over { border-color: var(--magenta); background: color-mix(in srgb, var(--magenta) 8%, var(--bg)); }
.btn input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.btn { position: relative; margin: 0; }
.btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.uploads { list-style: none; padding: 0; margin: 12px 0 0; }
.uploads li { display: grid; grid-template-columns: minmax(0, 1fr) 140px minmax(0, auto); gap: 12px; align-items: center; padding: 8px 0; font-size: .9rem; border-top: 1px solid var(--line); }
.uploads .u-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads progress { width: 100%; accent-color: var(--magenta); }
.uploads li.ok .u-status { color: var(--ok); font-weight: 600; }
.uploads li.bad .u-status { color: var(--danger); font-weight: 600; }
.upload-done { margin-top: 10px; }

/* Sharing and people */
.invites, .people { list-style: none; padding: 0; margin: 12px 0 0; }
.invites > li { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.invites .row { align-items: center; }
.invites input { margin: 0; font-size: .85rem; }
.person { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.person:first-child { border-top: 0; }
.person-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.person-tools { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.access { list-style: none; padding: 0; margin: 6px 0 0; font-size: .9rem; color: var(--muted); }
.invite-admin { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.share summary h2, details.card summary h2 { display: inline; }
.pick { max-height: 320px; overflow-y: auto; }
.pick label { font-weight: 400; margin: 6px 0; }
.pick-head { font-weight: 700; margin-top: 12px; color: var(--muted); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; }

@media (max-width: 1000px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
  .notes-col { position: static; height: auto; max-height: 85vh; }
}
@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .player { padding: 16px; }
  .play { width: 54px; height: 54px; }
  .meta .title { font-size: 1.02rem; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; }
  .now { gap: 12px; }
  .player-tools { gap: 6px; }
  .icon-btn { width: 38px; height: 38px; }
  .wave-wrap { height: 84px; }
  .uploads li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .person { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
.card.narrow h1 { font-family: var(--display); font-stretch: 112%; font-weight: 800; text-transform: uppercase; font-size: 1.6rem; }
.card.narrow form { margin-top: 18px; }
.tagline { color: var(--muted); font-size: .95rem; font-weight: 500; }
