:root {
  color-scheme: dark;
  --bg: #080819;
  --bg-deep: #03040d;
  --panel: rgba(13, 18, 46, 0.82);
  --panel-2: rgba(21, 29, 68, 0.74);
  --panel-3: rgba(8, 11, 31, 0.9);
  --line: rgba(100, 135, 255, 0.26);
  --line-strong: rgba(54, 121, 255, 0.58);
  --text: #f7f8ff;
  --muted: #aab4d9;
  --blue: #1d78ff;
  --blue-2: #1738ff;
  --red: #ff2d20;
  --red-2: #a40628;
  --cyan: #25d9ff;
  --amber: #ffcf5a;
  --green: #36e39a;
  --danger: #ff6474;
  --radius: 8px;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  padding: 18px 0 0;
  background:
    radial-gradient(circle at 22% 10%, rgba(29, 120, 255, 0.28), transparent 29rem),
    radial-gradient(circle at 86% 8%, rgba(255, 45, 32, 0.22), transparent 31rem),
    linear-gradient(150deg, #060719 0%, #0a0b23 42%, #17000d 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; }

.topbar {
  position: static;
  z-index: 20;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(430px, calc(100% - 28px));
  min-height: 60px;
  margin: 0 auto;
  padding: 10px;
  border: 1px solid rgba(155, 56, 255, 0.28);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: rgba(7, 5, 28, 0.9);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: max-content;
  color: var(--text);
  text-decoration: none;
}

.brand span:last-child { display: grid; gap: 1px; }
.brand strong { font-size: 12px; }
.brand small { color: var(--muted); font-size: 10px; }

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(37, 217, 255, 0.65);
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(29, 120, 255, 0.92), rgba(255, 45, 32, 0.78));
  box-shadow: 0 0 24px rgba(29, 120, 255, 0.32), inset 0 0 16px rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 12px;
  font-weight: 950;
}

.topbar nav {
  display: flex;
  justify-content: center;
}

.topbar nav a {
  padding: 7px 9px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.topbar nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.status-pill {
  display: none;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 16, 42, 0.76);
  color: #dfe6ff;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.ok { border-color: rgba(54, 227, 154, 0.48); color: #bbffe0; background: rgba(54, 227, 154, 0.1); }
.status-pill.warn { border-color: rgba(255, 207, 90, 0.5); color: #ffe6a2; background: rgba(255, 207, 90, 0.1); }
.status-pill.error { border-color: rgba(255, 100, 116, 0.52); color: #ffc5cc; background: rgba(255, 100, 116, 0.1); }

main {
  width: min(430px, calc(100% - 28px));
  margin: 0 auto;
  padding: 0 0 48px;
}

.eyebrow {
  color: #61e1ff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero {
  display: grid;
  gap: 20px;
  align-items: start;
  margin-bottom: 14px;
  padding: clamp(18px, 5vw, 28px);
  border: 1px solid rgba(155, 56, 255, 0.34);
  border-radius: 0 0 var(--radius) var(--radius);
  background:
    radial-gradient(circle at 80% 46%, rgba(255, 62, 62, 0.55), transparent 10rem),
    radial-gradient(circle at 20% 18%, rgba(29, 120, 255, 0.4), transparent 15rem),
    radial-gradient(circle at 55% 72%, rgba(255, 40, 180, 0.16), transparent 13rem),
    linear-gradient(145deg, rgba(18, 8, 60, 0.94), rgba(7, 5, 28, 0.98));
  box-shadow: var(--shadow);
}

.hero .account-panel {
  margin: 0;
}

.hero .input-pane {
  box-shadow: none;
}

.hero .input-pane .pane-head {
  padding-bottom: 5px;
  border-bottom: 0;
}

.hero .input-pane .pane-step {
  display: none;
}

.hero .field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hero h1 {
  max-width: 390px;
  margin-top: 8px;
  font-size: clamp(34px, 7.5vw, 40px);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 360px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.studio-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(155, 56, 255, 0.36);
  border-radius: var(--radius);
  background: rgba(10, 7, 35, 0.74);
}

.studio-steps span {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  background: linear-gradient(135deg, rgba(29, 120, 255, 0.4), rgba(255, 45, 32, 0.28));
  color: #f8f5ff;
  font-size: 11px;
  font-weight: 900;
}

.studio-steps span:last-child {
  border-right: 0;
}

.studio-steps strong {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--red));
  color: #fff;
  font-size: 11px;
}

.endpoint-chips {
  display: none;
  flex-wrap: wrap;
  gap: 7px;
}

.endpoint-chip {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(14, 21, 52, 0.76);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.endpoint-chip.active {
  border-color: rgba(37, 217, 255, 0.52);
  background: linear-gradient(135deg, rgba(29, 120, 255, 0.44), rgba(164, 6, 40, 0.28));
  color: #fff;
}

.endpoint-chip.disabled { opacity: 0.56; }
.endpoint-chip small { color: var(--amber); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; }

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 78% 10%, rgba(255, 45, 32, 0.12), transparent 17rem),
    linear-gradient(145deg, rgba(21, 14, 65, 0.88), rgba(8, 6, 30, 0.94)),
    var(--panel);
  box-shadow: var(--shadow);
}

