:root {
  --bg: #13131a;
  --bg-2: #1a1a24;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-soft: rgba(255, 255, 255, 0.03);
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 196, 122, 0.35);
  --text: #f4eee6;
  --muted: #c4bfb8;
  --accent: #f4c47a;
  --accent-2: #ff8b3d;
  --mint: #83d4cb;
  --danger: #ff9c8f;
  --line-mid: rgba(255, 255, 255, 0.15);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.16);
}

* { box-sizing: border-box; }

/* ── Global: hide all scrollbars while keeping scrolling functional ───── */
* {
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE / Edge */
}
*::-webkit-scrollbar {
  display: none;               /* Chrome / Safari / Opera */
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI Variable", sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 15% 0%, rgba(255, 139, 61, 0.32), transparent 35%),
    radial-gradient(ellipse at 85% 5%, rgba(131, 212, 203, 0.26), transparent 38%),
    radial-gradient(ellipse at 50% 80%, rgba(120, 80, 200, 0.18), transparent 45%),
    linear-gradient(145deg, #0e0e18 0%, #161624 50%, #111120 100%);
}

.shell {
  width: min(1520px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
  position: relative;
  padding-bottom: 14px;
}

.topbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(244, 196, 122, 0.50) 25%,
    rgba(131, 212, 203, 0.60) 50%,
    rgba(244, 196, 122, 0.50) 75%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: ui-shimmer 4s ease-in-out infinite;
}

@keyframes ui-shimmer {
  0%   { background-position: 200% 0; opacity: 0.7; }
  50%  { background-position: -200% 0; opacity: 1; }
  100% { background-position: 200% 0; opacity: 0.7; }
}

.brand-block h1,
.showcase h2,
.composer h2,
.output h2,
h3 {
  font-family: "Fraunces", "Iowan Old Style", serif;
  margin: 0;
}

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

.brand-logo {
  height: 128px;
  width: 128px;
  object-fit: contain;
  border-radius: 14px;
  flex-shrink: 0;
}

.brand-block h1 {
  font-size: clamp(1.7rem, 3vw, 2.8rem);
  line-height: 1.0;
  max-width: 14ch;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  color: var(--accent);
}

.subcopy,
.helper-text,
.timeline-meta,
.field span,
.status-pill span,
.audio-meta span,
.log-meta span {
  color: var(--muted);
}

.status-pills {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.service-toolbar {
  display: grid;
  gap: 10px;
  align-items: center;
  min-width: min(100%, 360px);
  padding: 10px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.service-toolbar .eyebrow {
  margin-bottom: 4px;
}

.service-toolbar-copy {
  display: grid;
  gap: 2px;
}

.service-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.service-action-button {
  min-width: 0;
}

#service-status-summary {
  font-size: 0.96rem;
}

#service-status-detail {
  margin: 0;
}

.panel,
.album-card,
.timeline-card,
.prompt-card,
.audio-card,
.log-card,
.history-card {
  border: 1px solid var(--glass-border);
  background: var(--panel);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  border-radius: 16px;
}

.status-pill {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 8px 14px;
}

.studio-grid {
  display: grid;
  grid-template-columns: 0.94fr 1.08fr 0.92fr;
  gap: 14px;
  align-items: start;
}

.panel {
  padding: 14px;
}

.showcase,
.composer,
.output {
  display: grid;
  gap: 10px;
}

.album-card {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.album-art {
  height: 190px;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 35%, rgba(255, 196, 122, 0.75), transparent 14%),
    radial-gradient(circle at 68% 62%, rgba(131, 212, 203, 0.6), transparent 18%),
    linear-gradient(135deg, #1c2126 0%, #202d39 45%, #10161d 100%);
}

.album-ring,
.album-core {
  position: absolute;
  border-radius: 50%;
  inset: 0;
  margin: auto;
}

.album-ring {
  width: 160px;
  height: 160px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.34);
}

.album-core {
  width: 64px;
  height: 64px;
  background: radial-gradient(circle, #f6eee5 0%, #f4c47a 34%, #1a1410 35%, #10151a 100%);
}

.mode-bar,
.duration-presets,
.preset-row,
.chip-cloud,
.actions,
.inline-actions,
.recipe-grid,
.recent-takes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-actions {
  align-items: center;
}

.wide-gap {
  gap: 12px;
}

.mode-chip,
.duration-chip,
.preset-chip,
.token-chip,
.badge,
.button {
  border-radius: 999px;
}

.mode-chip,
.duration-chip,
.preset-chip,
.token-chip {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 8px 13px;
  cursor: pointer;
  font-size: 0.87rem;
}

.mode-chip.active,
.duration-chip.active,
.preset-chip:hover,
.token-chip:hover {
  border-color: rgba(255, 196, 122, 0.45);
  background: rgba(255, 196, 122, 0.1);
}

.preset-chip.active {
  border-color: rgba(255, 196, 122, 0.8);
  background: rgba(255, 196, 122, 0.22);
  color: #ffc47a;
}

/* ── Melody First panel ───────────────────────────────────────────────────── */
.melody-panel {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(131, 212, 203, 0.18);
  border-radius: 12px;
  padding: 16px;
  background: rgba(131, 212, 203, 0.04);
}

.melody-panel.hidden {
  display: none;
}

.melody-mode-note {
  font-size: 0.88rem;
  line-height: 1.6;
  border-color: rgba(131, 212, 203, 0.15) !important;
  background: rgba(131, 212, 203, 0.04) !important;
}

.melody-mode-note p {
  margin: 0;
}

.timeline-card,
.prompt-card,
.engine-card,
.identity-card,
.helper-card,
.audio-card,
.log-card,
.history-card {
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.timeline-header,
.panel-header,
.audio-meta,
.log-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.panel-header.compact {
  margin-bottom: 10px;
}

.timeline-meta {
  text-align: right;
  display: grid;
  gap: 4px;
}

.range {
  width: 100%;
  margin: 14px 0 10px;
}

.duration-feedback {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 196, 122, 0.13);
  border-radius: 10px;
  background: rgba(255, 196, 122, 0.04);
}

.duration-feedback-label {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.extension-launchpad {
  border-color: rgba(131, 212, 203, 0.26);
}

.launch-card {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(131, 212, 203, 0.14);
  border-radius: 10px;
  padding: 14px;
  background: rgba(131, 212, 203, 0.04);
}

.launch-card h4 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.launch-card .helper-text {
  line-height: 1.55;
  margin: 0;
}

.launch-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.composer .field,
.edit-panel,
.engine-card,
.identity-card,
.helper-card,
.checkbox-field,
.upload-row {
  display: grid;
  gap: 8px;
}

.sound-effects-picker {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.sound-effect-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.sound-effect-card.active {
  border-color: rgba(255, 196, 122, 0.72);
  background: rgba(255, 196, 122, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sound-effect-card.playing {
  border-color: rgba(131, 212, 203, 0.55);
  background: rgba(131, 212, 203, 0.08);
  transform: translateY(-1px);
}

.sound-effect-card h4,
.sound-effect-card p {
  margin: 0;
}

.sound-effect-card h4 {
  font-size: 0.98rem;
}

.sound-effect-card p {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}

.sound-effect-source {
  font-size: 0.74rem;
  color: rgba(244, 238, 230, 0.78);
}

.sound-effect-source a {
  color: var(--accent);
  text-decoration: none;
}

.sound-effect-source a:hover {
  text-decoration: underline;
}

.sound-effect-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sound-effect-actions .button {
  flex: 1 1 0;
  min-width: 0;
}

.sound-effects-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.sound-effects-footer .helper-text {
  margin: 0;
}

.emphasis {
  margin: -4px 0 2px;
  color: var(--accent);
}

.engine-card {
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.inactive-panel {
  opacity: 0.78;
  border-color: rgba(255, 255, 255, 0.12);
}

.identity-card {
  border: 1px solid rgba(255, 196, 122, 0.20);
  border-radius: 12px;
  background: rgba(255, 196, 122, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 196, 122, 0.10);
}

.reference-library {
  display: grid;
  gap: 14px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 4px;
}

.reference-section {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
  padding: 10px 12px;
}

.reference-section-title {
  margin: 0 0 10px;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 460px;
  overflow-y: auto;
  padding-right: 4px;
}

.recipe-card,
.take-card,
.coach-card,
.candidate-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
  padding: 12px;
}

.recipe-card {
  display: grid;
  gap: 10px;
}

.recipe-card h4,
.take-card h4 {
  margin: 0;
  font-family: "Fraunces", "Iowan Old Style", serif;
}

.recipe-card p,
.take-meta,
.take-tags,
.empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.recipe-meta,
.take-actions,
.coach-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.recipe-meta .badge,
.take-meta .badge {
  padding: 6px 10px;
}

.coach-meter {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.coach-meter-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--mint));
  transition: width 160ms ease;
}

.coach-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.helper-candidates {
  display: grid;
  gap: 12px;
  padding-top: 6px;
}

.candidate-grid {
  display: grid;
  gap: 10px;
}

.candidate-card {
  display: grid;
  gap: 12px;
}

.candidate-card h4,
.candidate-copy {
  margin: 0;
}

.candidate-copy {
  color: var(--muted);
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.candidate-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.coach-card {
  gap: 10px;
  display: grid;
}

.coach-label {
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.coach-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--text);
}

.recent-takes {
  display: grid;
  gap: 10px;
  max-height: 680px;
  overflow-y: auto;
  padding-right: 4px;
}

.take-card {
  display: grid;
  gap: 10px;
}

.take-cover {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cover-studio {
  display: grid;
  gap: 14px;
}

.cover-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(0, 1.05fr);
  gap: 14px;
  align-items: start;
}

.cover-preview-card {
  display: grid;
  gap: 10px;
}

.cover-preview,
.cover-empty {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cover-preview {
  object-fit: cover;
  background: rgba(255, 255, 255, 0.03);
}

.cover-empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 196, 122, 0.12), transparent 26%),
    linear-gradient(155deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.02));
}

.cover-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.take-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.take-actions {
  display: flex;
  gap: 8px;
}

.feedback-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.feedback-header,
.feedback-actions,
.feedback-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.feedback-title {
  color: var(--text);
  font-size: 0.92rem;
}

.feedback-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.feedback-comment {
  min-height: 72px;
  resize: vertical;
}

.lock-panel,
.learning-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.lock-chip.active {
  border-color: rgba(255, 196, 122, 0.45);
  background: rgba(255, 196, 122, 0.1);
  color: var(--accent);
}

.learning-memory {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.learning-card-head,
.learning-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.learning-card h4,
.learning-card p {
  margin: 0;
}

.learning-card p {
  color: var(--muted);
  font-size: 0.92rem;
}

.learning-pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.78rem;
}

.take-actions .button {
  padding: 9px 12px;
}

.take-tags {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reference-library::-webkit-scrollbar,
.recipe-grid::-webkit-scrollbar,
.recent-takes::-webkit-scrollbar,
pre::-webkit-scrollbar {
  display: none;
}

.reference-library::-webkit-scrollbar-thumb,
.recipe-grid::-webkit-scrollbar-thumb,
.recent-takes::-webkit-scrollbar-thumb,
pre::-webkit-scrollbar-thumb {
  background: transparent;
}

.field span {
  font-size: 0.9rem;
}

input,
textarea,
select,
button,
audio {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
}

select {
  color-scheme: dark;
}

select option,
select optgroup {
  background: #1e1e2a;
  color: var(--text);
}

select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(255, 196, 122, 0.45);
  box-shadow: 0 0 0 2px rgba(244, 196, 122, 0.08);
}

.vocal-preset-header {
  margin-top: 4px;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.two-up,
.three-up,
.four-up,
.insight-grid {
  display: grid;
  gap: 14px;
}

.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four-up { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.insight-grid { grid-template-columns: 1fr; }

.dense { gap: 12px; }

.four-up.dense {
  gap: 10px;
  align-items: end;
}

.dense input,
.dense select {
  padding: 10px 12px;
}

.dense .field span {
  font-size: 0.84rem;
}

.checkbox-wrap.boxed {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.checkbox-wrap.boxed label {
  font-size: 0.86rem;
  line-height: 1.1;
}

.checkbox-wrap input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.upload-row {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.button {
  border: 0;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.87rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 100ms ease;
}

.button:hover,
.mode-chip:hover,
.duration-chip:hover,
.preset-chip:hover,
.token-chip:hover { transform: translateY(-1px); }

.button-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a0e02;
  font-weight: 700;
  box-shadow: 0 2px 14px rgba(244, 196, 122, 0.22);
}

.button-secondary {
  background: rgba(131, 212, 203, 0.09);
  color: var(--mint);
  border: 1px solid rgba(131, 212, 203, 0.22);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.button-danger {
  background: rgba(220, 53, 69, 0.12);
  color: #f87171;
  border: 1px solid rgba(220, 53, 69, 0.3);
}

.button-danger:hover {
  background: rgba(220, 53, 69, 0.25);
  border-color: rgba(220, 53, 69, 0.55);
  color: #fca5a5;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  padding-top: 6px;
  background: linear-gradient(180deg, transparent, rgba(13, 18, 24, 0.92) 40%);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.07);
}

.badge.running { background: rgba(255, 196, 122, 0.14); color: var(--accent); }
.badge.success { background: rgba(131, 212, 203, 0.14); color: var(--mint); }
.badge.error { background: rgba(255, 156, 143, 0.14); color: var(--danger); }

.audio-card.large { min-height: 180px; }

.hidden {
  display: none;
}

.mode-chip.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.mode-chip:disabled {
  transform: none;
}

pre {
  margin: 12px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", "Cascadia Code", monospace;
  font-size: 0.88rem;
  color: #ded4c7;
  max-height: 360px;
  overflow: auto;
}

#audio-player {
  width: 100%;
  margin-top: 14px;
  color-scheme: dark;
  accent-color: #4da6ff;
  filter: hue-rotate(195deg) saturate(1.6) brightness(1.05);
}
a { color: var(--accent); }
.hidden { display: none !important; }

@media (max-width: 1300px) {
  .studio-grid { grid-template-columns: 1fr 1fr; }
  .output { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .topbar,
  .studio-grid,
  .two-up,
  .three-up,
  .four-up,
  .upload-row { grid-template-columns: 1fr; }
  .status-pills { justify-content: start; }
  .service-toolbar { min-width: 0; }
  .recipe-grid,
  .coach-grid { grid-template-columns: 1fr; }
  .recipe-grid,
  .recent-takes {
    max-height: none;
  }
  .duration-feedback {
    align-items: start;
    flex-direction: column;
  }
  .cover-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .four-up.dense {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Composer Nav ─────────────────────────────────────────────────────────── */
.composer-nav {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  padding: 5px 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  position: sticky;
  top: 8px;
  z-index: 10;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
}

.composer-chip {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 90ms ease;
  white-space: nowrap;
  font-family: inherit;
}

.composer-chip:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border-color: transparent;
  transform: none;
}

.composer-chip.active {
  background: rgba(255, 196, 122, 0.14);
  border-color: rgba(255, 196, 122, 0.32);
  color: var(--accent);
  font-weight: 600;
}

/* ── Section anchor ──────────────────────────────────────────────────────── */
.section-anchor {
  scroll-margin-top: 80px;
  height: 0;
  pointer-events: none;
}

/* ── Stem Mixer ──────────────────────────────────────────────────────────── */
.stem-mixer-panel {
  overflow: hidden;
}

.stem-mixer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stem-board {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 6px;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin-top: 8px;
}

.stem-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
  padding: 12px 4px 10px;
  border-right: 1px solid var(--line);
  flex-shrink: 0;
  transition: background 120ms ease;
}

.stem-strip:hover {
  background: rgba(255, 255, 255, 0.03);
}

.stem-strip:last-child {
  border-right: none;
}

.stem-icon-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(244, 196, 122, 0.1);
  border: 1px solid rgba(244, 196, 122, 0.2);
  border-radius: 5px;
  padding: 3px 5px;
  margin-bottom: 10px;
  font-family: "IBM Plex Mono", "Cascadia Code", monospace;
}

.stem-fader-track {
  position: relative;
  height: 130px;
  width: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.stem-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, var(--accent-2), var(--accent), rgba(244, 196, 122, 0.25));
  pointer-events: none;
  transition: height 55ms ease;
  opacity: 0.42;
  border-radius: 12px;
}

/* Vertical range slider — uses writing-mode trick (most reliable cross-browser) */
.stem-fader {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 22px;
  height: 116px;
  cursor: grab;
  position: relative;
  z-index: 1;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
}

.stem-fader::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 12px;
  background: var(--accent);
  border-radius: 4px;
  cursor: grab;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.stem-fader::-webkit-slider-runnable-track {
  width: 4px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 999px;
}

.stem-fader:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

.stem-foot {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
}

.stem-level {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-family: "IBM Plex Mono", "Cascadia Code", monospace;
  font-variant-numeric: tabular-nums;
}

.stem-level[data-level="loud"]   { color: var(--danger); }
.stem-level[data-level="high"]   { color: var(--accent); }
.stem-level[data-level="mid"]    { color: var(--muted); }
.stem-level[data-level="low"]    { color: #7ba8b4; }
.stem-level[data-level="silent"],
.stem-level[data-level="muted"]  { color: var(--danger); opacity: 0.65; }

.stem-label {
  font-size: 0.66rem;
  color: var(--text);
  text-align: center;
  font-weight: 600;
  line-height: 1.2;
  padding: 0 2px;
}

.stem-mute-btn {
  margin-top: 3px;
  width: 22px;
  height: 17px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 100ms ease;
  font-family: inherit;
}

.stem-mute-btn:hover {
  background: rgba(255, 156, 143, 0.1);
  border-color: rgba(255, 156, 143, 0.3);
  color: var(--danger);
  transform: none;
}

.stem-mute-btn.muted {
  background: rgba(255, 156, 143, 0.2);
  border-color: rgba(255, 156, 143, 0.45);
  color: var(--danger);
}

.stem-mixer-preview {
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  margin-top: 4px;
}

.stem-preview-label {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.stem-preview-tags {
  color: var(--muted);
  font-style: italic;
  font-size: 0.82rem;
}

/* ── Scrollable chip rows (artist / vocal preset rows) ──────────────────── */
.scroll-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-height: 110px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 2px 8px;
}

.scroll-chip-row::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.03);
  border-radius: 999px;
}
.scroll-chip-row::-webkit-scrollbar-thumb {
  background: rgba(255, 196, 122, 0.25);
  border-radius: 999px;
}

/* ── Collapsible identity cards ─────────────────────────────────────────── */
.collapse-block {
  /* remove default details marker globally */
}

.collapse-block > summary {
  list-style: none;
}
.collapse-block > summary::-webkit-details-marker {
  display: none;
}

.collapse-header {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding-bottom: 2px;
}

.collapse-header h3 {
  margin: 0;
  flex: 1 1 auto;
}

.collapse-header .helper-text {
  flex: 1 1 auto;
  font-size: 0.82rem;
}

.collapse-caret {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms ease;
  position: relative;
}

.collapse-caret::after {
  content: "";
  display: block;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg) translate(-1px, -1px);
  margin-top: 1px;
}

