/* 素材台 — light-table workbench for AI video creators */
:root {
  --bg: #E8EDF1; --panel: #FFFFFF; --panel-2: #F4F7F9; --ink: #17202C; --muted: #5E6A7A; --faint: #8A95A3;
  --line: #D2DAE2; --line-2: #E3E8ED; --blue: #3256D4; --blue-ink: #FFFFFF; --blue-soft: #E5EBFC;
  --red: #D6433A; --red-soft: #FBE7E5; --ok: #1F8A5B; --stage: #DCE3E9; --stage-dot: #C8D1DA;
  --shadow: 0 1px 0 rgba(23, 32, 44, .04), 0 6px 20px -12px rgba(23, 32, 44, .25);
  --r-s: 6px; --r-m: 10px; --r-l: 16px;
  --font: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #10141A; --panel: #181E26; --panel-2: #1E252E; --ink: #E6EAF0; --muted: #94A0AF; --faint: #6D7887;
  --line: #2A333E; --line-2: #222A33; --blue: #7F99FF; --blue-ink: #0E1430; --blue-soft: #232D4D;
  --red: #FF6F62; --red-soft: #3A2020; --ok: #4CC38A; --stage: #0C1015; --stage-dot: #1B222B;
  --shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 10px 30px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- top bar with film-reel nav ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px; padding: 10px 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 16px; letter-spacing: .02em; white-space: nowrap; }
.brand-mark { width: 22px; height: 22px; border-radius: 5px; background:
  radial-gradient(circle at 50% 50%, var(--bg) 0 3px, transparent 3.5px),
  conic-gradient(var(--blue) 0 25%, var(--red) 0 50%, var(--blue) 0 75%, var(--ink) 0); }
.reel { display: flex; gap: 0; padding: 7px 4px; border-radius: 8px; background: var(--ink); position: relative; overflow-x: auto; scrollbar-width: none; }
.reel::before, .reel::after { content: ""; position: absolute; left: 6px; right: 6px; height: 4px; pointer-events: none;
  background: radial-gradient(circle, var(--bg) 1.4px, transparent 1.8px) 0 0 / 10px 4px repeat-x; opacity: .55; }
.reel::before { top: 2px; } .reel::after { bottom: 2px; }
.reel-tab { position: relative; padding: 5px 14px; color: color-mix(in srgb, var(--bg) 78%, transparent); text-decoration: none; font-size: 13px; white-space: nowrap; border-radius: 3px; }
.reel-tab + .reel-tab { border-left: 1px solid color-mix(in srgb, var(--bg) 18%, transparent); }
.reel-tab:hover { color: var(--bg); }
.reel-tab.on { background: var(--blue); color: var(--blue-ink); font-weight: 600; border-left-color: transparent; }
.reel-tab.on + .reel-tab { border-left-color: transparent; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.privacy { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.privacy::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; }
.icon-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- workbench ---------- */
.workbench { display: grid; grid-template-columns: 300px minmax(0, 1fr) 330px; gap: 14px; padding: 14px 20px 24px; align-items: start; }
.workbench.two { grid-template-columns: 330px minmax(0, 1fr); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); min-width: 0; }
.panel.sticky { position: sticky; top: 72px; max-height: calc(100vh - 86px); overflow: auto; scrollbar-width: thin; }
.sec { padding: 16px 18px; }
.sec + .sec { border-top: 1px solid var(--line-2); }
.sec h2 { margin: 0 0 12px; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.sec h2 .step { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; background: var(--ink); color: var(--bg); }
.sec h2 .aside { margin-left: auto; font-weight: 400; color: var(--muted); font-size: 12px; }
.page-title { padding: 18px 20px 0; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.page-title h1 { margin: 0; font-size: 22px; letter-spacing: .01em; }
.page-title p { margin: 0; color: var(--muted); }

.field { display: grid; gap: 6px; margin-bottom: 12px; align-content: start; }
.field:last-child { margin-bottom: 0; }
.field > span, .label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.field > span b { color: var(--ink); font-weight: 600; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
.row.tight > * { flex: 0 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.hint.warn { color: var(--red); }

input[type=text], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--panel-2); outline: none; min-width: 0;
}
input[type=text]:focus, input[type=number]:focus, select:focus, textarea:focus { border-color: var(--blue); background: var(--panel); }
input[type=color] { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--panel-2); flex: 0 0 38px; }
input[type=range] { width: 100%; accent-color: var(--blue); }
label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; margin-bottom: 8px; }
label.check input { accent-color: var(--blue); width: 16px; height: 16px; }

.seg { display: flex; padding: 3px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; gap: 2px; flex-wrap: wrap; }
.seg button { flex: 1; border: 0; background: transparent; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
[data-theme="dark"] .seg button.on { background: var(--blue-soft); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; cursor: pointer; font-size: 13px; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--blue); color: var(--blue-ink); border-color: var(--blue); font-weight: 600; }
.btn.primary:hover:not(:disabled) { color: var(--blue-ink); filter: brightness(1.08); }
.btn.big { width: 100%; padding: 11px 14px; font-size: 14px; }
.btn.small { padding: 5px 9px; font-size: 12px; border-radius: 6px; }
.btn.danger:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

