/* ─── Scroll Ledger：真轴长卷（轴头 · 卷筒 · 纸面 · 黄铜拨栓 · 内凹检索槽 · 碑印名录） ─── */
.scroll-ledger {
  --sheet-tex: url('/assets/textures/dark-slate-vellum.jpg');
  --sheet-base: #1b1916;
  --sheet-edge: rgba(0, 0, 0, 0.38);
  --curl-dark: rgba(0, 0, 0, 0.62);
  --curl-lite: rgba(255, 240, 210, 0.05);
  --ink-rule: rgba(212, 175, 106, 0.17);
  --roll-lo: #0b0a08; --roll-mid: #2b2823; --roll-hi: #4d483f;
  --brass-hi: #f3dca0; --brass-mid: #b88a3c; --brass-lo: #57390f;
  --recess: rgba(0, 0, 0, 0.42);
  --recess-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 236, 196, 0.1);
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  padding: 0.6rem 0.85rem 0.7rem;
}
[data-theme="light"] .scroll-ledger {
  --sheet-tex: url('/assets/textures/light-parchment.jpg');
  --sheet-base: #efe6d1;
  --sheet-edge: rgba(122, 88, 38, 0.2);
  --curl-dark: rgba(96, 66, 24, 0.34);
  --curl-lite: rgba(255, 252, 240, 0.5);
  --ink-rule: rgba(110, 80, 34, 0.2);
  --roll-lo: #8e7950; --roll-mid: #dccba3; --roll-hi: #fff7e3;
  --brass-hi: #f6e2ab; --brass-mid: #b4853a; --brass-lo: #6a4716;
  --recess: rgba(84, 58, 22, 0.13);
  --recess-shadow: inset 0 1px 3px rgba(60, 40, 12, 0.34), 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* 卷轴：纸筒柱面（上亮下暗的圆柱弧影）+ 两端车制黄铜轴头 */
.scroll-rod { position: relative; z-index: 2; flex: 0 0 auto; display: flex; align-items: center; height: 1.1rem; }
.rod-roll {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border-radius: 2px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.07) 0 1px, transparent 1px 9px),
    linear-gradient(180deg, var(--roll-lo) 0%, var(--roll-mid) 18%, var(--roll-hi) 34%, var(--roll-mid) 60%, var(--roll-lo) 100%);
  box-shadow: 0 4px 9px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}
.scroll-rod.is-bottom .rod-roll { box-shadow: 0 -3px 8px rgba(0, 0, 0, 0.3), 0 5px 10px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(0, 0, 0, 0.22); }
.rod-knob {
  position: relative;
  flex: 0 0 0.82rem;
  height: 1.42rem;
  border-radius: 0.34rem / 50%;
  background: linear-gradient(180deg, var(--brass-lo) 0%, var(--brass-mid) 22%, var(--brass-hi) 38%, var(--brass-mid) 62%, var(--brass-lo) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.38), 0 2px 5px rgba(0, 0, 0, 0.5);
}
.rod-knob::after { content: ''; position: absolute; top: 12%; bottom: 12%; left: 50%; width: 2px; margin-left: -1px; background: rgba(0, 0, 0, 0.3); box-shadow: 1px 0 0 rgba(255, 244, 210, 0.3); }

/* 纸面：纹理只铺在这一张纸上；两侧收暗，上下卷沿做圆柱明暗卷弧 */
.scroll-sheet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin: -0.36rem 0.72rem;
  background-color: var(--sheet-base);
  background-image: linear-gradient(90deg, var(--sheet-edge) 0%, transparent 6%, transparent 94%, var(--sheet-edge) 100%), var(--sheet-tex);
  background-size: 100% 100%, 384px 384px;
  background-repeat: no-repeat, repeat;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36), inset 1px 0 0 rgba(255, 240, 205, 0.07), inset -1px 0 0 rgba(0, 0, 0, 0.3);
}
.scroll-sheet::before,
.scroll-sheet::after { content: ''; position: absolute; left: 0; right: 0; z-index: 3; height: 1.7rem; pointer-events: none; }
.scroll-sheet::before { top: 0; background: linear-gradient(180deg, var(--curl-dark) 0%, var(--curl-lite) 44%, transparent 100%); }
.scroll-sheet::after { bottom: 0; background: linear-gradient(0deg, var(--curl-dark) 0%, var(--curl-lite) 44%, transparent 100%); }

