@font-face { font-family: "Cormorant"; src: url("/fonts/CormorantGaramond.ttf") format("truetype"); font-weight: 300 700; font-display: swap; }

:root {
  --bg: #f6f3ee; --panel: #ffffff; --panel-2: #faf8f4; --line: #e6e0d6; --line-2: #d8d0c3;
  --text: #1d1b18; --muted: #6b645a; --faint: #9a9287;
  --accent: #9a6b1f; --accent-ink: #ffffff; --accent-soft: #f4ead8;
  --ok: #2f7a4b; --ok-soft: #e4f2e8; --warn: #9a6400; --warn-soft: #fbf0d9; --bad: #b3372b; --bad-soft: #fbe6e3;
  --info: #2c5d8f; --info-soft: #e3edf7;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 4px 16px rgba(40, 30, 10, .06);
  --radius: 12px; --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --serif: "Cormorant", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311; --panel: #1d1b18; --panel-2: #22201c; --line: #2f2c27; --line-2: #3b3730;
    --text: #ede8df; --muted: #a9a195; --faint: #7d766b;
    --accent: #d6a24a; --accent-ink: #1a1408; --accent-soft: #3a2e1a;
    --ok: #6cc38e; --ok-soft: #1e3326; --warn: #e2b04f; --warn-soft: #3a2f17; --bad: #ef7b6d; --bad-soft: #3d201c;
    --info: #86b5e6; --info-soft: #1c2b3b;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 22px; }
.brand { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: .2px; text-decoration: none; color: var(--text); white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); }

main { max-width: 1240px; margin: 0 auto; padding: 26px 20px 80px; }
h1 { font-family: var(--serif); font-weight: 600; font-size: 38px; line-height: 1.1; margin: 0; }
h2 { font-size: 17px; margin: 0; font-weight: 650; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.sub { color: var(--muted); margin: 4px 0 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-2); background: var(--panel); padding: 8px 14px;
  border-radius: 9px; cursor: pointer; font-weight: 550; text-decoration: none; color: var(--text); white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--faint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--panel); color: var(--text); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 7px; }

/* ---------- cards & panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { padding: 20px 22px; margin-bottom: 18px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.step { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--accent-soft); color: var(--accent); flex: none; }
.step.done { background: var(--ok-soft); color: var(--ok); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.neutral { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.pill.busy::before { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.code { font-family: var(--mono); font-size: 12px; padding: 1px 7px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }

/* ---------- jobs overview ---------- */
.jobs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.job-card { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit; transition: transform .12s, border-color .12s; }
.job-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.job-card .title { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.15; }
.progress { height: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.progress.full > span { background: var(--ok); }

.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted);
  background: var(--panel-2); transition: border-color .12s, background .12s; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dropzone strong { color: var(--text); }
.empty { padding: 50px 20px; text-align: center; }
.empty h2 { font-family: var(--serif); font-size: 28px; font-weight: 600; margin-bottom: 6px; }

/* ---------- job page ---------- */
.back { color: var(--muted); text-decoration: none; font-weight: 500; display: inline-block; margin-bottom: 10px; }
.back:hover { color: var(--text); }
.batches { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.batch { padding: 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 10px; }
.batch h3 { margin: 0; font-size: 15px; }
.prompt-text { font-size: 13px; white-space: pre-wrap; max-height: 240px; overflow: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; margin: 0; font-family: inherit; }
details > summary { cursor: pointer; color: var(--muted); font-size: 13px; }

.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.shot { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); display: flex; flex-direction: column; gap: 4px; min-height: 86px; }
.shot .name { font-weight: 650; font-family: var(--mono); font-size: 13px; }
.shot.have { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: var(--ok-soft); }
.shot.problem { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: var(--bad-soft); }
.shot.warnish { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: var(--warn-soft); }
.shot .replace { margin-top: auto; align-self: flex-start; }
.batch-label { font-size: 12px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin: 14px 0 8px; }

.inputs { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px 14px; align-items: center; }
.inputs .label { font-weight: 600; }
.status-ok { color: var(--ok); } .status-bad { color: var(--bad); } .status-opt { color: var(--muted); }
.switch { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.switch input { margin-top: 4px; accent-color: var(--accent); width: 16px; height: 16px; }

.log { background: #12110f; color: #ddd6c9; font: 12.5px/1.55 var(--mono); border-radius: 10px; padding: 12px 14px; max-height: 280px; overflow: auto; white-space: pre-wrap; margin: 12px 0 0; }
.log .err { color: #ff9b8f; } .log .note { color: #e6c27a; }
.preview-grid { display: grid; grid-template-columns: auto minmax(0, 300px); justify-content: start; align-items: start; gap: 20px; margin-top: 14px; }
.storyboard { display: block; max-width: 100%; max-height: 520px; width: auto; border-radius: 10px; border: 1px solid var(--line); background: #000; cursor: zoom-in; }
video.player { width: 100%; max-height: 72vh; aspect-ratio: 9 / 16; background: #000; border-radius: 10px; display: block; }

/* ---------- ready library ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel); min-width: 220px; }
.reels { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
.reel { cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.reel .cover { position: relative; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: #1b1a18; box-shadow: var(--shadow); }
.reel .cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.reel:hover .cover img { transform: scale(1.03); }
.reel .cover .dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.65); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 6px; }
.reel .cover .cc { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .05em; padding: 2px 6px; border-radius: 5px; border: 1px solid rgba(255,255,255,.5); }
.reel .t { font-family: var(--serif); font-size: 20px; font-weight: 600; line-height: 1.15; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; }
.input, textarea.input { padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel); width: 100%; }
textarea.input { min-height: 84px; resize: vertical; font-size: 13.5px; }
.input:focus, .search:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 1px; }
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.accents { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; }

/* ---------- auth ---------- */
.auth { max-width: 380px; margin: 12vh auto 0; padding: 30px; }
.auth h1 { font-size: 34px; margin-bottom: 6px; }
.auth form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.error { color: var(--bad); font-size: 14px; min-height: 1.2em; }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 8, 5, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { max-width: 560px; width: 100%; max-height: 92vh; overflow: auto; padding: 22px; }
.modal.wide { max-width: 980px; }
.modal h2 { font-family: var(--serif); font-size: 28px; font-weight: 600; margin-bottom: 8px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.player-layout { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 22px; align-items: start; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 11px 14px; border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); font-size: 14px; }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 760px) {
  h1 { font-size: 30px; }
  .preview-grid, .player-layout, .rules { grid-template-columns: 1fr; }
  .inputs { grid-template-columns: 1fr auto; }
  .inputs .label { grid-column: 1 / -1; margin-top: 6px; }
  .topbar-inner { gap: 10px; flex-wrap: wrap; }
  .brand { font-size: 20px; }
  main { padding: 18px 12px 60px; }
  .section { padding: 16px 14px; }
  .shots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .shot { min-height: 0; padding: 8px 10px; }
  .reels { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .reel .t { font-size: 17px; }
}
