/* 现场：真实照片铺满全屏，界面只是压在照片上的字幕和几张实体相纸。
   没有面板、没有卡片格子；稀有度用相纸材质表达（哑光 / 光面 / 银边 / 烫金 / 镭射）。 */
:root {
  color-scheme: dark;
  --night: #0b0d0b;
  --ink: #f5f3ec;
  --ink-2: rgba(245, 243, 236, 0.8);
  --ink-3: rgba(245, 243, 236, 0.6);
  --rule: rgba(245, 243, 236, 0.32);
  --paper: #f6f4ee;
  --paper-back: #e8e4da;
  --paper-ink: #1b1d1a;
  --paper-ink-2: #5b6058;
  --danger: #ff8a75;
  --win: #c4e8ad;

  --foil-silver: linear-gradient(125deg, #7f868b 0%, #eef1f3 32%, #a3a9ae 52%, #f7f8f9 70%, #8b9196 100%);
  --foil-gold: linear-gradient(125deg, #8a5f17 0%, #f4d987 30%, #b4832c 52%, #fbe8a8 70%, #93661c 100%);
  --foil-holo: linear-gradient(115deg, #ff9ac6, #ffe08a, #9df3c4, #8fd3ff, #c9a4ff, #ff9ac6);

  --f-sans: 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --f-latin: 'Source Serif 4', Georgia, 'Times New Roman', serif;

  --gutter: clamp(16px, 3.4vw, 56px);
  --print-w: clamp(96px, 8.6vw, 148px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
/* 日文和繁中的汉字字形和简中不同，用各自的字体；字体文件由 app.js 按语言加载 */
:root:lang(ja) {
  --f-sans: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', 'Noto Sans SC', sans-serif;
}
:root:lang(zh-TW) {
  --f-sans: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans SC', sans-serif;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
body {
  min-height: 100dvh;
  background: var(--night);
  color: var(--ink);
  font: 400 15px/1.6 var(--f-sans);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
img {
  max-width: 100%;
}
[hidden] {
  display: none !important;
}
button {
  font: inherit;
  color: inherit;
}
a {
  color: inherit;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
}
a:hover {
  text-decoration-color: currentColor;
}
::selection {
  background: rgba(245, 243, 236, 0.85);
  color: var(--paper-ink);
}
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 243, 236, 0.3) transparent;
}

/* ================= 背景：现场 ================= */
.world {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--night);
}
/* 背景照片完整显示（contain），四周用同一张照片放大模糊垫满。
   之前整张 cover 再放大，竖图在横屏上只看得到中间一半，拍的东西常被裁掉 */
.scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition:
    opacity 1.2s var(--ease-out),
    filter 0.9s var(--ease-out);
}
.scene::before,
.scene::after {
  content: '';
  position: absolute;
  background-image: var(--photo, none);
  background-position: center;
  background-repeat: no-repeat;
}
/* 垫底：慢慢漂移的那层只放在模糊垫底上，照片本身不动、不裁 */
.scene::before {
  inset: -8%;
  background-size: cover;
  filter: blur(36px) brightness(0.5) saturate(1.1);
  animation: drift 40s ease-in-out infinite alternate;
}
.scene::after {
  inset: 0;
  background-size: contain;
}
.scene.is-on {
  opacity: 1;
}
@keyframes drift {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.08) translate(-1%, -1%);
  }
}
/* 字幕和顶栏需要的暗部：上下两条渐变 + 四角压暗，不是装饰 */
.vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 22%),
    linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.35) 45%, transparent 70%),
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.45));
  transition: opacity 0.6s var(--ease-out);
}
body[data-view='dex'] .scene,
body[data-view='ranking'] .scene {
  filter: blur(22px) brightness(0.42) saturate(0.85);
}
body.is-focus .scene,
body.is-moment .scene {
  filter: none;
}
/* 胶片漏光：SSR 以上翻开时扫过一次 */
.leak {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  background:
    radial-gradient(ellipse at 0% 35%, rgba(255, 128, 48, 0.65), transparent 50%),
    radial-gradient(ellipse at 100% 75%, rgba(255, 214, 140, 0.45), transparent 45%);
}
.leak.go {
  animation: leak 1.8s ease-out;
}
.leak.flash {
  background: #fff;
  mix-blend-mode: normal;
  animation: flash 0.5s ease-out;
}
@keyframes leak {
  20% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translateX(6%);
  }
}
@keyframes flash {
  from {
    opacity: 0.95;
  }
  to {
    opacity: 0;
  }
}