details[open] .collapse-caret {
  transform: rotate(180deg);
}

.collapse-body {
  padding-top: 10px;
}

/* ── Professional studio refinements ──────────────────────────────────────── */

/* Bigger, more prominent generate button */
#queue-button {
  padding: 12px 32px;
  font-size: 0.93rem;
  letter-spacing: 0.04em;
  box-shadow: 0 3px 20px rgba(244, 196, 122, 0.28);
}

#queue-button:hover {
  box-shadow: 0 4px 26px rgba(244, 196, 122, 0.42);
  transform: translateY(-1px);
}

/* Primary button hover lift */
.button-primary:hover {
  box-shadow: 0 4px 22px rgba(244, 196, 122, 0.38);
  transform: translateY(-1px);
}

/* Ghost button hover */
.button-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

/* Helper card gets a subtle border */
.helper-card {
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
}

/* h3 size/weight refinement */
h3 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Status pill label & value */
.status-pill span {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 2px;
}

.status-pill strong {
  font-size: 0.9rem;
  color: var(--text);
}

/* Sticky actions — cleaner fade */
.sticky-actions {
  padding-top: 8px;
  background: linear-gradient(180deg, transparent, rgba(13, 18, 24, 0.96) 35%);
}

/* Audio card less tall */
.audio-card.large {
  min-height: 100px;
}

