:root {
  --bg: #0b0b10;
  --panel: #14141c;
  --panel-2: #1b1b26;
  --line: #262634;
  --text: #ececf3;
  --muted: #8d8da3;
  --accent: #ff4800;
  --accent-2: #ff8a1f;
  --ok: #3ddc97;
  --warn: #ffb547;
  --err: #ff6b6b;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.error { color: var(--err); min-height: 1em; margin: 6px 0 0; }
h1, h2 { margin: 0 0 14px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 18px; }

.btn { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 999px;
  padding: 10px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; gap: 6px; transition: .15s; }
.btn:hover { border-color: #3a3a4d; }
.btn.primary { border: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn.primary:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 12px; font-size: 12.5px; }
.btn.wide { width: 100%; justify-content: center; margin-top: 18px; padding: 14px; font-size: 16px; }
.btn.danger:hover { border-color: var(--err); color: var(--err); }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; }

input, textarea, select { width: 100%; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font: inherit; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }
select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%238d8da3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px; }
select:hover, select:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23ff8a1f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); }
option { background: var(--panel-2); color: var(--text); }
#lyrics { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13.5px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 32px 28px; display: grid; gap: 12px; text-align: center; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; }
.logo.big { width: 56px; height: 56px; font-size: 26px; margin: 0 auto 4px; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 12px 24px; background: rgba(11, 11, 16, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand img { height: 30px; width: auto; display: block; }
.brand-studio { font-size: 15px; font-weight: 600; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line);
  letter-spacing: .02em; }
.login-logo { width: 190px; height: auto; margin: 0 auto; display: block; }
.studio-title { margin: -2px 0 0; font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: .3em;
  text-transform: uppercase; }
.mixer-toggles { display: flex; gap: 8px; }
.toggle { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 6px 14px;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s; }
.toggle:hover { border-color: #3a3a4d; color: var(--text); }
.toggle.on { background: rgba(255, 72, 0, .14); border-color: rgba(255, 72, 0, .5); color: var(--text); }
.stems-state { display: grid; gap: 4px; }
.topnav { display: flex; gap: 4px; margin-right: auto; margin-left: 12px; }
.topnav-item { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: .15s; }
.topnav-item:hover { color: var(--text); background: var(--panel-2); }
.topnav-item.active { color: var(--text); background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--accent); }
.topnav-item .heart { color: var(--accent); }
.gpu { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.on .dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.pill.busy .dot { background: var(--accent); animation: pulse 1s infinite; }
.pill.warm .dot { background: var(--warn); animation: pulse 1.4s infinite; }
.pill.bad .dot { background: var(--err); }
@keyframes pulse { 50% { opacity: .3; } }

.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); max-width: 1640px; margin: 0 auto; }
.shell.no-side { grid-template-columns: minmax(0, 1fr); }
.shell.no-side .layout { padding-left: 24px; }
.sidebar { position: sticky; top: 57px; align-self: start; height: calc(100vh - 57px); overflow: auto;
  padding: 20px 12px 20px 24px; display: flex; flex-direction: column; gap: 4px; }