/* ================= 顶栏 ================= */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) var(--gutter) 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  transition:
    opacity 0.5s var(--ease-out),
    transform 0.5s var(--ease-out);
}
.brand {
  font: 900 19px/1 var(--f-sans);
  letter-spacing: 0.18em;
  text-decoration: none;
  white-space: nowrap;
}
.quota {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  white-space: nowrap;
}
.quota b {
  color: var(--ink);
  font-weight: 700;
}
.nav {
  margin-left: auto;
  display: flex;
  gap: 4px;
}
.nav-link {
  border: 0;
  background: none;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--ink-2);
  font-size: 15px;
  white-space: nowrap;
  text-decoration: underline 1px transparent;
  text-underline-offset: 8px;
  transition:
    color 0.2s,
    text-decoration-color 0.2s;
}
.nav-link:hover {
  color: var(--ink);
}
.nav-link.is-active {
  color: var(--ink);
  font-weight: 700;
  text-decoration-color: var(--ink);
}
/* 语言切换：长得和导航链接一样，只多一个小箭头 */
.lang {
  appearance: none;
  font: inherit;
  font-size: 14px;
  padding-right: 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23d9d6cc' stroke-width='1.4'/%3E%3C/svg%3E")
    right 8px center / 9px no-repeat;
}
.lang option {
  color: #111;
}
.count {
  font-size: 12px;
  color: var(--ink-3);
  margin-left: 2px;
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  vertical-align: 0.4em;
  margin-left: 2px;
}

/* ================= 纪录片字幕 ================= */
.caption {
  position: fixed;
  z-index: 10;
  left: var(--gutter);
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--print-w) * 1.4 + 150px);
  width: min(500px, calc(100% - var(--gutter) * 2));
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.65),
    0 2px 18px rgba(0, 0, 0, 0.4);
  transition:
    opacity 0.5s var(--ease-out),
    bottom 0.6s var(--ease-out);
}
body[data-view='dex'] .caption,
body[data-view='ranking'] .caption {
  opacity: 0;
  pointer-events: none;
}
body.is-focus .caption,
body.is-moment .caption {
  opacity: 1;
  pointer-events: auto;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 64px);
}
.caption.swap {
  animation: cap-in 0.7s var(--ease-out);
}
@keyframes cap-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
.cap-where {
  margin: 0 0 6px;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
.cap-name {
  margin: 0;
  font: 900 clamp(30px, 3.6vw, 54px) / 1.05 var(--f-sans);
  letter-spacing: 0.02em;
  text-wrap: balance;
}
.cap-sci {
  margin: 4px 0 10px;
  font: italic 400 clamp(16px, 1.3vw, 19px) / 1.3 var(--f-latin);
  color: var(--ink-2);
}
/* 桌面上有相纸时字幕收小，让出照片；进入现场或 UR 时放大 */
body.is-focus .cap-name,
body.is-moment .cap-name {
  font-size: clamp(34px, 5.2vw, 76px);
}
body.is-focus .cap-sci,
body.is-moment .cap-sci {
  margin: 6px 0 14px;
  font-size: clamp(17px, 1.6vw, 22px);
}
.cap-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--ink-2);
}
.cap-line strong {
  color: var(--ink);
  font-weight: 700;
}
.cap-credit {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink-3);
}
.cap-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 12px;
}
.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--ink-2);
}
.facts dt {
  color: var(--ink-3);
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.cap-hint {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink-3);
}

