:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  font-size: 16px;
  --bg: #0d0c27;
  --ink: #f4efff;
  --coral: #ff745f;
  --lavender: #b7a8ea;
  --muted: #b9b2d0;
  --line: rgba(183, 168, 234, .23);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { position: relative; isolation: isolate; margin: 0; min-width: 320px; min-height: 100svh; display: flex; flex-direction: column; }
body::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: 640px;
  pointer-events: none;
  background: linear-gradient(0deg, var(--bg), rgba(13, 12, 39, .55)),
    url("brand/terrain-bg.jpg") center 42% / cover no-repeat;
}
.login-page::before {
  height: 100%;
  background: linear-gradient(0deg, var(--bg), transparent 55%),
    linear-gradient(90deg, rgba(13, 12, 39, .97) 5%, rgba(13, 12, 39, .8) 38%, rgba(13, 12, 39, .12) 85%),
    url("brand/terrain-bg.jpg") center / cover no-repeat;
}
::selection { background: rgba(255, 116, 95, .4); }
button, input, textarea { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
a { color: inherit; text-decoration: none; }
button, a { transition: color .2s ease, background-color .2s ease, border-color .2s ease; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--coral); outline-offset: 4px;
}
button { border: 1px solid var(--line); border-radius: 999px; color: inherit; background: transparent; padding: .65rem 1rem; }
input, textarea { background: rgba(13, 12, 39, .8); color: inherit; border: 1px solid rgba(183, 168, 234, .45); border-radius: 10px; padding: 1rem; width: 100%; }
textarea { resize: vertical; line-height: 1.65; min-height: 12rem; }
textarea::placeholder { color: #aaa1bf; }
label { display: block; font-size: .9375rem; font-weight: 500; margin-bottom: .85rem; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; }
h1, h2 { letter-spacing: -.045em; text-wrap: balance; }
h1 { font-size: clamp(2.75rem, 4.5vw, 4.25rem); line-height: 1.02; margin-bottom: 2rem; }
h1 em { color: var(--coral); font-style: normal; }
h2 { font-size: clamp(2rem, 3vw, 2.75rem); line-height: 1.1; margin: 0; }
h3 { font-size: 1.4rem; letter-spacing: -.02em; line-height: 1.35; overflow-wrap: anywhere; margin-bottom: .55rem; }
.skip-link { position: absolute; z-index: 10; top: -80px; left: 1rem; padding: .8rem 1rem; color: var(--bg); background: var(--ink); border-radius: 6px; }
.skip-link:focus { top: 1rem; }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; width: 100%; max-width: 1440px; margin: 0 auto; padding: 1.6rem 3rem; border-bottom: 1px solid var(--line); }
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem; }
.brand-name { font-size: 1.65rem; letter-spacing: -.045em; font-weight: 600; }
.studio-credit { font-size: .875rem; color: var(--lavender); }
.account { display: flex; align-items: center; gap: .75rem; font-size: .875rem; }
.account-role { display: inline-block; margin-left: .6rem; color: var(--coral); font-size: .75rem; }
.quiet { border-color: transparent; color: var(--muted); }
.quiet:hover { color: var(--coral); background: rgba(255, 116, 95, .06); }
.studio { display: grid; grid-template-columns: minmax(280px, 370px) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 6rem); width: 100%; max-width: 1320px; padding: 3.5rem 3rem 4rem; margin: 0 auto; flex: 1; }
.eyebrow { display: flex; align-items: center; gap: .75rem; font-family: var(--mono); font-size: .75rem; letter-spacing: .17em; color: var(--lavender); margin-bottom: 1.4rem; }
.eyebrow::before { content: ""; width: 27px; height: 1px; background: currentColor; opacity: .65; }
.compose { padding-top: .3rem; }
.prompt-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; font-size: .75rem; color: var(--muted); margin: .7rem 0 1.2rem; }
.generator-choice { display: flex; gap: .75rem; margin: 0 0 1.25rem; padding: 0; border: 0; }
.generator-choice legend { font-size: .875rem; margin-bottom: .65rem; }
.generator-choice label { display: flex; align-items: center; gap: .5rem; flex: 1; padding: .7rem .9rem; margin: 0; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.generator-choice label:has(:checked) { border-color: var(--coral); background: rgba(255, 116, 95, .08); }
.generator-choice input { width: 1rem; height: 1rem; margin: 0; padding: 0; accent-color: var(--coral); }
.primary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--coral); color: var(--bg); border: 1px solid var(--coral); width: 100%; font-weight: 650; padding: .9rem 1.4rem; }
.primary:hover:not(:disabled) { background: #ff927f; border-color: #ff927f; }
.primary [aria-hidden=true] { font-size: 1.3rem; }
.primary:disabled { background: rgba(183, 168, 234, .1); border-color: var(--line); color: var(--ink); opacity: 1; }
.generation-state { margin: .85rem 0 0; color: var(--muted); font-size: .875rem; line-height: 1.6; }
.generation-state:empty { display: none; }
.generation-state.is-active { border-left: 2px solid var(--coral); padding-left: .85rem; color: var(--ink); }
.muted { color: var(--muted); line-height: 1.7; }
.small { font-size: .875rem; }
.wait-note { margin: 2rem 0 .6rem; font-size: .9375rem; display: flex; gap: .6rem; align-items: center; }
.status-dot { height: .375rem; width: .375rem; background: var(--coral); border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 12px rgba(255, 116, 95, .3); }
.library-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 2rem; }
.library-heading .eyebrow { margin-bottom: .9rem; }
.library-count { font-family: var(--mono); font-size: .75rem; color: var(--muted); white-space: nowrap; padding-bottom: .25rem; }
.tabs { display: flex; gap: 1.5rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: .7rem 0 .9rem; color: var(--muted); font-size: .875rem; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-pressed=true] { color: var(--coral); border-bottom-color: var(--coral); }
.song { padding: 1.6rem 0; border-bottom: 1px solid var(--line); }
.song[data-status=running] { margin: 1rem 0; padding: 1.4rem; border: 1px solid rgba(255, 116, 95, .55); border-radius: 14px; background: rgba(183, 168, 234, .07); }
.song-progress { margin-top: 1.2rem; }
.progress-heading { display: flex; align-items: center; gap: .65rem; font-size: .9375rem; font-weight: 600; color: var(--coral); margin-bottom: .75rem; }
.activity-dot { flex-shrink: 0; width: .5rem; height: .5rem; border-radius: 50%; background: var(--coral); }
.song[data-status=running] .activity-dot { animation: pulse 2s ease-in-out infinite; }
.progress-track { height: 4px; border-radius: 99px; background: rgba(183, 168, 234, .2); overflow: hidden; }
.progress-track::after { content: ""; display: block; height: 100%; width: 35%; background: linear-gradient(90deg, var(--lavender), var(--coral)); border-radius: inherit; animation: composing 2.5s ease-in-out infinite alternate; }
@keyframes composing { from { transform: translateX(0); } to { transform: translateX(186%); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(255, 116, 95, .15); } }
.song-top { display: flex; gap: 1rem; align-items: start; }
.song-number { flex-shrink: 0; width: 2.5rem; height: 2.5rem; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--lavender); font-family: var(--mono); font-size: .75rem; }
.song-info { min-width: 0; flex: 1; }
.song-meta { font-size: .8125rem; color: var(--muted); margin: 0; line-height: 1.6; }
.badge { display: inline-block; color: var(--coral); font-size: .75rem; letter-spacing: .06em; margin-left: .5rem; }
.song audio { display: block; width: 100%; margin: 1rem 0 .3rem; height: 42px; }
.song-prompt { font-size: .875rem; line-height: 1.6; white-space: pre-wrap; color: var(--muted); margin: 1rem 0; overflow-wrap: anywhere; }
.song-prompt summary { cursor: pointer; width: fit-content; }
.song-prompt p { margin: .75rem 0 0; }
.song-status-line { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .75rem; }
.song-status-line .badge { margin-left: 0; }
.selection-control { font-size: .8125rem; line-height: 1.5; padding: .25rem .65rem; color: var(--lavender); }
.selection-control:hover, .selection-control.is-selected { color: var(--coral); border-color: rgba(255, 116, 95, .4); }
.song-title-actions { display: inline-flex; align-items: center; gap: .125rem; margin-left: .35rem; vertical-align: middle; }
button.icon-button, a.icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 2.5rem; height: 2.5rem; padding: 0; border: 1px solid transparent; border-radius: 50%; color: var(--muted); vertical-align: middle; }
.icon-button svg { display: block; width: 1.125rem; height: 1.125rem; pointer-events: none; }
.icon-button:hover:not(:disabled) { color: var(--coral); border-color: var(--line); background: rgba(183, 168, 234, .08); }
.song-title-actions .icon-button { width: 2rem; height: 2rem; }
.song-message { font-size: .875rem; line-height: 1.6; color: var(--muted); margin: .9rem 0 0; }
.error { color: #ffb7aa; line-height: 1.5; }
.error:empty, #create-message:empty, #worker-status:empty { display: none; }
#create-message { font-size: .9375rem; line-height: 1.6; margin-top: 1rem; }
.empty { padding: 3rem 2rem; border: 1px solid var(--line); border-radius: 14px; background: rgba(183, 168, 234, .04); text-align: center; color: var(--muted); line-height: 1.7; margin-top: 2rem; }
.login-wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: clamp(3rem, 9vh, 6rem) 3rem; flex: 1; }
.login-panel { max-width: 390px; }
.login-wrap h1 { font-size: clamp(3.5rem, 5.5vw, 5rem); margin-bottom: 1.4rem; }
.login-form { margin-top: 2rem; }
.login-form input { margin-bottom: 1.25rem; }
.login-form .primary { margin-top: .75rem; }
.site-footer { width: calc(100% - 6rem); max-width: 1224px; margin: 0 auto; padding: 1.8rem 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .875rem; border-top: 1px solid var(--line); }
.site-footer p { margin: 0; line-height: 1.7; }
.footer-credit { white-space: nowrap; }
.parent-brand { display: flex; align-items: center; gap: .75rem; }
.parent-brand img { width: 116px; height: 40px; object-fit: contain; }
.parent-brand:hover { color: var(--coral); }

