:root {
  color-scheme: light;
  font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: #1d2635;
  background: #f3f5f8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --muted: #4f5b6f;
  --line: #d5dbe5;
  --accent: #4d5dc7;
}
* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: #f3f5f8; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { min-height: 72px; padding: 0 max(24px, calc((100vw - 1120px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 24px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 700; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: #eef0ff; color: var(--accent); font-size: 17px; }
.navigation { display: flex; align-items: center; gap: 8px; overflow-x: auto; }
.nav-link { padding: 10px 14px; border-radius: 9px; color: #4d596d; font-size: 14px; white-space: nowrap; }
.nav-link.is-current { background: #f0f1ff; color: #4b59c4; }
.nav-link.is-disabled { color: #687386; }
.main-content { width: min(100% - 48px, 960px); margin: 0 auto; flex: 1; }
.page-heading { padding: 54px 0 28px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 9px; color: #58657a; font-size: 11px; font-weight: 700; letter-spacing: .14em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-size: clamp(26px, 4vw, 34px); letter-spacing: -.035em; }
.page-description { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.button { min-height: 42px; padding: 10px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 10px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.button-primary { color: #fff; background: var(--accent); box-shadow: 0 4px 10px rgb(88 103 217 / 20%); }
.button-primary:hover { background: #4857c9; }
.button-secondary { color: #586174; background: #fff; border-color: #dfe3eb; }
.button-secondary:hover { background: #f7f8fb; }
.button-danger { color: #fff; background: #a23442; border-color: #8e2634; }
.button-danger:hover { background: #8e2634; }
.library-panel { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 28px rgb(29 41 72 / 4%); }
.panel-heading { min-height: 83px; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #d8dee8; }
.panel-heading h2 { margin: 0 0 4px; font-size: 16px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.item-count { padding: 7px 10px; border-radius: 20px; background: #edf0f5; color: #465267; font-size: 12px; font-weight: 600; white-space: nowrap; }
.filter-toolbar { padding: 16px 24px; display: flex; flex-wrap: wrap; align-items: end; gap: 10px; border-bottom: 1px solid #d8dee8; }
.filter-field { min-width: 125px; flex: 1 1 135px; display: flex; flex-direction: column; gap: 6px; color: #4b586c; font-size: 12px; font-weight: 600; }
.filter-field.filter-search { min-width: 180px; flex: 1.4 1 190px; }
.tag-filter-field { flex: 1.1 1 155px; }
.sort-field { flex: 1 1 135px; }
.filter-field input, .filter-field select { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #aeb8c8; border-radius: 8px; color: #202b3d; background: #fff; font-size: 14px; font-weight: 400; }
.filter-field input:focus, .filter-field select:focus { border-color: #4657bd; outline: 3px solid rgb(77 93 199 / 20%); }
.tag-filter-field details { width: 100%; }
.tag-filter-field summary { min-height: 42px; padding: 10px; border: 1px solid #aeb8c8; border-radius: 8px; color: #202b3d; background: #fff; font-size: 14px; font-weight: 400; cursor: pointer; }
.tag-filter-field details[open] summary { border-color: #7b88b5; border-radius: 8px 8px 0 0; }
.tag-filter-options { max-height: 156px; overflow-y: auto; padding: 5px 9px; display: grid; gap: 2px; border: 1px solid #aeb8c8; border-top: 0; border-radius: 0 0 8px 8px; background: #fff; }
.tag-filter-options:empty::after { padding: 8px 2px; color: #536074; content: "尚無標籤"; font-size: 13px; }
.tag-option { min-height: 36px; display: flex; align-items: center; gap: 9px; color: #344157; font-size: 14px; font-weight: 400; cursor: pointer; }
.tag-option input { width: 18px; height: 18px; margin: 0; accent-color: #4d5dc7; }
.filter-actions { display: flex; gap: 7px; }
.filter-actions .small-button { min-height: 39px; white-space: nowrap; }
.small-button:disabled { cursor: default; opacity: .7; }
.video-list { padding: 0 24px; }
.category-panel { margin-top: 20px; }
.backup-content { padding: 24px; color: #344157; font-size: 14px; line-height: 1.7; }
.backup-content p { max-width: 70ch; }
.backup-content code { padding: 2px 5px; border-radius: 5px; background: #eef0f5; font-size: .92em; }
.backup-status { min-height: 1.5em; margin: 14px 0 0; color: #344157; }
.import-preview-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.import-preview-section h3 { margin: 0 0 7px; color: #263044; font-size: 16px; }
.import-preview-section > p { color: var(--muted); }
.import-file-field { max-width: 480px; display: flex; flex-direction: column; gap: 7px; color: #344157; font-size: 13px; font-weight: 600; }
.import-file-field input { width: 100%; min-height: 44px; padding: 8px; border: 1px solid #aeb8c8; border-radius: 8px; background: #fff; color: #202b3d; }
.import-preview { margin-top: 18px; }
.import-preview + .button-danger { margin-top: 15px; }
.undo-import-panel { margin-top: 22px; padding: 16px; border: 1px solid #d9c59b; border-radius: 10px; background: #fffaf0; }
.undo-import-panel p { margin: 0 0 10px; color: #51462f; }
.import-confirm-message { color: #344157; line-height: 1.65; }
.import-summary { margin: 0 0 16px; padding: 15px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; border-radius: 10px; background: #f3f5f8; color: #263044; }
.import-category-list { margin: 8px 0 0; padding-left: 20px; }
.import-validation { margin-top: 14px; padding: 14px; border: 1px solid #cbd3df; border-radius: 10px; background: #fff; }
.import-validation.is-invalid { border-color: #d99aa2; background: #fff7f7; }
.import-validation h4 { margin: 0 0 8px; color: #263044; font-size: 14px; }
.import-error-list { margin: 0; padding-left: 22px; display: grid; gap: 8px; color: #713b43; font-size: 13px; line-height: 1.5; }
.import-error-location { display: block; color: #4e3940; font-family: ui-monospace, monospace; font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 640px) { .import-summary { grid-template-columns: 1fr; } }
.tag-management-panel { margin-top: 20px; margin-bottom: 22px; }
.tag-management-list { padding: 0 24px; }
.tag-management-row { padding: 15px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #d8dee8; }
.tag-management-row:last-child { border-bottom: 0; }
.tag-management-info { min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 14px; }
.tag-management-info strong { overflow-wrap: anywhere; color: #263044; font-size: 14px; }
.tag-management-info span { color: #536074; font-size: 12px; }
.tag-management-info .actor-status { padding: 3px 8px; border-radius: 999px; color: #315b47; background: #e6f3eb; font-weight: 600; }
.tag-management-info .actor-status.is-retired { color: #6c3d46; background: #f8e9ec; }
.tag-management-info .actor-note-preview { flex-basis: 100%; max-width: 100%; overflow-wrap: anywhere; white-space: pre-wrap; }
.tag-management-empty { margin: 0; padding: 22px 0; color: #536074; font-size: 14px; }
.retired-field { min-height: 44px; grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; color: #344157; font-size: 14px; font-weight: 600; }
.retired-field input { width: 20px; height: 20px; margin: 0; accent-color: #4d5dc7; }
.tag-videos-content { max-height: min(55vh, 480px); overflow-y: auto; display: grid; gap: 8px; }
.tag-video-item { width: 100%; padding: 12px 13px; display: grid; gap: 5px; border: 1px solid #d5dbe5; border-radius: 10px; color: #263044; background: #f8f9fb; text-align: left; }
.tag-video-item:hover, .tag-video-item:focus-visible { border-color: #6977c8; background: #f0f2ff; outline: 2px solid rgb(77 93 199 / 16%); }
.tag-video-item strong { overflow-wrap: anywhere; font-size: 14px; }
.tag-video-item span { color: #536074; font-size: 12px; line-height: 1.5; }
.image-count { margin: -8px 0 16px; color: #465267; font-size: 13px; font-weight: 700; }
.image-upload-field { margin-bottom: 18px; }
.image-upload-field input[type="file"] { min-height: 48px; padding: 8px; }
.image-list { display: grid; gap: 10px; }
.image-empty-state { margin: 0; padding: 15px 0; color: #536074; font-size: 14px; }
.no-cover-option { min-height: 42px; display: flex; align-items: center; gap: 8px; color: #344157; font-size: 14px; font-weight: 600; }
.no-cover-option input, .image-cover-choice input { width: 18px; height: 18px; margin: 0; accent-color: #4d5dc7; }
.image-item { padding: 10px; display: grid; grid-template-columns: 96px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; border: 1px solid #d5dbe5; border-radius: 11px; background: #fafbfc; }
.image-item img { width: 96px; height: 76px; border-radius: 7px; background: #e9edf4; object-fit: contain; }
.image-item-info { min-width: 0; display: grid; gap: 5px; }
.image-item-info strong { overflow-wrap: anywhere; color: #263044; font-size: 13px; }
.image-item-info span { color: #536074; font-size: 11px; }
.image-cover-choice { display: flex; align-items: center; gap: 6px; color: #344157; font-size: 12px; white-space: nowrap; }
.cover-position-controls { margin-top: 18px; padding: 16px; border: 1px solid #cbd3df; border-radius: 12px; background: #f7f8fb; }
.cover-position-controls h3 { margin: 0 0 5px; color: #263044; font-size: 15px; }
.cover-position-description { margin: 0 0 12px; color: #536074; font-size: 12px; line-height: 1.5; }
.cover-position-preview { width: min(100%, 360px); aspect-ratio: 16 / 9; margin: 0 auto 14px; overflow: hidden; border: 1px solid #aeb8c8; border-radius: 8px; background-color: #e9edf4; background-repeat: no-repeat; }
.cover-range-field { margin-top: 10px; }
.cover-range-field input[type="range"] { width: 100%; min-height: 32px; padding: 0; border: 0; accent-color: #4d5dc7; background: transparent; }
.category-list { padding: 0 24px; }
.category-row { padding: 16px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #d8dee8; }
.category-row:last-child { border-bottom: 0; }
.category-info { min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 3px 10px; }
.category-info strong { overflow-wrap: anywhere; font-size: 14px; }
.category-code { color: #3d4ba8; font-size: 12px; font-weight: 700; white-space: nowrap; }
.category-meta { grid-column: 2; color: #536074; font-size: 12px; }
.empty-state { min-height: 290px; padding: 48px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-icon { width: 58px; height: 58px; margin-bottom: 17px; display: grid; place-items: center; border-radius: 18px; background: #edf0f6; color: #5c6b84; }
.empty-icon svg { width: 34px; height: 34px; }
.empty-state h3 { margin: 0 0 7px; font-size: 15px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }
.video-card { padding: 19px 0; display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; align-items: center; gap: 16px; border-bottom: 1px solid #d8dee8; }
.video-card:last-child { border-bottom: 0; }
.video-cover-button, .video-cover-placeholder { width: 112px; height: 63px; padding: 0; display: grid; place-items: center; overflow: hidden; border: 1px solid #d5dbe5; border-radius: 9px; color: #536074; background-color: #f0f2f6; background-repeat: no-repeat; font-size: 11px; text-align: center; }
.video-cover-button { cursor: pointer; }
.video-cover-button:hover, .video-cover-placeholder:hover, .detail-cover-button:hover, .detail-cover-placeholder:hover { border-color: #6675c8; outline: 2px solid rgb(77 93 199 / 18%); }
.video-cover-button img { width: 100%; height: 100%; object-fit: cover; }
.video-main { min-width: 0; }
.video-title-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; }
.video-number { color: #3d4ba8; font-size: 13px; font-weight: 700; }
.video-title { margin: 0; overflow-wrap: anywhere; font-size: 16px; font-weight: 600; }
.video-meta { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; color: #4f5b6f; font-size: 13px; line-height: 1.55; }
.video-tags { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-chip { padding: 4px 8px; border-radius: 999px; color: #3f4b61; background: #e9edf4; font-size: 12px; }
.card-actions { display: flex; gap: 7px; }
.small-button { padding: 7px 10px; border: 1px solid #b7c0cf; border-radius: 8px; color: #3e4a60; background: #fff; font-size: 13px; font-weight: 500; }
.small-button:hover { background: #f6f7fb; }
.small-button.danger { color: #a12d3a; }
.session-notice { margin: 14px 2px 0; color: #536074; font-size: 13px; line-height: 1.65; }
.session-notice.is-persistent { color: #46546a; }
.storage-error { margin: 0 0 16px; padding: 12px 14px; border: 1px solid #f1c5ca; border-radius: 10px; color: #a83240; background: #fff5f6; font-size: 13px; line-height: 1.55; }
.footer { padding: 26px 20px; color: #5a667a; font-size: 12px; text-align: center; }
.dialog { width: min(620px, calc(100vw - 28px)); max-height: min(90vh, 850px); padding: 0; overflow: auto; border: 0; border-radius: 18px; color: #202635; background: #fff; box-shadow: 0 24px 80px rgb(22 30 55 / 25%); }
.dialog::backdrop { background: rgb(24 31 52 / 48%); backdrop-filter: blur(2px); }
.dialog-form { padding: 25px; }
.dialog-heading { margin-bottom: 22px; display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.dialog-heading .eyebrow { margin-bottom: 5px; }
.dialog-heading h2 { margin: 0; font-size: 21px; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 9px; color: #465267; background: #eceff4; font-size: 24px; line-height: 1; }
.form-error { margin: -6px 0 18px; padding: 11px 13px; border: 1px solid #f1c5ca; border-radius: 9px; color: #a83240; background: #fff5f6; font-size: 13px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px 14px; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 7px; color: #344157; font-size: 14px; font-weight: 600; }
.field b { color: #d34e5c; }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 11px; border: 1px solid #aeb8c8; border-radius: 9px; color: #202b3d; background: #fff; font-size: 15px; font-weight: 400; }
.field textarea { min-height: 74px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #4657bd; outline: 3px solid rgb(77 93 199 / 20%); }
.field small { color: #536074; font-size: 12px; font-weight: 400; line-height: 1.55; }
.actor-suggestions:not([hidden]) { padding: 8px; display: flex; flex-wrap: wrap; gap: 7px; border: 1px solid #c2cad7; border-radius: 9px; background: #f7f8fb; }
.actor-suggestion { min-height: 36px; padding: 7px 10px; border: 1px solid #abb6c7; border-radius: 8px; color: #344157; background: #fff; font-size: 13px; }
.actor-suggestion:hover, .actor-suggestion:focus-visible { border-color: #4d5dc7; background: #eef0ff; outline: 2px solid rgb(77 93 199 / 18%); }
.field-wide { grid-column: 1 / -1; }
.dialog-actions { margin-top: 23px; display: flex; justify-content: end; gap: 9px; }
.detail-content { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-cover-wrap { grid-column: 1 / -1; display: flex; justify-content: center; }
.detail-cover-button, .detail-cover-placeholder { width: min(100%, 440px); height: auto; aspect-ratio: 16 / 9; padding: 0; display: grid; place-items: center; overflow: hidden; border: 1px solid #d5dbe5; border-radius: 11px; color: #536074; background-color: #f0f2f6; background-repeat: no-repeat; font-size: 13px; }
.detail-cover-button { cursor: pointer; }
.detail-cover-button img { width: 100%; height: 100%; object-fit: cover; }
.detail-item { min-width: 0; padding: 12px; border-radius: 10px; background: #f7f8fb; }
.detail-item.detail-wide { grid-column: 1 / -1; }
.detail-label { margin-bottom: 5px; color: #536074; font-size: 12px; }
.detail-value { overflow-wrap: anywhere; color: #30394c; font-size: 14px; white-space: pre-wrap; }
.duplicate-intro { margin: -7px 0 14px; color: #4f5b6f; font-size: 14px; line-height: 1.6; }
.duplicate-list { max-height: min(42vh, 360px); overflow-y: auto; display: grid; gap: 10px; }
.duplicate-record { padding: 13px; border: 1px solid #d5dbe5; border-radius: 11px; background: #f8f9fb; }
.duplicate-record-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.duplicate-record-heading strong { overflow-wrap: anywhere; color: #202b3d; font-size: 15px; }
.duplicate-record-heading span { flex: 0 0 auto; color: #3d4ba8; font-size: 12px; font-weight: 700; }
.duplicate-record dl { margin: 10px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.duplicate-record dl div { min-width: 0; }
.duplicate-record dt { color: #536074; font-size: 11px; }
.duplicate-record dd { margin: 2px 0 0; overflow-wrap: anywhere; color: #263044; font-size: 13px; }
.gallery-dialog { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; overflow: hidden; border: 0; border-radius: 0; color: #f7f8fc; background: #10141e; }
.gallery-dialog::backdrop { background: #080a0f; }
.gallery-shell { width: 100%; height: 100%; padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); display: flex; flex-direction: column; }
.gallery-toolbar { min-height: 58px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 16px; }
.gallery-heading .eyebrow { margin-bottom: 3px; color: #aeb8ca; }
.gallery-heading h2 { max-width: min(62vw, 640px); margin: 0; overflow: hidden; color: #fff; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.gallery-count { color: #e3e8f2; font-size: 13px; font-weight: 600; white-space: nowrap; }
.gallery-close { width: 42px; height: 42px; border: 1px solid #596273; border-radius: 10px; color: #fff; background: #252c39; font-size: 27px; line-height: 1; }
.gallery-stage { min-height: 0; flex: 1; display: grid; grid-template-columns: 54px minmax(0, 1fr) 54px; align-items: center; gap: 8px; overflow: hidden; touch-action: pan-y; }
.gallery-image-frame { position: relative; width: 100%; height: 100%; min-width: 0; min-height: 0; overflow: hidden; display: grid; place-items: center; isolation: isolate; }
.gallery-image-frame img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; object-position: center; transform-origin: center center; user-select: none; -webkit-user-drag: none; }
.gallery-image-frame.is-zoomed img { cursor: grab; touch-action: none; }
.gallery-image-frame.is-zoomed img:active { cursor: grabbing; }
.gallery-nav-button { width: 48px; height: 58px; border: 1px solid #596273; border-radius: 12px; color: #fff; background: #252c39; font-size: 38px; line-height: 1; }
.gallery-nav-button:disabled { opacity: .35; cursor: default; }
.gallery-bottom { min-height: 45px; margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gallery-hint { margin: 0; color: #c2cad7; font-size: 12px; text-align: center; }
.gallery-zoom-controls { display: flex; align-items: center; gap: 6px; }
.gallery-zoom-controls button { min-width: 40px; min-height: 38px; padding: 6px 9px; border: 1px solid #596273; border-radius: 8px; color: #fff; background: #252c39; font-size: 14px; }
.gallery-zoom-controls button:disabled { opacity: .4; cursor: default; }
.gallery-zoom-controls span { min-width: 75px; color: #e3e8f2; font-size: 12px; text-align: center; }
[hidden] { display: none !important; }
@media (max-width: 600px) {
  .topbar { min-height: auto; padding: 14px 16px 10px; flex-direction: column; align-items: stretch; gap: 12px; }
  .brand { font-size: 15px; }
  .navigation { width: 100%; gap: 4px; }
  .nav-link { flex: 1 0 auto; padding: 9px 8px; font-size: 12px; text-align: center; }
  .main-content { width: calc(100% - 32px); }
  .page-heading { padding: 34px 0 21px; align-items: start; flex-direction: column; }
  .page-description { max-width: 31em; font-size: 14px; }
  .page-heading .button { width: 100%; }
  .panel-heading { min-height: 76px; padding: 17px 16px; }
  .filter-toolbar { padding: 14px 16px; gap: 9px; }
  .filter-field { min-width: 0; flex: 1 1 calc(50% - 9px); }
  .filter-field.filter-search { min-width: 0; flex: 1 1 100%; }
  .tag-filter-field, .tag-mode-field, .sort-field { flex: 1 1 calc(50% - 9px); }
  .filter-actions { width: 100%; }
  .filter-actions .small-button { flex: 1; }
  .video-list { padding: 0 16px; }
  .category-list { padding: 0 16px; }
  .tag-management-list { padding: 0 16px; }
  .tag-management-row { align-items: stretch; flex-direction: column; gap: 10px; }
  .tag-management-row .card-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tag-management-row .small-button { min-height: 40px; }
  .tag-management-panel .panel-heading { align-items: stretch; flex-direction: column; }
  .tag-management-panel .panel-heading .button { width: 100%; }
  .category-row { align-items: stretch; flex-direction: column; gap: 10px; }
  .category-row .card-actions { justify-content: end; }
  .video-card { grid-template-columns: 80px minmax(0, 1fr); gap: 10px 12px; }
  .video-cover-button, .video-cover-placeholder { width: 80px; height: 45px; grid-column: 1; grid-row: 1; }
  .video-main { grid-column: 2; grid-row: 1; }
  .video-card .card-actions { grid-column: 1 / -1; }
  .video-card .card-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-card .small-button { min-height: 40px; }
  .card-actions { justify-content: end; }
  .dialog-form { padding: 20px 17px; }
  .image-item { grid-template-columns: 78px minmax(0, 1fr); }
  .image-item img { width: 78px; height: 68px; grid-row: span 2; }
  .image-item .image-cover-choice, .image-item > .small-button { grid-column: 2; }
  .image-item > .small-button { min-height: 40px; }
  .form-grid, .detail-content { grid-template-columns: 1fr; }
  .detail-cover-wrap { grid-column: auto; }
.detail-cover-button, .detail-cover-placeholder { width: 100%; height: auto; }
  .gallery-toolbar { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
  .gallery-count { grid-column: 1; grid-row: 2; }
  .gallery-close { grid-column: 2; grid-row: 1 / span 2; }
  .gallery-stage { grid-template-columns: 38px minmax(0, 1fr) 38px; gap: 4px; }
  .gallery-nav-button { width: 36px; height: 48px; font-size: 30px; }
  .gallery-bottom { align-items: stretch; flex-direction: column; }
  .gallery-hint { order: 2; }
  .gallery-zoom-controls { justify-content: center; }
  .gallery-zoom-controls button { min-height: 42px; }
  .duplicate-record dl { grid-template-columns: 1fr; }
  .field-wide, .detail-item.detail-wide { grid-column: auto; }
  .dialog-actions .button { flex: 1; }
  .footer { padding: 22px 16px; }
}
@media (prefers-reduced-motion: no-preference) { .button, .small-button { transition: background-color .16s ease, color .16s ease; } }

/* 可切換的整站配色 */
html[data-theme] {
  color: var(--theme-text);
  background: var(--theme-bg);
}
html[data-theme="black-gold"] {
  color-scheme: dark;
  --theme-bg: #151515;
  --theme-surface: #242424;
  --theme-raised: #2D2D2D;
  --theme-field: #191919;
  --theme-text: #F5F5F5;
  --theme-muted: #B8B8B8;
  --theme-line: #444444;
  --theme-accent: #F59E0B;
  --theme-accent-hover: #FDBA36;
  --theme-accent-text: #151515;
  --theme-active: #3A2A10;
  --theme-chip: #3A3A3A;
  --theme-error-bg: #3A2225;
  --theme-error: #FFD1D4;
  --theme-warning-bg: #352A18;
  --theme-warning-line: #80602A;
  --theme-warning-text: #F5E5C7;
  --theme-success-bg: #1E3A2A;
  --theme-success: #C6F0D8;
  --theme-retired-bg: #47252A;
  --theme-retired: #FFD1D4;
  --theme-focus: rgb(245 158 11 / 26%);
}
html[data-theme="graphite-teal"] {
  color-scheme: dark;
  --theme-bg: #202A33;
  --theme-surface: #2D3944;
  --theme-raised: #364652;
  --theme-field: #182129;
  --theme-text: #E5EDF2;
  --theme-muted: #AAB8C3;
  --theme-line: #45535E;
  --theme-accent: #2DD4BF;
  --theme-accent-hover: #5EEAD4;
  --theme-accent-text: #142527;
  --theme-active: #173B3B;
  --theme-chip: #3A4A55;
  --theme-error-bg: #432B31;
  --theme-error: #FFD6DD;
  --theme-warning-bg: #40361F;
  --theme-warning-line: #806E3D;
  --theme-warning-text: #F4E6BE;
  --theme-success-bg: #1D3C38;
  --theme-success: #C1F3E8;
  --theme-retired-bg: #4A2B36;
  --theme-retired: #FFD6E2;
  --theme-focus: rgb(45 212 191 / 27%);
}
html[data-theme="cyber-purple"] {
  color-scheme: dark;
  --theme-bg: #130F1F;
  --theme-surface: #211A33;
  --theme-raised: #2B2241;
  --theme-field: #171126;
  --theme-text: #F5F3FF;
  --theme-muted: #BFB5D7;
  --theme-line: #44385E;
  --theme-accent: #A78BFA;
  --theme-accent-hover: #C4B5FD;
  --theme-accent-text: #1B1230;
  --theme-active: #38204A;
  --theme-chip: #382E4F;
  --theme-error-bg: #42233A;
  --theme-error: #FFD4EE;
  --theme-warning-bg: #382C3C;
  --theme-warning-line: #78516D;
  --theme-warning-text: #F6D9EE;
  --theme-success-bg: #233A38;
  --theme-success: #CCF4E8;
  --theme-retired-bg: #4A2943;
  --theme-retired: #FFD4EE;
  --theme-focus: rgb(244 114 182 / 30%);
  --theme-extra: #F472B6;
}
html[data-theme="cream-forest"] {
  color-scheme: light;
  --theme-bg: #F5F2E9;
  --theme-surface: #FFFFFF;
  --theme-raised: #F1EEE4;
  --theme-field: #FFFFFF;
  --theme-text: #26352A;
  --theme-muted: #5F6F61;
  --theme-line: #D6D2C6;
  --theme-accent: #386641;
  --theme-accent-hover: #2F5738;
  --theme-accent-text: #FFFFFF;
  --theme-active: #E9F0E5;
  --theme-chip: #E9EDE3;
  --theme-error-bg: #FFF1F0;
  --theme-error: #8E2C34;
  --theme-warning-bg: #FBF4E5;
  --theme-warning-line: #D9C79F;
  --theme-warning-text: #51462F;
  --theme-success-bg: #E6F3EB;
  --theme-success: #315B47;
  --theme-retired-bg: #F8E9EC;
  --theme-retired: #6C3D46;
  --theme-focus: rgb(56 102 65 / 22%);
}
html[data-theme="mist-blue"] {
  color-scheme: light;
  --theme-bg: #F3F5F8;
  --theme-surface: #FFFFFF;
  --theme-raised: #F7F8FB;
  --theme-field: #FFFFFF;
  --theme-text: #1D2635;
  --theme-muted: #4F5B6F;
  --theme-line: #D5DBE5;
  --theme-accent: #4D5DC7;
  --theme-accent-hover: #4857C9;
  --theme-accent-text: #FFFFFF;
  --theme-active: #F0F1FF;
  --theme-chip: #E9EDF4;
  --theme-error-bg: #FFF5F6;
  --theme-error: #A83240;
  --theme-warning-bg: #FFFAF0;
  --theme-warning-line: #D9C59B;
  --theme-warning-text: #51462F;
  --theme-success-bg: #E6F3EB;
  --theme-success: #315B47;
  --theme-retired-bg: #F8E9EC;
  --theme-retired: #6C3D46;
  --theme-focus: rgb(77 93 199 / 20%);
}
html[data-theme] body { color: var(--theme-text); background: var(--theme-bg); }
html[data-theme] .topbar,
html[data-theme] .library-panel,
html[data-theme] .dialog { color: var(--theme-text); background: var(--theme-surface); border-color: var(--theme-line); }
html[data-theme] .topbar { border-bottom-color: var(--theme-line); }
html[data-theme] .panel-heading,
html[data-theme] .filter-toolbar,
html[data-theme] .video-card,
html[data-theme] .tag-management-row,
html[data-theme] .category-row,
html[data-theme] .import-preview-section { border-color: var(--theme-line); }
html[data-theme] h1,
html[data-theme] h2,
html[data-theme] h3,
html[data-theme] h4,
html[data-theme] .video-title,
html[data-theme] .panel-heading h2,
html[data-theme] .tag-management-info strong,
html[data-theme] .category-info strong,
html[data-theme] .duplicate-record-heading strong { color: var(--theme-text); }
html[data-theme] .eyebrow,
html[data-theme] .page-description,
html[data-theme] .panel-heading p,
html[data-theme] .video-meta,
html[data-theme] .tag-management-info span,
html[data-theme] .tag-management-empty,
html[data-theme] .category-meta,
html[data-theme] .session-notice,
html[data-theme] .footer,
html[data-theme] .image-count,
html[data-theme] .image-empty-state,
html[data-theme] .cover-position-description,
html[data-theme] .field small,
html[data-theme] .detail-label,
html[data-theme] .duplicate-intro,
html[data-theme] .duplicate-record dt,
html[data-theme] .gallery-hint,
html[data-theme] .gallery-heading .eyebrow { color: var(--theme-muted); }
html[data-theme] .brand-mark { color: var(--theme-accent); background: var(--theme-active); }
html[data-theme] .nav-link { color: var(--theme-muted); }
html[data-theme] .nav-link.is-current { color: var(--theme-accent); background: var(--theme-active); }
html[data-theme] .nav-link.is-disabled { color: var(--theme-muted); }
html[data-theme] .button-primary { color: var(--theme-accent-text); background: var(--theme-accent); box-shadow: 0 4px 12px var(--theme-focus); }
html[data-theme] .button-primary:hover { background: var(--theme-accent-hover); }
html[data-theme] .button-secondary,
html[data-theme] .small-button { color: var(--theme-text); background: var(--theme-raised); border-color: var(--theme-line); }
html[data-theme] .button-secondary:hover,
html[data-theme] .small-button:hover { background: var(--theme-active); }
html[data-theme] .button-danger { color: #FFFFFF; background: #A23442; border-color: #C04B57; }
html[data-theme] .small-button.danger { color: var(--theme-error); background: var(--theme-raised); border-color: var(--theme-line); }
html[data-theme] .item-count { color: var(--theme-text); background: var(--theme-raised); }
html[data-theme] .filter-field,
html[data-theme] .field,
html[data-theme] .backup-content,
html[data-theme] .import-file-field,
html[data-theme] .no-cover-option,
html[data-theme] .image-cover-choice,
html[data-theme] .tag-option,
html[data-theme] .duplicate-record,
html[data-theme] .detail-value { color: var(--theme-text); }
html[data-theme] .filter-field input,
html[data-theme] .filter-field select,
html[data-theme] .tag-filter-field summary,
html[data-theme] .tag-filter-options,
html[data-theme] .field input,
html[data-theme] .field select,
html[data-theme] .field textarea,
html[data-theme] .import-file-field input { color: var(--theme-text); background: var(--theme-field); border-color: var(--theme-line); color-scheme: inherit; }
html[data-theme] .filter-field input::placeholder,
html[data-theme] .field input::placeholder,
html[data-theme] .field textarea::placeholder { color: var(--theme-muted); }
html[data-theme] .filter-field input:focus,
html[data-theme] .filter-field select:focus,
html[data-theme] .field input:focus,
html[data-theme] .field select:focus,
html[data-theme] .field textarea:focus,
html[data-theme] .tag-filter-field details[open] summary { border-color: var(--theme-accent); outline-color: var(--theme-focus); }
html[data-theme] .tag-filter-options:empty::after { color: var(--theme-muted); }
html[data-theme] .tag-option input,
html[data-theme] .no-cover-option input,
html[data-theme] .image-cover-choice input,
html[data-theme] .retired-field input,
html[data-theme] .cover-range-field input[type="range"] { accent-color: var(--theme-accent); }
html[data-theme] .tag-chip { color: var(--theme-text); background: var(--theme-chip); }
html[data-theme] .tag-video-item { color: var(--theme-text); background: var(--theme-raised); border-color: var(--theme-line); }
html[data-theme] .tag-video-item:hover,
html[data-theme] .tag-video-item:focus-visible { background: var(--theme-active); border-color: var(--theme-accent); outline-color: var(--theme-focus); }
html[data-theme] .tag-video-item span,
html[data-theme] .image-item-info span,
html[data-theme] .session-notice.is-persistent { color: var(--theme-muted); }
html[data-theme] .image-item,
html[data-theme] .duplicate-record,
html[data-theme] .detail-item,
html[data-theme] .cover-position-controls { color: var(--theme-text); background: var(--theme-raised); border-color: var(--theme-line); }
html[data-theme] .image-item-info strong,
html[data-theme] .duplicate-record dd { color: var(--theme-text); }
html[data-theme] .image-item img,
html[data-theme] .cover-position-preview,
html[data-theme] .video-cover-button,
html[data-theme] .video-cover-placeholder,
html[data-theme] .detail-cover-button,
html[data-theme] .detail-cover-placeholder { background-color: var(--theme-field); border-color: var(--theme-line); }
html[data-theme] .video-cover-button:hover,
html[data-theme] .video-cover-placeholder:hover,
html[data-theme] .detail-cover-button:hover,
html[data-theme] .detail-cover-placeholder:hover { border-color: var(--theme-accent); outline-color: var(--theme-focus); }
html[data-theme] .cover-position-controls h3,
html[data-theme] .import-preview-section h3,
html[data-theme] .import-validation h4,
html[data-theme] .detail-label { color: var(--theme-text); }
html[data-theme] .category-code,
html[data-theme] .video-number,
html[data-theme] .duplicate-record-heading span { color: var(--theme-accent); }
html[data-theme] .empty-icon { color: var(--theme-accent); background: var(--theme-active); }
html[data-theme] .actor-suggestions:not([hidden]) { background: var(--theme-raised); border-color: var(--theme-line); }
html[data-theme] .actor-suggestion { color: var(--theme-text); background: var(--theme-field); border-color: var(--theme-line); }
html[data-theme] .actor-suggestion:hover,
html[data-theme] .actor-suggestion:focus-visible { background: var(--theme-active); border-color: var(--theme-accent); outline-color: var(--theme-focus); }
html[data-theme] .tag-management-info .actor-status { color: var(--theme-success); background: var(--theme-success-bg); }
html[data-theme] .tag-management-info .actor-status.is-retired { color: var(--theme-retired); background: var(--theme-retired-bg); }
html[data-theme] .backup-status,
html[data-theme] .actor-note-preview,
html[data-theme] .import-confirm-message { color: var(--theme-text); }
html[data-theme] .import-summary { color: var(--theme-text); background: var(--theme-raised); }
html[data-theme] .import-validation { color: var(--theme-text); background: var(--theme-surface); border-color: var(--theme-line); }
html[data-theme] .import-validation.is-invalid,
html[data-theme] .form-error,
html[data-theme] .storage-error { color: var(--theme-error); background: var(--theme-error-bg); border-color: #A34B55; }
html[data-theme] .import-error-list { color: var(--theme-error); }
html[data-theme] .import-error-location { color: var(--theme-error); }
html[data-theme] .undo-import-panel { background: var(--theme-warning-bg); border-color: var(--theme-warning-line); }
html[data-theme] .undo-import-panel p { color: var(--theme-warning-text); }
html[data-theme] .backup-content code { color: var(--theme-text); background: var(--theme-raised); }
html[data-theme] .dialog::backdrop { background: rgb(0 0 0 / 68%); }
html[data-theme] .field b { color: var(--theme-accent); }
html[data-theme] .icon-button { color: var(--theme-text); background: var(--theme-raised); }
html[data-theme] .gallery-dialog { color: var(--theme-text); background: var(--theme-bg); }
html[data-theme] .gallery-dialog::backdrop { background: var(--theme-bg); }
html[data-theme] .gallery-heading h2,
html[data-theme] .gallery-count,
html[data-theme] .gallery-zoom-controls span { color: var(--theme-text); }
html[data-theme] .gallery-close,
html[data-theme] .gallery-nav-button,
html[data-theme] .gallery-zoom-controls button { color: var(--theme-text); background: var(--theme-raised); border-color: var(--theme-line); }
html[data-theme] .gallery-close:hover,
html[data-theme] .gallery-nav-button:hover,
html[data-theme] .gallery-zoom-controls button:hover { border-color: var(--theme-accent); }
html[data-theme] .category-code,
html[data-theme] .video-number,
html[data-theme] .duplicate-record-heading span { color: var(--theme-extra, var(--theme-accent)); }
html[data-theme="cyber-purple"] .nav-link.is-current { box-shadow: inset 0 -2px #F472B6; }
html[data-theme="cyber-purple"] .tag-chip { border: 1px solid #F472B6; }
.theme-switcher { display: inline-flex; align-items: center; gap: 8px; color: #536074; font-size: 12px; font-weight: 700; white-space: nowrap; }
.theme-switcher select { min-height: 38px; max-width: 180px; padding: 7px 30px 7px 10px; border: 1px solid #aeb8c8; border-radius: 9px; color: #202b3d; background: #fff; font-size: 13px; }
.theme-switcher select:focus { outline: 3px solid rgb(77 93 199 / 20%); }
html[data-theme] .theme-switcher { color: var(--theme-muted); }
html[data-theme] .theme-switcher select { color: var(--theme-text); background: var(--theme-field); border-color: var(--theme-line); color-scheme: inherit; }
html[data-theme] .theme-switcher select:focus { border-color: var(--theme-accent); outline-color: var(--theme-focus); }
@media (max-width: 600px) {
  .theme-switcher { align-self: flex-start; }
  .theme-switcher select { min-height: 40px; }
}