/* 稀有度材质条：用在字幕、图鉴筛选、规则表 */
.rar {
  display: inline-block;
  padding: 0 7px;
  border-radius: 2px;
  font: 700 12px/1.7 var(--f-sans);
  letter-spacing: 0.08em;
  color: var(--paper-ink);
  text-shadow: none;
  background: var(--paper);
}
.rar-R {
  background: linear-gradient(160deg, #ffffff, #e2e0d8);
}
.rar-SR {
  background: var(--foil-silver);
}
.rar-SSR {
  background: var(--foil-gold);
}
.rar-UR {
  background: var(--foil-holo);
}
.rar-N {
  background: #c9c6bc;
}

/* ================= 开包台 ================= */
main {
  position: relative;
  z-index: 5;
}
.view-pull {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 28px);
  display: grid;
  justify-items: center;
  gap: 22px;
  transition:
    opacity 0.5s var(--ease-out),
    transform 0.6s var(--ease-out);
}
body.is-moment .view-pull,
body.is-moment .top,
body.is-focus .view-pull {
  opacity: 0;
  transform: translateY(40px);
  pointer-events: none;
}
body.is-moment .top {
  transform: translateY(-20px);
}
.table {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(10px, 1.6vw, 24px);
  min-height: calc(var(--print-w) * 1.4);
  perspective: 1400px;
}
.pull-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 22px;
}
.status {
  margin: 0;
  width: 100%;
  text-align: center;
  min-height: 1.5em;
  font-size: 13px;
  color: var(--ink-2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.status.is-error {
  color: var(--danger);
}

.btn-pack {
  border: 0;
  border-radius: 3px;
  padding: 13px 38px;
  background: var(--paper);
  color: var(--paper-ink);
  font: 700 16px/1 var(--f-sans);
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow:
    0 10px 24px -10px rgba(0, 0, 0, 0.7),
    0 1px 2px rgba(0, 0, 0, 0.4);
  transition:
    transform 0.2s var(--ease-out),
    box-shadow 0.2s;
}
.btn-pack:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 16px 30px -12px rgba(0, 0, 0, 0.75),
    0 2px 4px rgba(0, 0, 0, 0.4);
}
.btn-pack:active:not(:disabled) {
  transform: translateY(0);
}
.btn-pack:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-text {
  border: 0;
  background: none;
  padding: 4px 2px;
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
  text-decoration: underline 1px var(--rule);
  text-underline-offset: 5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.btn-text:hover {
  text-decoration-color: currentColor;
}
.btn-danger {
  color: var(--danger);
}

/* ================= 相纸 ================= */
.print {
  position: relative;
  width: var(--print-w);
  aspect-ratio: 5 / 7;
  flex: none;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
  perspective: 900px;
  --rx: 0deg;
  --ry: 0deg;
  --gx: 50%;
  --gy: 30%;
  transition:
    filter 0.4s,
    transform 0.4s var(--ease-out);
}
.print-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.55s var(--ease-out);
}
.print.is-flipped .print-inner {
  transform: rotateX(var(--rx)) rotateY(calc(180deg + var(--ry)));
}
.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 3px;
  overflow: hidden;
  box-shadow:
    0 22px 34px -16px rgba(0, 0, 0, 0.75),
    0 2px 5px rgba(0, 0, 0, 0.45);
}
/* 背面：相纸背印。SR 以上的边缘透出材质，是开之前唯一的预告 */
.back {
  background-color: var(--paper-back);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  color: rgba(27, 29, 26, 0.38);
  border: 4px solid transparent;
}
.back-mark {
  font: 900 13px/1 var(--f-sans);
  letter-spacing: 0.3em;
}
.back-sub {
  font: 500 8px/1 var(--f-sans);
  letter-spacing: 0.24em;
}
.print.r-SR .back {
  border-image: var(--foil-silver) 1;
}
.print.r-SSR .back {
  border-image: var(--foil-gold) 1;
}
.print.r-UR .back {
  border-image: var(--foil-holo) 1;
}
/* 正面：白边相片 + 下方印字 */
.front {
  transform: rotateY(180deg);
  background: var(--paper);
  color: var(--paper-ink);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: 6px 6px 0;
}
.print.r-SR .front {
  background: var(--foil-silver);
}
.print.r-SSR .front {
  background: var(--foil-gold);
}
.print.r-UR .front {
  background: var(--foil-holo);
  background-size: 300% 300%;
  animation: holo-pan 8s linear infinite;
}
.photo {
  position: relative;
  overflow: hidden;
  background: #3a3d38;
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo.no-photo::after {
  content: attr(data-alt);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  text-align: center;
  font-size: 11px;
  color: var(--ink-3);
}
.print-label {
  display: grid;
  gap: 1px;
  padding: 6px 2px 7px;
  min-width: 0;
  background: var(--paper);
  margin: 0 -6px;
  padding-inline: 8px;
}
.print-name {
  font: 700 12px/1.3 var(--f-sans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.print-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--paper-ink-2);
}
.print-meta .rar {
  flex: none;
  font-size: 9px;
  padding: 0 5px;
  line-height: 1.6;
}
/* 国名在别的语言里可能很长（Estados Unidos），一行放不下就省略 */
.print-meta > span:last-child {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 光面、镭射的反光跟着指针走 */
.glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  background: radial-gradient(circle at var(--gx) var(--gy), rgba(255, 255, 255, 0.55), transparent 55%);
  mix-blend-mode: soft-light;
}
.print.r-R .glare,
.print.r-SR .glare,
.print.r-SSR .glare {
  opacity: 0.55;
}
.print.r-UR .glare {
  opacity: 0.9;
  background:
    radial-gradient(circle at var(--gx) var(--gy), rgba(255, 255, 255, 0.6), transparent 50%),
    linear-gradient(115deg, rgba(255, 154, 198, 0.35), rgba(157, 243, 196, 0.35), rgba(143, 211, 255, 0.35));
  mix-blend-mode: overlay;
}
.dupe {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 2;
  min-width: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--paper-ink);
  font: 700 11px/22px var(--f-sans);
  text-align: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}