/* 卷首：题签 + 机件 */
.scroll-head {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  padding: 1.25rem 1.1rem 0.62rem;
  border-bottom: 1px solid var(--ink-rule);
  box-shadow: 0 3px 0 -2px var(--ink-rule);
}
.scroll-title { display: flex; flex-direction: column; gap: 0.14rem; min-width: 0; }
.ledger-title-line { display: flex; align-items: baseline; gap: 0.5rem; font-family: "Cinzel", Georgia, serif; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; color: var(--accent-gold); }
.ledger-count { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; color: var(--muted-foreground); }
.ledger-unit-whisper { font-size: 0.7rem; color: var(--subtle-foreground); }
.scroll-fittings { display: flex; align-items: center; gap: 0.7rem; }

/* 机械黄铜拨栓：栓块滑入卡位，空出一侧的铜钉点亮表示「已上栓」 */
.brass-latch {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.44rem;
  padding: 0.18rem 0.1rem;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: "Cormorant Garamond", "Noto Serif SC", Georgia, serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: var(--muted-foreground);
  transition: color 0.14s ease;
}
.brass-latch:hover { color: var(--foreground); }
.brass-latch:focus-visible { outline: 1px solid var(--accent-gold-bright); outline-offset: 3px; }
.latch-rail {
  position: relative;
  flex: 0 0 2.2rem;
  height: 0.9rem;
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.44) 100%);
  box-shadow: 0 0 0 1px var(--brass-lo), 0 0 0 2px rgba(255, 232, 180, 0.12), inset 0 1px 2px rgba(0, 0, 0, 0.8);
}
.latch-rail::before,
.latch-rail::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 0.3rem;
  height: 0.3rem;
  margin-top: -0.15rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7d6238 0%, #33230d 72%);
  transition: background 0.16s ease, box-shadow 0.16s ease;
}
.latch-rail::before { left: 0.22rem; }
.latch-rail::after { right: 0.22rem; }
.latch-bolt {
  position: absolute;
  z-index: 1;
  top: 1px;
  bottom: 1px;
  left: 1px;
  width: 1.08rem;
  border-radius: 1px;
  background:
    repeating-linear-gradient(90deg, transparent 0 3px, rgba(0, 0, 0, 0.26) 3px 4px) center / 0.5rem 56% no-repeat,
    linear-gradient(180deg, var(--brass-hi) 0%, var(--brass-mid) 48%, var(--brass-lo) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 248, 220, 0.55), inset 0 -1px 0 rgba(0, 0, 0, 0.4), 1px 0 2px rgba(0, 0, 0, 0.55);
  filter: saturate(0.5) brightness(0.7);
  transition: transform 0.18s cubic-bezier(0.3, 1.35, 0.5, 1), filter 0.16s ease;
}
.brass-latch.is-on { color: var(--accent-gold-bright); }
.brass-latch.is-on .latch-bolt { transform: translateX(calc(1.12rem - 2px)); filter: none; }
.brass-latch.is-on .latch-rail::before {
  background: radial-gradient(circle at 35% 30%, #fff3cc 0%, var(--brass-hi) 42%, var(--brass-mid) 86%);
  box-shadow: 0 0 5px rgba(240, 204, 128, 0.75);
}

/* 极简内凹检索槽 */
.search-slot {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  height: 1.62rem;
  padding: 0 0.5rem;
  border-radius: 2px;
  background: var(--recess);
  box-shadow: var(--recess-shadow);
  transition: box-shadow 0.14s ease;
}
.search-slot:focus-within { box-shadow: var(--recess-shadow), 0 0 0 1px rgba(212, 175, 106, 0.6); }
.slot-glass { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 0.8rem; height: 0.8rem; font-size: 0.74rem; line-height: 1; color: var(--subtle-foreground); }
.slot-glass svg { width: 100%; height: 100%; }
.slot-input { width: 8rem; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; font-size: 0.74rem; color: var(--foreground); transition: width 0.16s ease; }
.slot-input::placeholder { color: var(--subtle-foreground); }
.slot-input:focus { width: 10.2rem; }

/* 卷身：只有这里滚动 */
.scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.3rem 0.5rem 1.8rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 106, 0.32) transparent;
}
.scroll-body::-webkit-scrollbar { width: 3px; }
.scroll-body::-webkit-scrollbar-thumb { background: rgba(212, 175, 106, 0.32); border-radius: 999px; }

