:root {
  --ink: #0b0d0c;
  --panel: #111512;
  --panel-2: #171c18;
  --line: #2a322c;
  --muted: #8d988f;
  --paper: #eef5ef;
  --acid: #c8ff36;
  --acid-soft: rgba(200, 255, 54, .13);
  --danger: #ff6f61;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--ink); color: var(--paper); }
button, input, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.noise { position: fixed; inset: 0; pointer-events: none; opacity: .08; z-index: 10; background-image: repeating-linear-gradient(90deg, transparent 0 3px, rgba(255,255,255,.035) 3px 4px); }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 80% 10%, rgba(200,255,54,.1), transparent 30%), linear-gradient(135deg, #080a09, #111712); }
.login-card { width: min(530px, 100%); padding: 44px; border: 1px solid var(--line); background: rgba(17,21,18,.92); box-shadow: 0 28px 80px rgba(0,0,0,.5); position: relative; overflow: hidden; }
.login-card::after { content: ""; position: absolute; width: 180px; height: 180px; right: -90px; top: -90px; border: 1px solid var(--acid); border-radius: 50%; opacity: .28; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid var(--acid); transform: rotate(45deg); margin-bottom: 32px; }
.brand-mark span { transform: rotate(-45deg); color: var(--acid); font-weight: 900; font-size: 24px; }
.brand-mark.small { width: 36px; height: 36px; margin: 0; }
.brand-mark.small span { font-size: 17px; }
.eyebrow { color: var(--acid); letter-spacing: .17em; font-size: 11px; font-weight: 800; margin: 0 0 10px; }
.login-card h1 { margin: 0; font-size: clamp(42px, 9vw, 68px); line-height: .94; letter-spacing: -.065em; max-width: 440px; }
.login-card h1 em { color: var(--acid); font-style: normal; }
.login-copy { color: var(--muted); line-height: 1.6; max-width: 430px; margin: 26px 0 30px; }
label > span, form label { display: block; color: var(--muted); font-size: 10px; letter-spacing: .13em; font-weight: 800; margin-bottom: 9px; }
.key-field, .search-field { display: flex; border: 1px solid var(--line); background: #0c0f0d; }
.key-field:focus-within, .search-field:focus-within { border-color: var(--acid); box-shadow: 0 0 0 3px var(--acid-soft); }
input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--paper); padding: 14px 15px; }
.ghost-button, .mini-button { border: 1px solid var(--line); background: transparent; padding: 10px 14px; font-size: 10px; font-weight: 900; letter-spacing: .1em; cursor: pointer; }
.key-field .ghost-button { border-width: 0 0 0 1px; }
.primary-button { width: 100%; margin-top: 13px; border: 0; background: var(--acid); color: #11140b; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; font-weight: 900; cursor: pointer; }
.primary-button:hover { filter: brightness(1.08); }
.form-error { min-height: 22px; color: var(--danger); font-size: 13px; }
.login-foot { color: var(--muted); font-size: 11px; display: flex; gap: 8px; align-items: center; margin-top: 22px; }
.login-foot span, .live-dot { width: 7px; height: 7px; background: var(--acid); border-radius: 50%; box-shadow: 0 0 12px var(--acid); }

.app-shell { width: min(1560px, 100%); margin: auto; padding: 0 26px 50px; }
.topbar { min-height: 82px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; }
.brand-lockup, .instance-identity { display: flex; align-items: center; gap: 13px; }
.brand-lockup strong { display: block; letter-spacing: .16em; }
.brand-lockup small, .instance-identity small { color: var(--muted); font-size: 10px; letter-spacing: .11em; display: block; margin-top: 3px; }
.instance-identity img { width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); }
.instance-identity strong { font-size: 13px; }
.topbar > .ghost-button { justify-self: end; }