/* 没翻的沉在后面：更暗、更低 */
.table .print:not(.is-flipped) {
  filter: brightness(0.82);
  transform: translateY(8px) scale(0.97);
}
.table .print:not(.is-flipped):hover {
  filter: brightness(0.95);
  transform: translateY(0) scale(1);
}
.table .print.is-current {
  transform: translateY(-14px);
}
.print.is-loading {
  cursor: progress;
}

/* 一摞：开包前的样子 */
.stack {
  position: relative;
  width: var(--print-w);
  aspect-ratio: 5 / 7;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}
.stack:disabled {
  cursor: progress;
}
.stack .print {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.stack .print:nth-child(1) {
  transform: rotate(-5deg) translate(-6px, 4px);
}
.stack .print:nth-child(2) {
  transform: rotate(3deg) translate(5px, 2px);
}
.stack .print:nth-child(3) {
  transform: rotate(-2deg);
}
.stack .print:nth-child(4) {
  transform: rotate(4deg) translate(2px, -2px);
}
.stack .print:nth-child(5) {
  transform: rotate(-0.5deg) translateY(-4px);
}
.stack.is-searching .print:nth-child(5) {
  animation: lift 1.6s ease-in-out infinite;
}
@keyframes lift {
  50% {
    transform: rotate(1deg) translateY(-14px);
  }
}
.stack.is-ready {
  animation: settle 0.5s var(--ease-out);
}
.stack.is-ready:hover .print:nth-child(5) {
  transform: rotate(-0.5deg) translateY(-12px);
}
@keyframes settle {
  40% {
    transform: translateY(-6px);
  }
}

/* 发牌：从那一摞的位置落到各自位置 */
.print.dealt {
  animation: deal 0.7s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}
@keyframes deal {
  from {
    transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--rot, -4deg));
  }
}

