/* ============================================================
   Video Gen Studio — light claymorphism design system
   ------------------------------------------------------------
   Soft blue daylight canvas, near-white clay surfaces, generous
   radii, and depth built from layered shadows instead of borders:

     1. a hairline ring            (definition)
     2. a tight contact shadow     (the object sits on the page)
     3. a wide diffuse shadow      (it floats)
     4. an inset top highlight     (light falls from above)

   That four-part recipe lives in --clay / --clay-lg / --clay-press;
   use those instead of inventing new shadows, so every surface
   appears lit by the same light source.
   ============================================================ */

:root {
  /* --- canvas & surfaces --- */
  --bg: #e9eff9;
  --bg-deep: #dee7f6;          /* recessed areas: rails, wells, tracks */
  --surface: #ffffff;
  --surface-2: #f4f7fd;
  --surface-3: #e7edf9;
  --stage: #eaf0fa;            /* behind previews/thumbnails */

  --border: rgba(29, 51, 99, 0.08);
  --border-strong: rgba(29, 51, 99, 0.14);

  --text: #16233d;
  --text-soft: #46557a;
  --text-dim: #8090ad;

  /* --- brand: professional blue into violet, cyan highlight --- */
  --brand-1: #3068ff;
  --brand-2: #7c5cff;
  --brand-3: #17b6e8;
  --grad: linear-gradient(135deg, #3068ff 0%, #7c5cff 55%, #17b6e8 100%);
  --grad-soft: linear-gradient(135deg, rgba(48,104,255,0.12), rgba(124,92,255,0.12), rgba(23,182,232,0.12));

  --cyan: #0ea5e9;
  --lime: #65a30d;
  --amber: #d97706;
  --green: #0f9d76;
  --red: #e2565f;

  /* --- clay depth --- */
  --clay:
    0 0 0 1px rgba(29, 51, 99, 0.06),
    0 1px 2px rgba(23, 43, 84, 0.05),
    0 12px 26px -14px rgba(23, 43, 84, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --clay-lg:
    0 0 0 1px rgba(29, 51, 99, 0.05),
    0 2px 6px rgba(23, 43, 84, 0.05),
    0 30px 60px -28px rgba(23, 43, 84, 0.34),
    inset 0 2px 0 rgba(255, 255, 255, 0.95);
  --clay-hover:
    0 0 0 1px rgba(48, 104, 255, 0.18),
    0 2px 5px rgba(23, 43, 84, 0.06),
    0 22px 44px -18px rgba(30, 64, 160, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  /* pressed / inset wells: light now comes from below */
  --clay-press:
    inset 0 2px 6px rgba(23, 43, 84, 0.13),
    inset 0 -1px 0 rgba(255, 255, 255, 0.75);
  --clay-brand: 0 10px 24px -10px rgba(48, 104, 255, 0.55);

  --radius-sm: 14px;
  --radius: 20px;
  --radius-lg: 26px;

  --space-xxs: 2px; --space-xs: 4px; --space-sm: 7px; --space-md: 10px;
  --space-lg: 14px; --space-xl: 19px; --space-xxl: 27px; --space-section: 40px;

  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --content-max: 1360px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  color: var(--text-soft);
  font-family: var(--font-body);
  font-size: 12.5px; font-weight: 400; line-height: 1.45;
  /* daylight blooms over a blue-tinted canvas; fixed so scrolling feels like
     moving over one continuous surface rather than a repeating background */
  background:
    radial-gradient(900px 520px at 8% -8%, rgba(255, 255, 255, 0.95), transparent 60%),
    radial-gradient(760px 480px at 92% 2%, rgba(163, 205, 255, 0.55), transparent 62%),
    radial-gradient(680px 520px at 60% 100%, rgba(196, 187, 255, 0.35), transparent 60%),
    linear-gradient(180deg, #eaf1fb 0%, #e3ebf8 55%, #e7edf9 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* Layouts render header / content / footer as direct children of <body>, so the page
   itself is the flex column that keeps a footer at the bottom of the viewport on short
   pages (login, register) instead of floating it under the content. */
body { min-height: 100dvh; display: flex; flex-direction: column; }

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); margin: 0 0 var(--space-md); letter-spacing: -0.02em; }
h1 { font-size: 56px; font-weight: 700; line-height: 1.06; }
h2 { font-size: 40px; font-weight: 700; line-height: 1.12; }
h3 { font-size: 28px; font-weight: 700; line-height: 1.2; }
h4 { font-size: 20px; font-weight: 600; line-height: 1.3; }
h1:focus, h1:focus-visible { outline: none; }
/* Auth/utility pages need an h1 for the document outline, but not a 56px hero headline.
   Same visual weight the old h3 had. */
h1.auth-h1 { font-size: 28px; font-weight: 700; line-height: 1.2; }
p { margin: 0 0 var(--space-md); }
a { color: var(--text); text-decoration: none; }

.container { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--space-xl); }

::selection { background: rgba(48, 104, 255, 0.18); color: var(--text); }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(29, 51, 99, 0.18); border-radius: 999px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(29, 51, 99, 0.32); background-clip: content-box; }

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- top nav ---------- */
.top-nav {
  position: sticky; top: 0; z-index: 100; height: 52px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8), 0 6px 24px -14px rgba(23, 43, 84, 0.35);
  display: flex; align-items: center;
}
.top-nav .container { display: flex; align-items: center; gap: var(--space-xxl); width: 100%; }
.top-nav .brand { display: flex; align-items: center; gap: 10px; color: var(--text); flex-shrink: 0; }
.top-nav .brand-mark {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px;
  filter: drop-shadow(0 6px 12px rgba(48, 104, 255, 0.35));
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.22s ease;
}
.top-nav .brand:hover .brand-mark {
  transform: scale(1.06) rotate(-3deg);
  filter: drop-shadow(0 8px 18px rgba(48, 104, 255, 0.5));
}
.top-nav .brand-mark .brand-play { transition: transform 0.22s ease; transform-origin: 33px 32px; }
.top-nav .brand:hover .brand-mark .brand-play { transform: translateX(1.5px) scale(1.08); }
.top-nav .brand-mark .brand-brackets { opacity: 0.9; transition: opacity 0.22s ease; }
.top-nav .brand:hover .brand-mark .brand-brackets { opacity: 1; }
.top-nav .brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.top-nav .brand-name {
  font-family: var(--font-display); font-weight: 700; font-size: 15.5px;
  letter-spacing: -0.2px; color: var(--text);
}
.top-nav .brand-sub {
  font-size: 8.5px; font-weight: 700; letter-spacing: 1.7px;
  text-transform: uppercase; color: var(--text-dim); margin-top: 2px;
}
/* the nav pill is a recessed clay groove; the active tab rises out of it */
.top-nav nav {
  display: flex; gap: 3px; flex: 1;
  background: rgba(217, 227, 244, 0.75);
  border-radius: 999px; padding: 4px; max-width: fit-content;
  box-shadow: var(--clay-press);
}
.top-nav nav a {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--text-soft);
  padding: 6px 16px; border-radius: 999px; transition: all 0.16s ease;
}
.top-nav nav a .nav-ico { font-size: 12px; opacity: 0.6; }
.top-nav nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.6); }
.top-nav nav a.active {
  color: var(--brand-1); background: #fff;
  box-shadow: 0 1px 2px rgba(23, 43, 84, 0.06), 0 6px 14px -8px rgba(23, 43, 84, 0.4);
}
.top-nav nav a.active .nav-ico { opacity: 1; }
.top-nav .nav-cta {
  margin-left: auto; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: #fff;
  background: var(--grad); padding: 8px 18px; border-radius: 999px;
  box-shadow: var(--clay-brand), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.top-nav .nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px -10px rgba(48, 104, 255, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* ---------- buttons ---------- */
.btn-primary, .btn-secondary, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  height: 44px; padding: 0 24px;
  border-radius: 16px; border: none; cursor: pointer;
  font-family: var(--font-body); font-size: 12.5px; font-weight: 700; line-height: 1;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease, background 0.15s ease;
}
.btn-primary {
  background: var(--grad); color: #fff;
  box-shadow: var(--clay-brand), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px -10px rgba(48, 104, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-primary:active { transform: translateY(0); box-shadow: inset 0 3px 8px rgba(12, 40, 110, 0.35); }
.btn-primary:disabled {
  background: var(--surface-3); color: var(--text-dim);
  box-shadow: var(--clay-press); cursor: not-allowed; transform: none;
  /* some call sites set an inline gradient background, which beats the line above;
     desaturating makes those read as disabled too instead of looking clickable */
  filter: grayscale(0.9) opacity(0.6);
}
.btn-primary.busy-generating,
.btn-primary:disabled.busy-generating,
.ai-action-btn.busy-generating,
.ai-action-btn:disabled.busy-generating {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  filter: none !important;
  opacity: 1 !important;
  font-weight: 700 !important;
  cursor: wait !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45) !important;
  animation: btn-busy-pulse 1.6s ease-in-out infinite alternate;
}
.ai-poster-card .btn-primary.busy-generating,
.ai-poster-card .btn-primary:disabled.busy-generating {
  background: linear-gradient(135deg, #d97706, #b45309) !important;
  box-shadow: 0 4px 14px rgba(180, 83, 9, 0.45) !important;
}
@keyframes btn-busy-pulse {
  from { opacity: 0.92; }
  to { opacity: 1; }
}
.btn-secondary { background: #fff; color: var(--text); box-shadow: var(--clay); }
.btn-secondary:hover { transform: translateY(-1px); box-shadow: var(--clay-hover); color: var(--brand-1); }
.btn-secondary:active { transform: translateY(0); box-shadow: var(--clay-press); }
.btn-secondary:disabled {
  color: var(--text-dim); cursor: not-allowed; background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--border); transform: none;
}
.btn-danger {
  background: #fff; color: var(--red);
  box-shadow: 0 0 0 1px rgba(226, 86, 95, 0.28), 0 10px 22px -14px rgba(226, 86, 95, 0.6), inset 0 1px 0 #fff;
}
.btn-danger:hover { background: #fff5f5; transform: translateY(-1px); }
.btn-sm { height: 36px; padding: 0 16px; font-size: 13px; border-radius: 12px; }
/* Full-width button, usually an <a> acting as one. Do NOT reach for display:block to
   stretch these: the buttons are inline-flex with a fixed height and line-height:1, and
   they rely on that flex to centre their label — block layout leaves the text stuck at
   the top of a 44px box. width alone stretches an inline-flex box perfectly well. */
.btn-block { width: 100%; }

.text-link {
  font-size: 13px; font-weight: 700; color: var(--brand-1);
  background: none; border: none; cursor: pointer; padding: 0;
  font-family: var(--font-body); transition: color 0.15s ease;
}
.text-link:hover { color: var(--brand-2); }
.text-link.danger { color: var(--text-dim); }
.text-link.danger:hover { color: var(--red); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: var(--space-section) 0 64px;
  background:
    radial-gradient(700px 340px at 12% -10%, rgba(255, 255, 255, 0.95), transparent 62%),
    radial-gradient(620px 340px at 58% -20%, rgba(167, 199, 255, 0.6), transparent 62%),
    radial-gradient(560px 320px at 92% 0%, rgba(186, 227, 250, 0.6), transparent 62%);
}
.hero .sub { color: var(--text-soft); font-size: 17px; max-width: 620px; margin-bottom: var(--space-lg); }
.hero-badges { display: flex; gap: var(--space-sm); margin-bottom: var(--space-lg); flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, 0.85); color: var(--text-soft);
  box-shadow: var(--clay);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }

/* ---------- sections + cards ---------- */
.section { padding: var(--space-xxl) 0 var(--space-section); }

.card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-xl); }
@media (max-width: 1200px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 960px)  { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .card-grid { grid-template-columns: 1fr; } }

.project-card {
  background: var(--surface); border: none; border-radius: var(--radius-lg);
  padding: var(--space-md); overflow: hidden;
  box-shadow: var(--clay);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
}
.project-card:hover { transform: translateY(-4px); box-shadow: var(--clay-hover); }
.project-card .plate {
  aspect-ratio: 16 / 9; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--stage); margin-bottom: var(--space-md); position: relative;
  box-shadow: var(--clay-press);
}
.project-card .plate iframe {
  position: absolute; top: 0; left: 0;
  transform-origin: top left; border: 0; pointer-events: none;
}
/* A tile parked by livePlates() is showing about:blank — hide it so the plate's own
   stage colour shows through instead of a white rectangle. */
