@charset "UTF-8";
/* =========================================================================
   观象 · 韦特塔罗纸上藏馆 —— 完整样式（非补丁）
   设计：Claude（艺术总监）。结构：tokens → base → header → exhibit →
   plate/buttons → paper-card 材质 → collection → sources/footer →
   dialogs → responsive → reduced motion。
   所有纯装饰层 pointer-events:none。
   ========================================================================= */

@font-face {
  font-family: "Noto Serif SC";
  src: url("/assets/fonts/noto-serif-sc-subset.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: dark;

  /* 色彩：暖炭 / 墨褐，一处旧金 */
  --bg: #14110e;
  --bg-deep: #0e0c0a;
  --surface: #1b1713;
  --surface-2: #241f19;
  --surface-3: #2e271f;
  --line: rgba(222, 200, 160, 0.13);
  --line-2: rgba(222, 200, 160, 0.26);
  --line-3: rgba(222, 200, 160, 0.4);
  --ink: #efe7d6;
  --ink-2: #c9bea8;
  --ink-3: #9a8f7b;
  --gold: #c8a96a;
  --gold-2: #e0c488;
  --gold-dim: #7d6943;
  --gold-tint: rgba(200, 169, 106, 0.14);
  --focus: #e6c784;
  --paper: #f4efe4;
  --paper-edge: #cfc3a8;
  --paper-btn: #e9dfc9;
  --paper-btn-ink: #1d1812;
  --lamp: rgba(247, 224, 176, 0.085);

  /* 字体 */
  --f-cn: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --f-latin: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif SC", serif;
  --f-ui: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* 字号（下限 12px） */
  --t-display: clamp(30px, 3.6vw, 54px);
  --t-display-sub: clamp(16px, 1.6vw, 24px);
  --t-h2: clamp(26px, 2.5vw, 36px);
  --t-name: clamp(28px, 3vw, 44px);
  --t-numeral: clamp(22px, 2.3vw, 34px);
  --t-lead: 16px;
  --t-body: 15px;
  --t-ui: 15px;
  --t-meta: 13px;
  --t-micro: 12px;

  /* 间距（4 基数） */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --s9: 96px;
  --gutter: clamp(16px, 4vw, 56px);
  --maxw: 1360px;
  --header-h: 72px;
  --control-h: 48px;
  --r-ui: 4px;
  --r-tray: 6px;

  /* 卡牌与材质（JS MATERIAL 对象之外的唯一参数处） */
  --card-radius: 11px;
  --grain-opacity: 0.022;
  --flip-ms: 700ms;
  --ease-paper: cubic-bezier(0.3, 0.7, 0.2, 1);
  --card-shadow-rest:
    0 1px 0 0 var(--paper-edge),
    0 0 0 0.5px rgba(20, 12, 4, 0.55),
    0 2px 3px rgba(0, 0, 0, 0.42),
    0 18px 46px -8px rgba(0, 0, 0, 0.62);
}

/* -------------------------------------------------------------------- base */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font: var(--t-body)/1.75 var(--f-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* 极轻的全局纸纤维，位于内容之下，不覆盖牌面 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("/assets/paper.svg") 0 0 / 180px 180px;
  opacity: 0.03;
  pointer-events: none;
}

img { max-width: 100%; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 500; }
ul { margin: 0; padding: 0; list-style: none; }

a { color: inherit; text-decoration: none; }
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { opacity: 0.45; cursor: wait; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

::selection { background: #a88c55; color: #15110d; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--paper-btn);
  color: var(--paper-btn-ink);
  border-radius: var(--r-ui);
  font-size: var(--t-ui);
}
.skip-link:focus { top: 12px; }

.kicker {
  font: 500 var(--t-micro)/1.6 var(--f-ui);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

kbd {
  display: inline-block;
  min-width: 24px;
  padding: 1px 6px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  font: 12px/1.6 var(--f-latin);
  color: var(--ink-2);
  text-align: center;
}

/* svg 图标通用 */
.btn svg,
.icon-btn svg,
.exhibit__more svg,
.link-button svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ------------------------------------------------------------------ header */
.site-header {
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  max-width: var(--maxw);
  height: var(--header-h);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  gap: var(--s5);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 44px;
  white-space: nowrap;
}
.brand__mark { width: 28px; height: 28px; }
.brand__name {
  font: 600 22px/1 var(--f-cn);
  letter-spacing: 0.18em;
}
.brand__sub {
  padding-left: var(--s3);
  border-left: 1px solid var(--line-2);
  font-size: var(--t-meta);
  letter-spacing: 0.12em;
  color: var(--ink-3);
}
.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.site-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--s3);
  font-size: var(--t-ui);
  letter-spacing: 0.08em;
  color: var(--ink-2);
  transition: color 0.2s;
}
.site-nav__link:hover { color: var(--ink); }
.site-nav__link[aria-current="true"] { color: var(--ink); }
.site-nav__link[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: var(--s3);
  right: var(--s3);
  bottom: 6px;
  height: 1px;
  background: var(--gold);
  pointer-events: none;
}

/* ----------------------------------------------------------------- exhibit */
.exhibit {
  --hero-h: clamp(440px, calc(100svh - var(--header-h) - 168px), 700px);
  --hero-w: calc(var(--hero-h) * 0.6);
  position: relative;
  max-width: var(--maxw);
  min-height: calc(100svh - var(--header-h));
  margin-inline: auto;
  padding: clamp(24px, 4vh, 48px) var(--gutter) 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--hero-w) minmax(0, 1fr);
  grid-template-areas:
    "intro stage plate"
    "more  more  more";
  column-gap: clamp(40px, 5vw, 88px);
  align-content: center;
  overflow-x: clip;
}