.account-panel {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
  padding: 9px;
  border: 1px solid rgba(155, 56, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(7, 6, 28, 0.58);
  box-shadow: none;
}

.topbar .account-panel {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.topbar .account-details {
  grid-column: 1 / -1;
}

.account-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.account-toggle {
  display: grid;
  min-width: 0;
  min-height: 38px;
  justify-items: start;
  gap: 2px;
  padding: 6px 9px;
  border-color: rgba(100, 135, 255, 0.2);
  background: rgba(8, 12, 32, 0.56);
  box-shadow: none;
  text-align: left;
}

.account-toggle #account-heading {
  max-width: 100%;
  overflow: hidden;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-signout {
  min-height: 38px;
  padding: 0 10px;
  border-color: rgba(100, 135, 255, 0.18);
  background: rgba(11, 19, 51, 0.64);
  color: #dfe6ff;
  font-size: 11px;
}

.account-kicker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #61e1ff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.google-mark {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: transparent;
  background-image:
    linear-gradient(#fff, #fff),
    conic-gradient(from -40deg, #4285f4 0 25%, #34a853 0 42%, #fbbc05 0 62%, #ea4335 0 78%, #4285f4 0);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  -webkit-background-clip: padding-box, border-box;
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 0 #4285f4;
}

.account-details {
  display: grid;
  gap: 9px;
  padding: 4px 2px 0;
}

.account-details > p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  justify-items: start;
  justify-content: flex-start;
  align-items: center;
  align-content: center;
  gap: 7px;
}

#account-signed-out {
  display: grid;
  min-width: 0;
  justify-items: start;
}

#google-signin-button {
  max-width: 190px;
  min-height: 34px;
  overflow: hidden;
}

.google-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 170px;
  min-height: 36px;
  font-size: 11px;
}

.signed-in-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 7px;
}

.identity {
  display: none;
  min-width: 0;
  gap: 2px;
  text-align: left;
}

.identity span {
  max-width: 260px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credit-balance {
  padding: 7px 10px;
  border: 1px solid rgba(54, 227, 154, 0.46);
  border-radius: var(--radius);
  background: rgba(54, 227, 154, 0.1);
  color: #caffea;
  font-size: 13px;
  white-space: nowrap;
}

.test-mode-label {
  display: none;
  padding: 6px 8px;
  border: 1px solid rgba(255, 207, 90, 0.34);
  border-radius: var(--radius);
  background: rgba(255, 207, 90, 0.08);
  color: #ffe4a0;
  font-size: 11px;
  font-weight: 850;
}

.account-message {
  min-height: 0;
  flex-basis: 100%;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.playground-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.input-pane,
.output-pane {
  position: relative;
  overflow: hidden;
}

.input-pane {
  border-color: rgba(155, 56, 255, 0.46);
  background:
    radial-gradient(circle at 82% 34%, rgba(255, 64, 70, 0.18), transparent 11rem),
    radial-gradient(circle at 18% 22%, rgba(29, 120, 255, 0.14), transparent 12rem),
    rgba(8, 6, 30, 0.92);
}

.input-pane::before,
.output-pane::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 22% 20%, rgba(37, 217, 255, 0.09), transparent 16rem),
    radial-gradient(circle at 78% 50%, rgba(255, 45, 32, 0.08), transparent 17rem);
}

