:root {
  color-scheme: dark;
  --wine: #6f1730;
  --rose: #e15d82;
  --paper: #fff8f5;
  --ink: #fff6f3;
  --viewport-width: 100vw;
  --viewport-height: 100vh;
  --slide-media-width: 100%;
  --slide-media-height: 100%;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #14070d; }
html { overscroll-behavior: none; }
body { position: fixed; inset: 0; font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; color: var(--ink); overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button, a { font: inherit; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.reader { position: fixed; inset: 0 auto auto 0; width: var(--viewport-width); height: var(--viewport-height); overflow: hidden; background: radial-gradient(circle at 50% 45%, #4e1726 0, #1b0911 65%, #0d0508 100%); }
.reader-chrome { position: fixed; z-index: 20; inset: 0 0 auto; min-height: 68px; padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 14px max(18px, env(safe-area-inset-left)); display: grid; grid-template-columns: minmax(150px, .7fr) minmax(260px, 1fr) minmax(190px, .7fr); align-items: center; gap: 18px; background: linear-gradient(180deg, rgba(20,7,13,.9), rgba(20,7,13,.42) 65%, transparent); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.reader-chrome > * { pointer-events: auto; }
.brand-link { color: rgba(255,246,243,.82); text-decoration: none; letter-spacing: .08em; font-size: 13px; }
.slide-status { min-width: 0; display: flex; justify-content: center; align-items: baseline; gap: 14px; text-align: center; }
.slide-status strong { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-size: 14px; letter-spacing: .12em; }
.slide-status span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: rgba(255,246,243,.7); font-size: 13px; }
.reader-actions { display: flex; justify-content: flex-end; gap: 8px; }
.quiet-button, .panel-close { border: 1px solid rgba(255,255,255,.24); color: #fff9f6; background: rgba(75,18,36,.54); backdrop-filter: blur(18px); border-radius: 999px; min-height: 38px; padding: 0 15px; cursor: pointer; }
.quiet-button:hover, .quiet-button:focus-visible { border-color: rgba(255,255,255,.58); background: rgba(112,23,48,.78); outline: none; }

.slide-track { position: absolute; inset: 0; width: 100%; height: 100%; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; -ms-overflow-style: none; touch-action: pan-x pinch-zoom; cursor: grab; }
.slide-track::-webkit-scrollbar { display: none; }
.slide-track:focus-visible { outline: 3px solid rgba(255, 220, 229, .9); outline-offset: -5px; }
.slide-track.is-dragging { cursor: grabbing; }
.slide-track.is-dragging,
.slide-track.is-gliding { scroll-snap-type: none; }
.slide { position: relative; flex: 0 0 var(--viewport-width); width: var(--viewport-width); height: var(--viewport-height); margin: 0; display: grid; place-items: center; overflow: hidden; scroll-snap-align: center; scroll-snap-stop: normal; }
.slide::before { content: ""; position: absolute; inset: 0; background: #fff3f0; opacity: .1; }
.slide img { position: relative; z-index: 1; display: block; flex: none; width: var(--slide-media-width); height: var(--slide-media-height); object-fit: fill; user-select: none; -webkit-user-drag: none; filter: drop-shadow(0 26px 70px rgba(0,0,0,.3)); }

.reader-footer { position: fixed; z-index: 20; inset: auto 0 0; padding: 0 max(18px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); background: linear-gradient(0deg, rgba(20,7,13,.86), rgba(20,7,13,.18) 68%, transparent); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.reader-footer p { margin: 8px 0 0; text-align: center; color: rgba(255,246,243,.66); font-size: 12px; letter-spacing: .04em; }
.progress-track { height: 3px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,.18); }
.progress-track span { display: block; width: 5.5556%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f4a4b8, #e83f78); transition: width 180ms ease-out; }

.sources-panel { position: fixed; z-index: 50; inset: 0 0 0 auto; width: min(560px, 100%); background: rgba(255,248,245,.98); color: #38111f; box-shadow: -24px 0 80px rgba(0,0,0,.38); overflow-y: auto; }
.sources-panel[hidden] { display: none; }
.panel-head { position: sticky; top: 0; z-index: 2; padding: 24px 26px 18px; display: flex; justify-content: space-between; align-items: flex-start; background: rgba(255,248,245,.94); backdrop-filter: blur(18px); border-bottom: 1px solid rgba(110,22,47,.13); }
.panel-head p { margin: 0 0 4px; font-size: 11px; letter-spacing: .18em; color: #9b4b63; }
.panel-head h1 { margin: 0; font-family: "Songti SC", SimSun, serif; font-size: 28px; }
.panel-close { width: 40px; min-height: 40px; padding: 0; color: #66142d; background: transparent; border-color: rgba(102,20,45,.25); font-size: 24px; }
.panel-body { padding: 24px 26px 48px; }
.scope-note { margin: 0 0 26px; padding: 16px 18px; border-left: 3px solid #be3f66; background: #f7e4e7; line-height: 1.7; }
.panel-body section { padding: 20px 0; border-top: 1px solid rgba(110,22,47,.12); }
.panel-body h2 { margin: 0 0 10px; font-size: 16px; }
.panel-body a { display: block; padding: 7px 0; color: #861d42; line-height: 1.5; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 60; left: 50%; bottom: 54px; translate: -50% 12px; opacity: 0; padding: 10px 15px; border-radius: 999px; background: rgba(20,7,13,.88); color: white; transition: .2s ease; pointer-events: none; }
.toast.show { opacity: 1; translate: -50% 0; }

html:fullscreen .reader-chrome,
html:fullscreen .reader-footer { display: grid; visibility: visible; }
html:fullscreen .reader-footer { display: block; }

/* WeChat does not expose the Fullscreen API on many iOS/Android versions.
   Immersive mode keeps a small exit control while giving the deck every CSS
   pixel the webview makes available. */
html.is-immersive .reader-chrome { min-height: 0; padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 0 0; grid-template-columns: 1fr; background: none; }
html.is-immersive .brand-link,
html.is-immersive .slide-status,
html.is-immersive #sources-button { display: none; }
html.is-immersive .reader-actions { justify-content: flex-end; }
html.is-immersive #fullscreen-button { min-height: 32px; padding: 0 11px; border-color: rgba(255,255,255,.18); background: rgba(20,7,13,.36); opacity: .72; }
html.is-immersive .reader-footer { opacity: 0; transform: translateY(100%); }

@media (max-width: 760px) {
  .reader-chrome { grid-template-columns: 1fr auto; min-height: 58px; padding-top: max(10px, env(safe-area-inset-top)); }
  .brand-link { display: none; }
  .slide-status { justify-content: flex-start; text-align: left; }
  .slide-status span { display: none; }
  .quiet-button { min-height: 34px; padding: 0 12px; font-size: 12px; }
  .reader-footer p { font-size: 10px; }
}

@media (orientation: landscape) and (hover: none), (orientation: landscape) and (pointer: coarse) {
  .reader-chrome { min-height: 48px; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: 8px; }
  .reader-footer { padding-bottom: max(5px, env(safe-area-inset-bottom)); }
  .reader-footer p { display: none; }
  .quiet-button { min-height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .progress-track span, .toast { transition: none; }
}
