/* Home studio, modelled on Sume's Director Studio home (2026-11-12).
   Colours are ours (orange accent) and live only in these tokens. */
:root {
  --bg: #121214; --side: #0d0d0f; --surface: #1b1b1e; --tile: #242427; --tile-hover: #2c2c30;
  --hover: rgba(255,255,255,.06); --line: rgba(255,255,255,.08); --line-strong: rgba(255,255,255,.14);
  --text: #f2efe9; --muted: rgba(242,239,233,.55);
  --accent: #e8693c; --accent-2: #f2a65a; --accent-soft: rgba(232,105,60,.15);
  --ok: #6fcf97; --bad: #eb5757;
  --sans: 'Inter', system-ui, -apple-system, sans-serif; --display: 'Anton', 'Impact', sans-serif; --serif: 'Instrument Serif', Georgia, serif;
  --side-w: 228px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body.st { background: var(--bg); color: var(--text); font: 13px/1.4 var(--sans); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mark { display: inline-block; width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex-shrink: 0; }
.mark.sm { width: 14px; height: 14px; border-radius: 4px; }

/* ── sidebar ── */
.side { position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 12px 8px 10px; z-index: 30; transition: transform .22s ease; }
body.side-hidden .side { transform: translateX(-100%); }
.ws { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.ws-btn { flex: 1; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px; border-radius: 10px; background: rgba(255,255,255,.04); font-size: 14px; font-weight: 500; white-space: nowrap; }
.ws-btn:hover { background: var(--hover); }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button, .nav-row { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 10px; border-radius: 10px; font-size: 14px; font-weight: 500; text-align: left; width: 100%; white-space: nowrap; }
.nav svg, .nav-row svg { color: var(--muted); }
.nav a:hover, .nav button:hover, .nav-row:hover { background: var(--hover); }
.nav a.on { background: rgba(255,255,255,.07); }
.nav a.on svg { color: var(--text); }
.side-sec { display: flex; align-items: center; padding: 22px 8px 8px; font-size: 12px; color: var(--muted); }
.recent { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; min-height: 0; scrollbar-width: none; }
.rec { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 10px; font-size: 13.5px; text-align: left; color: rgba(242,239,233,.8); }
.rec span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec:hover { background: var(--hover); color: var(--text); }
.rec.new svg { width: 18px; height: 18px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.bad { background: var(--bad); }
.dot.run { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.side-foot { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.from { margin-left: auto; font-size: 10.5px; font-weight: 600; line-height: 16px; padding: 0 6px; border-radius: 4px; background: var(--accent); color: #fff; }
.me-row { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 8px; border-radius: 10px; text-align: left; }
.me-row:hover { background: var(--hover); }
.avatar { width: 24px; height: 24px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-2); font-weight: 600; font-size: 12px; display: grid; place-items: center; flex-shrink: 0; }
.who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.balance { font-size: 12px; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.acct { position: relative; }
.acct-pop { position: absolute; left: 0; right: 0; bottom: 46px; top: auto; padding: 6px; }

.side-open { position: fixed; left: 12px; top: 12px; z-index: 25; background: var(--surface); border: 1px solid var(--line); display: none; }
body.side-hidden .side-open { display: grid; }
.scrim { display: none; }

/* ── main column ── */
.main { position: fixed; left: var(--side-w); right: 0; top: 0; bottom: 0; overflow-y: auto; overflow-x: hidden; padding-bottom: 64px; transition: left .22s ease; }
body.side-hidden .main { left: 0; }

.hero { text-align: center; padding: 56px 16px 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 24px; font-weight: 500; letter-spacing: -.3px; }
.brand .mark { width: 26px; height: 26px; border-radius: 7px; }
.display { margin: 4px 0 0; font: 400 clamp(56px, 8.4vw, 112px)/.86 var(--display); letter-spacing: -.5px; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; transform: scaleY(1.12); transform-origin: top; }
.display span:last-child { font-size: .78em; margin-top: .06em; }
.hero p { margin: calc(clamp(56px, 8.4vw, 112px) * .3) 0 0; font-size: 18px; color: rgba(242,239,233,.7); }

/* film strip */
.reel { margin: 34px 0 0; overflow: hidden; -webkit-mask: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.reel-track { display: flex; gap: 12px; width: max-content; animation: reel 60s linear infinite; }
.reel:hover .reel-track { animation-play-state: paused; }
@keyframes reel { to { transform: translateX(calc(-50% - 6px)); } }
.frame { width: 280px; height: 158px; border-radius: 6px; overflow: hidden; flex-shrink: 0; background: #000; position: relative; }
.frame video { width: 100%; height: 100%; object-fit: cover; }
.frame.still::after { content: ''; position: absolute; inset: 0; opacity: .35; mix-blend-mode: overlay;
  background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0,0,0,.9)), repeating-linear-gradient(0deg, rgba(255,255,255,.04) 0 1px, transparent 1px 3px); }
@media (prefers-reduced-motion: reduce) { .reel-track { animation: none; } }

/* composer */
.composer { width: min(800px, calc(100% - 32px)); margin: 40px auto 0; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.ctop { display: flex; gap: 6px; align-items: stretch; overflow-x: auto; scrollbar-width: none; }
.ctop::-webkit-scrollbar { display: none; }
.ctile { display: flex; align-items: center; gap: 10px; height: 48px; min-width: 150px; padding: 0 12px 0 8px; border-radius: 12px; background: var(--tile); text-align: left; flex-shrink: 0; }
.ctile:hover, .ctile.open { background: var(--tile-hover); }
.cv { display: flex; flex-direction: column; line-height: 1.2; }
.cv small { font-size: 11px; color: var(--muted); font-weight: 500; }
.cv b { font-size: 14px; font-weight: 500; white-space: nowrap; }
.sq { width: 32px; height: 32px; border-radius: 8px; background: rgba(0,0,0,.35); display: grid; place-items: center; font-size: 20px; font-weight: 300; }
.thumb { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; }
.t-model { background: radial-gradient(70% 70% at 30% 30%, var(--accent-2), transparent 70%), linear-gradient(135deg, #5a2412, var(--accent)); }
.t-speed { background: radial-gradient(60% 60% at 70% 30%, #ffd27a, transparent 70%), linear-gradient(160deg, #2a3a5a, #7c4a8a 60%, #e8693c); }
.refs { display: flex; gap: 6px; align-items: center; }
.ref { position: relative; width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: #000; flex-shrink: 0; }
.ref img, .ref video { width: 100%; height: 100%; object-fit: cover; }
.ref .tag { position: absolute; left: 2px; bottom: 2px; font-size: 9px; background: rgba(0,0,0,.7); padding: 0 3px; border-radius: 3px; }
.ref .x { position: absolute; right: 2px; top: 2px; background: rgba(0,0,0,.7); border-radius: 50%; width: 16px; height: 16px; font-size: 10px; line-height: 16px; text-align: center; }
.ref.audio { display: grid; place-items: center; font-size: 10px; color: var(--muted); padding: 3px; text-align: center; background: var(--tile); }

.cbody { display: flex; gap: 10px; align-items: stretch; margin-top: 8px; }
.cmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cmain textarea { resize: none; min-height: 44px; background: transparent; border: 0; outline: 0; padding: 8px 6px 6px; font: 14px/1.5 var(--sans); color: var(--text); }
.cmain textarea::placeholder { color: var(--muted); }
.tools { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px 0 2px; }
.tb { height: 30px; padding: 0 9px; border-radius: 8px; background: rgba(255,255,255,.05); display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.tb:hover, .tb.open { background: rgba(255,255,255,.1); }
.tb svg { width: 14px; height: 14px; }
.tb .dn { width: 12px; height: 12px; color: var(--muted); }
.sq-tb { width: 30px; padding: 0; justify-content: center; }
.ar { display: inline-block; border: 1.6px solid currentColor; border-radius: 2px; }
.gen-btn { width: 128px; flex-shrink: 0; border-radius: 14px; background: var(--accent); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), 0 6px 20px rgba(232,105,60,.25); }
.gen-btn b { font-size: 14px; font-weight: 600; }
.gen-btn span { font-size: 13px; opacity: .9; font-variant-numeric: tabular-nums; }
.gen-btn:hover { filter: brightness(1.07); }
.gen-btn:disabled { opacity: .55; cursor: not-allowed; }
.fine { text-align: center; color: var(--muted); font-size: 12px; margin: 12px 0 0; }

/* my generations */
.gens { width: min(1100px, calc(100% - 32px)); margin: 72px auto 0; }
.gens-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.gens-head h2 { margin: 0; font-size: 16px; font-weight: 500; display: flex; align-items: center; gap: 4px; }
.gens-head h2 svg { color: var(--muted); }
.filters { display: flex; gap: 4px; }
.fchip { height: 26px; padding: 0 10px; border-radius: 8px; display: inline-flex; align-items: center; cursor: pointer; color: var(--muted); font-size: 12.5px; }
.fchip:hover { background: var(--hover); }
.fchip.on { background: rgba(255,255,255,.07); color: var(--text); }
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.new-wrap { display: flex; flex-direction: column; gap: 10px; }
.new-tile { width: 100%; aspect-ratio: 16/9; border-radius: 8px; background: var(--surface); display: grid; place-items: center; }
.new-tile:hover { background: var(--tile); }
.new-tile .ic { width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; background: rgba(255,255,255,.04); }
.new-tile svg { width: 22px; height: 22px; }
.new-cap { font-size: 14px; padding-left: 8px; }
.job { background: var(--surface); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; scroll-margin: 80px; }
.job .media { background: #000; aspect-ratio: 16/9; display: grid; place-items: center; }
.job video { width: 100%; height: 100%; object-fit: contain; }
.job .meta { padding: 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.job .meta p { margin: 0; color: var(--text); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.job .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.job .acts button, .job .acts a { font-size: 12px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line-strong); }
.job .acts button:hover, .job .acts a:hover { background: var(--hover); }
.badge { display: inline-flex; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.06); }
.badge.fast { color: var(--accent-2); }
.spin { width: 22px; height: 22px; border: 2px solid #444; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* popovers */
.pop { position: fixed; z-index: 40; background: #1f1f23; border: 1px solid var(--line-strong); border-radius: 14px; padding: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.5); display: none; }
.pop.show { display: block; }
.pop-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.pop-item:hover { background: var(--hover); }
.picker { width: 262px; }
.picker .ph { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.picker .big { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.picker .opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 14px; text-align: left; }
.picker .opt:hover { background: var(--hover); }
.picker .opt.on { background: rgba(255,255,255,.06); }
.picker .opt .ck { margin-left: auto; color: var(--accent); visibility: hidden; }
.picker .opt.on .ck { visibility: visible; }
.picker .opt small { display: block; color: var(--muted); font-size: 12px; }
.picker input[type=range] { width: 100%; accent-color: var(--accent); }
.ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* media library: a centred sheet over the page */
.lib-float { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(680px, calc(100vw - 32px)); max-height: min(520px, calc(100vh - 32px)); z-index: 45;
  background: #1f1f23; border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.7); display: flex; flex-direction: column; }
.lib-head { display: flex; align-items: center; padding: 10px 10px 8px 14px; }
.lib-head .x { font-size: 20px; color: var(--muted); width: 30px; height: 30px; border-radius: 8px; }
.lib-head .x:hover { background: var(--hover); }
.lib-body { margin: 0 8px 8px; background: rgba(255,255,255,.03); border-radius: 12px; padding: 10px; overflow-y: auto; }
.lib-filter { display: flex; gap: 4px; }
.lib-filter button { height: 28px; padding: 0 10px; border-radius: 8px; color: var(--muted); }
.lib-filter button.on { background: rgba(255,255,255,.08); color: var(--text); }
.lib { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lib .item { aspect-ratio: 1; border-radius: 10px; background: rgba(255,255,255,.05); overflow: hidden; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 12px; cursor: pointer; border: 1px solid transparent; }
.lib .item:hover { border-color: var(--accent); }
.lib .item img, .lib .item video { width: 100%; height: 100%; object-fit: cover; }
.lib .item.blank { cursor: default; } .lib .item.blank:hover { border-color: transparent; }
.lib .up svg { width: 18px; height: 18px; margin-bottom: 6px; }

/* modals (sign in, top up) */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: none; place-items: center; z-index: 50; padding: 16px; }
.modal.open { display: grid; }
.sheet { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; width: min(760px, 100%); max-height: 90vh; overflow-y: auto; padding: 24px; position: relative; font-size: 15px; }
.sheet.narrow { width: min(440px, 100%); }
.sheet h2 { font-family: var(--serif); font-weight: 400; font-size: 34px; margin: 0 0 6px; }
.sheet .close { position: absolute; right: 14px; top: 12px; color: var(--muted); font-size: 22px; }
.btn { display: inline-block; border: 1px solid var(--line-strong); background: var(--tile); border-radius: 999px; padding: 9px 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.wide { width: 100%; }
.field { width: 100%; background: var(--tile); border: 1px solid var(--line-strong); border-radius: 10px; padding: 11px 12px; color: var(--text); font: inherit; }
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.pack { border: 1px solid var(--line-strong); border-radius: 14px; padding: 16px; background: var(--tile); text-align: left; }
.pack b { font-size: 28px; display: block; }
.pack:hover { border-color: var(--accent); }
.custom { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.custom input { width: 120px; background: var(--tile); border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 10px; color: var(--text); font: inherit; }
.draft { border: 1px dashed var(--accent); color: var(--accent-2); padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #26262c; border: 1px solid var(--line-strong); padding: 10px 16px; border-radius: 10px; z-index: 60; display: none; max-width: calc(100% - 32px); }
.toast.show { display: block; }

/* phones and narrow windows: sidebar slides over the page */
@media (max-width: 860px) {
  .main { left: 0; }
  body:not(.side-hidden) .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 29; }
  .side { box-shadow: 20px 0 50px rgba(0,0,0,.5); }
  .hero { padding-top: 64px; }
}
@media (max-width: 600px) {
  .cbody { flex-direction: column; }
  .gen-btn { width: 100%; height: 52px; flex-direction: row; gap: 10px; }
  .frame { width: 200px; height: 113px; }
  .hero p { font-size: 15px; }
  .lib { grid-template-columns: repeat(3, 1fr); }
  .packs { grid-template-columns: 1fr; }
  .ctile { min-width: 0; }
}