/* Cover empty state — remove heavy gradient */
.cover-empty {
  background: rgba(255, 255, 255, 0.03);
}

/* Dense grid gap tighter */
.dense { gap: 10px; }

/* Eyebrow in panel headers — tighter bottom margin */
.panel-header .eyebrow {
  margin-bottom: 4px;
}

/* Extension launchpad — reset amber override */
.extension-launchpad {
  border-color: rgba(131, 212, 203, 0.14);
}

/* Collapse caret border */
.collapse-caret {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Mode chip font size */
.mode-chip {
  font-size: 0.88rem;
  font-weight: 500;
}

/* ── Chatbot ──────────────────────────────────────────────────────────────── */

/* Toggle button in topbar */
.chat-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 100ms ease;
  align-self: end;
  line-height: 1;
}

.chat-toggle-btn:hover,
.chat-toggle-btn.active {
  background: rgba(244, 196, 122, 0.1);
  border-color: rgba(244, 196, 122, 0.32);
  color: var(--accent);
}

/* Chat window */
.chat-window {
  position: fixed;
  right: 24px;
  top: 82px;
  width: 390px;
  height: 530px;
  min-width: 320px;
  min-height: 400px;
  background: rgba(18, 18, 28, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  display: flex;
  flex-direction: column;
  z-index: 9000;
  backdrop-filter: blur(36px) saturate(180%);
  -webkit-backdrop-filter: blur(36px) saturate(180%);
  overflow: hidden;
}

.chat-window.chat-expanded {
  right:         0 !important;
  top:           0 !important;
  left:          0 !important;
  bottom:        0 !important;
  width:         100vw !important;
  height:        100vh !important;
  border-radius: 0 !important;
}

/* Titlebar — drag handle */
.chat-titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  cursor: move;
  flex-shrink: 0;
  user-select: none;
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.chat-speech-status {
  margin-left: 8px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.chat-speech-status-ok {
  color: #9fe3a5;
  border-color: rgba(159, 227, 165, 0.35);
  background: rgba(159, 227, 165, 0.12);
}

.chat-speech-status-fail {
  color: #ffb0b0;
  border-color: rgba(255, 176, 176, 0.35);
  background: rgba(255, 176, 176, 0.12);
}

.chat-speech-status-unknown {
  color: rgba(212, 208, 201, 0.75);
  border-color: rgba(212, 208, 201, 0.25);
  background: rgba(212, 208, 201, 0.08);
}

.chat-title-icon { font-size: 1.05rem; }

.chat-titlebar-btns {
  display: flex;
  gap: 3px;
}

.chat-icon-btn {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 80ms ease;
  padding: 0;
  font-family: inherit;
}

.chat-icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

/* Settings panel */
.chat-settings {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 14px;
  flex-shrink: 0;
  background: rgba(244, 196, 122, 0.04);
}

.chat-settings-inner {
  display: grid;
  gap: 8px;
}

.chat-settings-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.chat-key-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.chat-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.chat-inline-check input {
  accent-color: var(--accent);
}

.chat-api-key-input {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.86rem;
  width: 100%;
}

.chat-api-key-input:focus {
  outline: none;
  border-color: rgba(244, 196, 122, 0.4);
}

.chat-save-key-btn {
  padding: 8px 14px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a0e02;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 100ms ease;
}

.chat-save-key-btn:hover {
  box-shadow: 0 2px 12px rgba(244, 196, 122, 0.3);
}

.chat-settings-hint {
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.45;
}

/* Messages area */
.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { display: none; }

/* Bubbles */
.chat-bubble {
  max-width: 90%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.55;
  word-break: break-word;
}

.chat-bubble code {
  font-family: "IBM Plex Mono", "Cascadia Code", monospace;
  font-size: 0.82em;
  background: rgba(255, 255, 255, 0.09);
  padding: 1px 5px;
  border-radius: 4px;
}

.chat-bubble pre {
  margin: 8px 0 0;
  background: rgba(0, 0, 0, 0.38);
  border-radius: 8px;
  padding: 8px 10px;
  max-height: 200px;
  overflow: auto;
  font-size: 0.8em;
  white-space: pre-wrap;
}

.chat-bubble-user {
  align-self: flex-end;
  background: rgba(244, 196, 122, 0.12);
  border: 1px solid rgba(244, 196, 122, 0.2);
  color: var(--text);
  border-bottom-right-radius: 4px;
}

.chat-bubble-assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

/* Thinking animation */
.chat-thinking {
  padding: 10px 14px;
  background: rgba(255,255,255,0.04) !important;
}

.chat-thinking-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-thinking-label {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(196, 191, 184, 0.55);
  font-style: italic;
  animation: chat-label-fade 2s ease-in-out infinite;
}

@keyframes chat-label-fade {
  0%, 100% { opacity: 0.45; }
  50%       { opacity: 0.90; }
}

.chat-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}

.chat-dots span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.25;
  animation: chat-dot-wave 1.4s ease-in-out infinite;
}

