/* 放映间：深酒红的放映厅底色，放映机灯光的暖黄做强调色；标题用宋体，数字用窄体。字体全部用系统自带的，不依赖外网。 */
:root {
  --bg: #150e12;
  --panel: #1f151b;
  --panel-2: #2b1d26;
  --line: #3d2b35;
  --text: #f3ebe4;
  --muted: #ab99a2;
  --lamp: #ffcf70;
  --lamp-ink: #2a1c05;
  --danger: #ff8272;
  --ok: #8fd6b4;
  --radius: 10px;
  --font-ui: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-title: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --font-num: "DIN Alternate", "Bahnschrift", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, p, ul, ol, dl, dd, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--lamp); }
code { font-family: var(--font-num); font-size: 1.05em; background: var(--panel-2); padding: 1px 6px; border-radius: 4px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }

.brand { font-family: var(--font-title); font-weight: 900; font-size: 26px; letter-spacing: 0.12em; }

/* —— 按钮与输入 —— */
.btn {
  min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--lamp); border-color: var(--lamp); color: var(--lamp-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); background: transparent; }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #2b0b06; font-weight: 600; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 14px; }
.link-btn { background: none; border: 0; padding: 4px 2px; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.icon-btn:hover { color: var(--text); background: var(--panel-2); }

input[type="text"], input[type="url"], input[type="password"], input[type="number"], select {
  width: 100%; min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text);
}
input::placeholder { color: #7d6c75; }
.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .field select { font-size: 15px; }
.field.grow { flex: 1 1 220px; }
.field.narrow { flex: 0 0 132px; }
.form-error { color: var(--danger); margin-top: 10px; }

.seg { display: inline-flex; align-self: flex-end; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 0 14px; line-height: 42px; color: var(--muted); }
.seg input:checked + span { background: var(--panel-2); color: var(--lamp); }
.seg input:focus-visible + span { outline: 2px solid var(--lamp); outline-offset: -2px; }

/* —— 登录 —— */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-box { width: min(340px, 100%); display: grid; gap: 10px; }
.login-box .brand { font-size: 34px; margin-bottom: 18px; }
.login-box label { color: var(--muted); font-size: 13px; }
.login-box .btn { margin-top: 8px; }
.login-box .form-error { margin: 0; }

/* —— 页面骨架 —— */
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; max-width: 1120px; margin: 0 auto; padding: 22px 20px 6px; }
.top-meta { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 14px; }
.page { max-width: 1120px; margin: 0 auto; padding: 14px 20px 80px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 38px 0 14px; }
.sec-head h2 { font-family: var(--font-title); font-weight: 900; font-size: 21px; letter-spacing: 0.06em; }
.empty { color: var(--muted); max-width: 34em; padding: 8px 0 30px; }

/* —— 下载栏 —— */
.add { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.add-row { display: flex; gap: 10px; }
.add-row input { flex: 1; min-height: 50px; font-size: 16px; }
.add-row .btn { min-height: 50px; padding: 0 28px; font-size: 16px; }
.add-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.add-hint { color: var(--muted); font-size: 13px; margin-top: 10px; }

/* —— 胶片进度条：上下两排齿孔，已完成的部分被灯光照亮 —— */
.strip { position: relative; height: 18px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.strip > i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--lamp); transition: width 0.6s linear; }
.strip::before, .strip::after {
  content: ""; position: absolute; left: 0; right: 0; height: 3px; z-index: 1;
  background: repeating-linear-gradient(90deg, var(--bg) 0 5px, transparent 5px 12px);
}
.strip::before { top: 2px; }
.strip::after { bottom: 2px; }
.strip.waiting > i { background: var(--muted); }
.strip.failed > i { background: var(--danger); }
/* 下完的任务不再画进度条，免得一排亮黄条抢了“下载”按钮的注意力 */
.task[data-state="done"] .strip { display: none; }