.command-strip { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto; gap: 12px; padding: 20px 0; border-bottom: 1px solid var(--line); }
select { width: 100%; min-height: 46px; border: 1px solid var(--line); outline: none; background: var(--panel); color: var(--paper); padding: 0 13px; }
select:focus { border-color: var(--acid); }
.connect-button { align-self: end; min-height: 46px; padding: 0 22px; background: var(--acid); color: #11140b; border: 0; font-weight: 900; letter-spacing: .08em; cursor: pointer; }
.connect-button:disabled, button:disabled { opacity: .35; cursor: not-allowed; }

.status-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 22px 0; }
.status-grid article { background: var(--panel); min-height: 86px; padding: 18px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; }
.status-grid i { width: 9px; height: 9px; border: 1px solid var(--muted); border-radius: 50%; }
.status-grid i.ok { background: var(--acid); border-color: var(--acid); box-shadow: 0 0 10px var(--acid); }
.status-grid small { display: block; color: var(--muted); font-size: 9px; letter-spacing: .13em; }
.status-grid strong { display: block; margin-top: 4px; font-size: 14px; }
.status-grid em { color: var(--muted); font-size: 10px; font-style: normal; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(310px, .7fr); gap: 22px; }
.main-column, .side-column { display: grid; align-content: start; gap: 22px; }
.now-card, .queue-card, .control-card, .instance-card { border: 1px solid var(--line); background: var(--panel); }
.now-card, .queue-card { padding: 24px; }
.control-card, .instance-card { padding: 22px; }
.card-heading, .mixer-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
h2 { font-size: 20px; margin: 0; letter-spacing: -.03em; }
.card-heading h2 span { color: var(--muted); font-size: 12px; margin-left: 6px; }
.danger-button { background: transparent; color: var(--danger); border: 1px solid rgba(255,111,97,.4); padding: 9px 12px; font-size: 9px; font-weight: 900; letter-spacing: .1em; }
.now-body { display: grid; grid-template-columns: minmax(180px, 32%) 1fr; gap: clamp(25px, 5vw, 60px); align-items: center; margin-top: 25px; }
.cover-wrap { aspect-ratio: 1; position: relative; background: #080a09; overflow: hidden; }
.cover-wrap img, .cover-placeholder { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder { display: grid; place-items: center; background: radial-gradient(circle at 50% 50%, #24301b, #0b0e0c 65%); }
.cover-placeholder span { font-size: clamp(56px, 8vw, 100px); color: var(--acid); opacity: .8; }
.playing-ring { position: absolute; width: 22px; height: 22px; bottom: 14px; right: 14px; border: 5px solid rgba(200,255,54,.3); border-top-color: var(--acid); border-radius: 50%; animation: spin 1.2s linear infinite; }
.playing-ring.paused { animation-play-state: paused; opacity: .35; }
@keyframes spin { to { transform: rotate(360deg); } }
.source-label { color: var(--acid); font-size: 10px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.track-copy h3 { font-size: clamp(27px, 4vw, 50px); line-height: 1.02; letter-spacing: -.055em; margin: 8px 0 10px; max-width: 760px; overflow-wrap: anywhere; }
.track-copy > p:not(.source-label) { color: var(--muted); margin: 0 0 28px; }
.progress, .volume-row input { padding: 0; accent-color: var(--acid); cursor: pointer; }
.time-row { color: var(--muted); display: flex; justify-content: space-between; font-size: 10px; margin-top: 8px; }
.transport { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 25px; }
.transport button { width: 42px; height: 42px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.transport button.active { color: var(--acid); border-color: var(--acid); }
.transport .play-button { width: 58px; height: 58px; border-radius: 50%; background: var(--acid); color: #10130b; border: 0; font-weight: 900; font-size: 19px; }

.queue-card { min-height: 310px; }
.queue-list { margin-top: 18px; }
.queue-row { display: grid; grid-template-columns: 28px 42px 1fr auto 32px; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.queue-number, .queue-duration { color: var(--muted); font-size: 10px; }
.queue-art { width: 42px; height: 42px; object-fit: cover; background: var(--panel-2); }
.queue-row strong, .queue-row small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-row strong { font-size: 13px; }
.queue-row small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.queue-row button { border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.empty-state { min-height: 220px; display: grid; place-items: center; align-content: center; color: var(--muted); text-align: center; }
.empty-state span { color: var(--acid); font-size: 30px; }
.empty-state strong { color: var(--paper); margin: 10px 0 0; }
.empty-state p { margin: 6px 0; font-size: 12px; }

.control-card h2 { font-size: 27px; margin-bottom: 20px; }
.search-field span { color: var(--acid); padding: 13px 0 0 13px; }
.mixer-heading strong { color: var(--acid); font-size: 25px; }
.volume-row { display: grid; grid-template-columns: 35px 1fr; align-items: center; gap: 10px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.volume-row span { color: var(--muted); font-size: 10px; }
.setting-row { min-height: 66px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.setting-row strong, .setting-row small { display: block; }
.setting-row strong { font-size: 13px; }
.setting-row small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.toggle { width: 40px; height: 22px; border: 1px solid var(--line); border-radius: 12px; background: #090b0a; padding: 2px; }
.toggle span { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: .2s; }
.toggle.on { border-color: var(--acid); }
.toggle.on span { transform: translateX(17px); background: var(--acid); }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mode-button { min-height: 40px; border: 1px solid var(--line); background: #0c0f0d; color: var(--muted); padding: 8px; font-size: 9px; font-weight: 900; letter-spacing: .08em; cursor: pointer; }
.mode-button:not(:disabled):hover { border-color: var(--acid); color: var(--paper); }
.mode-button.active { border-color: var(--acid); background: var(--acid-soft); color: var(--acid); box-shadow: inset 0 0 0 1px rgba(200,255,54,.1); }
.mode-hint { color: var(--muted); font-size: 10px; line-height: 1.5; margin: 14px 0 0; }
.instance-card dl { margin: 10px 0 0; }
.instance-card dl div { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.instance-card dt { color: var(--muted); }
.instance-card dd { margin: 0; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

.toast { position: fixed; right: 22px; bottom: 22px; width: min(390px, calc(100% - 44px)); border: 1px solid var(--line); background: #171d18; box-shadow: 0 14px 40px rgba(0,0,0,.5); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 14px; z-index: 20; }
.toast > span { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--acid); color: var(--acid); border-radius: 50%; }
.toast p { margin: 0; font-size: 12px; line-height: 1.45; }
.toast button { border: 0; background: transparent; color: var(--muted); font-size: 20px; }

@media (max-width: 980px) {
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: repeat(2, 1fr); }
  .instance-card { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .app-shell { padding: 0 15px 30px; }
  .topbar { grid-template-columns: 1fr auto; }
  .instance-identity { grid-row: 2; grid-column: 1 / -1; padding-bottom: 14px; }
  .topbar > .ghost-button { grid-column: 2; grid-row: 1; }
  .command-strip { grid-template-columns: 1fr; }
  .connect-button { min-height: 48px; }
  .status-grid { grid-template-columns: 1fr; }
  .status-grid article { min-height: 72px; }
  .now-card, .queue-card { padding: 18px; }
  .now-body { grid-template-columns: 1fr; }
  .cover-wrap { width: min(78vw, 340px); margin: auto; }
  .track-copy { text-align: center; }
  .side-column { grid-template-columns: 1fr; }
  .instance-card { grid-column: auto; }
  .login-card { padding: 30px 22px; }
  .queue-row { grid-template-columns: 24px 36px 1fr 30px; }
  .queue-art { width: 36px; height: 36px; }
  .queue-duration { display: none; }
}