.chat-dots span:nth-child(2) { animation-delay: 0.18s; }
.chat-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes chat-dot-wave {
  0%, 60%, 100% {
    transform: translateY(0) scale(0.75);
    opacity: 0.25;
    background: var(--accent);
  }
  30% {
    transform: translateY(-5px) scale(1.15);
    opacity: 1;
    background: var(--mint);
    box-shadow: 0 0 8px rgba(131, 212, 203, 0.7);
  }
}

/* shimmer bar below the dots */
.chat-thinking-bar {
  width: 100%;
  height: 2px;
  border-radius: 2px;
  margin-top: 8px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(244, 196, 122, 0.55) 40%,
    rgba(131, 212, 203, 0.55) 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: chat-shimmer 1.8s ease-in-out infinite;
}

@keyframes chat-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Footer / input */
.chat-footer {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.03);
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1 1 auto;
  width: 0 !important;       /* override global textarea { width:100% } */
  min-height: unset !important; /* override global textarea { min-height:120px } */
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  font-size: 0.87rem;
  resize: none;
  height: 38px;
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.45;
}

.chat-input:focus {
  outline: none;
  border-color: rgba(244, 196, 122, 0.4);
  box-shadow: 0 0 0 2px rgba(244, 196, 122, 0.07);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a0e02;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 100ms ease;
  padding: 0;
}