/* ================= 图鉴 / 对战：照片墙 ================= */
.view-wall {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top, 0px) + 96px) var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 80px);
  transition: opacity 0.5s var(--ease-out);
}
body.is-focus .view-wall {
  opacity: 0;
  pointer-events: none;
}
.wall-head {
  display: grid;
  gap: 10px;
  max-width: 70ch;
  margin-bottom: 36px;
}
.wall-head h1 {
  margin: 0;
  font: 900 clamp(34px, 4.6vw, 60px) / 1.05 var(--f-sans);
  letter-spacing: 0.04em;
}
.wall-stats {
  margin: 0;
  color: var(--ink-2);
  font-size: 15px;
}
.wall-stats strong {
  color: var(--ink);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 6px;
}
.filter {
  border: 0;
  background: none;
  padding: 2px 0;
  cursor: pointer;
  color: var(--ink-3);
  font-size: 14px;
  text-decoration: underline 1px transparent;
  text-underline-offset: 6px;
}
.filter[aria-pressed='true'] {
  color: var(--ink);
  font-weight: 700;
  text-decoration-color: var(--ink);
}
.filter small {
  margin-left: 3px;
  font-size: 12px;
  color: var(--ink-3);
}
.wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--print-w), 1fr));
  gap: clamp(22px, 3vw, 40px) clamp(16px, 2.4vw, 32px);
  justify-items: center;
}
.wall .print {
  width: 100%;
  max-width: 200px;
  transform: rotate(var(--tilt, 0deg));
}
.wall .print:hover {
  transform: rotate(0deg) translateY(-6px);
}
.wall .print[aria-pressed='true'] {
  outline: 2px solid var(--ink);
  outline-offset: 6px;
  transform: rotate(0deg) translateY(-6px);
}
.empty {
  grid-column: 1 / -1;
  justify-self: start;
  max-width: 50ch;
  color: var(--ink-2);
}
.wall-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  margin-top: 48px;
}
.confirm {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  color: var(--ink-2);
  font-size: 14px;
}

/* ================= 侧边抽屉：账号 / 规则 ================= */
.sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(400px, 100%);
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 0px) + 22px) 28px 28px;
  background: rgba(11, 13, 11, 0.86);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: -24px 0 48px -24px rgba(0, 0, 0, 0.8);
  animation: sheet-in 0.45s var(--ease-out);
}
@keyframes sheet-in {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-head h2 {
  margin: 0;
  font: 900 24px/1.2 var(--f-sans);
  letter-spacing: 0.04em;
}
.sheet-note {
  margin: 6px 0 18px;
  color: var(--ink-3);
  font-size: 13px;
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.icon-btn:hover {
  background: rgba(245, 243, 236, 0.1);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
  stroke: var(--ink);
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
}
.rules h3 {
  margin: 26px 0 8px;
  font: 700 15px var(--f-sans);
}
.rules p {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 14px;
}
.rules table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rules th,
.rules td {
  text-align: left;
  padding: 7px 8px 7px 0;
  border-top: 1px solid rgba(245, 243, 236, 0.14);
  vertical-align: top;
}
.rules th {
  color: var(--ink-3);
  font-weight: 400;
}

/* UR 时刻的提示 */
.moment-hint {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  transform: translateX(-50%);
  z-index: 15;
  font-size: 13px;
  color: var(--ink-2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  animation: cap-in 0.8s 1s var(--ease-out) both;
}

/* 只看照片：界面全部退开，只留拍摄者和许可证 */
body.is-bare .top,
body.is-bare .view-pull,
body.is-bare .view-wall {
  opacity: 0;
  pointer-events: none;
}
body.is-bare .vignette {
  opacity: 0.35;
}
body.is-bare .caption {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  pointer-events: none;
}
body.is-bare .caption > :not(.cap-credit) {
  display: none;
}
body.is-bare .cap-credit {
  margin: 0;
}

/* 粒子画布 */
.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
}

/* ================= 窄屏 ================= */
@media (max-width: 720px) {
  :root {
    --print-w: 30vw;
  }
  .top {
    flex-wrap: wrap;
    gap: 2px 12px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
  }
  .nav {
    margin-left: -10px;
    width: calc(100% + 20px);
    overflow-x: auto;
  }
  .nav-link {
    font-size: 14px;
    padding: 4px 8px;
  }
  .table {
    justify-content: flex-start;
    width: calc(100% + var(--gutter) * 2);
    padding: 20px var(--gutter) 0;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }
  .table .print {
    scroll-snap-align: center;
  }
  .table:has(.stack) {
    justify-content: center;
  }
  .caption {
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--print-w) * 1.4 + 160px);
  }
  .cap-name {
    font-size: clamp(30px, 9vw, 44px);
  }
}

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

