/* Loopline design system — the single token source (docs/loopline-brand.md).
   1. Fonts and tokens: dark marketing set on :root, light app set on
      `.app` / `[data-surface=app]`.
   2. Shared primitives (all `.ll-*`): mark, buttons, chips, tag chip, panels,
      header, menu, footer, floating CTA bar, focus ring.
   3. Legacy app layer: the pre-redesign rules the Create and Clip apps still
      rely on. It is gated off on public pages (anything with `.ll-header`) and
      can be deleted rule by rule as the app shells move to the tokens. */

@font-face{font-family:Manrope;src:url('./fonts/Manrope-latin.woff2') format('woff2');font-weight:500 800;font-style:normal;font-display:swap}
@font-face{font-family:'DM Sans';src:url('./fonts/DMSans-latin.woff2') format('woff2');font-weight:400 700;font-style:normal;font-display:swap}

/* ------------------------------------------------------------------ 1. Tokens */
:root{
  /* Marketing (dark) */
  --bg:#0a0a0b;
  --panel:#111113;
  --raised:#17171a;
  --line:#232327;
  --line-2:#303036;
  --ink:#f5f5f4;
  --ink-2:#a1a1a6;
  --ink-3:#7a7a80;
  --accent:#ff5b2e;
  --accent-2:#ff7a52;
  --accent-soft:rgba(255,91,46,.14);
  --on-accent:#0a0a0b;
  --primary:#f5f5f4;
  --primary-hover:#ffffff;
  --on-primary:#0a0a0b;
  --glow:0 0 0 1px rgba(255,91,46,.55),0 10px 36px -6px rgba(255,91,46,.55),0 0 80px -20px rgba(255,91,46,.6);
  --shadow-card:0 24px 60px -30px rgba(0,0,0,.8);
  --scrim:rgba(10,10,11,.85);

  /* Type */
  --font-display:Manrope,'Helvetica Neue',Arial,sans-serif;
  --font-ui:'DM Sans','Helvetica Neue',Arial,sans-serif;
  --font-mono:ui-monospace,'SFMono-Regular',Menlo,Consolas,monospace;

  /* Shape and rhythm */
  --r-panel:24px;
  --r-card:14px;
  --r-control:12px;
  --r-chip:999px;
  --wrap:1344px;
  --gutter:clamp(16px,4vw,48px);
  --header-h:68px;
  --ease:cubic-bezier(.2,.7,.2,1);
  color-scheme:dark;
}
:is(.app,[data-surface=app]){
  --bg:#ffffff;
  --panel:#f6f6f7;
  --raised:#efeff1;
  --line:#e6e6e9;
  --line-2:#d6d6db;
  --ink:#0b0b0c;
  --ink-2:#5f5f66;
  --ink-3:#86868d;
  --accent:#f04a1d;
  --accent-2:#d93d12;
  --accent-soft:#fff0ea;
  --on-accent:#ffffff;
  --primary:#0b0b0c;
  --primary-hover:#26262a;
  --on-primary:#ffffff;
  --glow:0 0 0 1px rgba(240,74,29,.4),0 8px 24px -8px rgba(240,74,29,.45);
  --shadow-card:0 1px 2px rgba(11,11,12,.06),0 8px 24px -12px rgba(11,11,12,.12);
  --scrim:rgba(255,255,255,.85);
  color-scheme:light;
}

/* Legacy aliases. The apps (creator-trends.css, clipping.css, brand.css,
   template-landing.css) read `--ds-*`; they follow whichever token set is in
   scope, so `[data-surface=app]` flips them to the light app theme. */
:root,:is(.app,[data-surface=app]){
  --ds-canvas:var(--bg);
  --ds-sidebar:var(--panel);
  --ds-surface:var(--panel);
  --ds-surface-raised:var(--raised);
  --ds-surface-hover:var(--line);
  --ds-field:var(--raised);
  --ds-text:var(--ink);
  --ds-text-secondary:var(--ink-2);
  --ds-text-muted:var(--ink-3);
  --ds-line:var(--line);
  --ds-control-border:var(--line-2);
  --ds-control-border-hover:var(--ink-3);
  --ds-accent:var(--accent);
  --ds-accent-hover:var(--accent-2);
  --ds-accent-active:var(--accent-2);
  --ds-on-accent:var(--on-accent);
  --ds-action:var(--primary);
  --ds-action-hover:var(--primary-hover);
  --ds-on-action:var(--on-primary);
  --ds-focus:var(--accent);
  --ds-danger:#ff8a80;
  --ds-danger-surface:#2a1413;
  --ds-danger-hover:#3a1b19;
  --ds-danger-border:#b0574f;
  --ds-disabled:#7c7c82;
  --ds-disabled-surface:var(--raised);
  --ds-font-body:var(--font-ui);
  --ds-font-heading:var(--font-display);
  --ds-space-1:4px;--ds-space-2:8px;--ds-space-3:12px;--ds-space-4:16px;--ds-space-5:24px;
  --ds-space-6:32px;--ds-space-7:48px;--ds-space-8:64px;--ds-space-9:96px;
  --ds-page-max:1536px;
  --ds-page-gutter:clamp(28px,3.8vw,64px);
  --ds-section-gap:clamp(32px,3vw,48px);
  --ds-radius-control:10px;
  --ds-radius-card:var(--r-card);
  --ds-control-height:44px;
  --ds-duration:140ms;
  --ds-ease:var(--ease);
  --text:var(--ink);
  --muted:var(--ink-2);
}
:is(.app,[data-surface=app]){
  --ds-danger:#b42318;--ds-danger-surface:#fef3f2;--ds-danger-hover:#fee4e2;--ds-danger-border:#fda29b;--ds-disabled:#a0a0a6;
}

/* ------------------------------------------------------------ 2. Primitives */

/* Mark: signal-orange rounded square with the slash glyph + lowercase wordmark.
   Markup: <a class="ll-wordmark" href="./"><span class="slash" aria-hidden="true">/</span>loopline</a> */