.chat-send-btn:hover {
  box-shadow: 0 2px 14px rgba(244, 196, 122, 0.34);
  transform: translateY(-1px);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  transform: none;
  cursor: not-allowed;
}

.chat-aux-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.chat-aux-btn:hover {
  box-shadow: none;
  transform: none;
  border-color: rgba(244, 196, 122, 0.4);
}

.chat-aux-btn.active {
  background: rgba(244, 196, 122, 0.15);
  border-color: rgba(244, 196, 122, 0.45);
  color: var(--accent);
}

/* Resize handle (bottom-right corner) */
.chat-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 1;
}

.chat-resize-handle::after {
  content: '';
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 9px;
  height: 9px;
  border-right: 2px solid rgba(255, 255, 255, 0.22);
  border-bottom: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 1px;
}

.chat-toggle-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 5px;
  flex-shrink: 0;
}

.chat-title-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr; }
  .chat-toggle-btn { justify-self: start; }
  .chat-window { right: 8px; left: 8px; width: auto !important; }
}

/* ── Chat alt panels (sessions / memory / logs) ─────────────────────────── */
.chat-icon-btn.active {
  background: rgba(244, 196, 122, 0.18);
  color: #f4c47a;
}

/* ── Auto-flow plan & result cards ─────────────────────────────────────── */
.af-plan-card,
.af-result-card {
  border: 1px solid rgba(244, 196, 122, 0.30);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.af-plan-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
}
.af-plan-tags {
  font-size: 0.75rem;
  color: var(--mint);
  line-height: 1.5;
  word-break: break-word;
}
.af-plan-lyrics {
  font-size: 0.74rem;
  color: rgba(244, 238, 230, 0.65);
  white-space: pre-wrap;
  margin: 0;
  background: rgba(0,0,0,0.15);
  border-radius: 7px;
  padding: 7px 10px;
  max-height: 110px;
  overflow: hidden;
}
.af-plan-meta {
  font-size: 0.71rem;
  color: rgba(196, 191, 184, 0.55);
}
.af-action-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.af-btn {
  border: none;
  border-radius: 8px;
  padding: 6px 13px;
  font-size: 0.80rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 120ms, filter 120ms;
}
.af-btn:hover { opacity: 0.88; filter: brightness(1.08); }
.af-btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1008;
}
.af-btn-ghost {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.14);
}
.af-audio {
  width: 100%;
  accent-color: var(--accent);
  filter: hue-rotate(195deg) saturate(1.4) brightness(1.05);
}
.af-progress {
  font-size: 0.83rem;
  color: var(--mint);
  font-style: italic;
}

.chat-alt-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.chat-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: rgba(244, 196, 122, 0.80);
  flex-shrink: 0;
}

.chat-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
}

.chat-panel-body::-webkit-scrollbar { display: none; }

.chat-panel-hint {
  font-size: 0.78rem;
  color: rgba(196, 191, 184, 0.65);
  margin: 0 0 10px;
  line-height: 1.5;
}

.chat-help-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.chat-help-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 196, 122, 0.82);
}

.chat-help-example {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.45;
  cursor: pointer;
  transition: background 100ms, border-color 100ms, transform 100ms;
}

.chat-help-example:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(244, 196, 122, 0.32);
  transform: translateY(-1px);
}

/* Sessions */
.chat-session-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  margin-bottom: 6px;
  transition: background 100ms, border-color 100ms;
}
.chat-session-item:hover,
.chat-session-item.active {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(244, 196, 122, 0.30);
}
.chat-session-title {
  font-size: 0.83rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-session-meta {
  font-size: 0.71rem;
  color: rgba(196, 191, 184, 0.60);
  margin-top: 2px;
}
.chat-session-del {
  background: none;
  border: none;
  color: rgba(255, 100, 100, 0.55);
  cursor: pointer;
  padding: 2px 5px;
  font-size: 0.88rem;
  flex-shrink: 0;
  border-radius: 5px;
  transition: color 100ms;
}
.chat-session-del:hover { color: rgba(255, 80, 80, 0.90); }

/* Memory */
.chat-memory-facts {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.chat-memory-fact {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  font-size: 0.81rem;
  line-height: 1.4;
}
.chat-memory-fact-del {
  background: none;
  border: none;
  color: rgba(255, 100, 100, 0.55);
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.88rem;
  flex-shrink: 0;
  border-radius: 4px;
  transition: color 100ms;
  line-height: 1;
}
.chat-memory-fact-del:hover { color: rgba(255, 80, 80, 0.90); }

/* Memory notes textarea */
.chat-memory-notes {
  width: 100%;
  min-height: 120px;
  max-height: 220px;
  resize: vertical;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.55;
  margin-top: 8px;
  overflow-y: auto;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;     /* IE/Edge */
}
.chat-memory-notes::-webkit-scrollbar { display: none; }   /* Chrome/Safari */
.chat-memory-notes:focus {
  outline: none;
  border-color: rgba(244, 196, 122, 0.40);
  box-shadow: 0 0 0 2px rgba(244, 196, 122, 0.07);
}

/* Logs */
.chat-logs-pre {
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  font-size: 0.70rem;
  color: rgba(180, 220, 180, 0.88);
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  line-height: 1.55;
}

.decision-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 16px);
  background: rgba(12, 16, 22, 0.95);
  color: #f1eadf;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 2200;
  max-width: min(92vw, 920px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.decision-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.decision-toast.success {
  border-color: rgba(122, 205, 144, 0.48);
}

/* ── Carbon Halo Studio reskin: Music Generator ─────────────────────────── */
:root {
  --bg: #090b10;
  --bg-2: #10141b;
  --panel: rgba(18, 22, 30, 0.82);
  --panel-soft: rgba(255, 255, 255, 0.035);
  --line: rgba(230, 232, 236, 0.10);
  --line-strong: rgba(126, 231, 219, 0.34);
  --text: #f4f0e8;
  --muted: #a9b0b7;
  --accent: #e8c172;
  --accent-2: #d97245;
  --mint: #7ee7db;
  --danger: #ff8f7d;
  --halo-blue: #86a8ff;
  --shadow: 0 18px 70px rgba(0, 0, 0, 0.42);
  --glass-border: rgba(255, 255, 255, 0.12);
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 22%),
    radial-gradient(circle at 8% 0%, rgba(126, 231, 219, 0.16), transparent 26%),
    radial-gradient(circle at 90% 6%, rgba(232, 193, 114, 0.13), transparent 24%),
    linear-gradient(135deg, #08090d 0%, #11151c 48%, #090d12 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 78%);
  opacity: 0.55;
}

.shell {
  width: min(1680px, calc(100vw - 28px));
  padding-top: 12px;
}

.topbar {
  grid-template-columns: minmax(280px, 1fr) minmax(320px, auto) minmax(330px, 0.78fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: rgba(10, 12, 17, 0.78);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  box-shadow: var(--shadow);
}

.topbar::after {
  display: none;
}

.brand-logo {
  width: 54px;
  height: 54px;
  border-radius: 8px;
}

.brand-block h1 {
  max-width: none;
  font-family: "Space Grotesk", "Segoe UI Variable", sans-serif;
  font-size: clamp(1.25rem, 1.8vw, 1.9rem);
  letter-spacing: -0.01em;
}

.eyebrow {
  color: var(--mint);
  letter-spacing: 0.15em;
  margin-bottom: 6px;
}

.status-pills {
  justify-content: center;
}

.status-pill,
.service-toolbar,
.panel,
.album-card,
.timeline-card,
.prompt-card,
.audio-card,
.log-card,
.history-card,
.engine-card,
.identity-card,
.recipe-card,
.take-card,
.coach-card,
.candidate-card,
.reference-section,
.launch-card {
  border-radius: 8px;
  box-shadow: none;
}

.status-pill,
.service-toolbar {
  background: rgba(255, 255, 255, 0.045);
}

.status-pill {
  min-width: 112px;
  padding: 8px 12px;
}

.status-pill strong,
#service-status-summary {
  font-size: 0.92rem;
}

.chat-toggle-btn {
  border-radius: 8px;
}

.studio-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(126, 231, 219, 0.16);
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(126, 231, 219, 0.08), transparent 44%),
    rgba(11, 14, 20, 0.72);
}

