:root {
  color-scheme: light;
  --page: #f5f6f7;
  --surface: #fff;
  --ink: #202624;
  --muted: #606963;
  --line: #dfe4e1;
  --accent: #176a4b;
  --selected: #eaf3ed;
  --error: #a82c36;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
  accent-color: var(--accent);
  caret-color: var(--accent);
}
* { box-sizing: border-box; letter-spacing: 0; scrollbar-color: #b5c1b9 #f5f6f7; scrollbar-width: thin; }
body { margin: 0; }
button, input, select { font: inherit; }
button, .file-button { cursor: pointer; }
button, select, input:not([type="checkbox"]), .file-button { min-height: 36px; border: 1px solid #cbd3ce; border-radius: 4px; background: var(--surface); color: var(--ink); padding: 7px 12px; }
button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 500; }
button:hover, .file-button:hover { background: #edf0ee; }
button:disabled { opacity: .45; cursor: default; }
button img, .source-bar > img, .local-note img { width: 17px; height: 17px; flex: 0 0 auto; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover:enabled { background: #115238; }
button.primary img { filter: invert(1); }
.icon-button { width: 36px; height: 36px; padding: 8px; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: #cfe7d9; color: #153d2a; }
.hidden { display: none !important; }
.shell { min-height: 100dvh; display: flex; flex-direction: column; background: var(--surface); }
.shell.dragging::after { content: "导入 OPT 文件夹"; position: fixed; inset: 12px; z-index: 20; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 6px; color: var(--accent); background: #eaf3edf2; font-size: 24px; pointer-events: none; }
.topbar { min-height: 76px; padding: 16px 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
h1 { display: flex; align-items: baseline; gap: 16px; margin: 0; font-size: 26px; font-weight: 750; }
h1 span { font-size: 13px; font-weight: 400; color: var(--muted); }
.toolbar { display: flex; gap: 8px; align-items: center; }
.settings { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; padding: 18px 28px; background: var(--page); border-bottom: 1px solid var(--line); }
.settings label { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.settings select, .settings input { font-size: 13px; }
#startNumber { width: 90px; }
.settings label.check { display: flex; align-items: center; height: 36px; color: var(--ink); font-size: 14px; }
.check input { width: 16px; height: 16px; margin: 0 3px 0 0; }
.settings .file-button { display: block; color: var(--ink); font-size: 13px; }
.file-button input { display: none; }
.settings p { width: 100%; margin: 0; font-size: 12px; color: var(--muted); }
.source-bar { min-height: 53px; display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line); font-size: 12px; }
.source-bar strong { font-size: 13px; font-weight: 550; overflow-wrap: anywhere; }
.source-bar > span { color: var(--muted); flex-shrink: 0; }
.source-bar .year { margin-left: auto; }
.empty-state { min-height: 430px; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 64px 24px; background: var(--page); }
.empty-state > img { width: 54px; height: 54px; opacity: .45; }
.empty-state h2 { font-size: 20px; font-weight: 550; margin: 0; }
.analysis { display: grid; grid-template-columns: 260px minmax(0, 1fr); flex: 1; }
.date-rail { border-right: 1px solid var(--line); background: var(--page); padding: 24px 14px; }
.rail-title { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 14px; }
.rail-title h2 { font-size: 13px; font-weight: 600; margin: 0; }
.rail-title span { font-size: 12px; color: var(--muted); }
#batchCards { display: flex; flex-direction: column; gap: 6px; }
.batch-card { text-align: left; justify-content: start; align-items: stretch; flex-direction: column; gap: 5px; width: 100%; padding: 13px 12px; border: 1px solid transparent; background: transparent; }
.batch-card:hover { background: #edf0ee; }
.batch-card[aria-current="date"] { background: var(--selected); border-color: #bdcfc2; }
.batch-card time { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.batch-card span { font-size: 12px; color: var(--muted); font-weight: 400; }
.batch-card b { font: 11px/1.5 ui-monospace, Consolas, monospace; color: var(--muted); overflow-wrap: anywhere; }
.results { padding: 28px 36px 56px; min-width: 0; max-width: 1400px; width: 100%; }
.release-header { padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.release-header h2 { margin: 0 0 6px; font-size: 26px; line-height: 1.3; font-variant-numeric: tabular-nums; font-weight: 650; }
.release-header p { margin: 0 0 8px; color: var(--muted); }
.release-header code { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.historical-notice { margin: 18px 0 0; padding: 10px 12px; background: #fff8e5; color: #634b15; border: 1px solid #ead9a6; border-radius: 4px; font-size: 12px; }
.group-title { display: flex; align-items: baseline; gap: 10px; margin: 30px 0 12px; }
.group-title h3 { font-size: 16px; margin: 0; font-weight: 650; }
.group-title span { font-size: 12px; color: var(--muted); }
.undated-image-note { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.announcement-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 20px; }
.announcement { min-width: 0; }
.announcement h4 { font-size: 14px; font-weight: 550; line-height: 1.55; margin: 10px 0 4px; overflow-wrap: anywhere; }
.announcement p, .announcement small { display: block; font-size: 12px; margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.preview { position: relative; padding: 0; width: 100%; height: 210px; overflow: hidden; background: #eff1f2; border: 1px solid var(--line); border-radius: 6px; }
.preview > img { width: 100%; height: 100%; object-fit: contain; }
.preview:hover { background: #e7ebed; border-color: #9caea2; }
.preview:disabled { opacity: 1; }
.preview .preview-error { display: none; }
.preview.failed img { display: none; }
.preview.failed .preview-error { display: block; color: var(--error); padding: 20px; font-size: 13px; }
.missing-preview { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 13px; font-weight: 400; }
.missing-preview img { width: 22px; height: 22px; opacity: .5; }
.resource-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 14px; border-bottom: 1px solid #edf0ee; padding: 14px 0; }
.type-chip { color: var(--muted); font-size: 12px; padding-top: 2px; }
.resource-row h3 { font-size: 14px; font-weight: 550; margin: 0; overflow-wrap: anywhere; }
.resource-row p { color: var(--muted); font-size: 12px; margin: 4px 0; overflow-wrap: anywhere; }
.resource-row small { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.shared-section { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 18px; }
.shared-section summary { cursor: pointer; font-size: 13px; font-weight: 550; }
.shared-section summary span { color: var(--muted); margin-left: 8px; }
.compact-list { padding-top: 12px; }
.compact-item { font-size: 12px; color: var(--muted); padding: 6px 0; overflow-wrap: anywhere; }
.status-line { min-height: 38px; border-top: 1px solid var(--line); background: var(--page); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; padding: 9px 28px; font-size: 12px; color: var(--muted); }
.local-note { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); padding: 12px 18px; background: #202624; color: #fff; border-radius: 6px; z-index: 50; max-width: calc(100% - 32px); overflow-wrap: anywhere; box-shadow: 0 8px 24px #0002; }
dialog { width: calc(100vw - 48px); max-width: 1500px; height: calc(100dvh - 48px); max-height: none; padding: 0; border: 1px solid #bbc5be; border-radius: 6px; background: var(--surface); box-shadow: 0 16px 60px #0004; }
dialog::backdrop { background: #171d22bd; }
dialog[open] { display: flex; flex-direction: column; }
.viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.viewer-toolbar > div:first-child { min-width: 0; }
.viewer-toolbar strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.viewer-toolbar span { font-size: 12px; color: var(--muted); }
.viewer-actions { display: flex; gap: 6px; flex-shrink: 0; }
.viewer-canvas { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 16px; background: #e8ecef; }
.viewer-canvas > img { width: 100%; height: 100%; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-canvas.original { display: block; }
.viewer-canvas.original > img { width: auto; height: auto; max-width: none; max-height: none; display: block; margin: auto; }
.viewer-canvas p { color: var(--error); }
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: open-viewer .16s cubic-bezier(.16, 1, .3, 1); }
  @keyframes open-viewer { from { transform: translateY(8px); clip-path: inset(1% 0 0); } to { transform: translateY(0); clip-path: inset(0); } }
}
@media (max-width: 900px) {
  .topbar { padding: 14px 18px; gap: 12px; }
  h1 span { display: none; }
  .analysis { grid-template-columns: 220px minmax(0, 1fr); }
  .results { padding: 24px; }
  .source-bar, .status-line { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 620px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  h1 { font-size: 24px; }
  .toolbar { width: 100%; gap: 6px; }
  .toolbar > button:first-child { margin-right: auto; }
  .toolbar button { font-size: 12px; padding-left: 9px; padding-right: 9px; }
  .settings { padding: 16px; gap: 12px; }
  .settings label { max-width: 100%; }
  .source-bar { flex-wrap: wrap; gap: 4px 8px; padding: 10px 16px; }
  .source-bar strong { flex: 1; min-width: 0; }
  .source-bar .year { margin-left: 0; }
  .analysis { display: block; }
  .date-rail { padding: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-title { padding: 0 0 10px; }
  #batchCards { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .batch-card { width: 190px; flex: 0 0 190px; }
  .batch-card b { display: none; }
  .results { padding: 24px 16px 40px; }
  .release-header h2 { font-size: 24px; }
  .announcement-grid { gap: 20px; }
  .preview { height: 240px; }
  .status-line { padding: 10px 16px; gap: 8px 14px; }
  .local-note { margin-left: 0; }
  .resource-row { grid-template-columns: 58px minmax(0, 1fr); gap: 8px; }
  dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .viewer-toolbar { flex-wrap: wrap; padding: 10px; gap: 8px; }
  .viewer-actions { margin-left: auto; }
}