/* —— 下载任务 —— */
.tasks { display: grid; gap: 4px; }
.task { padding: 14px 0 16px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.task-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.task-name { font-weight: 600; overflow-wrap: anywhere; }
.task-state { color: var(--muted); font-size: 13px; white-space: nowrap; }
.task[data-status="error"] .task-state { color: var(--danger); }
.task[data-status="done"] .task-state { color: var(--ok); }
.task-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.task-stats { display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--muted); font-size: 15px; }
.task-stats b { color: var(--text); font-weight: 600; min-width: 3.2em; }
.task-actions { display: flex; gap: 8px; }
.task-error { color: var(--danger); font-size: 14px; }

/* —— 片库 —— */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 26px 20px; }
.card { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; display: grid; gap: 8px; align-content: start; }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card:hover .thumb { border-color: var(--lamp); }
.badge { position: absolute; right: 8px; bottom: 8px; padding: 0 7px; border-radius: 5px; background: rgba(15, 9, 12, 0.82); font-size: 13px; line-height: 22px; }
.resume-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--lamp); }
.card-title { font-weight: 600; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.card-meta { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 2px 12px; }
.card-job { color: var(--lamp); }

/* —— 弹层 —— */
.sheet { width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); color: var(--text); padding: 22px; overflow-y: auto; }
.sheet::backdrop { background: rgba(8, 4, 6, 0.72); }
.narrow-sheet { width: min(480px, calc(100vw - 24px)); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.sheet-head h2 { font-family: var(--font-title); font-weight: 900; font-size: 22px; line-height: 1.3; overflow-wrap: anywhere; }
.sheet h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 26px 0 8px; }
.path { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; margin-top: 2px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .primary { padding: 0 34px; }
.edit-form { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.edit-actions { display: flex; gap: 8px; flex-basis: 100%; }
.edit-form .form-error { flex-basis: 100%; margin: 0; }
.rows .row { display: grid; grid-template-columns: 4.5em 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.rows dt { color: var(--muted); }
.rows dd { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 8px; }
.subs li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.subs .none { color: var(--muted); }
.upload-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; }
.danger-zone { margin-top: 30px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.danger-zone > span { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.steps { list-style: decimal; padding-left: 1.4em; display: grid; gap: 10px; margin: 14px 0; }
.jf-status { padding: 8px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 600; }

/* —— 播放器 —— */
.player { position: fixed; inset: 0; z-index: 40; background: #000; }
.stage { position: absolute; inset: 0; background: #000; overflow: hidden; color: #fff; }
.stage video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.stage.idle { cursor: none; }
.stage.idle .p-top, .stage.idle .p-bottom { opacity: 0; pointer-events: none; }
.p-top, .p-bottom { position: absolute; left: 0; right: 0; z-index: 3; transition: opacity 0.2s; }
.p-top { top: 0; display: flex; align-items: center; gap: 12px; padding: max(10px, env(safe-area-inset-top)) 14px 34px; background: linear-gradient(rgba(0, 0, 0, 0.72), transparent); }
.p-bottom { bottom: 0; padding: 34px 14px max(10px, env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)); }
.p-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 16px; }
.p-stats { display: flex; gap: 8px; font-size: 14px; }
.p-stats span { padding: 1px 8px; border-radius: 5px; background: rgba(255, 255, 255, 0.14); white-space: nowrap; }
.p-row { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.p-row .spacer { flex: 1; }
.p-btn { min-width: 40px; height: 40px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.p-btn:hover { background: rgba(255, 255, 255, 0.14); }
.p-btn.text { font-size: 15px; padding: 0 10px; white-space: nowrap; }
.p-btn.toggle[aria-pressed="true"] { background: var(--lamp); color: var(--lamp-ink); font-weight: 600; }
.p-time { font-size: 15px; margin-left: 4px; white-space: nowrap; }
.stage:not(.playing) .i-pause, .stage.playing .i-play { display: none; }
.stage:not(.muted) .i-muted, .stage.muted .i-vol { display: none; }

input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; margin: 0; }
.seek { width: 100%; height: 22px; --played: 0%; --buffered: 0%; }
.seek::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--lamp) 0 var(--played), rgba(255,255,255,0.5) var(--played) var(--buffered), rgba(255,255,255,0.2) var(--buffered) 100%); }
.seek::-moz-range-track { height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--lamp) 0 var(--played), rgba(255,255,255,0.5) var(--played) var(--buffered), rgba(255,255,255,0.2) var(--buffered) 100%); }
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--lamp); margin-top: -5px; }
.seek::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: var(--lamp); }
.volume { width: 84px; height: 22px; }
.volume::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.4); }
.volume::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.4); }
.volume::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; margin-top: -4.5px; }
.volume::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; }

