@font-face { font-family: "Anton"; src: url("/fonts/Anton-Regular.ttf"); font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/Inter.ttf"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "DM Serif"; src: url("/fonts/DMSerifDisplay-Italic.ttf"); font-style: italic; font-display: swap; }

:root {
  --ink: #12142B;
  --ink-2: #1B1F3B;
  --ink-3: #272C52;
  --line: #343a6b;
  --paper: #FFF8EE;
  --text: #F4F1FF;
  --muted: #C2C0DD;
  --hot: #FF4F5E;
  --sun: #FFD23F;
  --mint: #3DDC97;
  --sky: #5BC0FF;
  --violet: #9B7BFF;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: Inter, system-ui, sans-serif; font-size: 17px; line-height: 1.5;
  background: radial-gradient(1200px 600px at 85% -10%, rgba(155,123,255,.22), transparent 60%),
              radial-gradient(900px 500px at -10% 110%, rgba(255,79,94,.18), transparent 60%), var(--ink);
  color: var(--text); min-height: 100vh;
}
::selection { background: var(--sun); color: var(--ink); }
a { color: var(--sun); }
h1, h2, h3 { font-family: Anton, Impact, sans-serif; font-weight: 400; letter-spacing: .5px; line-height: 1.1; margin: 0 0 .4em; }
h1 { font-size: 44px; }
h2 { font-size: 30px; }
h3 { font-size: 22px; }
.muted { color: var(--muted); }
small, .small { font-size: 15px; }
[hidden] { display: none !important; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 16px; background: rgba(10,11,28,.55);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; backdrop-filter: blur(8px); }
.brandmark { font-family: Anton, sans-serif; font-size: 30px; letter-spacing: 1px; display: flex; align-items: center; gap: 10px; }
.brandmark .dot { width: 26px; height: 26px; border-radius: 8px; background: var(--hot); position: relative; flex: none;
  box-shadow: 0 0 0 4px rgba(255,79,94,.25); }
.brandmark .dot::after { content: ""; position: absolute; left: 9px; top: 6px; border-left: 11px solid var(--sun);
  border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
nav { display: flex; flex-direction: column; gap: 4px; }
nav a { color: var(--text); text-decoration: none; padding: 11px 14px; border-radius: 12px; display: flex; gap: 12px; align-items: center; font-weight: 600; }
nav a i { font-style: normal; width: 22px; text-align: center; color: var(--muted); }
nav a:hover { background: var(--ink-3); }
nav a.active { background: linear-gradient(90deg, rgba(255,79,94,.25), rgba(255,79,94,.05)); box-shadow: inset 3px 0 0 var(--hot); }
nav a.nav-new { background: var(--hot); color: #fff; margin: 6px 0; }
nav a.nav-new i { color: var(--sun); }
.linkish { margin-top: auto; background: none; border: 0; color: var(--muted); font: inherit; text-align: left; padding: 10px 14px; cursor: pointer; }
.view { padding: 26px 34px 80px; max-width: 1400px; width: 100%; outline: none; }

/* ---------- pieces */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.page-head p { margin: 0; color: var(--muted); }
.card { background: linear-gradient(180deg, rgba(39,44,82,.85), rgba(27,31,59,.85)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 18px; align-items: start; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { position: relative; overflow: hidden; }
.stat .num { font-family: Anton, sans-serif; font-size: 46px; line-height: 1; }
.stat .lbl { color: var(--muted); font-weight: 600; }
.stat::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; opacity: .22; background: var(--c, var(--hot)); }

.btn { font: inherit; font-weight: 700; border: 2px solid transparent; border-radius: 999px; padding: 11px 22px; cursor: pointer;
  background: var(--ink-3); color: var(--text); border-color: var(--line); display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; transition: transform .12s ease, background .12s ease; min-height: 46px; }
.btn:hover { transform: translateY(-1px); background: #313768; }
.btn:active { transform: translateY(0); }
.btn-hot { background: var(--hot); border-color: var(--hot); color: #fff; box-shadow: 0 6px 0 #b32a37; }
.btn-hot:hover { background: #ff6874; }
.btn-hot:active { box-shadow: 0 2px 0 #b32a37; transform: translateY(4px); }
.btn-sun { background: var(--sun); border-color: var(--sun); color: var(--ink); }
.btn-sun:hover { background: #ffdd66; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 14px; min-height: 38px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

label { display: block; font-weight: 700; margin-bottom: 14px; }
label .hint { display: block; font-weight: 400; color: var(--muted); font-size: 15px; margin-top: 2px; }
input[type=text], input[type=password], input[type=number], input[type=url], textarea, select {
  width: 100%; margin-top: 6px; font: inherit; font-weight: 400; color: var(--text); background: rgba(10,11,28,.6);
  border: 2px solid var(--line); border-radius: 12px; padding: 11px 13px; }
textarea { min-height: 220px; resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(91,192,255,.25); }
input[type=color] { width: 56px; height: 44px; border: 2px solid var(--line); border-radius: 10px; background: none; padding: 2px; margin-top: 6px; }
.invalid { border-color: var(--hot) !important; box-shadow: 0 0 0 3px rgba(255,79,94,.25) !important; }
.field-error { color: #ff8a94; font-weight: 600; font-size: 15px; margin: 6px 0 0; }
.checkline { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.checkline input { width: 22px; height: 22px; accent-color: var(--hot); }

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 9px 16px; border-radius: 999px; border: 2px solid var(--line); cursor: pointer; font-weight: 600; background: rgba(10,11,28,.4); }
.chip input:checked + span { background: var(--sun); color: var(--ink); border-color: var(--sun); }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(91,192,255,.5); }
.chip small { display: block; font-weight: 400; font-size: 14px; opacity: .85; }

.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; cursor: pointer; background: rgba(10,11,28,.35); display: block; }
.drop:hover, .drop.over { border-color: var(--sun); background: rgba(255,210,63,.07); }
.drop input { display: none; }
.drop b { color: var(--sun); }

.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 14px; font-weight: 700; letter-spacing: .3px; background: var(--ink-3); border: 1px solid var(--line); white-space: nowrap; }
.s-complete { background: rgba(61,220,151,.18); color: #7ff0bf; border-color: rgba(61,220,151,.5); }
.s-review { background: rgba(255,210,63,.16); color: var(--sun); border-color: rgba(255,210,63,.45); }
.s-running, .s-queued { background: rgba(91,192,255,.16); color: #9ad8ff; border-color: rgba(91,192,255,.45); }
.s-failed { background: rgba(255,79,94,.18); color: #ff9aa3; border-color: rgba(255,79,94,.5); }
.s-needs_approval { background: rgba(155,123,255,.2); color: #c9b8ff; border-color: rgba(155,123,255,.5); }

.proj-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.proj { text-decoration: none; color: var(--text); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--ink-2); display: flex; flex-direction: column; transition: transform .15s ease; }
.proj:hover { transform: translateY(-3px); }
.proj .thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, var(--violet), var(--hot)); background-size: cover; background-position: center; position: relative; }
.proj .thumb .pill { position: absolute; left: 10px; top: 10px; }
.proj .body { padding: 14px 16px 16px; }
.proj .t { font-weight: 800; font-size: 18px; line-height: 1.3; }
.proj .meta { color: var(--muted); font-size: 15px; margin-top: 4px; }

.bar { height: 12px; background: rgba(10,11,28,.7); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--hot), var(--sun)); border-radius: 999px; transition: width .6s ease; }
.stages { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.stages li { padding: 8px 12px; border-radius: 10px; background: rgba(10,11,28,.45); color: var(--muted); font-weight: 600; font-size: 15px; display: flex; gap: 8px; align-items: center; }
.stages li.done { color: #7ff0bf; }
.stages li.now { color: var(--ink); background: var(--sun); }
.stages li::before { content: "○"; }
.stages li.done::before { content: "✓"; }
.stages li.now::before { content: "●"; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.player { width: 100%; border-radius: 14px; background: #000; display: block; aspect-ratio: 16/9; }
.player.portrait { aspect-ratio: 9/16; max-height: 78vh; width: auto; margin: 0 auto; }
.player.square { aspect-ratio: 1/1; max-height: 78vh; width: auto; margin: 0 auto; }

.log { background: #090a18; border-radius: 12px; padding: 14px; font: 15px/1.5 ui-monospace, Menlo, monospace; color: #cfd2ff; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--line); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 15px; font-weight: 700; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* storyboard */
.tl { display: flex; height: 54px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); margin: 6px 0 18px; }
.tl a { display: block; height: 100%; background-size: cover; background-position: center; border-right: 2px solid var(--ink); position: relative; min-width: 3px; }
.tl a.flagged::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 -5px 0 var(--hot); }
.tl a.sel { outline: 3px solid var(--sun); outline-offset: -3px; }
.scenes { display: grid; gap: 14px; }
.scene { display: grid; grid-template-columns: 300px 1fr; gap: 18px; padding: 16px; border-radius: 14px; background: rgba(27,31,59,.85); border: 1px solid var(--line); scroll-margin-top: 20px; }
.scene.sel { border-color: var(--sun); }
.scene .media { position: relative; }
.scene .media img, .scene .media video { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; background: #000; display: block; }
.scene .media .noimg { aspect-ratio: 16/9; border-radius: 10px; display: grid; place-items: center; text-align: center; padding: 12px; background: linear-gradient(135deg, var(--ink-3), var(--violet)); font-family: Anton, sans-serif; font-size: 22px; }
.scene .num { font-family: Anton, sans-serif; font-size: 26px; color: var(--sun); }
.scene .narr { font-family: "DM Serif", Georgia, serif; font-style: italic; font-size: 19px; line-height: 1.45; margin: 4px 0 10px; }
.scene .flags { color: #ff9aa3; font-weight: 700; font-size: 15px; }
.scene .tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.scene .fields { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.scene .fields label { margin: 0; font-size: 15px; }
.scene .fields select, .scene .fields input { margin-top: 4px; padding: 8px 10px; }
.cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 12px; }
.cands button { padding: 0; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: #000; cursor: pointer; color: var(--text); text-align: left; font: inherit; }
.cands button:hover { border-color: var(--sun); }
.cands img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.cands span { display: block; padding: 6px 8px; font-size: 14px; background: var(--ink-2); }
.lock { color: var(--mint); font-weight: 800; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.media-item { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--ink-2); }
.media-item img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #000; }
.media-item .noimg { aspect-ratio: 16/9; display: grid; place-items: center; font-size: 34px; background: linear-gradient(135deg, var(--ink-3), var(--hot)); }
.media-item .body { padding: 10px 12px; font-size: 15px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { font: inherit; font-weight: 700; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
.tabs button.on { background: var(--violet); border-color: var(--violet); }

.notice { padding: 14px 16px; border-radius: 12px; background: rgba(255,210,63,.12); border: 1px solid rgba(255,210,63,.4); margin-bottom: 16px; }
.notice.bad { background: rgba(255,79,94,.13); border-color: rgba(255,79,94,.45); }
.notice.good { background: rgba(61,220,151,.12); border-color: rgba(61,220,151,.4); }
.qc li { margin: 4px 0; }
.qc .ok { color: #7ff0bf; } .qc .warning { color: var(--sun); } .qc .error { color: #ff9aa3; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(140%); background: var(--paper); color: var(--ink); padding: 12px 20px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow); transition: transform .25s ease, visibility .25s; z-index: 50; max-width: 92vw; visibility: hidden; }
.toast.show { transform: translateX(-50%) translateY(0); visibility: visible; }
.toast.bad { background: var(--hot); color: #fff; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); background: var(--ink-2); border: 1px solid var(--line); border-radius: 22px; padding: 30px; box-shadow: var(--shadow); }
.login-card h1 { margin-top: 18px; }
.empty { text-align: center; padding: 40px 20px; }
.empty h2 { color: var(--sun); }
.sep { height: 1px; background: var(--line); margin: 18px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g3 { grid-template-columns: 1fr; }
  .scene { grid-template-columns: 1fr; }
  .scene .fields { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; height: auto; z-index: 10; flex-direction: row; align-items: center; padding: 10px 12px; gap: 10px; overflow-x: auto; }
  .side .brandmark { font-size: 22px; }
  .side .brandmark .dot { width: 22px; height: 22px; }
  nav { flex-direction: row; gap: 4px; }
  nav a { padding: 8px 10px; white-space: nowrap; font-size: 15px; }
  nav a i { display: none; }
  .linkish { margin: 0; white-space: nowrap; }
  .view { padding: 16px 14px 70px; }
  h1 { font-size: 34px; }
  .g2 { grid-template-columns: 1fr; }
}
