/* ==========================================================================
   拾页 · 本地书架 — 空间光影剧场视觉系统（日间磨砂空间 + 夜间石炭影院）
   ========================================================================== */

:root {
  --bg: #EDF1F5;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #FFFFFF;
  --surface-subtle: rgba(18, 25, 33, 0.055);
  --surface-hover: rgba(18, 25, 33, 0.095);
  --ink: #12171D;
  --ink-2: #36414D;
  --muted: #56626E;
  --line: rgba(18, 23, 29, 0.10);
  --line-strong: rgba(18, 23, 29, 0.19);
  --accent: #0E7466;
  --accent-hover: #0A5B50;
  --accent-soft: rgba(14, 116, 102, 0.11);
  --amber: #A45312;
  --amber-soft: rgba(164, 83, 18, 0.11);
  --scrim: linear-gradient(90deg, rgba(246, 248, 251, 0.90) 0%, rgba(246, 248, 251, 0.72) 56%, rgba(246, 248, 251, 0.84) 100%);
  --ambient-bright: 1.05;
  --ambient-opacity: 0.36;
  --shadow-card: 0 8px 24px -14px rgba(18, 23, 29, 0.16), 0 1px 3px rgba(18, 23, 29, 0.05);
  --shadow-hover: 0 18px 38px -14px rgba(18, 23, 29, 0.24), 0 4px 10px rgba(18, 23, 29, 0.08);
  --font-sans: "DM Sans", "MiSans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Fraunces", "ChironSungHK", "Songti SC", Georgia, serif;
  color-scheme: light;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

html[data-theme="dark"] {
  --bg: #0B0D10;
  --surface: rgba(24, 28, 33, 0.76);
  --surface-solid: #16191E;
  --surface-subtle: rgba(255, 255, 255, 0.07);
  --surface-hover: rgba(255, 255, 255, 0.12);
  --ink: #F4F5F7;
  --ink-2: #D0D5DC;
  --muted: #939DA8;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.19);
  --accent: #42C5B0;
  --accent-hover: #64D6C4;
  --accent-soft: rgba(66, 197, 176, 0.16);
  --amber: #F0A95E;
  --amber-soft: rgba(240, 169, 94, 0.16);
  --scrim: linear-gradient(90deg, rgba(11, 13, 16, 0.80) 0%, rgba(11, 13, 16, 0.56) 56%, rgba(11, 13, 16, 0.74) 100%);
  --ambient-bright: 0.72;
  --ambient-opacity: 0.72;
  --shadow-card: 0 10px 26px -14px rgba(0, 0, 0, 0.55);
  --shadow-hover: 0 20px 42px -14px rgba(0, 0, 0, 0.72);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s cubic-bezier(0.22, 1, 0.36, 1), color 0.18s ease, border-color 0.18s ease, box-shadow 0.22s ease, transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

button {
  cursor: pointer;
  color: inherit;
  border: 0;
  background: none;
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button[hidden],
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -64px;
  left: 16px;
  z-index: 100;
  background: var(--accent);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

html[data-theme="dark"] .skip-link {
  color: #0B0D10;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- View Transitions 主题径向扩散动效 ---------- */
html.is-theme-vt::view-transition-image-pair(root) {
  isolation: isolate;
}

html.is-theme-vt::view-transition-old(root),
html.is-theme-vt::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

html.is-theme-vt-expand::view-transition-old(root) {
  z-index: 1;
}

html.is-theme-vt-expand::view-transition-new(root) {
  z-index: 9999;
  animation: theme-ripple-expand 460ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

html.is-theme-vt-shrink::view-transition-old(root) {
  z-index: 9999;
  animation: theme-ripple-shrink 440ms cubic-bezier(0.32, 0.72, 0, 1) both;
}

html.is-theme-vt-shrink::view-transition-new(root) {
  z-index: 1;
}

@keyframes theme-ripple-expand {
  from {
    clip-path: circle(0px at var(--vt-x, 50%) var(--vt-y, 32px));
  }
  to {
    clip-path: circle(var(--vt-r, 1400px) at var(--vt-x, 50%) var(--vt-y, 32px));
  }
}

@keyframes theme-ripple-shrink {
  from {
    clip-path: circle(var(--vt-r, 1400px) at var(--vt-x, 50%) var(--vt-y, 32px));
  }
  to {
    clip-path: circle(0px at var(--vt-x, 50%) var(--vt-y, 32px));
  }
}

/* ---------- 悬浮磨砂导航胶囊 ---------- */
.nav-shell {
  position: sticky;
  top: 8px;
  z-index: 40;
  max-width: 1528px;
  margin: 0 auto;
  padding: 8px 36px 0;
}

.spatial-pill-nav {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px 8px 18px;
  box-shadow: 0 12px 32px -14px rgba(18, 23, 29, 0.2);
  display: grid;
  grid-template-columns: auto minmax(240px, 500px) auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

html[data-theme="dark"] .spatial-pill-nav {
  box-shadow: 0 14px 36px -14px rgba(0, 0, 0, 0.55);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  color: var(--accent);
  flex-shrink: 0;
}

.brand-mark svg {
  width: 30px;
  height: 30px;
  stroke: none;
}

.brand-text {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-text small {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.search-box {
  width: 100%;
  height: 40px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 9px;
}

.search-box:focus-within {
  border-color: var(--accent);
  background: var(--surface-solid);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-box > svg {
  color: var(--muted);
  flex-shrink: 0;
}

.search-box input {
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  color: var(--ink);
  font-size: 14px;
  min-width: 0;
}

.search-box input::placeholder {
  color: var(--muted);
}

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-box input:focus-visible {
  outline: none;
}

.search-box kbd {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-solid);
}

.clear-search {
  min-width: 30px;
  min-height: 30px;
  font-size: 18px;
  color: var(--muted);
  border-radius: 50%;
}

.clear-search:hover {
  background: var(--surface-hover);
  color: var(--ink);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.library-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.library-stats b {
  color: var(--ink);
  font-weight: 600;
  margin-right: 2px;
  font-variant-numeric: tabular-nums;
}

.library-stats span:nth-child(n+3) {
  display: none;
}

.snapshot {
  font-size: 12px;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 12px;
}

.snapshot time {
  font-variant-numeric: tabular-nums;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-subtle);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle svg {
  width: 14px;
  height: 14px;
}

/* ---------- 主工作区与专题分类 ---------- */
main {
  max-width: 1528px;
  margin: 0 auto;
  padding: 14px 36px 0;
  outline: none;
}

.spatial-categories {
  margin-bottom: 16px;
}

.category-bar-wrap {
  position: relative;
}

#categories {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 2px;
}

#categories::-webkit-scrollbar {
  display: none;
}

.category-bar-wrap.can-scroll-right #categories {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent);
}

.category-bar-wrap.can-scroll-left:not(.can-scroll-right) #categories {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 44px);
  mask-image: linear-gradient(90deg, transparent, #000 44px);
}

.category-bar-wrap.can-scroll-left.can-scroll-right #categories {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 44px, #000 calc(100% - 44px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 44px, #000 calc(100% - 44px), transparent);
}

.cat-scroll-btn,
.cat-scroll-btn:disabled {
  position: absolute;
  top: 50%;
  transform: translateY(-50%) scale(0.92);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong);
  box-shadow: 0 6px 18px rgba(18, 23, 29, 0.14);
  color: var(--ink);
  display: grid;
  place-items: center;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 180ms cubic-bezier(0.22, 1, 0.36, 1), background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.cat-scroll-btn:active:not(:disabled) {
  transform: translateY(-50%) scale(0.95);
}

html[data-theme="dark"] .cat-scroll-btn {
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.48);
}

.cat-scroll-btn.is-left {
  left: 2px;
}

.cat-scroll-btn.is-right {
  right: 2px;
}

.cat-scroll-btn svg {
  width: 16px;
  height: 16px;
}

@media (hover: hover) and (pointer: fine) {
  .category-bar-wrap:hover .cat-scroll-btn.is-visible,
  .category-bar-wrap:focus-within .cat-scroll-btn.is-visible {
    opacity: 1;
    transform: translateY(-50%) scale(1);
    pointer-events: auto;
  }

  .category-bar-wrap:hover .cat-scroll-btn.is-visible:not(:disabled):hover,
  .category-bar-wrap:focus-within .cat-scroll-btn.is-visible:not(:disabled):hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    color: var(--accent);
  }

  .category-bar-wrap:hover .cat-scroll-btn.is-visible:disabled,
  .category-bar-wrap:focus-within .cat-scroll-btn.is-visible:disabled {
    opacity: 0.36;
    cursor: not-allowed;
    transform: translateY(-50%) scale(1);
    pointer-events: auto;
  }
}

@media (hover: none), (pointer: coarse) {
  .cat-scroll-btn {
    display: none;
  }
}

.category-button {
  flex-shrink: 0;
  scroll-margin-inline: 56px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.category-button svg {
  width: 14px;
  height: 14px;
  opacity: 0.72;
}

.category-button small {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.category-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  transform: translateY(-1px);
}

.category-button.active {
  background: var(--accent);
  border-color: transparent;
  color: #FFFFFF;
  font-weight: 600;
}

html[data-theme="dark"] .category-button.active {
  color: #0B0D10;
}

.category-button.active small {
  color: inherit;
  opacity: 0.85;
}

/* ---------- 可折叠「随机翻书 · 换一批」动态光影剧场 ---------- */
.theater-collapsible {
  display: grid;
  grid-template-rows: 1fr;
  margin-bottom: 18px;
  transition: grid-template-rows 300ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease, margin-bottom 300ms ease;
}

.theater-collapsible.is-collapsed {
  grid-template-rows: 0fr;
  opacity: 0;
  margin-bottom: 0;
  pointer-events: none;
}

.theater-collapse-inner {
  min-height: 0;
  overflow: hidden;
  padding: 6px 18px 38px;
  margin: -6px -18px -38px;
  transition: padding 300ms cubic-bezier(0.22, 1, 0.36, 1), margin 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.theater-collapsible.is-collapsed .theater-collapse-inner {
  padding: 0;
  margin: 0;
}

.theater-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 10px;
}

.theater-bar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.theater-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.theater-bar-title strong {
  font-weight: 600;
  color: var(--ink);
}

.theater-pool-label {
  font-size: 12px;
  color: var(--muted);
}

.theater-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.shuffle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}

.shuffle-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.shuffle-btn svg {
  width: 14px;
  height: 14px;
}

.shuffle-btn.is-spinning svg {
  animation: spin-once 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes spin-once {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.collapse-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.collapse-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.theater-stage {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
  background: var(--surface);
  min-height: 268px;
  box-shadow: 0 12px 28px -14px rgba(18, 23, 29, 0.20);
}

html[data-theme="dark"] .theater-stage {
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.48);
}

.theater-bg-bleed {
  position: absolute;
  inset: -24%;
  width: 148%;
  height: 148%;
  object-fit: cover;
  filter: blur(56px) saturate(1.6) brightness(var(--ambient-bright));
  opacity: 0.88;
  pointer-events: none;
  transform: scale(1.1);
}

.theater-scrim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid var(--line);
  background: var(--scrim);
  pointer-events: none;
}

.theater-inner {
  position: relative;
  z-index: 2;
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 158px minmax(0, 1fr) 248px;
  gap: 28px;
  align-items: center;
}

.theater-cover-btn {
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.theater-cover-btn img {
  height: 214px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.36), 0 0 0 1px rgba(255, 255, 255, 0.14);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.theater-cover-btn:hover img {
  transform: translateY(-4px) scale(1.02);
}

.theater-meta {
  min-width: 0;
}

.theater-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.theater-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.theater-year {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
}

.theater-index {
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.theater-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.28;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.theater-author {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--accent);
  margin: 0 0 8px;
}

.theater-summary {
  font-size: 14px;
  line-height: 1.68;
  color: var(--ink-2);
  margin: 0 0 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 62ch;
}

.theater-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.theater-cta {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 600;
}

html[data-theme="dark"] .theater-cta {
  color: #0B0D10;
}

.theater-cta:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.theater-formats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.theater-formats span {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.theater-rail {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.theater-thumb {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  padding: 6px 10px 6px 6px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--line);
  text-align: left;
}

.theater-thumb:hover {
  border-color: var(--line-strong);
  transform: translateX(-2px);
}

.theater-thumb.is-active {
  background: var(--surface-solid);
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(18, 23, 29, 0.14);
}

.theater-thumb img {
  width: 32px;
  height: 42px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.theater-thumb-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 剧场「换一批」与「切书」微动效 */
.theater-stage.is-shuffling .theater-cover-btn,
.theater-stage.is-switching .theater-cover-btn {
  animation: book-swap 340ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.theater-stage.is-shuffling .theater-meta,
.theater-stage.is-switching .theater-meta {
  animation: meta-swap 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.theater-stage.is-shuffling .theater-bg-bleed,
.theater-stage.is-switching .theater-bg-bleed {
  animation: bleed-fade 420ms ease-out both;
}

.theater-stage.is-shuffling .theater-thumb {
  animation: thumb-stagger 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--thumb-i, 0) * 45ms);
}

@keyframes book-swap {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: none; }
}

@keyframes meta-swap {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes bleed-fade {
  from { opacity: 0.28; }
  to { opacity: 0.88; }
}

@keyframes thumb-stagger {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 筛选带 ---------- */
.catalog-controls {
  padding: 12px 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.format-tabs-wrap {
  position: relative;
  min-width: 0;
  max-width: 100%;
  flex: 1;
}

.format-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.format-tabs::-webkit-scrollbar {
  display: none;
}

.format-tabs-wrap.has-overflow-right .format-tabs {
  -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent);
  mask-image: linear-gradient(90deg, #000 90%, transparent);
}

.format-tabs-wrap.has-overflow-left.has-overflow-right .format-tabs {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.format-tabs-wrap.has-overflow-left:not(.has-overflow-right) .format-tabs {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%);
  mask-image: linear-gradient(90deg, transparent, #000 10%);
}

.format-tab {
  min-height: 36px;
  flex-shrink: 0;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.format-tab small {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.format-tab:hover {
  background: var(--surface-subtle);
  color: var(--ink);
}

.format-tab.active {
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 600;
}

html[data-theme="dark"] .format-tab.active {
  color: #0B0D10;
}

.format-tab.active small {
  color: inherit;
  opacity: 0.85;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sort-caption {
  font-size: 12px;
  color: var(--muted);
}

.sort-segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-subtle);
  gap: 2px;
}

.sort-btn {
  min-height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 500;
}

.sort-btn.active {
  background: var(--surface-solid);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(18, 23, 29, 0.1);
}

.alpha-index {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.alpha-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.alpha-keys {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.alpha-btn {
  min-width: 28px;
  min-height: 28px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.alpha-all {
  padding: 0 11px;
  margin-right: 4px;
}

.alpha-btn:hover:not(:disabled) {
  background: var(--surface-subtle);
  color: var(--ink);
}

.alpha-btn.active {
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
}

/* ---------- 结果眉标与筛选标签 ---------- */
.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.results-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

h1#section-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  margin: 0;
}

.results-heading #result-count {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.results-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.expand-spotlight-btn {
  min-height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
}

.expand-spotlight-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.active-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 12px;
  min-height: 32px;
  font-size: 12.5px;
  font-weight: 500;
}

.reset-link {
  font-size: 12.5px;
  color: var(--amber);
  font-weight: 600;
  padding: 4px 8px;
}

/* ---------- 自发光环境晕海报书墙 ---------- */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px 20px;
}

.resource-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.24s ease, border-color 0.2s ease;
}

.resource-card.is-entering {
  animation: card-enter 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--card-i, 0) * 28ms);
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.resource-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--line-strong);
}

.cover-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 220px;
  background: var(--surface-subtle);
  padding: 20px;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
}

/* 真实书封漫反射环境光层 */
.cover-ambient {
  position: absolute;
  inset: -25%;
  width: 150%;
  height: 150%;
  object-fit: cover;
  filter: blur(34px) saturate(1.7) brightness(var(--ambient-bright));
  opacity: var(--ambient-opacity);
  pointer-events: none;
  z-index: 0;
  transition: transform 0.36s ease, opacity 0.25s ease;
}

.resource-card:hover .cover-ambient {
  transform: scale(1.08);
  opacity: calc(var(--ambient-opacity) + 0.14);
}

.book-object {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.resource-card:hover .book-object {
  transform: translateY(-5px) scale(1.03);
}

.cover-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.cover-fallback {
  width: 114px;
  height: 160px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  background: var(--cover-color, #0E7466);
  color: #F5F7F8;
  text-align: left;
  border-radius: 7px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.fallback-frame {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  padding: 8px;
}

.fallback-title {
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.38;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fallback-meta {
  font-size: 11px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-label,
.year-label {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-solid) 86%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.collection-label {
  color: var(--amber);
}

.card-body {
  padding: 14px 16px 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-category {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 4px;
}

.title-button {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: left;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  min-height: calc(16px * 1.4 * 2);
  width: 100%;
  padding: 0;
  color: var(--ink);
}

.title-button:hover {
  color: var(--accent);
}

.card-author {
  margin-top: 5px;
  font-size: 13.5px;
  color: var(--muted);
}

.author-filter-btn {
  padding: 0;
  text-align: left;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
}

.author-filter-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}

.card-author.is-primary .author-filter-btn {
  color: var(--accent);
  font-weight: 600;
}

.card-author.is-missing {
  font-size: 13px;
  color: var(--muted);
}

/* 网格卡片突出封面、书名与作者；完整简介展示于随机剧场与详情弹窗中 */
.card-summary {
  display: none;
}

.format-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
  padding-top: 10px;
}

.format-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-subtle);
  color: var(--ink-2);
}

.format-badge[data-format="PDF"] {
  background: var(--amber-soft);
  color: var(--amber);
}

.format-badge[data-format="EPUB"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.matched-file {
  font-size: 12px;
  line-height: 1.5;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 10px;
  margin: 8px 0 0;
  overflow-wrap: anywhere;
}

.card-bottom {
  margin: 12px 16px 0;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.file-count {
  width: 100%;
  font-size: 12.5px;
  color: var(--muted);
  min-height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-count:hover {
  color: var(--accent);
}

.file-count svg {
  width: 14px;
  height: 14px;
}

/* ---------- 空状态、分页、页脚 ---------- */
.empty-state {
  text-align: center;
  padding: 64px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
}

.empty-state > svg {
  width: 52px;
  height: 52px;
  color: var(--muted);
  stroke-width: 1.3;
}

.empty-state h3 {
  font-family: var(--font-serif);
  font-size: 21px;
  margin: 14px 0 8px;
}

.empty-state p {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 18px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  background: var(--accent);
  color: #FFFFFF;
  padding: 0 24px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
}

.primary-button:hover {
  background: var(--accent-hover);
}

html[data-theme="dark"] .primary-button {
  color: #0B0D10;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 30px 0 14px;
}

.page-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination button {
  min-width: 36px;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.pagination button.active {
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 600;
}

html[data-theme="dark"] .pagination button.active {
  color: #0B0D10;
}

.pagination button:hover:not(:disabled):not(.active) {
  background: var(--surface);
}

.pagination .page-summary {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pagination .page-ellipsis {
  min-width: 24px;
  text-align: center;
  color: var(--muted);
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.page-jump input {
  width: 56px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.page-jump button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
}

.page-footer {
  padding: 22px 0 32px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.page-footer strong {
  color: var(--ink);
}

/* ---------- 详情弹层 ---------- */
dialog {
  width: min(880px, calc(100% - 32px));
  height: min(760px, 86dvh);
  max-height: 90dvh;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--surface-solid);
  color: var(--ink);
  box-shadow: 0 32px 96px rgba(18, 23, 29, 0.34);
  overflow: hidden;
  outline: none;
  animation: dialog-in 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

#detail-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#detail-content:focus {
  outline: none;
}

#detail-content.slide-next > * {
  animation: slide-next 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#detail-content.slide-prev > * {
  animation: slide-prev 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes slide-next {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes slide-prev {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: none; }
}

dialog::backdrop {
  background: rgba(11, 13, 16, 0.56);
  backdrop-filter: blur(8px);
}

.dialog-top {
  position: relative;
  flex-shrink: 0;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 12px 26px;
  z-index: 2;
  font-weight: 600;
}

.dialog-top > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#detail-id {
  display: none;
}

.dialog-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nav-button {
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-subtle);
  font-size: 12.5px;
}

.nav-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-button {
  font-size: 22px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover {
  background: var(--surface-hover);
}

.detail-overview {
  display: grid;
  grid-template-columns: 162px 1fr;
  gap: 26px;
  padding: 26px;
}

.detail-cover {
  min-height: 214px;
  background: var(--surface-subtle);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-cover img {
  width: 100%;
  max-height: 192px;
  object-fit: contain;
  border-radius: 6px;
}

.detail-cover .cover-fallback {
  width: 114px;
  height: 160px;
}

.detail-category {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 6px;
}

#detail-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.detail-summary {
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.8;
  margin: 12px 0 8px;
}

.summary-source {
  font-size: 12px;
  color: var(--muted);
}

.detail-section {
  padding: 0 26px 24px;
}

.detail-section h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 4px 0 6px;
}

.detail-hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 12px;
}

.detail-warning {
  color: var(--amber);
  font-weight: 600;
  margin-top: 8px;
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.file-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--bg);
  min-width: 0;
}

.file-item > .format-badge {
  margin-top: 2px;
  flex-shrink: 0;
  min-width: 48px;
  text-align: center;
}

.file-info {
  min-width: 0;
  flex: 1;
}

.file-name {
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.file-sources {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
}

.download-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.file-sources a {
  font-size: 13px;
  font-weight: 600;
  color: #FFFFFF;
  background: var(--accent);
  padding: 5px 15px;
  border-radius: 999px;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 36px;
}

.file-sources a:hover {
  background: var(--accent-hover);
}

html[data-theme="dark"] .file-sources a {
  color: #0B0D10;
}

.file-sources svg {
  width: 13px;
  height: 13px;
}

.download-unavailable {
  font-size: 13px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.link-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  color: inherit;
}

.download-unavailable .link-status {
  background: var(--accent-soft);
  color: var(--accent);
}

.link-status.status-unavailable {
  background: var(--amber-soft);
  color: var(--amber);
}

.link-status.status-notConfirmed {
  background: var(--surface-subtle);
  color: var(--muted);
}

.copy-code {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12.5px;
  font-weight: 600;
}

.copy-code:hover {
  background: var(--amber);
  color: #FFFFFF;
}

.copy-code.copied {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.unlisted-files {
  font-size: 13.5px;
  color: var(--muted);
  background: var(--surface-subtle);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 95;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.noscript {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--amber-soft);
  padding: 16px;
  text-align: center;
}

/* ---------- 响应式断点 ---------- */
@media (min-width: 1650px) {
  .resource-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1150px) {
  .nav-shell { padding: 10px 24px 0; }
  main { padding: 14px 24px 0; }
  .library-stats, .snapshot { display: none; }
  .theater-inner { grid-template-columns: 142px minmax(0, 1fr); }
  .theater-rail { grid-column: 1 / -1; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .resource-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .nav-shell {
    position: static;
    padding: 10px 16px 0;
  }
  .spatial-pill-nav {
    border-radius: 18px;
    padding: 10px 12px;
    grid-template-columns: 1fr auto;
    gap: 10px;
  }
  .search-box {
    grid-column: 1 / -1;
    order: 3;
  }
  .search-box kbd { display: none; }
  .theme-toggle span { display: none; }
  .theme-toggle {
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
  }
  main { padding: 10px 16px 0; }
  .theater-pool-label { display: none; }
  .theater-collapse-inner { padding: 4px 12px 28px; margin: -4px -12px -28px; }
  .theater-stage {
    border-radius: 18px;
    min-height: 0;
    box-shadow: 0 10px 24px -12px rgba(18, 23, 29, 0.18);
  }
  html[data-theme="dark"] .theater-stage {
    box-shadow: 0 12px 26px -12px rgba(0, 0, 0, 0.44);
  }
  .theater-inner {
    grid-template-columns: 94px minmax(0, 1fr);
    padding: 16px;
    gap: 14px;
  }
  .theater-cover-btn img { height: 132px; }
  .theater-title { font-size: 18px; }
  .theater-summary, .theater-index { display: none; }
  .theater-rail {
    grid-column: 1 / -1;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
  }
  .theater-thumb {
    padding: 4px;
    justify-content: center;
  }
  .theater-thumb img {
    width: 100%;
    max-width: 44px;
    height: 58px;
  }
  .theater-thumb-label { display: none; }
  .controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .sort-control { justify-content: space-between; }
  .alpha-index { overflow: hidden; }
  .alpha-keys {
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
    padding-right: 16px;
  }
  .alpha-keys::-webkit-scrollbar { display: none; }
  .alpha-btn { min-width: 32px; min-height: 34px; }
  .resource-grid { gap: 12px; }
  .cover-button { height: 180px; padding: 14px; }
  .card-body { padding: 12px 12px 0; }
  .title-button { font-size: 14.5px; min-height: calc(14.5px * 1.4 * 2); }
  .card-bottom { margin: 10px 12px 0; }
  .pagination {
    flex-direction: column;
    align-items: center;
  }
  .pagination button { min-width: 36px; min-height: 42px; }
  .page-jump input, .page-jump button { min-height: 42px; }
  .detail-overview {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 14px;
    padding: 16px;
  }
  .dialog-top {
    padding: 10px 10px 10px 14px;
    gap: 8px;
    font-size: 13px;
  }
  .dialog-top > span {
    white-space: nowrap;
  }
  .dialog-top small {
    margin-left: 4px;
    font-size: 11.5px;
  }
  .dialog-nav {
    gap: 4px;
    flex-shrink: 0;
  }
  .nav-button {
    white-space: nowrap;
    padding: 0 9px;
    min-height: 34px;
    font-size: 12px;
  }
  .icon-button {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }
  .detail-cover {
    min-height: 132px;
    padding: 8px;
    align-self: start;
  }
  .detail-cover img { max-height: 118px; }
  #detail-title { font-size: 18px; }
  .detail-section { padding: 0 16px 20px; }
  .file-item { flex-direction: column; gap: 8px; padding: 12px; }
  .file-sources a, .copy-code { min-height: 40px; }
}

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