.studio-command h2 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI Variable", sans-serif;
  font-size: clamp(1.2rem, 2.3vw, 2rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 8px;
}

.workflow-steps span {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.82rem;
  font-weight: 700;
}

.workflow-steps span:first-child {
  color: #11151c;
  background: var(--accent);
  border-color: transparent;
}

.studio-grid {
  grid-template-columns: minmax(300px, 0.82fr) minmax(540px, 1.26fr) minmax(360px, 0.92fr);
  gap: 12px;
}

.panel {
  background: rgba(14, 17, 24, 0.76);
  border-color: rgba(255, 255, 255, 0.10);
  padding: 12px;
}

.showcase,
.composer,
.output {
  gap: 12px;
}

.album-card {
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  background:
    linear-gradient(135deg, rgba(232, 193, 114, 0.12), transparent 42%),
    rgba(255, 255, 255, 0.045);
}

.album-art {
  height: 92px;
  border-radius: 8px;
}

.album-ring {
  width: 68px;
  height: 68px;
}

.album-core {
  width: 30px;
  height: 30px;
}

.showcase h2,
.composer h2,
.output h2,
h3 {
  font-family: "Space Grotesk", "Segoe UI Variable", sans-serif;
  letter-spacing: -0.01em;
}

.showcase h2 {
  font-size: 1.35rem;
  line-height: 1.1;
}

.subcopy,
.helper-text,
.recipe-card p,
.take-meta,
.take-tags,
.empty-state {
  line-height: 1.45;
}

.mode-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.mode-chip {
  width: 100%;
  border-radius: 6px;
  padding: 9px 8px;
  text-align: center;
}

.mode-chip.active {
  color: #10141b;
  background: var(--mint);
  border-color: transparent;
  font-weight: 800;
}

.timeline-card,
.prompt-card,
.engine-card,
.identity-card,
.audio-card,
.history-card,
.log-card {
  background: rgba(255, 255, 255, 0.038);
  border-color: rgba(255, 255, 255, 0.10);
}

.reference-library,
.recipe-grid,
.recent-takes,
.learning-memory {
  max-height: 360px;
}

.reference-section,
.recipe-card,
.coach-card,
.launch-card,
.lock-panel,
.learning-card,
.feedback-panel {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.09);
}

.recipe-grid {
  grid-template-columns: 1fr;
}

.extension-launchpad {
  border-color: rgba(255, 255, 255, 0.10);
}

.extension-launchpad .collapse-header {
  padding: 0;
}

.launchpad-grid {
  display: grid;
  gap: 8px;
  padding-top: 12px;
}

.launch-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 10px;
}

.launch-card h4 {
  font-size: 0.96rem;
  margin: 0;
}

.launch-card .eyebrow {
  margin-bottom: 4px;
}

.composer {
  position: sticky;
  top: 10px;
  max-height: calc(100vh - 20px);
  overflow: auto;
}

.composer-nav {
  top: 0;
  border-radius: 8px;
  gap: 4px;
  padding: 5px;
  background: rgba(7, 9, 13, 0.88);
}

.composer-chip {
  border-radius: 6px;
  padding: 7px 10px;
}

.composer-chip.active {
  color: #10141b;
  background: var(--accent);
  border-color: transparent;
}

.field span {
  color: #c8cdd3;
  font-size: 0.82rem;
  font-weight: 700;
}

input,
textarea,
select {
  border-radius: 6px;
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(5, 7, 10, 0.52);
}

textarea {
  min-height: 104px;
}

#lyrics {
  min-height: 260px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(126, 231, 219, 0.58);
  box-shadow: 0 0 0 2px rgba(126, 231, 219, 0.10);
}

.button,
.badge,
.mode-chip,
.duration-chip,
.preset-chip,
.token-chip {
  border-radius: 6px;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), #f1d99a);
  color: #11151c;
  box-shadow: none;
}

.button-secondary {
  background: rgba(126, 231, 219, 0.10);
  color: var(--mint);
  border-color: rgba(126, 231, 219, 0.24);
}

.button-ghost {
  color: #c1c6cc;
}

.sticky-actions {
  margin: 4px -12px -12px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: rgba(8, 10, 14, 0.94);
}

.output {
  position: sticky;
  top: 10px;
  max-height: calc(100vh - 20px);
  overflow: auto;
}

.audio-card.large {
  min-height: 0;
  border-color: rgba(126, 231, 219, 0.18);
}

#audio-player {
  filter: none;
  accent-color: var(--mint);
}

.cover-grid {
  grid-template-columns: 140px minmax(0, 1fr);
}

.cover-empty,
.cover-preview {
  border-radius: 8px;
}

pre {
  max-height: 260px;
  color: #d9e1e6;
}

.chat-window {
  border-radius: 10px;
  border-color: rgba(126, 231, 219, 0.22);
}

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

  .chat-toggle-btn {
    justify-self: start;
  }

  .studio-grid {
    grid-template-columns: minmax(320px, 0.86fr) minmax(520px, 1.14fr);
  }

  .output {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
  }
}