/* 导语：底边对齐牌底，贴近牌的左侧 */
.exhibit__intro {
  grid-area: intro;
  align-self: end;
  justify-self: end;
  max-width: 360px;
  padding-bottom: var(--s1);
}
.exhibit__title {
  margin-top: var(--s4);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  font-family: var(--f-cn);
  font-weight: 600;
}
.exhibit__title-main {
  font-size: var(--t-display);
  line-height: 1.15;
  letter-spacing: 0.1em;
  color: var(--ink);
}
.exhibit__title-sub {
  font-size: var(--t-display-sub);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.24em;
  color: var(--ink-2);
}
.exhibit__lead {
  margin-top: var(--s5);
  max-width: 21em;
  font-size: var(--t-lead);
  line-height: 1.85;
  color: var(--ink-2);
}
.exhibit__hint {
  margin-top: var(--s5);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
  display: flex;
  gap: var(--s3);
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-3);
}
.hint-icon {
  width: 16px;
  height: 16px;
  margin-top: 4px;
  flex: none;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.4;
  stroke-linejoin: round;
}

/* 舞台：牌 + 牌堆 + 灯池 */
.exhibit__stage {
  grid-area: stage;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stage {
  position: relative;
  isolation: isolate;
  width: var(--hero-w);
  aspect-ratio: 3 / 5;
}
.stage__lamp {
  position: absolute;
  left: 50%;
  top: 40%;
  z-index: -2;
  width: 260%;
  height: 150%;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, var(--lamp), rgba(247, 224, 176, 0.03) 55%, transparent);
  pointer-events: none;
}
.deck-stack {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.deck-stack img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: var(--card-radius);
  box-shadow: 0 1px 0 var(--paper-edge), 0 14px 30px -10px rgba(0, 0, 0, 0.6);
  filter: brightness(0.5) saturate(0.8);
}
.deck-stack img:nth-child(1) { transform: translate(15px, 11px) rotate(3.4deg); }
.deck-stack img:nth-child(2) { transform: translate(7px, 5px) rotate(1.5deg); filter: brightness(0.6) saturate(0.85); }

.hero-card {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
}
.initial-card {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--card-radius);
  background: var(--paper);
  box-shadow: var(--card-shadow-rest);
}
@media (hover: hover) and (pointer: fine) {
  .hero-card .paper-card { cursor: zoom-in; }
}

.exhibit__more {
  grid-area: more;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 44px;
  margin: clamp(20px, 4vh, 40px) 0 var(--s4);
  padding: 0 var(--s3);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  transition: color 0.2s;
}
.exhibit__more:hover { color: var(--ink); }
.exhibit__more svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------ plate 展签 */
.plate {
  grid-area: plate;
  align-self: start;
  justify-self: start;
  width: 100%;
  max-width: 340px;
}
.plate__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s4);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--line-2);
}
.plate__type {
  font-size: var(--t-meta);
  letter-spacing: 0.14em;
  color: var(--gold);
}
.plate__pos {
  font: 14px/1 var(--f-latin);
  letter-spacing: 0.06em;
  color: var(--ink-2);
  font-variant-numeric: lining-nums tabular-nums;
}
.plate__pos .pos-total { margin-left: 0.4em; color: var(--ink-3); }
.plate__tools { display: inline-flex; align-items: center; gap: var(--s3); }
.plate__title { margin-top: var(--s6); }
.plate__numeral {
  display: block;
  font: 400 var(--t-numeral)/1 var(--f-latin);
  letter-spacing: 0.06em;
  color: var(--gold);
}
.plate__name {
  margin-top: var(--s4);
  font: 600 var(--t-name)/1.2 var(--f-cn);
  letter-spacing: 0.14em;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.plate__english {
  margin-top: var(--s2);
  font: 13px/1.5 var(--f-latin);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.keywords {
  margin-top: var(--s5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) 0;
  font: 15px/1.7 var(--f-cn);
  letter-spacing: 0.1em;
  color: var(--ink-2);
}
.keywords > * + *::before {
  content: "·";
  margin: 0 0.7em;
  color: var(--gold-dim);
}
.plate__credit {
  margin-top: var(--s5);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
  font-size: var(--t-meta);
  line-height: 1.7;
  color: var(--ink-3);
}
.plate__controls {
  margin-top: var(--s6);
  display: grid;
  gap: 10px;
}
.stepper { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* ----------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: var(--control-h);
  padding: 0 var(--s4);
  border: 1px solid var(--line-2);
  border-radius: var(--r-ui);
  font-size: var(--t-ui);
  letter-spacing: 0.04em;
  color: var(--ink);
  white-space: nowrap;
  transition: background-color 0.18s, border-color 0.18s, color 0.18s, transform 0.12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-3); }
.btn:active { transform: translateY(1px); }
.btn[aria-pressed="true"] { border-color: var(--gold); color: var(--gold-2); background: var(--gold-tint); }

.btn--paper {
  background: var(--paper-btn);
  border-color: var(--paper-btn);
  color: var(--paper-btn-ink);
  font-weight: 500;
}
.btn--paper:hover { background: #f3ead6; border-color: #f3ead6; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  color: var(--ink-2);
  transition: background-color 0.18s, color 0.18s, border-color 0.18s;
}
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.icon-btn--lg {
  width: 56px;
  height: 56px;
  border: 1px solid var(--line-2);
}
.icon-btn--lg svg { width: 22px; height: 22px; }

.link-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 14px;
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--gold-dim);
  text-underline-offset: 4px;
}
.link-button:hover { color: var(--ink); text-decoration-color: var(--gold); }

