:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #edebe7;
  background: #0e0e0d;
  font-synthesis: none;
  --accent: #f05a1a;
  --stage-text: #edebe7;
  --stage-muted: #a3a09a;
  --stage-raised: #1f1e1c;
  --stage-hover: #2c2a27;
  --stage-line: #2a2926;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; min-height: 100vh; -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .3; }
h1, h2, p { margin-top: 0; }
svg { display: block; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.viewer-shell { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.viewer-header { display: flex; min-height: 48px; flex: none; align-items: center; gap: 12px; padding: 8px 16px; background: #0e0e0d; }
.viewer-brand { display: inline-flex; flex: none; }
.viewer-brand-symbol { width: 25px; height: 25px; }
.viewer-header-divider { width: 1px; height: 16px; flex: none; background: var(--stage-line); }
.viewer-header h1 { min-width: 0; margin: 0; overflow: hidden; font-size: .875rem; font-weight: 500; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }

.viewer-state { width: min(320px, calc(100% - 40px)); margin: auto; padding: 36px 0; }
.viewer-state h2 { margin-bottom: 20px; font-size: .9375rem; font-weight: 550; line-height: 1.5; }
.viewer-state progress { display: block; width: 100%; height: 4px; overflow: hidden; accent-color: var(--accent); background: var(--stage-raised); border: 0; border-radius: 999px; }
.viewer-state progress::-webkit-progress-bar { background: var(--stage-raised); border-radius: 999px; }
.viewer-state progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width .2s ease-out; }
.viewer-state progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.viewer-state-detail { margin: 13px 0 0; color: var(--stage-muted); font-size: .75rem; line-height: 1.65; overflow-wrap: anywhere; }
.loading-steps { display: grid; gap: 12px; margin: 0 0 22px; padding: 0; list-style: none; }
.loading-step { display: flex; align-items: center; gap: 11px; color: #6f6c67; font-size: .8125rem; transition: color .15s; }
.loading-step-marker { display: grid; width: 20px; height: 20px; flex: none; place-items: center; border: 1px solid var(--stage-line); border-radius: 50%; }
.loading-step-marker .icon { display: none; width: 12px; height: 12px; stroke-width: 2.3; }
.loading-step.is-active { color: var(--stage-text); }
.loading-step.is-active .loading-step-marker { border-color: var(--accent); }
.loading-step.is-active .loading-step-marker::after { width: 6px; height: 6px; content: ""; background: var(--accent); border-radius: 50%; animation: viewer-pulse 1.2s ease-in-out infinite; }
.loading-step.is-complete { color: var(--stage-text); }
.loading-step.is-complete .loading-step-marker { background: var(--accent); border-color: var(--accent); }
.loading-step.is-complete .loading-step-marker::after { display: none; }
.loading-step.is-complete .loading-step-marker .icon { display: block; color: #fff; }
#error-view { width: min(384px, calc(100% - 40px)); text-align: center; }
#error-view h2 { margin: 16px 0 7px; font-size: 1rem; }
#error-view .viewer-state-detail { margin-top: 0; font-size: .8125rem; }
.viewer-error-icon { display: grid; width: 46px; height: 46px; margin: 0 auto; place-items: center; color: #f7b955; background: var(--stage-raised); border-radius: 12px; }
.viewer-error-icon .icon { width: 23px; height: 23px; }
#error-view .button { min-height: 40px; margin-top: 22px; padding: 8px 15px; gap: 7px; color: var(--stage-text); background: var(--stage-raised); border: 0; border-radius: 9px; font-size: .8125rem; font-weight: 500; }
#error-view .button:hover { background: var(--stage-hover); }

.player { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; background: #0e0e0d; }
.slide-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: pan-y pinch-zoom; -webkit-user-select: none; user-select: none; }
/* 页面被双指放大后，横向拖动交给浏览器移动画面，不再当作翻页 */
.slide-stage.is-zoomed { touch-action: auto; }
.slide-stage:focus-visible { outline: 1px solid #6f6c67; outline-offset: -1px; }
.slide-container { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; line-height: 0; }
.slide-container canvas { display: block; flex: none; background: #fff; border-radius: 3px; box-shadow: 0 8px 40px rgb(0 0 0 / 50%); }
.slide-loading { position: absolute; right: 12px; bottom: 12px; padding: 6px 10px; color: var(--stage-text); background: rgb(31 30 28 / 92%); border: 1px solid var(--stage-line); border-radius: 7px; font-size: .75rem; line-height: 1.5; }
.viewer-controls { position: relative; flex: none; background: #151514; }
.viewer-progress-track { position: absolute; top: 0; right: 0; left: 0; height: 2px; background: var(--stage-line); }
#slide-progress { width: 0; height: 100%; background: var(--accent); transition: width .2s ease-out; }
.viewer-controls-inner { display: grid; height: 56px; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 12px; }
.viewer-hint { grid-column: 1; overflow: hidden; color: var(--stage-muted); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.viewer-navigation { display: flex; grid-column: 2; align-items: center; gap: 3px; }
.button { display: inline-flex; align-items: center; justify-content: center; transition: color .15s, background-color .15s, border-color .15s; }
.button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.button-viewer { color: var(--stage-text); background: transparent; border: 0; }
.button-viewer:hover:not(:disabled) { color: #fff; background: var(--stage-hover); }
.viewer-control-button { width: 40px; height: 40px; padding: 0; border-radius: 9px; }
.viewer-control-button .icon { width: 20px; height: 20px; }
#fullscreen-button { grid-column: 3; grid-row: 1; justify-self: end; }
.page-indicator { min-width: 64px; color: var(--stage-text); font-size: .8125rem; font-variant-numeric: tabular-nums; text-align: center; }
.player:fullscreen { width: 100vw; max-width: none; height: 100dvh; margin: 0; display: flex; flex-direction: column; background: #0e0e0d; }
.player:fullscreen .slide-stage { flex: 1; min-height: 0; overflow: hidden; }
.player:fullscreen .slide-container { align-self: center; }
/* 真全屏：只留幻灯片，控制栏/提示/渲染中标记全部隐藏（键盘、滑动、点击左右半屏仍可翻页，Esc 退出） */
.player:fullscreen .viewer-controls,
.player:fullscreen .slide-loading { display: none; }
.player:fullscreen .slide-stage { cursor: default; }
.player:fullscreen .slide-stage:focus-visible { outline: 0; }
.player:fullscreen .slide-container canvas { border-radius: 0; box-shadow: none; }
.noscript-message { margin: 30px; text-align: center; }
@keyframes viewer-pulse { 50% { opacity: .35; } }

@media (max-width: 720px) {
  .viewer-hint { visibility: hidden; }
}

@media (max-height: 480px) {
  .viewer-header { display: none; }
  .viewer-controls-inner { height: 46px; padding-inline: 8px; }
  .viewer-control-button { width: 36px; height: 36px; }
}

@media (max-width: 480px) {
  .viewer-header { min-height: 44px; padding-inline: 12px; }
  .viewer-header h1 { font-size: .8125rem; }
  .viewer-controls-inner { height: 54px; padding-inline: 8px; }
  .page-indicator { min-width: 56px; font-size: .75rem; }
  .slide-container canvas { border-radius: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
