:root {
  --bg: #0a0b0f;
  --bg-low: #07080b;
  --sidebar: #0d0f15;
  --card: #141722;
  --card-hi: #181c28;
  --card-alt: #1b1f2c;
  --border: #262b39;
  --border-soft: #1e2230;
  --text: #eef0f6;
  --text-dim: #b7c0d6;
  --text-faint: #8b93ac;
  --ok: #46d6c3;
  --warn: #e6a95c;
  --err: #f26a5f;
  --input: #0f1118;
  --outline: #343c4f;
  --accent: #e9a83a;
  --accent-hi: #ffc25c;
  --accent-lo: #b9822a;
}

* { box-sizing: border-box; }
html { font-size: calc(16px * var(--ui-scale, 1)); }
a:focus-visible, button:focus-visible, .nav-btn:focus-visible, .ob-badge:focus-visible,
.flow-action:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.list li:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent-hi); outline-offset: 2px; border-radius: 6px;
}
/* Typing fields: draw the focus ring INSIDE the box so it never spills onto
   the label above (an outward outline clipped "Lyrics", etc.). */
input:not([type=checkbox]):not([type=radio]):not([type=range]):focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--accent-hi); box-shadow: inset 0 0 0 1px var(--accent-hi);
}
body {
  margin: 0;
  font-family: 'Segoe UI', 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent-hi); }
a:hover { color: var(--accent); }
a:visited { color: var(--accent); }

#app { display: flex; height: 100vh; }