/* 手机感应并入现有工具栏，不占用卡牌下方空间。 */
.motion-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  padding: 0 9px;
  flex: none;
  border: 1px solid transparent;
  border-radius: var(--r-ui);
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}
.motion-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.motion-toggle:hover { background: var(--surface-2); color: var(--ink); }
.motion-toggle[aria-pressed="true"] {
  border-color: var(--gold);
  background: var(--gold-tint);
  color: var(--gold-2);
}
.motion-toggle[aria-busy="true"] { opacity: 0.65; }
.motion-toggle[hidden] { display: none; }
.viewer-motion { margin-left: auto; }

/* 指针 / 触屏 提示切换 */
.hint-touch { display: none; }
@media (hover: none), (pointer: coarse) {
  .hint-pointer { display: none; }
  .hint-touch { display: inline; }
  .motion-toggle:not([hidden]) { display: inline-flex; }
  .viewer-stage { --viewer-hint-space: 0px; }
  .viewer-stage .viewer-hint { display: none; }
}

.reading-entry { margin-top: 24px; width: 100%; gap: 16px; text-decoration: none; }

/* ======================================================= 纸牌材质组件
   JS 生成：.paper-card > .paper-tilt > .paper-rotor > .paper-face(.paper-front|.paper-back)
   指针只改写 .paper-card 上的 CSS 变量：--rx --ry --glare-x --glare-y
   --glare-opacity --shadow-x --shadow-y --light
   ==================================================================== */
.paper-card {
  --rx: 0deg;
  --ry: 0deg;
  --glare-x: 50%;
  --glare-y: 50%;
  --glare-opacity: 0;
  --shadow-x: 0px;
  --shadow-y: 18px;
  --light: 0;
  position: relative;
  width: 100%;
  height: 100%;
  perspective: 1600px;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.paper-tilt {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry)) scale(calc(1 + var(--light) * 0.012));
  will-change: transform;
}
.paper-rotor {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateY(0deg);
  transition: transform var(--flip-ms) var(--ease-paper);
  border-radius: var(--card-radius);
  /* 1px 薄纸边 + 切边细线 + 接触阴影 + 随姿态的浮起阴影 */
  box-shadow:
    0 1px 0 0 var(--paper-edge),
    0 0 0 0.5px rgba(20, 12, 4, 0.55),
    0 2px 3px rgba(0, 0, 0, 0.42),
    var(--shadow-x) var(--shadow-y) calc(44px + var(--light) * 12px) -8px rgba(0, 0, 0, 0.62);
}
.paper-card[data-flipped="true"] .paper-rotor { transform: rotateY(180deg); }

.paper-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--card-radius);
  background: var(--paper);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(1px);
}
.paper-back { transform: rotateY(180deg) translateZ(1px); }

.paper-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

/* 微纸纤维：随牌面一起变换；原图已有扫描颗粒，故极轻 */
.paper-grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: url("/assets/paper.svg") 0 0 / 180px 180px;
  mix-blend-mode: multiply;
  opacity: var(--grain-opacity);
  pointer-events: none;
}

/* 覆膜高光：柔和亮斑与有亮芯的斜光带；只跟随姿态，中立时为 0。 */
.paper-glare {
  position: absolute;
  inset: -1px;
  z-index: 3;
  mix-blend-mode: screen;
  opacity: var(--glare-opacity);
  background:
    radial-gradient(90% 70% at var(--glare-x) var(--glare-y),
      rgba(255, 253, 245, 0.64) 0%,
      rgba(255, 251, 237, 0.25) 24%,
      rgba(255, 249, 232, 0.06) 44%,
      transparent 64%),
    linear-gradient(112deg,
      transparent 36%,
      rgba(255, 253, 245, 0.12) 42%,
      rgba(255, 253, 245, 0.62) 48%,
      rgba(255, 253, 245, 0.78) 50%,
      rgba(255, 253, 245, 0.38) 53%,
      transparent 62%);
  background-size: 100% 100%, 200% 100%;
  background-position: center, var(--glare-x) 50%;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* 纸面内缘：上沿一线微亮、下沿一线微暗，表现卡纸厚度 */
.paper-face::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 0 0 0.75px rgba(255, 255, 255, 0.32),
    inset 0 -1px 0 rgba(90, 70, 40, 0.22);
  pointer-events: none;
}

.image-status {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s4);
  background: var(--paper);
  color: #5a5040;
  font-size: 14px;
  text-align: center;
  cursor: pointer;
}
.image-status[hidden] { display: none; }

