/* Studio layout, modelled on Sume's video generator (measured 2026-11-12).
   Colours are ours for now and live only in these tokens. */
:root {
  --bg: #08080a; --surface: #111114; --raise: rgba(255,255,255,.05); --hover: rgba(255,255,255,.08);
  --line: rgba(255,255,255,.1); --line-soft: rgba(255,255,255,.05);
  --text: #f2efe9; --muted: rgba(242,239,233,.6);
  --accent: #e8693c; --accent-2: #f2a65a; --accent-soft: rgba(232,105,60,.15);
  --bad: #eb5757; --ok: #6fcf97;
  --sans: 'Inter', system-ui, -apple-system, sans-serif; --serif: 'Instrument Serif', Georgia, serif;
}
* { 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; }

/* rail: 52px */
.rail { position: fixed; left: 0; top: 0; bottom: 0; width: 52px; background: var(--surface); padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 30; }
.rail-logo { width: 36px; height: 36px; border-radius: 10px; background: var(--raise); display: grid; place-items: center; margin-bottom: 8px; }
.rail-logo .mark { width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.rail-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.rail-btn:hover { background: var(--hover); color: var(--text); }
.rail-btn.on { color: var(--accent); background: var(--raise); }
.rail-avatar { width: 28px; height: 28px; border-radius: 28%; background: var(--accent-soft); color: var(--accent-2); font-weight: 600; margin-bottom: 4px; }

/* top bar: 52px, starts after the rail */
.topbar { position: fixed; left: 52px; right: 0; top: 0; height: 52px; display: flex; align-items: center; gap: 16px; padding: 0 16px; z-index: 20; }
.logo { font-weight: 600; font-size: 17px; letter-spacing: .1px; white-space: nowrap; }
.logo em { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 21px; }
.menu { list-style: none; display: flex; gap: 2px; margin: 0 0 0 12px; padding: 0; font-size: 14px; overflow: hidden; }
.menu a { display: block; padding: 4px 8px; border-radius: 8px; color: var(--text); white-space: nowrap; }
.menu a:hover { background: var(--hover); }
.menu a.on { color: var(--accent); }
.actions { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.act-btn { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line-soft); white-space: nowrap; }
.act-btn:hover { background: var(--hover); }
.act-btn.upgrade { margin-bottom: 4px; }
.badge-from { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); font-size: 10px; line-height: 14px; padding: 0 5px; border-radius: 4px; background: var(--accent); color: #fff; white-space: nowrap; }
.act-link { display: inline-flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 8px; color: var(--muted); white-space: nowrap; }
.act-link:hover { color: var(--text); background: var(--hover); }
.balance { padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); font-variant-numeric: tabular-nums; cursor: pointer; }
.acct { position: relative; }
.avatar { width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }

/* workspace: below the bar, beside the rail; padding 0 16 8 */
.work { position: fixed; left: 52px; right: 0; top: 52px; bottom: 0; padding: 0 16px 8px; display: flex; gap: 8px; }

/* create panel: 320px */
.create { width: 320px; flex-shrink: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 0 9px 12px; display: flex; flex-direction: column; min-height: 0; max-height: 728px; }
.ctabs { display: flex; gap: 12px; padding: 12px 8px 0; flex-shrink: 0; }
.ctabs button { height: 36px; font-size: 14px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; }
.ctabs button.on { color: var(--accent); border-color: var(--accent); }
.ctabs button.soon { cursor: default; }
.cscroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 8px; scrollbar-width: none; }
.cscroll::-webkit-scrollbar { display: none; }
.cscroll > * { flex-shrink: 0; }

.model-card { position: relative; height: 112px; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; justify-content: flex-end;
  background: radial-gradient(120% 140% at 100% 0%, rgba(232,105,60,.34), transparent 60%), var(--raise); }
.model-card h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 20px; color: var(--accent-2); }
.model-card p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.model-card .chg { position: absolute; right: 10px; top: 10px; height: 28px; padding: 0 10px; border-radius: 999px; background: rgba(255,255,255,.1); font-size: 12px; display: inline-flex; align-items: center; }
.bars { fill: currentColor; stroke: none; width: 16px; height: 16px; }