.pane-head,
.section-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border-bottom: 1px solid var(--line);
}

.pane-head {
  background: transparent;
}

.pane-head h2,
.section-head h2,
.section-head h3 { margin-top: 5px; }

.pane-step,
.section-head > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-align: right;
}

.idea-form {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 12px 14px 14px;
}

label {
  color: #d8e0ff;
  font-size: 11px;
  font-weight: 850;
}

textarea,
input,
select,
button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 13, 37, 0.86);
  color: var(--text);
  font: inherit;
}

textarea,
input,
select { width: 100%; }
textarea { min-height: 120px; padding: 13px; resize: vertical; line-height: 1.5; }
input,
select { min-height: 42px; padding: 0 11px; }

#song-idea {
  height: 140px;
  min-height: 140px;
  max-height: 220px;
  border-color: rgba(155, 56, 255, 0.34);
  background:
    radial-gradient(circle at 88% 25%, rgba(255, 45, 32, 0.14), transparent 12rem),
    linear-gradient(135deg, rgba(50, 36, 120, 0.72), rgba(104, 4, 60, 0.44)),
    rgba(7, 13, 37, 0.92);
  box-shadow: inset 0 0 28px rgba(29, 120, 255, 0.14);
  font-size: 15px;
}

#song-idea::placeholder { color: rgba(233, 237, 255, 0.66); }

.field-label {
  margin-bottom: -7px;
  color: #ffffff;
  font-size: 12px;
}

.vibe-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.vibe-chip {
  min-height: 36px;
  padding: 0 10px;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(29, 120, 255, 0.18);
  box-shadow: none;
  color: #dce6ff;
  font-size: 11px;
}

.vibe-chip.active,
.vibe-chip:hover {
  border-color: rgba(37, 217, 255, 0.62);
  background: linear-gradient(135deg, rgba(29, 120, 255, 0.74), rgba(255, 45, 32, 0.42));
  color: #fff;
}