/* sidebar */
#sidebar {
  width: 230px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #10131b, var(--sidebar));
  border-right: 1px solid var(--border-soft);
  padding: 26px 18px 18px;
  display: flex;
  flex-direction: column;
}
.nav-btn {
  text-align: left; padding: 11px 16px; border: none; border-radius: 10px;
  background: transparent; color: var(--text-dim); font-size: 0.9375rem; font-weight: 600;
  cursor: pointer; margin-bottom: 6px; width: 100%;
}
.nav-btn:hover { background: #161a24; color: var(--text); }
.nav-btn.active { background: linear-gradient(90deg, var(--accent-lo), var(--accent)); color: #0b0b0d; }
.sidebar-spacer { flex: 1; }
.chip {
  display: inline-block; background: var(--card-alt); border: 1px solid var(--border);
  border-radius: 9px; padding: 2px 9px; font-size: 0.75rem; font-weight: 600; color: var(--text-dim);
  margin-top: 6px;
}
.chip.ok { color: var(--ok); border-color: var(--ok); }
.chip.warn { color: var(--warn); border-color: var(--warn); }
.chip.err { color: var(--err); border-color: var(--err); }
.sidebar-links { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.sidebar-links a { font-size: 0.75rem; color: #9ba3e0; text-decoration: none; }
.sidebar-links a:hover { color: var(--accent-hi); }

/* Pinned top bar (brand + Support + account) living inside #main, sticky
   above every page - not a floating fixed pill with no backdrop, which used
   to visually collide with scrolled-past card edges. */
.app-topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 60px; padding: 0 28px;
  background: rgba(10, 11, 15, 0.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}
/* Top bar: the studio's name, centred, as a gold engraved plate - flanked
   by fading gold rules with a small diamond at the inner end, a slow sheen
   across the letters, and a soft gold glow along the bar's bottom edge. */
.app-topbar { display: grid; grid-template-columns: 1fr auto 1fr; }
.app-topbar::after {
  content: ""; position: absolute; left: 10%; right: 10%; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233, 168, 58, 0.55), rgba(255, 214, 140, 0.9), rgba(233, 168, 58, 0.55), transparent);
  box-shadow: 0 0 14px rgba(233, 168, 58, 0.45);
  pointer-events: none;
}
.app-topbar-spacer { min-width: 0; }
.app-topbar-right { justify-self: end; }
.studio-title { display: flex; align-items: center; gap: 14px; }
.st-word {
  margin: 0; font-size: 1.25rem; font-weight: 800; letter-spacing: 0.42em; text-transform: uppercase;
  padding-left: 0.42em; /* balance the trailing letter-space so it centres truly */
  white-space: nowrap; line-height: 1;
  background: linear-gradient(100deg, #b9822a 0%, #f3c877 30%, #fff0c8 45%, #f3c877 60%, #b9822a 100%);
  background-size: 250% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 12px rgba(233, 168, 58, 0.28));
  animation: st-sheen 9s ease-in-out infinite;
}
.st-word span { font-weight: 400; }
@keyframes st-sheen { 0%, 55% { background-position: 100% 0; } 85%, 100% { background-position: 0% 0; } }
.st-orn { position: relative; width: 64px; height: 1px; background: linear-gradient(90deg, transparent, var(--accent)); }
.st-orn::after {
  content: ""; position: absolute; right: -3px; top: -3px; width: 7px; height: 7px;
  background: var(--accent-hi); transform: rotate(45deg); box-shadow: 0 0 8px rgba(255, 194, 92, 0.8);
}
.st-orn-r { transform: scaleX(-1); }
@media (prefers-reduced-motion: reduce) { .st-word { animation: none; background-position: 50% 0; } }

/* Sidebar brand: same lockup and size as the public pages' header, in a
   band as tall as the top bar so their bottom lines meet. Links home. */
.sidebar-brand {
  display: flex; align-items: center; gap: 11px; height: 60px; margin: -26px -18px 20px; padding: 0 18px;
  border-bottom: 1px solid var(--border-soft); text-decoration: none; color: var(--text);
}
/* white SWARA in every link state (the global a:visited rule turned it gold) */
.sidebar-brand:link, .sidebar-brand:visited, .sidebar-brand:hover, .sidebar-brand:active { color: var(--text); }
.sidebar-brand img { height: 32px; width: auto; filter: drop-shadow(0 0 10px rgba(233, 168, 58, 0.35)); transition: transform .2s; }
.sidebar-brand:hover img { transform: rotate(-6deg) scale(1.06); }
.sidebar-brand-word { font-size: 17px; font-weight: 800; letter-spacing: 2px; white-space: nowrap; }
.sidebar-brand-word span { color: var(--accent); }
.app-topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.app-topbar-support {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 8px 16px; border-radius: 999px; font-size: 0.8125rem;
}

.account-widget { position: relative; width: 220px; flex-shrink: 0; }
.account-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: var(--card-alt); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 10px; color: var(--text); font-size: 0.875rem; font-weight: 600; cursor: pointer;
  text-align: left;
}
.account-btn:hover { background: var(--card-hi); }
.account-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #0b0b0d; font-size: 0.75rem; font-weight: 800;
  object-fit: cover;
}
.account-avatar.google-g { background: #fff; }
#account-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 10;
  background: var(--card-hi); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.account-email { font-size: 0.75rem; color: var(--text-dim); margin-bottom: 8px; word-break: break-all; }
.account-kicker { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 2px; }
.account-caret { margin-left: auto; color: var(--text-faint); font-size: 0.75rem; }
.account-signout {
  width: 100%; background: transparent; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; color: var(--err); font-size: 0.8125rem; font-weight: 700; cursor: pointer;
}
.account-signout:hover { background: var(--card-alt); }

/* main */
#main {
  flex: 1;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-low) 100%);
}
.page { display: none; padding: 32px; max-width: 1200px; }
.page.active { display: block; }
.page-title { font-size: 1.5625rem; font-weight: 700; margin: 0 0 6px; }
.page-sub { font-size: 0.875rem; color: var(--text-dim); margin: 0 0 20px; max-width: 760px; line-height: 1.5; }

/* per-page hero banner - a real image swaps in automatically once one
   exists at the path named in the placeholder; until then this shows a
   themed placeholder instead of a broken <img>. */