.card-mount-enter { animation: cardIn 0.36s var(--ease-paper) both; }
@keyframes cardIn {
  from { opacity: 0.35; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* -------------------------------------------------------------- collection */
.collection {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #17130f 0, var(--bg) 360px);
  padding: var(--s9) 0 var(--s8);
}
.collection__inner {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s6);
  margin-bottom: var(--s6);
}
.section-head__title {
  margin-top: var(--s2);
  font: 600 var(--t-h2)/1.25 var(--f-cn);
  letter-spacing: 0.14em;
}
.section-head__note {
  max-width: 25em;
  font-size: var(--t-body);
  line-height: 1.8;
  color: var(--ink-2);
}

.collection-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s5);
  margin: 0 calc(var(--gutter) * -1) var(--s7);
  padding: 0 var(--gutter);
  background: rgba(20, 17, 14, 0.97);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.filters {
  display: flex;
  gap: var(--s1);
  margin-left: calc(var(--s4) * -1);
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 56px;
  padding: 0 var(--s4);
  font-size: var(--t-ui);
  letter-spacing: 0.06em;
  color: var(--ink-2);
  white-space: nowrap;
  transition: color 0.18s;
}
.filter:hover { color: var(--ink); }
.filter__count {
  font: 12px/1 var(--f-latin);
  color: var(--ink-3);
  font-variant-numeric: lining-nums;
}
.filter.active,
.filter[aria-pressed="true"] { color: var(--ink); }
.filter.active .filter__count { color: var(--gold); }
.filter.active::after {
  content: "";
  position: absolute;
  left: var(--s4);
  right: var(--s4);
  bottom: -1px;
  height: 2px;
  background: var(--gold);
  pointer-events: none;
}
.filter:focus-visible { outline-offset: -4px; }
.results-count {
  font-size: 14px;
  color: var(--ink-3);
  white-space: nowrap;
}

.card-grid { min-height: 320px; }
.loading-state,
.error-state {
  padding: var(--s8) 0;
  text-align: center;
  color: var(--ink-2);
}
.error-state button {
  display: inline-flex;
  margin-top: var(--s4);
  min-height: 44px;
  padding: 0 var(--s4);
  border: 1px solid var(--line-2);
  border-radius: var(--r-ui);
}

/* 分组 + 藏品托盘 */
.deck-group { --cols: 7; }
.deck-group + .deck-group { margin-top: var(--s8); }
.deck-group__head {
  display: flex;
  align-items: baseline;
  gap: var(--s4);
  margin-bottom: var(--s4);
}
.deck-group__title {
  font: 600 24px/1.3 var(--f-cn);
  letter-spacing: 0.14em;
}
.deck-group__en {
  font: 13px/1.3 var(--f-latin);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.deck-group__count {
  margin-left: auto;
  font-size: var(--t-meta);
  color: var(--ink-3);
}
.deck-tray {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: clamp(24px, 2.6vw, 36px) clamp(12px, 2vw, 28px);
  padding: clamp(14px, 2.4vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-tray);
  box-shadow: inset 0 1px 0 rgba(255, 238, 205, 0.03);
}

.gallery-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
}
.thumb {
  position: relative;
  display: block;
  aspect-ratio: 3 / 5;
  border-radius: 5px;
  background: var(--paper);
  box-shadow:
    0 0 0 0.5px rgba(20, 12, 4, 0.6),
    0 1px 0 var(--paper-edge),
    0 8px 16px -6px rgba(0, 0, 0, 0.55);
  transition: transform 0.22s var(--ease-paper), box-shadow 0.22s var(--ease-paper);
}
.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}
.gallery-card:hover .thumb {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 0.5px rgba(20, 12, 4, 0.6),
    0 1px 0 var(--paper-edge),
    0 18px 28px -10px rgba(0, 0, 0, 0.7);
}
.gallery-card:focus-visible { outline: none; }
.gallery-card:focus-visible .thumb {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}
.thumb-caption {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  column-gap: var(--s2);
  row-gap: 2px;
  margin-top: var(--s3);
}
.thumb-num {
  font: 13px/1.5 var(--f-latin);
  letter-spacing: 0.04em;
  color: var(--gold);
}
.thumb-num:empty { display: none; }
.thumb-num:empty + .thumb-name { grid-column: 1 / -1; }
.thumb-name {
  font: 500 16px/1.5 var(--f-cn);
  letter-spacing: 0.06em;
  color: var(--ink);
  transition: color 0.18s;
}
.gallery-card:hover .thumb-name { color: #fff8ea; }
.thumb-en {
  grid-column: 1 / -1;
  font: 12px/1.45 var(--f-latin);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ----------------------------------------------------------------- sources */
.sources { border-top: 1px solid var(--line); }
.sources__inner {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: var(--s8) var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: var(--s8);
}
.sources__title {
  margin-top: var(--s2);
  font: 600 var(--t-h2)/1.25 var(--f-cn);
  letter-spacing: 0.14em;
}
.sources__lead {
  margin: var(--s4) 0 var(--s5);
  max-width: 24em;
  color: var(--ink-2);
  line-height: 1.85;
}
.credits {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s5) var(--s7);
}
.credits__item {
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
}
.credits dt {
  font-size: var(--t-meta);
  letter-spacing: 0.14em;
  color: var(--gold);
}
.credits dd {
  margin: var(--s1) 0 0;
  font-size: var(--t-body);
  line-height: 1.75;
  color: var(--ink-2);
}
.credits a,
.about-dialog a {
  color: var(--gold-2);
  text-decoration: underline;
  text-decoration-color: var(--gold-dim);
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------------ footer */
.site-footer { border-top: 1px solid var(--line); }
.site-footer__inner {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: var(--s5) var(--gutter) calc(var(--s5) + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  font-size: 14px;
  color: var(--ink-3);
}
.site-footer__brand {
  font: 600 17px/1 var(--f-cn);
  letter-spacing: 0.18em;
  color: var(--ink-2);
}

/* ================================================================ dialogs */
dialog {
  color: var(--ink);
  border: 0;
  padding: 0;
}
dialog[open] { animation: dialogIn 0.26s var(--ease-paper) both; }
dialog::backdrop { background: rgba(6, 5, 4, 0.82); }
dialog[open]::backdrop { animation: backdropIn 0.26s ease both; }
dialog[open].closing { animation: dialogOut 0.15s ease-in both; }
dialog.closing::backdrop { animation: backdropOut 0.15s ease-in both; }
@keyframes dialogIn { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes dialogOut { to { opacity: 0; transform: scale(0.99); } }
@keyframes backdropIn { from { opacity: 0; } }
@keyframes backdropOut { to { opacity: 0; } }

/* ---- viewer：全屏灯箱 ---- */
.viewer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border-radius: 0;
  background:
    radial-gradient(ellipse 55% 60% at 40% 48%, rgba(247, 224, 176, 0.05), transparent 70%),
    var(--bg-deep);
  overflow: hidden;
}
.viewer-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
.viewer-bar {
  display: flex;
  align-items: center;
  gap: var(--s4);
  height: 64px;
  padding: 0 var(--s4) 0 var(--s5);
  border-bottom: 1px solid var(--line);
}
.viewer-bar__crumb {
  display: flex;
  align-items: baseline;
  gap: var(--s4);
  min-width: 0;
}
.viewer-position {
  font: 14px/1 var(--f-latin);
  letter-spacing: 0.06em;
  color: var(--ink-2);
  white-space: nowrap;
  font-variant-numeric: lining-nums tabular-nums;
}
.viewer-keys {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-meta);
  color: var(--ink-3);
}
.viewer-keys__gap { width: var(--s4); }
.viewer-close { margin-left: var(--s3); }

.viewer-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 96px 360px;
  grid-template-areas: "prev stage next info";
}
.viewer-arrow { align-self: center; justify-self: center; }
.viewer-arrow--prev { grid-area: prev; }
.viewer-arrow--next { grid-area: next; }

.viewer-stage {
  grid-area: stage;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s5) 0 0;
}
.viewer-card {
  --card-radius: 12px;
  position: relative;
  flex: none;
  width: min(100%, calc((100dvh - 64px - 24px - var(--viewer-hint-space, 56px) - 16px) * 0.6), 580px);
  aspect-ratio: 3 / 5;
}
.viewer-hint {
  flex: none;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--t-meta);
  color: var(--ink-3);
}

