/* Storyboard Studio */
:root {
  --bg: #f4f1ea; --surface: #fffdf8; --surface-2: #faf7f0; --ink: #1b1916; --ink-2: #57524a; --muted: #8b857a;
  --line: #e4ded2; --line-2: #d4ccbd; --accent: #c9821f; --accent-ink: #8a5310; --accent-soft: #f6e6cc;
  --chrome: #161412; --chrome-ink: #f4efe6; --chrome-muted: #a39c90;
  --frame: #0e0d0c; --shadow: 0 1px 2px rgba(30,25,15,.06), 0 6px 18px rgba(30,25,15,.07);
  --shadow-lg: 0 20px 60px rgba(20,15,5,.28);
  --s-draft: #8b857a; --s-review: #2f6fd6; --s-changes: #d2482f; --s-approved: #2e9a5a;
  --radius: 12px; --serif: 'Fraunces', Georgia, serif; --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --thumb: 260px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12110f; --surface: #1c1a17; --surface-2: #232019; --ink: #f1ece2; --ink-2: #c4bdb0; --muted: #8f887c;
    --line: #2f2b25; --line-2: #3d3830; --accent: #e8a33d; --accent-ink: #f0b860; --accent-soft: #3a2c16;
    --chrome: #0b0a09; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #12110f; --surface: #1c1a17; --surface-2: #232019; --ink: #f1ece2; --ink-2: #c4bdb0; --muted: #8f887c;
  --line: #2f2b25; --line-2: #3d3830; --accent: #e8a33d; --accent-ink: #f0b860; --accent-soft: #3a2c16;
  --chrome: #0b0a09; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.hidden { display: none !important; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--surface); cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: .88; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #1b1206; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--s-changes); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn.sm.icon { width: 30px; }
.btn.wide { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
input[type=text], input[type=password], input[type=number], input:not([type]), select, textarea {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: 9px; padding: 8px 11px; outline: none; }
textarea { resize: vertical; min-height: 64px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
label > input, label > select, label > textarea { margin-top: 5px; font-weight: 400; font-size: 14px; color: var(--ink); }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; font-size: 13px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.form { display: grid; gap: 14px; }

/* auth */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent), var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.auth-card h1 { font-family: var(--serif); font-size: 26px; }
.alert { background: #fde8e3; color: #8d2614; border-radius: 9px; padding: 10px 12px; font-size: 13px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #1b1206; display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.brand-mark.big { width: 48px; height: 48px; font-size: 16px; border-radius: 12px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--chrome); color: var(--chrome-ink); }
.topbar-in { max-width: 1480px; margin: 0 auto; padding: 0 24px; height: 58px; display: flex; align-items: center; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: .01em; }
.brand span { font-family: var(--serif); font-size: 18px; }
.nav { display: flex; gap: 4px; }
.nav a { text-decoration: none; padding: 7px 12px; border-radius: 8px; color: var(--chrome-muted); font-weight: 500; }
.nav a:hover { color: var(--chrome-ink); background: rgba(255,255,255,.06); }
.nav a.on { color: var(--chrome-ink); background: rgba(255,255,255,.1); }
.topbar .spacer { flex: 1; }
.userchip { display: flex; align-items: center; gap: 9px; background: none; border: 0; color: var(--chrome-ink); cursor: pointer; padding: 4px 6px; border-radius: 9px; }
.userchip:hover { background: rgba(255,255,255,.08); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 12px; color: #fff; flex: none; }
.menu { position: absolute; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; z-index: 60; }
.menu button { display: flex; width: 100%; gap: 9px; align-items: center; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.menu .menu-head { padding: 8px 10px 6px; font-size: 12px; color: var(--muted); }

.page { max-width: 1480px; margin: 0 auto; padding: 28px 24px 80px; }

/* dashboard */
.dash-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.dash-head h1 { font-family: var(--serif); font-size: 34px; letter-spacing: -.01em; }
.since { display: flex; align-items: center; gap: 10px; background: var(--accent-soft); color: var(--accent-ink); padding: 10px 14px; border-radius: 10px; margin-bottom: 20px; font-weight: 500; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); text-decoration: none; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.pcard:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(30,25,15,.06), 0 14px 30px rgba(30,25,15,.12); }
.pcard-cover { aspect-ratio: 16/8; background: var(--frame) center/cover no-repeat; position: relative; }
.pcard-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(0,0,0,.6)); }
.pcard-cover .badge-new { position: absolute; top: 12px; right: 12px; z-index: 1; }
.pcard-cover .cover-title { position: absolute; left: 16px; bottom: 12px; right: 16px; z-index: 1; color: #fff; font-family: var(--serif); font-size: 22px; line-height: 1.15; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.pcard-body { padding: 14px 16px 16px; display: grid; gap: 10px; }
.pcard-body .logline { color: var(--ink-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 39px; }
.pcard-meta { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pcard-meta b { color: var(--ink); font-weight: 600; }
.pcard.new { border-style: dashed; border-width: 2px; align-items: center; justify-content: center; min-height: 300px; color: var(--muted); background: transparent; box-shadow: none; cursor: pointer; font-weight: 500; gap: 8px; }
.pcard.new:hover { color: var(--ink); border-color: var(--muted); }
.pcard.new svg, .ccard.new svg { width: 26px; height: 26px; }
.badge-new { background: var(--accent); color: #1b1206; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; }

.progress { height: 6px; border-radius: 99px; background: var(--line); display: flex; overflow: hidden; }
.progress i { display: block; height: 100%; }
.progress .p-approved { background: var(--s-approved); } .progress .p-review { background: var(--s-review); }
.progress .p-changes { background: var(--s-changes); } .progress .p-draft { background: var(--line-2); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.draft { background: var(--s-draft); } .dot.review { background: var(--s-review); } .dot.changes { background: var(--s-changes); } .dot.approved { background: var(--s-approved); }

.panel-box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.panel-box h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
.feed { display: grid; gap: 2px; }
.feed-item { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .avatar { width: 26px; height: 26px; font-size: 11px; }
.feed-item.unseen { background: linear-gradient(90deg, var(--accent-soft), transparent); border-radius: 8px; }
.feed-item .when { color: var(--muted); font-size: 11px; }
.feed-item a { color: var(--accent-ink); text-decoration: none; font-weight: 500; }

/* project header */
.proj-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: start; margin-bottom: 18px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { text-decoration: none; } .crumbs a:hover { color: var(--ink); }
.proj-head h1 { font-family: var(--serif); font-size: 36px; letter-spacing: -.01em; line-height: 1.1; }
.proj-head .logline { color: var(--ink-2); margin-top: 6px; max-width: 760px; font-size: 15px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.chip.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(5, auto); gap: 4px 26px; text-align: right; }
.stat b { display: block; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.proj-progress { display: grid; gap: 8px; margin-bottom: 18px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 7px; align-items: center; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-color: var(--accent); }
.tabs .count { font-size: 11px; background: var(--line); border-radius: 99px; padding: 1px 7px; color: var(--ink-2); }

/* toolbar */
.toolbar { position: sticky; top: 58px; z-index: 20; background: var(--bg); padding: 10px 0; margin: -10px 0 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 0 11px; height: 34px; cursor: pointer; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg button svg { width: 15px; height: 15px; }
.toolbar select { width: auto; height: 36px; padding: 0 30px 0 10px; }
.size-ctl { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.size-ctl input { width: 90px; accent-color: var(--accent); }
.selbar { background: var(--ink); color: var(--bg); border-radius: 11px; padding: 8px 10px 8px 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; width: 100%; }
.selbar .btn { background: transparent; color: var(--bg); border-color: rgba(255,255,255,.25); }
.selbar .btn:hover { background: rgba(255,255,255,.1); }

/* scenes & panels */
.scene { margin-bottom: 30px; border-radius: 14px; transition: background .15s, outline-color .15s; outline: 2px dashed transparent; outline-offset: 6px; }
.scene.drop-files { outline-color: var(--accent); background: var(--accent-soft); }
.scene-head { display: flex; align-items: start; gap: 14px; margin-bottom: 12px; }
.scene-no { flex: none; background: var(--ink); color: var(--bg); border-radius: 8px; padding: 4px 9px; font-weight: 700; font-size: 12px; letter-spacing: .06em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.scene-title { flex: 1; min-width: 0; }
.scene-title h2 { font-size: 15px; letter-spacing: .04em; text-transform: uppercase; font-weight: 700; }
.scene-title p { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; max-width: 820px; }
.scene-meta { color: var(--muted); font-size: 12px; white-space: nowrap; margin-top: 3px; }
.scene-actions { display: flex; gap: 4px; opacity: .55; transition: opacity .15s; }
.scene:hover .scene-actions, .scene-actions:focus-within { opacity: 1; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--thumb), 1fr)); gap: 16px; min-height: 40px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); cursor: pointer; display: flex; flex-direction: column; position: relative; transition: transform .12s, box-shadow .12s, border-color .12s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(30,25,15,.06), 0 12px 26px rgba(30,25,15,.13); }
.card.dragging { opacity: .35; }
.card.drop-before::before, .card.drop-after::after { content: ''; position: absolute; top: 0; bottom: 0; width: 4px; background: var(--accent); border-radius: 4px; z-index: 3; }
.card.drop-before::before { left: -10px; } .card.drop-after::after { right: -10px; }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.card .frame { position: relative; aspect-ratio: var(--aspect, 16/9); background: var(--frame); overflow: hidden; }
.card .frame img { width: 100%; height: 100%; object-fit: cover; }
.card .frame .empty { position: absolute; inset: 0; display: grid; place-items: center; color: #8b857a; text-align: center; font-size: 12px;
  background: repeating-linear-gradient(135deg, #1a1816 0 10px, #1f1d1a 10px 20px); }
.card .frame .empty b { display: block; color: #cfc8bb; font-size: 13px; margin-bottom: 4px; }
.shotno { position: absolute; top: 8px; left: 8px; background: rgba(10,9,8,.78); color: #fff; font-weight: 700; font-size: 12px; padding: 3px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; backdrop-filter: blur(4px); letter-spacing: .03em; }
.status-pill { position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 5px; background: rgba(10,9,8,.78); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 8px 3px 7px; border-radius: 99px; backdrop-filter: blur(4px); }
.dur { position: absolute; bottom: 8px; right: 8px; background: rgba(10,9,8,.78); color: #fff; font-size: 11px; padding: 2px 7px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.cmt-badge { position: absolute; bottom: 8px; left: 8px; background: var(--accent); color: #1b1206; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; display: inline-flex; gap: 4px; align-items: center; }
.cmt-badge.done { background: rgba(10,9,8,.78); color: #fff; font-weight: 500; }
.cmt-badge svg { width: 11px; height: 11px; }
.selbox { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 6px; border: 2px solid #fff; background: rgba(0,0,0,.35); z-index: 2; display: grid; place-items: center; }
.card.selected .selbox { background: var(--accent); border-color: var(--accent); }
.card.selected .selbox::after { content: ''; width: 10px; height: 6px; border: 2px solid #1b1206; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.card .meta { padding: 10px 12px 12px; display: grid; gap: 5px; flex: 1; }
.card .tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }
.card .action { font-size: 13px; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .dialogue { font-size: 12.5px; color: var(--ink-2); font-style: italic; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .sound { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.card .sound::before { content: '♪ '; }
.card .faces { display: flex; margin-top: 2px; }
.face { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); background: var(--line) center/cover; margin-right: -6px; }
.grid.compact .card .meta { display: none; }
.add-tile { border: 2px dashed var(--line-2); border-radius: var(--radius); display: grid; place-items: center; color: var(--muted); cursor: pointer; aspect-ratio: var(--aspect, 16/9); background: transparent; font-weight: 500; text-align: center; padding: 10px; }
.add-tile:hover { color: var(--ink); border-color: var(--muted); background: var(--surface); }
.add-tile svg { width: 22px; height: 22px; margin: 0 auto 6px; }

/* script view */
.script { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.script th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-weight: 600; }
.script td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; }
.script tr.scene-row td { background: var(--surface-2); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 12px; }
.script tr.prow { cursor: pointer; } .script tr.prow:hover td { background: var(--surface-2); }
.script img { width: 168px; aspect-ratio: var(--aspect, 16/9); object-fit: cover; border-radius: 6px; background: var(--frame); }
.script .noimg { width: 168px; aspect-ratio: var(--aspect, 16/9); border-radius: 6px; background: var(--frame); }
.script .dlg { font-style: italic; color: var(--ink-2); }

/* filmstrip view */
.strip-scene { margin-bottom: 18px; }
.strip-scene h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.strip { display: flex; gap: 4px; overflow-x: auto; background: var(--frame); padding: 14px 10px; border-radius: 10px; position: relative; }
.strip::before, .strip::after { content: ''; position: absolute; left: 0; right: 0; height: 8px; background: repeating-linear-gradient(90deg, transparent 0 8px, rgba(255,255,255,.18) 8px 16px); }
.strip::before { top: 3px; } .strip::after { bottom: 3px; }
.strip .sf { flex: none; width: 180px; cursor: pointer; position: relative; }
.strip .sf img, .strip .sf .noimg { width: 100%; aspect-ratio: var(--aspect, 16/9); object-fit: cover; border-radius: 3px; background: #222; }
.strip .sf span { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.7); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 4px; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(12,10,8,.62); z-index: 50; display: grid; place-items: center; padding: 20px; backdrop-filter: blur(3px); animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; animation: pop .18s; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; gap: 12px; }
.modal-head h2 { font-family: var(--serif); font-size: 22px; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; }
.modal-foot .left { margin-right: auto; }

/* panel / character detail */
.detail { width: min(1280px, 100%); height: min(860px, calc(100vh - 40px)); display: grid; grid-template-columns: minmax(0, 1fr) 420px; overflow: hidden; }
.detail-stage { background: var(--frame); position: relative; display: flex; flex-direction: column; min-height: 0; }
.detail-stage .stage-top { display: flex; align-items: center; gap: 10px; padding: 14px 16px; color: #e9e3d8; }
.detail-stage .stage-top .shotno { position: static; font-size: 14px; }
.detail-stage .stage-top .scene-name { font-size: 12px; color: #a39c90; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-img { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 56px; position: relative; }
.stage-img img { position: absolute; inset: 0 56px; width: calc(100% - 112px); height: 100%; object-fit: contain; }
.stage-img .empty-stage { color: #a39c90; text-align: center; border: 2px dashed #3d3830; border-radius: 12px; padding: 50px 40px; }
.stage-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; display: grid; place-items: center; }
.stage-nav:hover { background: rgba(255,255,255,.2); }
.stage-nav:disabled { opacity: .2; cursor: default; }
.stage-nav.prev { left: 8px; } .stage-nav.next { right: 8px; }
.stage-nav svg { width: 20px; height: 20px; }
.stage-bottom { display: flex; gap: 8px; padding: 12px 16px; justify-content: center; flex-wrap: wrap; }
.stage-bottom .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #eee; }
.stage-bottom .btn:hover { background: rgba(255,255,255,.16); }
.detail-side { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); }
.side-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.side-head .grow { flex: 1; }
.side-scroll { overflow: auto; flex: 1; padding: 16px; display: grid; gap: 16px; align-content: start; }
.side-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.side-foot .grow { flex: 1; font-size: 12px; color: var(--muted); }
.status-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; border: 1px solid var(--line); }
.status-seg button { border: 0; background: none; border-radius: 7px; padding: 7px 4px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: 5px; }
.status-seg button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); color: var(--ink); }
.pick-chars { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pick-chars button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 99px; padding: 3px 10px 3px 3px; cursor: pointer; font-size: 12px; font-weight: 500; }
.pick-chars button .face { margin: 0; width: 22px; height: 22px; border: 0; }
.pick-chars button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: -6px; }

/* comments */
.comments { display: grid; gap: 10px; }
.comment { display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.comment .avatar { width: 28px; height: 28px; font-size: 11px; }
.comment .bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; padding: 8px 11px; }
.comment.resolved .bubble { opacity: .55; }
.comment .who { font-size: 12px; font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.comment .who .when { color: var(--muted); font-weight: 400; }
.comment .text { white-space: pre-wrap; font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.comment .acts { display: flex; gap: 10px; margin-top: 4px; }
.comment .acts button { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; font-size: 11.5px; font-weight: 500; }
.comment .acts button:hover { color: var(--ink); }
.comment-form { display: grid; gap: 8px; }
.comment-form textarea { min-height: 54px; }
.comment-form .btn { justify-self: end; }

/* characters */
.chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.ccard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s, box-shadow .15s; display: flex; flex-direction: column; }
.ccard:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(30,25,15,.06), 0 14px 30px rgba(30,25,15,.12); }
.ccard .portrait { aspect-ratio: 3/4; background: var(--frame) center/cover; position: relative; }
.ccard .portrait .noportrait { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: 56px; color: #57524a; }
.ccard .portrait .chip { position: absolute; top: 10px; left: 10px; background: rgba(10,9,8,.72); color: #fff; border: 0; backdrop-filter: blur(4px); }
.ccard .cbody { padding: 12px 14px 14px; display: grid; gap: 4px; }
.ccard h3 { font-family: var(--serif); font-size: 19px; }
.ccard .desc { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ccard .cmeta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; margin-top: 4px; }
.ccard.new { border: 2px dashed var(--line-2); background: transparent; box-shadow: none; display: grid; place-items: center; color: var(--muted); min-height: 360px; font-weight: 500; text-align: center; }
.ccard.new:hover { color: var(--ink); border-color: var(--muted); }
.gallery-main { flex: 1; min-height: 0; display: grid; place-items: center; padding: 10px 20px; position: relative; }
.gallery-main img { position: absolute; inset: 10px 20px; width: calc(100% - 40px); height: calc(100% - 20px); object-fit: contain; }
.gallery-main .label-tag { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.7); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 99px; }
.gallery-thumbs { display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto; }
.gallery-thumbs .gt { flex: none; width: 66px; aspect-ratio: 3/4; border-radius: 6px; background: #222 center/cover; cursor: pointer; border: 2px solid transparent; position: relative; }
.gallery-thumbs .gt.on { border-color: var(--accent); }
.gallery-thumbs .gt .star { position: absolute; top: 2px; right: 3px; color: var(--accent); font-size: 12px; text-shadow: 0 1px 2px #000; }
.gallery-thumbs .gt.add { display: grid; place-items: center; border: 2px dashed #57524a; background: none; color: #a39c90; font-size: 22px; }
.prompt-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.prompt-box .presets { display: flex; gap: 6px; flex-wrap: wrap; }
.prompt-box textarea { font-size: 12.5px; min-height: 120px; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.appears { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.appears img { width: 96px; aspect-ratio: 16/9; object-fit: cover; border-radius: 5px; cursor: pointer; flex: none; background: var(--frame); }

/* overview */
.overview { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.synopsis { white-space: pre-wrap; font-size: 15px; line-height: 1.7; color: var(--ink); max-width: 72ch; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }

/* team */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); background: var(--surface-2); }

/* upload progress */
.upl-list { display: grid; gap: 6px; max-height: 320px; overflow: auto; margin-top: 12px; }
.upl-row { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center; font-size: 12.5px; }
.upl-row .ut { width: 54px; aspect-ratio: 16/9; border-radius: 4px; background: var(--frame) center/cover; }
.upl-row .un { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upl-row .us { font-size: 12px; color: var(--muted); }
.upl-row .us.ok { color: var(--s-approved); } .upl-row .us.err { color: var(--s-changes); }
.bigbar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bigbar i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.dropzone { border: 2px dashed var(--line-2); border-radius: 14px; padding: 30px; text-align: center; color: var(--muted); cursor: pointer; background: var(--surface-2); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.dropzone b { color: var(--ink); display: block; font-size: 15px; margin-bottom: 4px; }

/* toast */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; animation: pop .2s; }
.toast.err { background: #a8321d; color: #fff; }

/* presentation */
.present { position: fixed; inset: 0; background: #000; z-index: 80; display: flex; flex-direction: column; color: #eee; }
.present-img { flex: 1; min-height: 0; position: relative; }
.present-img img { position: absolute; inset: 24px 24px 0; width: calc(100% - 48px); height: calc(100% - 24px); object-fit: contain; }
.present-cap { padding: 16px 30px 10px; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: start; max-width: 1200px; margin: 0 auto; width: 100%; }
.present-cap .no { font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.present-cap .txt { font-size: 16px; line-height: 1.5; }
.present-cap .txt i { color: #bbb; display: block; margin-top: 4px; }
.present-cap .tags { display: flex; gap: 6px; } .present-cap .tag { background: #222; border-color: #333; color: #ccc; }
.present-ctl { display: flex; gap: 8px; justify-content: center; align-items: center; padding: 8px 0 18px; color: #999; font-size: 13px; }
.present-ctl .btn { background: #1a1a1a; border-color: #333; color: #eee; }
.present-bar { height: 3px; background: #222; } .present-bar i { display: block; height: 100%; background: var(--accent); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); border: 2px dashed var(--line-2); border-radius: 16px; }
.empty-state h3 { font-family: var(--serif); font-size: 22px; color: var(--ink); margin-bottom: 6px; }
.empty-state .btn { margin-top: 14px; }

/* print */
#print-root { display: none; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body > #app, .toasts, .overlay { display: none !important; }
  #print-root { display: block; color: #000; background: #fff; font: 9pt/1.35 var(--sans); }
  .pr-page { page-break-after: always; }
  .pr-head { display: flex; justify-content: space-between; border-bottom: 1.5pt solid #000; padding-bottom: 4pt; margin-bottom: 6pt; }
  .pr-head b { font-family: var(--serif); font-size: 14pt; }
  .pr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8pt 10pt; }
  .pr-cell { break-inside: avoid; }
  .pr-frame { border: 1pt solid #000; aspect-ratio: var(--aspect, 16/9); overflow: hidden; background: #eee; }
  .pr-frame img { width: 100%; height: 100%; object-fit: cover; }
  .pr-line { display: flex; justify-content: space-between; font-weight: 700; margin-top: 3pt; font-size: 8pt; }
  .pr-txt { border-bottom: .5pt solid #999; min-height: 26pt; padding: 2pt 0; font-size: 8pt; }
  .pr-txt i { color: #333; }
  .pr-scene { grid-column: 1 / -1; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 8.5pt; border-bottom: .5pt solid #000; padding-top: 4pt; }
}

/* responsive */
@media (max-width: 1100px) {
  .dash-grid, .overview { grid-template-columns: 1fr; }
  .detail { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 40px); overflow: auto; }
  .modal.detail-modal { width: 100% !important; }
  .detail-stage { min-height: 50vh; }
  .detail-side { border-left: 0; border-top: 1px solid var(--line); }
  .side-scroll { overflow: visible; }
  .proj-head { grid-template-columns: 1fr; }
  .stats { text-align: left; grid-template-columns: repeat(5, auto); justify-content: start; }
}
@media (max-width: 640px) {
  .topbar-in, .page { padding-left: 16px; padding-right: 16px; }
  .brand span { display: none; }
  .userchip .uname { display: none; }
  .proj-head h1, .dash-head h1 { font-size: 28px; }
  .stats { grid-template-columns: repeat(3, auto); }
  .overlay { padding: 0; }
  .modal { border-radius: 0; max-height: 100vh; height: 100%; }
  .detail { height: 100vh; }
  .stage-img { padding: 0 8px; }
  .stage-img img { inset: 0 8px; width: calc(100% - 16px); }
  .stage-nav { display: none; }
  :root { --thumb: 150px; }
  .grid { gap: 10px; }
  .toolbar .size-ctl { display: none; }
  .script img, .script .noimg { width: 100px; }
  .script .hide-sm { display: none; }
  .present-cap { grid-template-columns: 1fr; gap: 6px; padding: 12px 16px; }
  .scene-head { flex-wrap: wrap; gap: 8px 12px; }
  .scene-title { flex: 1 1 calc(100% - 80px); }
  .scene-meta { order: 3; margin-left: 58px; }
  .scene-actions { order: 4; margin-left: auto; opacity: 1; }
  .detail-stage { min-height: 40vh; }
  .present-img img { inset: 8px 8px 0; width: calc(100% - 16px); height: calc(100% - 8px); }
}

/* guide */
.help-link { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); text-decoration: none; font-size: 12px; margin-left: auto; }
.help-link:hover { color: var(--accent-ink); }
.help-link svg { width: 14px; height: 14px; }
.help-link.inline { margin-left: 4px; }
.guide-hint a { color: inherit; font-weight: 700; }
.guide-hint span { flex: 1; }
.guide-hint svg { width: 18px; height: 18px; flex: none; }
.guide-search { position: relative; width: min(340px, 100%); }
.guide-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.guide-search input { padding-left: 34px; height: 40px; }
.guide { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 40px; align-items: start; }
.guide aside { position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow: auto; }
.guide-jump { display: none; }
.guide-toc { display: grid; gap: 1px; }
.toc-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 14px 0 4px; }
.toc-group:first-child { margin-top: 0; }
.guide-toc a { text-decoration: none; color: var(--ink-2); padding: 6px 10px; border-radius: 7px; font-size: 13.5px; border-left: 2px solid transparent; }
.guide-toc a:hover { background: var(--surface); color: var(--ink); }
.guide-toc a.on { color: var(--ink); background: var(--surface); border-left-color: var(--accent); font-weight: 600; }
.guide-toc a.dim { opacity: .35; }
.guide-body { max-width: 780px; }
.guide-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px 30px; margin-bottom: 18px; }
.guide-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink); font-weight: 700; margin-bottom: 4px; }
.guide-sec h2 { font-family: var(--serif); font-size: 26px; letter-spacing: -.01em; margin-bottom: 12px; }
.guide-html { font-size: 15px; line-height: 1.65; color: var(--ink); }
.guide-html h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin: 22px 0 8px; }
.guide-html p { margin: 0 0 12px; }
.guide-html ul { margin: 0 0 12px; padding-left: 20px; }
.guide-html li { margin-bottom: 5px; }
.guide-html a { color: var(--accent-ink); font-weight: 500; }
.g-lead { font-size: 17px; color: var(--ink); }
.g-steps { list-style: none; counter-reset: step; padding: 0; margin: 0 0 14px; }
.g-steps > li { counter-increment: step; position: relative; padding: 2px 0 10px 40px; }
.g-steps > li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.g-steps ul { margin-top: 6px; }
.g-table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 14px; }
.g-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 10px; border-bottom: 1px solid var(--line-2); }
.g-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.g-table td:first-child { white-space: nowrap; width: 1%; }
.g-table tr:last-child td { border-bottom: 0; }
.g-tip { background: var(--accent-soft); color: var(--ink); border-radius: 10px; padding: 11px 14px; font-size: 14px; border-left: 3px solid var(--accent); }
.g-code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; font-size: 14px; }
.g-kbd { display: inline-block; font: 600 12px/1 var(--sans); padding: 3px 7px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); }
.g-inline { display: inline-block; position: static; vertical-align: 1px; margin: 0 2px; }
.shotno.g-inline { font-size: 11px; }
.g-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 16px; }
.g-card { border: 1px solid var(--line-2); border-radius: 12px; padding: 14px 16px; text-decoration: none; display: grid; gap: 4px; background: var(--surface-2); transition: border-color .15s, transform .15s; }
.g-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.g-card b { color: var(--ink); font-size: 15px; }
.g-card span { color: var(--ink-2); font-size: 13px; font-weight: 400; line-height: 1.45; }
.g-faq dt { font-weight: 700; margin-top: 14px; }
.g-faq dd { margin: 4px 0 0; color: var(--ink-2); }
@media (max-width: 900px) {
  .guide { grid-template-columns: 1fr; gap: 14px; }
  .guide aside { position: sticky; top: 58px; z-index: 5; background: var(--bg); padding: 8px 0; max-height: none; overflow: visible; }
  .guide-toc { display: none; }
  .guide-jump { display: block; }
  .guide-sec { padding: 20px 18px; }
  .g-table td:first-child { white-space: normal; }
}