/* 放大镜：圆形镜片，金属细边，显示原图细节 */
.loupe {
  --r: 120px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 35;
  width: calc(var(--r) * 2);
  height: calc(var(--r) * 2);
  border-radius: 50%;
  pointer-events: none;
  background-color: #151714;
  background-repeat: no-repeat;
  border: 3px solid rgba(232, 230, 222, 0.92);
  box-shadow:
    0 22px 44px -14px rgba(0, 0, 0, 0.75),
    0 3px 8px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(0, 0, 0, 0.35),
    inset 0 -18px 30px -18px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity 0.18s ease-out;
  will-change: transform;
}
.loupe.is-on {
  opacity: 1;
}
body.is-loupe-scene {
  cursor: none;
}

@keyframes holo-pan {
  to {
    background-position: 200% 0;
  }
}

/* ================= 排行榜 ================= */
.ranking-me {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 15px;
}
.ranking-me strong {
  color: var(--ink);
}
.ranking {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 980px;
}
.rank-row {
  display: grid;
  grid-template-columns: 3.2ch 56px minmax(0, 1fr) auto 8ch;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
  border-top: 1px solid rgba(245, 243, 236, 0.14);
}
.rank-row.is-me {
  background: linear-gradient(to right, rgba(245, 243, 236, 0.1), transparent 70%);
}
.rank-no {
  font: 900 26px/1 var(--f-sans);
  text-align: right;
  color: var(--ink-2);
}
.rank-row:nth-child(-n + 3) .rank-no {
  color: var(--ink);
  font-size: 34px;
}
/* 每个人最稀有的那张，缩成一张小相纸 */
.rank-print {
  display: block;
  width: 56px;
  aspect-ratio: 5 / 7;
  padding: 3px 3px 10px;
  background: var(--paper);
  border-radius: 2px;
  box-shadow:
    0 10px 18px -10px rgba(0, 0, 0, 0.8),
    0 1px 3px rgba(0, 0, 0, 0.45);
  transform: rotate(-2deg);
}
.rank-print.r-SR {
  background: var(--foil-silver);
}
.rank-print.r-SSR {
  background: var(--foil-gold);
}
.rank-print.r-UR {
  background: var(--foil-holo);
}
.rank-print img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rank-who {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.rank-name {
  font: 700 18px/1.3 var(--f-sans);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-best {
  font-size: 13px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-counts {
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
}
.rank-score {
  font: 900 24px/1 var(--f-sans);
  text-align: right;
}
.ranking .empty {
  padding: 14px 0;
  border-top: 1px solid rgba(245, 243, 236, 0.14);
}

/* ================= 账号表单 ================= */
.auth-form {
  display: grid;
  gap: 6px;
  margin: 8px 0 16px;
}
.auth-form label {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink-2);
}
.auth-form input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(245, 243, 236, 0.28);
  border-radius: 3px;
  background: rgba(245, 243, 236, 0.06);
  color: var(--ink);
  font: 400 15px var(--f-sans);
  caret-color: var(--ink);
}
.auth-form input:focus {
  outline: none;
  border-color: var(--ink);
  background: rgba(245, 243, 236, 0.1);
}
.auth-form .btn-pack {
  margin-top: 6px;
  justify-self: start;
}
.form-msg {
  min-height: 1.5em;
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-2);
}
.form-msg.is-error {
  color: var(--danger);
}
.account-name {
  margin: 8px 0 0;
  font: 900 26px/1.2 var(--f-sans);
}
.account-score {
  color: var(--ink-2);
  font-size: 14px;
}
.account-score strong {
  color: var(--ink);
}
.account-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 14px;
}
.sheet code {
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(245, 243, 236, 0.1);
}

@media (max-width: 720px) {
  .rank-row {
    grid-template-columns: 3ch 44px minmax(0, 1fr) auto;
    gap: 12px;
  }
  .rank-counts {
    display: none;
  }
  .rank-print {
    width: 44px;
  }
}