.viewer-info {
  grid-area: info;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: var(--s7) 40px;
  border-left: 1px solid var(--line);
}
.viewer-category {
  font-size: var(--t-meta);
  letter-spacing: 0.14em;
  color: var(--gold);
}
.viewer-numeral {
  display: block;
  margin-top: var(--s6);
  font: 400 var(--t-numeral)/1 var(--f-latin);
  letter-spacing: 0.06em;
  color: var(--gold);
}
.viewer-title {
  margin-top: var(--s4);
  font: 600 var(--t-name)/1.2 var(--f-cn);
  letter-spacing: 0.14em;
  overflow-wrap: anywhere;
}
.viewer-english {
  margin-top: var(--s2);
  font: 13px/1.5 var(--f-latin);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.rule {
  width: 40px;
  height: 1px;
  margin: var(--s6) 0 var(--s5);
  border: 0;
  background: var(--gold-dim);
}
.viewer-credit {
  font-size: var(--t-meta);
  line-height: 1.8;
  color: var(--ink-3);
}
.viewer-flip { margin-top: var(--s6); min-width: 160px; }

/* ---- 来源说明 ---- */
.about-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: var(--s7) 44px var(--s6);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-tray);
  line-height: 1.9;
}
.about-close { position: absolute; right: 10px; top: 10px; }
.about-dialog h2 {
  margin: var(--s3) 0 var(--s5);
  font: 600 26px/1.35 var(--f-cn);
  letter-spacing: 0.1em;
}
.about-dialog h3 {
  margin: var(--s6) 0 var(--s2);
  font: 600 18px/1.4 var(--f-cn);
  letter-spacing: 0.08em;
  color: var(--ink);
}
.about-dialog p:not(.kicker) {
  margin-top: var(--s3);
  font-size: var(--t-body);
  color: var(--ink-2);
}
.about-dialog .about-note {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-3);
}

/* ------------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 90;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: var(--r-ui);
  background: var(--paper-btn);
  color: var(--paper-btn-ink);
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================ responsive */

/* 1200–1439：图鉴 6 列 */
@media (max-width: 1199px) {
  .deck-group { --cols: 6; }
  .viewer-body { grid-template-columns: 80px minmax(0, 1fr) 80px 320px; }
  .viewer-info { padding: var(--s7) var(--s6); }
}