.ll-wordmark{display:inline-flex;align-items:center;gap:9px;font:800 22px/1 var(--font-display);letter-spacing:-.045em;white-space:nowrap;color:var(--ink);text-decoration:none}
.ll-wordmark .slash,.ll-mark{display:inline-block;flex:none;width:28px;height:28px;border-radius:8px;font-size:0;color:transparent;background:var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M24 2h-7L8 30h7Z' fill='%230a0a0b'/%3E%3C/svg%3E") center/64% no-repeat;transform:none;margin:0}
.ll-mark-lg{width:56px;height:56px;border-radius:15px}

/* Buttons: pill, ink-on-canvas primary with an arrow disc. */
.ll-btn{display:inline-flex;align-items:center;justify-content:center;gap:12px;min-height:48px;padding:0 22px;border:1px solid transparent;border-radius:var(--r-chip);font:600 15px/1 var(--font-ui);letter-spacing:-.005em;white-space:nowrap;text-decoration:none;cursor:pointer;transition:background-color .18s var(--ease),color .18s var(--ease),border-color .18s var(--ease),box-shadow .18s var(--ease),transform .18s var(--ease)}
.ll-btn:active{transform:translateY(1px)}
.ll-btn:has(.ll-disc){padding-right:6px}
.ll-btn-primary,.ll-btn-ink,.ll-btn-paper{background:var(--primary);color:var(--on-primary)}
.ll-btn-primary:hover,.ll-btn-ink:hover,.ll-btn-paper:hover{background:var(--primary-hover)}
.ll-btn-accent,.ll-btn-copper{background:var(--accent);color:var(--on-accent)}
.ll-btn-accent:hover,.ll-btn-copper:hover{background:var(--accent-2)}
.ll-btn-ghost{background:transparent;color:var(--ink);border-color:var(--line-2)}
.ll-btn-ghost:hover{background:var(--raised);border-color:var(--ink-3)}
.ll-btn-soft{background:var(--raised);color:var(--ink);border-color:var(--line)}
.ll-btn-soft:hover{border-color:var(--line-2);background:var(--line)}
.ll-btn-glow{box-shadow:var(--glow)}
.ll-btn-sm{min-height:38px;padding:0 16px;font-size:13.5px;gap:8px}
.ll-btn-sm:has(.ll-disc){padding-right:4px}
.ll-btn-lg{min-height:56px;padding:0 26px;font-size:16px}
.ll-btn-lg:has(.ll-disc){padding-right:7px}
.ll-btn-block{width:100%}
.ll-disc{display:inline-grid;place-items:center;width:36px;height:36px;border-radius:50%;background:var(--bg);color:var(--accent);flex:none;transition:transform .18s var(--ease)}
.ll-disc svg{width:14px;height:14px}
.ll-btn-sm .ll-disc{width:30px;height:30px}
.ll-btn-lg .ll-disc{width:42px;height:42px}
.ll-btn:hover .ll-disc{transform:rotate(45deg)}
.ll-btn[aria-disabled=true],.ll-btn:disabled{opacity:.5;cursor:not-allowed;box-shadow:none}

/* Chips and tags */
.ll-chip{display:inline-flex;align-items:center;gap:8px;min-height:34px;padding:0 14px;border:1px solid var(--line);border-radius:var(--r-chip);background:var(--raised);color:var(--ink-2);font:500 13.5px/1 var(--font-ui);white-space:nowrap;text-decoration:none;cursor:pointer;transition:color .15s,border-color .15s,background-color .15s}
.ll-chip:hover{color:var(--ink);border-color:var(--line-2)}
.ll-chip[aria-pressed=true],.ll-chip[aria-selected=true],.ll-chip.is-active{background:var(--accent-soft);border-color:color-mix(in srgb,var(--accent) 60%,transparent);color:var(--ink)}
.ll-chip svg{width:15px;height:15px;flex:none}
.ll-tag{display:inline-flex;align-items:center;gap:8px;padding:6px 11px;border:1px solid var(--line);border-radius:9px;background:var(--raised);color:var(--ink);font:600 13px/1.1 var(--font-ui)}
.ll-tag svg,.ll-tag .ll-tag-dot{width:14px;height:14px;color:var(--accent);flex:none}
.ll-tag .ll-tag-dot{width:7px;height:7px;border-radius:50%;background:var(--accent)}
.ll-status{display:inline-flex;align-items:center;gap:6px;padding:4px 9px;border-radius:7px;font:600 12px/1.3 var(--font-ui);white-space:nowrap}
.ll-status::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
.ll-status-live{background:var(--accent-soft);color:var(--ink)}
.ll-status-live::before{background:var(--accent)}
.ll-status-create{background:var(--raised);color:var(--ink-2)}
.ll-status-soon{background:transparent;color:var(--ink-3);box-shadow:inset 0 0 0 1px var(--line-2)}
.ll-status-soon::before{background:transparent;box-shadow:inset 0 0 0 1.5px currentColor}

/* Panels: the big rounded section surface, optionally with corner ticks and
   inset guide rules. */
.ll-panel{position:relative;border:1px solid var(--line);border-radius:var(--r-panel);background:var(--panel)}
.ll-panel-ticks{background-image:linear-gradient(var(--line),var(--line)),linear-gradient(var(--line),var(--line));background-size:1px 100%,1px 100%;background-position:32px 0,calc(100% - 32px) 0;background-repeat:no-repeat}
.ll-panel-ticks::before,.ll-panel-ticks::after{content:"";position:absolute;left:29px;right:29px;height:7px;pointer-events:none;background:radial-gradient(circle,var(--ink-3) 1.4px,transparent 1.8px) 0 0/7px 7px no-repeat,radial-gradient(circle,var(--ink-3) 1.4px,transparent 1.8px) 100% 0/7px 7px no-repeat}
.ll-panel-ticks::before{top:30px}
.ll-panel-ticks::after{bottom:30px}
.ll-card{border:1px solid var(--line);border-radius:var(--r-card);background:var(--raised)}

/* Focus ring: one visible accent ring everywhere. */
.ll-focus:focus-visible,.ll-btn:focus-visible,.ll-chip:focus-visible,.ll-header a:focus-visible,.ll-header button:focus-visible,.ll-footer a:focus-visible,.ll-float a:focus-visible,.ll-float button:focus-visible{outline:2px solid var(--accent);outline-offset:3px}

/* Header (canonical public header, docs/loopline-brand.md) */
.ll-header{position:sticky;top:0;z-index:50;background:var(--scrim);-webkit-backdrop-filter:saturate(1.4) blur(14px);backdrop-filter:saturate(1.4) blur(14px);border-bottom:1px solid var(--line)}
.ll-header-inner{height:var(--header-h);display:flex;align-items:center;gap:clamp(20px,3vw,44px)}
.ll-nav{display:flex;align-items:center;gap:clamp(16px,2.2vw,30px);margin-left:auto;font:500 14.5px/1 var(--font-ui);color:var(--ink-2)}
.ll-nav a{position:relative;padding:10px 0;text-decoration:none;transition:color .15s}
.ll-nav a:hover,.ll-nav a[aria-current=page]{color:var(--ink)}
.ll-nav a[aria-current=page]::after{content:"";position:absolute;left:0;right:0;bottom:2px;height:2px;border-radius:2px;background:var(--accent)}
.ll-actions{display:flex;align-items:center;gap:18px}
.ll-nav+.ll-actions{margin-left:0}
.ll-header-inner>.ll-actions:only-of-type{margin-left:auto}
.ll-signin{font:500 14.5px/1 var(--font-ui);color:var(--ink-2);text-decoration:none}
.ll-signin:hover{color:var(--ink)}
.ll-signin[hidden]{display:none}
.ll-header .ll-btn{min-height:40px;font-size:14px}
.ll-menu-button{display:none;align-items:center;gap:8px;min-height:40px;padding:0 14px;border:1px solid var(--line-2);border-radius:var(--r-chip);background:transparent;color:var(--ink);font:600 13.5px/1 var(--font-ui);cursor:pointer}
.ll-menu-button .bars{position:relative;width:14px;height:10px}
.ll-menu-button .bars::before,.ll-menu-button .bars::after{content:"";position:absolute;left:0;right:0;height:1.5px;background:currentColor;transition:transform .18s}
.ll-menu-button .bars::before{top:1px}
.ll-menu-button .bars::after{bottom:1px}
.ll-menu-button[aria-expanded=true] .bars::before{transform:translateY(3.5px) rotate(45deg)}
.ll-menu-button[aria-expanded=true] .bars::after{transform:translateY(-3.75px) rotate(-45deg)}
.ll-menu{position:absolute;left:0;right:0;top:100%;background:var(--bg);border-bottom:1px solid var(--line);box-shadow:0 30px 40px -30px rgba(0,0,0,.9)}
.ll-menu[hidden]{display:none}
.ll-menu nav{display:flex;flex-direction:column;padding:4px 0 20px}
.ll-menu a{display:flex;align-items:center;justify-content:space-between;min-height:56px;border-bottom:1px solid var(--line);font:700 20px/1.1 var(--font-display);letter-spacing:-.03em;color:var(--ink);text-decoration:none}
.ll-menu a::after{content:"↗";font:500 15px var(--font-ui);color:var(--accent)}
.ll-menu a[aria-current=page]{color:var(--accent)}
.ll-menu a.ll-menu-signin{border-bottom:0;font:600 16px var(--font-ui);letter-spacing:0;color:var(--ink-2)}
@media (max-width:980px){.ll-nav{gap:16px;font-size:13.5px}.ll-actions{gap:14px}}
@media (max-width:760px){
  :root{--header-h:60px}
  .ll-nav,.ll-signin{display:none}
  .ll-menu-button{display:inline-flex;width:40px;padding:0;justify-content:center}
  .ll-menu-button [data-ll-menu-label]{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
  .ll-actions{margin-left:auto;gap:8px}
  .ll-wordmark{font-size:20px;gap:8px}
  .ll-wordmark .slash{width:26px;height:26px;border-radius:7px}
}
/* While the floating CTA bar shows on a phone, the header drops its own CTA. */
@media (max-width:760px){html.ll-float-on .ll-header .ll-actions>.ll-btn{display:none}}
@media (max-width:360px){.ll-header .ll-btn .ll-disc{display:none}.ll-header .ll-btn{padding:0 13px}.ll-menu-button{padding:0 11px}}

/* Footer: brand block + dense link columns + fine print. */
.ll-footer{background:var(--bg);color:var(--ink);padding:72px 0 40px;border-top:1px solid var(--line)}
.ll-footer .ll-wordmark{color:var(--ink)}
.ll-footer-grid{display:grid;grid-template-columns:1.5fr repeat(3,minmax(0,1fr));gap:40px 32px}
.ll-footer-grid.ll-footer-wide{grid-template-columns:1.3fr repeat(4,minmax(0,1fr))}
.ll-footer-brand p{margin-top:16px;max-width:330px;font-size:14px;line-height:1.6;color:var(--ink-2)}
.ll-footer nav{display:flex;flex-direction:column;gap:11px;font-size:14px;color:var(--ink-2)}
.ll-footer nav a{text-decoration:none;transition:color .15s}
.ll-footer nav a:hover{color:var(--ink)}
.ll-footer nav h2{margin:0 0 6px;font:600 14px/1.3 var(--font-ui);letter-spacing:0;text-transform:none;color:var(--ink)}
.ll-footer-fine{grid-column:1/-1;margin-top:24px;padding-top:24px;border-top:1px solid var(--line);font-size:12.5px;line-height:1.6;color:var(--ink-3)}
.ll-footer-fine a{text-decoration:underline;text-underline-offset:2px}
@media (max-width:1060px){.ll-footer-grid,.ll-footer-grid.ll-footer-wide{grid-template-columns:repeat(3,minmax(0,1fr))}.ll-footer-brand{grid-column:1/-1}}
@media (max-width:640px){.ll-footer{padding-top:52px}.ll-footer-grid,.ll-footer-grid.ll-footer-wide{grid-template-columns:repeat(2,minmax(0,1fr));gap:32px 20px}}

/* Floating CTA bar: shown after the hero (site.js toggles `.is-visible`). */
.ll-float{position:fixed;left:50%;bottom:18px;z-index:40;display:flex;align-items:center;gap:24px;width:min(760px,calc(100% - 32px));padding:12px 12px 12px 22px;border:1px solid var(--line-2);border-radius:18px;background:color-mix(in srgb,var(--panel) 88%,transparent);-webkit-backdrop-filter:blur(16px) saturate(1.3);backdrop-filter:blur(16px) saturate(1.3);box-shadow:0 20px 50px -20px rgba(0,0,0,.9);transform:translate(-50%,calc(100% + 40px));opacity:0;visibility:hidden;transition:transform .35s var(--ease),opacity .35s var(--ease),visibility 0s linear .35s}
.ll-float.is-visible{transform:translate(-50%,0);opacity:1;visibility:visible;transition:transform .35s var(--ease),opacity .35s var(--ease),visibility 0s}
.ll-float-copy{min-width:0;flex:1}
.ll-float-copy strong{display:block;font:700 17px/1.2 var(--font-display);letter-spacing:-.02em;color:var(--ink)}
.ll-float-copy span{display:block;margin-top:3px;font-size:13.5px;line-height:1.35;color:var(--ink-2)}
.ll-float .ll-btn{flex:none}
@media (max-width:640px){
  .ll-float{bottom:10px;gap:12px;padding:10px 10px 10px 16px;border-radius:16px}
  .ll-float-copy span{display:none}
  .ll-float-copy strong{font-size:15px}
}
@media (max-width:480px){.ll-float{padding:8px}.ll-float-copy{display:none}.ll-float .ll-btn{width:100%}}

@media (prefers-reduced-motion:reduce){
  .ll-btn,.ll-disc,.ll-float,.ll-chip{transition:none}
  .ll-btn:hover .ll-disc{transform:none}
}

/* --------------------------------------------------- 3. Legacy app layer
   Scoped to documents without the public header so none of it reaches the
   marketing pages. Zero added specificity (`:where`). */
@keyframes studio-opening { from { background-position: 100% 0; } to { background-position: -100% 0; } }
:where(html:not(:has(.ll-header))) {
--paper: var(--bg);

/* Canonical surfaces are consumed by both existing applications. Artwork
   selectors are deliberately absent: imagery retains its own palette. */
body { background: var(--ds-canvas); color: var(--ds-text); }
.sidebar { background: var(--ds-sidebar); border-color: var(--ds-line); }
:is(.stats-strip, .studio-toolbar, .project-card, .trends-panel, .workflow-note,
  .settings-card, .jobs-section, .exports-section, .source-status,
  .scene-list-panel, .scene-editor, .preview-panel, .create-modal,
  .lp-product, .final-cta) { background: var(--ds-surface); border-color: var(--ds-line); }
:is(.workspace-switch, .guardrail, .product-note) { background: var(--ds-surface-raised); border-color: var(--ds-line); }
input, textarea, select { background: var(--ds-field); border-color: var(--ds-control-border); color: var(--ds-text); }
input::placeholder, textarea::placeholder { color: var(--ds-text-muted); }
.file-label input { background: var(--ds-field); border-color: var(--ds-control-border); color: var(--ds-text-secondary); }
.check-label strong, .schedule-row strong { color: var(--ds-text); }
.hero .floating-label { background: var(--ds-surface-raised); color: var(--ds-text-secondary); border: 1px solid var(--ds-line); }
.hero .mini-play { background: #333333; color: var(--ds-text); }

/* A single control silhouette across the studio, landing and system preview. */
:is(.button, .lp-button, .lp-nav-cta, .ds-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--ds-control-height);
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--ds-radius-control);
  font-family: var(--ds-font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: none;
  transition: background-color var(--ds-duration) var(--ds-ease),
    border-color var(--ds-duration) var(--ds-ease),
    color var(--ds-duration) var(--ds-ease),
    transform var(--ds-duration) var(--ds-ease);
}
:is(.button, .lp-button, .lp-nav-cta, .ds-button):hover:not(:disabled):not([aria-disabled="true"]) {
  transform: none;
}
:is(.button, .lp-button, .lp-nav-cta, .ds-button):active:not(:disabled):not([aria-disabled="true"]) {
  transform: translateY(1px);
}
:is(.button.dark, .button.cream, .lp-button.primary, .ds-primary) {
  color: var(--ds-on-action);
  background: var(--ds-action);
  border-color: transparent;
  box-shadow: 0 1px 2px #00000040;
}
:is(.button.dark, .button.cream, .lp-button.primary, .ds-primary):hover:not(:disabled):not([aria-disabled="true"]) {
  color: var(--ds-on-action);
  background: var(--ds-action-hover);
}
:is(.button.dark, .button.cream, .lp-button.primary, .ds-primary):active:not(:disabled):not([aria-disabled="true"]) {
  background: #e2dbd0;
}
:is(.button.subtle, .lp-nav-cta, .ds-secondary) {
  color: var(--ds-text);
  background: var(--ds-surface-raised);
  border-color: var(--ds-control-border);
}
:is(.button.subtle, .lp-nav-cta, .ds-secondary):hover:not(:disabled):not([aria-disabled="true"]) {
  color: #ffffff;
  background: var(--ds-surface-hover);
  border-color: var(--ds-control-border-hover);
}
:is(.button.subtle, .lp-nav-cta, .ds-secondary):active:not(:disabled):not([aria-disabled="true"]) {
  background: #333333;
}
:is(.button, .lp-button, .lp-nav-cta) svg { width: 16px; height: 16px; }
.lp-button > span, .lp-nav-cta > span { color: inherit; font-size: 19px; }
.button-group { flex-wrap: wrap; }
/* Override legacy compact contexts explicitly; they previously shrank labels
   to 9–10px even when the shared button class had readable typography. */
:is(.page-heading > .button, .modal-footer .button, .export-row .button,
  .editor-actions .button, .welcome-banner .button, .reorder-controls .button,
  .studio-heading .button-group .button) {
  min-height: var(--ds-control-height);
  padding: 11px 18px;
  font-size: 13px;
  line-height: 1.4;
}

/* Ghost controls retain a real touch area without adding competing filled CTAs. */
:is(.text-button, .back-link, .lp-watch, .lp-text-link, .lp-footer > a:last-of-type, .asset-attached button, .ds-ghost) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--ds-control-height);
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--ds-radius-control);
  background: transparent;
  color: var(--ds-text-secondary);
  font: 500 12px/1.4 var(--ds-font-body);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--ds-duration) var(--ds-ease), color var(--ds-duration) var(--ds-ease);
}
:is(.text-button, .back-link, .lp-watch, .lp-text-link, .lp-footer > a:last-of-type, .asset-attached button, .ds-ghost):hover:not(:disabled):not([aria-disabled="true"]) {
  color: var(--ds-text);
  background: var(--ds-surface-raised);
}
:is(.text-button, .back-link, .lp-watch, .lp-text-link, .lp-footer > a:last-of-type, .asset-attached button, .ds-ghost):active:not(:disabled):not([aria-disabled="true"]) {
  background: var(--ds-surface-hover);
}
.back-link { margin-left: -10px; }
.lp-watch { padding-right: 10px; }
.lp-watch .play-circle { border-color: var(--ds-control-border); color: inherit; }
.lp-watch:hover .play-circle { background: transparent; border-color: var(--ds-accent); color: var(--ds-accent); }
.preview-play { width: 44px; height: 44px; left: calc(50% - 22px); background: var(--ds-accent); border-color: transparent; color: var(--ds-on-accent); }
.product-preview:hover .preview-play { background: var(--ds-accent-hover); color: var(--ds-on-accent); }
.product-preview:active .preview-play { background: var(--ds-accent-active); }
.product-preview:focus-visible { outline: 3px solid var(--ds-focus); outline-offset: 4px; }
.asset-attached button { min-height: 36px; padding: 6px 9px; text-decoration: none; }

