:root {
  --bg: #1c1d20;
  --panel: #202125;
  --bar: #222327;
  --well: #17181a;
  --field: #18191b;
  --raised: #2e3035;
  --chip: #2a2c31;
  --line: #34363c;
  --line-soft: #2c2e33;
  --text: #eceae6;
  --text-2: #a7a9ae;
  --text-3: #8b8e94;
  --a: #6f8cff;
  --b: #f2a03d;
  --ok: #8fe0a8;
  --live: #ff5b4f;
  --warn-bg: #2a251c;
  --warn-line: #6b5124;
  --warn-text: #f3d7a8;
  --radius: 7px;
  font-family: 'Instrument Sans', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-size: 14px; }
body { -webkit-font-smoothing: antialiased; }
a { color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--a); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cond { font-stretch: 85%; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mobile-only { display: none !important; }

.app { display: flex; height: 100vh; height: 100dvh; }
.shell { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.main { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.main:focus { outline: none; }

/* Rail */
.rail { flex: 0 0 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 0; border-right: 1px solid var(--line); }
.rail .logo { margin-bottom: 18px; }
.rail a, .rail-btn { width: 60px; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border-radius: 8px; color: var(--text-2); text-decoration: none; font-size: 11px; font-stretch: 85%; font-weight: 600; background: none; border: 0; }
.rail svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.rail a[aria-current="page"] { background: var(--raised); color: #fff; }
.rail a:hover, .rail-btn:hover { color: #fff; }
.rail-spacer { flex: 1 1 auto; }

/* Generic controls */
.btn { min-height: 40px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line); background: transparent; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--chip); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 700; font-size: 14px; }
.btn.primary:hover { background: #fff; }
.btn.solid { background: var(--raised); border-color: var(--raised); }
.btn.warn { background: var(--b); color: var(--bg); border-color: var(--b); font-weight: 700; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.icon-btn { width: 32px; height: 32px; border-radius: 6px; border: 0; background: var(--chip); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.icon-btn.ghost { background: transparent; color: var(--text-3); }
.icon-btn.on { background: #3a3d43; color: #fff; }
.icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.icon-btn svg.fill { fill: currentColor; stroke: none; }
.field { min-height: 40px; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px; font-size: 14px; }
.field:focus-within, .field:focus { border-color: #55585f; }
select.field { padding: 0 8px; font-size: 13px; }
.seg { display: inline-flex; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px; }
.seg button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 5px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: #3a3d43; color: #fff; }
.label { font-size: 12px; font-stretch: 85%; color: var(--text-2); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--bar); }
.toolbar h1 { font-size: 18px; font-weight: 600; margin: 0 8px 0 0; }
.slots { flex: 1 1 560px; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.slot { flex: 1 1 180px; min-width: 0; display: flex; align-items: center; gap: 4px; }
.slot .join { padding: 0 4px; color: var(--text-3); font-size: 13px; }
.slot label { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 4px 0 10px; }
.slot input { flex: 1 1 auto; min-width: 0; min-height: 36px; background: transparent; border: 0; outline: none; font-size: 14px; }
.dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.describe { flex: 1 1 560px; display: flex; align-items: center; }
.describe input { flex: 1 1 auto; min-width: 0; min-height: 36px; background: transparent; border: 0; outline: none; font-size: 15px; }
.grow { flex: 1 1 0; }

/* Body panes */
.panes { flex: 1 1 auto; min-height: 0; display: flex; flex-wrap: wrap; }
.pane-claude { flex: 1 1 300px; max-width: 360px; min-width: 0; display: flex; flex-direction: column; gap: 14px; padding: 18px; border-right: 1px solid var(--line); background: var(--panel); min-height: 0; }
.pane-center { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; }
.pane-right { flex: 1 1 300px; max-width: 380px; min-width: 0; display: flex; flex-direction: column; gap: 14px; padding: 16px 18px; border-left: 1px solid var(--line); background: var(--panel); }

/* Claude panel */
.claude-head { display: flex; flex-direction: column; gap: 4px; }
.claude-head strong { font-size: 15px; }
.claude-head span { font-size: 12px; line-height: 1.45; color: var(--text-2); }
.thread { flex: 1 1 auto; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.msg-user { align-self: flex-end; max-width: 88%; background: var(--raised); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.msg-claude { font-size: 13.5px; line-height: 1.55; color: #d9d7d2; white-space: pre-wrap; }
.actlog { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.actlog div { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 12px; color: #c9c7c2; }
.actlog div + div { border-top: 1px solid var(--line); }
.actlog svg { width: 13px; height: 13px; flex: 0 0 13px; fill: none; stroke: var(--ok); stroke-width: 2.4; }
.actlog span { flex: 1 1 auto; }
.linkbtn { background: none; border: 0; color: var(--text-2); font-size: 12px; text-decoration: underline; padding: 2px 4px; }
.linkbtn[disabled] { text-decoration: none; opacity: 0.6; }
.confirm { display: flex; flex-direction: column; gap: 10px; border: 1px solid var(--warn-line); background: var(--warn-bg); border-radius: 8px; padding: 12px; }
.confirm p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--warn-text); }
.confirm div { display: flex; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 30px; padding: 0 9px; border-radius: 6px; background: var(--chip); color: #c9c7c2; border: 0; font-size: 12px; }
.composer { display: flex; align-items: flex-end; gap: 6px; background: var(--field); border: 1px solid var(--line); border-radius: 9px; padding: 6px 6px 6px 12px; }
.composer textarea { flex: 1 1 auto; min-width: 0; min-height: 40px; max-height: 160px; resize: none; background: transparent; border: 0; outline: none; font-size: 13.5px; line-height: 1.5; }
.send { width: 36px; height: 36px; border-radius: 7px; background: var(--text); color: var(--bg); border: 0; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.send svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.typing { font-size: 12.5px; color: var(--text-3); }

/* Map */
.map-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; }
.map-head h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.map-head .meta { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.legend { display: flex; align-items: center; gap: 14px; font-size: 12px; font-stretch: 85%; color: var(--text-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.mapwrap { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--well); }
.mapwrap svg { width: 100%; height: auto; display: block; }
.mapwrap .artist-pt { cursor: pointer; }
.reading { margin: 0; font-size: 13.5px; line-height: 1.55; color: #d9d7d2; max-width: 70ch; }
.empty { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 40px 28px; color: var(--text-2); }
.empty h2 { margin: 0; color: var(--text); font-size: 20px; font-weight: 600; }
.empty p { margin: 0; max-width: 56ch; line-height: 1.55; }
.busy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(23, 24, 26, 0.82); font-size: 14px; text-align: center; padding: 20px; }
.pulse { width: 34px; height: 24px; position: relative; }
.pulse i { position: absolute; top: 2px; width: 20px; height: 20px; border-radius: 50%; border: 2px solid; animation: drift 1.4s ease-in-out infinite alternate; }
.pulse i:first-child { left: 0; border-color: var(--a); }
.pulse i:last-child { right: 0; border-color: var(--b); animation-direction: alternate-reverse; }
@keyframes drift { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .pulse i { animation: none; } .roller-card { transition: none !important; } }
.popover { position: absolute; width: 250px; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #25272b; border: 1px solid #44474e; border-radius: 9px; z-index: 5; }
.popover .top { display: flex; align-items: center; gap: 10px; }
.popover img, .popover .ph { width: 56px; height: 56px; border-radius: 3px; object-fit: cover; flex: 0 0 56px; background: var(--raised); }
.popover strong { font-size: 15px; }
.popover p { margin: 0; font-size: 12.5px; line-height: 1.45; color: #c9c7c2; }
.popover .row { display: flex; gap: 6px; }
.popover .row .btn { flex: 1 1 0; }

/* Draft list */
.draft-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.draft-status { font-size: 12px; font-stretch: 85%; color: var(--b); font-weight: 600; }
.draft-status.sent { color: var(--text-2); }
.list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.item input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--text); flex: 0 0 16px; }
.cover { flex: 0 0 auto; border-radius: 3px; background: var(--raised); object-fit: cover; display: block; }
.c44 { width: 44px; height: 44px; }
.c36 { width: 36px; height: 36px; }
.item .txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .name { font-size: 14px; font-weight: 600; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.item .tag { font-size: 11px; font-stretch: 85%; color: var(--text-2); font-weight: 500; }
.item .sub { font-size: 12px; color: var(--text-2); }
.right-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.attrib { font-size: 11.5px; line-height: 1.45; color: var(--text-3); }

/* Player bar */
.playerbar { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--bar); min-height: 64px; }
.playerbar:empty { display: none; }
.pb-now { flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 12px; }
.pb-now a.art { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 3px; background: var(--raised); overflow: hidden; display: block; }
.pb-now img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pb-now .t { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pb-now .t strong { font-size: 14px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-now .t span { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live { width: 6px; height: 6px; border-radius: 50%; background: var(--live); flex: 0 0 6px; }
.pb-mid { flex: 2 1 320px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.transport { display: flex; align-items: center; gap: 8px; }
.tbtn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; }
.tbtn svg { width: 16px; height: 16px; fill: currentColor; }
.tbtn.tplay { width: 40px; height: 40px; background: var(--text); color: var(--bg); }
.tbtn.tplay svg { width: 14px; height: 14px; }
.progress { width: 100%; max-width: 420px; height: 3px; border-radius: 2px; background: var(--line); }
.progress i { display: block; height: 3px; border-radius: 2px; background: var(--text); }
.pb-right { flex: 1 1 260px; min-width: 0; display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; }
kbd { font: inherit; font-size: 11px; font-stretch: 85%; color: var(--text-2); border: 1px solid #4a4d54; border-radius: 4px; padding: 0 5px; }

/* Big player */
.big { flex: 1 1 auto; display: flex; flex-direction: column; transition: background 600ms; }
.big-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.big-body { flex: 1 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 48px; padding: 40px 48px; }
.big-cover { flex: 1 1 420px; max-width: 640px; min-width: 0; margin: 0; }
.big-cover img, .big-cover .ph { width: 100%; aspect-ratio: 1 / 1; border-radius: 4px; display: block; background: var(--raised); object-fit: contain; }
.big-info { flex: 1 1 420px; min-width: 0; max-width: 620px; display: flex; flex-direction: column; gap: 24px; }
.big-info h1 { margin: 0; font-size: clamp(40px, 6vw, 76px); line-height: 0.98; font-weight: 600; letter-spacing: -0.025em; }
.big-info .artist { font-size: 24px; font-weight: 500; }
.big-info .album { font-size: 15px; color: rgba(255,255,255,0.68); }
.why { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: 9px; background: rgba(0,0,0,0.18); border: 1px solid rgba(255,255,255,0.1); }
.why strong { font-size: 13px; }
.why span { font-size: 14px; line-height: 1.55; color: rgba(255,255,255,0.86); }
.upnext { display: flex; flex-direction: column; gap: 10px; }
.upnext .row { display: flex; align-items: center; gap: 12px; }
.upnext img, .upnext .ph { width: 52px; height: 52px; border-radius: 3px; background: rgba(255,255,255,0.08); object-fit: cover; }
.big .progress { max-width: none; height: 4px; background: rgba(255,255,255,0.18); }
.big .progress i { height: 4px; }
.big .transport .tbtn { width: 48px; height: 48px; color: #fff; }
.big .transport .tbtn.tplay { width: 64px; height: 64px; background: #fff; color: #222; }
.big .transport .tbtn svg { width: 20px; height: 20px; }

/* Albums roller */
.roller { position: relative; height: 470px; perspective: 1400px; overflow: hidden; flex: 0 0 auto; }
.roller-card { position: absolute; left: 50%; top: 50%; width: 380px; height: 380px; padding: 0; border: 0; border-radius: 4px; overflow: hidden; background: var(--raised); transition: transform 380ms cubic-bezier(.2,.7,.2,1), opacity 380ms; }
.roller-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.roller-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 40; width: 48px; height: 48px; border-radius: 50%; background: var(--raised); border: 1px solid #44474e; display: flex; align-items: center; justify-content: center; }
.roller-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.roller-info { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 0 24px; }
.roller-info h2 { margin: 0; font-size: 36px; line-height: 1.05; font-weight: 600; letter-spacing: -0.02em; }
.roller-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0 24px; }
.strip { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 8px 24px 0; }
.strip button { width: 52px; height: 52px; padding: 0; border-radius: 3px; border: 2px solid transparent; background: var(--raised); overflow: hidden; }
.strip button[aria-current="true"] { border-color: var(--text); }
.strip img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Playlists */
.families { flex: 0 1 190px; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 16px 10px; border-right: 1px solid var(--line); }
.families button { min-height: 38px; display: flex; align-items: center; justify-content: space-between; padding: 0 10px; border-radius: 6px; background: transparent; border: 0; color: #c9c7c2; font-size: 14px; font-weight: 600; text-align: left; }
.families button[aria-pressed="true"] { background: var(--raised); color: #fff; }
.families small { font-size: 12px; font-stretch: 85%; color: var(--text-3); font-weight: 500; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 9px; background: transparent; border: 1px solid transparent; text-align: left; }
.tile[aria-pressed="true"] { background: var(--chip); border-color: #55585f; }
.tile .t { font-size: 14px; font-weight: 600; line-height: 1.3; }
.tile .m { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--text-2); }
.tile .m b { color: var(--b); }
.tile .m b.sent { color: var(--text-2); font-weight: 600; }
.mosaic { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; aspect-ratio: 1 / 1; border-radius: 3px; overflow: hidden; background: var(--raised); }
.mosaic img, .mosaic span { width: 100%; height: 100%; object-fit: cover; display: block; background: #2a2c31; }

/* Log */
.table { min-width: 860px; display: flex; flex-direction: column; }
.trow { display: grid; grid-template-columns: 52px 60px minmax(0, 3fr) minmax(0, 1fr) 176px 92px 180px; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.trow.head { padding: 12px 0 10px; border-bottom: 1px solid var(--line); font-size: 12px; font-stretch: 85%; color: var(--text-3); }
.trow .ttl { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trow .ttl strong { font-size: 15px; font-weight: 600; }
.trow .ttl span { font-size: 12px; color: var(--text-2); }
.kept { display: flex; gap: 4px; align-items: center; }
.acts { display: flex; gap: 6px; justify-content: flex-end; }

/* Login */
.login { flex: 1 1 auto; display: grid; place-items: center; padding: 24px; }
.login div { max-width: 440px; display: flex; flex-direction: column; gap: 16px; }
.login h1 { margin: 0; font-size: 44px; font-weight: 600; letter-spacing: -0.02em; }
.login p { margin: 0; color: var(--text-2); line-height: 1.55; font-size: 15px; }

/* Toasts */
.toasts { position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(92vw, 520px); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 9px; background: #2e3035; border: 1px solid #44474e; font-size: 13.5px; line-height: 1.45; }
.toast.err { border-color: #7a3b36; background: #3a2422; }
.toast span { flex: 1 1 auto; }

/* Small screens: Fold 7 cover screen and phones */
@media (max-width: 760px) {
  .app { flex-direction: column-reverse; }
  .rail { flex: 0 0 auto; flex-direction: row; justify-content: space-around; padding: 4px 0 calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .rail .logo, .rail-spacer, .desktop-only { display: none !important; }
  .rail a { width: auto; flex: 1 1 0; min-height: 52px; }
  .mobile-only { display: flex !important; }
  .toolbar { padding: 10px 12px; }
  .slots { flex-direction: column; align-items: stretch; }
  .slot { flex: 1 1 auto; }
  .slot .join { display: none; }
  .pane-claude.inline { display: none; }
  .pane-center { padding: 12px; }
  .pane-right { max-width: none; border-left: 0; border-top: 1px solid var(--line); }
  .families { flex: 1 1 100%; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
  .families button { flex: 0 0 auto; }
  .big-body { padding: 20px; gap: 24px; }
  .roller { height: 320px; }
  .roller-card { width: 240px; height: 240px; }
  .roller-info h2 { font-size: 26px; }
  .pb-mid .progress, .devtxt, .transport .tbtn:not(.tplay) { display: none; }
  .playerbar { gap: 8px 10px; padding: 8px 12px; min-height: 0; }
  .pb-now { flex: 1 1 calc(100% - 60px); }
  .pb-now a.art { flex-basis: 44px; width: 44px; height: 44px; }
  .pb-mid { flex: 0 0 auto; }
  .pb-right { flex: 1 1 100%; justify-content: space-between; }
  .pb-right kbd { display: none; }
  .devsel select { max-width: 150px; }
  .big .transport .tbtn:not(.tplay) { display: inline-flex; }
  .toasts { bottom: 140px; }
}