.refbox { border: 1px solid var(--line); border-radius: 16px; padding: 8px; min-height: 120px; display: flex; }
.ref-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 10px; color: var(--muted); }
.ref-empty:hover { background: var(--raise); }
.ref-empty .plus { width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.1); display: grid; place-items: center; font-size: 20px; color: var(--text); margin-bottom: 4px; }
.ref-empty b { color: var(--text); font-size: 14px; font-weight: 500; }
.ref-empty .muted { font-size: 12px; }
.refs { display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.ref { position: relative; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: #000; border: 1px solid var(--line); }
.ref img, .ref video { width: 100%; height: 100%; object-fit: cover; }
.ref .tag { position: absolute; left: 3px; bottom: 3px; font-size: 10px; background: rgba(0,0,0,.7); padding: 1px 4px; border-radius: 4px; }
.ref .x { position: absolute; right: 2px; top: 2px; background: rgba(0,0,0,.7); border-radius: 50%; width: 18px; height: 18px; font-size: 11px; line-height: 18px; }
.ref.audio { display: grid; place-items: center; font-size: 11px; color: var(--muted); padding: 4px; text-align: center; }
.ref.add { display: grid; place-items: center; color: var(--muted); font-size: 22px; border-style: dashed; background: transparent; }

.promptbox { border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.promptbox label { font-size: 12px; color: var(--muted); }
.promptbox textarea { height: 100px; resize: none; background: transparent; border: 0; outline: 0; padding: 0; font: 14px/1.45 var(--sans); color: var(--text); }
.promptbox textarea::placeholder { color: var(--muted); }
.chips { display: flex; gap: 6px; }
.chip { height: 26px; padding: 0 8px; border-radius: 999px; background: rgba(255,255,255,.1); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.chip:hover { background: rgba(255,255,255,.14); }

.row-tile, .tile { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 16px; text-align: left; height: 52px; }
.row-tile { width: 100%; height: 48px; }
.row-tile:hover, .tile:hover, .row-tile.open, .tile.open { background: var(--raise); }
.row-tile .t, .tile .t { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.k { font-size: 12px; color: var(--muted); }
.v { display: flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.v svg { width: 14px; height: 14px; }
.row-tile .v .bars { color: var(--accent); }
.chev { color: var(--muted); font-size: 18px; line-height: 1; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ar { display: inline-block; border: 1.6px solid currentColor; border-radius: 2px; }

.gen { display: grid; grid-template-columns: 1.25fr 1fr; gap: 8px; padding: 8px 3px 0; }
.gen-btn { height: 48px; border-radius: 999px; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; white-space: nowrap; }
.gen-btn span { font-size: 14px; opacity: .85; }
.gen-btn.fast { background: var(--accent); color: #fff; }
.gen-btn.fast:hover { filter: brightness(1.08); }
.gen-btn.slow { border: 1px solid var(--line); background: var(--raise); }
.gen-btn.slow:hover { background: var(--hover); }
.gen-btn:disabled { opacity: .5; cursor: not-allowed; }

/* output panel */
.out { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; min-height: 0; }
.out-head { display: flex; align-items: center; padding: 8px 16px; height: 58px; flex-shrink: 0; }
.pills { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: 999px; }
.pills button { height: 32px; padding: 0 12px; border-radius: 999px; display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--muted); }
.pills button svg { width: 14px; height: 14px; }
.pills button.on { background: rgba(255,255,255,.1); color: var(--accent-2); }
.pane { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 16px; }
.filters { display: flex; gap: 6px; margin-bottom: 12px; }
.fchip { height: 28px; padding: 0 10px; border-radius: 8px; background: rgba(217,217,217,.04); display: inline-flex; align-items: center; cursor: pointer; color: var(--muted); }
.fchip.on { color: var(--accent-2); }
.empty { grid-column: 1 / -1; color: var(--muted); font-size: 14.4px; margin: 12px 0; }
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.job { background: var(--raise); border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.job .media { background: #000; aspect-ratio: 9/16; display: grid; place-items: center; }
.job .media.w { aspect-ratio: 16/9; } .job .media.s { aspect-ratio: 1/1; }
.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); }
.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); } }

.how { text-align: center; padding-top: 48px; }
.how h2 { font-size: 24px; font-weight: 500; margin: 0 0 8px; }
.how > p { font-size: 14px; margin: 0 0 40px; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; text-align: left; }
.how-grid b { display: block; font-size: 16px; font-weight: 500; margin: 20px 0 6px; }
.how-grid p { margin: 0; font-size: 14px; line-height: 1.45; }
.how-img { aspect-ratio: 4/3; border-radius: 12px; border: 1px dashed rgba(255,255,255,.18); display: grid; place-items: center; text-align: center; color: var(--muted);
  background: repeating-linear-gradient(135deg, #141417 0 14px, #18181c 14px 28px); }
.how-img small { color: var(--accent-2); }

/* popovers */
.pop { position: fixed; z-index: 40; background: #1a1a1e; border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.5); display: none; }
.pop.show { display: block; }
.acct-pop { position: absolute; right: 0; top: 40px; width: 220px; }
.pop-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; margin-top: 8px; }
.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; }

/* floating media library, beside the create panel */
.lib-float { position: fixed; left: 404px; top: 52px; width: min(640px, calc(100vw - 420px)); max-height: 480px; z-index: 35; background: #1a1a1e; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.6); display: flex; flex-direction: column; }
.lib-float[hidden] { display: none; }
.lib-head { display: flex; align-items: center; padding: 8px 10px; }
.lib-tabs button { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.lib-tabs button.on { background: rgba(255,255,255,.08); color: var(--accent-2); }
.lib-head .x { font-size: 20px; color: var(--muted); width: 30px; height: 30px; }
.lib-body { margin: 0 6px 6px; background: rgba(255,255,255,.04); border-radius: 12px; padding: 10px; overflow-y: auto; }
.lib-filter { display: flex; gap: 4px; margin-bottom: 10px; }
.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(--accent-2); }
.lib { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.lib .item { aspect-ratio: 1; border-radius: 10px; background: rgba(255,255,255,.06); 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); 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); background: var(--raise); border-radius: 999px; padding: 9px 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.wide { width: 100%; }
.btn.google { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; border-color: #fff; font-weight: 500; text-decoration: none; margin-top: 14px; }
.btn.google:hover { background: #f1f1f1; }
.btn.google svg { width: 18px; height: 18px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 14px 0 10px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.field { width: 100%; background: var(--raise); border: 1px solid var(--line); 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); border-radius: 14px; padding: 16px; background: var(--raise); text-align: left; }
.pack b { font-size: 28px; display: block; }
.pack:hover { border-color: var(--accent); }
.custom { display: flex; gap: 8px; align-items: center; }
.custom input { width: 120px; background: var(--raise); border: 1px solid var(--line); 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); padding: 10px 16px; border-radius: 10px; z-index: 60; display: none; max-width: calc(100% - 32px); }
.toast.show { display: block; }

/* small screens: stack, page scrolls */
@media (max-width: 900px) {
  .menu, .act-link { display: none; }
}
@media (max-width: 760px) {
  body.st { overflow: auto; }
  .rail { display: none; }
  .topbar { left: 0; position: sticky; background: var(--bg); }
  .work { position: static; flex-direction: column; padding: 0 16px 16px; }
  .create { width: 100%; max-height: none; }
  .out { min-height: 60vh; }
  .how-grid { grid-template-columns: 1fr; }
  .lib-float { left: 16px; right: 16px; width: auto; top: 60px; }
  .lib { grid-template-columns: repeat(3, 1fr); }
  .packs { grid-template-columns: 1fr; }
  .badge-from { display: none; }
  .topbar { gap: 8px; }
  .logo { font-size: 15px; } .logo em { font-size: 18px; }
}
@media (max-width: 440px) {
  .act-btn.upgrade { padding: 0 9px; font-size: 0; gap: 0; }
  .act-btn.upgrade svg { width: 16px; height: 16px; }
}