.project-card .plate iframe[data-parked-src] { visibility: hidden; }
.project-card h4 { margin-bottom: 2px; }
/* kind differentiation: badge on the thumbnail + colored top edge */
.project-card.kind-video, .project-card.kind-image { position: relative; }
.project-card.kind-video::after, .project-card.kind-image::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; z-index: 4;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.project-card.kind-video::after { background: linear-gradient(90deg, #7c5cff, #3068ff); }
.project-card.kind-image::after { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.project-card.kind-image:hover {
  box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.22), 0 2px 5px rgba(23, 43, 84, 0.06),
              0 22px 44px -18px rgba(180, 83, 9, 0.32), inset 0 1px 0 #fff;
}
.plate-kind {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 6px rgba(23, 43, 84, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.plate-kind.video { background: rgba(255, 255, 255, 0.88); color: #5b3fd9; }
.plate-kind.image { background: rgba(255, 255, 255, 0.88); color: #b45309; }

/* projects header row: title + kind filter + search */
.projects-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-md);
  flex-wrap: wrap; margin-bottom: var(--space-lg);
}
.filter-bar { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; }
.kind-filter button { padding: 5px 14px; font-size: 12px; }
.search-input { width: 220px; height: 36px; padding: 0 16px; border-radius: 999px; font-size: 13px; }
.project-card .tagline { font-size: 13px; color: var(--text-dim); margin-bottom: var(--space-md); min-height: 20px; }
.project-card .card-actions { display: flex; align-items: center; justify-content: space-between; }

/* ---------- inputs ---------- */
/* inputs are wells pressed into the clay, so they read as "fill me in" */
.text-input, .select-input, textarea.text-input {
  width: 100%; background: var(--surface-2); color: var(--text);
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  border: none; border-radius: 14px;
  padding: 12px 14px; height: 44px;
  box-shadow: var(--clay-press), 0 0 0 1px var(--border);
  transition: box-shadow 0.16s ease, background 0.16s ease;
}
textarea.text-input { height: auto; min-height: 120px; resize: vertical; line-height: 1.55; }
.text-input:focus, .select-input:focus, textarea.text-input:focus {
  outline: none; background: #fff;
  box-shadow: inset 0 2px 5px rgba(23, 43, 84, 0.06), 0 0 0 3px rgba(48, 104, 255, 0.18), 0 0 0 1px rgba(48, 104, 255, 0.5);
}
.text-input::placeholder { color: var(--text-dim); }
.select-input option { background: #fff; color: var(--text); }
/* selects center their text in the box — vertical padding just clips it when a
   smaller inline height (32px/28px) is used */
select.select-input { padding-top: 0; padding-bottom: 0; line-height: normal; }

.field { margin-bottom: var(--space-lg); }
.field label {
  display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: var(--space-xs);
}
.field .hint { font-size: 12px; color: var(--text-dim); margin-top: var(--space-xxs); }

/* ---------- chips / status ---------- */
.chip {
  display: inline-block; padding: 5px 13px; border-radius: 999px;
  border: none; background: #fff;
  font-size: 12px; font-weight: 600; color: var(--text-soft);
  box-shadow: 0 0 0 1px var(--border), 0 2px 5px -3px rgba(23, 43, 84, 0.4);
}
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7); }

/* ---------- alerts ---------- */
.alert {
  padding: var(--space-md) var(--space-lg); border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: var(--space-md); border: none;
  box-shadow: 0 0 0 1px rgba(29, 51, 99, 0.06), 0 6px 16px -10px rgba(23, 43, 84, 0.4);
}
.alert-error   { background: #fff1f2; color: #b4232d; }
.alert-warning { background: #fff8eb; color: #a15c07; }
.alert-success { background: #ecfdf5; color: #06795a; }
/* Neutral, for telling someone what happens next rather than that something went
   wrong — the account pages say this far more often than they report a failure. */
.alert-info    { background: #eff5ff; color: #1d4ed8; }
.alert a { color: inherit; font-weight: 700; text-decoration: underline; }

/* ---------- studio workspace ---------- */
.studio-grid { display: grid; grid-template-columns: 272px 1fr; height: calc(100vh - 52px); }
.studio-grid.with-inspector { grid-template-columns: 272px 1fr 310px; }
.studio-left {
  padding: var(--space-sm); overflow-y: auto;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.9), 1px 0 18px -12px rgba(23, 43, 84, 0.4);
  display: flex; flex-direction: column; gap: var(--space-sm);
}

/* ---------- sidebar cards ---------- */
.side-card {
  background: var(--surface); border: none; border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  box-shadow: var(--clay);
  display: flex; flex-direction: column; gap: var(--space-xs);
}
.side-card.accent {
  background: linear-gradient(180deg, rgba(15, 157, 118, 0.09), rgba(255, 255, 255, 0) 70px), var(--surface);
  box-shadow: 0 0 0 1px rgba(15, 157, 118, 0.22), 0 1px 2px rgba(23, 43, 84, 0.05),
              0 14px 28px -16px rgba(15, 157, 118, 0.4), inset 0 1px 0 #fff;
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); min-height: 22px; }
.side-title { font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); white-space: nowrap; }
.side-actions { display: flex; gap: 10px; align-items: center; }
.side-actions .text-link { font-size: 11px; font-weight: 700; }
.side-project-name {
  margin: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.select-compact { height: 32px; padding: 2px 12px; font-size: 12px; width: 100%; }

/* new-project kind chooser */
.kind-choice { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
.kind-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: var(--space-md) var(--space-lg);
  background: #fff; border: none; border-radius: var(--radius-sm);
  cursor: pointer; text-align: left; font-family: var(--font-body); color: var(--text);
  box-shadow: var(--clay);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.kind-card:hover { transform: translateY(-2px); box-shadow: var(--clay-hover); }
.kind-card.selected {
  background: linear-gradient(180deg, rgba(48, 104, 255, 0.08), rgba(255, 255, 255, 0));
  box-shadow: 0 0 0 2px rgba(48, 104, 255, 0.55), 0 12px 26px -14px rgba(48, 104, 255, 0.5), inset 0 1px 0 #fff;
}
.kind-icon { font-size: 22px; }
.kind-name { font-weight: 800; font-size: 14px; }
.kind-desc { font-size: 11px; color: var(--text-dim); }

/* segmented toggle — a groove with a raised active pill */
.seg {
  display: inline-flex; background: rgba(217, 227, 244, 0.8);
  border: none; border-radius: 999px; padding: 3px; flex-shrink: 0;
  box-shadow: var(--clay-press);
}
.seg button {
  border: none; background: transparent; color: var(--text-soft);
  font-size: 11px; font-weight: 700; padding: 4px 13px; border-radius: 999px;
  cursor: pointer; font-family: var(--font-body); transition: all 0.15s ease;
}
.seg button.on {
  background: #fff; color: var(--brand-1);
  box-shadow: 0 1px 2px rgba(23, 43, 84, 0.08), 0 4px 10px -6px rgba(23, 43, 84, 0.5);
}
.seg button:not(.on):hover { color: var(--text); }

/* AI create/refine mode toggle */
.ai-mode-seg { display: flex; width: 100%; margin-bottom: 4px; }
.ai-mode-seg button { flex: 1; padding: 6px 10px; }
.ai-mode-seg button:disabled { opacity: 0.45; cursor: not-allowed; }
.ai-mode-hint { font-size: 11px; color: var(--text-dim); margin: 0 2px 8px; line-height: 1.4; width: 100%; }
.ai-action-row { display: flex; gap: var(--space-xs); }
.ai-action-btn { flex: 1; padding: 9px 14px; font-size: 13px; }

/* 3×3 position preset grid */
.pos-grid {
  display: grid; grid-template-columns: repeat(3, 24px); grid-auto-rows: 24px; gap: 4px;
  flex-shrink: 0;
}
.pos-grid button {
  background: #fff; border: none; border-radius: 7px;
  cursor: pointer; position: relative; transition: all 0.14s ease;
  box-shadow: 0 0 0 1px var(--border), 0 2px 4px -2px rgba(23, 43, 84, 0.35);
}
.pos-grid button::after {
  content: ""; position: absolute; inset: 30%; border-radius: 50%;
  background: var(--text-dim); transition: background 0.14s ease;
}
.pos-grid button:hover { box-shadow: 0 0 0 1px rgba(48, 104, 255, 0.5), 0 4px 8px -3px rgba(48, 104, 255, 0.5); }
.pos-grid button:hover::after { background: var(--brand-1); }

/* canvas background swatches */
.bg-swatch-row { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.bg-swatch {
  width: 30px; height: 30px; border-radius: 10px; cursor: pointer; border: none;
  box-shadow: 0 0 0 1px var(--border-strong), 0 3px 6px -3px rgba(23, 43, 84, 0.5);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.bg-swatch:hover { transform: scale(1.14); box-shadow: 0 0 0 2px var(--brand-1), 0 6px 12px -4px rgba(48, 104, 255, 0.55); }

.studio-main { display: flex; flex-direction: column; overflow: hidden; background: transparent; }
.studio-preview {
  flex: 1; min-height: 320px;
  display: grid; place-items: center; position: relative; overflow: hidden;
  background:
    radial-gradient(600px 340px at 20% 0%, rgba(255, 255, 255, 0.9), transparent 62%),
    radial-gradient(520px 320px at 82% 100%, rgba(178, 205, 255, 0.5), transparent 62%),
    linear-gradient(180deg, #e6edf9, #dfe8f6);
}
/* the composition sits on the light stage like a print on a desk */
.studio-preview .frame-holder {
  background: #fff; position: relative; border-radius: var(--radius-sm); overflow: hidden;
  box-shadow: 0 0 0 1px rgba(29, 51, 99, 0.1), 0 30px 60px -24px rgba(23, 43, 84, 0.45);
}
.studio-preview iframe { border: 0; display: block; transform-origin: top left; }

/* Instagram/TikTok safe-zone overlay — shaded areas = platform UI covers them */
.safe-zones { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.safe-zones .sz {
  position: absolute; display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg, rgba(226, 86, 95, 0.16) 0 8px, rgba(226, 86, 95, 0.06) 8px 16px);
  border: 1px dashed rgba(226, 86, 95, 0.6);
}
.safe-zones .sz span {
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: #fff; background: rgba(190, 40, 60, 0.85);
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(23, 43, 84, 0.3);
}
.safe-zones .sz-top { left: 0; right: 0; top: 0; height: 12%; }
.safe-zones .sz-bottom { left: 0; right: 0; bottom: 0; height: 22%; }
.safe-zones .sz-right { right: 0; top: 38%; height: 40%; width: 12%; }
.safe-zones .sz-right span { transform: rotate(90deg); }

/* Floating inline contextual toolbar */
.floating-inline-toolbar {
  position: absolute;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 9px;
  box-shadow:
    0 0 0 1px rgba(29, 51, 99, 0.12),
    0 4px 12px -2px rgba(23, 43, 84, 0.22),
    0 16px 32px -8px rgba(23, 43, 84, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  user-select: none;
  pointer-events: auto;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  animation: fitb-pop-in 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

@keyframes fitb-pop-in {
  from { opacity: 0; transform: scale(0.95) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.fitb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  min-width: 28px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text, #16233d);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.fitb-btn:hover {
  background: rgba(48, 104, 255, 0.08);
  color: var(--brand-1, #3068ff);
}
.fitb-btn:active, .fitb-btn.active {
  background: rgba(48, 104, 255, 0.16);
  color: var(--brand-1, #3068ff);
  border-color: rgba(48, 104, 255, 0.24);
}
.fitb-btn.danger:hover {
  background: rgba(226, 86, 95, 0.12);
  color: #dc2626;
}

.fitb-select {
  height: 28px;
  max-width: 130px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #16233d);
  background: var(--surface-2, #f4f7fd);
  border: 1px solid rgba(29, 51, 99, 0.12);
  border-radius: 6px;
  cursor: pointer;
  outline: none;
}
.fitb-select:focus {
  border-color: var(--brand-1, #3068ff);
  box-shadow: 0 0 0 2px rgba(48, 104, 255, 0.2);
}

.fitb-stepper {
  display: inline-flex;
  align-items: center;
  height: 28px;
  background: var(--surface-2, #f4f7fd);
  border: 1px solid rgba(29, 51, 99, 0.12);
  border-radius: 6px;
  overflow: hidden;
}
.fitb-step-btn {
  height: 100%;
  width: 24px;
  min-width: 24px;
  padding: 0;
  border-radius: 0;
  font-size: 14px;
  font-weight: bold;
}
.fitb-size-val {
  font-size: 12px;
  font-weight: 600;
  padding: 0 4px;
  min-width: 28px;
  text-align: center;
  color: var(--text, #16233d);
  font-variant-numeric: tabular-nums;
}

.fitb-color-btn {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(29, 51, 99, 0.2), 0 1px 3px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  overflow: hidden;
  vertical-align: middle;
}
.fitb-color-btn input[type="color"] {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 40px;
  height: 40px;
  opacity: 0;
  cursor: pointer;
  border: none;
}

.fitb-divider {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: rgba(29, 51, 99, 0.12);
  margin: 0 2px;
}

.studio-bottom {
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.9), 0 -10px 30px -18px rgba(23, 43, 84, 0.45);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  max-height: 42vh; overflow-y: auto; /* tall timelines scroll instead of squeezing the preview */
}

.scrub-bar {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-sm) var(--space-lg);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 -1px 0 var(--border);
}
.scrub-bar input[type="range"] { flex: 1; accent-color: var(--brand-1); height: 4px; }
.scrub-time { font-size: 12px; color: var(--text-dim); min-width: 110px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- ai prompt + assets ---------- */
textarea.prompt-box {
  min-height: 220px; font-size: 13.5px; line-height: 1.65;
  background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 14px 16px;
  box-shadow: var(--clay-press), 0 0 0 1px var(--border);
}
textarea.prompt-box:focus {
  background: #fff;
  box-shadow: inset 0 2px 5px rgba(23, 43, 84, 0.05), 0 0 0 3px rgba(15, 157, 118, 0.18), 0 0 0 1px rgba(15, 157, 118, 0.55);
}

.upload-drop {
  display: block; text-align: center; cursor: pointer;
  padding: var(--space-md); border: 1.5px dashed rgba(29, 51, 99, 0.22); border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 13px; font-weight: 600;
  background: rgba(255, 255, 255, 0.5);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.upload-drop:hover { border-color: var(--brand-1); color: var(--brand-1); background: rgba(48, 104, 255, 0.06); }
.upload-drop input[type="file"] { display: none; }

.asset-list { margin-top: var(--space-sm); display: flex; flex-direction: column; gap: var(--space-xs); }
.asset-row {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-xs); border: none; border-radius: 12px; background: #fff;
  box-shadow: 0 0 0 1px var(--border), 0 3px 8px -6px rgba(23, 43, 84, 0.5);
}
.asset-row img { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; flex: none; background: var(--stage); }
.asset-icon {
  width: 44px; height: 44px; flex: none; border-radius: 10px;
  display: grid; place-items: center; font-size: 18px;
  background: var(--grad-soft); color: var(--brand-1);
}
.asset-meta { flex: 1; min-width: 0; cursor: pointer; }
.asset-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-meta:hover .asset-name { color: var(--brand-1); }

/* ---------- timeline strip ---------- */
.timeline-strip { padding: var(--space-md) var(--space-lg); overflow-x: auto; }
.timeline-track { display: flex; align-items: stretch; min-height: 30px; position: relative; margin-bottom: 6px; }
.timeline-track .track-label { width: 48px; flex: none; align-self: center; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; color: var(--text-dim); }
.timeline-lane {
  position: relative; flex: 1; height: 100%; border-radius: 10px;
  background: rgba(217, 227, 244, 0.85); box-shadow: var(--clay-press);
}
.timeline-item {
  position: absolute; border-radius: 9px;
  color: #fff; font-size: 11px; font-weight: 700;
  padding: 0 8px; display: flex; align-items: center;
  overflow: hidden; white-space: nowrap; min-width: 26px;
  background: linear-gradient(135deg, #3068ff, #5b8bff);
  box-shadow: 0 4px 10px -4px rgba(23, 43, 84, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.timeline-track:nth-child(2n) .timeline-item { background: linear-gradient(135deg, #7c5cff, #a78bfa); }
.timeline-track:nth-child(3n) .timeline-item { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.timeline-track:nth-child(4n) .timeline-item { background: linear-gradient(135deg, #d97706, #f59e0b); }
.timeline-item.audio { background: linear-gradient(135deg, #0f9d76, #34d399); }
.timeline-item { cursor: grab; transition: filter 0.12s ease; user-select: none; touch-action: none; }
.timeline-item.dragging { cursor: grabbing; filter: brightness(1.12) saturate(1.15); z-index: 10; transition: none; }
.tl-handle {
  position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 2;
}
.tl-handle.l { left: 0; border-left: 3px solid rgba(255, 255, 255, 0.0); }
.tl-handle.r { right: 0; border-right: 3px solid rgba(255, 255, 255, 0.0); }
.timeline-item:hover .tl-handle.l { border-left-color: rgba(255, 255, 255, 0.9); }
.timeline-item:hover .tl-handle.r { border-right-color: rgba(255, 255, 255, 0.9); }
.timeline-item:hover { filter: brightness(1.08); }
.timeline-item.selected {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  box-shadow: 0 6px 16px -4px rgba(23, 43, 84, 0.6);
}

/* ---------- text inspector ---------- */
.inspector {
  margin: 0 var(--space-lg) var(--space-md);
  padding: var(--space-lg);
  border: none;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--clay);
}
.inspector-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-sm); }
.inspector-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }
@media (max-width: 1200px) { .inspector-grid { grid-template-columns: repeat(2, 1fr); } }

/* Add-element / selected-element panels dock as a third column beside the
   preview instead of sitting inline under the timeline (which forced a scroll
   past a tall timeline) or floating over the preview (which blocked dragging
   elements there). Docking reserves its own space, so it never covers either. */
.studio-side-inspector {
  background: rgba(255, 255, 255, 0.6);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.9), -1px 0 18px -12px rgba(23, 43, 84, 0.4);
  padding: var(--space-lg); overflow-y: auto;
  animation: sidein 180ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.studio-side-inspector .inspector { margin: 0; border: none; padding: 0; background: transparent; box-shadow: none; }
.studio-side-inspector .inspector-grid { grid-template-columns: repeat(2, 1fr); }
.studio-side-inspector .inspector-head { flex-wrap: wrap; row-gap: var(--space-xs); }
@keyframes sidein { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@media (max-width: 1300px) { .studio-grid.with-inspector { grid-template-columns: 340px 1fr 340px; } }
.color-swatch {
  width: 44px; height: 44px; padding: 2px; flex: none;
  border: none; border-radius: 12px;
  background: #fff; cursor: pointer;
  box-shadow: 0 0 0 1px var(--border-strong), 0 3px 8px -4px rgba(23, 43, 84, 0.5);
}
/* the native colour well is a hard-edged rectangle; round it so a colour field reads
   as a clay chip rather than a black bar (most visible when the value is empty) */
input.color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
input.color-swatch::-webkit-color-swatch { border: none; border-radius: 9px; }
input.color-swatch::-moz-color-swatch { border: none; border-radius: 9px; }

/* ---------- code editor ---------- */
.code-editor {
  width: 100%; min-height: 220px; resize: vertical;
  font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; line-height: 1.55;
  border: none; border-radius: var(--radius-sm); padding: var(--space-lg);
  color: #24314f; background: #f7f9fe;
  box-shadow: var(--clay-press), 0 0 0 1px var(--border);
  white-space: pre; tab-size: 2;
}
.code-editor:focus {
  outline: none;
  box-shadow: inset 0 2px 5px rgba(23, 43, 84, 0.05), 0 0 0 3px rgba(48, 104, 255, 0.18), 0 0 0 1px rgba(48, 104, 255, 0.5);
}

/* ---------- render queue ---------- */
.job-row {
  display: grid; grid-template-columns: 1fr auto; gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl); border: none; border-radius: var(--radius-lg);
  margin-bottom: var(--space-md); background: var(--surface);
  box-shadow: var(--clay);
}
.progress-outer {
  height: 10px; background: rgba(217, 227, 244, 0.9); border-radius: 999px;
  margin-top: var(--space-sm); overflow: hidden; box-shadow: var(--clay-press);
}
.progress-inner {
  height: 100%; background: var(--grad); border-radius: 999px;
  transition: width 0.2s linear;
  box-shadow: 0 0 10px rgba(48, 104, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.meta-line { font-size: 12px; color: var(--text-dim); }
.panel-label { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }

/* ---------- ai stream panel ---------- */
.ai-stream-panel {
  border: none; border-radius: var(--radius-sm); overflow: hidden; background: #f7f9fe;
  box-shadow: var(--clay-press), 0 0 0 1px var(--border);
}
.ai-stream-head {
  display: flex; align-items: center; gap: var(--space-xs);
  padding: 9px var(--space-md);
  font-size: 12px; font-weight: 700; color: var(--text-soft);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 0 var(--border);
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand-1);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; box-shadow: 0 0 0 3px rgba(48, 104, 255, 0.2); } 50% { opacity: 0.4; box-shadow: none; } }
.ai-stream {
  font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; line-height: 1.5;
  color: #5b6a8c; padding: var(--space-md);
  min-height: 140px; max-height: 260px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
  display: flex; flex-direction: column-reverse; /* keeps scroll pinned to the newest text */
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(22, 35, 61, 0.28); z-index: 200;
  display: grid; place-items: center;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.modal {
  background: var(--surface); width: min(540px, 92vw);
  padding: var(--space-xxl); border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--clay-lg);
  max-height: 88vh; overflow-y: auto;
}
.modal-wide { width: min(1200px, 96vw); }

/* ---------- generation progress overlay (glass) ---------- */
.generating-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  z-index: 30; overflow: hidden; border-radius: inherit;
  background: linear-gradient(160deg, rgba(233, 240, 252, 0.72), rgba(222, 231, 248, 0.82));
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  animation: genFadeIn 0.35s ease-out both;
}
@keyframes genFadeIn { from { opacity: 0; } to { opacity: 1; } }
/* drifting aurora blobs behind the card */
.generating-overlay::before,
.generating-overlay::after {
  content: ""; position: absolute; width: 55%; aspect-ratio: 1; border-radius: 50%;
  filter: blur(70px); opacity: 0.65; pointer-events: none;
}
.generating-overlay::before {
  background: radial-gradient(circle, rgba(124, 92, 255, 0.45), transparent 65%);
  top: -15%; left: -10%; animation: genDriftA 9s ease-in-out infinite alternate;
}
.generating-overlay::after {
  background: radial-gradient(circle, rgba(23, 182, 232, 0.4), transparent 65%);
  bottom: -20%; right: -10%; animation: genDriftB 11s ease-in-out infinite alternate;
}
@keyframes genDriftA { to { transform: translate(20%, 25%) scale(1.15); } }
@keyframes genDriftB { to { transform: translate(-22%, -20%) scale(1.1); } }

.generating-card {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: min(400px, 84%); padding: 26px 28px 20px; text-align: center;
  background: rgba(255, 255, 255, 0.82);
  border: none; border-radius: var(--radius-lg);
  box-shadow: var(--clay-lg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
/* sheen sweeping across the glass card */
.generating-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.55) 50%, transparent 60%);
  background-size: 250% 100%; animation: genSheen 2.6s ease-in-out infinite;
}
@keyframes genSheen { 0% { background-position: 130% 0; } 100% { background-position: -130% 0; } }

.generating-title { font-size: 15px; font-weight: 800; color: var(--text); letter-spacing: 0.01em; }
.generating-title .gen-dots span {
  display: inline-block; width: 4px; height: 4px; margin-left: 4px; border-radius: 50%;
  background: currentColor; vertical-align: middle; opacity: 0.3;
  animation: genDot 1.2s ease-in-out infinite;
}
.generating-title .gen-dots span:nth-child(2) { animation-delay: 0.2s; }
.generating-title .gen-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes genDot { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.generating-sub {
  font-size: 11px; color: var(--text-dim); max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
/* indeterminate shimmer progress bar */
.generating-bar {
  width: 100%; height: 4px; border-radius: 999px; overflow: hidden;
  background: rgba(29, 51, 99, 0.1);
}
.generating-bar i {
  display: block; height: 100%; width: 40%; border-radius: inherit;
  background: linear-gradient(90deg, #3068ff, #17b6e8);
  animation: genBar 1.4s ease-in-out infinite;
}
@keyframes genBar { 0% { transform: translateX(-110%); } 100% { transform: translateX(280%); } }

/* pulsing gradient orb */
.generating-spinner {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; position: relative;
  background: conic-gradient(from 0deg, #3068ff, #17b6e8, #7c5cff, #3068ff);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation: genspin 1.1s linear infinite;
}
@keyframes genspin { to { transform: rotate(360deg); } }
.generating-spinner.sm {
  width: 12px; height: 12px;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.5px), #000 calc(100% - 2px));
}

/* live render progress chip in the scrub bar */
.render-chip {
  display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0;
  font-size: 11px; font-weight: 700; color: var(--brand-1);
  background: #fff; border: none;
  border-radius: 999px; padding: 5px 12px; white-space: nowrap;
  box-shadow: 0 0 0 1px rgba(48, 104, 255, 0.28), 0 4px 10px -6px rgba(48, 104, 255, 0.6);
}
.render-chip.done {
  color: #06795a;
  box-shadow: 0 0 0 1px rgba(15, 157, 118, 0.35), 0 4px 10px -6px rgba(15, 157, 118, 0.6);
}
.render-chip.done a { color: #06795a; text-decoration: none; }
.render-chip.failed {
  color: #b4232d;
  box-shadow: 0 0 0 1px rgba(226, 86, 95, 0.35), 0 4px 10px -6px rgba(226, 86, 95, 0.6);
}
.render-chip.failed a { color: #b4232d; text-decoration: none; }

/* ---------- Jamendo music library ---------- */
.music-result-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; }
.music-row {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px;
  background: #fff; border: none; border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--border), 0 4px 12px -8px rgba(23, 43, 84, 0.5);
}
.music-row img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.music-row audio { height: 30px; width: 240px; flex-shrink: 0; }
.music-meta { flex: 1; min-width: 0; }
.music-name { font-weight: 700; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.music-artist { font-size: 12px; color: var(--text-dim); }
.music-artist a { color: var(--brand-1); }
.prompt-chip.active { color: var(--brand-1); box-shadow: 0 0 0 1.5px var(--brand-1); }

/* picker dialogs: one scrollbar only — the template grid scrolls, the dialog never does */
.modal-picker { display: flex; flex-direction: column; overflow: hidden; height: 88vh; }
.modal-picker > .template-modal-grid { flex: 1; min-height: 0; overflow-y: auto; }
.modal-picker .picker-field { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.modal-picker .picker-field .template-modal-grid { flex: 1; min-height: 0; overflow-y: auto; }

/* ---------- template picker ---------- */
.template-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md);
  max-height: 340px; overflow-y: auto; padding: 4px;
}
@media (max-width: 640px) { .template-grid { grid-template-columns: repeat(2, 1fr); } }
.template-pick {
  display: flex; flex-direction: column; gap: 4px; text-align: left;
  padding: var(--space-md) var(--space-lg); border-radius: var(--radius-sm);
  background: #fff; border: none;
  cursor: pointer; font-family: var(--font-body);
  box-shadow: var(--clay);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.template-pick:hover { transform: translateY(-2px); box-shadow: var(--clay-hover); }
.template-pick.selected {
  background: linear-gradient(180deg, rgba(48, 104, 255, 0.08), rgba(255, 255, 255, 0));
  box-shadow: 0 0 0 2px rgba(48, 104, 255, 0.55), 0 12px 26px -14px rgba(48, 104, 255, 0.5), inset 0 1px 0 #fff;
}
.template-pick-name { font-size: 13.5px; font-weight: 800; color: var(--text); }
.template-pick-desc { font-size: 12px; color: var(--text-dim); line-height: 1.35; }

/* ---------- history ---------- */
.history-item { padding: var(--space-sm) 0; box-shadow: 0 1px 0 var(--border); }
.history-item .prompt-text { font-size: 13px; color: var(--text-soft); cursor: pointer; transition: color 0.15s ease; }
.history-item .prompt-text:hover { color: var(--brand-1); }

/* ---------- video tabs (multi-video projects) ---------- */
.video-tabs {
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 0 var(--border);
  overflow-x: auto; flex-wrap: nowrap; min-height: 48px;
}
.video-tab {
  border: none; background: #fff; color: var(--text-soft);
  border-radius: 999px; padding: 6px 15px; font-size: 12.5px; font-weight: 700;
  cursor: pointer; white-space: nowrap; font-family: var(--font-body);
  box-shadow: 0 0 0 1px var(--border), 0 3px 8px -6px rgba(23, 43, 84, 0.5);
  transition: color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.video-tab:hover { color: var(--text); transform: translateY(-1px); box-shadow: var(--clay); }
.video-tab.active {
  color: #fff; background: var(--grad);
  box-shadow: var(--clay-brand), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.video-tab.add { background: transparent; box-shadow: 0 0 0 1.5px rgba(29, 51, 99, 0.18); color: var(--text-dim); }
.video-tab.add:hover { color: var(--brand-1); box-shadow: 0 0 0 1.5px var(--brand-1); }

/* ---------- render gallery ---------- */
.render-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: var(--space-xl);
}
.render-project {
  border: none; border-radius: var(--radius-lg);
  background: var(--surface); padding: var(--space-xl); margin-bottom: var(--space-lg);
  box-shadow: var(--clay);
}
.render-project-head {
  display: flex; align-items: baseline; gap: var(--space-md);
  padding-bottom: var(--space-sm); margin-bottom: var(--space-md);
  box-shadow: 0 1px 0 var(--border);
}
.render-video-head {
  font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim); margin: var(--space-md) 0 var(--space-sm);
}
.render-card { cursor: pointer; }
.render-card .render-thumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--stage); border: none;
  margin-bottom: var(--space-sm);
  box-shadow: var(--clay);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.render-card:hover .render-thumb { transform: translateY(-3px); box-shadow: var(--clay-hover); }
.render-thumb video, .render-thumb img {
  width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 0;
  pointer-events: none;
}
.render-play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--brand-1); background: rgba(255, 255, 255, 0.55);
  opacity: 0; transition: opacity 0.15s ease;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.render-card:hover .render-play { opacity: 1; }
.render-badge {
  position: absolute; right: 7px; bottom: 7px;
  font-size: 10px; font-weight: 800; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 8px; color: var(--text-soft);
  background: rgba(255, 255, 255, 0.92); border: none;
  box-shadow: 0 2px 6px rgba(23, 43, 84, 0.16);
}
.render-del {
  position: absolute; top: 7px; right: 7px;
  width: 28px; height: 28px; border-radius: 10px;
  display: grid; place-items: center; font-size: 13px;
  background: rgba(255, 255, 255, 0.94); color: var(--text-soft);
  border: none; cursor: pointer;
  box-shadow: 0 2px 8px rgba(23, 43, 84, 0.2);
  opacity: 0; transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.render-card:hover .render-del { opacity: 1; }
.render-del:hover { color: #fff; background: var(--red); }
.render-title {
  font-size: 13.5px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.player-modal { width: min(960px, 94vw); }
.player-media {
  display: block; width: 100%; max-height: 68vh; background: #0f1729;
  border-radius: var(--radius-sm); object-fit: contain;
  box-shadow: var(--clay-press);
}

/* ---------- storyboard frame strip (live animated mini-viewports) ---------- */
.storyboard-strip-container {
  background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 0 var(--border) inset;
  padding: 14px 18px; display: flex; flex-direction: column; gap: 10px;
}
.storyboard-header-row {
  display: flex; align-items: center; justify-content: space-between;
}
.storyboard-frames-scroll {
  display: flex; gap: 14px; overflow-x: auto; padding: 6px 2px 12px;
  align-items: center; scroll-behavior: smooth;
}
.frame-card {
  position: relative; flex: 0 0 160px; height: 110px;
  border-radius: var(--radius-sm); background: #fff;
  border: none; overflow: hidden;
  cursor: pointer; display: flex; flex-direction: column;
  box-shadow: var(--clay);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.frame-card:hover { transform: translateY(-3px); box-shadow: var(--clay-hover); }
.frame-card.active {
  box-shadow: 0 0 0 2px var(--brand-1), 0 12px 26px -12px rgba(48, 104, 255, 0.55), inset 0 1px 0 #fff;
}
.frame-card-preview-holder {
  position: relative; width: 100%; flex: 1; overflow: hidden; background: var(--stage);
  pointer-events: none;
}
.frame-mini-iframe {
  position: absolute; top: 0; left: 0; border: none;
  transform-origin: top left; pointer-events: none;
}
.frame-engine-tag {
  position: absolute; top: 6px; left: 6px; z-index: 10;
  display: flex; align-items: center; gap: 4px;
  background: rgba(255, 255, 255, 0.94); color: #06795a;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: 999px; box-shadow: 0 2px 8px rgba(23, 43, 84, 0.18);
}
.frame-engine-tag.remotion { background: rgba(255, 255, 255, 0.94); color: #0d7f8f; }
.frame-engine-tag.html { background: rgba(255, 255, 255, 0.94); color: #5b3fd9; }
.frame-edit-icon {
  position: absolute; top: 6px; right: 6px; z-index: 10;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--green); color: #fff; display: grid; place-items: center;
  font-size: 10px; box-shadow: 0 2px 6px rgba(15, 157, 118, 0.5);
}
.frame-card-footer {
  padding: 5px 9px; background: rgba(244, 247, 253, 0.95);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-family: "Space Mono", Consolas, monospace;
  box-shadow: 0 -1px 0 var(--border);
}
.frame-card-footer .frame-label {
  font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.frame-card-footer .frame-dur { color: var(--text-dim); }

/* Prompt helper chips under the AI prompt box */
.prompt-chip-row {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap;
}
.prompt-chip-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-dim);
}
.prompt-chip {
  border: none; background: #fff;
  color: var(--text-soft); font-size: 11px; font-weight: 700;
  padding: 4px 11px; border-radius: 999px; cursor: pointer;
  box-shadow: 0 0 0 1px var(--border), 0 2px 6px -4px rgba(23, 43, 84, 0.5);
  transition: all 0.15s ease;
}
.prompt-chip:hover { color: var(--green); box-shadow: 0 0 0 1.5px rgba(15, 157, 118, 0.6); }
.prompt-chip:disabled { opacity: 0.45; cursor: default; }
.prompt-chip:disabled:hover { color: var(--text-soft); box-shadow: 0 0 0 1px var(--border); }
.prompt-chip.saved-chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: default;
  max-width: 220px; overflow: hidden;
}
.prompt-chip .chip-x { cursor: pointer; color: var(--text-dim); font-size: 10px; }
.prompt-chip .chip-x:hover { color: var(--red); }

/* Timeline ruler + playhead — the red line syncs with the seek bar; drag the ruler to scrub */
.timeline-ruler {
  position: relative; height: 22px; margin: 0 50px 6px 0;
  cursor: grab; touch-action: none; user-select: none;
  box-shadow: 0 1px 0 var(--border-strong);
}
.timeline-ruler:active { cursor: grabbing; }
.ruler-tick { position: absolute; bottom: 0; width: 1px; height: 6px; background: rgba(29, 51, 99, 0.25); }
.ruler-tick span {
  position: absolute; bottom: 7px; left: 2px; font-size: 9px; color: var(--text-dim);
  font-family: "Space Mono", Consolas, monospace; white-space: nowrap;
}
.ruler-playhead {
  position: absolute; top: 0; bottom: -3px; width: 2px; margin-left: -1px;
  background: #e11d48; z-index: 4; pointer-events: none;
}
.ruler-playhead::after {
  content: ""; position: absolute; top: 0; left: -4px;
  border: 5px solid transparent; border-top-color: #e11d48;
}
.ruler-time {
  position: absolute; top: -2px; left: 8px; font-size: 9.5px; font-weight: 800; color: #e11d48;
  font-family: "Space Mono", Consolas, monospace; white-space: nowrap;
}
.timeline-lanes { position: relative; }
.lanes-playhead-layer {
  position: absolute; top: 0; bottom: 0; left: 0; right: 50px;
  pointer-events: none; z-index: 6;
}
.lanes-playhead {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: rgba(225, 29, 72, 0.9);
  box-shadow: 0 0 6px rgba(225, 29, 72, 0.45);
}

/* Timeline frame lane — frames as preview tiles, width ∝ duration */
.timeline-frame-lane {
  display: flex; gap: 7px; width: 100%; margin-bottom: 12px;
}
.timeline-frame-tile {
  position: relative; height: 64px; min-width: 56px;
  border: none; border-radius: 10px;
  overflow: hidden; cursor: move; background: var(--stage);
  box-shadow: 0 0 0 1px var(--border), 0 4px 10px -8px rgba(23, 43, 84, 0.6);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.timeline-frame-tile:hover { transform: translateY(-2px); box-shadow: var(--clay); }
.timeline-frame-tile.active { box-shadow: 0 0 0 2px var(--brand-1), 0 8px 18px -10px rgba(48, 104, 255, 0.6); }
.timeline-frame-tile.drag-over { box-shadow: 0 0 0 2px var(--brand-2), 0 8px 18px -10px rgba(124, 92, 255, 0.6); }
.timeline-frame-tile iframe {
  position: absolute; top: 0;
  border: none; transform-origin: top left; pointer-events: none;
}
.timeline-frame-tile .tile-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 8px; font-size: 10px; font-weight: 800;
  font-family: "Space Mono", Consolas, monospace;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.94));
  color: var(--text);
}
.timeline-frame-tile .tile-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline-frame-tile .tile-dur { color: var(--green); margin-left: 6px; }
.timeline-frame-tile .tile-regen {
  position: absolute; top: 4px; left: 4px; z-index: 3;
  opacity: 0; font-size: 9px; padding: 1px 6px;
}
.timeline-frame-tile:hover .tile-regen { opacity: 1; }
.timeline-frame-tile .tile-qa-warn {
  position: absolute; top: 4px; right: 6px; z-index: 3; font-size: 13px;
  filter: drop-shadow(0 1px 3px rgba(255, 255, 255, 0.9));
}
.timeline-add-frame {
  flex: 0 0 44px; height: 64px; border-radius: 10px;
  border: 1.5px dashed rgba(29, 51, 99, 0.2); background: rgba(255, 255, 255, 0.6);
  color: var(--text-dim); font-size: 20px; cursor: pointer;
  transition: all 0.15s ease;
}
.timeline-add-frame:hover { border-color: var(--green); color: var(--green); background: rgba(15, 157, 118, 0.06); }

.frame-engine-tag.clickable {
  border: none; cursor: pointer; font-family: inherit;
  transition: all 0.15s ease;
}
.frame-engine-tag.clickable:hover:not(:disabled) {
  transform: scale(1.05); box-shadow: 0 4px 14px rgba(23, 43, 84, 0.25);
}
.frame-engine-tag.clickable:disabled { opacity: 0.5; cursor: default; }
.frame-regen-overlay {
  position: absolute; inset: 0; z-index: 11;
  display: grid; place-items: center;
  background: rgba(236, 253, 245, 0.85); color: #06795a;
  font-size: 11px; font-weight: 800; letter-spacing: 0.05em;
  animation: regenPulse 1.2s ease-in-out infinite;
}
@keyframes regenPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.frame-action-card {
  flex: 0 0 100px; height: 110px; border-radius: var(--radius-sm);
  border: 1.5px dashed rgba(29, 51, 99, 0.2); background: rgba(255, 255, 255, 0.6);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer; color: var(--text-dim); font-size: 12px; font-weight: 700;
  transition: all 0.15s ease;
}
.frame-action-card:hover {
  color: var(--brand-1); border-color: var(--brand-1); background: rgba(48, 104, 255, 0.06);
}

/* ---------- live frame text inspector panel ---------- */
.frame-text-inspector {
  display: flex; flex-direction: column; gap: var(--space-md);
}
.done-editing-badge {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: #ecfdf5; border: none;
  color: #06795a; font-size: 12px; font-weight: 800; padding: 5px 12px; border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(15, 157, 118, 0.3), 0 4px 10px -6px rgba(15, 157, 118, 0.6);
}
.done-editing-badge:hover { background: #d9fbee; }
.editable-field-card {
  background: #fff; border: none;
  border-radius: var(--radius-sm); padding: var(--space-md);
  box-shadow: var(--clay);
  display: flex; flex-direction: column; gap: 6px;
}
.editable-field-card label {
  font-size: 11.5px; font-weight: 800; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em;
}
.editable-field-card input, .editable-field-card textarea {
  font-size: 13.5px; color: var(--text); background: var(--surface-2);
  border: none; border-radius: 10px; padding: 8px 11px;
  box-shadow: var(--clay-press), 0 0 0 1px var(--border);
}

/* ---------- audio track bar ---------- */
.audio-track-bar {
  background: #fff; border: none;
  border-radius: var(--radius-sm); padding: 9px 15px;
  box-shadow: var(--clay);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.audio-track-bar .track-title {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text);
}

/* footer */
.footer .meta-line, .footer { color: var(--text-soft); }
/* body is a flex column, so an auto top margin drops the footer to the bottom of the
   viewport on pages whose content is shorter than the screen */
.footer { margin-top: auto; }
.footer {
  padding: var(--space-xl) 0; background: rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 -1px 0 var(--border);
}

/* ---------- pick a template visual modal ---------- */
.template-modal {
  width: min(1500px, 96vw); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: none; border-radius: var(--radius-lg);
  box-shadow: var(--clay-lg);
}
.template-modal-header {
  display: flex; align-items: center; justify-content: space-between; padding: 20px 26px;
  box-shadow: 0 1px 0 var(--border);
}
.template-modal-header h3 {
  margin: 0; font-size: 22px; font-weight: 700; color: var(--text);
}
.template-modal-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  grid-auto-rows: max-content; align-content: start;
  gap: 22px; padding: 26px; overflow-y: auto; flex: 1;
}
.template-modal-card {
  background: #fff; border: none; border-radius: var(--radius-sm);
  overflow: hidden; cursor: pointer; display: flex; flex-direction: column;
  box-shadow: var(--clay);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); text-align: left;
}
.template-modal-card:hover { transform: translateY(-4px); box-shadow: var(--clay-hover); }
.template-modal-card.selected {
  box-shadow: 0 0 0 2px var(--brand-1), 0 18px 36px -16px rgba(48, 104, 255, 0.5), inset 0 1px 0 #fff;
}
.template-modal-preview-holder {
  position: relative; width: 100%; height: 150px; background: var(--stage); overflow: hidden;
  box-shadow: inset 0 -1px 0 var(--border); flex-shrink: 0;
}
.template-modal-preview-holder iframe {
  position: absolute; top: 0; left: 0; border: none; transform-origin: top left; pointer-events: none;
}
.template-modal-body {
  padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; justify-content: space-between;
}
.template-modal-title {
  font-size: 16px; font-weight: 700; color: var(--text);
}
.template-modal-desc {
  font-size: 12.5px; color: var(--text-soft); line-height: 1.45; flex: 1;
}
.template-tag-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.template-tag-pill {
  font-size: 10.5px; font-family: "Space Mono", monospace; padding: 3px 9px;
  border-radius: 999px; background: var(--surface-3); color: var(--text-soft);
  border: none;
}

@media (max-width: 1024px) {
  h1 { font-size: 38px; }
  .studio-grid, .studio-grid.with-inspector { grid-template-columns: 1fr; height: auto; }
  .studio-left { box-shadow: 0 1px 0 var(--border); }
  .studio-side-inspector { box-shadow: 0 -1px 0 var(--border); max-height: 60vh; }
}

/* ---------- top-nav auth (user + logout) ---------- */
.top-nav .nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-nav .nav-right .nav-cta { margin-left: 0; }
.top-nav .nav-user {
  font-size: 12px; font-weight: 700; color: var(--text-soft);
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.top-nav .nav-logout-form { margin: 0; display: inline; }
.top-nav .nav-logout {
  background: #fff; border: none; color: var(--text-soft);
  font-size: 12px; font-weight: 700; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  box-shadow: 0 0 0 1px var(--border), 0 3px 8px -6px rgba(23, 43, 84, 0.5);
  transition: color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.top-nav .nav-logout:hover { color: var(--red); transform: translateY(-1px); box-shadow: var(--clay); }

/* ---------- showcase & demos (built-in read-only projects) ---------- */
.showcase-section { padding-bottom: var(--space-xl); }

.showcase-head { align-items: flex-end; }
.showcase-head .showcase-title { display: flex; flex-direction: column; gap: var(--space-xs); min-width: 0; }
.showcase-head .showcase-title .meta-line { max-width: 60ch; }
.showcase-count {
  background: var(--grad); color: #fff; border: none;
  font-weight: 800; letter-spacing: 0.02em; white-space: nowrap; flex-shrink: 0;
  box-shadow: var(--clay-brand);
}

/* the demo grid tints its cards so they read as "ours", not "yours" */
.project-card.showcase {
  position: relative;
  background: linear-gradient(180deg, #fbfcff, #ffffff 90px);
  border: none;
  padding-top: calc(var(--space-md) + 4px);
}
/* gradient top edge replaces the per-kind colored edge */
.project-card.showcase::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--grad); z-index: 3;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.project-card.showcase::after { display: none; }
.project-card.showcase:hover {
  box-shadow: 0 0 0 1px rgba(124, 92, 255, 0.22), 0 2px 6px rgba(23, 43, 84, 0.06),
              0 26px 50px -20px rgba(124, 92, 255, 0.4), inset 0 1px 0 #fff;
}
.project-card.showcase.kind-image:hover {
  box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.22), 0 2px 6px rgba(23, 43, 84, 0.06),
              0 26px 50px -20px rgba(180, 83, 9, 0.34), inset 0 1px 0 #fff;
}

.showcase-ribbon {
  position: absolute; top: 9px; right: 9px; z-index: 2;
  background: var(--grad); color: #fff;
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
  box-shadow: 0 4px 12px -4px rgba(48, 104, 255, 0.7);
}

.showcase-meta { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-bottom: var(--space-md); }
.showcase-readonly {
  padding: 4px 11px; font-size: 11px; font-weight: 700;
  background: var(--surface-3); color: var(--text-dim); box-shadow: none;
}

.project-card.showcase .card-actions { gap: var(--space-sm); }
.showcase-dup {
  height: 34px; padding: 0 15px; font-size: 12px; border-radius: 12px;
  white-space: nowrap; min-width: 0;
}

@media (max-width: 640px) {
  .showcase-head { align-items: flex-start; }
  .project-card.showcase .card-actions { flex-wrap: wrap; }
}

/* demo gallery toggle: your own projects are the default view */
.btn-sm.demos-toggle {
  height: 36px; padding: 0 15px; font-size: 12px; border-radius: 999px; white-space: nowrap;
}
.btn-sm.demos-toggle.on {
  color: #fff; background: var(--grad);
  box-shadow: var(--clay-brand), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.showcase-head .filter-bar { gap: var(--space-sm); }

/* .text-input { width: 100% } is declared after .search-input and wins on equal
   specificity, so the search box stretched and forced the filter row to wrap. */
.filter-bar .search-input { width: 220px; flex: 0 0 220px; }
.projects-head { row-gap: var(--space-sm); }
@media (max-width: 720px) { .filter-bar .search-input { flex: 1 1 160px; width: auto; } }

/* export-finished banner: a render takes minutes, so completion must be unmissable */
.export-ready {
  position: fixed; z-index: 300; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--space-lg);
  max-width: min(680px, calc(100vw - 32px));
  padding: 14px 16px; border-radius: var(--radius);
  background: #fff;
  border: none;
  box-shadow: 0 0 0 1px rgba(15, 157, 118, 0.28), 0 26px 60px -22px rgba(23, 43, 84, 0.5),
              inset 0 1px 0 #fff;
  animation: exportReadyIn 0.34s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes exportReadyIn {
  from { opacity: 0; transform: translateX(-50%) translateY(14px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.export-ready-icon {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #0f9d76, #34d399);
  box-shadow: 0 6px 16px -6px rgba(15, 157, 118, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.export-ready-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.export-ready-body strong { color: var(--text); font-size: 13.5px; }
.export-ready-body .meta-line { font-size: 11.5px; }
.export-ready-actions { display: flex; align-items: center; gap: var(--space-sm); margin-left: auto; flex-shrink: 0; }
.export-ready-actions .btn-primary, .export-ready-actions .btn-secondary { text-decoration: none; }
@media (max-width: 640px) {
  .export-ready { flex-wrap: wrap; }
  .export-ready-actions { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .export-ready { animation: none; } }

/* ---- Renders: download affordances + ephemeral-file notice ---- */
.renders-retention {
  display: flex; align-items: flex-start; gap: var(--space-sm);
  margin: var(--space-md) 0 var(--space-lg);
  padding: var(--space-md) var(--space-lg); border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.5; color: #8a5209;
  background: #fff8eb; border: none;
  box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.2), 0 8px 20px -14px rgba(180, 83, 9, 0.6);
}
.renders-retention strong { color: #7c4708; font-weight: 800; }
.renders-retention-icon { flex-shrink: 0; font-size: 14px; line-height: 1.5; }
.renders-retention-inline { color: #a15c07; }
.render-dl {
  position: absolute; top: 7px; right: 41px;
  width: 28px; height: 28px; border-radius: 10px;
  display: grid; place-items: center; font-size: 14px; text-decoration: none;
  background: rgba(255, 255, 255, 0.94); color: var(--text-soft);
  border: none; cursor: pointer;
  box-shadow: 0 2px 8px rgba(23, 43, 84, 0.2);
  opacity: 0; transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.render-card:hover .render-dl { opacity: 1; }
.render-dl:hover { color: #fff; background: var(--green); }
.renders-dl-action { text-decoration: none; }

/* ---- header render bell (RenderBell.razor) --------------------------------
   Global export progress. The bell sits in .nav-right; the panel is absolutely
   positioned against .render-bell, so that element must stay position:relative. */
.render-bell { position: relative; display: flex; align-items: center; }

.bell-btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0;
    border-radius: 12px; cursor: pointer;
    background: #fff; border: none; color: var(--text-soft);
    box-shadow: 0 0 0 1px var(--border), 0 3px 8px -6px rgba(23, 43, 84, 0.5);
    transition: box-shadow 0.15s ease, transform 0.15s ease, color 0.15s ease;
}
.bell-btn:hover { color: var(--brand-1); transform: translateY(-1px); box-shadow: var(--clay); }
/* while the panel is open the button reads as pressed — and still as a button */
.render-bell.open .bell-btn { color: var(--brand-1); box-shadow: var(--clay-press), 0 0 0 1px var(--border-strong); }
.render-bell .bell-btn, .render-bell .bell-btn * { cursor: pointer; }
.bell-btn:active { transform: translateY(1px); }
.bell-btn .bell-ico { font-size: 15px; line-height: 1; }
.bell-btn.busy {
  color: var(--brand-1);
  box-shadow: 0 0 0 1.5px rgba(48, 104, 255, 0.45), 0 6px 14px -8px rgba(48, 104, 255, 0.8);
}
.bell-btn.busy .bell-ico { animation: bell-spin 1.6s linear infinite; }
@keyframes bell-spin { to { transform: rotate(360deg); } }

.bell-badge {
    /* the header is 52px and the button 36px, so keep the offset small or the
       badge clips against the top of the viewport */
    position: absolute; top: -4px; right: -7px;
    min-width: 17px; height: 17px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 800; letter-spacing: 0.01em;
    border-radius: 999px; color: #fff;
    background: #e2565f; box-shadow: 0 0 0 2px #fff, 0 3px 8px -3px rgba(226, 86, 95, 0.9);
}
.bell-badge.busy { background: var(--grad); box-shadow: 0 0 0 2px #fff, 0 3px 8px -3px rgba(48, 104, 255, 0.9); }

.bell-panel {
    position: absolute; top: calc(100% + 10px); right: 0; z-index: 61;
    width: 348px; max-width: calc(100vw - 24px);
    padding: 8px; border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.96);
    border: none;
    box-shadow: var(--clay-lg);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    animation: bell-in 0.14s ease-out;
}
@keyframes bell-in { from { opacity: 0; transform: translateY(-6px); } }

.bell-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 10px 8px; font-size: 12.5px; color: var(--text);
}
.bell-panel-head .text-link { font-size: 11.5px; }

.bell-empty, .bell-foot {
    padding: 10px; font-size: 11.5px; line-height: 1.5; color: var(--text-dim);
}
.bell-foot { box-shadow: 0 -1px 0 var(--border); margin-top: 4px; }

.bell-list { list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto; }
.bell-item {
    padding: 10px 11px; border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    background: var(--surface-2);
}
.bell-item + .bell-item { margin-top: 6px; }
.bell-item.running { border-left-color: var(--brand-1); }
.bell-item.done { border-left-color: var(--green); }
.bell-item.failed { border-left-color: var(--red); }
.bell-item.cancelled { border-left-color: var(--text-dim); }

.bell-item-top { display: flex; align-items: baseline; gap: 8px; }
.bell-item-name {
    font-size: 12.5px; font-weight: 800; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto;
}
.bell-item-status { font-size: 11px; font-weight: 700; color: var(--text-soft); flex-shrink: 0; }
.bell-item.done .bell-item-status { color: #06795a; }
.bell-item.failed .bell-item-status { color: #b4232d; }

.bell-bar {
    margin-top: 8px; height: 5px; border-radius: 999px; overflow: hidden;
    background: rgba(29, 51, 99, 0.1);
}
.bell-bar > span {
    display: block; height: 100%; border-radius: 999px;
    background: var(--grad);
    transition: width 0.3s ease;
}

.bell-item-actions {
    margin-top: 8px; display: flex; align-items: center; gap: 8px;
}
.bell-item-meta {
    font-size: 10.5px; color: var(--text-dim); flex: 1 1 auto;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bell-dl {
    flex-shrink: 0; font-size: 11px; font-weight: 800; text-decoration: none;
    padding: 4px 10px; border-radius: 999px; color: #fff;
    background: linear-gradient(135deg, #0f9d76, #34d399);
    box-shadow: 0 4px 10px -5px rgba(15, 157, 118, 0.9);
}
.bell-dl:hover { filter: brightness(1.05); }

@media (max-width: 640px) {
    .bell-panel { width: calc(100vw - 24px); right: -8px; }
}

/* a delivered render: the file is gone from the server, so no link — just a note */
.bell-gone {
    flex-shrink: 0; font-size: 10.5px; font-weight: 800; color: #06795a;
    padding: 4px 10px; border-radius: 999px;
    background: #ecfdf5; box-shadow: 0 0 0 1px rgba(15, 157, 118, 0.25);
}

/* ------------------------------------------------------------
   Cookie consent banner (ConsentBanner.razor)

   The conventional shape: a small card pinned to the bottom-left corner, not a wide bar and
   not a modal. Nothing about reading the site depends on answering, so it stays out of the
   way and never covers the middle of the page. On a phone it spans the width, which is the
   only layout that leaves room for two readable buttons.
   ------------------------------------------------------------ */

.consent {
  position: fixed;
  z-index: 1400;                 /* above the header (100) and the render bell panel */
  left: 20px;
  bottom: 20px;
  width: 372px;
  max-width: calc(100vw - 32px);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--clay-lg);
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  animation: consentRise 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.consent[hidden] { display: none; }

@keyframes consentRise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.consent-inner { display: block; }

.consent-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 5px;
}

.consent-text {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-soft);
  margin: 0 0 var(--space-lg);
}

.consent-text a { color: var(--brand-1); text-decoration: underline; text-underline-offset: 2px; }

.consent-actions {
  display: flex;
  gap: var(--space-sm);
}

/* Same size, same padding, same font weight for both answers, each taking half the row.
   Only the fill differs, and only so the primary action is findable — a reject that reads
   as the harder option is not freely given consent. */
.consent-btn {
  flex: 1 1 0;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 12px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: box-shadow 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.consent-reject {
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--clay);
}

.consent-reject:hover { background: var(--surface-3); box-shadow: var(--clay-hover); }

.consent-accept {
  background: var(--grad);
  color: #fff;
  box-shadow: var(--clay-brand);
}

.consent-accept:hover { transform: translateY(-1px); }

.consent-btn:active { transform: translateY(1px); box-shadow: var(--clay-press); }

.consent-btn:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }

@media (max-width: 560px) {
  .consent {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-width: none;
    padding: var(--space-lg) var(--space-xl);
  }
}

@media (prefers-reduced-motion: reduce) {
  .consent { animation: none; }
  .consent-btn:hover, .consent-btn:active { transform: none; }
}

/* "Cookie settings" link that reopens the banner, in both footers. */
.consent-link {
  font: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.85;
}

.consent-link:hover { opacity: 1; }

/* ------------------------------------------------------------
   Legal / notice pages (Privacy.razor)

   Long-form prose, so this is a narrow measure with generous line height rather than the
   card grids the rest of the app uses.
   ------------------------------------------------------------ */

.legal { padding: 56px 20px 80px; }

.legal-inner {
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--clay);
  padding: 44px 48px 40px;
}

.legal-h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  margin: 0 0 10px;
}

.legal-lead {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0 0 30px;
}

.legal-inner h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 10px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.legal-inner p,
.legal-inner li {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-soft);
}

.legal-inner p { margin: 0 0 12px; }
.legal-inner ul { margin: 0 0 14px; padding-left: 22px; }
.legal-inner li { margin-bottom: 7px; }
.legal-inner strong { color: var(--text); font-weight: 600; }
.legal-inner code { font-size: 12.5px; background: var(--surface-3); padding: 2px 6px; border-radius: 6px; }
.legal-inner a { color: var(--brand-1); text-decoration: underline; text-underline-offset: 2px; }

/* The cookie table is the widest thing on the page; it scrolls itself rather than
   forcing the whole document sideways on a phone. */
.legal-table-wrap { overflow-x: auto; margin: 0 0 16px; }

.legal-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 13px;
}

.legal-table th,
.legal-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-soft);
}

.legal-table th { color: var(--text); font-weight: 600; background: var(--surface-2); }
.legal-table tr:last-child td { border-bottom: 0; }

.legal-btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--grad);
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  box-shadow: var(--clay-brand);
}

.legal-btn:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }

.legal-foot { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }

@media (max-width: 620px) {
  .legal { padding: 28px 12px 56px; }
  .legal-inner { padding: 28px 22px 26px; border-radius: var(--radius); }
  .legal-h1 { font-size: 25px; }
}

/* ---------- admin ---------- */
.admin-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-lg); margin-bottom: var(--space-xl);
}
.stat-tile {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); padding: var(--space-lg);
}
.stat-tile .stat-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim); font-weight: 700;
}
.stat-tile .stat-value {
  font-family: var(--font-display); font-size: 30px; font-weight: 700;
  letter-spacing: -0.5px; margin-top: 4px; line-height: 1.1;
}
.stat-tile .stat-note { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.stat-tile.warn .stat-value { color: #a15c07; }
.stat-tile.bad  .stat-value { color: var(--red); }

/* Wide tables must scroll inside their own box; the page itself never scrolls sideways. */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); background: var(--surface);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-dim); font-weight: 700; padding: 12px 14px;
  border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(124, 92, 255, 0.04); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .nowrap { white-space: nowrap; }

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap;
}
.pill-admin   { background: #efe9ff; color: #5b3fd9; }
.pill-user    { background: #eef2f8; color: #52627f; }
.pill-ok      { background: #ecfdf5; color: #06795a; }
.pill-pending { background: #fff8eb; color: #a15c07; }
.pill-locked  { background: #fff1f2; color: #b4232d; }

.admin-toolbar {
  display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center;
  margin-bottom: var(--space-lg);
}
.admin-toolbar .spacer { flex: 1 1 auto; }

/* ---------- Professional Layers Inspector ---------- */
.layers-inspector {
  padding: 14px 16px !important;
}
.layers-inspector .inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.layers-count-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-dim);
}
.layers-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 440px;
  overflow-y: auto;
  padding-right: 2px;
  margin-top: 6px;
}
.layers-list::-webkit-scrollbar {
  width: 4px;
}
.layers-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.layer-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
  user-select: none;
}
.layer-item:hover {
  background: var(--surface-3);
  border-color: var(--border);
  transform: translateX(2px);
}
.layer-item.selected {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.35);
  color: #1d4ed8;
  font-weight: 600;
}
.layer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 4px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.layer-badge.badge-h {
  background: #dbeafe;
  color: #1e40af;
}
.layer-badge.badge-p {
  background: #f1f5f9;
  color: #475569;
}
.layer-badge.badge-btn {
  background: #fef3c7;
  color: #92400e;
}
.layer-badge.badge-img {
  background: #dcfce7;
  color: #166534;
}
.layer-badge.badge-shp {
  background: #f3e8ff;
  color: #6b21a8;
}
.layer-badge.badge-text {
  background: #e2e8f0;
  color: #334155;
}
.layer-label {
  flex: 1;
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.layer-arrow {
  color: var(--text-dim);
  font-size: 14px;
  opacity: 0.4;
  transition: opacity 0.15s, transform 0.15s;
}
.layer-item:hover .layer-arrow {
  opacity: 0.9;
  transform: translateX(1px);
}
.back-to-layers-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease;
}
.back-to-layers-btn:hover {
  background: var(--surface);
  color: var(--brand-1);
}

.btn-busy-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: btn-spin 0.75s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

.ai-mode-seg button:disabled {
  opacity: 0.85 !important;
  cursor: not-allowed;
  color: var(--text) !important;
}


/* zoomed past "fit": the stage scrolls around the canvas; margin:auto centers a small canvas and
   lets a large one start at the top-left so every corner stays reachable */
.studio-preview.zoomed { display: flex; overflow: auto; place-items: unset; }
.studio-preview.zoomed .frame-holder { margin: auto; flex: none; }