@media (max-width: 980px) {
  .topbar,
  .studio-command,
  .studio-grid,
  .album-card,
  .cover-grid,
  .launch-card {
    grid-template-columns: 1fr;
  }

  .composer {
    position: static;
    max-height: none;
  }

  .workflow-steps,
  .mode-bar {
    grid-template-columns: 1fr;
  }
}

/* ── Writer-aligned Carbon Halo themes ──────────────────────────────────── */
:root,
body[data-theme="carbon-core"] {
  --bg:
    radial-gradient(circle at 10% 0%, rgba(64, 209, 255, 0.18), transparent 26%),
    radial-gradient(circle at 86% 15%, rgba(120, 92, 255, 0.16), transparent 24%),
    radial-gradient(circle at 48% 100%, rgba(36, 232, 177, 0.12), transparent 30%),
    linear-gradient(180deg, #040b15 0%, #081321 48%, #030810 100%);
  --panel: linear-gradient(180deg, rgba(10, 20, 38, 0.9), rgba(7, 14, 27, 0.96));
  --panel-strong: linear-gradient(180deg, rgba(14, 29, 51, 0.96), rgba(9, 18, 33, 0.98));
  --panel-soft: rgba(8, 17, 31, 0.76);
  --border: rgba(94, 170, 255, 0.16);
  --border-strong: rgba(64, 209, 255, 0.32);
  --text: #edf5ff;
  --muted: #96adcd;
  --faint: #617998;
  --accent: #40d1ff;
  --accent-2: #785cff;
  --accent-3: #24e8b1;
  --warning: #ffbe62;
  --danger: #ff6f8a;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.46);
  --glow: 0 0 0 1px rgba(64, 209, 255, 0.12), 0 0 34px rgba(64, 209, 255, 0.14);
  --glass-border: var(--border);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --mint: var(--accent-3);
  --halo-blue: var(--accent-2);
}

body[data-theme="aurora"] {
  --bg:
    radial-gradient(circle at 12% 8%, rgba(82, 255, 214, 0.18), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(118, 132, 255, 0.18), transparent 24%),
    linear-gradient(180deg, #03121a 0%, #071d27 48%, #021116 100%);
  --panel: linear-gradient(180deg, rgba(8, 29, 34, 0.92), rgba(5, 16, 24, 0.96));
  --panel-strong: linear-gradient(180deg, rgba(10, 40, 45, 0.95), rgba(7, 18, 27, 0.98));
  --panel-soft: rgba(6, 22, 30, 0.78);
  --border: rgba(82, 255, 214, 0.16);
  --border-strong: rgba(82, 255, 214, 0.34);
  --text: #edfffb;
  --muted: #8bc6c8;
  --faint: #5f8d92;
  --accent: #52ffd6;
  --accent-2: #6f7bff;
  --accent-3: #44eab2;
  --warning: #ffce73;
  --danger: #ff7f9b;
  --glass-border: var(--border);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --mint: var(--accent);
}

body[data-theme="ember"] {
  --bg:
    radial-gradient(circle at 8% 10%, rgba(255, 169, 92, 0.18), transparent 26%),
    radial-gradient(circle at 86% 18%, rgba(255, 92, 124, 0.14), transparent 24%),
    linear-gradient(180deg, #14070a 0%, #1f0d11 52%, #10060a 100%);
  --panel: linear-gradient(180deg, rgba(38, 14, 19, 0.92), rgba(24, 9, 13, 0.97));
  --panel-strong: linear-gradient(180deg, rgba(49, 16, 22, 0.96), rgba(29, 10, 15, 0.99));
  --panel-soft: rgba(30, 10, 15, 0.78);
  --border: rgba(255, 169, 92, 0.14);
  --border-strong: rgba(255, 129, 77, 0.3);
  --text: #fff1eb;
  --muted: #d8a79d;
  --faint: #a67873;
  --accent: #ff9c5d;
  --accent-2: #ff6f8a;
  --accent-3: #ffd36d;
  --warning: #ffd36d;
  --danger: #ff7c7c;
  --glass-border: var(--border);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --mint: var(--accent-3);
}

body[data-theme="midnight-core"] {
  --bg:
    radial-gradient(circle at 14% 6%, rgba(63, 130, 255, 0.16), transparent 28%),
    radial-gradient(circle at 86% 15%, rgba(141, 99, 255, 0.14), transparent 22%),
    linear-gradient(180deg, #01050d 0%, #050a14 50%, #02050b 100%);
  --panel: linear-gradient(180deg, rgba(6, 11, 22, 0.94), rgba(3, 8, 17, 0.98));
  --panel-strong: linear-gradient(180deg, rgba(10, 16, 30, 0.96), rgba(5, 10, 18, 0.99));
  --panel-soft: rgba(5, 9, 18, 0.82);
  --border: rgba(90, 135, 255, 0.14);
  --border-strong: rgba(90, 135, 255, 0.28);
  --text: #eef3ff;
  --muted: #8c9fc3;
  --faint: #627499;
  --accent: #69b4ff;
  --accent-2: #7f66ff;
  --accent-3: #2bd7b8;
  --glass-border: var(--border);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --mint: var(--accent-3);
}

body[data-theme="starlight"] {
  --bg:
    radial-gradient(circle at 12% 0%, rgba(104, 149, 255, 0.16), transparent 28%),
    radial-gradient(circle at 86% 16%, rgba(255, 190, 111, 0.12), transparent 24%),
    linear-gradient(180deg, #edf4fc 0%, #e5edf7 48%, #dbe6f2 100%);
  --panel: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 248, 253, 0.97));
  --panel-strong: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 246, 252, 0.98));
  --panel-soft: rgba(255, 255, 255, 0.88);
  --border: rgba(92, 126, 189, 0.14);
  --border-strong: rgba(73, 122, 224, 0.26);
  --text: #18253b;
  --muted: #60718d;
  --faint: #8292aa;
  --accent: #2f6cff;
  --accent-2: #5b6eff;
  --accent-3: #0fb785;
  --warning: #b97700;
  --danger: #c84b65;
  --shadow: 0 22px 58px rgba(52, 77, 118, 0.14);
  --glow: 0 0 0 1px rgba(47, 108, 255, 0.08), 0 0 24px rgba(47, 108, 255, 0.08);
  --glass-border: var(--border);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --mint: var(--accent-3);
}

body[data-theme="sandstorm"] {
  --bg:
    radial-gradient(circle at 10% 2%, rgba(255, 219, 164, 0.18), transparent 28%),
    radial-gradient(circle at 86% 16%, rgba(223, 170, 101, 0.12), transparent 24%),
    linear-gradient(180deg, #f6efe2 0%, #efe3cf 52%, #e6d7c1 100%);
  --panel: linear-gradient(180deg, rgba(255, 251, 245, 0.95), rgba(248, 241, 231, 0.98));
  --panel-strong: linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(243, 234, 220, 0.98));
  --panel-soft: rgba(255, 248, 239, 0.9);
  --border: rgba(168, 129, 75, 0.14);
  --border-strong: rgba(185, 134, 67, 0.26);
  --text: #3a2b1d;
  --muted: #7a6248;
  --faint: #a08b72;
  --accent: #c6853e;
  --accent-2: #9f6a33;
  --accent-3: #8b9f5a;
  --warning: #a76c0a;
  --danger: #ba5b4b;
  --shadow: 0 22px 58px rgba(118, 88, 47, 0.14);
  --glow: 0 0 0 1px rgba(198, 133, 62, 0.08), 0 0 24px rgba(198, 133, 62, 0.08);
  --glass-border: var(--border);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --mint: var(--accent-3);
}

html[data-theme="carbon-core"] body { color-scheme: dark; }
html[data-theme="aurora"] body { color-scheme: dark; }
html[data-theme="ember"] body { color-scheme: dark; }
html[data-theme="midnight-core"] body { color-scheme: dark; }
html[data-theme="starlight"] body { color-scheme: light; }
html[data-theme="sandstorm"] body { color-scheme: light; }

body {
  font-family: "Inter", "Segoe UI", sans-serif;
  background: var(--bg);
}

body::before {
  background-image:
    linear-gradient(rgba(94, 170, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 170, 255, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 88%);
  opacity: 0.28;
}

.topbar,
.studio-command,
.panel {
  border-radius: 28px;
  border-color: var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar {
  padding: 18px 22px;
  grid-template-columns: minmax(280px, 1fr) auto minmax(330px, 0.78fr) auto;
}

.dashboard-theme-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.dashboard-theme-copy {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.dashboard-theme-copy .eyebrow {
  margin: 0;
}

.dashboard-theme-copy strong {
  font-size: 0.78rem;
  color: var(--text);
}

.dashboard-theme-deck {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dashboard-theme-button {
  width: 34px;
  height: 34px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel-soft);
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.dashboard-theme-button span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px;
}

.dashboard-theme-button:hover,
.dashboard-theme-button.active {
  border-color: var(--border-strong);
  box-shadow: var(--glow);
  transform: translateY(-1px);
}

.brand-logo,
.chat-toggle-logo,
.chat-title-logo {
  display: none !important;
}

.brand-mark,
.mini-brand-mark {
  flex: none;
  position: relative;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.95), rgba(64, 209, 255, 0.82) 24%, rgba(40, 72, 128, 0.24) 56%, transparent 76%),
    linear-gradient(135deg, rgba(255, 166, 102, 0.78), rgba(64, 209, 255, 0.74) 42%, rgba(120, 92, 255, 0.78));
  box-shadow: 0 0 24px rgba(64, 209, 255, 0.24);
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
}

.mini-brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 10px;
}

.brand-mark::before,
.mini-brand-mark::before {
  content: "";
  position: absolute;
  border: 2px solid rgba(244, 251, 255, 0.88);
  transform: rotate(45deg);
}

.brand-mark::before {
  inset: 12px;
  border-radius: 12px;
}

.mini-brand-mark::before {
  inset: 7px;
  border-radius: 6px;
}

.brand-block h1 {
  font-size: clamp(1.5rem, 2vw, 2.15rem);
  font-weight: 800;
}

.eyebrow,
.brand-kicker {
  color: var(--accent);
}

.status-pill,
.service-toolbar,
.timeline-card,
.prompt-card,
.engine-card,
.identity-card,
.audio-card,
.history-card,
.log-card,
.album-card {
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  box-shadow: var(--glow);
}

.studio-command {
  background:
    radial-gradient(circle at 96% 50%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 28%),
    var(--panel);
}

.workflow-steps span,
.mode-chip.active,
.composer-chip.active {
  color: var(--bg-2, #081321);
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
}

.theme-section {
  display: grid;
  gap: 12px;
}

.theme-deck {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.theme-card {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  color: var(--text);
  background: var(--panel-soft);
  cursor: pointer;
  display: grid;
  gap: 8px;
  min-height: 112px;
}

.theme-card:hover {
  border-color: var(--border-strong);
}

.theme-card.active {
  border-color: var(--border-strong);
  box-shadow: var(--glow);
}

.theme-card-swatch {
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.theme-card h3,
.theme-card p {
  margin: 0;
}

.theme-card h3 {
  font-size: 0.95rem;
}

.theme-card p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.swatch-carbon-core {
  background: linear-gradient(135deg, #040b15, #40d1ff 52%, #785cff);
}

.swatch-aurora {
  background: linear-gradient(135deg, #03121a, #52ffd6 54%, #6f7bff);
}

.swatch-ember {
  background: linear-gradient(135deg, #14070a, #ff9c5d 52%, #ff6f8a);
}

.swatch-midnight {
  background: linear-gradient(135deg, #01050d, #69b4ff 54%, #7f66ff);
}

.swatch-starlight {
  background: linear-gradient(135deg, #edf4fc, #2f6cff 54%, #0fb785);
}

.swatch-sandstorm {
  background: linear-gradient(135deg, #f6efe2, #c6853e 54%, #8b9f5a);
}

.panel,
.album-card,
.timeline-card,
.prompt-card,
.audio-card,
.log-card,
.history-card {
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

input,
textarea,
select {
  border-radius: 16px;
  border-color: var(--border);
  background: color-mix(in srgb, var(--panel-soft) 82%, black 18%);
  color: var(--text);
}

.button,
.badge,
.mode-chip,
.duration-chip,
.preset-chip,
.token-chip,
.composer-chip {
  border-radius: 16px;
}

.button-primary {
  color: var(--bg-2, #081321);
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
}

.button-secondary {
  color: var(--accent);
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
}

.button-ghost {
  color: var(--muted);
  border-color: var(--border);
}

.cover-empty,
.cover-preview {
  border-radius: 18px;
}

@media (max-width: 980px) {
  .theme-deck {
    grid-template-columns: 1fr;
  }

  .topbar,
  .studio-command,
  .panel {
    border-radius: 18px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
  }

  .brand-block,
  .status-pills,
  .service-toolbar,
  .dashboard-theme-bar,
  .chat-toggle-btn {
    min-width: 0;
    width: 100%;
  }

  .status-pills {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dashboard-theme-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-theme-deck {
    width: 100%;
    justify-content: space-between;
  }

  .status-pill {
    width: 100%;
    min-width: 0;
  }

  .status-pill strong,
  #service-status-summary,
  #service-status-detail {
    overflow-wrap: anywhere;
  }

  .service-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .service-actions .button {
    width: 100%;
  }
}
