/* 影視拆解工作室 — 深色剪輯室主題 */
:root {
  color-scheme: dark;
  --bg: #0c0d11;
  --bg-2: #101217;
  --s1: #15171d;          /* 卡片 */
  --s2: #1b1e26;          /* 卡片內區塊 */
  --s3: #232733;          /* hover / 輸入框 */
  --line: #262a35;
  --line-2: #1f222b;
  --ink: #eceef4;
  --ink-2: #b4b9c7;
  --muted: #7d8394;
  --faint: #565b69;
  --violet: #8b7cff;
  --violet-2: #6d5cf0;
  --violet-soft: rgba(139, 124, 255, .14);
  --violet-line: rgba(139, 124, 255, .38);
  --amber: #f5b13d;
  --amber-2: #e09a1f;
  --amber-soft: rgba(245, 177, 61, .1);
  --amber-line: rgba(245, 177, 61, .35);
  --green: #3ecf8e;
  --green-soft: rgba(62, 207, 142, .12);
  --red: #ff6b6b;
  --red-soft: rgba(255, 107, 107, .1);
  --cyan: #4cc9f0;
  --r-lg: 16px;
  --r: 12px;
  --r-sm: 8px;
  --sans: 'Inter', 'Noto Sans TC', system-ui, -apple-system, 'Microsoft JhengHei', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px rgba(0,0,0,.28);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, rgba(109, 92, 240, .10), transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font: 14.5px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
::selection { background: rgba(139, 124, 255, .35); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2b2f3b; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #3a3f4d; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.kicker { font: 600 11px/1 var(--mono); letter-spacing: .16em; color: var(--violet); text-transform: uppercase; }

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--s2);
  font-weight: 600; font-size: 14px; color: var(--ink); white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .06s;
}
.btn:hover:not(:disabled) { background: var(--s3); border-color: #323745; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #9384ff, var(--violet-2)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(109, 92, 240, .35), 0 1px 0 rgba(255,255,255,.2) inset; }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #a092ff, #7a6af5); }
.btn.gold { background: linear-gradient(180deg, #f8bf55, var(--amber-2)); border-color: transparent; color: #1b1406; box-shadow: 0 6px 18px rgba(245, 177, 61, .25), 0 1px 0 rgba(255,255,255,.35) inset; }
.btn.gold:hover:not(:disabled) { background: linear-gradient(180deg, #fbc965, #eba52a); }
.btn.ghost { background: transparent; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn.sm svg { width: 15px; height: 15px; }
.btn.lg { height: 46px; font-size: 15px; }
.btn.icon { width: 38px; padding: 0; }
.btn.block { width: 100%; }
.btn.danger { color: var(--red); }
.btn .price { font: 500 11.5px var(--mono); opacity: .75; padding-left: 6px; margin-left: 2px; border-left: 1px solid currentColor; border-left-color: rgba(255,255,255,.18); }
.btn.gold .price, .btn.primary .price { border-left-color: rgba(0,0,0,.2); opacity: .85; }

.input, .field select, .field input[type=text], .field input[type=number], .field textarea {
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2);
  font-size: 13.5px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .field select:focus, .field input:focus { border-color: var(--violet-line); box-shadow: 0 0 0 3px var(--violet-soft); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.field.grow { flex: 1; min-width: 220px; }

/* ---------- 頂欄 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 28px; background: rgba(12, 13, 17, .82); backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line-2);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #a597ff, #5b47e0); display: grid; place-items: center; flex: none; box-shadow: 0 6px 16px rgba(109, 92, 240, .4), 0 1px 0 rgba(255,255,255,.3) inset; }
.mark svg { width: 18px; height: 18px; fill: #fff; stroke: none; }
.mark.big { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 6px; }
.mark.big svg { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; }
.brand-text b { font-size: 15.5px; font-weight: 800; letter-spacing: .02em; }
.brand-text span { font: 500 10.5px var(--mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.crumb { margin-left: 10px; padding-left: 14px; border-left: 1px solid var(--line); color: var(--ink-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.actions { display: flex; gap: 8px; flex: none; align-items: center; }
.cost-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; margin-right: 6px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2);
  font: 500 12.5px var(--mono); color: var(--ink-2); transition: border-color .15s, color .15s;
}
.cost-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.cost-chip:hover { border-color: var(--green); color: var(--ink); }

/* ---------- 版面 ---------- */
.wrap { max-width: 1480px; margin: 0 auto; padding: 22px 28px 72px; }
.panel-card { background: var(--s1); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }

/* 首頁 */
.hero { display: grid; place-items: center; min-height: calc(100vh - 160px); }
.hero-inner { width: min(860px, 100%); text-align: center; display: grid; gap: 16px; justify-items: center; }
.hero h2 { margin: 0; font-size: clamp(26px, 3.6vw, 40px); font-weight: 800; letter-spacing: -.01em; line-height: 1.25; background: linear-gradient(180deg, #fff, #b7bbcb); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; max-width: 640px; color: var(--ink-2); font-size: 15px; }
.drop {
  margin-top: 14px; width: 100%; padding: 46px 24px; border-radius: 20px; border: 1.5px dashed #343949; background: rgba(21, 23, 29, .6);
  display: grid; justify-items: center; gap: 10px; transition: border-color .2s, background .2s;
}
.drop:hover { border-color: var(--violet); background: rgba(139, 124, 255, .06); }
.drop b { font-size: 16px; }
.drop small { color: var(--muted); }
.drop-icon { width: 58px; height: 58px; border-radius: 16px; background: var(--violet-soft); color: var(--violet); display: grid; place-items: center; border: 1px solid var(--violet-line); }
.drop-icon svg { width: 26px; height: 26px; }
.key-notice { width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--amber-line); background: var(--amber-soft); margin-top: 10px; }
.key-notice > div { flex: 1; display: grid; gap: 2px; }
.key-notice small { color: var(--muted); }
.kn-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(245,177,61,.15); color: var(--amber); flex: none; }
.btn.icon.alert { position: relative; border-color: var(--amber-line); }
.btn.icon.alert::after { content: ''; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.steps { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.steps div { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; background: var(--s1); }
.steps em { font: normal 600 11px var(--mono); color: var(--violet); margin-right: 6px; }

/* 專案列 */
.projbar { display: flex; align-items: center; gap: 20px; padding: 4px 2px 18px; }
.proj-main { flex: 1; min-width: 0; }
.proj-title { font-size: 21px; font-weight: 800; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.meta-chip { font-size: 12px; padding: 2px 9px; border-radius: 6px; background: var(--s2); border: 1px solid var(--line); color: var(--ink-2); }
.meta-chip:empty { display: none; }
.meta-chip.cost { color: var(--green); border-color: rgba(62, 207, 142, .3); background: var(--green-soft); font-family: var(--mono); }
.status { font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 7px; margin-left: 4px; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.status.ok { color: var(--green); }
.status.busy { color: var(--violet); }
.status.busy::before { animation: pulse 1s infinite; }
.status.err { color: var(--red); }
@keyframes pulse { 50% { opacity: .25; } }
.proj-actions { display: flex; gap: 8px; align-items: center; }
.proj-actions .input { width: 300px; }

/* 分頁 */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--s1); border: 1px solid var(--line); border-radius: 14px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs button {
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent; background: transparent;
  font-weight: 600; color: var(--muted); white-space: nowrap; transition: all .15s; display: inline-flex; align-items: center; gap: 8px;
}
.tabs button em { font: normal 600 11px var(--mono); color: var(--faint); transition: color .15s; }
.tabs button:hover:not(:disabled) { color: var(--ink); background: var(--s2); }
.tabs button.on { background: var(--s3); border-color: #333847; color: var(--ink); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }
.tabs button.on em { color: var(--violet); }
.tabs button.gold.on { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.tabs button.gold.on em { color: var(--amber); }
.tabs button:disabled { opacity: .35; cursor: not-allowed; }

.stage { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; margin-top: 16px; align-items: stretch; }

/* ---------- 播放器 ---------- */
.player { overflow: hidden; display: flex; flex-direction: column; }
.video-box { position: relative; background: #000; aspect-ratio: 16 / 9; display: grid; place-items: center; max-height: 64vh; }
.video-box video { width: 100%; height: 100%; object-fit: contain; display: block; }
.hud { position: absolute; left: 14px; top: 14px; display: flex; gap: 6px; pointer-events: none; }
.hud span { font: 600 11.5px var(--mono); letter-spacing: .06em; padding: 4px 9px; border-radius: 6px; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); color: #fff; border: 1px solid rgba(255,255,255,.08); }
.hud span.rec { color: var(--amber); }
.big-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 76px; height: 76px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.14); backdrop-filter: blur(10px);
  color: #fff; display: grid; place-items: center; transition: transform .15s, opacity .2s, background .15s;
}
.big-play svg { width: 30px; height: 30px; fill: currentColor; stroke: none; margin-left: 4px; }
.big-play:hover { transform: translate(-50%, -50%) scale(1.06); background: rgba(255,255,255,.22); }
.video-box.playing .big-play { opacity: 0; pointer-events: none; }

.timeline { position: relative; height: 40px; margin: 14px 18px 0; cursor: pointer; user-select: none; touch-action: none; }
.tl-segs { position: absolute; inset: 6px 0; display: flex; gap: 2px; border-radius: 7px; overflow: hidden; background: var(--s2); }
.tl-seg { position: relative; height: 100%; background: #20232d; display: flex; align-items: center; padding-left: 7px; font: 600 10.5px var(--mono); color: var(--faint); overflow: hidden; white-space: nowrap; transition: background .15s, color .15s; }
.tl-seg:hover { background: #272b37; color: var(--ink-2); }
.tl-seg.cur { background: var(--violet-soft); color: var(--violet); box-shadow: inset 0 -2px 0 var(--violet); }
.tl-progress { position: absolute; left: 0; top: 6px; bottom: 6px; width: 0; background: rgba(255,255,255,.06); border-radius: 7px 0 0 7px; pointer-events: none; }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--amber); transform: translateX(-1px); pointer-events: none; box-shadow: 0 0 10px rgba(245, 177, 61, .6); }
.tl-head::before { content: ''; position: absolute; top: -2px; left: -5px; width: 12px; height: 10px; background: var(--amber); clip-path: polygon(0 0, 100% 0, 100% 50%, 50% 100%, 0 50%); }

.controls { display: flex; align-items: center; gap: 12px; padding: 12px 18px 14px; flex-wrap: wrap; }
.ctl { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink-2); transition: background .15s, color .15s; }
.ctl:hover { background: var(--s3); color: var(--ink); }
.ctl svg { width: 19px; height: 19px; }
.ctl.solid { width: 42px; height: 42px; border-radius: 12px; background: var(--ink); color: #0c0d11; }
.ctl.solid:hover { background: #fff; color: #000; }
#cPlay svg { fill: currentColor; stroke: none; }
#cPlay .i-pause, .playing-state #cPlay .i-play { display: none; }
.playing-state #cPlay .i-pause { display: block; }
.ctl-group { display: flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: var(--bg-2); }
.ctl-group .ctl { width: 30px; height: 30px; }
.ctl-label { font-size: 12px; color: var(--muted); padding: 0 6px; }
.time { font-size: 15px; color: var(--muted); display: flex; gap: 6px; align-items: baseline; }
.time b { color: var(--amber); font-weight: 600; font-size: 17px; }
.seg-ctl { display: flex; border: 1px solid var(--line); border-radius: 10px; padding: 2px; margin-left: auto; background: var(--bg-2); }
.seg-ctl button { border: 0; background: transparent; height: 30px; padding: 0 10px; border-radius: 7px; font: 500 12.5px var(--mono); color: var(--muted); }
.seg-ctl button:hover { color: var(--ink); }
.seg-ctl button.on { background: var(--s3); color: var(--ink); box-shadow: 0 0 0 1px #343949 inset; }
.vol { display: flex; align-items: center; gap: 4px; }
.vol input { width: 90px; accent-color: var(--violet); }
.muted-state .waves { display: none; }

.filmstrip { display: flex; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line-2); overflow-x: auto; background: var(--bg-2); }
.filmstrip:empty { display: none; }
.film { flex: none; width: 136px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line); background: #000; position: relative; cursor: pointer; transition: border-color .15s, transform .15s; padding: 0; }
.film:hover { border-color: #3b4050; transform: translateY(-1px); }
.film.cur { border-color: var(--violet); box-shadow: 0 0 0 1px var(--violet); }
.film img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; opacity: .85; }
.film.cur img, .film:hover img { opacity: 1; }
.film span { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 7px 4px; background: linear-gradient(transparent, rgba(0,0,0,.85)); display: flex; justify-content: space-between; font: 600 10.5px var(--mono); color: #fff; }
.film span i { font-style: normal; color: #aeb3c2; font-weight: 500; }
.film .dotai { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 6px var(--violet); }

/* ---------- 側欄 ---------- */
.side { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.side-head { display: flex; align-items: center; justify-content: space-between; }
.side h3 { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; }
.side h3 svg { color: var(--violet); width: 18px; height: 18px; }
.side h3.gold svg, .side h3.gold { color: var(--amber); }
.side .spacer { flex: 1; }
.prompt-box {
  font: 13px/1.75 var(--mono); white-space: pre-wrap; word-break: break-word; color: #e9dfc9;
  background: var(--amber-soft); border: 1px solid var(--amber-line); border-radius: 12px; padding: 14px 16px;
  max-height: 340px; overflow: auto;
}
.prompt-box.plain { background: var(--bg-2); border-color: var(--line); color: var(--ink-2); }
.kv { display: grid; gap: 1px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.kv div { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 8px 12px; background: var(--bg-2); font-size: 13px; }
.kv b { color: var(--muted); font-weight: 600; font-size: 12px; }
.side-thumb { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; background: #000; border: 1px solid var(--line); }
.side-empty { color: var(--muted); text-align: center; padding: 40px 10px; display: grid; gap: 12px; justify-items: center; }
.linkbtn { border: 1px solid var(--line); background: transparent; border-radius: 10px; height: 40px; font-weight: 600; display: flex; justify-content: center; gap: 8px; align-items: center; color: var(--ink-2); }
.linkbtn:hover { background: var(--s2); color: var(--ink); }
.shot-badge { display: inline-flex; align-items: center; gap: 8px; font: 600 12px var(--mono); }
.shot-badge b { background: var(--violet); color: #fff; padding: 3px 8px; border-radius: 6px; letter-spacing: .04em; }
.shot-badge span { color: var(--amber); }

/* ---------- 分頁內容 ---------- */
.panel { margin-top: 18px; padding: 26px 28px 30px; }
.panel-head { display: flex; gap: 16px; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line-2); margin-bottom: 22px; }
.panel-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--violet-soft); color: var(--violet); display: grid; place-items: center; flex: none; border: 1px solid var(--violet-line); }
.panel-icon.gold { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-line); }
.panel-icon svg { width: 22px; height: 22px; }
.panel-head h2 { margin: 3px 0 0; font-size: 20px; font-weight: 800; letter-spacing: -.005em; }
.panel-head h2 small { font: 500 13px var(--sans); color: var(--muted); margin-left: 8px; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.panel-head .grow { flex: 1; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--s2); border: 1px solid var(--line); font-weight: 600; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }

.loading { text-align: center; padding: 56px 0; color: var(--ink-2); display: grid; justify-items: center; gap: 14px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(139,124,255,.18); border-top-color: var(--violet); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.errbox { background: var(--red-soft); border: 1px solid rgba(255,107,107,.3); color: #ffc9c9; border-radius: 12px; padding: 16px 18px; }
.skeleton { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; margin-top: 8px; }
.skeleton div { height: 180px; border-radius: 14px; background: linear-gradient(90deg, var(--s2), #20232c, var(--s2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* 區塊 */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.block { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: var(--s2); }
.block h4 { margin: 0 0 8px; font: 600 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 22px; }
.block p { margin: 0; white-space: pre-wrap; color: var(--ink); }
.block p.mono { font-size: 13px; color: var(--ink-2); line-height: 1.75; }
.section-label { font: 600 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 26px 0 12px; display: flex; align-items: center; gap: 10px; }
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }

/* 腳本 */
.seg-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg-table th { text-align: left; color: var(--muted); font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; padding: 11px 14px; background: var(--s2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.seg-table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; color: var(--ink-2); }
.seg-table tr:last-child td { border-bottom: 0; }
.seg-table tbody tr { cursor: pointer; transition: background .12s; }
.seg-table tbody tr:hover td { background: rgba(255,255,255,.02); }
.seg-table tr.cur td { background: var(--violet-soft); color: var(--ink); }
.tc { font-family: var(--mono); color: var(--amber); font-weight: 500; white-space: nowrap; font-size: 12.5px; }

/* 風格 */
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.swatch { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--s2); cursor: pointer; transition: transform .15s, border-color .15s; padding: 0; text-align: left; }
.swatch:hover { transform: translateY(-2px); border-color: #3b4050; }
.swatch div { height: 74px; }
.swatch span { display: block; padding: 8px 10px; font-size: 12.5px; }
.swatch code { font: 500 11.5px var(--mono); color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.chip { padding: 3px 11px; border-radius: 999px; background: var(--violet-soft); color: #c6bfff; font-weight: 500; font-size: 12.5px; border: 1px solid var(--violet-line); }
.attr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* 分鏡 */
.toolbar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 20px; }
.refs { display: flex; gap: 6px; align-items: center; height: 38px; }
.refs img { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.refs img:hover { border-color: var(--red); }

.shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.shot { border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 11px; background: var(--s2); transition: border-color .15s, box-shadow .15s; }
.shot:hover { border-color: #323746; }
.shot.cur { border-color: var(--violet-line); box-shadow: 0 0 0 1px var(--violet-line), 0 10px 30px rgba(109, 92, 240, .12); }
.shot-head { display: flex; align-items: center; gap: 10px; }
.shot-no { font: 600 12px var(--mono); letter-spacing: .06em; background: var(--s3); color: var(--ink-2); padding: 3px 8px; border-radius: 6px; }
.shot.cur .shot-no { background: var(--violet); color: #fff; }
.shot-tc { font: 500 13px var(--mono); color: var(--amber); }
.shot-dur { margin-left: auto; font: 500 12px var(--mono); color: var(--muted); }
.thumb { position: relative; border-radius: 11px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb img { cursor: zoom-in; }
.thumb .cap { position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.65); backdrop-filter: blur(6px); color: #fff; padding: 2px 8px; border-radius: 6px; font-size: 12px; max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.thumb .switch { position: absolute; top: 8px; right: 8px; display: flex; background: rgba(0,0,0,.6); backdrop-filter: blur(8px); border-radius: 8px; padding: 2px; gap: 2px; border: 1px solid rgba(255,255,255,.08); }
.thumb .switch button { border: 0; background: transparent; color: #c9cdd8; font-size: 11.5px; padding: 3px 8px; border-radius: 6px; font-weight: 600; }
.thumb .switch button.on { background: #fff; color: #111; }
.thumb .busy { position: absolute; inset: 0; background: rgba(8,9,12,.72); backdrop-filter: blur(3px); color: #fff; display: grid; place-items: center; text-align: center; font-size: 13px; }
.thumb .busy > div { display: grid; gap: 10px; justify-items: center; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 7px; padding: 2px 9px; font-size: 12.5px; color: var(--ink-2); background: var(--bg-2); }
.tag svg { color: var(--violet); width: 14px; height: 14px; }
.tag.cam svg { color: var(--green); }
.shot dl { margin: 0; display: grid; gap: 5px; font-size: 13.5px; }
.shot dl div { display: grid; grid-template-columns: 38px 1fr; gap: 6px; }
.shot dt { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.shot dd { margin: 0; color: var(--ink-2); }
.shot dd.strong { color: var(--ink); font-weight: 600; }
.shot-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.shot-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 10px; display: flex; justify-content: space-between; align-items: center; color: var(--muted); cursor: pointer; font-size: 13px; transition: color .15s; }
.shot-foot:hover, .shot.cur .shot-foot { color: var(--violet); }
.err-line { color: var(--red); font-size: 12.5px; }

/* 提示詞 */
.prompt-list { display: grid; gap: 12px; }
.pcard { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg-2); }
.pcard-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 16px; background: var(--s2); border-bottom: 1px solid var(--line); }
.pcard-head b { font-size: 14px; }
.pcard-head span { color: var(--muted); font-size: 12.5px; }
.pcard-head .push { margin-left: auto; }
.pcard textarea { display: block; width: 100%; border: 0; resize: vertical; padding: 14px 16px; font: 13px/1.75 var(--mono); min-height: 100px; background: transparent; outline: none; color: var(--ink-2); }
.pcard textarea:focus { color: var(--ink); background: rgba(139,124,255,.04); }
.pcard textarea + textarea { border-top: 1px dashed var(--line); min-height: 76px; }

/* 10 秒短片 */
.gold-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; }
.gold-grid textarea.golden { width: 100%; min-height: 210px; border: 1px solid var(--amber-line); background: var(--amber-soft); color: #efe4cd; border-radius: 12px; padding: 16px; font: 13.5px/1.8 var(--mono); resize: vertical; outline: none; }
.gold-grid textarea.golden:focus { box-shadow: 0 0 0 3px rgba(245,177,61,.12); }
.gen-box { border: 1px solid var(--line); border-radius: 14px; background: var(--s2); padding: 18px; display: grid; gap: 14px; align-content: start; }
.gen-box h4 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.gen-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gen-opts .full { grid-column: 1 / -1; }
.note { font-size: 12.5px; color: var(--muted); margin: 0; }
.estimate { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 14px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.estimate span { color: var(--muted); font-size: 12.5px; }
.estimate b { font: 600 18px var(--mono); color: var(--green); }
.estimate b small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 6px; }
.jobs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.job { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--s2); }
.job video { width: 100%; display: block; background: #000; aspect-ratio: 16 / 9; }
.job .job-wait { aspect-ratio: 16 / 9; background: #000; color: var(--ink-2); display: grid; place-items: center; text-align: center; font-size: 13px; padding: 12px; }
.job .job-wait > div { display: grid; gap: 10px; justify-items: center; }
.job-meta { padding: 9px 12px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.job-meta .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-line { color: var(--muted); padding: 22px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; grid-column: 1 / -1; }

/* ---------- 對話框 ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(4, 5, 8, .66); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { background: var(--s1); border: 1px solid var(--line); border-radius: 18px; width: min(620px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 40px 100px rgba(0,0,0,.6); animation: pop .18s ease-out; }
.modal-card.wide { width: min(880px, 100%); }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 14px 22px; border-bottom: 1px solid var(--line-2); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-body { padding: 18px 22px 22px; overflow: auto; display: grid; gap: 14px; grid-auto-rows: max-content; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

.bill { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.bill div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; font-size: 13.5px; border-bottom: 1px solid var(--line-2); background: var(--bg-2); }
.bill div span:last-child { font-family: var(--mono); color: var(--ink-2); white-space: nowrap; }
.bill div.total { background: var(--s2); font-weight: 700; border-bottom: 0; }
.bill div.total span:last-child { color: var(--green); font-size: 16px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--bg-2); }
.stat span { font: 600 10.5px var(--mono); letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.stat b { display: block; font: 600 22px var(--mono); margin-top: 4px; }
.stat small { color: var(--muted); font-family: var(--mono); }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 70px 1fr 190px; gap: 10px; align-items: center; font-size: 13px; }
.bar i { display: block; height: 8px; border-radius: 6px; background: var(--s3); overflow: hidden; }
.bar i b { display: block; height: 100%; border-radius: 6px; }
.bar span:last-child { font-family: var(--mono); text-align: right; color: var(--ink-2); font-size: 12.5px; }
.ledger { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ledger td, .ledger th { padding: 7px 8px; border-bottom: 1px solid var(--line-2); text-align: left; }
.ledger th { color: var(--muted); font: 600 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.ledger td.num { font-family: var(--mono); text-align: right; color: var(--ink-2); white-space: nowrap; }
.price-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.price-table td, .price-table th { padding: 6px 8px; border-bottom: 1px solid var(--line-2); text-align: left; }
.price-table th { color: var(--muted); font-weight: 600; }
.price-table td:last-child { font-family: var(--mono); color: var(--ink-2); }
details.more summary { cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: 13px; }
details.more[open] summary { margin-bottom: 10px; }

.hist { display: flex; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--bg-2); }
.hist img { width: 112px; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: #000; }
.hist .grow { flex: 1; min-width: 0; }
.hist b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist small { color: var(--muted); font-size: 12px; }

.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.9); display: grid; place-items: center; cursor: zoom-out; padding: 24px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #f2f3f7; color: #111; padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 13.5px; opacity: 0; transition: all .2s; pointer-events: none; z-index: 80; max-width: calc(100% - 32px); box-shadow: 0 12px 30px rgba(0,0,0,.4); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #fff; }

.dragmask { position: fixed; inset: 10px; z-index: 90; background: rgba(139,124,255,.1); border: 2px dashed var(--violet); border-radius: 20px; display: grid; place-items: center; font-size: 22px; font-weight: 800; color: #fff; pointer-events: none; backdrop-filter: blur(2px); }

.login { position: fixed; inset: 0; z-index: 100; background: radial-gradient(800px 500px at 50% 0%, rgba(109,92,240,.25), transparent 70%), var(--bg); display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--s1); border: 1px solid var(--line); border-radius: 22px; padding: 36px 32px 28px; width: min(400px, 100%); text-align: center; box-shadow: 0 40px 100px rgba(0,0,0,.5); display: grid; gap: 12px; }
.login-card h1 { margin: 0; font-size: 24px; font-weight: 800; }
.login-card p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.login-card input { height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; text-align: center; background: var(--bg-2); outline: none; }
.login-card input:focus { border-color: var(--violet-line); box-shadow: 0 0 0 3px var(--violet-soft); }
.login-err { color: var(--red); min-height: 1.4em; font-size: 13px; }

/* ---------- 響應式 ---------- */
@media (max-width: 1240px) {
  .stage { grid-template-columns: 1fr; }
  .shots, .jobs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attr-grid { grid-template-columns: repeat(2, 1fr); }
  .crumb { display: none; }
}
@media (max-width: 820px) {
  .topbar { padding: 0 16px; height: 58px; }
  .brand-text span { display: none; }
  .actions .btn span { display: none; }
  .actions .btn { width: 38px; padding: 0; }
  .cost-chip { margin-right: 0; padding: 0 10px; }
  .wrap { padding: 16px 16px 56px; }
  .projbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .proj-actions .input { flex: 1; width: auto; }
  .tabs { width: 100%; }
  .tabs button { padding: 0 11px; font-size: 13px; }
  .panel { padding: 18px 16px; }
  .panel-head h2 small { display: block; margin: 0; }
  .shots, .grid2, .attr-grid, .gold-grid, .jobs, .gen-opts, .skeleton, .stats { grid-template-columns: 1fr; }
  .timeline { margin: 10px 12px 0; }
  .controls { padding: 10px 12px 12px; gap: 8px; }
  .seg-ctl { margin-left: 0; }
  .vol input { width: 60px; }
  .seg-table { display: block; overflow-x: auto; }
  .filmstrip { padding: 10px 12px 12px; }
  .film { width: 112px; }
  .panel-head { flex-wrap: wrap; }
  .panel-head .pill { display: none; }
  .toolbar .field, .toolbar > .btn { width: 100%; }
  .bar { grid-template-columns: 64px 1fr; }
  .bar span:last-child { grid-column: 1 / -1; text-align: left; }
}
@media (max-width: 600px) {
  .brand-text { display: none; }
  .actions { gap: 6px; }
  .cost-chip { height: 36px; font-size: 11.5px; }
  .actions .btn { width: 36px; height: 36px; }
  .ctl-label { display: none; }
}