/* 平板 700–1099：导语在上，牌与展签并排 */
@media (max-width: 1099px) {
  .exhibit {
    --hero-h: clamp(400px, calc(100svh - var(--header-h) - 250px), 580px);
    min-height: 0;
    grid-template-columns: var(--hero-w) minmax(0, 1fr);
    grid-template-areas:
      "intro intro"
      "stage plate"
      "more  more";
    column-gap: var(--s7);
    row-gap: var(--s6);
    align-content: start;
    padding-top: var(--s6);
  }
  .exhibit__intro {
    justify-self: stretch;
    align-self: start;
    max-width: none;
    padding-bottom: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "kicker kicker"
      "title  lead"
      "title  hint";
    column-gap: var(--s7);
    align-items: end;
  }
  .exhibit__intro .kicker { grid-area: kicker; }
  .exhibit__title { grid-area: title; }
  .exhibit__lead { grid-area: lead; margin-top: 0; max-width: 28em; }
  .exhibit__hint { grid-area: hint; margin-top: var(--s3); padding-top: 0; border-top: 0; }
  .plate { align-self: center; max-width: 360px; }
}

@media (max-width: 899px) {
  .deck-group { --cols: 5; }
  .section-head { flex-direction: column; align-items: flex-start; gap: var(--s3); }
  .sources__inner { grid-template-columns: 1fr; gap: var(--s6); }
}

/* viewer 平板/手机竖屏：牌在上，名称与翻面在底栏，箭头夹住底栏 */
@media (max-width: 759px) {
  .viewer-bar { height: 56px; padding: 0 var(--s2) 0 var(--s4); }
  .viewer-keys { display: none; }
  .viewer-close { margin-left: auto; }
  .viewer-motion:not([hidden]) + .viewer-close { margin-left: var(--s1); }
  .viewer-body {
    grid-template-columns: 64px minmax(0, 1fr) 64px;
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas:
      "stage stage stage"
      "prev  info  next";
  }
  .viewer-stage { padding: var(--s3) var(--s4) 0; }
  .viewer-card {
    --card-radius: 9px;
    width: min(100%, calc((100dvh - 56px - 24px - var(--viewer-hint-space, 52px) - 140px) * 0.6));
  }
  .viewer-hint { height: 52px; }
  .viewer-info {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 2px var(--s3);
    padding: var(--s3) 0 calc(var(--s3) + env(safe-area-inset-bottom));
    border-left: 0;
    border-top: 1px solid var(--line);
    overflow: visible;
    text-align: center;
  }
  .viewer-category,
  .viewer-numeral,
  .viewer-keywords,
  .viewer-credit,
  .viewer-info .rule { display: none; }
  .viewer-title { margin-top: 0; font-size: 24px; letter-spacing: 0.1em; }
  .viewer-english { margin-top: 0; font-size: 12px; letter-spacing: 0.12em; }
  .viewer-flip { flex-basis: 100%; max-width: 220px; margin: var(--s2) auto 0; }
  .viewer-arrow { width: 48px; height: 48px; }
  .about-dialog { padding: var(--s7) var(--s5) var(--s5); }
}

/* 手机 <700：单列，牌优先进入首屏 */
@media (max-width: 699px) {
  :root { --header-h: 56px; --card-radius: 9px; }
  .brand__sub { display: none; }
  .brand__name { font-size: 20px; }
  .site-nav { gap: 0; }
  .site-nav__link { padding: 0 10px; }

  .exhibit {
    --hero-w: min(76vw, 340px, calc((100svh - 232px) * 0.6));
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--s4) var(--s4) 0;
  }
  .exhibit__intro {
    display: block;
    width: 100%;
    text-align: center;
  }
  .exhibit__intro .kicker,
  .exhibit__lead,
  .exhibit__hint { display: none; }
  .exhibit__title {
    margin: 0;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 2px var(--s3);
  }
  .exhibit__title-main { font-size: clamp(26px, 8vw, 32px); letter-spacing: 0.08em; }
  .exhibit__title-sub { font-size: 15px; letter-spacing: 0.16em; }
  .exhibit__stage { margin-top: var(--s4); }
  .deck-stack img:nth-child(1) { transform: translate(9px, 7px) rotate(3deg); }
  .deck-stack img:nth-child(2) { transform: translate(4px, 3px) rotate(1.4deg); }

  .plate {
    max-width: 440px;
    margin-top: var(--s6);
    text-align: center;
  }
  .plate__meta { justify-content: center; gap: var(--s4); }
  .plate__title {
    margin-top: var(--s4);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 0 var(--s3);
  }
  .plate__numeral { font-size: 22px; }
  .plate__name { margin-top: 0; font-size: 28px; letter-spacing: 0.12em; }
  .plate__english { flex-basis: 100%; }
  .keywords { justify-content: center; margin-top: var(--s3); }
  .plate__credit { display: none; }
  .plate__controls { margin-top: var(--s5); }
  .exhibit__more { margin-top: var(--s6); }

  .collection { padding-top: var(--s8); }
  .section-head__note { font-size: 14px; }
  /* 手机筛选：3×2 网格全部可见，不吸顶；计数独占一行，不与说明重叠 */
  .collection-toolbar {
    position: static;
    display: block;
    margin: 0 0 var(--s6);
    padding: 0;
    background: none;
    border: 0;
  }
  .filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s2);
    margin: 0;
    overflow: visible;
  }
  .filter {
    min-height: 48px;
    padding: 0 var(--s2);
    border: 1px solid var(--line);
    border-radius: var(--r-ui);
  }
  .filter.active { border-color: var(--gold); background: var(--gold-tint); }
  .filter.active::after { display: none; }
  .results-count { margin-top: var(--s3); font-size: var(--t-meta); }

  .deck-group { --cols: 3; }
  .deck-group + .deck-group { margin-top: var(--s7); }
  .deck-group__title { font-size: 20px; }
  .deck-tray { gap: var(--s5) var(--s3); padding: var(--s3); }
  .thumb { border-radius: 4px; }
  .thumb-caption { margin-top: var(--s2); }
  .thumb-num { font-size: 12px; }
  .thumb-name { font-size: 14px; letter-spacing: 0.02em; }

  .credits { grid-template-columns: 1fr; }
  .sources__inner { padding-block: var(--s7); }
  .site-footer__inner { flex-wrap: wrap; justify-content: center; text-align: center; }
}