.drop { border: 1.5px dashed var(--line); border-radius: var(--r-m); padding: 18px 14px; text-align: center; cursor: pointer; color: var(--muted); background: var(--panel-2); transition: border-color .15s, background .15s; }
.drop:hover, .drop.drag-over { border-color: var(--blue); background: var(--blue-soft); color: var(--ink); }
.drop strong { display: block; color: var(--ink); font-size: 14px; margin-bottom: 2px; }
.drop small { font-size: 12px; }

.list { display: grid; gap: 6px; margin-top: 10px; }
.item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel-2); }
.item.dragging { opacity: .4; }
.item .name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: 11.5px; color: var(--muted); }
.item .acts { display: flex; gap: 2px; }
.mini { width: 26px; height: 26px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--muted); display: grid; place-items: center; font-size: 13px; }
.mini:hover:not(:disabled) { background: var(--panel); color: var(--ink); }
.mini:disabled { opacity: .3; }
.idx { width: 22px; height: 22px; border-radius: 6px; background: var(--ink); color: var(--bg); font-size: 11px; display: grid; place-items: center; font-weight: 700; }

/* ---------- stage ---------- */
.stage { position: relative; border-radius: var(--r-l); border: 1px solid var(--line); overflow: hidden; background-color: var(--stage);
  background-image: radial-gradient(var(--stage-dot) 1px, transparent 1.2px); background-size: 18px 18px; min-height: 420px; }
.stage-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.stage-bar .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 2px; flex: 0 0 1px; }
.stage-bar .info { margin-left: auto; font-size: 12px; color: var(--muted); }
.empty { display: grid; place-items: center; text-align: center; padding: 60px 20px; color: var(--muted); min-height: 420px; }
.empty h3 { color: var(--ink); margin: 0 0 6px; font-size: 17px; }
.empty p { margin: 0 0 16px; max-width: 38em; }
.checker { background-color: #fff; background-image: linear-gradient(45deg, #e3e7eb 25%, transparent 25%), linear-gradient(-45deg, #e3e7eb 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e3e7eb 75%), linear-gradient(-45deg, transparent 75%, #e3e7eb 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; }

.progress { height: 6px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s; }
.status { font-size: 12px; color: var(--muted); margin-top: 6px; min-height: 1.5em; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.warn { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-soft); }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv div { padding: 8px 10px; background: var(--panel-2); border-radius: 8px; border: 1px solid var(--line-2); }
.kv small { display: block; color: var(--muted); font-size: 11.5px; }
.kv b { font-size: 16px; }
details.more summary { cursor: pointer; font-size: 12.5px; color: var(--muted); padding: 4px 0; }
details.more[open] summary { margin-bottom: 8px; }
.callout { padding: 10px 12px; border-radius: 8px; background: var(--blue-soft); font-size: 12.5px; border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); }
.callout.warn { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.callout + .btn, .callout + .row { margin-top: 10px; }
.callout code { font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 13px; z-index: 100; max-width: min(92vw, 640px); transition: .2s; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); color: #fff; }

kbd { font: 11px/1 var(--font); padding: 2px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--panel-2); }

/* ---------- home ---------- */
.home { max-width: 1080px; margin: 0 auto; padding: 56px 24px 64px; }
.home-hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; align-items: end; margin-bottom: 44px; }
.home-hero h1 { font-size: clamp(32px, 5vw, 54px); line-height: 1.08; margin: 0; letter-spacing: -.01em; font-weight: 800; }
.home-hero p { margin: 0; color: var(--muted); font-size: 15px; max-width: 30em; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; box-shadow: var(--shadow); }
.sheet-head, .sheet-row { display: grid; grid-template-columns: 56px 170px minmax(0, 1fr) 210px 24px; gap: 16px; align-items: center; padding: 0 20px; }
.sheet-head { font-size: 12px; color: var(--muted); height: 38px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.sheet-row { min-height: 74px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line-2); position: relative; }
.sheet-row:last-child { border-bottom: 0; }
.sheet-row:hover { background: var(--blue-soft); }
.sheet-row .no { font-size: 13px; color: var(--faint); font-weight: 600; }
.sheet-row .tname { font-size: 17px; font-weight: 700; }
.sheet-row .tdesc { color: var(--muted); }
.sheet-row .tout { font-size: 12.5px; color: var(--muted); }
.sheet-row .go { color: var(--blue); font-size: 18px; }
.home-notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 36px; color: var(--muted); font-size: 13px; }
.home-notes h3 { color: var(--ink); font-size: 14px; margin: 0 0 4px; }
.home-notes p { margin: 0; }

@media (max-width: 1180px) {
  .workbench { grid-template-columns: 280px minmax(0, 1fr); }
  .workbench > .panel:last-child:not(:first-child) { grid-column: 1 / -1; position: static; max-height: none; }
}
@media (max-width: 820px) {
  .workbench, .workbench.two { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .panel.sticky { position: static; max-height: none; }
  .topbar { flex-wrap: wrap; gap: 10px; padding: 8px 10px; }
  .reel { order: 3; width: 100%; }
  .privacy { display: none; }
  .home-hero, .home-notes { grid-template-columns: 1fr; gap: 16px; }
  .sheet-head { display: none; }
  .sheet-row { grid-template-columns: 34px minmax(0, 1fr) 20px; padding: 12px 16px; gap: 4px 12px; }
  .sheet-row .tdesc, .sheet-row .tout { grid-column: 2; }
  .sheet-row .go { grid-row: 1; grid-column: 3; }
}