.page-banner-img {
  position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 1;
  border: 1px solid var(--border); background: var(--card); margin-bottom: 20px;
}
@media (max-width: 700px) { .page-banner-img { aspect-ratio: 2 / 1; } }
.page-banner-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.page-banner-img .placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background:
    repeating-linear-gradient(135deg, rgba(233, 168, 58, 0.05) 0 2px, transparent 2px 16px),
    linear-gradient(120deg, var(--card-hi), var(--card));
  color: var(--text-faint);
}
.page-banner-img .placeholder svg { flex-shrink: 0; opacity: 0.55; color: var(--accent); }
.page-banner-img .placeholder .ph-text { font-size: 0.8125rem; line-height: 1.5; }
.page-banner-img .placeholder code {
  background: var(--card-alt); border: 1px solid var(--border); border-radius: 6px;
  padding: 1px 7px; color: var(--text-dim); font-size: 0.75rem;
}

/* banner (top of every page) */
.banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 16px; margin-bottom: 20px;
}
.banner .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.banner.busy .dot { background: var(--warn); }
.banner.ok .dot { background: var(--ok); }
.banner.err .dot { background: var(--err); }
.banner-text { font-weight: 600; }
.banner-sub { font-size: 0.8125rem; color: var(--text-dim); }

/* the one shared status banner, living in the sidebar instead of repeated
   per page - narrower and lets long status text (pod-check messages,
   errors) wrap instead of clipping or forcing the sidebar wider. */
.sidebar-banner {
  align-items: flex-start; padding: 10px 12px; margin: 12px 0 10px;
  width: 100%;
}
.sidebar-banner .dot { margin-top: 5px; }
.sidebar-banner .banner-text { font-size: 0.8125rem; }
.sidebar-banner .banner-sub { font-size: 0.75rem; line-height: 1.4; white-space: normal; word-break: break-word; }

.card {
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px; margin-bottom: 18px;
}

/* "How this page works" - collapsed by default, opens in place. Separate
   from .card visually (accent left border + badge) so it reads as help,
   not just another settings block. */
.help-card {
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--border); border-left: 3px solid var(--accent-lo);
  border-radius: 14px; padding: 14px 18px; margin-bottom: 18px;
}
.help-card summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 0.9375rem;
}
.help-card summary::-webkit-details-marker { display: none; }
.help-badge {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(233, 168, 58, 0.14); color: var(--accent-hi); font-weight: 800; font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1.5px rgba(233, 168, 58, 0.5);
}
.help-card summary::after { content: "+"; margin-left: auto; color: var(--accent); font-size: 1.125rem; }
.help-card[open] summary::after { content: "\2212"; }
.help-card .a { padding-top: 12px; }
.help-card ul { margin: 0 0 10px; padding-left: 20px; color: var(--text-dim); font-size: 0.8125rem; line-height: 1.6; }
.help-card li { margin-bottom: 6px; }
.help-card .help-link { font-size: 0.8125rem; font-weight: 700; color: var(--accent-hi); text-decoration: none; }
.help-card .help-link:hover { text-decoration: underline; }
.card h2 { font-size: 0.9375rem; font-weight: 700; margin: 0 0 10px; }
.optional-tag {
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--ok); background: rgba(70, 214, 195, 0.12); border: 1px solid rgba(70, 214, 195, 0.4);
  border-radius: 99px; padding: 2px 8px; margin-left: 6px; vertical-align: middle;
}
.hint { font-size: 0.8125rem; color: var(--text-dim); margin: 0 0 8px; }
.faint { font-size: 0.75rem; color: var(--text-faint); }

.row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 14px; }
.two-col { display: flex; gap: 18px; align-items: flex-start; }
.two-col > .main { flex: 3; min-width: 0; }
.two-col > .side { flex: 0 0 340px; }

label { font-size: 0.8125rem; color: var(--text-dim); }