.captions { position: absolute; left: 4%; right: 4%; bottom: 8%; z-index: 2; text-align: center; pointer-events: none; line-height: 1.35; font-family: var(--font-ui); font-weight: 600; }
.captions > div { display: inline; white-space: pre-line; padding: 0.08em 0.35em; border-radius: 0.15em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

.veil { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 70px 24px; text-align: center; background: rgba(0, 0, 0, 0.6); }
.veil p { max-width: 30em; font-size: 16px; }
.veil .strip { width: min(360px, 76vw); }
.veil-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.menu { position: absolute; z-index: 5; min-width: 168px; max-width: min(320px, calc(100vw - 20px)); max-height: 62%; overflow-y: auto; padding: 6px; border-radius: 10px; background: rgba(31, 21, 27, 0.97); border: 1px solid var(--line); color: var(--text); }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 4px 12px; border: 0; border-radius: 7px; background: none; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.menu button:hover { background: var(--panel-2); }
.menu button[aria-checked="true"] { color: var(--lamp); font-weight: 600; }
.menu button[aria-checked="true"]::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lamp); flex: none; }
.menu button[aria-checked="false"]::before { content: ""; width: 7px; flex: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.menu .note { padding: 6px 12px; color: var(--muted); font-size: 13px; }

.cap-panel { position: absolute; z-index: 6; right: 12px; top: 12px; width: min(330px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow-y: auto; padding: 16px; border-radius: 14px; background: rgba(31, 21, 27, 0.94); border: 1px solid var(--line); color: var(--text); display: grid; gap: 14px; }
.cap-panel .sheet-head { margin: 0; }
.cap-panel .sheet-head h2 { font-size: 18px; }
.slider { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 14px; color: var(--muted); }
.slider input { grid-column: 1 / -1; order: 3; height: 24px; }
.slider input::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line); }
.slider input::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
.slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--lamp); margin-top: -6px; }
.slider input::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--lamp); }
.slider output { order: 2; color: var(--text); font-family: var(--font-num); }
.swatches { display: flex; gap: 10px; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatches button[aria-checked="true"] { border-color: var(--lamp); outline: 2px solid var(--lamp); outline-offset: 2px; }
.offset { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.offset span { flex-basis: 100%; }
.offset output { min-width: 4.6em; text-align: center; color: var(--text); }
.offset .btn { min-height: 34px; padding: 0 10px; font-size: 14px; }

/* 不支持真全屏的设备（iPhone）用铺满窗口代替 */
.player.pseudo-fs { z-index: 100; }

@media (max-width: 640px) {
  .top { padding: 16px 16px 4px; }
  .page { padding: 12px 16px 60px; }
  .add-row { flex-direction: column; }
  .field.narrow { flex: 1 1 110px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 14px; }
  .card-title { font-size: 15px; }
  .sheet { padding: 18px; }
  .hide-s { display: none; }
  .p-btn.text { padding: 0 7px; font-size: 14px; }
  .p-time { font-size: 13px; }
  .p-stats { font-size: 12px; }
  .p-title { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* 自动删除倒计时 */
.expiry { color: #d9a25b; }
.retention { color: #d9a25b; font-size: 13px; }