/* 窄屏：英文名由原画自带，缩略图下省略以免挤压 */
@media (max-width: 479px) {
  .thumb-en { display: none; }
  .deck-group__en { display: none; }
}

@media (max-width: 360px) {
  .site-nav__link { padding: 0 8px; font-size: 14px; }
  .brand { gap: var(--s2); }
  .actions .btn { padding: 0 var(--s2); gap: 6px; font-size: 14px; }
  .stepper .btn { padding: 0 var(--s2); }
  .deck-tray { padding: 10px; gap: var(--s4) 10px; }
  .thumb-name { font-size: 13px; }
}

/* 手机/平板横屏（矮屏）：牌在左，导语+展签在右；viewer 侧栏化 */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --header-h: 56px; }
  .exhibit {
    --hero-w: calc((100svh - var(--header-h) - 40px) * 0.6);
    display: grid;
    min-height: 0;
    grid-template-columns: var(--hero-w) minmax(0, 1fr);
    grid-template-areas:
      "stage intro"
      "stage plate"
      "more  more";
    column-gap: var(--s6);
    row-gap: var(--s3);
    align-content: start;
    padding: var(--s4) var(--gutter) 0;
  }
  .exhibit__intro { display: block; text-align: left; }
  .exhibit__intro .kicker,
  .exhibit__lead,
  .exhibit__hint { display: none; }
  .exhibit__title { flex-direction: row; align-items: baseline; gap: var(--s3); margin: 0; }
  .exhibit__title-main { font-size: 26px; }
  .exhibit__title-sub { font-size: 15px; }
  .exhibit__stage { grid-row: 1 / 3; margin: 0; }
  .plate { margin: 0; max-width: 420px; text-align: left; align-self: start; }
  .plate__meta,
  .plate__title,
  .keywords { justify-content: flex-start; }
  .plate__title { margin-top: var(--s3); }
  .plate__controls { margin-top: var(--s4); }

  .viewer-bar { height: 48px; }
  .viewer-keys { display: none; }
  .viewer-close { margin-left: auto; }
  .viewer-motion:not([hidden]) + .viewer-close { margin-left: var(--s1); }
  .viewer-body {
    grid-template-columns: 56px minmax(0, 1fr) 56px 260px;
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "prev stage next info";
  }
  .viewer-stage { padding: var(--s2) 0 0; }
  .viewer-card {
    --card-radius: 8px;
    width: min(100%, calc((100dvh - 48px - 24px - var(--viewer-hint-space, 44px)) * 0.6));
  }
  .viewer-hint { height: 44px; }
  .viewer-arrow { width: 44px; height: 44px; }
  .viewer-info {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    padding: var(--s4) var(--s5);
    border-top: 0;
    border-left: 1px solid var(--line);
    overflow-y: auto;
    text-align: left;
  }
  .viewer-category { display: block; }
  .viewer-numeral,
  .viewer-credit,
  .viewer-info .rule { display: none; }
  .viewer-keywords { display: flex; margin-top: var(--s3); }
  .viewer-title { margin-top: var(--s2); font-size: 24px; }
  .viewer-english { margin-top: var(--s1); }
  .viewer-flip { flex-basis: auto; margin: var(--s4) 0 0; }
}

/* ======================================================= reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .paper-tilt { transform: none !important; }
  .paper-glare { opacity: 0 !important; }
  .gallery-card:hover .thumb { transform: none; }
}

/* 高对比模式：保证焦点与边框可见 */
@media (forced-colors: active) {
  .btn,
  .filter,
  .motion-toggle,
  .icon-btn--lg { border: 1px solid ButtonText; }
  .paper-glare,
  .paper-grain,
  .stage__lamp { display: none; }
}




/* ======================================================== 原著释义阅读层 */
.viewer-shell { position: relative; }