input[type=text], input[type=password], input[type=number], textarea, select {
  background: var(--input); border: 1px solid var(--outline); border-radius: 9px;
  color: var(--text); padding: 8px 10px; font-size: 0.875rem; font-family: inherit;
  width: 100%;
}
textarea { resize: vertical; }
input:disabled, select:disabled, textarea:disabled { opacity: 0.5; }
input[readonly] { cursor: default; caret-color: transparent; }
/* brief gold pulse when a field is filled in for you (band -> style prompt) */
.flash-fill { animation: flash-fill 1.1s ease; }
@keyframes flash-fill {
  0% { border-color: var(--accent-hi); box-shadow: inset 0 0 0 2px rgba(233, 168, 58, 0.45); }
  100% { border-color: var(--outline); box-shadow: none; }
}

button, a.btn {
  background: var(--card-alt); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 16px; font-weight: 600; cursor: pointer; font-size: 0.875rem;
  display: inline-block; text-decoration: none;
}
button:hover:not(:disabled), a.btn:hover { border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary, a.btn.primary { background: linear-gradient(90deg, var(--accent-lo), var(--accent)); color: #0b0b0d; border: none; }
button.danger { background: #2a1414; color: var(--err); border-color: var(--err); }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  padding: 10px 12px; border-radius: 10px; cursor: pointer; margin-bottom: 4px;
  border: 1px solid transparent;
}
.list li:hover { background: var(--card-alt); }
.list li.selected { background: var(--card-alt); border-color: var(--accent); }
.list li .title { font-weight: 600; }
.list li .meta { font-size: 0.75rem; color: var(--text-faint); }
.list li.list-empty-wrap { padding: 0; cursor: default; }
.list li.list-empty-wrap:hover { background: transparent; }
.list-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
  padding: 28px 16px; color: var(--text-faint); background: var(--input);
  border: 1px dashed var(--border); border-radius: 12px; font-size: 0.8125rem; line-height: 1.5;
}
.list-empty svg { color: var(--text-faint); }
.list-empty button { margin-top: 6px; }

/* Library song list - colorful cards (icon badge + gold left border) laid
   out as a wrapping grid, not a plain dense file-explorer-style list. */
.lib-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
/* Toolbar + player stay pinned (under the app top bar) while the page
   scrolls; the song list below scrolls on its own. */
.lib-head {
  position: sticky; top: 60px; z-index: 5;
  background: var(--card-hi); margin: -16px -18px 12px; padding: 16px 18px 0;
  border-radius: 14px 14px 0 0;
}
.lib-nowbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--input); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 10px 8px 16px; margin-bottom: 12px;
}
.lib-now-label { display: flex; flex-direction: column; min-width: 0; flex: 0 1 260px; }
.lib-now-kicker { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.lib-now-title { font-weight: 700; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-nowbar audio { flex: 1; min-width: 0; height: 40px; color-scheme: dark; }
@media (max-width: 700px) {
  .lib-nowbar { flex-direction: column; align-items: stretch; gap: 6px; }
  .lib-now-label { flex-basis: auto; }
  .lib-nowbar audio { width: 100%; }
}
.lib-toolbar h2 { margin: 0; }
.lib-toolbar .row { margin: 0; }
.lib-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 520px; overflow-y: auto; padding: 2px 4px 2px 2px;
}
.list li.lib-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 0;
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--border); border-left: 3px solid var(--accent-lo);
  border-radius: 10px; padding: 10px 12px 10px 14px; transition: border-color 0.15s ease;
}
.list li.lib-row:hover { background: linear-gradient(180deg, var(--card-hi), var(--card)); border-color: var(--accent); border-left-color: var(--accent); }
.list li.lib-row.selected { border-color: var(--accent); border-left-color: var(--accent-hi); box-shadow: 0 0 0 1px var(--accent); }
.lib-row .lib-check { flex-shrink: 0; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.lib-row-main { flex: 1; min-width: 0; }
.lib-row-main .title, .lib-row-main .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-row-main .meta { margin-top: 2px; }
/* Per-row play/pause - drives the same shared player as the Now playing
   card, so the list alone is enough to play through the library. */
.lib-play {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent-hi), var(--accent-lo)); color: #1a1206;
  border: none; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.lib-play:hover:not(:disabled) { transform: scale(1.07); box-shadow: 0 0 0 3px rgba(233, 168, 58, 0.22); }
