/* Morningstar Melody — our layer on top of studio.css (studio.css is regenerated by tools/retheme.py). */
:root {
  --mm-pink-1: #ff3d8b;
  --mm-pink-2: #ff9ad0;
  --mm-gradient: linear-gradient(120deg, var(--mm-pink-1), var(--mm-pink-2));
  --mm-black: #070707;
  --mm-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
[hidden] { display: none !important; }

/* Terminal-black canvas with a faint grid */
body { background: var(--mm-black) !important; }
.mm-studio {
  background-color: var(--mm-black);
  background-image: linear-gradient(#ffffff06 1px, transparent 1px), linear-gradient(90deg, #ffffff06 1px, transparent 1px);
  background-size: 28px 28px;
}
.studio-sidebar { background: #0b0b0b; }

/* Brand */
.mm-brand .brand-ai, .studio-mobile-brand .brand-ai {
  background: var(--mm-gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Pink gradient wherever the design used its solid accent */
.studio-primary-button {
  background: var(--mm-gradient) !important; border-color: transparent !important; color: #1a0610 !important;
  box-shadow: 0 0 0 1px #ff3d8b40, 0 8px 28px -10px #ff3d8bb0;
}
.studio-primary-button:hover { filter: brightness(1.08); }
.studio-primary-button:disabled { filter: grayscale(.4) brightness(.8); cursor: progress; }
.studio-page-heading h1 {
  background: linear-gradient(120deg, #f5f5f5 30%, var(--mm-pink-2) 75%, var(--mm-pink-1));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.studio-nav button.active { box-shadow: inset 2px 0 0 var(--mm-pink-1); }
.studio-library-tabs button.active { border-image: var(--mm-gradient) 1; }

/* Terminal touches */
.studio-eyebrow { font-family: var(--mm-mono); letter-spacing: .5px !important; text-transform: none; }
.studio-eyebrow > span:first-child { display: none; }
.studio-eyebrow { font-size: 11px !important; color: #9a9a9a; }
.studio-eyebrow > .mm-prompt { background: none; width: auto; height: auto; border-radius: 0; color: var(--mm-pink-1); margin-right: -1px; }
.mm-cursor { display: inline-block; width: 7px; height: 1em; margin-left: 4px; vertical-align: -2px;
  background: var(--mm-pink-2); animation: mm-blink 1.1s steps(1) infinite; }
@keyframes mm-blink { 50% { opacity: 0; } }
.studio-breadcrumb { font-family: var(--mm-mono); }
#song-lyrics { font-family: var(--mm-mono); font-size: 12.5px; line-height: 1.75; }
.studio-form-actions kbd { font-family: var(--mm-mono); font-size: 10px; padding: 1px 5px; border-radius: 4px;
  border: 1px solid #ffffff22; background: #ffffff0d; }

/* Helper / GPU connection pill (replaces the language menu) */
.mm-helper-pill { display: inline-flex; align-items: center; gap: 7px; font: 500 10.5px var(--mm-mono);
  color: #9a9a9a; border: 1px solid #262626; border-radius: 99px; padding: 5px 11px; background: #0e0e0e; }
.mm-helper-pill i { width: 7px; height: 7px; border-radius: 50%; background: #666; }
.mm-helper-pill[data-state="online"] i { background: #ff5fa8; box-shadow: 0 0 8px #ff5fa8; }
.mm-helper-pill[data-state="offline"] i { background: #e1694f; }
.mm-helper-pill[data-state="offline"] { color: #e8a08f; border-color: #4a2a22; }

/* Draft cards: player + download */
.mm-player { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.mm-player audio { flex: 1 1 200px; min-width: 0; height: 34px; filter: invert(.88) hue-rotate(150deg); }

/* Inspiration presets: gradient art instead of the original photos */
.studio-inspiration-card { background: radial-gradient(120% 90% at 20% 10%, #ff3d8b55, transparent 60%), #111; }
.studio-inspiration-card:nth-child(2) { background: radial-gradient(120% 90% at 80% 10%, #ff9a6a55, transparent 60%), #111; }
.studio-inspiration-card:nth-child(3) { background: radial-gradient(120% 90% at 50% 0%, #b45cff55, transparent 60%), #111; }
.studio-sidebar .mm-brand > span { font-size: 15.5px !important; white-space: nowrap; letter-spacing: -.2px; }
.mm-helper-pill { white-space: nowrap; }
@media (max-width: 520px) { .mm-helper-pill span { display: none; } .mm-helper-pill { padding: 7px; } }

/* ---------- Live generation panel (replaces the inspiration presets) ---------- */
.mm-live { border: 1px solid #262626; border-radius: 14px; background: #0c0c0c; padding: 20px 22px 22px; }
.mm-live-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.mm-live h2 { display: flex; align-items: center; gap: 9px; margin: 0; font: 600 15px var(--font-display), sans-serif; color: #ececec; }
.mm-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #3a3a3a; }
.mm-live[data-state="active"] .mm-live-dot { background: var(--mm-pink-1); box-shadow: 0 0 10px var(--mm-pink-1); animation: mm-pulse 1.6s ease-in-out infinite; }
.mm-live[data-state="complete"] .mm-live-dot { background: var(--mm-pink-2); }
.mm-live[data-state="failed"] .mm-live-dot { background: #e1694f; }
@keyframes mm-pulse { 50% { opacity: .35; } }
.mm-live-sub { margin: 6px 0 0; color: #8d8d8d; font-size: 11.5px; line-height: 1.6; }
.mm-live-sub a { color: var(--mm-pink-2); }
.mm-live-pct { text-align: right; font-family: var(--mm-mono); flex-shrink: 0; }
.mm-live-pct strong { display: block; font-size: 22px; font-weight: 600; background: var(--mm-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.mm-live-pct span { font-size: 10.5px; color: #7a7a7a; }

.mm-overall { position: relative; height: 8px; margin: 16px 0 18px; border-radius: 99px; background: #1b1b1b; overflow: hidden; }
.mm-overall-fill { height: 100%; width: 0; border-radius: inherit; background: var(--mm-gradient);
  box-shadow: 0 0 14px #ff3d8b90; transition: width .8s ease; position: relative; overflow: hidden; }
.mm-live[data-state="active"] .mm-overall-fill::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, #ffffff55, transparent); animation: mm-shine 1.8s linear infinite; }
@keyframes mm-shine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.mm-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.mm-stage { display: flex; gap: 13px; align-items: flex-start; padding: 12px 14px; border: 1px solid #1f1f1f;
  border-radius: 11px; background: #101010; transition: border-color .3s, background .3s, opacity .3s; }
.mm-stage[data-state="pending"] { opacity: .5; }
.mm-stage[data-state="active"] { border-color: #ff3d8b66; background: linear-gradient(90deg, #ff3d8b12, #101010 60%); }
.mm-stage[data-state="failed"] { border-color: #6b2f22; background: #1a0f0c; }
.mm-stage-icon { position: relative; flex-shrink: 0; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 2px solid #333; }
.mm-stage[data-state="active"] .mm-stage-icon { border-color: #ff3d8b33; border-top-color: var(--mm-pink-1);
  border-right-color: var(--mm-pink-2); animation: mm-spin .8s linear infinite; }
.mm-stage[data-state="done"] .mm-stage-icon { border: 0; background: var(--mm-gradient); }
.mm-stage[data-state="done"] .mm-stage-icon::after { content: ""; position: absolute; left: 8px; top: 4px; width: 5px; height: 10px;
  border: solid #1a0610; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.mm-stage[data-state="failed"] .mm-stage-icon { border-color: #e1694f; }
.mm-stage[data-state="failed"] .mm-stage-icon::after { content: "×"; position: absolute; inset: 0; display: grid; place-items: center;
  color: #e1694f; font: 700 14px/1 sans-serif; }
@keyframes mm-spin { to { transform: rotate(360deg); } }
.mm-stage-body { flex: 1; min-width: 0; }
.mm-stage-top { display: flex; justify-content: space-between; gap: 10px; }
.mm-stage-top strong { font-size: 12.5px; font-weight: 500; color: #e6e6e6; }
.mm-stage-top time { font: 10.5px var(--mm-mono); color: #7a7a7a; }
.mm-stage[data-state="active"] .mm-stage-top time { color: var(--mm-pink-2); }
.mm-stage-detail { display: block; margin-top: 3px; font: 10.5px/1.5 var(--mm-mono); color: #8a8a8a;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-stage-bar { height: 3px; margin-top: 8px; border-radius: 99px; background: #1d1d1d; overflow: hidden; }
.mm-stage-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--mm-gradient); transition: width .8s ease; }
.mm-stage[data-state="done"] .mm-stage-bar i { width: 100%; opacity: .55; }
.mm-stage[data-state="active"][data-indeterminate] .mm-stage-bar i { width: 35% !important; animation: mm-slide 1.4s ease-in-out infinite; }
@keyframes mm-slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@media (prefers-reduced-motion: reduce) {
  .mm-stage-icon, .mm-stage-bar i, .mm-overall-fill::after, .mm-live-dot { animation: none !important; }
}
.mm-open-folder { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid #2a2a2a; border-radius: 7px;
  color: #b5b5b5; font: 500 10.5px var(--mm-mono); padding: 6px 10px; cursor: pointer; }
.mm-open-folder:hover { color: var(--mm-pink-2); border-color: #ff3d8b66; }

/* Download menu on finished songs */
.mm-dl { position: relative; flex-shrink: 0; }
.mm-dl summary { list-style: none; cursor: pointer; font: 500 10.5px var(--mm-mono); color: #1a0610;
  background: var(--mm-gradient); border-radius: 6px; padding: 8px 11px; white-space: nowrap; user-select: none; }
.mm-dl summary::-webkit-details-marker { display: none; }
.mm-dl[open] summary { box-shadow: 0 0 0 2px #ff3d8b55; }
.mm-player { flex-wrap: wrap; justify-content: flex-end; }
.mm-dl[open] { flex-basis: 100%; display: flex; flex-direction: column; align-items: flex-end; }
.mm-dl > div { width: 100%; margin-top: 6px; padding: 5px; background: #0b0b0b; border: 1px solid #2c2c2c; border-radius: 10px; }
.mm-dl button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 7px; background: none; cursor: pointer; font: inherit; }
.mm-dl button[data-busy] { cursor: progress; }
.mm-dl button:hover, .mm-dl button:focus-visible { background: #ff3d8b1a; outline: none; }
.mm-dl button strong { display: block; color: #ececec; font: 600 11.5px var(--mm-mono); }
.mm-dl button span { display: block; margin-top: 2px; color: #8a8a8a; font-size: 10.5px; }
.mm-dl button:first-child strong { color: var(--mm-pink-2); }

/* ---------- Installed app (PWA) ---------- */
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.mm-install { font: 500 10.5px var(--mm-mono); color: #1a0610; background: var(--mm-gradient); border: 0;
  border-radius: 99px; padding: 6px 12px; cursor: pointer; margin-right: 8px; white-space: nowrap; }
.mm-toast { position: fixed; left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 100; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px; border: 1px solid #ff3d8b66; border-radius: 12px; background: #0d0d0d;
  box-shadow: 0 14px 40px #000c; color: #dcdcdc; font-size: 12px; }
.mm-toast button { flex-shrink: 0; font: 600 11px var(--mm-mono); color: #1a0610; background: var(--mm-gradient);
  border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer; }
.mm-toast button.mm-toast-close { background: none; color: #8a8a8a; padding: 8px 4px; }

/* Cloud mode: one-time unlock screen */
.mm-unlock { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  background: #070707ee; backdrop-filter: blur(6px); }
.mm-unlock form { width: min(360px, 100%); padding: 28px 24px; border: 1px solid #ff3d8b55; border-radius: 16px;
  background: #0d0d0d; text-align: center; box-shadow: 0 20px 60px #000; }
.mm-unlock-mark { font-size: 28px; background: var(--mm-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mm-unlock h2 { margin: 8px 0 6px; font: 600 18px var(--font-display), sans-serif; color: #eee; }
.mm-unlock p { margin: 0 0 16px; color: #8d8d8d; font-size: 12px; }
.mm-unlock input { width: 100%; box-sizing: border-box; padding: 12px 14px; border-radius: 10px; border: 1px solid #2c2c2c;
  background: #070707; color: #eee; font: 14px var(--mm-mono); }
.mm-unlock input:focus { outline: none; border-color: var(--mm-pink-1); }
.mm-unlock button { width: 100%; margin-top: 12px; padding: 12px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--mm-gradient); color: #1a0610; font: 600 13px var(--mm-mono); }
.mm-unlock .mm-unlock-error { margin: 10px 0 0; color: #e8a08f; min-height: 1em; }
