/* 操作页：现场是暗下来的宴会厅，操作的人坐在侧边看笔记本，所以一直用深色，不跟系统切换。
   配色沿用小工具站的深色版（暖褐底、杏色强调），画面切换按钮做大，远一点也点得准。 */
:root {
  --bg: #171411; --surface: #221d19; --surface-2: #2a241f; --surface-3: #342c26;
  --line: #3a322b; --line-strong: #52473e;
  --ink: #f1e7d8; --ink-2: #c9b9a6; --ink-3: #a39382;
  --accent: #e0915a; --accent-ink: #1d1611; --honey: #ffd98a;
  --live: #9cc27a; --live-soft: #26301e; --warn: #e5b45f; --warn-soft: #3a2e1a; --danger: #e57c68;
  --radius: 10px;
  --z-sticky: 10; --z-gate: 40; --z-toast: 50;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line-strong);
  font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink-2); text-align: center; background: var(--bg);
}

/* ---------- 顶栏 ---------- */
.top {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px 24px; background: color-mix(in oklch, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 16px; min-width: 0; flex-wrap: wrap; }
.brand h1 { margin: 0; font: 400 30px/1.2 "Long Cang", "Kaiti SC", "KaiTi", serif; color: var(--honey); letter-spacing: .02em; }
.folder { color: var(--ink-2); font-size: 13px; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.folder .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); flex: none; }
.folder .dot.w { background: var(--warn); }
.folder button { padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font-size: 12px; color: var(--ink-2); }
.folder button:hover { border-color: var(--ink-3); color: var(--ink); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.save-state { color: var(--ink-3); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface-2); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .15s var(--ease-out);
}
.btn:hover { background: var(--surface-3); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .seg button:focus-visible, .scene:focus-visible, .thumb:focus-visible { outline: 2px solid var(--honey); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.on { border-color: var(--honey); color: var(--honey); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn kbd { font-size: 11px; }

.warn { margin: 12px 24px 0; padding: 10px 14px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: 13px; line-height: 1.7; }
.warn ul { margin: 0; padding-left: 18px; }

/* ---------- 版面 ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 456px; gap: 28px; padding: 20px 24px 48px; align-items: start; }
.col-main { min-width: 0; display: flex; flex-direction: column; gap: 34px; }
.side-sticky { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .col-side { order: -1; }
  .side-sticky { position: static; }
  .preview-box { max-width: 640px; }
}

.sec-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.sec-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.count { color: var(--ink-3); font-weight: 400; font-size: 14px; margin-left: 4px; }
.sec-note { margin: 0; color: var(--ink-3); font-size: 13px; }

.opts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 12px 0 14px; border-top: 1px solid var(--line); }
.opt { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.opt input[type=number] { width: 64px; }
input[type=number], input[type=text], select {
  height: 34px; padding: 4px 10px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--surface);
}
input[type=text] { width: 100%; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
input[type=range] { accent-color: var(--accent); width: 130px; }
output { min-width: 3em; color: var(--ink); font-variant-numeric: tabular-nums; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button:hover { color: var(--ink); background: var(--surface-2); }
.seg button.on { background: var(--surface-3); color: var(--honey); }

/* ---------- 画面切换 ---------- */
.scene-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 12px; }
.scene {
  position: relative; display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden; text-align: left;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  transition: border-color .15s, transform .2s var(--ease-out);
}
.scene:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.scene .pic { position: relative; aspect-ratio: 16 / 9; background: #0d0a08; overflow: hidden; }
.scene .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scene .pic.contain img { object-fit: contain; }
.scene .pic .split { position: absolute; inset: 0; display: grid; grid-template-columns: 3fr 2fr; }
.scene .pic .split img { position: static; width: 100%; height: 100%; }
.scene .pic .split .disc { display: flex; align-items: center; justify-content: center; background: oklch(0.2 0.024 55); }
.scene .pic .split .disc i { width: 44%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #e0612a 0 30%, #1c1612 31%); }
.scene .meta { display: flex; align-items: center; gap: 8px; padding: 9px 12px 10px; }
.scene .name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene .sub { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.scene.on { border-color: var(--honey); box-shadow: 0 0 0 1px var(--honey); }
.scene.on::after {
  content: "正在放映"; position: absolute; top: 8px; left: 8px; padding: 1px 8px; border-radius: 99px;
  background: var(--honey); color: var(--accent-ink); font-size: 12px; font-weight: 600;
}
.scene.bad .sub { color: var(--danger); }
.scene.missing { cursor: default; opacity: .6; }
.scene.missing:hover { transform: none; border-color: var(--line); }

/* ---------- 照片网格 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.thumb {
  position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--surface);
  border: 0; padding: 0; cursor: pointer;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .3s, filter .2s; }
.thumb .n { position: absolute; left: 5px; bottom: 4px; font-size: 11px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.8); font-variant-numeric: tabular-nums; }
.thumb.off img { filter: grayscale(1) brightness(.35); }
.thumb.off::after { content: "不放"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink); font-size: 13px; font-weight: 600; }
.thumb.cur { box-shadow: 0 0 0 2px var(--honey); }
.thumb.bad::after { content: "读不出"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--danger); font-size: 12px; background: rgba(0,0,0,.5); }
.thumb .go {
  position: absolute; right: 5px; top: 5px; width: 28px; height: 28px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; font-size: 11px; cursor: pointer; opacity: 0; transition: opacity .15s;
  display: flex; align-items: center; justify-content: center;
}
.thumb:hover .go, .thumb:focus-within .go { opacity: 1; }
.thumb.off .go { display: none; }
.grid-more { grid-column: 1 / -1; color: var(--ink-3); font-size: 13px; padding: 4px 0; }

/* ---------- 歌单 ---------- */
.songs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.song { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.song .i { color: var(--ink-3); font-variant-numeric: tabular-nums; text-align: right; font-size: 12px; }
.song .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song .t small { color: var(--ink-3); margin-left: 8px; font-size: 12px; }
.song .d { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 12px; }
.song button { border: 1px solid transparent; background: transparent; border-radius: 6px; padding: 3px 8px; cursor: pointer; color: var(--ink-2); font-size: 12px; }
.song button:hover { border-color: var(--line-strong); color: var(--ink); }
.song.cur .t { color: var(--honey); }
.song.cur .i::before { content: "♪"; color: var(--honey); }
.song.cur .i span { display: none; }
.song.off .t, .song.off .d { opacity: .4; text-decoration: line-through; }
.song.bad .d { color: var(--danger); }

/* ---------- 屏幕和文字 ---------- */
.form { display: grid; gap: 14px; padding-top: 12px; border-top: 1px solid var(--line); max-width: 760px; }
.field { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 12px; color: var(--ink-2); }
.field > .seg, .field > select { justify-self: start; }
.field .inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field .inline input[type=number] { width: 84px; }
.field small { color: var(--ink-3); font-size: 12px; flex-basis: 100%; }
.field input.script { font-family: "Long Cang", "Kaiti SC", "KaiTi", serif; font-size: 20px; color: var(--honey); }
.field select { margin-left: 10px; }

/* ---------- 侧栏：预览与控制 ---------- */
.preview-box { position: relative; border-radius: var(--radius); overflow: hidden; background: #0d0a08; border: 1px solid var(--line); }
.preview { position: relative; width: 100%; aspect-ratio: var(--ar, 1366 / 768); }
.preview:fullscreen { aspect-ratio: auto; width: 100vw; height: 100vh; }
.preview-note {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 16px; text-align: center; color: var(--ink-2); font-size: 13px; background: rgba(13,10,8,.55); pointer-events: none;
}
.preview-note b { color: var(--ink); font-size: 15px; font-weight: 600; }

.now { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.now .row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; }
.now .k { color: var(--ink-3); }
.now .v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now .v b { color: var(--ink); font-weight: 600; }
.now .paused { color: var(--warn); font-weight: 600; }

.transport { display: grid; gap: 8px; }
.t-row { display: flex; gap: 8px; align-items: center; }
.t-row .btn { flex: 1; }
.btn.wide { width: 100%; min-height: 44px; font-weight: 600; }
.btn.wide.paused { border-color: var(--warn); color: var(--warn); }
.video-ctl { display: grid; gap: 8px; padding-top: 6px; }
.vbar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; cursor: pointer; }
.vbar i { display: block; height: 100%; width: 0; background: var(--accent); }
.vtime { flex: 1; color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 13px; }

.keys { color: var(--ink-2); font-size: 13px; border-top: 1px solid var(--line); padding-top: 10px; }
.keys summary { cursor: pointer; color: var(--ink-3); }
.keys dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 0 0; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; }

/* ---------- 选文件夹 ---------- */
.gate { position: fixed; inset: 0; z-index: var(--z-gate); display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.gate-card { width: min(560px, 100%); }
.gate-card h2 { margin: 0 0 6px; font: 400 44px/1.2 "Long Cang", "Kaiti SC", "KaiTi", serif; color: var(--honey); }
.gate-card p { margin: 8px 0; color: var(--ink-2); line-height: 1.75; }
.gate-card .tree {
  margin: 18px 0; padding: 14px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  font: 13px/1.85 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink-2); white-space: pre; overflow-x: auto;
}
.gate-card .tree b { color: var(--ink); font-weight: 400; }
.gate-card .tree em { font-style: normal; color: var(--ink-3); }
.gate-card .big { width: 100%; min-height: 48px; font-size: 16px; margin-top: 10px; }
.gate-card .link { display: inline-block; margin-top: 10px; border: 0; background: none; color: var(--ink-2); text-decoration: underline; cursor: pointer; padding: 0; }
.gate-card .err { color: var(--danger); }
.gate-card .bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 16px; }
.gate-card .bar i { display: block; height: 100%; width: 40%; background: var(--accent); animation: gate-ind 1.2s ease-in-out infinite alternate; }
@keyframes gate-ind { from { margin-left: 0; } to { margin-left: 60%; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: var(--z-toast); transform: translate(-50%, 16px);
  max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px; background: var(--surface-3); color: var(--ink);
  border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .btn, .scene, .toast, .thumb img { transition: none; }
  .gate-card .bar i { animation: none; width: 100%; }
}