.side-head { display: flex; justify-content: space-between; align-items: center; margin: 18px 10px 6px;
  color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.side-head .link { text-transform: none; letter-spacing: 0; font-weight: 600; }
.folder-list { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.nav-item:hover { background: var(--panel-2); }
.nav-item.active { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.nav-item.muted { color: var(--muted); }
.nav-icon { width: 18px; text-align: center; flex: none; }
.nav-icon.heart { color: var(--accent); }
.nav-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { color: var(--muted); font-size: 12px; }

.layout { display: grid; grid-template-columns: minmax(340px, 460px) minmax(0, 1fr); gap: 20px; padding: 20px 24px 20px 12px;
  min-width: 0; align-content: start; }
.layout.single { grid-template-columns: 1fr; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px; min-width: 0; }
.create { align-self: start; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.field-label { display: block; margin: 16px 0 6px; font-weight: 600; font-size: 13.5px; }

.drop { position: relative; border: 1.5px dashed #34344a; border-radius: var(--radius); padding: 20px;
  text-align: center; background: var(--panel-2); transition: .15s; }
.drop.over { border-color: var(--accent); background: #24160f; }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop.has-file input[type=file] { display: none; }
.drop-icon { font-size: 26px; margin-bottom: 6px; }
.file-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
audio { width: 100%; max-width: 100%; min-width: 0; height: 36px; }
.progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
.progress.indeterminate > div { width: 35%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

.chips, .tagbar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.tagbar { margin: 0 0 6px; }
.chip { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px;
  padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--accent); }
.hint { margin-top: 6px; }
.advanced { margin-top: 14px; }
.advanced summary { cursor: pointer; color: var(--muted); font-size: 13.5px; list-style: none; display: inline-flex; align-items: center; gap: 8px; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { content: ""; width: 10px; height: 7px; flex: none; transition: transform .15s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%238d8da3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E") center / contain no-repeat; }
.advanced[open] summary::after { transform: rotate(180deg); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.row label { font-size: 12.5px; color: var(--muted); display: grid; gap: 4px; }

.subtabs { display: flex; gap: 4px; margin: 14px 0 18px; border-bottom: 1px solid var(--line); }
.subtab { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 14px;
  padding: 10px 16px; margin-bottom: -1px; cursor: pointer; border-bottom: 2px solid transparent; }
.subtab:hover { color: var(--text); }
.subtab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-count { color: var(--muted); font-size: 12px; font-weight: 500; margin-left: 4px; }
.tab-count:empty { display: none; }
.lib-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.lib-actions { display: flex; gap: 6px; }
.folder-hint { margin: -8px 0 4px; }
.block + .block { margin-top: 22px; }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
#sources-block.over { outline: 1.5px dashed var(--accent); outline-offset: 6px; border-radius: var(--radius); }
.upload-list { display: grid; gap: 8px; margin-bottom: 10px; }
.upload-list:empty { display: none; }
.upload-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 8px 12px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); }
.upload-row .progress { grid-column: 1 / -1; margin-top: 4px; }
.upload-row.failed { border-color: var(--err); }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; }
.upload-row.failed .upload-state { color: var(--err); }
.src-editor { display: none; gap: 8px; }
.source.editing .src-editor { display: grid; }
.src-editor textarea { font-size: 13px; }
.src-lyrics { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.src-editor-actions { display: flex; align-items: center; gap: 10px; }
.source.editing .edit-text { border-color: var(--accent); }
#source-text-save { margin-top: 10px; }
h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 10px; align-items: start; }
.source { display: grid; gap: 8px; padding: 12px; border-radius: var(--radius); background: var(--panel-2);
  border: 1px solid var(--line); min-width: 0; }
.source.selected { border-color: var(--accent); }
.source-top { display: grid; gap: 2px; min-width: 0; }
.source-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.style-sets { display: flex; gap: 6px; margin-bottom: 8px; }
.style-sets select { flex: 1; min-width: 0; padding: 7px 10px; font-size: 13.5px; }
.job-flags { display: flex; align-items: center; gap: 6px; flex: none; }
.like { border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
  padding: 2px 4px; border-radius: 8px; }
.like:hover { color: var(--accent); }
.like.on { color: var(--accent); }
.small-select { width: auto; padding: 5px 34px 5px 12px; font-size: 12.5px; font-weight: 600; border-radius: 999px;
  background-color: transparent; background-position: right 13px center; background-size: 10px 7px; }
.onboarding { text-align: center; padding: 48px 24px; max-width: 520px; justify-self: center; width: 100%; }
.inline-form { display: flex; gap: 8px; margin-top: 16px; }
.jobs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.job { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 14px; min-width: 0; border-radius: var(--radius);
  background: var(--panel-2); border: 1px solid var(--line); }
.art { width: 64px; height: 64px; border-radius: 12px; display: grid; place-items: center; font-size: 26px;
  color: rgba(255, 255, 255, .85); }
.job-body { min-width: 0; display: grid; gap: 8px; }
.job-top { display: flex; justify-content: space-between; gap: 10px; min-width: 0; }
.job-top > div:first-child { flex: 1; min-width: 0; }
.job-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-style { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60ch; }
.badge { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; height: fit-content; white-space: nowrap;
  background: var(--line); color: var(--muted); }
.badge.succeeded { background: rgba(61, 220, 151, .12); color: var(--ok); }
.badge.running, .badge.queued { background: rgba(255, 72, 0, .14); color: var(--accent-2); }
.badge.failed { background: rgba(255, 107, 107, .12); color: var(--err); }
.job-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.meta { margin-left: auto; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 12px 16px 0; gap: 6px; }
  .side-head { margin: 0; order: 3; flex: none; }
  .side-head > span { display: none; }
  .folder-list { flex-direction: row; gap: 6px; }
  .nav-item { width: auto; flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
  .nav-item.active { box-shadow: none; border-color: var(--accent); }
  .nav-name { max-width: 16ch; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; }
  .create { position: static; max-height: none; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .topnav { order: 3; width: 100%; margin: 0; }
  .topnav-item { flex: 1; justify-content: center; }
  .sidebar { top: 0; }
  .brand { font-size: 14px; }
  .brand img { height: 24px; }
  .brand-studio { font-size: 13px; padding-left: 8px; }
}
@media (max-width: 480px) {
  .job { grid-template-columns: minmax(0, 1fr); }
  .meta { margin-left: 0; width: 100%; }
  .pill { font-size: 12px; padding: 5px 10px; }
}

.job-title-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1;
  padding: 3px 5px; border-radius: 8px; flex: none; }
.icon-btn:hover { color: var(--accent); background: var(--panel); }
.note { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; color: var(--warn); }

.menu-wrap { position: relative; }
.menu-btn { font-size: 18px; line-height: 1; padding: 4px 12px; letter-spacing: 1px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; min-width: 180px; padding: 6px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0, 0, 0, .45); display: grid; gap: 2px; }
.menu-item { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13.5px; text-align: left;
  padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.menu-item:hover { background: var(--panel); }
.menu-item.danger:hover { color: var(--err); }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; cursor: pointer; }
.check input { width: auto; accent-color: var(--accent); }

/* ---- compact song card ---- */
.jobs { gap: 8px; }
.job { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; padding: 10px 12px; align-items: start; }
.job.now-playing { border-color: rgba(255, 72, 0, .55); }
.art { position: relative; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; }
.art-play { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; cursor: pointer; color: #fff;
  font-size: 20px; background: rgba(0, 0, 0, .18); display: grid; place-items: center; transition: background .15s; }
.art-play:hover { background: rgba(0, 0, 0, .42); }
.job-body { gap: 4px; }
.job-top { align-items: flex-start; }
.job-main { flex: 1; min-width: 0; }
.job-title-row { min-width: 0; }
.dur { flex: none; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--line); color: var(--muted); }
.job-flags { gap: 2px; }
.job-note-wrap { min-width: 0; }
.job-note { cursor: text; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.4; color: var(--warn); }
.job-note.no-note { color: var(--muted); opacity: .55; font-size: 12.5px; }
.job-note.no-note:hover { opacity: 1; }
.note-editor { font-size: 13px; color: var(--warn); padding: 6px 8px; border-radius: 8px; min-height: 0; }
.job-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.job-foot .meta { margin-left: auto; }
.job-menu-btn { font-size: 18px; letter-spacing: 1px; padding: 2px 8px; }
.menu-wrap .menu { max-height: 60vh; overflow: auto; }
.menu-label { padding: 8px 12px 2px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.menu-divider { height: 1px; background: var(--line); margin: 4px 2px; }
a.menu-item { text-decoration: none; display: block; }
.menu-item.danger { color: var(--err); }
.mixer-toggles { display: flex; gap: 6px; }

/* ---- lyrics modal ---- */
.modal { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 0; border: 1px solid var(--line);
  border-radius: 18px; background: var(--panel); color: var(--text); }
.modal::backdrop { background: rgba(0, 0, 0, .6); }
.modal[open] { display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px 8px; }
.modal-head h3 { text-transform: none; letter-spacing: 0; font-size: 16px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lyrics-text { margin: 0; padding: 8px 20px 16px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.6 ui-monospace, "SF Mono", Menlo, monospace; user-select: text; }
.modal-actions { display: flex; align-items: center; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--line); }

/* ---- player bar ---- */
body.has-player { padding-bottom: 88px; }
.playerbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  align-items: center; gap: 16px; padding: 10px 24px; background: rgba(20, 20, 28, .94); backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.pb-now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pb-art { width: 48px; height: 48px; border-radius: 8px; flex: none; display: grid; place-items: center; color: rgba(255, 255, 255, .85); font-size: 20px; }
.pb-meta { min-width: 0; }
.pb-title { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-center { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pb-play { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; font-size: 16px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.pb-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: center; }
.pb-range, .pb-vol { accent-color: var(--accent); padding: 0; background: transparent; border: 0; width: auto; }
.pb-range { flex: 1; min-width: 0; }
.pb-vol { width: 90px; }
.pb-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.pb-right .toggle { padding: 4px 10px; font-size: 12px; white-space: nowrap; }

@media (max-width: 1000px) {
  .playerbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "now right" "center center"; gap: 6px 12px; padding: 8px 16px; }
  .pb-now { grid-area: now; } .pb-center { grid-area: center; } .pb-right { grid-area: right; }
  .pb-vol { display: none; }
  body.has-player { padding-bottom: 120px; }
}
@media (max-width: 480px) {
  .job { grid-template-columns: 48px minmax(0, 1fr); }
  .art { display: grid; width: 48px; height: 48px; }
}