.lib-play svg { width: 15px; height: 15px; }
.lib-row.playing .lib-play { box-shadow: 0 0 0 3px rgba(255, 194, 92, 0.3); }
.lib-time {
  flex-shrink: 0; min-width: 48px; text-align: right;
  font-variant-numeric: tabular-nums; font-size: 0.8125rem; color: var(--text-faint);
}
.lib-row.playing .lib-time { color: var(--accent-hi); font-weight: 700; }

/* onboarding flow (Create page) - a horizontal row of colorful, clickable
   steps rather than a plain checklist, connected by a track. Each step gets
   its own accent so the row reads at a glance, not just on/off. */
.ob-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.ob-head h2 { margin: 0; }
.ob-flow { display: flex; align-items: flex-start; margin-top: 8px; }
.ob-step {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 10px; position: relative; padding: 0 6px;
}
.ob-step::before {
  content: ""; position: absolute; top: 21px; left: -50%; width: 100%; height: 2px;
  background: var(--border); z-index: 0;
}
.ob-step:first-child::before { display: none; }
.ob-step.done::before { background: var(--ok); }
.ob-badge {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; z-index: 1;
  display: flex; align-items: center; justify-content: center; font-weight: 800;
  border: none; cursor: pointer; transition: transform 0.15s ease;
}
.ob-badge:hover { transform: translateY(-2px); }
.ob-step.done .ob-badge { cursor: default; }
.ob-step.done .ob-badge:hover { transform: none; }
.ob-label { font-size: 0.8125rem; font-weight: 600; color: var(--text-dim); line-height: 1.35; }
.ob-step.done .ob-label { color: var(--text-faint); }

