:root {
  --bg-canvas: #020617;
  --bg-card: rgba(15, 23, 42, 0.82);
  --bg-input: #0b1120;
  --border-glass: rgba(56, 189, 248, 0.2);
  --cyan: #22d3ee;
  --amber: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: radial-gradient(circle at top right, #0f172a, var(--bg-canvas) 62%);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.hidden { display: none !important; }

.app-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 24px;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.4);
  color: var(--cyan);
  display: grid;
  place-items: center;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.2);
}

.brand h1 { font-size: 1.2rem; letter-spacing: 0.08em; font-weight: 800; }

.badge {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 6px;
}

.tagline { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }

.header-actions { display: flex; align-items: center; gap: 14px; }
.brand-sub { font-size: 0.72rem; letter-spacing: 0.08em; color: var(--text-muted); }

.status-pill {
  font-size: 0.78rem;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.3);
  padding: 6px 12px;
  border-radius: 999px;
}

.workspace {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
}

@media (max-width: 940px) {
  .workspace { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 22px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

@media (max-width: 560px) {
  .mode-tabs { grid-template-columns: repeat(2, 1fr); }
}

.tab {
  background: var(--bg-input);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  transition: 0.2s;
}

.tab.active {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
}

.field-group { margin-bottom: 16px; }

label {
  display: block;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.label-row label { margin-bottom: 0; }

.upload-box {
  border: 1px dashed rgba(34, 211, 238, 0.45);
  background: rgba(11, 17, 32, 0.85);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}

.upload-box:hover { border-color: var(--amber); }
.upload-title { font-size: 0.9rem; font-weight: 600; color: var(--cyan); }
.upload-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
#imagePreview { max-height: 150px; border-radius: 8px; margin: 0 auto; display: block; }

.preset-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.preset-chip {
  background: var(--bg-input);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

.preset-chip.active {
  border-color: var(--amber);
  color: var(--amber);
  background: rgba(245, 158, 11, 0.1);
}

input[type="text"], textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: var(--text-main);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.92rem;
  font-family: inherit;
}

input[type="text"]:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
}

.options-row { margin-bottom: 16px; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  font-size: 0.84rem;
  color: var(--text-main);
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--cyan), #0284c7);
  color: #020617;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
}

.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  width: 100%;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: var(--amber);
  font-weight: 600;
  font-size: 0.84rem;
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: var(--cyan);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  cursor: pointer;
}

.hint {
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--amber);
  min-height: 18px;
}

.vault-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.vault-header h2 { font-size: 1.05rem; }

.now-playing {
  background: var(--bg-input);
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
}

.np-top {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.np-cover {
  width: 78px;
  height: 78px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(34, 211, 238, 0.3);
  flex-shrink: 0;
}

.np-meta { flex: 1; min-width: 0; }
.np-badges {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.np-label { font-size: 0.7rem; color: var(--amber); letter-spacing: 0.08em; font-weight: 700; }

.dsp-toggle {
  display: inline-flex;
  background: #020617;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  overflow: hidden;
}

.dsp-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 4px 8px;
  cursor: pointer;
}

.dsp-btn.active {
  background: rgba(34, 211, 238, 0.18);
  color: var(--cyan);
  font-weight: 600;
}

.now-playing h3 {
  font-size: 1rem;
  margin: 5px 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing p {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

audio { width: 100%; height: 38px; }

.stem-bar {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.stem-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stem-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.stem-link {
  display: block;
  text-align: center;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.3);
  color: var(--cyan);
  text-decoration: none;
  font-size: 0.75rem;
  padding: 6px 4px;
  border-radius: 6px;
}

.track-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 410px;
  overflow-y: auto;
}

.track-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(11, 17, 32, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.15);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.track-item:hover { border-color: var(--cyan); }
.track-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #020617;
  flex-shrink: 0;
}

.track-info { flex: 1; min-width: 0; }
.track-title { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-sub { font-size: 0.76rem; color: var(--text-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-status { font-size: 0.74rem; color: var(--cyan); text-transform: uppercase; font-weight: 600; }
.empty-state { color: var(--text-muted); font-size: 0.88rem; text-align: center; padding: 30px 0; }