@media (min-width: 1100px) {
  .compose { position: sticky; top: 2rem; align-self: start; }
}
@media (max-width: 1000px) {
  .studio { gap: 2.5rem; padding: 2.5rem 2rem; }
  .masthead { padding: 1.5rem 2rem; }
  .site-footer { width: calc(100% - 4rem); }
}
@media (max-width: 750px) {
  .studio { grid-template-columns: 1fr; padding: 2.5rem 1.25rem; gap: 3rem; }
  .masthead { padding: 1.2rem 1.25rem; align-items: start; }
  .brand { flex-direction: column; gap: .2rem; }
  .brand-name { font-size: 1.5rem; }
  .studio-credit { font-size: .8125rem; }
  .account { gap: .25rem; flex-wrap: wrap; justify-content: end; }
  .account span { max-width: 8rem; overflow-wrap: anywhere; }
  .quiet { padding: .55rem .7rem; }
  .compose h1 br { display: none; }
  .compose h1 em::before { content: " "; }
  h1 { font-size: 3rem; }
  .wait-note { margin-top: 1.4rem; }
  .library-heading { margin-bottom: 1.2rem; }
  .tabs { gap: 1.2rem; }
  .site-footer { width: calc(100% - 2.5rem); padding: 1.5rem 0; flex-wrap: wrap; }
  .login-wrap { padding: 3rem 1.5rem; }
  .login-panel { margin: 0 auto; }
  .login-page::before { background: linear-gradient(rgba(13, 12, 39, .72), var(--bg)), url("brand/terrain-bg.jpg") 70% center / cover no-repeat; }
}
@media (prefers-reduced-motion: reduce) {
  button, a { transition: none; }
  .progress-track::after, .song[data-status=running] .activity-dot { animation: none; }
}