.ob-step.ob-teal .ob-badge { background: rgba(70, 214, 195, 0.14); color: var(--ok); box-shadow: inset 0 0 0 1.5px rgba(70, 214, 195, 0.5); }
.ob-step.ob-teal.done .ob-badge { background: var(--ok); color: #08211c; box-shadow: none; }
.ob-step.ob-gold .ob-badge { background: rgba(233, 168, 58, 0.14); color: var(--accent-hi); box-shadow: inset 0 0 0 1.5px rgba(233, 168, 58, 0.5); }
.ob-step.ob-gold.done .ob-badge { background: var(--accent); color: #1a1206; box-shadow: none; }
.ob-step.ob-rose .ob-badge { background: rgba(226, 112, 138, 0.14); color: #e2708a; box-shadow: inset 0 0 0 1.5px rgba(226, 112, 138, 0.5); }
.ob-step.ob-rose.done .ob-badge { background: #e2708a; color: #290c13; box-shadow: none; }
.ob-step.ob-violet .ob-badge { background: rgba(139, 124, 240, 0.14); color: #a79cf7; box-shadow: inset 0 0 0 1.5px rgba(139, 124, 240, 0.5); }
.ob-step.ob-violet.done .ob-badge { background: #8b7cf0; color: #16123a; box-shadow: none; }

@media (max-width: 860px) {
  .ob-flow { flex-direction: column; gap: 14px; }
  .ob-step { flex-direction: row; text-align: left; padding: 0; }
  .ob-step::before { display: none; }
  .ob-label { font-size: 0.875rem; }
}

.key-row { display: flex; gap: 8px; align-items: center; }
.key-row input { flex: 1; }
/* Saved keys/URLs are display-only (edited via the button beside them), so
   they read as locked values - flat, dimmed, no input chrome - not as a
   live text box that silently ignores typing. Clicking one opens its Edit. */
.key-row input[readonly] {
  background: rgba(255, 255, 255, 0.025); border: 1px dashed var(--border);
  color: var(--text-faint); cursor: pointer; letter-spacing: 0.02em;
}
.key-row input[readonly]:hover { border-color: var(--outline); }
/* "Don't have a key? Get one from …" - under empty key fields + in the edit popup */
.key-get {
  margin: 6px 0 10px; font-size: 0.8125rem; color: var(--text-dim); line-height: 1.5;
  padding-left: 10px; border-left: 2px solid var(--accent-lo);
}
.key-get a { color: var(--accent-hi); font-weight: 700; text-decoration: none; }
.key-get a:hover { text-decoration: underline; }
.key-get-steps { color: var(--text-faint); }
.modal .key-get { margin: 0 0 12px; }
.key-row input[readonly]::placeholder { color: var(--text-faint); font-style: italic; }

/* Toasts - the attention-grabbing twin of the sidebar status line. Every
   ok/err/warn outcome pops one here (bottom-right, where the eye isn't
   already busy) so "Saved." can't happen silently off to the side. A busy
   step shows a spinner toast that then turns into its own result. */
.toast-stack {
  position: fixed; right: 24px; bottom: 24px; z-index: 1100;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 12px;
  width: 360px; max-width: calc(100vw - 32px);
  background: linear-gradient(180deg, #1d2231, #161a26);
  border: 1px solid var(--outline); border-left: 4px solid var(--text-faint);
  border-radius: 12px; padding: 12px 14px 12px 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  animation: toast-in 0.22s cubic-bezier(.2,.9,.3,1.2);
}
.toast.leaving { animation: toast-out 0.2s ease forwards; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
.toast.busy { border-left-color: var(--accent); }
.toast-icon {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.8125rem;
}
.toast.ok .toast-icon { background: var(--ok); color: #08211c; }
.toast.err .toast-icon { background: var(--err); color: #2a0b08; }
.toast.warn .toast-icon { background: var(--warn); color: #2a1a06; }
.toast.busy .toast-icon {
  border: 2.5px solid rgba(233, 168, 58, 0.25); border-top-color: var(--accent-hi);
  animation: toast-spin 0.8s linear infinite;
}
.toast-body { flex: 1; min-width: 0; }
.toast-text { font-weight: 700; font-size: 0.9375rem; line-height: 1.35; }
.toast-sub { font-size: 0.8125rem; color: var(--text-dim); margin-top: 3px; line-height: 1.45; word-break: break-word; }
.toast-close {
  flex-shrink: 0; background: transparent; border: none; padding: 0 2px;
  color: var(--text-faint); font-size: 1.125rem; line-height: 1; cursor: pointer;
}
.toast-close:hover { color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes toast-spin { to { transform: rotate(360deg); } }
@media (max-width: 700px) {
  .toast-stack { left: 16px; right: 16px; bottom: 16px; align-items: stretch; }
  .toast { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .toast, .toast.leaving { animation: none; }
}

/* Action dialog - same shell as the edit modal, for "do this first" stops
   (e.g. no library folder connected) that offer the fix right there. */
.modal .modal-body { color: var(--text-dim); font-size: 0.875rem; line-height: 1.55; margin: 0 0 4px; }
.modal-icon {
  width: 40px; height: 40px; border-radius: 50%; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(233, 168, 58, 0.14); color: var(--accent-hi);
  box-shadow: inset 0 0 0 1.5px rgba(233, 168, 58, 0.5);
}
.modal-icon svg { width: 20px; height: 20px; }

/* modal (used for editing an API key / URL - explicit Save/Cancel, no
   ambiguous click-away-to-save) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,5,8,0.65);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal {
  background: linear-gradient(180deg, var(--card-hi), var(--card));
  border: 1px solid var(--outline); border-radius: 14px;
  padding: 22px 24px; width: 420px; max-width: calc(100vw - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal h2 { margin: 0 0 8px; font-size: 1rem; }
.modal input {
  background: var(--input); border: 1px solid var(--accent); border-radius: 9px;
  color: var(--text); padding: 9px 11px; font-size: 0.875rem; width: 100%;
}

/* flow chart / stepper (Voices > train on Colab) */
.flow { margin: 16px 0 18px; }
.flow-step { display: flex; gap: 16px; }
.flow-node { flex-shrink: 0; width: 36px; display: flex; flex-direction: column; align-items: center; }
.flow-num {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-hi), var(--accent-lo)); color: #100b02;
  font-weight: 800; font-size: 0.9375rem; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 4px var(--card), 0 4px 14px rgba(233, 168, 58, 0.35); z-index: 1;
}
.flow-line { flex: 1; width: 2px; min-height: 24px; margin: 4px 0; background: linear-gradient(180deg, var(--accent-lo), var(--border) 90%); }
.flow-card {
  flex: 1; min-width: 0; background: var(--card-alt); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 18px; margin-bottom: 22px;
}
.flow-step-last .flow-card { margin-bottom: 0; }
.flow-card-title {
  display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 0.9375rem; margin: 0 0 7px;
}
.flow-card-title svg { flex-shrink: 0; color: var(--accent); }
.flow-caption { font-size: 0.8125rem; color: var(--text-dim); margin: 0; line-height: 1.55; }
.flow-action {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 13px;
  background: linear-gradient(90deg, var(--accent-lo), var(--accent)); color: #0b0b0d;
  border: none; border-radius: 9px; padding: 10px 18px; font-weight: 700; font-size: 0.875rem;
  text-decoration: none; box-shadow: 0 4px 16px rgba(233, 168, 58, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.flow-action:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(233, 168, 58, 0.4); color: #0b0b0d; }
.flow-action.secondary {
  background: var(--card-hi); color: var(--text); border: 1px solid var(--outline); box-shadow: none;
}
.flow-action.secondary:hover { border-color: var(--accent); color: var(--text); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }

/* Appearance settings (Settings page) */
.appearance-row { display: flex; align-items: center; gap: 14px; }
#appearance-scale-value { min-width: 44px; text-align: right; font-weight: 700; color: var(--accent-hi); }

/* range sliders (Appearance, ACE-Step duration) */
input[type=range] { flex: 1; width: 100%; accent-color: var(--accent); }
.duration-row { display: flex; align-items: center; gap: 12px; }
.duration-label { min-width: 46px; text-align: right; font-weight: 700; color: var(--accent-hi); font-size: 0.8125rem; }

/* library audio player */
audio { color-scheme: dark; border-radius: 9px; width: 100%; margin-top: 10px; }

/* Library "now playing" card - the audio element is always visible (no
   placeholder swap), just empty until a song is picked, so nothing
   suddenly appears/disappears. No backdrop image - it's a plain card. */
.np-actions { display: flex; gap: 8px; margin: 10px 0 0; }
.np-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.np-info-block h3 {
  font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-faint); margin: 0 0 6px; font-weight: 700;
}
.np-text {
  font-size: 0.8125rem; color: var(--text-dim); line-height: 1.55; white-space: pre-wrap;
  max-height: 140px; overflow-y: auto; margin: 0; background: var(--input);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-family: inherit;
}
@media (max-width: 700px) {
  .np-info-grid { grid-template-columns: 1fr; }
}

/* narrow screens: collapse the fixed 230px sidebar into a horizontal top bar
   instead of the desktop-only two-column shell, and let the split layouts
   used across every page stack into one column. Not a full mobile redesign -
   just enough that a phone visitor sees a usable app instead of a broken one. */
/* Phones & small tablets: ONE pinned bar - [menu] SWARA STUDIO · page ...
   Support, Sign in. The menu (pages, status, folder chip, help links) is
   the #sidebar, turned into a panel that drops down from under the bar when
   the menu button is tapped, so the whole screen below the bar is work area.
   #main's children join #app's column (display: contents) so the bar can
   sit first and stick to the page itself. Desktop is untouched. */
.nav-toggle, .nav-scrim, .st-page { display: none; }
@media (max-width: 860px) {
  #app { flex-direction: column; height: auto; min-height: 100vh; }
  #main { display: contents; }
  .app-topbar { order: -1; }

  .app-topbar { height: 56px; padding: 0 12px 0 8px; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 8px; }
  .app-topbar-spacer { display: flex; align-items: center; min-width: 0; }
  .st-orn { display: none; }
  .studio-title { justify-self: start; min-width: 0; overflow: hidden; gap: 8px; }
  .app-topbar-right { justify-self: end; gap: 8px; }
  .st-word { font-size: 0.875rem; letter-spacing: 0.26em; padding-left: 0; }
  .st-page { display: inline; font-size: 0.8125rem; font-weight: 600; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .app-topbar-support { padding: 8px 11px; }
  .app-topbar-support span.label { display: none; }
  .account-widget { width: auto; min-width: 0; }
  #account-label { max-width: 120px; }
  .lbl-long { display: none; }

  /* the menu button: three bars that turn into a gold X */
  .nav-toggle {
    display: inline-flex; position: relative; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 12px; cursor: pointer; flex-shrink: 0;
    background: transparent; border: 1px solid rgba(255, 255, 255, 0.16); color: var(--text);
  }
  .nav-toggle:hover, body.nav-open .nav-toggle { border-color: rgba(233, 168, 58, 0.6); color: var(--accent-hi); }
  .nt-bars, .nt-bars::before, .nt-bars::after {
    display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transition: transform .2s ease, background .2s ease;
  }
  .nt-bars { position: relative; }
  .nt-bars::before, .nt-bars::after { content: ""; position: absolute; left: 0; }
  .nt-bars::before { top: -6px; }
  .nt-bars::after { top: 6px; }
  body.nav-open .nt-bars { background: transparent; }
  body.nav-open .nt-bars::before { transform: translateY(6px) rotate(45deg); background: var(--accent-hi); }
  body.nav-open .nt-bars::after { transform: translateY(-6px) rotate(-45deg); background: var(--accent-hi); }
  .nt-dot {
    position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent-hi); box-shadow: 0 0 0 2px var(--bg), 0 0 8px rgba(255, 194, 92, 0.8);
  }
  .nt-dot[hidden] { display: none; }

  /* the menu panel (the desktop sidebar, re-laid out) */
  #sidebar {
    position: fixed; top: 56px; left: 0; right: 0; z-index: 39;
    width: auto; max-height: calc(100dvh - 56px); overflow-y: auto; overscroll-behavior: contain;
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start;
    padding: 14px 14px 18px; border-right: none; border-bottom: 1px solid rgba(233, 168, 58, 0.35);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
  }
  body.nav-open #sidebar { opacity: 1; visibility: visible; transform: none; transition: opacity .18s ease, transform .18s ease; }
  .nav-scrim {
    display: block; position: fixed; inset: 56px 0 0 0; z-index: 38; background: rgba(4, 5, 8, 0.6);
    opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility 0s linear .18s;
  }
  body.nav-open .nav-scrim { opacity: 1; visibility: visible; transition: opacity .18s ease; }
  body.nav-open { overflow: hidden; }

  .sidebar-brand { grid-column: 1 / -1; order: 9; justify-content: center; height: 44px; margin: 6px 0 0; border-bottom: none; }
  .nav-btn {
    width: auto; margin: 0; text-align: left; padding: 13px 14px; font-size: 0.9375rem;
    background: var(--card-alt); border: 1px solid var(--border); color: var(--text);
  }
  .nav-btn.active { border-color: transparent; }
  .sidebar-spacer { display: none; }
  .sidebar-banner, #folder-chip, .sidebar-links { grid-column: 1 / -1; margin: 0; }
  .sidebar-banner { margin-top: 6px; }
  #folder-chip { justify-self: start; }
  .sidebar-links { flex-direction: row; gap: 18px; padding: 4px 2px 0; }

  .page { padding: 20px 16px 40px; }
  .two-col { flex-direction: column; }
  .two-col > .side { flex: 1 1 auto; width: 100%; }

  .key-row { flex-wrap: wrap; }
  .key-row label { width: 100% !important; }
}
@media (max-width: 560px) {
  #account-label { max-width: 96px; }
  .account-btn { padding: 7px 10px; }
}
@media (max-width: 420px) {
  .st-page { display: none; }
}
@media (max-width: 360px) {
  .st-word { letter-spacing: 0.16em; }
}