/* 名录行：固定行高 + 视口外跳过渲染 */
.model-row {
  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  height: 3.3rem;
  padding: 0 0.7rem 0 0.8rem;
  border-bottom: 1px solid var(--ink-rule);
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: auto 3.3rem;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}
.model-row.is-laureate { background: linear-gradient(90deg, var(--laurel, transparent) 0%, transparent 44%); }
.model-row.laureate-1 { --laurel: rgba(212, 175, 106, 0.13); }
.model-row.laureate-2 { --laurel: rgba(186, 192, 200, 0.1); }
.model-row.laureate-3 { --laurel: rgba(197, 134, 84, 0.1); }
.model-row:hover { background: var(--row-hover); }
.model-row.selected {
  background: linear-gradient(90deg, rgba(212, 175, 106, 0.15) 0%, rgba(212, 175, 106, 0.04) 100%);
  box-shadow: inset 0 1px 0 rgba(212, 175, 106, 0.2), inset 0 -1px 0 rgba(212, 175, 106, 0.2);
}
.model-row.selected::before { content: ''; position: absolute; left: 0; top: 0.4rem; bottom: 0.4rem; width: 3px; border-radius: 1px; background: var(--accent-main, var(--accent-gold-bright)); }

.row-rank { flex: 0 0 1.6rem; display: flex; align-items: center; justify-content: center; font-family: "Cinzel", Georgia, serif; font-size: 0.84rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--subtle-foreground); }
/* 前三名：金 / 银 / 铜 拱顶碑印 */
.rank-seal {
  --seal-hi: #f7e4a8; --seal-mid: #c9a04a; --seal-lo: #76561a; --seal-ink: #2b1c06;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1.6rem;
  width: 1.6rem;
  height: 1.76rem;
  padding-top: 0.1rem;
  border-radius: 0.5rem 0.5rem 1px 1px / 0.36rem 0.36rem 1px 1px;
  background: linear-gradient(160deg, var(--seal-hi) 0%, var(--seal-mid) 46%, var(--seal-lo) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -2px 0 rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.45);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--seal-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.rank-seal.seal-2 { --seal-hi: #f4f5f6; --seal-mid: #aab0b7; --seal-lo: #5b6168; --seal-ink: #22262a; }
.rank-seal.seal-3 { --seal-hi: #ecbb92; --seal-mid: #a9673a; --seal-lo: #572f14; --seal-ink: #2a1205; }

/* 品牌图标：任何状态下都保持不透明与原色 */
.row-icon { flex: 0 0 1.45rem; width: 1.45rem; height: 1.45rem; display: flex; align-items: center; justify-content: center; }
.row-icon svg { width: 100%; height: 100%; }
.model-row .row-icon,
.model-row.is-unavail .row-icon { opacity: 1; filter: none; mix-blend-mode: normal; }

.row-left { display: flex; align-items: center; gap: 0.7rem; flex: 1 1 auto; min-width: 0; }
.row-names { flex: 1 1 auto; min-width: 0; }
.name-line { display: flex; align-items: baseline; gap: 0.42rem; min-width: 0; font-size: 0.94rem; line-height: 1.25; white-space: nowrap; overflow: hidden; }
.name-line > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row-api-id { margin-top: 0.12rem; font-size: 0.7rem; color: var(--subtle-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.claimed-pip { flex: 0 0 auto; margin-left: 0.15rem; font-size: 0.72rem; color: var(--gold-rank); }
.row-right { display: flex; align-items: center; gap: 0.8rem; flex: 0 0 auto; }
.row-price { min-width: 6.4rem; text-align: right; font-variant-numeric: tabular-nums; }
.plate-bookmark { margin-left: 0.12rem; font-size: 0.82rem; line-height: 1; color: var(--accent-gold-bright); }

/* 无渠道参考款：只柔化名称与价格文字，图标不动 */
.model-row.is-unavail .row-names { opacity: 0.6; }
.model-row.is-unavail .row-price,
.model-row.is-unavail .price-nosupply { color: var(--subtle-foreground); }
.model-row.is-unavail .price-now { font-weight: 600; color: var(--muted-foreground); }
/* 轻折角 */
.ref-corner { position: absolute; top: 0; right: 0; min-height: 0.82rem; padding: 0 0.98rem 0 0.3rem; font-size: 0.56rem; line-height: 0.86rem; letter-spacing: 0.08em; color: var(--subtle-foreground); pointer-events: none; }
.ref-corner::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 0.82rem;
  height: 0.82rem;
  background: linear-gradient(225deg, transparent 49%, rgba(212, 175, 106, 0.6) 50%, rgba(212, 175, 106, 0.16) 100%);
  filter: drop-shadow(-1px 1px 1px rgba(0, 0, 0, 0.3));
}

@media (max-width: 720px) {
  .scroll-ledger { padding: 0.5rem 0.45rem 0.6rem; }
  .scroll-sheet { margin: -0.36rem 0.5rem; }
  .scroll-head { padding: 1.15rem 0.75rem 0.55rem; }
  .scroll-body { padding: 0.3rem 0.2rem 1.6rem; }
  .slot-input, .slot-input:focus { width: 6.4rem; }
  .row-price { min-width: 5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .latch-bolt, .latch-rail::before, .slot-input, .model-row { transition: none; }
}