.optional-inputs {
  overflow: hidden;
  border: 1px solid rgba(100, 135, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(8, 12, 32, 0.52);
}

.optional-inputs summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  color: #dce5ff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.optional-inputs summary span {
  color: var(--cyan);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.optional-input-grid {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

.exact-field {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 0;
  border-top: 1px solid rgba(100, 135, 255, 0.18);
  border-radius: 0;
  background: transparent;
}

.exact-field label span,
.exact-field p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.exact-lyrics textarea { min-height: 210px; }

.idea-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
}

#plan-button {
  min-height: 58px;
  border-color: rgba(255, 207, 90, 0.28);
  background: linear-gradient(135deg, #5c2dff 0%, #185cff 35%, #ff3a31 100%);
  font-size: 15px;
  letter-spacing: 0;
}

button {
  min-height: 44px;
  padding: 0 14px;
  border-color: rgba(37, 217, 255, 0.36);
  background: linear-gradient(135deg, #1485ff 0%, #1738ff 45%, #a40628 100%);
  box-shadow: 0 12px 30px rgba(29, 120, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-weight: 900;
  cursor: pointer;
}

button:disabled { cursor: not-allowed; opacity: 0.52; }
.secondary-button { border-color: rgba(100, 135, 255, 0.28); background: rgba(28, 41, 88, 0.86); box-shadow: none; }
.ghost-button { border-color: transparent; background: transparent; box-shadow: none; color: var(--muted); }

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(37, 217, 255, 0.72);
  outline-offset: 2px;
}

input[readonly],
textarea[readonly] {
  border-color: rgba(100, 135, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
  color: #f0f4ff;
}

.status-panel {
  position: relative;
  display: grid;
  gap: 9px;
  margin: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(3, 5, 18, 0.62);
}

.status-panel h3 { font-size: 18px; line-height: 1.18; }
.status-panel > p:last-child { color: var(--muted); line-height: 1.5; }

.plan-panel {
  position: relative;
  margin: 0 14px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(7, 12, 35, 0.84);
}

.plan-summary {
  padding: 16px;
  color: #e6ebff;
  font-size: 14px;
  line-height: 1.55;
}

.advanced-panel {
  margin: 0 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.advanced-panel summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  color: var(--muted);
  font-weight: 850;
  cursor: pointer;
}

.advanced-panel summary span {
  color: #61e1ff;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fine-tune {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.fine-tune label { display: grid; gap: 7px; }
.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.fixed-controls-note {
  padding: 9px 11px;
  border-radius: var(--radius);
  background: rgba(37, 217, 255, 0.08);
  color: #b9eeff;
  font-size: 11px;
  line-height: 1.4;
}

.weight-settings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.weight-settings label {
  align-content: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 9, 29, 0.72);
}

.weight-settings label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.35;
}

.weight-settings input:disabled {
  opacity: 1;
  color: #edf2ff;
  font-variant-numeric: tabular-nums;
  cursor: not-allowed;
}

.generate-button {
  width: calc(100% - 28px);
  min-height: 54px;
  margin: 0 14px 14px;
  border-color: rgba(255, 207, 90, 0.3);
  background: linear-gradient(135deg, #ff3b1f 0%, #df071f 48%, #1738ff 120%);
  font-size: 15px;
}

.results-panel {
  position: relative;
  margin: 0 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(4, 8, 28, 0.68);
}

.results-head { padding: 14px 15px; }

.music-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  padding: 14px;
}

.empty-state,
.track-card,
.history-item,
.summary-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(7, 12, 35, 0.84);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
}

.empty-state p,
.caption {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.failure-state {
  border-color: rgba(255, 100, 116, 0.45);
  background: rgba(55, 10, 28, 0.72);
}

.failure-state h3 { margin-top: 7px; }

.failure-state .credit-status {
  width: fit-content;
  margin: 12px auto 0;
  padding: 7px 10px;
  border: 1px solid rgba(255, 207, 90, 0.35);
  border-radius: var(--radius);
  background: rgba(255, 207, 90, 0.08);
  color: #ffe0a5;
  font-weight: 800;
}

.failure-state .credit-status.restored {
  border-color: rgba(54, 227, 154, 0.4);
  background: rgba(54, 227, 154, 0.1);
  color: #baffdf;
}

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

.track-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
}

.track-card audio { width: 100%; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.result-actions a {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.history-panel { margin-top: 18px; }
.history-list { display: grid; gap: 10px; padding: 16px; }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-item > div { min-width: 0; }
.history-item h3 { overflow-wrap: anywhere; }

.history-notice {
  padding: 10px 12px;
  border: 1px solid rgba(255, 207, 90, 0.25);
  border-radius: var(--radius);
  background: rgba(255, 207, 90, 0.06);
  color: #ffe0a5;
  font-size: 12px;
}

.mobile-nav {
  display: none;
}

.music-footer {
  width: min(760px, calc(100% - 32px));
  margin: 24px auto 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.music-footer a { color: #b9eeff; }

.legal-page {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(22px, 5vw, 48px);
}

.legal-page h1 { margin: 8px 0 4px; }
.legal-page h2 { margin: 28px 0 8px; font-size: 20px; }
.legal-page p { color: #dbe9ff; line-height: 1.7; }
.legal-page a { color: #b9eeff; }
.legal-page .legal-updated { color: var(--muted); }

@media (max-width: 1020px) {
  .playground-grid { grid-template-columns: 1fr; }
  .weight-settings { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .topbar { position: static; align-items: center; }
  .account-actions,
  #account-signed-out { justify-items: start; }
  .signed-in-actions { justify-content: flex-start; }
  .account-message { text-align: left; }
}

@media (max-width: 620px) {
  body {
    padding-top: 0;
  }

  main {
    width: min(calc(100% - 18px), 430px);
    padding-top: 0;
    padding-bottom: 96px;
  }

  .topbar {
    position: static;
    width: min(calc(100% - 18px), 430px);
    grid-template-columns: auto auto minmax(0, 1fr);
    min-height: 60px;
    margin-top: 9px;
    padding: 10px 12px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .status-pill {
    margin-left: auto;
    padding: 7px 10px;
    font-size: 11px;
  }

  .hero {
    gap: 15px;
    overflow: hidden;
    padding: 16px;
  }

  .hero > * {
    min-width: 0;
  }

  .hero h1 {
    max-width: 100%;
    font-size: clamp(30px, 9vw, 34px);
    line-height: 1.04;
    overflow-wrap: break-word;
  }

  .hero-copy {
    max-width: 100%;
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: break-word;
  }

  .studio-steps span {
    min-width: 0;
    min-height: 42px;
    gap: 5px;
    padding: 0 4px;
    font-size: 11px;
    overflow: hidden;
    text-overflow: clip;
    white-space: nowrap;
  }

  .studio-steps strong {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

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

  .endpoint-chip {
    justify-content: center;
  }

  .account-panel { padding: 9px; }
  .account-actions,
  #account-signed-out,
  .google-fallback,
  .signed-in-actions { width: 100%; }
  .signed-in-actions > button:not(.account-signout) { width: 100%; }

  .hero .account-panel {
    margin-top: -2px;
  }

  .pane-head,
  .section-head,
  .history-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .pane-head h2 {
    max-width: 100%;
    font-size: 19px;
    line-height: 1.12;
    overflow-wrap: break-word;
  }

  .pane-step,
  .section-head > span { text-align: left; }

  #song-idea {
    height: 130px;
    min-height: 130px;
    font-size: 14px;
  }

  .vibe-strip,
  .idea-actions,
  .settings-row,
  .weight-settings {
    grid-template-columns: 1fr 1fr;
  }

  .idea-actions button:first-child {
    grid-column: 1 / -1;
  }

  #plan-button {
    min-height: 54px;
    border-color: rgba(255, 207, 90, 0.44);
    background: linear-gradient(135deg, #2a4fff 0%, #0f8cff 38%, #ff3d24 100%);
    box-shadow: 0 16px 34px rgba(29, 120, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    font-size: 14px;
  }

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

  .idea-actions .secondary-button,
  .idea-actions .ghost-button {
    min-height: 34px;
    padding: 0 10px;
    border-color: rgba(100, 135, 255, 0.18);
    background: rgba(11, 19, 51, 0.72);
    font-size: 11px;
    box-shadow: none;
  }

  .idea-actions .ghost-button {
    background: transparent;
    color: #c7d1f5;
  }

  .status-panel,
  .plan-panel,
  .results-panel {
    margin-left: 10px;
    margin-right: 10px;
  }

  .generate-button {
    width: calc(100% - 20px);
    margin-left: 10px;
    margin-right: 10px;
  }

  .mobile-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px;
    border: 1px solid rgba(100, 135, 255, 0.26);
    border-radius: var(--radius);
    background: rgba(4, 6, 20, 0.9);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.54);
    backdrop-filter: blur(18px);
  }

  .mobile-nav a:last-child {
    display: none;
  }

  .mobile-nav a {
    display: grid;
    min-height: 42px;
    place-items: center;
    border-radius: var(--radius);
    background: rgba(29, 120, 255, 0.12);
    color: #dfe6ff;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
  }

  .mobile-nav a:first-child {
    background: linear-gradient(135deg, rgba(29, 120, 255, 0.76), rgba(255, 45, 32, 0.48));
    color: #fff;
  }

  .music-footer {
    margin-bottom: 96px;
  }
}

@media (max-width: 390px) {
  .vibe-strip,
  .idea-actions,
  .settings-row,
  .weight-settings {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 14px 12px;
  }

  .studio-steps span {
    font-size: 10px;
  }
}

/* music-app.css cache key: font-logo-stable-20260720131156 */