/* Icon buttons share boundaries, dimensions and clear keyboard treatment. */
:is(.close-modal, .icon-button, .toast > button, .ds-icon) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: var(--ds-control-height);
  min-height: var(--ds-control-height);
  width: var(--ds-control-height);
  height: var(--ds-control-height);
  padding: 10px;
  border: 1px solid var(--ds-control-border);
  border-radius: var(--ds-radius-control);
  background: transparent;
  color: var(--ds-text-secondary);
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--ds-duration) var(--ds-ease), border-color var(--ds-duration) var(--ds-ease);
}
:is(.close-modal, .toast > button) { border-color: transparent; font-size: 25px; }
.close-modal { top: 12px; right: 12px; }
:is(.close-modal, .icon-button, .toast > button, .ds-icon):hover:not(:disabled) {
  color: var(--ds-text);
  background: var(--ds-surface-hover);
  border-color: var(--ds-control-border-hover);
}
:is(.close-modal, .icon-button, .toast > button, .ds-icon):active:not(:disabled) { background: #333333; }

/* Destructive is a semantic modifier; cancellation of a dialog is secondary. */
:is(.button.button-danger, .ds-danger) {
  color: var(--ds-danger);
  background: var(--ds-danger-surface);
  border-color: var(--ds-danger-border);
}
:is(.button.button-danger, .ds-danger):hover:not(:disabled):not([aria-disabled="true"]) {
  color: #ffd1cd;
  background: var(--ds-danger-hover);
  border-color: var(--ds-danger);
}
:is(.button.button-danger, .ds-danger):active:not(:disabled) { background: #57312e; }
:is(.text-button.danger, .asset-attached button.danger, .ds-ghost.danger) { color: var(--ds-danger); }
:is(.text-button.danger, .asset-attached button.danger, .ds-ghost.danger):hover:not(:disabled) {
  color: #ffd1cd;
  background: var(--ds-danger-surface);
}

/* Navigation and tabs use an accent marker, with neutral selected surfaces. */
.nav-item { min-height: var(--ds-control-height); border: 1px solid transparent; border-radius: var(--ds-radius-control); color: var(--ds-text-secondary); }
.nav-item:hover { background: var(--ds-surface-raised); color: var(--ds-text); }
.nav-item.active { background: #262626; color: var(--ds-text); box-shadow: inset 3px 0 0 var(--ds-accent); }
:is(.input-tabs > button, .ds-tab) {
  min-height: var(--ds-control-height);
  padding: 10px 6px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 4px 4px 0 0;
  background: transparent;
  color: var(--ds-text-secondary);
  font: 500 12px/1.4 var(--ds-font-body);
  cursor: pointer;
}
:is(.input-tabs > button, .ds-tab):hover { background: var(--ds-surface-raised); color: var(--ds-text); }
:is(.input-tabs > button.selected, .ds-tab[aria-selected="true"]) { color: var(--ds-text); border-bottom-color: var(--ds-accent); }

/* Card controls preserve their content colors and existing layout. */
:is(.project-card, .scene-item, .new-project-card) {
  transition: background-color var(--ds-duration) var(--ds-ease), border-color var(--ds-duration) var(--ds-ease), box-shadow var(--ds-duration) var(--ds-ease);
}
.project-card:hover { border-color: var(--ds-control-border-hover); box-shadow: 0 8px 22px #0000004d; transform: none; }
.project-card:active { border-color: var(--ds-text-secondary); }
.scene-item:hover { background: var(--ds-surface-raised); }
.scene-item.selected { background: #272727; border-color: #929292; box-shadow: inset 3px 0 0 var(--ds-accent); }
.new-project-card { border-color: var(--ds-control-border); }
.new-project-card:hover { background: var(--ds-surface-raised); border-color: var(--ds-control-border-hover); }
.new-project-card:active { background: var(--ds-surface-hover); }
.projects-section .project-grid:has(> .new-project-card:only-child) { grid-template-columns: minmax(0, 340px); }
@media (max-width: 760px) { .projects-section .project-grid:has(> .new-project-card:only-child) { grid-template-columns: 1fr; } }
.new-project-plus { background: #303030; color: var(--ds-text); }

/* Browser-native file controls participate in the same system. */
.file-label input::file-selector-button {
  min-height: 36px;
  margin-right: 9px;
  padding: 7px 11px;
  border: 1px solid var(--ds-control-border);
  border-radius: 6px;
  background: var(--ds-surface-raised);
  color: var(--ds-text);
  font: 500 12px/1.4 var(--ds-font-body);
  cursor: pointer;
}
.file-label input:not(:disabled)::file-selector-button:hover { background: var(--ds-surface-hover); border-color: var(--ds-control-border-hover); }
.file-label input:not(:disabled)::file-selector-button:active { background: #333333; }
.file-label input:disabled::file-selector-button { color: var(--ds-disabled); background: var(--ds-disabled-surface); border-color: var(--ds-line); cursor: not-allowed; }
input[type="checkbox"] { accent-color: var(--ds-accent); }

/* A visible ring outside the boundary, with no reliance on hover alone. */
button:focus-visible, a:focus-visible, summary:focus-visible,
:is(.ds-button, .ds-tab, input, textarea, select):focus-visible {
  outline: 3px solid var(--ds-focus);
  outline-offset: 3px;
}
input:focus, textarea:focus, select:focus { outline-color: var(--ds-focus); }

/* Last by design: disabled wins over every variant and hover treatment. */
:is(.button, .lp-button, .lp-nav-cta, .ds-button):is(:disabled, [aria-disabled="true"]) {
  color: var(--ds-disabled);
  background: var(--ds-disabled-surface);
  border-color: var(--ds-line);
  box-shadow: none;
  transform: none;
  opacity: 1;
  cursor: not-allowed;
}
:is(.text-button, .back-link, .lp-watch, .ds-ghost, .close-modal, .icon-button, .ds-icon, .nav-item, .input-tabs > button, .ds-tab):is(:disabled, [aria-disabled="true"]) {
  color: var(--ds-disabled);
  background: transparent;
  border-color: var(--ds-line);
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
}
:is(button, a)[aria-busy="true"] { cursor: progress; }

@media (max-width: 760px) {
  :is(.button, .lp-button, .lp-nav-cta, .ds-button) { padding: 10px 13px; font-size: 12px; }
  :is(.page-heading > .button, .modal-footer .button, .export-row .button,
    .editor-actions .button, .welcome-banner .button,
    .studio-heading .button-group .button) { padding: 10px 13px; font-size: 12px; }
  .button-group { gap: 8px; }
  .studio-heading .button-group { width: 100%; }
  .reorder-controls .button { min-height: 44px; padding: 9px 8px; font-size: 12px; }
  .scene-list { padding: 3px; }
  .scene-item { min-width: 155px; }
  .job-row > .text-button { font-size: 12px; }
  .asset-attached button { min-height: 44px; }
  .file-label input::file-selector-button { min-height: 44px; }
}
@media (pointer: coarse) {
  .asset-attached button { min-height: 44px; }
  .file-label input::file-selector-button { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  :is(.button, .lp-button, .lp-nav-cta, .ds-button, .text-button, .back-link, .lp-watch, .lp-text-link, .project-card, .scene-item, .new-project-card, .icon-button) { transition: none; }
  :is(.button, .lp-button, .lp-nav-cta, .ds-button):active { transform: none; }
}

/* Shared workspace rhythm. The template library supplies its own card layout,
   while every workspace page inherits the same readable outer geometry. */
.topbar {
  height: 76px;
  padding-inline: var(--ds-page-gutter);
}
.page-content {
  max-width: var(--ds-page-max);
  padding: 48px var(--ds-page-gutter) var(--ds-space-9);
}
.page-heading {
  align-items: flex-end;
  gap: var(--ds-space-6);
  margin-bottom: var(--ds-space-6);
}
.page-heading .eyebrow {
  font-size: 12px;
  letter-spacing: 1.8px;
  margin-bottom: var(--ds-space-3);
}
.page-heading h1 {
  font-size: clamp(32px, 3vw, 46px);
  line-height: 1.12;
  letter-spacing: -1.8px;
}
.page-heading p {
  max-width: 640px;
  margin-top: var(--ds-space-3);
  font-size: 13px;
  line-height: 1.65;
}
.section-top {
  margin-bottom: var(--ds-space-5);
}
.section-top h2 {
  font-size: 21px;
  line-height: 1.25;
  letter-spacing: -.65px;
}
.section-top p {
  margin-top: var(--ds-space-2);
  font-size: 12px;
  line-height: 1.55;
}
.nav-item {
  min-height: 46px;
  font-size: 13px;
}

@media (max-width: 760px) {
  .topbar { height: 62px; padding-inline: 18px; }
  .page-content { padding: 28px 18px var(--ds-space-8); }
  .page-heading { align-items: flex-start; flex-wrap: wrap; gap: var(--ds-space-4); }
  .page-heading h1 { font-size: 30px; letter-spacing: -1.2px; }
  .page-heading p { font-size: 12px; }
  .section-top h2 { font-size: 18px; }
  .section-top p { font-size: 12px; }
}

/* The same slash mark and rule-based geometry appear in the public catalog. */
.wordmark { letter-spacing: -1.2px; }
.brand-icon {
  width: 34px;
  height: 31px;
  margin-right: 11px;
  border-radius: 0;
  background: transparent;
  color: var(--ds-text);
  font: 900 26px/1 Arial, sans-serif;
  letter-spacing: -3px;
  transform: none;
  justify-content: flex-start;
}
.brand-icon i { display: none; }
.wordmark svg.brand-icon { width: 27px; height: 27px; margin-right: 8px; padding: 0; border: 0; background: transparent; fill: currentColor; color: var(--ds-text); transform: none; }
.brand-period { color: var(--ds-accent); }
.nav-item.active { background: var(--ds-surface-raised); box-shadow: inset 2px 0 0 var(--ds-accent); }
:is(.project-card, .new-project-card, .scene-item, .studio-toolbar,
  .workflow-note, .settings-card, .jobs-section, .exports-section,
  .trends-panel, .preview-panel, .scene-list-panel, .scene-editor,
  .create-modal, .creator-card, .creator-dialog) { border-radius: var(--ds-radius-card); }
:is(.creator-platforms button, .creator-search, .creator-preview-label,
  .creator-sample-badge, .creator-sample-expand, .tiny-pill) { border-radius: var(--ds-radius-control); }
.creator-card:hover { transform: none; }
.creator-hook { border-color: var(--ds-line); border-left: 2px solid var(--ds-accent); }
.creator-card-footer button { color: var(--ds-text); text-decoration: underline; text-underline-offset: 3px; }
.creator-card-footer button:hover { color: var(--ds-accent-hover); }

/* The reference stays visible from draft to edit, with its original claim labeled. */
.research-handoff,.studio-research-source{border:1px solid var(--ds-line);border-left:3px solid var(--ds-accent);background:var(--ds-surface-raised);color:var(--ds-text);padding:17px 19px;min-width:0}
.research-handoff{display:grid;gap:7px;margin:18px 0}
.research-handoff>span,.studio-research-source>div>span{color:var(--ds-accent);font:700 12px/1.4 var(--ds-font-body);letter-spacing:.13em}
.research-handoff strong,.studio-research-source strong{font:700 20px/1.25 var(--ds-font-heading);letter-spacing:-.025em;overflow-wrap:anywhere}
.research-handoff p,.studio-research-source p{font-size:12px;line-height:1.6;color:var(--ds-text-secondary);margin:0}
.research-handoff a,.studio-research-links a{font-size:12px;font-weight:700;text-decoration:underline;text-underline-offset:4px;color:var(--ds-text)}
.research-handoff a:hover,.studio-research-links a:hover{color:var(--ds-accent)}
.studio-research-source{display:flex;justify-content:space-between;align-items:center;gap:20px;margin:0 0 18px}
.studio-research-source>div:first-child{display:grid;gap:7px;min-width:0}
.studio-research-source small{font-size:12px;color:var(--ds-text-muted);text-transform:capitalize}
.studio-research-links{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px 18px;flex-shrink:0}
@media(max-width:760px){.studio-research-source{align-items:flex-start;flex-direction:column}.studio-research-links{justify-content:flex-start}}

.starter-credit{display:flex;align-items:center;justify-content:space-between;gap:32px;margin-bottom:28px;padding:28px 32px;border-left:3px solid var(--ds-accent)}
.starter-credit .eyebrow{color:var(--ds-accent);font-size:12px;letter-spacing:.15em}
.starter-credit h2{margin:10px 0 8px;font:700 clamp(23px,2.5vw,33px)/1.15 var(--ds-font-heading);letter-spacing:-.025em;letter-spacing:-.02em;color:var(--ds-text)}
.starter-credit p{margin:0 0 8px;max-width:610px;font-size:13px;line-height:1.55;color:var(--ds-text-secondary)}
.starter-credit small{display:block;max-width:660px;font-size:12px;line-height:1.55;color:var(--ds-text-muted)}
.starter-credit .button{flex-shrink:0}
@media(max-width:760px){.starter-credit{align-items:flex-start;flex-direction:column;gap:20px;padding:24px 20px}.starter-credit .button{width:100%}}

/* Loopline shell: one slash mark and the same module switcher in Create and Clip. */
.sidebar .wordmark svg.brand-icon { width: 22px; height: 30px; margin-right: 2px; fill: var(--ds-accent); color: var(--ds-accent); }
.sidebar .wordmark + .module-nav { margin-top: 34px; }
.breadcrumb a.crumb-root { color: inherit; text-decoration: none; }
.breadcrumb a.crumb-root:hover { color: var(--ds-text); }
.sidebar .module-nav + .nav-label { margin-top: 22px; }
.sidebar .module-nav .nav-item[aria-current="page"] { color: var(--ds-text); background: var(--ds-surface-raised); box-shadow: inset 2px 0 0 var(--ds-accent); }
@media (max-width: 760px) {
  .sidebar .module-nav { padding-bottom: 8px; border-bottom: 1px solid var(--ds-line); }
  .sidebar .module-nav + .nav-label + nav { border-top: 0; }
  .breadcrumb .crumb-root { display: none; }
}


/* ==========================================================================
   Loopline workspace shell, shared by Create (/studio) and Clip (/clip).
   Same sidebar, header, card, button and type scale in both apps. Selectors
   are anchored on `.app-shell.loop-shell` so they outrank the older per-app
   shell rules that still load after this file in Clip.
   ========================================================================== */
.app-shell.loop-shell { --loop-sidebar: 248px; --loop-tabbar: 64px; background: var(--ds-canvas); color: var(--ds-text); font-family: var(--ds-font-body); }
.app-shell.loop-shell .sidebar { width: var(--loop-sidebar); padding: 22px 14px 14px; background: var(--ds-sidebar); border-right: 1px solid var(--ds-line); display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.app-shell.loop-shell .loop-sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 0 10px; }
.app-shell.loop-shell .wordmark { display: inline-flex; align-items: center; gap: 2px; padding: 0; font: 800 25px/1 var(--ds-font-heading); letter-spacing: -.045em; color: var(--ds-text); text-decoration: none; }
.app-shell.loop-shell .wordmark svg.brand-icon { width: 17px; height: 24px; margin: 0 1px 0 0; fill: var(--ds-accent); color: var(--ds-accent); background: none; border: 0; transform: none; }
.app-shell.loop-shell .loop-nav-close, .app-shell.loop-shell .loop-menu-button, .app-shell.loop-shell .loop-mobile-mark, .app-shell.loop-shell .loop-signout { display: none; }
.app-shell.loop-shell .loop-nav { margin-top: 22px; display: grid; gap: 14px; }
.app-shell.loop-shell .loop-nav-group { display: grid; gap: 2px; }
.app-shell.loop-shell .loop-nav-group + .loop-nav-group { padding-top: 14px; border-top: 1px solid var(--ds-line); }
.app-shell.loop-shell .sidebar .nav-label { margin: 0 0 6px; padding: 0 12px; font: 700 12px/1.2 var(--ds-font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--ds-text-muted); }
.app-shell.loop-shell .sidebar .nav-item, .app-shell.loop-shell .sidebar nav .nav-item { display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; min-height: 40px; margin: 0; padding: 0 12px; border: 0; border-radius: var(--ds-radius-control); background: transparent; box-shadow: none; color: var(--ds-text-secondary); font: 500 13.5px/1 var(--ds-font-body); text-align: left; text-decoration: none; flex-direction: row; }
.app-shell.loop-shell .sidebar .nav-item > svg { width: 18px; height: 18px; color: var(--ds-text-muted); }
.app-shell.loop-shell .sidebar .nav-item span { display: inline; font-size: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-shell.loop-shell .sidebar .nav-item:hover { background: var(--ds-surface-raised); color: var(--ds-text); }
.app-shell.loop-shell .sidebar .nav-item.active, .app-shell.loop-shell .sidebar .nav-item[aria-current="page"] { background: var(--ds-surface-raised); color: var(--ds-text); box-shadow: inset 2px 0 0 var(--ds-accent); }
.app-shell.loop-shell .sidebar .nav-item.active > svg { color: var(--ds-accent); }
.app-shell.loop-shell .sidebar .nav-item:focus-visible, .app-shell.loop-shell .loop-tabbar .nav-item:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: -2px; }
.app-shell.loop-shell .sidebar-bottom { margin-top: auto; padding-top: 18px; }
.app-shell.loop-shell .sidebar-bottom .guardrail { display: none; }
.app-shell.loop-shell .profile { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 14px 10px 4px; border-top: 1px solid var(--ds-line); }
.app-shell.loop-shell .profile > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.app-shell.loop-shell .profile strong { font-size: 12.5px; color: var(--ds-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-shell.loop-shell .profile span:not(.avatar) { font-size: 12px; color: var(--ds-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-shell.loop-shell .avatar, .app-shell.loop-shell .top-avatar { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ds-surface-hover); color: var(--ds-text); font: 700 12px/1 var(--ds-font-heading); }
.app-shell.loop-shell .status-dot { display: none; }
.app-shell.loop-shell .main { margin-left: var(--loop-sidebar); width: calc(100% - var(--loop-sidebar)); min-width: 0; }
.app-shell.loop-shell .topbar { position: sticky; top: 0; z-index: 20; height: 60px; padding: 0 var(--ds-page-gutter); display: flex; align-items: center; gap: 14px; background: color-mix(in srgb, var(--ds-canvas) 94%, transparent); border-bottom: 1px solid var(--ds-line); }
.app-shell.loop-shell .breadcrumb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ds-text-muted); white-space: nowrap; overflow: hidden; }
.app-shell.loop-shell .breadcrumb a { color: inherit; text-decoration: none; }
.app-shell.loop-shell .breadcrumb a:hover { color: var(--ds-text); }
.app-shell.loop-shell .breadcrumb strong { font-weight: 600; color: var(--ds-text); overflow: hidden; text-overflow: ellipsis; }
.app-shell.loop-shell .breadcrumb > span { color: var(--ds-line); color: var(--ds-control-border); }
.app-shell.loop-shell .topbar-right { display: flex; align-items: center; gap: 14px; }
.app-shell.loop-shell .mode-label { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ds-text-muted); }
.app-shell.loop-shell .mode-label i { width: 6px; height: 6px; border-radius: 50%; background: var(--ds-accent); }
.app-shell.loop-shell .topbar .text-button { min-height: 36px; padding: 6px 10px; font-size: 12.5px; color: var(--ds-text-secondary); }
.app-shell.loop-shell .page-content { max-width: 1440px; margin: 0 auto; padding: 40px var(--ds-page-gutter) 96px; }

/* Page header: stage eyebrow, module name, one-line description, primary action right. */
.app-shell.loop-shell .page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 0 0 32px; padding: 0 0 24px; border-bottom: 1px solid var(--ds-line); flex-wrap: nowrap; }
.app-shell.loop-shell .page-heading > div { min-width: 0; }
.app-shell.loop-shell .page-heading .eyebrow { display: block; margin: 0 0 10px; font: 700 12px/1.2 var(--ds-font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--ds-accent); }
.app-shell.loop-shell .page-heading h1 { margin: 0; font: 750 clamp(30px, 2.6vw, 40px)/1.08 var(--ds-font-heading); letter-spacing: -.035em; color: var(--ds-text); max-width: none; }
.app-shell.loop-shell .page-heading h1 > span { display: inline; }
.app-shell.loop-shell .page-heading > div > p:not(.eyebrow) { max-width: 700px; margin: 10px 0 0; font-size: 14.5px; line-height: 1.55; color: var(--ds-text-secondary); }
.app-shell.loop-shell .page-heading > .button { flex-shrink: 0; min-height: 44px; padding: 11px 18px; font-size: 13.5px; font-weight: 650; }
.app-shell.loop-shell .page-heading.studio-heading { align-items: flex-end; }
.app-shell.loop-shell .creator-heading + .creator-toolbar { border-top: 0; padding-top: 0; }
.app-shell.loop-shell .page-heading .back-link { margin: 0 0 10px -10px; min-height: 32px; font-size: 12.5px; }

/* One section and card language. */
.app-shell.loop-shell .section-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.app-shell.loop-shell .section-top h2, .app-shell.loop-shell .settings-card h2 { font: 700 20px/1.25 var(--ds-font-heading); letter-spacing: -.02em; color: var(--ds-text); }
.app-shell.loop-shell .section-top p { margin-top: 6px; font-size: 13px; line-height: 1.55; color: var(--ds-text-secondary); }
.app-shell.loop-shell .settings-card, .app-shell.loop-shell .jobs-section, .app-shell.loop-shell .exports-section { background: var(--ds-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-card); }
.app-shell.loop-shell .eyebrow { font-size: 12px; letter-spacing: .14em; font-weight: 700; text-transform: uppercase; }
.app-shell.loop-shell .text-button { font-size: 13px; color: var(--ds-text-secondary); }
.app-shell.loop-shell .button { font-size: 13.5px; font-weight: 600; }
.app-shell.loop-shell .tiny-pill { font-size: 12px; letter-spacing: .1em; padding: 5px 8px; background: var(--ds-surface-raised); border-color: var(--ds-line); color: var(--ds-text-secondary); }
.app-shell.loop-shell .toast { left: calc(50% + var(--loop-sidebar) / 2); }

/* Create home: starting points. */
.start-section { margin-top: 8px; }
.projects-section + .start-section { margin-top: 44px; }
.start-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "tpl tpl idea script" "tpl tpl clip research"; gap: 14px; }
.start-idea { grid-area: idea; } .start-script { grid-area: script; } .start-clip { grid-area: clip; } .start-research { grid-area: research; } .start-templates { grid-area: tpl; }
.start-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; min-width: 0; min-height: 214px; padding: 20px; background: var(--ds-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-card); color: var(--ds-text); text-align: left; text-decoration: none; font: inherit; cursor: pointer; transition: border-color var(--ds-duration) var(--ds-ease), background-color var(--ds-duration) var(--ds-ease); }
.start-card:is(button, a):hover { border-color: var(--ds-control-border-hover); background: var(--ds-surface-raised); }
.start-card:is(button, a):hover .start-action { color: var(--ds-accent); }
.start-card:focus-visible, .start-poster:focus-visible, .start-action:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.start-top { display: flex; align-items: center; gap: 10px; width: 100%; }
.start-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--ds-radius-control); background: var(--ds-surface-raised); border: 1px solid var(--ds-line); color: var(--ds-accent); }
.start-icon svg { width: 18px; height: 18px; }
.start-index { font: 700 12px/1.2 var(--ds-font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--ds-text-muted); }
.start-card strong { display: block; margin-top: 22px; font: 700 18px/1.25 var(--ds-font-heading); letter-spacing: -.02em; }
.start-copy { display: block; margin-top: 8px; font-size: 13px; line-height: 1.55; color: var(--ds-text-secondary); }
.start-action { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 16px; font-size: 13px; font-weight: 650; color: var(--ds-text); text-decoration: none; }
.start-action svg { width: 15px; height: 15px; }
.start-templates { cursor: default; padding: 20px 20px 18px; }
.start-templates-head { width: 100%; }
.start-templates-head strong { margin-top: 18px; }
.start-templates-head .start-copy { max-width: 520px; }
.start-posters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; width: 100%; margin: 18px 0 0; }
.start-poster { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 0; border: 0; background: none; color: var(--ds-text); text-align: left; cursor: pointer; font: inherit; }
.start-poster-frame { position: relative; display: block; width: 100%; aspect-ratio: 9 / 16; overflow: hidden; background: #221f1c; border: 1px solid var(--ds-line); border-radius: 4px; }
.start-poster-frame img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s var(--ds-ease); }
.start-poster:hover .start-poster-frame img { transform: scale(1.03); }
.start-poster:hover .start-poster-title { color: var(--ds-accent); }
.start-poster-badge { position: absolute; left: 7px; top: 7px; padding: 4px 6px; background: #0f0e0dcc; color: #f4f0e9; border-radius: 3px; font: 700 12px/1 var(--ds-font-body); letter-spacing: .1em; text-transform: uppercase; }
.start-poster-title { font: 650 13px/1.3 var(--ds-font-heading); letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.start-poster-meta { margin-top: -4px; font-size: 12px; color: var(--ds-text-muted); }
.start-templates > .start-action:hover { color: var(--ds-accent); }

/* Project cards: typographic cover, no illustration. */
.app-shell.loop-shell .project-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.app-shell.loop-shell .project-card { background: var(--ds-surface); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-card); }
.app-shell.loop-shell .project-cover { height: auto; aspect-ratio: 16 / 10; display: block; position: relative; background: #24201c; border-bottom: 1px solid var(--ds-line); }
.app-shell.loop-shell .project-cover .cover-title { position: absolute; left: 16px; right: 16px; bottom: 16px; max-width: none; font: 700 19px/1.2 var(--ds-font-heading); letter-spacing: -.02em; color: var(--ds-text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.app-shell.loop-shell .project-cover .cover-badge, .app-shell.loop-shell .project-cover .cover-duration { position: absolute; top: 12px; padding: 4px 6px; border: 1px solid var(--ds-line); border-radius: 3px; background: transparent; color: var(--ds-text-secondary); font: 600 12px/1 ui-monospace, 'SF Mono', Menlo, monospace; }
.app-shell.loop-shell .project-cover .cover-badge { left: 14px; }
.app-shell.loop-shell .project-cover .cover-duration { right: 14px; left: auto; bottom: auto; }
.app-shell.loop-shell .project-info { padding: 12px 14px 14px; }
.app-shell.loop-shell .project-info h3 { font: 650 13.5px/1.3 var(--ds-font-heading); color: var(--ds-text); }
.app-shell.loop-shell .project-info > div { font-size: 12px; color: var(--ds-text-muted); }
.app-shell.loop-shell .project-state i { background: var(--ds-accent); }
.app-shell.loop-shell .new-project-card { min-height: 0; aspect-ratio: auto; border-style: dashed; border-radius: var(--ds-radius-card); }
.app-shell.loop-shell .new-project-card strong { font-size: 13.5px; color: var(--ds-text); }
.app-shell.loop-shell .new-project-card > span:last-child { font-size: 12px; color: var(--ds-text-muted); }

/* Clip setup reminder: a banner, never a wall. */
.setup-banner { display: flex; align-items: center; gap: 16px; margin: 0 0 28px; padding: 14px 16px; background: var(--ds-surface); border: 1px solid var(--ds-line); border-left: 2px solid var(--ds-accent); border-radius: var(--ds-radius-card); }
.setup-banner-icon { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: var(--ds-radius-control); background: var(--ds-surface-raised); color: var(--ds-accent); }
.setup-banner > div:nth-child(2) { flex: 1; min-width: 0; }
.setup-banner strong { font: 650 14px/1.3 var(--ds-font-heading); }
.setup-banner p { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ds-text-secondary); }
.setup-banner-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.setup-banner-actions .button { min-height: 38px; padding: 8px 14px; font-size: 12.5px; }
.setup-banner-actions .text-button { min-height: 38px; font-size: 12.5px; }
.setup-banner-line, .setup-banner-x { display: none; }

/* Mobile tab bar is hidden on wide screens. */
.loop-tabbar, .loop-scrim { display: none; }

@media (max-width: 1200px) {
  .app-shell.loop-shell { --loop-sidebar: 220px; }
  .start-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "tpl tpl" "idea script" "clip research"; }
  .app-shell.loop-shell .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell.loop-shell .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 90; width: min(300px, 84vw); padding: 16px 12px calc(14px + env(safe-area-inset-bottom)); transform: translateX(-102%); visibility: hidden; transition: transform .22s var(--ds-ease), visibility 0s linear .22s; box-shadow: 16px 0 40px #00000066; }
  .app-shell.loop-shell.nav-open .sidebar { transform: none; visibility: visible; transition: transform .22s var(--ds-ease); }
  .app-shell.loop-shell.nav-open .loop-scrim { display: block; position: fixed; inset: 0; z-index: 80; background: #0009; }
  .app-shell.loop-shell .loop-nav-close { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--ds-radius-control); color: var(--ds-text-secondary); }
  .app-shell.loop-shell .loop-nav-close:hover { background: var(--ds-surface-raised); color: var(--ds-text); }
  .app-shell.loop-shell .loop-nav { margin-top: 14px; }
  .app-shell.loop-shell .sidebar .nav-label { display: block; }
  .app-shell.loop-shell .sidebar .nav-item, .app-shell.loop-shell .sidebar nav .nav-item { height: 44px; min-height: 44px; padding: 0 12px; flex-direction: row; justify-content: flex-start; text-align: left; }
  .app-shell.loop-shell .sidebar .nav-item span, .app-shell.loop-shell .sidebar nav .nav-item span { display: inline; font-size: 14px; max-width: none; }
  .app-shell.loop-shell .sidebar nav + .nav-label + nav, .app-shell.loop-shell .sidebar .module-nav { border: 0; padding: 0; }
  .app-shell.loop-shell .loop-signout { display: inline-flex; margin-left: auto; min-height: 36px; padding: 6px 8px; font-size: 12.5px; }
  .app-shell.loop-shell .main { margin-left: 0; width: 100%; padding-bottom: calc(var(--loop-tabbar) + env(safe-area-inset-bottom)); overflow-x: clip; }
  .app-shell.loop-shell .topbar { height: 56px; padding: 0 12px 0 6px; gap: 6px; }
  .app-shell.loop-shell .loop-menu-button { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--ds-radius-control); color: var(--ds-text); }
  .app-shell.loop-shell .loop-menu-button:focus-visible { outline: 2px solid var(--ds-focus); outline-offset: -2px; }
  .app-shell.loop-shell .loop-mobile-mark { display: inline-flex; font-size: 21px; }
  .app-shell.loop-shell .loop-mobile-mark svg.brand-icon { width: 14px; height: 20px; }
  .app-shell.loop-shell .breadcrumb { display: none; }
  .app-shell.loop-shell .topbar-right { margin-left: auto; gap: 8px; }
  .app-shell.loop-shell .mode-label, .app-shell.loop-shell .loop-top-signout { display: none; }
  .app-shell.loop-shell .page-content { padding: 22px 16px 48px; }
  .app-shell.loop-shell .page-heading { align-items: flex-start; flex-direction: column; gap: 16px; margin-bottom: 22px; padding-bottom: 20px; }
  .app-shell.loop-shell .page-heading h1 { font-size: 30px; }
  .app-shell.loop-shell .page-heading > div > p:not(.eyebrow) { font-size: 14px; }
  .app-shell.loop-shell .page-heading > .button.dark { width: 100%; }
  .app-shell.loop-shell .loop-tabbar .nav-item span { display: block; font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* One line on phones: a link to setup and a dismiss control. */
  .setup-banner { gap: 4px; margin: -6px 0 18px; padding: 0 0 0 12px; min-height: 44px; border-width: 0 0 1px; border-left: 2px solid var(--ds-accent); border-radius: 0; background: none; }
  .setup-banner-icon, .setup-banner-copy, .setup-banner-actions { display: none; }
  .setup-banner-line { display: block; flex: 1; min-width: 0; padding: 12px 0; font-size: 13px; line-height: 1.35; color: var(--ds-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .setup-banner-line span { color: var(--ds-text); font-weight: 600; }
  .setup-banner-x { display: grid; place-items: center; flex: 0 0 44px; height: 44px; color: var(--ds-text-muted); }
  .setup-banner-x svg { width: 16px; height: 16px; }
  .app-shell.loop-shell .section-top h2 { font-size: 18px; }
  .app-shell.loop-shell .toast { left: 16px; right: 16px; transform: none; max-width: none; bottom: calc(var(--loop-tabbar) + 12px + env(safe-area-inset-bottom)); }
  .app-shell.loop-shell .loop-tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; height: calc(var(--loop-tabbar) + env(safe-area-inset-bottom)); padding: 0 4px env(safe-area-inset-bottom); background: var(--ds-sidebar); border-top: 1px solid var(--ds-line); }
  .app-shell.loop-shell .loop-tabbar .nav-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; height: 100%; min-height: 0; padding: 0 2px; margin: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--ds-text-muted); font: 600 12px/1 var(--ds-font-body); text-decoration: none; }
  .app-shell.loop-shell .loop-tabbar .nav-item > svg { width: 20px; height: 20px; }
  .app-shell.loop-shell .loop-tabbar .nav-item.active { color: var(--ds-text); }
  .app-shell.loop-shell .loop-tabbar .nav-item.active > svg { color: var(--ds-accent); }
  .app-shell.loop-shell .loop-tabbar .nav-item.active::before { content: ""; position: absolute; top: -1px; left: 26%; right: 26%; height: 2px; background: var(--ds-accent); }
  .start-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "tpl" "idea" "script" "clip" "research"; gap: 10px; }
  .start-card { min-height: 0; padding: 16px; }
  .start-card strong { margin-top: 14px; font-size: 17px; }
  .start-templates { padding: 16px 0 14px; }
  .start-templates-head, .start-templates > .start-action { padding: 0 16px; }
  .start-posters { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 16px 4px; scrollbar-width: none; }
  .start-posters::-webkit-scrollbar { display: none; }
  .start-posters > div { flex: 0 0 38%; scroll-snap-align: start; }
  .app-shell.loop-shell .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .app-shell.loop-shell .project-cover .cover-title { font-size: 15px; left: 12px; right: 12px; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell.loop-shell .sidebar, .start-poster-frame img, .start-card { transition: none; }
}

/* Native control parts (file button, range, scrollbar). These pseudo-elements
   ship unminified so each selector list stays valid in every engine. */
.file-label input[type="file"] { min-height: 44px; padding: 5px 12px 5px 5px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-control); background: var(--ds-field); color: var(--ds-text-secondary); font: 500 13px/1.4 var(--ds-font-body); cursor: pointer; }
.file-label input[type="file"]::file-selector-button {
  min-height: 34px;
  margin: 0 12px 0 0;
  padding: 0 14px;
  border: 1px solid var(--ds-control-border);
  border-radius: var(--ds-radius-control);
  background: var(--ds-surface-raised);
  color: var(--ds-text);
  font: 600 13px/1 var(--ds-font-body);
  cursor: pointer;
  transition: background-color var(--ds-duration), border-color var(--ds-duration);
}
.file-label input[type="file"]:not(:disabled):hover::file-selector-button { background: var(--ds-surface-hover); border-color: var(--ds-control-border-hover); }
.file-label input[type="file"]:disabled { cursor: not-allowed; color: var(--ds-disabled); }
.file-label input[type="file"]:disabled::file-selector-button { color: var(--ds-disabled); background: var(--ds-disabled-surface); border-color: var(--ds-line); cursor: not-allowed; }
@media (max-width: 760px), (pointer: coarse) {
  .file-label input[type="file"]::file-selector-button { min-height: 34px; }
}

/* Thin, quiet scrollbars on the dark workspace. */
.app-shell { scrollbar-color: #5a534b transparent; }
.app-shell ::-webkit-scrollbar { width: 10px; height: 10px; }
.app-shell ::-webkit-scrollbar-track { background: transparent; }
.app-shell ::-webkit-scrollbar-thumb { background: #4a443d; border: 2px solid transparent; border-radius: 10px; background-clip: padding-box; }
.app-shell ::-webkit-scrollbar-thumb:hover { background-color: #6b6259; }
.app-shell ::-webkit-scrollbar-corner { background: transparent; }

/* File pickers: a real button with an empty-state hint. The native input stays in
   the tab order (visually hidden) so keyboard and screen-reader access is kept. */
.file-button { position: relative; display: flex; flex-direction: row; justify-content: flex-start; text-align: left; align-items: center; gap: 12px; width: 100%; min-height: 56px; margin: 0; padding: 10px 14px; border: 1px dashed var(--ds-control-border); border-radius: var(--ds-radius-control); background: var(--ds-field); color: var(--ds-text); cursor: pointer; transition: border-color var(--ds-duration), background-color var(--ds-duration); }
.file-button:hover:not(.is-disabled) { border-color: var(--ds-control-border-hover); background: var(--ds-surface-raised); }
.file-button:focus-within { outline: 2px solid var(--ds-focus); outline-offset: 2px; }
.file-button.is-disabled { cursor: not-allowed; border-style: solid; border-color: var(--ds-line); color: var(--ds-text-muted); }
.file-button-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.file-button-face { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: var(--ds-radius-control); background: var(--ds-surface-raised); border: 1px solid var(--ds-line); color: var(--ds-accent); }
.file-button.is-disabled .file-button-face { color: var(--ds-text-muted); }
.file-button-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; text-align: left; }
.file-button-copy strong { font: 650 13.5px/1.25 var(--ds-font-heading); color: inherit; }
.file-button-copy small { font-size: 12px; line-height: 1.4; color: var(--ds-text-muted); }
.file-field-label { display: block; margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ds-text); }
.asset-picker .asset-attached { margin-top: 10px; }
.music-picker .file-button { margin-top: 4px; }

/* Studio: the storyboard leads; optional voice/character/model settings follow. */
.app-shell.loop-shell .studio-settings { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--ds-line); }
.app-shell.loop-shell .studio-settings-head { margin-bottom: 20px; }
.app-shell.loop-shell .studio-settings-head .eyebrow { display: block; margin-bottom: 8px; color: var(--ds-accent); }
.app-shell.loop-shell .studio-settings-head h2 { font: 700 22px/1.2 var(--ds-font-heading); letter-spacing: -.02em; color: var(--ds-text); }
.app-shell.loop-shell .studio-settings-head p { max-width: 640px; margin-top: 6px; font-size: 13.5px; line-height: 1.55; color: var(--ds-text-secondary); }
.app-shell.loop-shell .studio-settings > section { margin: 0 0 16px; }
.app-shell.loop-shell .studio-opening { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; max-width: 520px; margin: 12vh auto 0; padding: 28px; border: 1px solid var(--ds-line); border-radius: var(--ds-radius-card); background: var(--ds-surface); }
.app-shell.loop-shell .studio-opening strong { font: 700 20px/1.25 var(--ds-font-heading); color: var(--ds-text); }
.app-shell.loop-shell .studio-opening p { font-size: 13.5px; line-height: 1.55; color: var(--ds-text-secondary); }
.studio-opening-bar { display: block; width: 100%; height: 2px; background: linear-gradient(90deg, var(--ds-accent) 0 30%, var(--ds-line) 30%); background-size: 200% 100%; animation: studio-opening 1.2s linear infinite; }
@media (prefers-reduced-motion: reduce) { .studio-opening-bar { animation: none; } }
.operator-details { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--ds-line); }
.operator-details summary { cursor: pointer; font-size: 13px; color: var(--ds-text-secondary); }
.operator-details[open] summary { margin-bottom: 10px; }

/* One product from sign-up to workspace: the same paper header band as the public
   pages and onboarding, over the dark editing canvas. */
.app-shell.loop-shell { --loop-band: #f3efe7; --loop-band-ink: #171716; --loop-band-muted: #5f5a53; --loop-band-rule: #1717161f; }
.app-shell.loop-shell .topbar { background: var(--loop-band); border-bottom: 1px solid var(--loop-band-rule); color: var(--loop-band-ink); }
.app-shell.loop-shell .breadcrumb { color: var(--loop-band-muted); }
.app-shell.loop-shell .breadcrumb a:hover, .app-shell.loop-shell .breadcrumb strong { color: var(--loop-band-ink); }
.app-shell.loop-shell .breadcrumb > span { color: #17171659; }
.app-shell.loop-shell .topbar .text-button { color: var(--loop-band-muted); }
.app-shell.loop-shell .topbar .text-button:hover:not(:disabled) { color: var(--loop-band-ink); background: #1717160f; }
.app-shell.loop-shell .top-avatar { background: var(--loop-band-ink); color: var(--loop-band); }
.app-shell.loop-shell .topbar :focus-visible { outline: 2px solid #b8643f; outline-offset: 2px; }
.app-shell.loop-shell .topbar .wordmark, .app-shell.loop-shell .loop-menu-button { color: var(--loop-band-ink); }
.app-shell.loop-shell .topbar .wordmark svg.brand-icon { fill: #b8643f; color: #b8643f; }
.app-shell.loop-shell .loop-sidebar-head { flex: 0 0 auto; height: 60px; margin: -22px -14px 18px; padding: 0 12px 0 24px; background: var(--loop-band); border-bottom: 1px solid var(--loop-band-rule); }
.app-shell.loop-shell .loop-sidebar-head .wordmark { color: var(--loop-band-ink); }
.app-shell.loop-shell .loop-sidebar-head .wordmark svg.brand-icon { fill: #b8643f; color: #b8643f; }
.app-shell.loop-shell .loop-sidebar-head .loop-nav-close { color: var(--loop-band-ink); }
@media (max-width: 760px) {
  .app-shell.loop-shell .loop-sidebar-head { height: 56px; margin: -16px -12px 8px; padding: 0 8px 0 20px; }
  .app-shell.loop-shell .loop-sidebar-head .loop-nav-close:hover { background: #1717160f; color: var(--loop-band-ink); }
}
}