.viewer-actions {
  display: flex;
  gap: var(--s3);
  margin-top: var(--s6);
  width: 100%;
}
.viewer-actions .viewer-flip {
  margin-top: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.viewer-actions .viewer-read {
  flex: 0 0 auto;
  min-width: 88px;
  padding: 0 var(--s3);
}

.card-reader {
  position: absolute;
  top: 64px;
  right: 0;
  bottom: 0;
  width: 360px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  border-left: 1px solid var(--line);
}
.card-reader[hidden] { display: none !important; }

.viewer-shell.reader-open .viewer-info {
  visibility: hidden;
}

.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 56px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.reader-back {
  min-height: 44px;
  min-width: 44px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--ink-2);
  flex: 0 0 auto;
}
.reader-back svg {
  width: 18px;
  height: 18px;
}
.reader-card-name {
  font: 600 16px/1.2 var(--f-cn);
  letter-spacing: 0.06em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 4px;
}
.reader-card-name:focus-visible {
  outline: none;
}
.reader-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.reader-nav .icon-btn {
  width: 44px;
  height: 44px;
}

.reader-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--s6) 36px calc(var(--s6) + env(safe-area-inset-bottom));
}
.reader-scroll:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.reader-content {
  max-width: 600px;
  margin-inline: auto;
}
.reader-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s3);
}
.reader-badge {
  font: 500 12px/1.5 var(--f-ui);
  letter-spacing: 0.12em;
  color: var(--gold);
  padding: 2px 7px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-ui);
  background: var(--gold-tint);
}
.reader-edition-tag {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.reader-title {
  font: 600 22px/1.3 var(--f-cn);
  letter-spacing: 0.08em;
  color: var(--ink);
  margin-bottom: var(--s5);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--line);
  border-radius: var(--r-ui);
  overflow-wrap: break-word;
}
.reader-section {
  margin-bottom: var(--s5);
}
.reader-section h3 {
  font: 600 15px/1.4 var(--f-cn);
  letter-spacing: 0.06em;
  color: var(--gold-2);
  margin-bottom: var(--s2);
}
.reader-section p {
  font-size: 15px;
  line-height: 1.85;
  color: var(--ink-2);
  overflow-wrap: break-word;
}
.reader-meanings {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.reader-meaning-block {
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-ui);
}
.reader-meaning-block h3 {
  margin-bottom: var(--s1);
}
.reader-note {
  padding: var(--s3) var(--s4);
  border-left: 2px solid var(--gold);
  background: var(--surface-2);
  border-radius: 0 var(--r-ui) var(--r-ui) 0;
}
.reader-original {
  margin-top: var(--s5);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-ui);
  background: var(--surface);
  font-size: 13px;
}
.reader-original summary {
  font: 500 13px/1.6 var(--f-ui);
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.reader-original summary:hover {
  color: var(--gold-2);
}
.reader-original-body {
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
  color: var(--ink-3);
}
.reader-original-body h4 {
  font: 600 13px/1.4 var(--f-latin);
  color: var(--gold);
  margin: var(--s3) 0 var(--s1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.reader-original-body h4:first-child {
  margin-top: 0;
}
.reader-original-body p {
  font: 14px/1.8 var(--f-latin);
  white-space: pre-wrap;
  overflow-wrap: break-word;
  margin: 0;
  color: var(--ink-2);
}
.reader-sources ul {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.reader-sources a {
  font-size: 13px;
  color: var(--gold);
  text-decoration: underline;
  text-decoration-color: var(--gold-dim);
  text-underline-offset: 3px;
}
.reader-sources a:hover {
  color: var(--gold-2);
  text-decoration-color: var(--gold);
}
.reader-loading,
.reader-error {
  padding: var(--s7) var(--s4);
  text-align: center;
  color: var(--ink-2);
}
.reader-error p {
  margin-bottom: var(--s3);
}

@media (max-width: 1199px) and (min-width: 760px) and (min-height: 521px) {
  .reader-scroll { padding: var(--s5) var(--s4); }
}

@media (max-width: 759px) {
  .viewer-actions {
    max-width: 260px;
    margin: var(--s2) auto 0;
    gap: var(--s2);
  }
  .viewer-actions .viewer-flip {
    padding: 0 var(--s2);
    font-size: 13px;
  }
  .viewer-actions .viewer-read {
    min-width: 72px;
    padding: 0 var(--s2);
    font-size: 13px;
  }
  .card-reader {
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-left: none;
  }
  .reader-scroll {
    padding: var(--s4) var(--s4) calc(var(--s6) + env(safe-area-inset-bottom));
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .viewer-actions {
    margin: var(--s4) 0 0;
    gap: var(--s2);
  }
  .viewer-actions .viewer-flip {
    padding: 0 var(--s2);
    font-size: 13px;
  }
  .viewer-actions .viewer-read {
    min-width: 72px;
    padding: 0 var(--s2);
    font-size: 13px;
  }
  .card-reader {
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    border-left: none;
  }
  .reader-scroll {
    padding: var(--s3) var(--s4) calc(var(--s4) + env(safe-area-inset-bottom));
  }
}

@media (forced-colors: active) {
  .card-reader { border: 1px solid ButtonText; }
  .reader-badge,
  .reader-meaning-block,
  .reader-note,
  .reader-original { border: 1px solid ButtonText; }
}


/* 阅读操作保留完整触控目标；原文和来源链接也便于触摸。 */
.reader-original summary { min-height: 44px; align-content: center; }
.reader-sources a { display: inline-block; min-height: 44px; padding-block: 8px; }
.reading-entry { background: var(--gold); border-color: var(--gold); color: #17130f; }
.reading-entry:hover { background: var(--gold-2); border-color: var(--gold-2); color: #17130f; }
