/* Only collection-specific controls override the original paper-and-foil layout. */
html.tab-layout,
html.tab-layout body {
  height: 100%;
  overflow: hidden;
}
html.tab-layout .frame {
  height: 100svh;
}
.frame {
  height: auto;
  min-height: 100svh;
  padding-bottom: env(safe-area-inset-bottom);
}
.topbar {
  height: 54px;
  padding-top: env(safe-area-inset-top);
}
.topbar .wordmark {
  font-size: 13px;
  color: #685b65;
  letter-spacing: 0.12em;
}
.icon-button {
  min-width: 42px;
  min-height: 42px;
}
.intro {
  padding-top: 10px;
}
.tagline,
#packHint {
  color: #706670;
  letter-spacing: 0.05em;
}
.site-stats {
  margin: 6px 0 0;
  color: #8a7d88;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-align: center;
}
.site-stats b {
  color: #685b65;
  font-weight: 750;
}
.site-stats i {
  margin: 0 6px;
  font-style: normal;
  opacity: 0.55;
}
.level-row {
  width: min(74%, 285px);
  margin-top: 14px;
}
#levelInfo {
  order: 3;
}
.stage {
  min-height: clamp(245px, 45svh, 425px);
  flex: 1;
}
.pack-wrap {
  height: clamp(186px, 36svh, 330px);
  max-width: 65vw;
}
.pouch:focus-visible {
  outline: 2px solid var(--gold);
}
.pile-count {
  bottom: 10%;
}
.stage.opening .pack-fallback {
  animation: pack-out 0.5s both;
}
.pack-wrap:has(.pack-fallback) .pack-fallback {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  transition: filter 0.15s;
}
.pack-wrap.torn .pack-fallback {
  clip-path: polygon(
    0 12%,
    var(--tear) 12%,
    var(--tear) 0,
    100% 0,
    100% 100%,
    0 100%
  );
}
#packHint {
  font-size: 13px;
  text-align: center;
  margin: 8px 0 18px;
}
#refill {
  margin: 0 auto 12px;
  min-height: 44px;
}
.shared-dock {
  margin-top: auto;
}
.counter {
  padding: 12px 0 max(14px, env(safe-area-inset-bottom));
}
.result {
  width: min(77vw, 300px, calc(53svh + 10px));
  max-width: 100%;
}
:root {
  --card-back-art: url("../art/clow-card-back.svg");
}
.card-back {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  background: #470c0c var(--card-back-art) center / 100% 100% no-repeat;
  border: none;
  color: #e8bc5c;
}
.card-back svg {
  display: none;
}
/* 堆叠纸张与卡背共用库洛牌矢量卡背，露出边角时延续暗红烫金框纹。 */
.stack-sheet {
  background: #470c0c var(--card-back-art) center / 100% 100% no-repeat;
}
.result-bar {
  height: 55px;
}
.back [data-icon="back"] {
  transform: rotate(180deg);
}
.history-summary {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid #dfd8cb;
  border-radius: 10px;
  background: #faf8f4;
  font-size: 12px;
  color: #685b65;
}
.history-summary b {
  color: #2f262d;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 62px;
  padding: 8px 4px;
  border-bottom: 1px solid #cfc8ba;
  text-align: left;
}
.history-thumb {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  flex: none;
  overflow: hidden;
  display: grid;
  place-items: end center;
  background: #e6e5db url("../art/courtyard.svg") center bottom / cover no-repeat;
}
.history-thumb .sprite {
  width: 38px;
  height: 38px;
}
.history-thumb[data-art-style="portrait"] {
  background: linear-gradient(180deg, #f8f5ee 0%, #ebe5d8 100%);
  display: block;
}
.history-thumb[data-art-style="portrait"] .sprite {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--fx, 50%) var(--fy, 16%);
}
.history-info {
  min-width: 0;
  flex: 1;
}
.history-info b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item small {
  display: block;
  color: #706670;
}
.history-item em {
  margin-left: auto;
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}
.history-item em.first {
  color: #8f6415;
  font-weight: 600;
}
.history-item em.dup {
  color: #6b6169;
}
.empty {
  grid-column: 1/-1;
  padding: 30px 15px;
  text-align: center;
}
.rates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.rates .rarity {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11.5px;
}
.rates .rarity b {
  color: inherit;
  letter-spacing: 0.04em;
}
.dialog-head {
  position: relative;
}
.dialog-head h2 {
  order: 1;
}
.dialog-head:after {
  order: 2;
}
.dialog-close {
  order: 3;
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid #221b251c;
  background: #ffffffc8;
  color: #5b5259;
  cursor: pointer;
}
.dialog-close svg {
  width: 15px;
  height: 15px;
}
.dialog-close:active {
  transform: scale(0.92);
}
#warning {
  font-size: 13px;
  color: #765817;
}
#dialog .claim {
  margin: 10px auto;
  display: block;
}
.result .cta-row {
  position: relative;
  z-index: 4;
  margin: 10px 0 8px;
}
.result .cta-row .primary {
  box-shadow:
    0 1px 0 #ffffff33 inset,
    0 8px 20px -6px rgba(18, 12, 32, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.14);
}
html[data-theme="dark"] .result .cta-row .primary {
  box-shadow:
    0 1px 0 #ffffff24 inset,
    0 10px 24px -6px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(242, 198, 109, 0.24);
}
@media (max-width: 640px) {
  .result-bar {
    height: 34px;
    margin-bottom: 4px;
  }
  .result .cta-row {
    margin: 8px 0 6px;
  }
  .result .cta-row .primary {
    min-height: 44px;
    height: 44px;
  }
  .alt-art-row {
    margin: 6px 0 4px;
    gap: 4px;
  }
  .result-feedback-row {
    margin-top: 6px;
  }
  /* 主界面移动端紧凑比例：确保 375×667 小屏下标题、卡包、托盘与「连开 5 包」完全位于底栏上方无遮挡 */
  #homeView .intro {
    margin: 2px 0 4px;
  }
  #homeView .intro h1 {
    font-size: 24px;
    line-height: 1.15;
    margin: 0;
  }
  #homeView .intro .tagline {
    margin: 2px 0 0;
    font-size: 12px;
    line-height: 1.3;
  }
  #homeView .level-row {
    margin: 4px auto 4px;
  }
  #homeView .stage {
    flex: 0 1 auto;
    min-height: 162px;
    height: clamp(160px, 24dvh, 230px);
  }
  #homeView .pack-wrap {
    height: clamp(140px, 21dvh, 200px);
  }
  #homeView #packHint {
    margin: 2px 0 4px;
    font-size: 12px;
  }
  #homeView .tray-wrap {
    margin: 2px 0 4px;
  }
  #homeView .tray-shell {
    padding: 8px 4px 10px;
  }
  #homeView .tray {
    min-height: 0;
    align-items: center;
    gap: 8px;
  }
  #homeView .tray-pack {
    width: 66px;
    padding: 6px 5px 5px;
  }
  #homeView .tray-art {
    width: 34px;
    height: 49px;
  }
  #homeView .tray-thumb {
    width: 100%;
    height: 100%;
  }
  #homeView .home-actions {
    margin: 2px 0 6px;
  }
  #homeView .batch-btn {
    min-height: 34px;
    padding: 5px 18px;
    font-size: 12.5px;
  }
}
.binder {
  padding-bottom: 16px;
}
.entry-icon svg {
  width: 20px;
  height: 20px;
}
@media (max-height: 570px) {
  .stage {
    min-height: 230px;
  }
  .pack-wrap {
    height: 175px;
  }
  .result {
    width: min(280px, 80vw);
  }
  .frame {
    height: auto !important;
  }
  .shared-dock {
    position: relative;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* The imported card, radar and binder layout use the same pixel portrait. */
.result {
  width: min(91vw, 340px);
}
/* 卡面高度统一锁 520px（常规卡与满画卡同高），所有稀有度、所有卡完全一致。
   改造前常规卡高度由内容撑出（实测 652 / 672 / 690 三种，差 38px，根因是名字与
   作品名换行），且「都瑠璃子」这类作品名过长的卡会溢出到 721px。
   先试过 468px（满画卡原本的高度），但常规卡的档案区装不下（内容 329px > 可用
   282px，天赋标签被裁），所以抬到 520px 让内容完整显示。
   高度定义只此一处（--card-height），满画卡与移动端媒体查询都引用它，改一处全跟着变。
   注意不能用 --card-h：original.css 的 .card.UR{--card-h:110cqi} 已经占用那个名字
   （UR 演出动画 ur-rise 的位移用），复用会让 UR 卡高变成 429px。 */
:root {
  --card-height: 556px;
}
@media (max-width: 640px) {
  :root {
    --card-height: clamp(420px, calc(100dvh - 220px), 556px);
  }
}
.card {
  aspect-ratio: auto;
  min-height: 0;
  height: var(--card-height);
}
.card .card-inner:not(.full-art) {
  height: 100%;
  /* 兜底：高度锁死后任何内容都不许把卡片撑破，超出的走内部滚动而不是溢出到卡外。 */
  overflow: hidden;
}
.card-body {
  position: relative;
  /* .card 锁 --card-height 后，.card-body 必须跟着走 100%：它原本高度由内容撑开
     （实测 518px），会把 --card-height 的 .card 撑破。
     不能加 overflow:hidden——远端的 180° 翻面靠 .card-back 在 3D 空间里绕到背面，
     裁掉就看不到卡背了。 */
  height: 100%;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.62s cubic-bezier(0.22, 0.85, 0.3, 1);
}
/* 单卡展示（无多张横滑切卡时）：全图异画卡面与常规卡头图区关闭浏览器滚动接管，
   让手机端手指按住卡面任意拖动即可像 PC 鼠标一样流畅 3D 倾斜与带动闪光；
   常规卡下方 .record 仍保持正常纵滑，按钮/链接保留 touch-action: manipulation。 */
.card.touch-tiltable:has(> .card-body > .card-inner.full-art:not(.show-dossier)),
.card.touch-tiltable .portrait.scene {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
/* 3D 倾斜直接作用在 .card-body 上（不改写外层 #personCard.transform），
   规避 iOS Safari 下 container-type 拍扁 3D 空间，同时与横滑/切卡动画完全解耦。 */
.card.foil-active > .card-body {
  animation: none;
  transition: none;
  transform: rotateY(var(--tilt-ry, 0deg)) rotateX(var(--tilt-rx, 0deg));
}
/* 点击卡面非按钮区域 180° 实体翻面（展示卡背 .card-back，再点翻回正面） */
.card.flipped > .card-body {
  animation: none;
  transform: rotateY(calc(180deg + var(--tilt-ry, 0deg))) rotateX(var(--tilt-rx, 0deg));
}
.card.flipped.foil-active > .card-body {
  transition: transform 0.12s linear;
}
/* 翻面过渡锁定：正→反与反→正双向统一走 0.62s 3D 过渡，
   防止移除 .flipped 时被 sway 动画或 .foil-active 的 transition: none 打断瞬切；
   且保持 rotateY -> rotateX 同序，避免 180° 矩阵插值抖动。 */
.card.flipping > .card-body {
  animation: none !important;
  transition: transform 0.62s cubic-bezier(0.22, 0.85, 0.3, 1) !important;
}
.card.flipping:not(.flipped) > .card-body {
  transform: rotateY(var(--tilt-ry, 0deg)) rotateX(var(--tilt-rx, 0deg));
}
/* 展开档案阅读态时锁平卡面，保证「返回立绘」与天赋/评分按钮绝不因 3D 透视漂移 */
.card:has(.card-inner.show-dossier) > .card-body {
  animation: none;
  transform: none;
}
.card-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.record,
.record-content {
  position: relative;
  overflow: visible;
  height: auto;
}
.record-content {
  display: flex;
  flex-direction: column;
  padding: 7px 11px 8px;
}
/* 常规卡在 --card-height 内分配垂直空间：头图 + 标题条固定，档案区吃掉剩余高度并均匀铺满不溢出。 */
.card-inner:not(.full-art) .record {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}
.card-inner:not(.full-art) .record::-webkit-scrollbar {
  display: none;
}
.card-inner:not(.full-art) .record-content {
  flex: 1 1 auto;
  min-height: 100%;
  justify-content: space-between;
  gap: 4px;
  padding: 7px 11px 8px;
  box-sizing: border-box;
}
.portrait.scene,
.thumb.scene {
  background:
    radial-gradient(ellipse 18% 3% at 50% 90%, #52616d40, transparent),
    linear-gradient(to bottom, transparent 81%, #c9d0d4 81%, #e1e5e6),
    linear-gradient(145deg, #f3f4f2, #d7dfe1);
  display: grid;
  place-items: end center;
}
.portrait.scene {
  position: relative;
  width: 100%;
  /* 卡高收紧后头图不再用 clamp(130px,21svh,176px)，改为固定值。
     角色头图保持完整可见，只是整体更紧凑。 */
  height: 150px;
  flex: none;
}
.sprite {
  image-rendering: pixelated;
  object-fit: contain;
  width: 128px;
  height: 128px;
  max-height: 100%;
}
.thumb .sprite {
  width: 64px;
  height: 64px;
}
.record .attributes {
  height: 150px;
  min-height: 150px;
  flex: none;
}
/* 数值区排版：锁定与 SVG viewBox (240:160 = 3:2) 一致的宽高比，确保雷达六边形舒展对称，不会因高度紧凑被横向拉宽。 */
.card-inner:not(.full-art) .record .attributes {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 118px;
  max-height: 144px;
  height: auto;
  margin: 1px 0;
}
.card-inner:not(.full-art) .record .radar {
  width: auto;
  height: 100%;
  max-width: 216px;
  max-height: 142px;
  aspect-ratio: 3 / 2;
  padding: 2px 0;
  margin: 0 auto;
  box-sizing: border-box;
}
.card-inner:not(.full-art) .record .radar svg {
  transform: none;
  transform-origin: center;
}
.card-inner:not(.full-art) .record .radar-label[data-attribute="0"] {
  top: 5% !important;
}
.card-inner:not(.full-art) .record .radar-label[data-attribute="3"] {
  top: 95% !important;
}
.card-inner:not(.full-art) .radar-label {
  min-width: 34px;
  min-height: 20px;
  gap: 0;
}
.card-inner:not(.full-art) .radar-label span:first-child {
  font-size: 9.5px;
  line-height: 1.1;
}
.card-inner:not(.full-art) .radar-label b {
  font-size: 1.14em;
  line-height: 1.05;
}
.tags-heading {
  justify-content: space-between;
}
.tags-heading small {
  font-size: 11px;
  font-weight: 400;
}
.tier-filter button[aria-pressed="true"] {
  outline: 2px solid #4a3d46;
  outline-offset: 2px;
}
.binderList .empty,
.binder-list .empty {
  grid-column: 1/-1;
}
.binder-portrait-meta {
  pointer-events: none;
}
.scene .serial {
  background: #262333cf;
  border-radius: 4px;
  padding: 2px 5px;
  color: white;
  font: 700 10px system-ui;
}
.scene .sprite {
  align-self: end;
}
.life button,
.card-score {
  cursor: pointer;
}
.card-score {
  color: var(--rd);
}
.record-content .ability-tag {
  min-height: 26px;
}
.record-content .radar-label {
  min-height: 28px;
}
.card .name-row h2 {
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .origin {
  min-height: 2.8em;
  line-height: 1.45;
  /* 3 行 × 1.45em = 4.35em，给 4.6em 封顶避免第 3 行（如「动画角色」）被半截裁切 */
  max-height: 4.6em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.card .origin-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
}
.card .origin-seg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.card .wish {
  min-height: 3.1em;
}
.card .tag-row {
  min-height: 60px;
  align-content: flex-start;
}
/* 卡高收紧后压缩档案区的固定最小高度，给数值区腾出空间。
   tag-row 原先 min-height:60px 是为「三行天赋」预留的，但实测绝大多数卡只有一行
   （标签行高 26px），空着的 34px 会把内容顶出卡外。改为按内容自然撑高。
   注意选择器：.card 是 .card-inner 的祖先而非后代，不能写成
   `.card-inner:not(.full-art) .card .wish`（那样规则永远不会命中）。 */
/* 常态卡档案文字区整体排版优化：
   1. .origin 取消 -webkit-line-clamp 截断，双行各自稳固展示，作品名超长时单行省略不挤换行；
   2. .wish 增加柔和引文底色与左侧强调线，拉开信息层次；
   3. .tag-row 改为两列规整网格并释放底部裁切，确保 1~4 个天赋全部清晰可点。 */
.card-inner:not(.full-art) .origin {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10.5px;
  line-height: 1.35;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding-bottom: 4px;
  border-bottom: 1px dashed rgba(122, 90, 42, 0.22);
  overflow: visible;
}
.card-inner:not(.full-art) .origin-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
.card-inner:not(.full-art) .origin-row .origin-seg {
  flex: 0 0 auto;
  white-space: nowrap;
}
.card-inner:not(.full-art) .origin-row:last-child .origin-seg:first-child {
  flex: 0 1 auto;
  min-width: 0;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-inner:not(.full-art) .staff-tag {
  padding: 0 5px;
  font-size: 9.5px;
  line-height: 1.4;
  vertical-align: middle;
}
.card-inner:not(.full-art) .wish {
  font-size: 11px;
  line-height: 1.34;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 4px 8px;
  border-left: 2.5px solid rgba(150, 103, 44, 0.68);
  border-radius: 0 6px 6px 0;
  background: rgba(150, 103, 44, 0.065);
  display: block;
  overflow: hidden;
}
.card-inner:not(.full-art) .wish b {
  display: block;
  font-size: 9.5px;
  line-height: 1.2;
  letter-spacing: 0.14em;
  margin-bottom: 1px;
}
.card-inner:not(.full-art) .wish .wish-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 2.7em;
  overflow-wrap: anywhere;
}
.card-inner:not(.full-art) .tags-heading {
  margin: 0;
  padding-top: 3px;
  border-top: 1px dashed rgba(122, 90, 42, 0.2);
  font-size: 11px;
  align-items: center;
}
.card-inner:not(.full-art) .tag-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 24px;
  max-height: none;
  margin-top: 0;
  overflow: visible;
  gap: 4px 6px;
}
.card-inner:not(.full-art) .tag-row .ability-tag,
.card-inner:not(.full-art) .tag-row .ability-more {
  min-height: 24px;
  height: 24px;
  padding: 0 7px;
  font-size: 11px;
  justify-content: center;
}
/* —— 标题条：稀有度 + 名称 + 评分，固定在头图底部 ——
   改造前这三样在档案区顶部占一整行；移到底部后头图与标题成为一个整体，
   档案区可以专注「出处 / 愿望 / 数值 / 天赋」。
   高度用 --titlebar-h 变量，头图与编号都据此留出空间，避免互相遮盖。
   不要给标题条加背景：文字直接压在头图上才是原意，加渐变会把角色头图下半部分
   整片盖掉（先前 55%→90% 的深色渐变就是这个问题）。
   可读性靠 text-shadow 的多层描边阴影保证，不依赖背景。 */
.card-inner:not(.full-art) .portrait.scene {
  --titlebar-h: 46px;
}
.card-titlebar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: var(--titlebar-h, 46px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: #fffdf7;
  background: none;
  /* 多层描边阴影：白字压在任意亮度的插画上都可读，不需要背景垫底 */
  text-shadow:
    0 0 2px rgba(0, 0, 0, 0.95),
    0 1px 2px rgba(0, 0, 0, 0.9),
    0 2px 6px rgba(0, 0, 0, 0.75),
    0 0 12px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.card-titlebar > * {
  pointer-events: auto;
}
.card-titlebar h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 18px;
  line-height: 1.15;
  font-weight: 750;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-titlebar .card-score {
  flex: none;
  align-self: center;
  font-size: 21px;
  line-height: 1;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  color: #ffe9a6;
  border-bottom: 2px dotted rgba(255, 233, 166, 0.5);
  text-shadow: inherit;
}
/* 编号移到头图左上角：标题条现在无背景、直接压在头图底部，
   编号若留在左下角会和稀有度徽章重叠。 */
.card-inner:not(.full-art) .portrait-meta {
  top: 8px;
  bottom: auto;
  left: 10px;
}
/* 标题条已无背景（文字直接压在头图上），所以角色图不必再为它让出高度，
   恢复完整 168px。原先为避让标题条而做的 bottom/height 缩减会让头图下半截变窄。 */
.card-inner:not(.full-art) .portrait.scene[data-art-style="portrait"] .sprite,
.card-inner:not(.full-art) .scene[data-crop="face"] .sprite,
.card-inner:not(.full-art) .scene[data-focus] .sprite {
  bottom: 0;
  height: 100%;
}
/* 满画卡同样不加背景：文字直接压在插画上，可读性由 .card-titlebar 的多层描边阴影保证。
   这里只补一层更重的阴影，因为满画插画可能整片是亮色。 */
.card-inner.full-art .card-titlebar {
  background: none;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 1),
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 2px 8px rgba(0, 0, 0, 0.85),
    0 0 16px rgba(0, 0, 0, 0.6);
}
.binder-card {
  contain: layout style paint;
}
.binder-card .binder-meta strong,
.binder-card .binder-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-body .scene,
.record {
  transform: translateZ(0.2px);
}

.card .portrait.scene {
  width: auto;
}
.record .attributes {
  height: auto;
  min-height: 0;
  margin: 6px 0;
}
.record .radar {
  max-width: 260px;
}
.scene img {
  filter: none;
}
#dialogBody p {
  overflow-wrap: anywhere;
}
#shareButton {
  min-height: 42px;
}
.card-inner .specimen {
  box-sizing: border-box;
}
/* 预选功能：分级原立绘风格（SSR/UR 满画全图背景卡 + R/SR 自动裁脸特写卡） */
.portrait.scene[data-art-style="portrait"],
.thumb.scene[data-art-style="portrait"] {
  position: relative;
  display: block;
  overflow: hidden;
  background: linear-gradient(160deg, #f6f3eb 0%, #e7e0d2 100%);
  isolation: isolate;
}
.portrait.scene[data-art-style="portrait"] {
  /* 520px 卡高下头图给足 208px（内宽 ~297px 对应 480×320 head 原图 3:2 比例），
     完整展现 head 原图同时消除天赋下方大块留白。 */
  height: 208px;
  flex: 0 0 208px;
  padding: 0;
  box-sizing: border-box;
}
/* 常规非异画卡面头图长按预览原立绘：禁止系统弹出保存菜单或误选文字 */
.card-inner:not(.full-art) .portrait.scene {
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
.card-inner:not(.full-art) .portrait.scene img {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.thumb.scene[data-art-style="portrait"] {
  aspect-ratio: 168 / 112;
  height: auto;
}
.scene[data-crop="face"] .sprite,
.scene[data-focus] .sprite,
.portrait.scene[data-art-style="portrait"] .sprite,
.thumb.scene[data-art-style="portrait"] .sprite {
  position: absolute;
  inset: 0;
  z-index: 1;
  image-rendering: auto;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: var(--fx, 50%) var(--fy, 16%);
}
.scene[data-art-style="portrait"] .portrait-meta,
.scene[data-art-style="full-art"] .portrait-meta {
  z-index: 4;
}

/* SSR / UR：宝可梦 PTCG 全图金闪风格（默认满画展面 + 点击查看完整档案） */
.card-inner.full-art {
  position: relative;
  /* 满画卡与常规卡同高（--card-height），两种形态切卡时 stage 不跳。 */
  height: var(--card-height);
  min-height: var(--card-height);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  isolation: isolate;
  background: #1b1723;
}
.card-inner.full-art > .card-full-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--fx, 50%) var(--fy, 16%);
  pointer-events: none;
}
/* Danbooru 3:4 满画竖图：顶部锚定偏上，矮屏下优先保住角色头部不被顶边切掉 */
.card-inner.full-art > .card-full-art[data-no-crop] {
  object-position: var(--fx, 50%) var(--fy, 4%);
}
.card-inner.full-art::before {
  z-index: 6;
  box-shadow:
    inset 0 0 0 2px rgba(244, 210, 122, 0.72),
    inset 0 0 18px rgba(255, 224, 140, 0.28);
}
.card-inner.full-art .portrait.scene[data-art-style="full-art"] {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  margin: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.card-inner.full-art .portrait.scene[data-art-style="full-art"]::after {
  display: none;
}
.card-inner.full-art .portrait-meta {
  inset: 10px 10px auto;
  bottom: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  width: calc(100% - 20px);
}
.card-inner.full-art .serial {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dossier-switch {
  pointer-events: auto;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 232, 168, 0.72);
  background: rgba(25, 20, 34, 0.68);
  color: #ffe9b3;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
/* 右上角动作区：「换一张」+「查看档案」。两个按钮共用 dossier-switch 的胶囊样式，
   只把「换一张」压暗一点，避免和主操作抢注意力。 */
.card-inner.full-art .portrait-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
  align-items: center;
}
.banner-switch {
  pointer-events: auto;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 232, 168, 0.42);
  background: rgba(25, 20, 34, 0.52);
  color: rgba(255, 233, 179, 0.86);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.banner-switch:active {
  background: rgba(25, 20, 34, 0.78);
}
/* 插画出处在左下角：Danbooru 的画师与帖子链接。
   字号压到 10px 并加半透明底，不遮插画主体，但点击能追溯原图。 */
.banner-credit {
  position: absolute;
  left: 10px;
  bottom: calc(var(--titlebar-h, 46px) + 8px);
  z-index: 4;
  max-width: calc(100% - 20px);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(25, 20, 34, 0.5);
  color: rgba(255, 245, 224, 0.82);
  font-size: 10px;
  line-height: 1.5;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.card-inner.full-art.show-dossier .banner-credit,
.card-inner.full-art.show-dossier .banner-pager {
  display: none;
}
.portrait:has(.banner-pager) .banner-credit {
  max-width: calc(100% - 96px);
}
/* 异画多图指示器：替代旧「换一张」按钮，提示玩家左右滑动切换异画 */
.banner-pager {
  position: absolute;
  right: 10px;
  bottom: calc(var(--titlebar-h, 46px) + 8px);
  z-index: 4;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(25, 20, 34, 0.52);
  border: 1px solid rgba(255, 232, 168, 0.32);
  color: rgba(255, 245, 224, 0.9);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.banner-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 245, 224, 0.48);
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.banner-dot.owned {
  background: rgba(255, 245, 224, 0.72);
}
.banner-dot.locked {
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 245, 224, 0.42);
}
.banner-dot.active {
  background: #ffe9b3;
  transform: scale(1.25);
}
.banner-pager-num {
  margin-left: 2px;
}
/* 左右滑切换异画时的轻快滑入过渡 */
.card-full-art.banner-enter-next {
  animation: banner-slide-next 220ms cubic-bezier(0.22, 0.85, 0.32, 1) both;
}
.card-full-art.banner-enter-prev {
  animation: banner-slide-prev 220ms cubic-bezier(0.22, 0.85, 0.32, 1) both;
}
@keyframes banner-slide-next {
  from {
    opacity: 0.38;
    transform: translate3d(18px, 0, 0) scale(1.02);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}
@keyframes banner-slide-prev {
  from {
    opacity: 0.38;
    transform: translate3d(-18px, 0, 0) scale(1.02);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .card-full-art.banner-enter-next,
  .card-full-art.banner-enter-prev {
    animation: none;
  }
}
.card-inner.full-art {
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
.ptcg-caption {
  position: relative;
  z-index: 3;
  margin-top: auto;
  padding: 12px 14px 14px;
  color: #fffdf7;
  background: none;
  text-shadow:
    0 1px 2px rgba(10, 8, 16, 0.9),
    0 0 8px rgba(10, 8, 16, 0.58);
  transition:
    background-color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}
.ptcg-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ptcg-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 19px;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ptcg-head .card-score {
  color: #ffd97d;
  font-weight: 800;
}
.ptcg-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(255, 248, 232, 0.94);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ptcg-wish {
  margin: 4px 0 0;
  font-size: 11.5px;
  line-height: 1.38;
  max-height: 2.82em;
  color: rgba(255, 236, 186, 0.96);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
  overflow-wrap: anywhere;
}
/* 底部插画偏亮时自动切深色文字 + 柔和浅色描边，无需黑底渐变遮罩 */
.card-inner.full-art[data-caption-tone="light"] .ptcg-caption {
  color: #1b1622;
  text-shadow:
    0 1px 2px rgba(255, 253, 247, 0.94),
    0 0 8px rgba(255, 253, 247, 0.78);
}
.card-inner.full-art[data-caption-tone="light"] .ptcg-sub {
  color: #2c2335;
}
.card-inner.full-art[data-caption-tone="light"] .ptcg-wish {
  color: #5c3e12;
}
.card-inner.full-art[data-caption-tone="light"] .ptcg-head .card-score {
  color: #8a5610;
}
/* 手机端长按满画卡面：文字浮起清晰毛玻璃面板，松手复原 */
.card-inner.full-art.caption-peek .ptcg-caption {
  margin: auto 10px 10px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #fffdf7;
  background: rgba(20, 16, 28, 0.78);
  border: 1px solid rgba(255, 236, 186, 0.28);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  transform: translateY(-4px);
}
.card-inner.full-art.caption-peek .ptcg-sub {
  color: rgba(255, 248, 232, 0.94);
  white-space: normal;
}
.card-inner.full-art.caption-peek .ptcg-wish {
  color: rgba(255, 236, 186, 0.96);
  white-space: normal;
  max-height: none;
  -webkit-line-clamp: unset;
}
.card-inner.full-art .record {
  display: none;
}
.card-inner.full-art.show-dossier .ptcg-caption {
  display: none;
}
.card-inner.full-art.show-dossier .portrait.scene[data-art-style="full-art"] {
  flex: 0 0 86px;
  min-height: 86px;
  height: 86px;
}
.card-inner.full-art.show-dossier .record {
  display: block;
  position: relative;
  z-index: 3;
  background: rgba(250, 247, 239, 0.93);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* 图鉴页 SSR / UR 满画缩略卡 */
.binder-card.full-art {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: #1b1723;
  box-shadow: inset 0 0 0 1.5px rgba(244, 210, 122, 0.65);
}
.binder-card.full-art > .card-full-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--fx, 50%) var(--fy, 16%);
  pointer-events: none;
}
/* 图鉴 1:1 缩略卡展示 Danbooru 3:4 异画时锁顶 0%，保证角色头顶与脸部完整落入上半可见区 */
.binder-card.full-art > .card-full-art[data-no-crop] {
  object-position: var(--fx, 50%) var(--fy, 0%);
}
.binder-card.full-art .binder-open {
  position: relative;
  z-index: 2;
}
.binder-card.full-art .binder-portrait-meta {
  z-index: 3;
}
.binder-card.full-art .thumb.scene[data-art-style="full-art"] {
  display: block;
  aspect-ratio: 168 / 112;
  height: auto;
  margin: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.binder-card.full-art .thumb.scene[data-art-style="full-art"]::after {
  display: none;
}
.binder-card.full-art .binder-meta {
  color: #fffdf7;
  background: none;
  box-shadow: none;
  text-shadow:
    0 1px 2px rgba(10, 8, 16, 0.92),
    0 0 6px rgba(10, 8, 16, 0.62);
}
.binder-card.full-art .binder-meta small {
  color: rgba(255, 238, 194, 0.94);
}
.binder-card.full-art[data-caption-tone="light"] .binder-meta {
  color: #1b1622;
  text-shadow:
    0 1px 2px rgba(255, 253, 247, 0.95),
    0 0 6px rgba(255, 253, 247, 0.8);
}
.binder-card.full-art[data-caption-tone="light"] .binder-meta small {
  color: #3a2d44;
}
.binder-card.full-art .binder-favorite {
  z-index: 4;
  color: rgba(255, 245, 224, 0.88);
  border-color: rgba(255, 232, 168, 0.48);
  background: rgba(25, 20, 34, 0.58);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.binder-card.full-art .binder-favorite[aria-pressed="true"] {
  color: #ff80ab;
  border-color: rgba(255, 143, 180, 0.78);
  background: rgba(45, 18, 34, 0.76);
}
@media (max-height: 740px) {
  .topbar {
    height: 46px;
  }
  .intro {
    padding-top: 2px;
  }
  .intro h1 {
    font-size: clamp(26px, 8.6vw, 40px);
  }
  .tagline {
    margin-top: 3px;
    font-size: 11px;
  }
  .level-row {
    margin-top: 6px;
  }
  .stage {
    min-height: clamp(176px, 31svh, 280px);
  }
  .pack-wrap {
    height: clamp(148px, 27svh, 240px);
  }
  #packHint {
    font-size: 12px;
    margin: 4px 0 8px;
  }
  .tray-wrap {
    margin: 0 0 6px;
  }
  .tray {
    min-height: 68px;
    padding: 4px 8px;
  }
  .counter {
    padding: 6px 0 max(10px, env(safe-area-inset-bottom));
  }
}
@media (max-height: 700px) {
  /* 矮屏已由 #cardStage 的 --card-scale 整体等比缩放，不再把非异画头图压扁到 132px */
  .card-inner.full-art .portrait.scene[data-art-style="full-art"] {
    min-height: 0;
  }
}
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mode-toggle {
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #cfc8ba;
  background: #f6f4ef;
  color: #5b5259;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.mode-toggle[aria-pressed="true"] {
  background: #4a3d46;
  border-color: #4a3d46;
  color: #fff;
}
.home-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 8px;
}
.home-actions[hidden] {
  display: none !important;
}
.batch-btn {
  min-height: 38px;
  padding: 6px 20px;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  background: linear-gradient(180deg, #3a3152, #231c38);
  border: 1px solid rgba(242, 198, 109, 0.45);
  color: #fff4d8;
  box-shadow: 0 6px 14px -6px rgba(25, 18, 42, 0.45);
}
.batch-btn:active {
  transform: scale(0.97);
}
html[data-theme="dark"] .batch-btn {
  background: linear-gradient(180deg, #4b3d6d, #2d2446);
  border-color: rgba(242, 198, 109, 0.55);
  color: #ffeab8;
}
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.dialog-actions .claim {
  margin: 0 !important;
  flex: 1 1 auto;
}
.dialog-actions .danger {
  background: #8f2d36;
  color: #fff;
}
.card {
  transition: transform 0.14s ease-out;
  will-change: transform;
}

/* ==================== P0：等级宝箱 · 卡包托盘 · 市场 ==================== */
.home-entries {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}
.announce {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 52px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  pointer-events: none;
  margin: 0;
  padding: 6px 14px;
  width: fit-content;
  max-width: min(86vw, 340px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  color: #4d4250;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.announce:empty {
  display: none;
}

/* --- 等级条与宝箱 --- */
.level-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.level-bar {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 2px;
  height: 8px;
}
.level-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: #00000014;
  box-shadow: inset 0 1px 0 #ffffff80;
  transition: background 0.25s var(--ease);
}
.level-bar i.on {
  background: linear-gradient(180deg, #ffe6a1, #e8b45a);
}
.level-bar i.on[data-tint="N"] {
  background: linear-gradient(180deg, #e6ebf3, #aab4c6);
}
.level-bar i.on[data-tint="R"] {
  background: linear-gradient(180deg, #8cc0ff, #2f6fe0);
}
.level-bar i.on[data-tint="SR"] {
  background: linear-gradient(180deg, #d2b0ff, #7a3fe0);
}
.level-bar i.on[data-tint="SSR"] {
  background: linear-gradient(180deg, #ffd27a, #f08a12);
}
.level-bar i.on[data-tint="UR"] {
  background: linear-gradient(90deg, #ff3d7f, #ff9f0a, #f5c400, #18c98f, #2f9bff, #a855f7);
}
.level-chest {
  position: relative;
  order: 4;
  width: 34px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: #ffffffb0;
  box-shadow: 0 2px 6px #00000022, inset 0 1px 0 #ffffffcc;
  color: #8a5a1c;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.18s var(--ease);
}
.level-chest .chest-icon {
  display: grid;
  place-items: center;
}
.level-chest .chest-icon svg {
  width: 17px;
  height: 17px;
}
.level-chest.has {
  animation: chest-breathe 2.6s ease-in-out infinite;
}
.level-chest:active {
  transform: scale(0.92);
}
.chest-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 99px;
  background: #e2453c;
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  display: grid;
  place-items: center;
}
/* 无数字的纯红点（如市场入口）收成小圆点，避免盖住整个入口图标 */
.chest-badge:empty {
  min-width: 9px;
  height: 9px;
  padding: 0;
}
@keyframes chest-breathe {
  0%,
  100% {
    box-shadow: 0 2px 6px #00000022, inset 0 1px 0 #ffffffcc;
  }
  50% {
    box-shadow: 0 2px 14px #f0a12c66, inset 0 1px 0 #ffffffcc;
  }
}

/* --- 托盘 --- */
.tray-wrap {
  width: 100%;
  margin: 2px 0 14px;
}
.tray-shell {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  padding: 8px 4px 10px;
}
.tray-shell::-webkit-scrollbar {
  display: none;
}
.tray {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: safe center;
  min-height: 0;
  padding: 0 8px;
}
.tray-pack {
  position: relative;
  flex: 0 0 auto;
  width: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  padding: 6px 5px 5px;
  border: 0;
  border-radius: 11px;
  background: #ffffffbf;
  box-shadow: 0 2px 6px #0000001a, inset 0 1px 0 #ffffffd0;
  color: #4d4250;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.tray-pack.current {
  box-shadow: 0 0 0 2px #dcbd84, 0 4px 12px #00000028;
  transform: translateY(-3px);
}
.tray-art {
  position: relative;
  display: block;
  width: 34px;
  height: 49px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(18, 12, 32, 0.26);
  background: #1b1838;
}
.tray-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  background: transparent;
}
.tray-thumb-empty {
  display: block;
  background: linear-gradient(160deg, #f7efdf, #e4d4bb);
}
.tray-count {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.tray-name {
  font-size: 10px;
  line-height: 1.2;
  color: #7d7282;
  max-width: 60px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- 市场 --- */
.market {
  padding: 4px 16px 12px;
}
.market h2 {
  margin: 6px 0 10px;
}
.market-free {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.market-bar {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0;
}
.market-timer {
  margin: 0;
  color: #7d7282;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.market-timer b {
  color: #4d4250;
}
.market-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 12px 2px 8px;
}
.market-shelf-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #4d4250;
}
html[data-theme="dark"] .market-shelf-title {
  color: var(--ink);
}
.market-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.offer {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 8px 6px 6px;
  border-radius: 12px;
  background: #ffffffc4;
  box-shadow: 0 2px 8px #00000014, inset 0 1px 0 #ffffffd0;
  min-width: 0;
}
.offer.free {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 10px 8px 8px;
  border-radius: 14px;
  min-width: 0;
}
.offer.taken {
  opacity: 0.55;
}
.offer.famous {
  box-shadow: 0 0 0 1px #f0c26566, 0 2px 10px #f0c26533;
}
.offer.locked {
  box-shadow: none;
}
.offer-pack {
  display: grid;
  place-items: center;
}
.offer.free .offer-pack {
  width: 68px;
  height: 98px;
  aspect-ratio: auto;
  flex: none;
}
.market-grid .offer {
  padding: 10px 8px 8px;
  gap: 6px;
}
.market-grid .offer-pack {
  width: 82px;
  height: 118px;
  aspect-ratio: auto;
  flex: none;
}
.market-grid .offer-pack .offer-thumb,
.offer.free .offer-pack .offer-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.offer-thumb {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  object-fit: cover;
  background: #ffffff55;
}
.offer-thumb-empty {
  display: block;
  background: linear-gradient(160deg, #f7efdf, #e0cfb6);
}
.offer-name {
  font-size: 11.5px;
  font-weight: 600;
  color: #4d4250;
  text-align: center;
}
.free-side {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.offer.free .offer-name {
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.offer.free .market-timer,
.free-timer {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.offer .claim,
.offer.free .claim,
.free-side .claim {
  width: 100%;
  height: auto;
  min-height: 30px;
  padding: 0 10px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-indent: 0;
  border-radius: 99px;
}
.bgm-exchange {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ffffffbd;
  box-shadow: inset 0 1px 0 #ffffffd0, 0 2px 8px #00000010;
}
.redeem-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 12px;
  color: #4d4250;
}
.redeem-head span {
  color: #7d7282;
  font-size: 11px;
}
.redeem-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.redeem-row .claim {
  min-height: 32px;
  padding: 0 12px;
  font-size: 11.5px;
  border-radius: 99px;
}
.bgm-exchange + .market-grid,
.market + .binder {
  margin-top: 6px;
}

/* --- 图鉴搜索 --- */
.binder-search {
  flex: 1 1 100%;
  order: -1;
}
.binder-controls .binder-tabs {
  flex-wrap: wrap;
  border-radius: 14px;
}
.binder-controls .binder-tabs button {
  padding-inline: 10px;
}
.binder-search input {
  width: 100%;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #d8c9b4;
  border-radius: 99px;
  background: #ffffffd0;
  color: #4d4250;
  font: inherit;
  font-size: 12.5px;
}
.binder-search input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

/* --- 概率说明里的卡包列表 --- */
.pack-rates {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.7;
  color: #5c5364;
}
.rates-note {
  font-size: 11.5px;
  color: #7d7282;
}
.chest-lead {
  font-weight: 600;
}

/* ==================== P1：演出层（压暗 / 光线 / 闪光 / 大字 / 粒子画布） ==================== */
.dim {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #0b0a12;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: strict;
}
.ur-rays {
  position: fixed;
  inset: 0;
  z-index: 21;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.4s ease;
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: strict;
}
.ur-rays.go {
  opacity: 1;
}
.ur-rays i {
  width: min(118vmax, 900px);
  height: min(118vmax, 900px);
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg 6deg,
    rgba(255, 255, 255, 0.22) 6deg 9deg,
    transparent 9deg 15deg
  );
  animation: rays-spin 22s linear infinite;
  -webkit-mask-image: radial-gradient(circle, #000 10%, rgba(0, 0, 0, 0.65) 36%, transparent 66%);
  mask-image: radial-gradient(circle, #000 10%, rgba(0, 0, 0, 0.65) 36%, transparent 66%);
  will-change: transform;
  backface-visibility: hidden;
}
.ur-rays.ssr i {
  background: repeating-conic-gradient(
    from 0deg,
    transparent 0deg 7deg,
    rgba(255, 214, 102, 0.28) 7deg 11deg,
    transparent 11deg 18deg
  );
}
.ur-rays.ur i {
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 61, 127, 0.26) 0deg 5deg,
    transparent 5deg 10deg,
    rgba(255, 196, 48, 0.28) 10deg 15deg,
    transparent 15deg 20deg,
    rgba(34, 211, 154, 0.24) 20deg 25deg,
    transparent 25deg 30deg,
    rgba(47, 155, 255, 0.26) 30deg 35deg,
    transparent 35deg 40deg,
    rgba(168, 85, 247, 0.28) 40deg 45deg,
    transparent 45deg 50deg
  );
}
@keyframes rays-spin {
  to {
    transform: rotate(360deg);
  }
}
.beat-pulse {
  position: fixed;
  inset: 0;
  z-index: 21;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.26) 0%, transparent 52%);
}
.beat-pulse.sr {
  background: radial-gradient(circle at 50% 48%, rgba(168, 108, 255, 0.36) 0%, rgba(255, 114, 210, 0.16) 36%, transparent 64%);
}
.beat-pulse.ssr {
  background: radial-gradient(circle at 50% 48%, rgba(255, 214, 96, 0.42) 0%, rgba(255, 154, 26, 0.18) 38%, transparent 66%);
}
.beat-pulse.ur {
  background: radial-gradient(circle at 50% 48%, rgba(255, 112, 208, 0.4) 0%, rgba(110, 178, 255, 0.24) 34%, transparent 68%);
}
.beat-pulse.go {
  animation: beat-pulse 0.72s ease-out 1;
}
@keyframes beat-pulse {
  0% {
    opacity: 0.95;
    transform: scale(0.84);
  }
  100% {
    opacity: 0;
    transform: scale(1.24);
  }
}
.flash {
  position: fixed;
  inset: 0;
  z-index: 29;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 45%, #fff 0%, rgba(255, 255, 255, 0.45) 35%, transparent 72%);
}
.flash.SR {
  background: radial-gradient(circle at 50% 45%, #fff 0%, rgba(204, 152, 255, 0.8) 26%, rgba(139, 77, 255, 0.38) 48%, transparent 75%);
}
.flash.SSR {
  background: radial-gradient(circle at 50% 45%, #fffef4 0%, rgba(255, 224, 128, 0.88) 28%, rgba(255, 159, 10, 0.44) 50%, transparent 76%);
}
.flash.UR {
  background: radial-gradient(circle at 50% 45%, #ffffff 0%, rgba(255, 180, 238, 0.88) 24%, rgba(124, 216, 255, 0.54) 48%, transparent 78%);
}
.flash.go {
  animation: flash 0.65s ease-out 1;
}
@keyframes flash {
  0% {
    opacity: 0;
  }
  14% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
  }
}
.ur-splash {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: strict;
}
.ur-splash i,
.ur-splash u {
  display: block;
  position: absolute;
  pointer-events: none;
  opacity: 0;
}
.ur-splash i {
  width: min(116vmax, 880px);
  height: min(116vmax, 880px);
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 61, 127, 0.22) 0deg 10deg,
    rgba(255, 159, 10, 0.22) 10deg 20deg,
    rgba(255, 214, 10, 0.22) 20deg 30deg,
    rgba(34, 211, 154, 0.22) 30deg 40deg,
    rgba(47, 155, 255, 0.22) 40deg 50deg,
    rgba(168, 85, 247, 0.22) 50deg 60deg
  );
  -webkit-mask-image: radial-gradient(circle, transparent 8%, #000 16%, rgba(0, 0, 0, 0.42) 34%, transparent 62%);
  mask-image: radial-gradient(circle, transparent 8%, #000 16%, rgba(0, 0, 0, 0.42) 34%, transparent 62%);
  will-change: transform, opacity;
  backface-visibility: hidden;
}
.ur-splash.ssr i {
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 232, 146, 0.34) 0deg 10deg,
    transparent 10deg 20deg,
    rgba(255, 168, 28, 0.28) 20deg 30deg,
    transparent 30deg 40deg
  );
}
.ur-splash.sr i {
  background: repeating-conic-gradient(
    from 0deg,
    rgba(196, 144, 255, 0.26) 0deg 12deg,
    transparent 12deg 24deg
  );
}
.ur-splash u {
  display: none;
}
.ur-splash b {
  position: relative;
  font-size: clamp(68px, 24vw, 178px);
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 0 24px #ff9fd4, 0 0 64px #ffd36a;
}
.ur-splash.sr b {
  font-size: clamp(56px, 18vw, 132px);
  color: #f6e8ff;
  text-shadow: 0 0 18px #a86cff, 0 0 42px #ff72d2, 0 8px 20px rgba(34, 12, 68, 0.6);
}
.ur-splash.ssr b {
  font-size: clamp(64px, 21vw, 156px);
  background: linear-gradient(180deg, #fffdf0 0%, #ffe078 46%, #f08a12 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 190, 56, 0.9)) drop-shadow(0 8px 20px rgba(72, 34, 4, 0.68));
}
.ur-splash.ur b {
  font-size: clamp(72px, 25vw, 186px);
  background: linear-gradient(110deg, #ff7ab8, #ffe26a, #7dffb8, #6ab8ff, #c58bff, #ff7ab8);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 160, 232, 0.95)) drop-shadow(0 0 32px rgba(108, 206, 255, 0.8)) drop-shadow(0 10px 22px rgba(24, 12, 48, 0.72));
}
.ur-splash.go {
  animation: splash 1.45s cubic-bezier(0.2, 0.8, 0.2, 1) 1 both;
}
.ur-splash.ur.go {
  animation-duration: 1.85s;
}
.ur-splash.go b {
  animation: none;
  opacity: 1;
}
.ur-splash.go i {
  animation: splash-burst 1.45s ease-out 1 both;
}
.ur-splash.go u {
  animation: none;
}
@keyframes splash-burst {
  0% {
    opacity: 0;
    transform: scale(0.45) rotate(0deg);
  }
  24% {
    opacity: 0.72;
    transform: scale(0.95) rotate(16deg);
  }
  100% {
    opacity: 0;
    transform: scale(1.22) rotate(48deg);
  }
}
@keyframes splash {
  0% {
    opacity: 0;
    transform: scale(1.36);
  }
  20% {
    opacity: 1;
    transform: scale(0.98);
  }
  34% {
    transform: scale(1.02);
  }
  74% {
    opacity: 1;
    transform: scale(1.03);
  }
  100% {
    opacity: 0;
    transform: scale(1.07);
  }
}

/* 首次连开/多卡左右滑动切卡提示 */
.multi-nav-tip {
  margin: 10px auto 4px;
  padding: 6px 14px;
  max-width: min(92vw, 320px);
  border-radius: 999px;
  background: rgba(255, 250, 238, 0.92);
  border: 1px solid #d9c59d;
  box-shadow: 0 4px 12px rgba(42, 28, 12, 0.12);
  color: #5b4420;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.04em;
  animation: view-in 0.32s var(--ease) both;
}
html[data-theme="dark"] .multi-nav-tip {
  background: rgba(34, 28, 54, 0.9);
  border-color: rgba(242, 206, 128, 0.34);
  color: #f7e6bd;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
}
#fx {
  position: fixed;
  inset: 0;
  z-index: 30;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: strict;
}

/* ==================== P1：切包双向弧线 · 领包入袋 · 托盘微动 ==================== */
.swap-ghost {
  position: fixed;
  z-index: 48;
  border-radius: 10px;
  overflow: hidden;
  pointer-events: none;
  transform-origin: 50% 50%;
  background: linear-gradient(155deg, #4b3d6d, #221a38);
  border: 1px solid rgba(255, 232, 178, 0.42);
  box-shadow:
    0 20px 36px -12px rgba(14, 10, 28, 0.56),
    0 0 18px rgba(242, 198, 109, 0.28);
  will-change: transform, opacity;
}
.swap-ghost.swap-out {
  z-index: 46;
}
.swap-ghost.swap-in {
  z-index: 49;
}
.swap-ghost.shelf-blue {
  border-color: rgba(114, 180, 255, 0.62);
  box-shadow:
    0 20px 36px -12px rgba(14, 28, 64, 0.56),
    0 0 22px rgba(68, 146, 255, 0.44);
}
.swap-ghost.shelf-purple {
  border-color: rgba(196, 146, 255, 0.68);
  box-shadow:
    0 20px 36px -12px rgba(28, 12, 64, 0.58),
    0 0 24px rgba(154, 88, 255, 0.48);
}
.swap-ghost.shelf-gold {
  border-color: rgba(255, 214, 108, 0.8);
  box-shadow:
    0 20px 38px -12px rgba(64, 38, 6, 0.54),
    0 0 26px rgba(255, 190, 56, 0.56);
}
.swap-ghost img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}
.swap-ghost.swap-in::after {
  content: "";
  position: absolute;
  inset: -12% -60%;
  background: linear-gradient(
    112deg,
    transparent 34%,
    rgba(255, 255, 255, 0.36) 48%,
    rgba(255, 245, 214, 0.14) 55%,
    transparent 66%
  );
  animation: swap-sheen 360ms cubic-bezier(0.22, 0.86, 0.32, 1) both;
  pointer-events: none;
}
@keyframes swap-sheen {
  0% {
    transform: translateX(-48%);
    opacity: 0;
  }
  28% {
    opacity: 0.9;
  }
  100% {
    transform: translateX(52%);
    opacity: 0;
  }
}
/* 领取卡包 / 开宝箱平滑抛物线飞入下方卡包栏动效 */
.pack-fly-ghost {
  position: fixed;
  z-index: 52;
  pointer-events: none;
  border-radius: 7px;
  overflow: visible;
  will-change: transform, opacity;
  background: linear-gradient(155deg, #4b3d6d, #221a38);
  border: 1px solid rgba(255, 232, 178, 0.55);
  box-shadow:
    0 12px 24px -6px rgba(18, 12, 34, 0.55),
    0 0 14px rgba(242, 198, 109, 0.38);
}
.pack-fly-ghost.shelf-blue {
  border-color: rgba(114, 180, 255, 0.72);
  box-shadow:
    0 12px 24px -6px rgba(18, 32, 68, 0.55),
    0 0 16px rgba(68, 146, 255, 0.52);
}
.pack-fly-ghost.shelf-purple {
  border-color: rgba(196, 146, 255, 0.78);
  box-shadow:
    0 12px 24px -6px rgba(34, 16, 68, 0.58),
    0 0 18px rgba(154, 88, 255, 0.58);
}
.pack-fly-ghost.shelf-gold {
  border-color: rgba(255, 214, 108, 0.9);
  box-shadow:
    0 12px 26px -6px rgba(68, 42, 8, 0.55),
    0 0 20px rgba(255, 190, 56, 0.68);
}
.pack-fly-ghost img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}
.pack-fly-badge {
  position: absolute;
  right: -6px;
  top: -6px;
  padding: 1px 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe294, #e09a2b);
  color: #24180a;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
/* 落袋时的柔和弹性接住回弹与微光反馈 */
.pack-received {
  animation: pack-catch 420ms cubic-bezier(0.22, 1.32, 0.36, 1) both;
}
@keyframes pack-catch {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.11, 0.92);
    filter: brightness(1.18);
  }
  65% {
    transform: scale(0.97, 1.04);
  }
  100% {
    transform: scale(1);
    filter: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pack-received {
    animation: none;
  }
}
.foot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 0 0 4px;
}
.foot-row .mode-toggle {
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
}
.settings-group + .settings-group {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(130, 114, 145, 0.25);
}
.settings-group h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 750;
  color: inherit;
}
.settings-hint {
  margin: 0 0 8px;
  font-size: 12px;
  opacity: 0.78;
}
.settings-sound-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.settings-sound-icon {
  display: inline-flex;
  align-items: center;
}
.settings-sound-icon svg {
  width: 16px;
  height: 16px;
}
.settings-track-picker {
  position: relative;
  margin-top: 8px;
  width: 100%;
  min-width: 0;
}
#dialog .settings-track-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 44px;
  margin: 0;
  padding: 8px 12px;
  border-radius: 12px;
  text-align: left;
  letter-spacing: normal;
  text-indent: 0;
  box-sizing: border-box;
}
.settings-track-trigger-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
.settings-track-trigger-label b {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 750;
}
.settings-track-trigger-label small {
  min-width: 0;
  font-size: 12px;
  opacity: 0.78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-track-caret {
  flex: 0 0 auto;
  font-size: 13px;
  line-height: 1;
  opacity: 0.8;
  transition: transform 0.18s var(--ease);
}
.settings-track-picker.open .settings-track-caret {
  transform: rotate(180deg);
}
.settings-track-dropdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding: 6px;
  max-height: 280px;
  overflow-y: auto;
  border-radius: 12px;
  background: rgba(255, 250, 240, 0.94);
  border: 1px solid rgba(90, 68, 42, 0.16);
  box-shadow: 0 8px 20px rgba(24, 16, 10, 0.12);
  box-sizing: border-box;
}
.settings-track-dropdown[hidden] {
  display: none;
}
html[data-theme="dark"] .settings-track-dropdown {
  background: rgba(28, 22, 42, 0.96);
  border-color: rgba(242, 206, 128, 0.24);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.36);
}
.settings-track-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(34, 27, 37, 0.04);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-sizing: border-box;
}
html[data-theme="dark"] .settings-track-option {
  background: rgba(255, 255, 255, 0.05);
}
.settings-track-option-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.settings-track-option-head b {
  flex: 0 0 auto;
  font-size: 12.5px;
  font-weight: 750;
}
.settings-track-option-head span {
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-track-option small {
  font-size: 10.5px;
  line-height: 1.3;
  opacity: 0.72;
  white-space: normal;
  word-break: break-word;
}
.settings-track-option[aria-pressed="true"] {
  background: linear-gradient(135deg, #3c2f59, #241b39);
  border-color: rgba(242, 206, 128, 0.78);
  color: #ffe9b3;
  box-shadow: 0 3px 10px rgba(24, 14, 48, 0.24);
}
html[data-theme="dark"] .settings-track-option[aria-pressed="true"] {
  background: linear-gradient(135deg, #54407d, #31254f);
  color: #fff0c2;
}
.tray-thumb {
  animation: none;
}
.tray-pack:nth-child(2n) .tray-thumb {
  animation-delay: -2.1s;
}
.tray-pack:nth-child(3n) .tray-thumb {
  animation-delay: -4.3s;
}
.offer-thumb {
  animation: pack-sway 7.2s ease-in-out infinite;
  transform-origin: 50% 90%;
}
.offer:nth-child(2n) .offer-thumb {
  animation-delay: -3.4s;
}
@keyframes pack-sway {
  0%,
  100% {
    transform: rotate(-1.6deg) translateY(0);
  }
  50% {
    transform: rotate(1.6deg) translateY(-2px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tray-thumb,
  .offer-thumb {
    animation: none;
  }
}
.share-sub {
  margin: 0 0 8px;
  color: #6b6273;
  font-size: 12.5px;
}
.share-picture {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto 10px;
  border-radius: 10px;
  box-shadow: 0 6px 18px #0000002e;
}
.share-code {
  margin: 0 0 10px;
  text-align: center;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  user-select: all;
  color: #3c3346;
}
.share-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 6px 0 10px;
}
.share-actions .claim {
  min-height: 36px;
  padding: 0 16px;
  border-radius: 99px;
  font-size: 12.5px;
}
.share-note {
  margin: 0;
  font-size: 11.5px;
  color: #7d7282;
  text-align: center;
}
.gift-lead {
  margin: 0 0 8px;
}
.gift-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d8c9b4;
  border-radius: 10px;
  background: #fffdf8;
  color: #3c3346;
  font: inherit;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  resize: none;
}
.gift-input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.gift-quota,
.gift-message {
  margin: 8px 0 0;
  font-size: 12px;
  color: #7d7282;
  text-align: center;
}
.gift-message {
  color: #b1503a;
  min-height: 1em;
}
.claim.danger {
  background: #b1503a;
  color: #fff;
}

/* ==================== P2：奖杯轨道 · 作品收藏集 · 语言 ==================== */
.trophy-count {
  margin-left: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: #7d7282;
}
.trophy-tabs {
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.trophy-section {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 2px 2px;
  font-size: 12px;
  color: #6b6273;
}
.trophy-section b {
  font-size: 12.5px;
  color: #3c3346;
  letter-spacing: 0.03em;
}
.trophy-rank {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  border-radius: 5px;
  background: #f0e8da;
  color: #7c5c26;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}
.trophy-list {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
}
.trophy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: #ffffffc2;
  box-shadow: inset 0 1px 0 #ffffffd0, 0 1px 4px #00000010;
}
.trophy-row.R {
  box-shadow: inset 0 1px 0 #ffffffd0, 0 0 0 1px #2f7bff33;
}
.trophy-row.SR {
  box-shadow: inset 0 1px 0 #ffffffd0, 0 0 0 1px #8b4dff33;
}
.trophy-row.SSR {
  box-shadow: inset 0 1px 0 #ffffffd0, 0 0 0 1px #ff9f0a44;
}
.trophy-row.UR {
  box-shadow: inset 0 1px 0 #ffffffd0, 0 0 0 1px #ff3d9a44;
}
.trophy-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}
.trophy-text strong {
  font-size: 12.5px;
  color: #3c3346;
}
.trophy-text small {
  font-size: 11px;
  color: #7d7282;
}
.trophy-cups {
  display: flex;
  align-items: center;
  gap: 3px;
}
.trophy-cups .cup {
  width: 9px;
  height: 12px;
  border-radius: 2px 2px 5px 5px;
  background: #00000012;
}
.cup.on.N {
  background: #c9cfda;
}
.cup.on.R {
  background: #2f7bff;
}
.cup.on.SR {
  background: #8b4dff;
}
.cup.on.SSR {
  background: #f08a12;
}
.cup.on.UR {
  background: linear-gradient(90deg, #ff3d7f, #ff9f0a, #f5c400, #18c98f, #2f9bff, #a855f7);
}
.trophy-progress {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 99px;
  background: #00000010;
  overflow: hidden;
}
.trophy-progress i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #e8c886, #dcbd84);
  transition: width 0.4s var(--ease);
}
.trophy-value {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: #6b6273;
}
.trophy-banner {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 58px);
  z-index: 35;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 8px 18px;
  border-radius: 99px;
  border: 0;
  background: #ffffff;
  box-shadow: 0 8px 22px #0000002e;
  color: #3c3346;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.trophy-banner.go {
  animation: banner-in 0.4s var(--ease) both;
}
.trophy-banner.R {
  box-shadow: 0 8px 22px #2f7bff44;
}
.trophy-banner.SR {
  box-shadow: 0 8px 22px #8b4dff44;
}
.trophy-banner.SSR {
  box-shadow: 0 8px 22px #ff9f0a55;
}
.trophy-banner.UR {
  box-shadow: 0 8px 22px #ff3d9a55;
}
@keyframes banner-in {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
.work-collection {
  position: relative;
  grid-column: 1 / -1;
  display: flex;
  align-items: stretch;
  border-radius: 12px;
  background: #ffffffc2;
  box-shadow: inset 0 1px 0 #ffffffd0, 0 1px 4px #00000010;
  overflow: hidden;
  contain: layout style paint;
}
.work-collection > button.work-collection-open,
.work-collection > button[data-work] {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 6px 8px 10px;
  border: 0;
  background: none;
  text-align: left;
  color: #3c3346;
  font: inherit;
  cursor: pointer;
}
.work-collection .series-fav {
  flex: none;
  width: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid rgba(90, 74, 54, 0.08);
  background: transparent;
  color: #b4a796;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease;
}
.work-collection .series-fav svg {
  width: 18px;
  height: 18px;
}
.work-collection .series-fav[aria-pressed="true"] {
  color: #e59a16;
  background: rgba(255, 214, 102, 0.14);
}
.work-collection .series-fav[aria-pressed="true"] svg {
  fill: currentColor;
}
.series-detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.series-detail-actions .work-progress {
  flex: 1 1 auto;
}
.series-fav-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid #d9cbb5;
  background: #fffbf2;
  color: #6b5d4d;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.series-fav-pill svg {
  width: 14px;
  height: 14px;
}
.series-fav-pill[aria-pressed="true"] {
  border-color: #eab338;
  background: linear-gradient(180deg, #fff5d6, #ffe39a);
  color: #7c4c00;
}
.series-fav-pill[aria-pressed="true"] svg {
  fill: currentColor;
}
.work-collection-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.work-cover {
  position: relative;
  width: 52px;
  aspect-ratio: 5 / 7;
  border-radius: 7px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #e7dfd6, #d4c6b8);
  box-shadow: inset 0 0 0 1px #00000014, 0 1px 3px #00000014;
  color: #5c5064;
  flex: 0 0 auto;
}
.work-cover[data-media="动画"] {
  background: linear-gradient(145deg, #f3e4d0, #dfc2a3);
  color: #6b4b2a;
}
.work-cover[data-media="游戏"] {
  background: linear-gradient(145deg, #dfe4f5, #c3cbe6);
  color: #3d4870;
}
.work-cover[data-media="书籍"],
.work-cover[data-media="漫画"],
.work-cover[data-media="轻小说"] {
  background: linear-gradient(145deg, #e4efe2, #c6dbc4);
  color: #3b583d;
}
.work-cover.large {
  width: 68px;
  border-radius: 9px;
}
.work-cover-fallback {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  opacity: 0.72;
  user-select: none;
}
.work-cover.large .work-cover-fallback {
  font-size: 24px;
}
.work-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.work-cover-img[hidden] {
  display: none;
}
.work-collection-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.work-collection-top b {
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.work-collection-top .rarity {
  flex: none;
}
.series-detail-hero {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.series-detail-meta {
  min-width: 0;
}
.series-detail-meta p {
  margin: 0 0 6px;
  font-size: 12.5px;
  line-height: 1.5;
}
.work-collection small {
  color: #7d7282;
  font-size: 11px;
}
.work-progress {
  display: block;
  height: 5px;
  border-radius: 99px;
  background: #00000010;
  overflow: hidden;
}
.work-progress.large {
  height: 8px;
  margin: 6px 0 10px;
}
.work-progress i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #e8c886, #dcbd84);
}
.work-progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  color: #7d7282;
}
.work-progress-label b {
  white-space: nowrap;
  flex: none;
}
.work-people {
  display: grid;
  gap: 6px;
  max-height: 46vh;
  overflow-y: auto;
}
.work-person {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #e2d6c4;
  border-radius: 10px;
  background: #fffdf8;
  color: #3c3346;
  font: inherit;
  text-align: left;
}
.work-person.owned {
  cursor: pointer;
}
.work-person.missing {
  opacity: 0.55;
}
.work-person small {
  display: block;
  color: #7d7282;
  font-size: 10.5px;
}
.work-person em {
  font-style: normal;
  font-size: 10.5px;
  color: #7d7282;
}
#binderSort[hidden],
#tierFilter[hidden] {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .trophy-banner.go {
    animation: none;
  }
}

/* ==================== 作品 · 系列 ==================== */
.binder-controls {
  justify-content: flex-start;
}
.binder-decade {
  flex: 0 0 auto;
  order: -1;
}
.binder-media {
  flex: 0 0 auto;
  order: -1;
}
.binder-decade select,
.binder-media select,
.binder-status select,
.binder-sortcol select {
  height: 34px;
  min-height: 34px;
  padding: 0 28px 0 12px;
  border: 1px solid #d8c9b4;
  border-radius: 99px;
  background-color: #ffffffd0;
  color: #4d4250;
  font: inherit;
  font-size: 12.5px;
  line-height: 32px;
  box-sizing: border-box;
  vertical-align: middle;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238d8394' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-size: 10px 6px;
  background-repeat: no-repeat;
}
.binder-sort select {
  height: 34px;
  min-height: 34px;
  line-height: 32px;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none;
}
.media-chip {
  display: inline-block;
  margin-right: 4px;
  padding: 0 6px;
  border-radius: 99px;
  background: #00000010;
  color: #5c5364;
  font-size: 10px;
  line-height: 1.6;
}
.origin-more {
  display: inline-block;
  margin-left: 2px;
  padding: 0 6px;
  border: 0;
  border-radius: 99px;
  background: #dcbd8433;
  color: #7a5a1f;
  font: inherit;
  font-size: 10.5px;
  line-height: 1.6;
  cursor: pointer;
}
/* 角色定位（主角 / 配角 / 客串 / 闲角）：跟"出处 N 部"同款药丸，用颜色区分份量 */
.staff-tag {
  display: inline-block;
  padding: 0 6px;
  border-radius: 99px;
  font-size: 10.5px;
  line-height: 1.6;
  background: #c9b8e033;
  color: #6a4f8f;
}
.staff-tag.主角 {
  background: #dcbd8433;
  color: #7a5a1f;
}
.staff-tag.客串,
.staff-tag.闲角 {
  background: #b8c4d033;
  color: #5a6675;
}
.origin-lead {
  margin: 0 0 8px;
  color: #6b6273;
  font-size: 12px;
}
.origin-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 46vh;
  overflow-y: auto;
}
.origin-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #e2d6c4;
  border-radius: 10px;
  background: #fffdf8;
}
.origin-list b {
  display: block;
  font-size: 12.5px;
  color: #3c3346;
}
.origin-list small {
  color: #7d7282;
  font-size: 10.5px;
}
.origin-list em {
  font-style: normal;
  font-size: 11px;
  color: #7d7282;
  font-variant-numeric: tabular-nums;
}
.series-works {
  margin: 4px 0 12px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 3px;
  font-size: 11.5px;
  color: #5c5364;
}
.series-works li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.series-works em {
  margin-left: 4px;
  font-style: normal;
  font-size: 10px;
  color: #9a92a3;
}
.series-works b {
  font-variant-numeric: tabular-nums;
  color: #4d4250;
}

/* ==================== 异画卡面 ==================== */
.alt-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: linear-gradient(115deg, #ffe29a, #ffb4ee, #8cebff, #ffe29a);
  background-size: 200% 100%;
  color: #24192d;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.dup-badge {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(24, 20, 34, 0.84);
  border: 1px solid rgba(255, 198, 128, 0.72);
  color: #ffd89b;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}
.card-inner.full-art.alt-art {
  overflow: hidden;
}
/* 游戏王风格异画闪卡层（仅 SR / SSR / UR 异画生效）：
   SR = 面闪（细斜金属拉丝 + 冷银紫棱镜）；
   SSR = 斜碎闪 SER（45° 交错斜碎星纹 + 金香槟彩虹折射）；
   UR = 碎钻星光闪 Prismatic Secret / 25th（正交+菱格蚀刻微闪 + 七彩虹光 + 四芒星闪点）。 */
.card-inner.full-art.alt-art > .ygo-foil,
.binder-card.full-art.alt-art > .ygo-foil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  overflow: hidden;
  transition: opacity 0.24s ease, filter 0.24s ease;
}
.card-inner.full-art.alt-art > .ygo-foil::before,
.card-inner.full-art.alt-art > .ygo-foil::after,
.binder-card.full-art.alt-art > .ygo-foil::before,
.binder-card.full-art.alt-art > .ygo-foil::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
}

/* 大图异画卡：底层全息虹光 + 指针联动聚光点 */
.card-inner.full-art.alt-art > .ygo-foil {
  opacity: 0.72;
  background:
    radial-gradient(
      circle 170px at var(--foil-x, 52%) var(--foil-y, 34%),
      rgba(255, 255, 255, 0.34) 0%,
      rgba(255, 236, 178, 0.14) 36%,
      transparent 72%
    ),
    linear-gradient(
      var(--foil-angle, 122deg),
      transparent 10%,
      rgba(255, 118, 196, 0.22) 26%,
      rgba(255, 224, 114, 0.24) 38%,
      rgba(116, 255, 206, 0.24) 50%,
      rgba(104, 196, 255, 0.26) 62%,
      rgba(198, 134, 255, 0.22) 74%,
      transparent 90%
    );
  background-size: 100% 100%, 260% 260%;
  background-position: 0 0, calc(50% + var(--foil-shift, 0%)) 50%;
  mix-blend-mode: color-dodge;
  animation: ygo-prism-drift 7.2s ease-in-out infinite;
}
.card.foil-active .card-inner.full-art.alt-art > .ygo-foil {
  opacity: 0.94;
  animation: none;
}

/* SR 面闪（Super Rare）：细斜金属全息拉丝 + 银紫冷调光晕 */
.card.SR .card-inner.full-art.alt-art > .ygo-foil {
  opacity: 0.56;
  background:
    radial-gradient(
      circle 160px at var(--foil-x, 50%) var(--foil-y, 34%),
      rgba(255, 255, 255, 0.28) 0%,
      rgba(202, 176, 255, 0.14) 38%,
      transparent 72%
    ),
    linear-gradient(
      var(--foil-angle, 126deg),
      transparent 18%,
      rgba(182, 146, 255, 0.24) 36%,
      rgba(222, 246, 255, 0.3) 50%,
      rgba(162, 186, 255, 0.22) 64%,
      transparent 82%
    );
  background-size: 100% 100%, 250% 250%;
}
.card.SR.foil-active .card-inner.full-art.alt-art > .ygo-foil {
  opacity: 0.78;
}
.card.SR .card-inner.full-art.alt-art > .ygo-foil::before {
  opacity: 0.42;
  background: repeating-linear-gradient(
    132deg,
    rgba(255, 255, 255, 0) 0 3px,
    rgba(232, 224, 255, 0.22) 3px 4px,
    rgba(255, 255, 255, 0) 4px 8px
  );
  mix-blend-mode: overlay;
}

/* SSR 斜碎闪（Secret Rare / SER）：经典 -45° 细斜虚线碎闪 + 香槟金虹光 */
.card.SSR .card-inner.full-art.alt-art > .ygo-foil {
  opacity: 0.7;
  background:
    radial-gradient(
      circle 175px at var(--foil-x, 50%) var(--foil-y, 34%),
      rgba(255, 250, 224, 0.34) 0%,
      rgba(255, 214, 112, 0.18) 38%,
      transparent 72%
    ),
    linear-gradient(
      var(--foil-angle, 124deg),
      transparent 14%,
      rgba(255, 198, 92, 0.26) 30%,
      rgba(255, 246, 188, 0.32) 44%,
      rgba(156, 234, 255, 0.24) 56%,
      rgba(255, 178, 228, 0.22) 68%,
      transparent 86%
    );
  background-size: 100% 100%, 260% 260%;
}
.card.SSR.foil-active .card-inner.full-art.alt-art > .ygo-foil {
  opacity: 0.9;
}
.card.SSR .card-inner.full-art.alt-art > .ygo-foil::before {
  opacity: 0.52;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 248, 214, 0) 0 4px,
      rgba(255, 242, 182, 0.34) 4px 5.5px,
      rgba(176, 236, 255, 0.2) 5.5px 6.5px,
      rgba(255, 248, 214, 0) 6.5px 10px
    ),
    repeating-linear-gradient(
      45deg,
      rgba(16, 12, 24, 0.32) 0 2px,
      rgba(255, 255, 255, 0) 2px 6px
    );
  background-size: 140% 140%, 100% 100%;
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(ellipse 66% 54% at 50% 40%, rgba(0, 0, 0, 0.48) 0%, rgba(0, 0, 0, 0.94) 68%, #000 100%);
  mask-image: radial-gradient(ellipse 66% 54% at 50% 40%, rgba(0, 0, 0, 0.48) 0%, rgba(0, 0, 0, 0.94) 68%, #000 100%);
  animation: ygo-secret-shift 6.4s linear infinite;
}

/* UR 碎钻星光闪（Prismatic Secret / 25th）：正交细网格 + 45° 菱格碎钻 + 边缘四芒星闪点 */
.card.UR .card-inner.full-art.alt-art > .ygo-foil::before {
  opacity: 0.48;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0) 0 3px,
      rgba(255, 244, 206, 0.22) 3px 4px,
      rgba(255, 255, 255, 0) 4px 7px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0) 0 3px,
      rgba(178, 236, 255, 0.22) 3px 4px,
      rgba(255, 255, 255, 0) 4px 7px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0) 0 5px,
      rgba(255, 198, 244, 0.24) 5px 6.5px,
      rgba(255, 255, 255, 0) 6.5px 11px
    ),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0) 0 5px,
      rgba(174, 255, 224, 0.2) 5px 6.5px,
      rgba(255, 255, 255, 0) 6.5px 11px
    );
  background-size: 100% 100%, 100% 100%, 150% 150%, 150% 150%;
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(ellipse 66% 54% at 50% 40%, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.94) 68%, #000 100%);
  mask-image: radial-gradient(ellipse 66% 54% at 50% 40%, rgba(0, 0, 0, 0.42) 0%, rgba(0, 0, 0, 0.94) 68%, #000 100%);
  animation: ygo-prismatic-grid 7.5s linear infinite;
}

/* 边缘四芒星芒闪点（避开画面中央人脸，仅点缀在卡面四周与斜角） */
.card.SSR .card-inner.full-art.alt-art > .ygo-foil::after,
.card.UR .card-inner.full-art.alt-art > .ygo-foil::after {
  opacity: 0.66;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 460'%3E%3Cg fill='%23fffdf4'%3E%3Cpath d='M36 68l2.6 10.4L49 81l-10.4 2.6L36 94l-2.6-10.4L23 81l10.4-2.6z' opacity='.92'/%3E%3Cpath d='M286 92l2 8 8 2-8 2-2 8-2-8-8-2 8-2z' opacity='.88'/%3E%3Cpath d='M274 282l2.8 11.2 11.2 2.8-11.2 2.8L274 310l-2.8-11.2L260 296l11.2-2.8z' opacity='.9'/%3E%3Cpath d='M42 326l2.2 8.8 8.8 2.2-8.8 2.2L42 348l-2.2-8.8-8.8-2.2 8.8-2.2z' opacity='.85'/%3E%3Cpath d='M264 46l1.4 5.6 5.6 1.4-5.6 1.4-1.4 5.6-1.4-5.6-5.6-1.4 5.6-1.4z' opacity='.72'/%3E%3Cpath d='M58 214l1.4 5.6 5.6 1.4-5.6 1.4-1.4 5.6-1.4-5.6-5.6-1.4 5.6-1.4z' opacity='.7'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 100% 100%;
  mix-blend-mode: screen;
  animation: ygo-twinkle 3.8s ease-in-out infinite;
}
.card.SSR .card-inner.full-art.alt-art > .ygo-foil::after {
  opacity: 0.44;
  animation-duration: 4.8s;
}

/* 顶层覆膜斜向镜面扫光（高光掠过整张异画，查看档案时自动隐藏保证文字清晰） */
.card-inner.full-art.alt-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(
      var(--foil-angle, 118deg),
      transparent 28%,
      rgba(255, 255, 255, 0.08) 40%,
      rgba(255, 252, 236, 0.42) 47.5%,
      rgba(176, 242, 255, 0.24) 51%,
      rgba(255, 255, 255, 0.08) 55%,
      transparent 67%
    ),
    linear-gradient(
      calc(var(--foil-angle, 118deg) + 22deg),
      transparent 38%,
      rgba(255, 224, 152, 0.16) 49%,
      transparent 60%
    );
  background-size: 260% 260%, 220% 220%;
  animation: ygo-glare-sweep 4.8s ease-in-out infinite;
  mix-blend-mode: screen;
  opacity: 0.82;
}
.card.SR .card-inner.full-art.alt-art::after {
  opacity: 0.62;
}
.card.foil-active .card-inner.full-art.alt-art::after {
  animation: none;
  background-position:
    calc(50% + var(--foil-shift, 0%)) 50%,
    calc(50% - var(--foil-shift, 0%) * 0.6) 50%;
  opacity: 0.92;
}
.card-inner.full-art.show-dossier > .ygo-foil {
  opacity: 0.12 !important;
}
.card-inner.full-art.show-dossier::after {
  display: none;
}

@keyframes ygo-prism-drift {
  0%,
  100% {
    background-position: 0 0, 18% 45%;
  }
  50% {
    background-position: 0 0, 82% 55%;
  }
}
@keyframes ygo-secret-shift {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 40px 40px, 0 0;
  }
}
@keyframes ygo-prismatic-grid {
  0% {
    background-position: 0 0, 0 0, 0 0, 0 0;
  }
  100% {
    background-position: 0 0, 0 0, 44px 44px, -44px 44px;
  }
}
@keyframes ygo-twinkle {
  0%,
  100% {
    opacity: 0.26;
    transform: scale(0.985);
  }
  50% {
    opacity: 0.84;
    transform: scale(1.015);
  }
}
@keyframes ygo-glare-sweep {
  0%,
  16% {
    background-position: 118% 0, -20% 100%;
  }
  52% {
    background-position: -18% 100%, 110% 0;
  }
  100% {
    background-position: -18% 100%, 110% 0;
  }
}

.card.SR .card-inner.full-art.alt-art::before {
  box-shadow:
    inset 0 0 0 2px rgba(206, 174, 255, 0.84),
    inset 0 0 0 4px rgba(255, 255, 255, 0.16),
    inset 0 0 22px rgba(160, 108, 255, 0.34);
}
.card.SSR .card-inner.full-art.alt-art::before {
  box-shadow:
    inset 0 0 0 2px rgba(255, 218, 122, 0.9),
    inset 0 0 0 4px rgba(255, 248, 210, 0.22),
    inset 0 0 26px rgba(255, 194, 74, 0.38);
}
.card.UR .card-inner.full-art.alt-art::before {
  box-shadow:
    inset 0 0 0 2px rgba(255, 236, 174, 0.95),
    inset 0 0 0 4px rgba(154, 240, 255, 0.3),
    inset 0 0 30px rgba(170, 235, 255, 0.44);
}

/* 图鉴缩略异画卡：轻量级游戏王三档闪膜（按 --i 错峰流动，不抢角色面部与文字） */
.binder-card.full-art.alt-art {
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 214, 128, 0.82),
    0 4px 12px rgba(96, 62, 142, 0.18);
}
.binder-card.SR.full-art.alt-art {
  box-shadow:
    inset 0 0 0 1.5px rgba(196, 152, 255, 0.82),
    0 4px 12px rgba(122, 63, 224, 0.2);
}
.binder-card.UR.full-art.alt-art {
  box-shadow:
    inset 0 0 0 1.5px rgba(188, 242, 255, 0.92),
    0 4px 14px rgba(102, 168, 255, 0.26);
}
.binder-card.full-art.alt-art > .ygo-foil {
  opacity: 0.62;
  background: linear-gradient(
    120deg,
    transparent 24%,
    rgba(255, 255, 255, 0.36) 44%,
    rgba(168, 240, 255, 0.24) 52%,
    rgba(255, 198, 246, 0.2) 59%,
    transparent 74%
  );
  background-size: 260% 260%;
  mix-blend-mode: screen;
  animation: ygo-glare-sweep 5.6s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -0.55s);
}
.binder-card.full-art.alt-art:hover > .ygo-foil {
  opacity: 0.88;
}
.binder-card.SR.full-art.alt-art > .ygo-foil::before {
  opacity: 0.38;
  background: repeating-linear-gradient(
    132deg,
    rgba(255, 255, 255, 0) 0 3px,
    rgba(220, 204, 255, 0.26) 3px 4px,
    rgba(255, 255, 255, 0) 4px 8px
  );
}
.binder-card.SSR.full-art.alt-art > .ygo-foil::before {
  opacity: 0.52;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 245, 204, 0) 0 3.5px,
      rgba(255, 232, 152, 0.34) 3.5px 5px,
      rgba(255, 245, 204, 0) 5px 9px
    ),
    repeating-linear-gradient(
      45deg,
      rgba(16, 12, 24, 0.28) 0 2px,
      rgba(255, 255, 255, 0) 2px 5.5px
    );
}
.binder-card.UR.full-art.alt-art > .ygo-foil {
  opacity: 0.74;
  background:
    linear-gradient(
      122deg,
      transparent 16%,
      rgba(255, 118, 196, 0.22) 32%,
      rgba(255, 232, 128, 0.28) 43%,
      rgba(122, 255, 212, 0.26) 52%,
      rgba(116, 202, 255, 0.28) 61%,
      rgba(204, 146, 255, 0.22) 72%,
      transparent 86%
    );
  background-size: 270% 270%;
}
.binder-card.UR.full-art.alt-art > .ygo-foil::before {
  opacity: 0.58;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0) 0 3px,
      rgba(255, 242, 196, 0.24) 3px 4px,
      rgba(255, 255, 255, 0) 4px 7px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0) 0 3px,
      rgba(170, 236, 255, 0.24) 3px 4px,
      rgba(255, 255, 255, 0) 4px 7px
    );
}
.binder-card.UR.full-art.alt-art > .ygo-foil::after {
  opacity: 0.56;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 180'%3E%3Cg fill='%23fffdf4'%3E%3Cpath d='M24 34l1.8 7.2 7.2 1.8-7.2 1.8L24 52l-1.8-7.2L15 43l7.2-1.8z' opacity='.9'/%3E%3Cpath d='M154 44l1.5 6 6 1.5-6 1.5-1.5 6-1.5-6-6-1.5 6-1.5z' opacity='.85'/%3E%3Cpath d='M150 118l1.6 6.4 6.4 1.6-6.4 1.6-1.6 6.4-1.6-6.4-6.4-1.6 6.4-1.6z' opacity='.8'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 100% 100%;
  animation: ygo-twinkle 4.2s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -0.45s);
}
.alt-switch {
  background: rgba(34, 24, 52, 0.74);
  border-color: rgba(210, 184, 255, 0.62);
}
.alt-art-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin: 8px 0 4px;
}
.alt-art-button {
  min-height: 36px;
  padding: 6px 18px;
  border-radius: 999px;
  border: 1px solid #d4b06a;
  background: linear-gradient(135deg, #fff6de, #f7dfaa 55%, #f0c97e);
  color: #4f3512;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(167, 119, 47, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.alt-art-button:hover:not(:disabled) {
  filter: brightness(1.03);
}
.alt-art-button:active:not(:disabled) {
  transform: scale(0.97);
}
.alt-art-button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  background: #ebe6dc;
  border-color: #cfc7b8;
  color: #7c7382;
  box-shadow: none;
}
.alt-art-button.unlocked {
  background: linear-gradient(135deg, #f3ecff, #e2d4ff);
  border-color: #b796f2;
  color: #4c2d8a;
  box-shadow: 0 2px 10px rgba(122, 63, 224, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.alt-art-hint {
  font-size: 11px;
  color: #6b6273;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .card-body {
    transition: none;
  }
  .card-inner.full-art.alt-art::after,
  .card-inner.full-art.alt-art > .ygo-foil,
  .card-inner.full-art.alt-art > .ygo-foil::before,
  .card-inner.full-art.alt-art > .ygo-foil::after,
  .binder-card.full-art.alt-art > .ygo-foil,
  .binder-card.full-art.alt-art > .ygo-foil::before,
  .binder-card.full-art.alt-art > .ygo-foil::after {
    animation: none;
  }
}
/* 重复卡：跳过整段揭示动画，只做一次短促弹出——与 app.js 「重复卡不播 ceremony」一致。
   判据来自 views.revealOf(entry).skipCeremony，表现层只认 .quick 这个类。 */
.card.reveal.quick .card-body{animation:pop-in .34s var(--ease) backwards,sway 9s .34s ease-in-out infinite}
.card.reveal.quick .radar-shape{animation-delay:.2s}
@media (prefers-reduced-motion: reduce){
  .card.reveal.quick .card-body{animation:none}
}
/* 托盘：这个卡包停放着一份未领取的预抽结果（换包后没领） */
.tray-pack.parked .tray-art{box-shadow:0 0 0 2px #7a3fe0,0 7px 10px -5px #2a1a3a88}
.tray-parked{position:absolute;top:-4px;left:-4px;width:9px;height:9px;border-radius:99px;background:#a86bff;box-shadow:0 0 0 2px #fff8;animation:tray-parked-pulse 2.4s ease-in-out infinite}
@keyframes tray-parked-pulse{50%{opacity:.45}}
@media (prefers-reduced-motion: reduce){.tray-parked{animation:none}}
/* 收藏集（作品集视图）专用的状态筛选与排序：沿用统一胶囊下拉外观 */
.binder-status,
.binder-sortcol { flex: 0 0 auto; }
.binder-status select:focus-visible,
.binder-sortcol select:focus-visible { outline: 2px solid #7a3fe0; outline-offset: 2px; }

/* 非中文模式（如 English）：收缩长标题与顶栏按钮字距，避免 375px 屏裁切或折行 */
html:not(:lang(zh)):not(:lang(zh-Hant)) .topbar .wordmark {
  font-size: 11.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
html:not(:lang(zh)):not(:lang(zh-Hant)) .topbar-tools {
  gap: 4px;
}
html:not(:lang(zh)):not(:lang(zh-Hant)) .topbar .mode-toggle {
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
}
html:not(:lang(zh)):not(:lang(zh-Hant)) #homeView h1 {
  font-size: clamp(24px, 7.6vw, 42px);
  letter-spacing: 0.01em;
}
/* 系列详情里的作品行：可点进单作品详情，所以要撑满一行并保留原有行内布局 */
.series-works li > .series-work-row {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.series-work-row:hover,
.series-work-row:focus-visible {
  border-color: #d8c9b4;
  background: #ffffffb0;
}
.series-work-row .work-progress {
  grid-column: 1 / -1;
  height: 3px;
}
.series-work-row .rarity {
  margin-left: 6px;
  font-size: 9.5px;
  padding: 0 6px;
}
/* 单作品详情头部的「返回系列」按钮 */
.series-work-back {
  margin-top: 8px;
  padding: 6px 12px;
  border: 1px solid #d8c9b4;
  border-radius: 99px;
  background: #ffffffd0;
  color: #4d4250;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.series-work-back:hover,
.series-work-back:focus-visible {
  border-color: #7a3fe0;
  color: #4b2a86;
}

/* 作品评价：Bangumi 评分与全站排名。
   评分用大字号做视觉锚点，排名做次要信息；两者都缺时 JS 不渲染这个块，不留空壳。 */
.series-rating {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin: 8px 0 2px;
}
.series-rating .rating-score {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  padding: 1px 9px 2px;
  border-radius: 9px;
  background: #ffb3001f;
  color: #8a5a00;
  font-variant-numeric: tabular-nums;
}
.series-rating .rating-score b {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
}
.series-rating .rating-score small {
  font-size: 10px;
  opacity: 0.75;
}
.series-rating .rating-rank {
  color: #6b6070;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.series-rating .rating-rank b {
  font-weight: 700;
  color: #4a4152;
}

/* 站内问题反馈表单弹窗与结果页反馈入口（浅色暖纸底高对比配色） */
.result-feedback-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.result-feedback,
.result-gyro {
  font-size: 12px;
  color: #6b6070;
}
.result-gyro[aria-pressed="true"] {
  border-color: #b796f2;
  background: #f2ebff;
  color: #4f2c92;
}
html[data-theme="dark"] .result-gyro {
  color: #bfb4cc;
}
html[data-theme="dark"] .result-gyro[aria-pressed="true"] {
  background: #302252;
  border-color: #b796f2;
  color: #f3ebff;
}
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  color: #2a2230;
}
.feedback-hint {
  margin: 0 0 2px;
  font-size: 12px;
  line-height: 1.5;
  color: #665b6b;
}
.feedback-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: #2a2230;
}
.feedback-count {
  font-weight: 600;
  font-size: 11px;
  color: #7a6e7d;
  font-variant-numeric: tabular-nums;
}
.feedback-select,
.feedback-textarea,
.feedback-contact {
  width: 100%;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid #d5c9b6;
  background: #faf7f1;
  color: #221b25;
  font: inherit;
  font-size: 13.5px;
  padding: 9px 11px;
}
.feedback-select:focus,
.feedback-textarea:focus,
.feedback-contact:focus {
  outline: none;
  border-color: #8c63d6;
  background: #fff;
}
.feedback-textarea::placeholder,
.feedback-contact::placeholder {
  color: #8c8090;
}
.feedback-select option {
  background: #fff;
  color: #221b25;
}
.feedback-textarea {
  resize: vertical;
  min-height: 86px;
  line-height: 1.5;
}
.feedback-honey {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.feedback-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: #3d3344;
  cursor: pointer;
}
.feedback-check input {
  margin-top: 2px;
  accent-color: #7a3fe0;
}
.feedback-actions {
  margin-top: 4px;
}
.feedback-actions .claim.secondary,
.feedback-actions .feedback-link {
  background: #f4efe6;
  color: #2f2536;
  border: 1px solid #d3c6b2;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.feedback-status {
  margin: 2px 0 0;
  min-height: 1.4em;
  font-size: 12.5px;
  font-weight: 600;
  color: #8a5600;
}
@media (pointer: coarse) {
  .feedback-select,
  .feedback-textarea,
  .feedback-contact {
    font-size: 16px;
  }
}

/* 主题切换弹窗选项 */
.theme-desc {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #665b6b;
}
.theme-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.theme-option {
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 11px 14px;
  border-radius: 14px;
  text-align: left;
  white-space: normal;
  background: #f5f0e7;
  color: #261e2c;
  border: 1px solid #d7cbb8;
  box-shadow: none;
  cursor: pointer;
}
.theme-option strong {
  font-size: 13.5px;
  font-weight: 750;
}
.theme-option small {
  font-size: 11.5px;
  font-weight: 500;
  color: #6e6274;
}
.theme-option.active {
  background: linear-gradient(135deg, #251d36, #392c54);
  color: #fff6e4;
  border-color: #d8b56c;
  box-shadow: 0 4px 14px rgba(34, 24, 56, 0.25);
}
.theme-option.active small {
  color: rgba(255, 238, 200, 0.84);
}

/* ================= 黑夜星夜主题（html[data-theme="dark"]） ================= */
html[data-theme="dark"] {
  --bg: #0f0d19;
  --ink: #f4ede0;
  --dim: #a99eb8;
  --muted: #9f94ae;
  background: #0f0d19;
}
html[data-theme="dark"] body {
  color: #f4ede0;
  background:
    radial-gradient(125% 78% at 50% -6%, #241d3d 0%, #151224 44%, #0d0b16 100%);
  background-attachment: fixed;
}
html[data-theme="dark"] body::before {
  background:
    linear-gradient(rgba(255, 238, 206, 0.045) 1px, transparent 1px) 0 0 / 100% 36px,
    linear-gradient(90deg, rgba(255, 238, 206, 0.045) 1px, transparent 1px) 0 0 / 36px 100%;
}
html[data-theme="dark"] .topbar .wordmark,
html[data-theme="dark"] h1,
html[data-theme="dark"] .binder h2,
html[data-theme="dark"] .market h2,
html[data-theme="dark"] .trophy h2 {
  color: #f6efe2;
}
html[data-theme="dark"] .tagline,
html[data-theme="dark"] #packHint,
html[data-theme="dark"] .site-stats,
html[data-theme="dark"] .counter,
html[data-theme="dark"] .binder p,
html[data-theme="dark"] .cultivate-hint {
  color: #a99eb8;
}
html[data-theme="dark"] .site-stats b,
html[data-theme="dark"] .counter strong {
  color: #ebd094;
}
html[data-theme="dark"] .mode-toggle,
html[data-theme="dark"] .icon-button,
html[data-theme="dark"] .index-button,
html[data-theme="dark"] button.back,
html[data-theme="dark"] .more,
html[data-theme="dark"] .share-button,
html[data-theme="dark"] .level-info,
html[data-theme="dark"] .level-chest,
html[data-theme="dark"] .pager button,
html[data-theme="dark"] .series-work-back {
  background: #1f1b30;
  border-color: rgba(255, 236, 198, 0.16);
  color: #f2eadc;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
html[data-theme="dark"] .mode-toggle:hover,
html[data-theme="dark"] .icon-button:hover,
html[data-theme="dark"] button.back:hover,
html[data-theme="dark"] .share-button:hover {
  background: #29243f;
  border-color: rgba(242, 208, 134, 0.38);
}
html[data-theme="dark"] .favorite[aria-pressed="true"] {
  background: #3d1b30;
  border-color: rgba(255, 118, 166, 0.55);
  color: #ff77a8;
}
html[data-theme="dark"] .level-num {
  color: #f0cc80;
}
html[data-theme="dark"] .level-bar {
  background: #1b172b;
  border-color: rgba(255, 236, 198, 0.14);
}
html[data-theme="dark"] .level-bar i:not(.on) {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.45);
}
html[data-theme="dark"] .tray-pack {
  background: #1b172a;
  border-color: rgba(255, 236, 198, 0.14);
  color: #ede4d4;
}
html[data-theme="dark"] .tray-pack.current {
  background: #27203d;
  border-color: rgba(244, 210, 128, 0.62);
}
html[data-theme="dark"] .tray-name {
  color: #dcd3e6;
}
html[data-theme="dark"] .tray-count {
  background: #2c2444;
  color: #f6dca0;
}
html[data-theme="dark"] .pack-shadow {
  background: #040308;
  opacity: 0.68;
}
html[data-theme="dark"] #warning {
  background: rgba(56, 36, 22, 0.72);
  border-color: rgba(245, 196, 110, 0.34);
  color: #f8dca0;
}
html[data-theme="dark"] .announce {
  background: rgba(34, 28, 52, 0.94);
  border: 1px solid rgba(242, 208, 134, 0.32);
  color: #fff3da;
}
html[data-theme="dark"] .result-progress {
  background: #201c31;
  border-color: rgba(242, 208, 134, 0.24);
  color: #f0dfc0;
}
html[data-theme="dark"] .result-feedback {
  color: #bfb4cc;
}

/* 图鉴筛选、搜索、收藏集与卡面保持清晰层次 */
html[data-theme="dark"] .binder-tabs {
  background: #1b172b;
  border-color: rgba(255, 236, 198, 0.14);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
html[data-theme="dark"] .binder-tabs button {
  color: #b4a9c4;
}
html[data-theme="dark"] .binder-tabs button[aria-pressed="true"] {
  background: #f2e4c4;
  color: #1c1528;
}
html[data-theme="dark"] .binder-search input,
html[data-theme="dark"] .binder-sort select,
html[data-theme="dark"] .binder-media select,
html[data-theme="dark"] .binder-decade select,
html[data-theme="dark"] .binder-status select,
html[data-theme="dark"] .binder-sortcol select {
  background-color: #1c182c;
  border-color: rgba(255, 236, 198, 0.16);
  color: #f4ede0;
}
html[data-theme="dark"] .binder-search input::placeholder {
  color: #8f849e;
}
html[data-theme="dark"] .binder-sort select option,
html[data-theme="dark"] .binder-media select option,
html[data-theme="dark"] .binder-decade select option,
html[data-theme="dark"] .binder-status select option,
html[data-theme="dark"] .binder-sortcol select option {
  background: #1c182c;
  color: #f4ede0;
}
html[data-theme="dark"] .tier-filter .rarity[aria-pressed="true"] {
  box-shadow: 0 0 0 2px #141122, 0 0 0 4px #f2d48f;
}
html[data-theme="dark"] .empty {
  border-color: rgba(255, 236, 198, 0.18);
  color: #a69bb6;
}
html[data-theme="dark"] .work-collection,
html[data-theme="dark"] .work-collection > button,
html[data-theme="dark"] .series-card,
html[data-theme="dark"] .series-work-card {
  background: #1a1629;
  border-color: rgba(255, 236, 198, 0.14);
  color: #f4ede0;
}
html[data-theme="dark"] .work-collection small,
html[data-theme="dark"] .series-summary,
html[data-theme="dark"] .series-rating .rating-rank {
  color: #aca0bc;
}
html[data-theme="dark"] .series-rating .rating-score {
  background: rgba(255, 196, 70, 0.16);
  color: #ffd37a;
}
html[data-theme="dark"] .series-rating .rating-rank b {
  color: #e6d8f2;
}
/* 常态卡实体印刷纸面在黑夜背景下保持深墨可读 */
html[data-theme="dark"] .card-inner:not(.full-art),
html[data-theme="dark"] .card-inner.full-art.show-dossier .record,
html[data-theme="dark"] .binder-card:not(.full-art) {
  --ink: #221b25;
  --muted: #5a4f61;
  color: #221b25;
}
html[data-theme="dark"] .card-inner:not(.full-art) .record h2,
html[data-theme="dark"] .card-inner.full-art.show-dossier .record h2,
html[data-theme="dark"] .card-inner:not(.full-art) .card-score,
html[data-theme="dark"] .card-inner.full-art.show-dossier .record .card-score {
  color: #221b25;
}
.card-inner.full-art .card-titlebar .card-score {
  color: #ffd97d;
}

/* 市场、星屑工坊、开包记录、奖杯页 */
html[data-theme="dark"] .offer {
  --badge-outline: #171426;
  background: linear-gradient(180deg, #211c33, #171426);
  box-shadow:
    inset 0 0 0 1px rgba(255, 236, 198, 0.16),
    0 12px 22px -14px rgba(0, 0, 0, 0.72);
  color: #f4ede0;
}
html[data-theme="dark"] .offer.free {
  background: linear-gradient(160deg, #2c2342, #1e1930);
  box-shadow:
    inset 0 0 0 1px rgba(244, 210, 128, 0.42),
    0 12px 22px -14px rgba(0, 0, 0, 0.72);
}
html[data-theme="dark"] .offer-name {
  color: #f6efe2;
}
html[data-theme="dark"] .offer-name span {
  color: #b7abc8;
}
html[data-theme="dark"] .offer.taken .claim {
  background: #28223a;
  color: #8f849e;
}
html[data-theme="dark"] .market-free,
html[data-theme="dark"] .market-card,
html[data-theme="dark"] .bgm-exchange,
html[data-theme="dark"] .history-summary,
html[data-theme="dark"] .history-item,
html[data-theme="dark"] .trophy-row,
html[data-theme="dark"] .rank-panel {
  background: #1a162a;
  border-color: rgba(255, 236, 198, 0.14);
  color: #f4ede0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
html[data-theme="dark"] .market-timer,
html[data-theme="dark"] .history-summary,
html[data-theme="dark"] .history-item small,
html[data-theme="dark"] .trophy-text small,
html[data-theme="dark"] .trophy-value,
html[data-theme="dark"] .rank-panel small {
  color: #aba0bb;
}
html[data-theme="dark"] .market-timer b,
html[data-theme="dark"] .history-summary b,
html[data-theme="dark"] .history-info b,
html[data-theme="dark"] .trophy-text strong,
html[data-theme="dark"] .bgm-exchange strong,
html[data-theme="dark"] .bgm-exchange h3,
html[data-theme="dark"] .rank-panel strong {
  color: #f7efe2;
}
html[data-theme="dark"] .trophy-progress {
  background: rgba(255, 255, 255, 0.1);
}
html[data-theme="dark"] .trophy-section {
  color: #aba0bb;
}
html[data-theme="dark"] .trophy-section b {
  color: #f4ede0;
}
html[data-theme="dark"] .trophy-rank {
  background: rgba(242, 198, 109, 0.18);
  color: #f3cf7a;
}
html[data-theme="dark"] .cultivate-button.unlocked {
  background: linear-gradient(135deg, #322452, #463274);
  border-color: #b796f2;
  color: #f5eeff;
}

/* 弹窗、反馈表单与主题选择器黑夜适配 */
html[data-theme="dark"] dialog {
  color: #f4ede0;
  background: linear-gradient(180deg, #211d34, #171426);
  border-color: rgba(255, 232, 184, 0.18);
  box-shadow: 0 28px 68px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] dialog::backdrop {
  background: rgba(6, 4, 12, 0.72);
}
html[data-theme="dark"] .dialog-body,
html[data-theme="dark"] .theme-desc,
html[data-theme="dark"] .feedback-hint {
  color: #cbc0d8;
}
html[data-theme="dark"] .dialog-body b {
  color: #f2cb7c;
}
html[data-theme="dark"] .dialog-close {
  background: #28233d;
  border-color: rgba(255, 236, 198, 0.18);
  color: #f2eadc;
}
html[data-theme="dark"] .feedback-form,
html[data-theme="dark"] .feedback-label,
html[data-theme="dark"] .feedback-check {
  color: #f3ecde;
}
html[data-theme="dark"] .feedback-count {
  color: #a79cb6;
}
html[data-theme="dark"] .feedback-select,
html[data-theme="dark"] .feedback-textarea,
html[data-theme="dark"] .feedback-contact,
html[data-theme="dark"] .gift-input {
  background: #131020;
  border-color: rgba(255, 234, 192, 0.2);
  color: #f6efe2;
}
html[data-theme="dark"] .feedback-select option {
  background: #1a162a;
  color: #f6efe2;
}
html[data-theme="dark"] .feedback-textarea::placeholder,
html[data-theme="dark"] .feedback-contact::placeholder,
html[data-theme="dark"] .gift-input::placeholder {
  color: #8f839e;
}
html[data-theme="dark"] .feedback-actions .claim.secondary,
html[data-theme="dark"] .feedback-actions .feedback-link {
  background: #27223b;
  color: #f5ede0;
  border-color: rgba(242, 208, 134, 0.28);
}
html[data-theme="dark"] .feedback-status {
  color: #f5cf7a;
}
html[data-theme="dark"] .theme-option {
  background: #221d35;
  color: #f4ede0;
  border-color: rgba(255, 236, 198, 0.16);
}
html[data-theme="dark"] .theme-option small {
  color: #a99eb8;
}
html[data-theme="dark"] .theme-option.active {
  background: linear-gradient(135deg, #3c2c66, #523d85);
  color: #fff8ea;
  border-color: #e8c67c;
}
html[data-theme="dark"] .theme-option.active small {
  color: rgba(255, 240, 206, 0.88);
}
html[data-theme="dark"] .claim {
  background: linear-gradient(135deg, #f3d796, #dfb560);
  color: #261a08;
}
html[data-theme="dark"] .shared-dock .home-entries {
  background: #1c182d;
  border: 1px solid rgba(255, 236, 198, 0.14);
}

/* ================= 移动端性能与紧凑底栏 + 图鉴滚动/翻页过渡 ================= */
@media (pointer: coarse), (max-width: 600px) {
  /* 取消实时 WebGL 画布上的 CSS drop-shadow，避免手机每帧回读帧缓冲做模糊（已有 .pack-shadow） */
  #pack3d {
    filter: none !important;
  }
  /* tab-layout 下 body 已锁高不滚动，改为 scroll 避免移动端浏览器关闭 GPU 合成 */
  body,
  html[data-theme="dark"] body {
    background-attachment: scroll;
  }
}

/* 移动端底部功能栏紧凑化：压低高度占比（约 145px → 86px），单手切换更顺手 */
@media (max-width: 560px) {
  .shared-dock {
    padding-top: 0;
  }
  .shared-dock .home-entries {
    margin: 4px 0 4px;
    padding: 3px;
    gap: 3px;
    border-radius: 15px;
  }
  .shared-dock .entry {
    height: 38px;
    min-height: 38px;
    padding: 3px 2px;
    gap: 2px;
    font-size: 11px;
    border-radius: 12px;
  }
  .shared-dock .entry-icon,
  .shared-dock .entry-icon svg {
    width: 16px;
    height: 16px;
  }
  .shared-dock .foot-row {
    margin: 0 0 2px;
    gap: 4px;
  }
  .shared-dock .foot-row .mode-toggle {
    min-height: 25px;
    height: 25px;
    padding: 0 8px;
    font-size: 11px;
    border-radius: 99px;
  }
  .shared-dock .counter {
    padding: 2px 0 max(4px, env(safe-area-inset-bottom));
    font-size: 10px;
    letter-spacing: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 10px;
}
.pager .pager-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #dfd3be;
  background: linear-gradient(180deg, #fffdf9, #f5ede0);
  color: #463a2e;
  display: grid;
  place-items: center;
  box-shadow: 0 3px 10px -6px rgba(42, 28, 12, 0.32), inset 0 1px 0 #ffffff;
  cursor: pointer;
  transition: transform 0.16s var(--ease), border-color 0.18s ease, opacity 0.18s ease;
}
.pager .pager-btn:active:not(:disabled) {
  transform: scale(0.92);
}
.pager .pager-btn svg {
  width: 15px;
  height: 15px;
}
.pager .pager-btn:disabled {
  opacity: 0.32;
  cursor: default;
}
.pager-jump {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 6px;
  border-radius: 999px;
  border: 1px solid #dfd3be;
  background: #fffdf8;
  box-shadow: inset 0 1px 2px rgba(42, 28, 12, 0.05);
}
.pager-input {
  width: 40px;
  height: 24px;
  padding: 0 3px;
  border: 1px solid #e4d8c4;
  border-radius: 6px;
  background: #f8f3e8;
  color: #2f251b;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.pager-input::-webkit-outer-spin-button,
.pager-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.pager span.pager-sep,
.pager span.pager-total {
  min-width: auto;
  width: auto;
  padding: 0 1px;
  font-size: 12px;
  font-weight: 700;
  color: #7d6f5d;
  font-variant-numeric: tabular-nums;
}
.pager .pager-go {
  width: auto;
  height: 24px;
  min-width: 38px;
  padding: 0 8px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(180deg, #3c3154, #261e38);
  color: #fff2cc;
  font-size: 11px;
  font-weight: 700;
  box-shadow: none;
  cursor: pointer;
}
.pager .pager-go:active {
  transform: scale(0.94);
}
html[data-theme="dark"] .pager-jump {
  border-color: rgba(255, 236, 198, 0.16);
  background: #1b172b;
}
html[data-theme="dark"] .pager-input {
  border-color: rgba(255, 236, 198, 0.18);
  background: #27213c;
  color: #f6eedf;
}
html[data-theme="dark"] .pager-sep,
html[data-theme="dark"] .pager-total {
  color: #b7ac9c;
}
html[data-theme="dark"] .pager .pager-go {
  background: linear-gradient(180deg, #624d8c, #40325e);
  color: #ffeab3;
}
html[data-theme="dark"] .work-collection .series-fav {
  border-left-color: rgba(255, 236, 198, 0.1);
  color: #827894;
}
html[data-theme="dark"] .work-collection .series-fav[aria-pressed="true"] {
  color: #ffd466;
  background: rgba(255, 212, 102, 0.14);
}
html[data-theme="dark"] .series-fav-pill {
  border-color: rgba(255, 236, 198, 0.2);
  background: #221d34;
  color: #ded5c8;
}
html[data-theme="dark"] .series-fav-pill[aria-pressed="true"] {
  border-color: rgba(247, 206, 114, 0.7);
  background: linear-gradient(180deg, #4b3316, #2f200d);
  color: #ffe18c;
}

/* 异画加载占位微光：图片从 COS 下载解码前不生硬闪黑 */
.card-inner.full-art,
.binder-card.full-art {
  background: linear-gradient(125deg, #1b1726 25%, #282138 50%, #1b1726 75%);
  background-size: 220% 100%;
}

/* 图鉴滚动显现 + 翻页/手势滑动过渡 */
.binder-list.swiping {
  transform: translate3d(var(--binder-swipe-x, 0px), 0, 0);
  transition: none;
}
.binder-list.page-next {
  animation: binder-slide-next 0.28s cubic-bezier(0.22, 0.85, 0.3, 1) both;
}
.binder-list.page-prev {
  animation: binder-slide-prev 0.28s cubic-bezier(0.22, 0.85, 0.3, 1) both;
}
@keyframes binder-slide-next {
  from {
    opacity: 0.25;
    transform: translate3d(26px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}
@keyframes binder-slide-prev {
  from {
    opacity: 0.25;
    transform: translate3d(-26px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}
.binder-card.reveal-wait,
.work-collection.reveal-wait {
  opacity: 0;
  transform: translate3d(0, 14px, 0) scale(0.975);
  animation: none !important;
}
.binder-card.reveal-in,
.work-collection.reveal-in {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  transition:
    opacity 0.32s cubic-bezier(0.22, 0.85, 0.3, 1),
    transform 0.34s cubic-bezier(0.22, 0.85, 0.3, 1);
  animation: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .binder-list.page-next,
  .binder-list.page-prev {
    animation: none;
  }
  .binder-card.reveal-wait,
  .work-collection.reveal-wait {
    opacity: 1;
    transform: none;
  }
}

/* 小屏（<= 640px 宽）常规卡：因 #cardStage 已由 --card-scale 整体等比缩放，内部沿用 200px 完整 3:2 头图与紧凑档案区，不重复缩窄或加双层内边距 */
@media (max-width: 640px) {
  .card-inner:not(.full-art) .record {
    padding: 0;
    scrollbar-width: none;
  }
  .card-inner:not(.full-art) .record::-webkit-scrollbar {
    display: none;
  }
}

/* 常规非异画卡面长按头图：页面级原立绘浮层预览 */
.portrait-peek-overlay {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  background: rgba(12, 10, 20, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.18s ease;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}
.portrait-peek-overlay[hidden] {
  display: none;
}
.portrait-peek-overlay.open {
  opacity: 1;
}
.portrait-peek-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 420px);
  max-height: 86dvh;
  transform: scale(0.92);
  transition: transform 0.22s cubic-bezier(0.22, 0.9, 0.3, 1);
}
.portrait-peek-overlay.open .portrait-peek-frame {
  transform: scale(1);
}
.portrait-peek-img {
  display: block;
  max-width: 100%;
  max-height: 74dvh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 14px;
  background: linear-gradient(160deg, #f7f3ea, #e7dfd0);
  box-shadow:
    0 24px 56px rgba(0, 0, 0, 0.62),
    0 0 0 1.5px rgba(255, 240, 204, 0.45);
  -webkit-user-drag: none;
}
.portrait-peek-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(20, 16, 32, 0.78);
  border: 1px solid rgba(255, 236, 188, 0.28);
  color: #fffaf0;
  text-align: center;
  max-width: 100%;
}
.portrait-peek-name {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.25;
}
.portrait-peek-work {
  font-size: 11.5px;
  color: rgba(255, 236, 188, 0.88);
  max-width: 78vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portrait-peek-tip {
  margin-top: 2px;
  font-size: 10.5px;
  color: rgba(255, 245, 224, 0.62);
}
@media (prefers-reduced-motion: reduce) {
  .portrait-peek-overlay,
  .portrait-peek-frame {
    transition: none;
  }
}

/* ==================== 全局经验槽、颜色染色与浮动 EXP +N 动效 ==================== */
#frame > .level-row {
  flex: none;
  width: 100%;
  margin: 2px 0 4px;
  padding: 2px 2px;
}
.level-bar i.on[data-tint="N"] {
  background: linear-gradient(180deg, #f0f4fa, #9ea9bd);
  box-shadow: inset 0 1px 0 #ffffffcc, 0 0 6px rgba(176, 188, 208, 0.55);
}
.level-bar i.on[data-tint="R"] {
  background: linear-gradient(180deg, #8ec5ff, #2b6be0);
  box-shadow: inset 0 1px 0 #ffffffa8, 0 0 7px rgba(58, 136, 255, 0.65);
}
.level-bar i.on[data-tint="SR"] {
  background: linear-gradient(180deg, #d7b2ff, #7c3ce6);
  box-shadow: inset 0 1px 0 #ffffffa8, 0 0 7px rgba(154, 88, 255, 0.68);
}
.level-bar i.on[data-tint="SSR"] {
  background: linear-gradient(180deg, #ffe08a, #f08a12);
  box-shadow: inset 0 1px 0 #ffffffbb, 0 0 8px rgba(255, 174, 42, 0.72);
}
.level-bar i.on[data-tint="UR"] {
  background: linear-gradient(105deg, #ff3d7f, #ff9f0a, #f5c400, #18c98f, #2f9bff, #a855f7, #ff3d7f) 0 0 / 220% 100%;
  box-shadow: inset 0 1px 0 #ffffffcc, 0 0 9px rgba(255, 108, 198, 0.78);
  animation: chip-flow-ur 2.4s linear infinite;
}
.level-bar i.pop {
  animation: exp-cell-pop 0.42s cubic-bezier(0.22, 1.25, 0.36, 1) both;
}
.level-bar i.on[data-tint="UR"].pop {
  animation: exp-cell-pop 0.42s cubic-bezier(0.22, 1.25, 0.36, 1) both, chip-flow-ur 2.4s linear infinite;
}
@keyframes exp-cell-pop {
  0% {
    transform: scaleY(0.45) scaleX(0.7);
    filter: brightness(1.65);
  }
  55% {
    transform: scaleY(1.38) scaleX(1.06);
    filter: brightness(1.35);
  }
  100% {
    transform: none;
    filter: none;
  }
}

/* 浮动 EXP +N 弹出层 */
.exp-float-layer {
  position: fixed;
  inset: 0;
  z-index: 48;
  pointer-events: none;
  overflow: hidden;
}
.exp-float {
  position: fixed;
  transform: translate(-50%, 0);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(24, 19, 36, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.48);
  animation: exp-float-up 1.25s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
}
.exp-float-tag {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 700;
  opacity: 0.9;
}
.exp-float.N {
  color: #eef3fb;
  border-color: rgba(196, 206, 224, 0.65);
  box-shadow: 0 6px 16px -4px rgba(164, 178, 202, 0.5);
}
.exp-float.R {
  color: #82c4ff;
  border-color: rgba(88, 162, 255, 0.72);
  box-shadow: 0 6px 18px -4px rgba(47, 111, 224, 0.62);
}
.exp-float.SR {
  color: #dab2ff;
  border-color: rgba(176, 116, 255, 0.76);
  box-shadow: 0 6px 18px -4px rgba(132, 66, 232, 0.66);
}
.exp-float.SSR {
  color: #ffd76e;
  border-color: rgba(255, 196, 70, 0.82);
  box-shadow: 0 6px 20px -4px rgba(240, 138, 18, 0.72);
}
.exp-float.UR {
  border-color: rgba(255, 160, 220, 0.88);
  box-shadow: 0 6px 22px -4px rgba(255, 86, 170, 0.72);
}
.exp-float.UR b {
  background: linear-gradient(90deg, #ff5d9e, #ffba42, #fff176, #43e9b2, #5ab4ff, #c985ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}
@keyframes exp-float-up {
  0% {
    opacity: 0;
    transform: translate(-50%, 10px) scale(0.74);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -6px) scale(1.1);
  }
  34% {
    opacity: 1;
    transform: translate(-50%, -14px) scale(1);
  }
  75% {
    opacity: 1;
    transform: translate(-50%, -34px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -48px) scale(0.95);
  }
}

/* 成就页 EXP 奖励标签（按成就档位着色） */
.trophy-text strong {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.trophy-exp {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}
.trophy-exp.N {
  background: #e9eef6;
  color: #4f5c70;
}
.trophy-exp.R {
  background: #e1efff;
  color: #1f5ec7;
}
.trophy-exp.SR {
  background: #f0e4ff;
  color: #6f32d4;
}
.trophy-exp.SSR {
  background: #fff0cc;
  color: #b85d00;
}
.trophy-exp.UR {
  background: linear-gradient(90deg, #ffe0ee, #fff0cc, #d9faee, #e0eeff, #f0e2ff);
  color: #9b1d66;
}
.trophy-exp.done {
  opacity: 0.72;
}
html[data-theme="dark"] .trophy-exp.N {
  background: rgba(208, 218, 236, 0.16);
  color: #dbe3f2;
}
html[data-theme="dark"] .trophy-exp.R {
  background: rgba(68, 146, 255, 0.22);
  color: #8cc4ff;
}
html[data-theme="dark"] .trophy-exp.SR {
  background: rgba(154, 88, 255, 0.24);
  color: #d6b2ff;
}
html[data-theme="dark"] .trophy-exp.SSR {
  background: rgba(255, 184, 54, 0.22);
  color: #ffd772;
}
html[data-theme="dark"] .trophy-exp.UR {
  background: linear-gradient(90deg, rgba(255, 61, 127, 0.28), rgba(255, 180, 40, 0.28), rgba(47, 155, 255, 0.28), rgba(168, 85, 247, 0.28));
  color: #ffe8f7;
}

/* 图鉴页出卡经验对照条 */
.binder-exp-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 4px 0 8px;
}
.binder-exp-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--dim);
  margin-right: 2px;
}
.binder-exp-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.binder-exp-chip.N {
  background: #e9eef6;
  color: #4f5c70;
}
.binder-exp-chip.R {
  background: #e1efff;
  color: #1f5ec7;
}
.binder-exp-chip.SR {
  background: #f0e4ff;
  color: #6f32d4;
}
.binder-exp-chip.SSR {
  background: #fff0cc;
  color: #b85d00;
}
.binder-exp-chip.UR {
  background: linear-gradient(90deg, #ffe0ee, #fff0cc, #d9faee, #e0eeff, #f0e2ff);
  color: #9b1d66;
}
html[data-theme="dark"] .binder-exp-chip.N {
  background: rgba(208, 218, 236, 0.14);
  color: #dce4f2;
}
html[data-theme="dark"] .binder-exp-chip.R {
  background: rgba(68, 146, 255, 0.2);
  color: #8cc4ff;
}
html[data-theme="dark"] .binder-exp-chip.SR {
  background: rgba(154, 88, 255, 0.22);
  color: #d6b2ff;
}
html[data-theme="dark"] .binder-exp-chip.SSR {
  background: rgba(255, 184, 54, 0.2);
  color: #ffd772;
}
html[data-theme="dark"] .binder-exp-chip.UR {
  background: linear-gradient(90deg, rgba(255, 61, 127, 0.26), rgba(255, 180, 40, 0.26), rgba(47, 155, 255, 0.26), rgba(168, 85, 247, 0.26));
  color: #ffe8f7;
}
/* ==================== 丝滑切包舞台衔接与托盘微弹 ==================== */
.stage.pack-swapping .pack-wrap {
  opacity: 0;
  pointer-events: none;
  transition: none;
}
.stage .pack-shadow {
  transition: opacity 220ms ease, transform 240ms cubic-bezier(0.22, 0.86, 0.32, 1);
}
.stage.pack-swapping .pack-shadow {
  opacity: 0.24;
  transform: translateX(-50%) scale(0.68);
  animation-play-state: paused;
}
.pack-wrap.pack-land {
  animation:
    pack-land 380ms cubic-bezier(0.22, 1, 0.36, 1) both,
    float 5.2s ease-in-out 380ms infinite;
}
.pack-wrap.pack-nudge {
  animation:
    pack-nudge 340ms cubic-bezier(0.22, 1.28, 0.36, 1) both,
    float 5.2s ease-in-out 340ms infinite;
}
@keyframes pack-land {
  0% {
    opacity: 0.35;
    transform: translateY(-2px) scale(1.032, 0.974);
  }
  32% {
    opacity: 1;
    transform: translateY(4px) scale(0.986, 1.016);
  }
  68% {
    opacity: 1;
    transform: translateY(7px) scale(1.006, 0.996);
  }
  100% {
    opacity: 1;
    transform: translateY(6px) scale(1);
  }
}
@keyframes pack-nudge {
  0% {
    transform: translateY(6px) scale(1);
  }
  30% {
    transform: translateY(0px) scale(1.045, 0.965);
  }
  66% {
    transform: translateY(8px) scale(0.99, 1.012);
  }
  100% {
    transform: translateY(6px) scale(1);
  }
}
.stage .halo.halo-pulse {
  animation:
    halo-swap-pulse 480ms ease-out both,
    breathe 6s ease-in-out 480ms infinite;
}
@keyframes halo-swap-pulse {
  0% {
    opacity: 0.65;
    transform: translate(-50%, -50%) scale(0.9);
  }
  38% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.12);
  }
  100% {
    opacity: 0.75;
    transform: translate(-50%, -50%) scale(0.96);
  }
}
.tray-pack {
  animation: none;
  transition:
    transform 280ms cubic-bezier(0.22, 1.25, 0.36, 1),
    box-shadow 240ms ease,
    background-color 200ms ease;
}
.tray-pack.current {
  transform: translateY(-3px) scale(1.03);
}
.tray-pack.tray-tuck {
  animation: tray-tuck 320ms cubic-bezier(0.22, 1.28, 0.36, 1) both;
}
@keyframes tray-tuck {
  0% {
    transform: translateY(0) scale(1);
  }
  38% {
    transform: translateY(2px) scale(1.07, 0.94);
  }
  72% {
    transform: translateY(-1px) scale(0.98, 1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .exp-float,
  .level-bar i.pop,
  .level-bar i.on[data-tint="UR"],
  .pack-wrap.pack-land,
  .pack-wrap.pack-nudge,
  .stage .halo.halo-pulse,
  .tray-pack.tray-tuck,
  .swap-ghost.swap-in::after {
    animation: none;
  }
}

/* ==================== 手机端防拥挤与阅读体验优化（360px–640px 竖屏真机实测） ==================== */
@media (max-width: 640px) {
  /* 1. 顶栏与全局经验槽：避免宝箱按钮/等级角标被 22px 高度裁切 */
  .topbar {
    height: 48px;
  }
  .topbar .wordmark {
    font-size: 14px;
  }
  #frame > .level-row {
    min-height: 32px;
    margin: 2px 0 6px;
    padding: 2px 2px;
    gap: 8px;
  }

  /* 2. 开包主页：在 375×667 等小屏保持紧凑节奏，确保「连开 5 包」完整露在底栏上方不被遮挡 */
  #homeView:not([hidden]) {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding-bottom: 10px;
  }
  #homeView .intro {
    padding-top: 0;
    margin: 0 0 2px;
  }
  #homeView .intro h1 {
    font-size: 24px;
    line-height: 1.15;
  }
  #homeView .intro .tagline {
    margin-top: 2px;
    font-size: 12px;
    line-height: 1.35;
  }
  #homeView .stage {
    flex: 1 1 156px;
    min-height: 156px;
    height: clamp(156px, 25dvh, 250px);
  }
  #homeView .pack-wrap {
    height: clamp(140px, 22dvh, 220px);
  }
  #homeView #packHint {
    margin: 2px 0 4px;
    font-size: 12px;
    line-height: 1.35;
  }
  #homeView .tray-wrap {
    margin: 0 0 4px;
  }
  #homeView .tray-shell {
    padding: 5px 4px 6px;
  }
  #homeView .home-actions {
    margin: 2px 0 6px;
  }

  /* 3. 图鉴页：收紧顶部控制区（从 ~360px 压到 ~210px），首屏直接露出清晰卡片，消除杂乱折行 */
  .binder {
    padding-top: 4px;
    padding-bottom: 20px;
  }
  .binder h2 {
    margin: 0 0 2px;
    font-size: 20px;
    line-height: 1.25;
  }
  #binderCount {
    margin: 0 0 6px;
    font-size: 12.5px;
    line-height: 1.4;
  }
  .binder-exp-bar {
    flex-wrap: wrap;
    overflow: visible;
    margin: 0 0 6px;
    padding-bottom: 0;
    gap: 4px;
  }
  .binder-exp-label,
  .binder-exp-chip {
    flex: none;
    white-space: nowrap;
  }
  .binder-exp-label {
    font-size: 10.5px;
  }
  .binder-exp-chip {
    font-size: 10px;
    padding: 1px 6px;
  }
  .binder-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px 6px;
    margin: 0 0 8px;
    align-items: center;
  }
  .binder-controls .binder-tabs {
    grid-column: 1 / -1;
    order: 0;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    width: 100%;
    padding: 3px;
    border-radius: 12px;
  }
  .binder-controls .binder-tabs::-webkit-scrollbar {
    display: none;
  }
  .binder-controls .binder-tabs button {
    flex: 1 0 auto;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12.5px;
    white-space: nowrap;
  }
  .binder-search {
    grid-column: 1 / -1;
    order: 1;
  }
  .binder-search input {
    min-height: 36px;
    padding: 0 13px;
    font-size: 13.5px;
  }
  .binder-media,
  .binder-decade,
  .binder-sort,
  .binder-status,
  .binder-sortcol {
    order: 2;
    min-width: 0;
    width: 100%;
  }
  .binder-status,
  .binder-sortcol {
    grid-column: span 1;
  }
  .binder-media select,
  .binder-decade select,
  .binder-sort select,
  .binder-status select,
  .binder-sortcol select {
    width: 100%;
    min-width: 0;
    height: 34px;
    min-height: 34px;
    font-size: 11.5px;
    line-height: 32px;
    padding: 0 22px 0 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
  }
  .binder-media select::-ms-expand,
  .binder-decade select::-ms-expand,
  .binder-sort select::-ms-expand,
  .binder-status select::-ms-expand,
  .binder-sortcol select::-ms-expand {
    display: none;
  }
  .binder-media select::picker-icon,
  .binder-decade select::picker-icon,
  .binder-sort select::picker-icon,
  .binder-status select::picker-icon,
  .binder-sortcol select::picker-icon {
    display: none;
  }
  .binder-sort select {
    padding: 0 18px 0 22px;
    background-image: none;
  }
  .binder-sort svg:first-child {
    inset-inline-start: 7px;
    width: 12px;
    height: 12px;
  }
  .binder-sort .binder-sort-chevron {
    inset-inline-end: 7px;
    width: 10px;
    height: 10px;
  }
  .tier-filter {
    margin: 0 0 6px;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 8px 6px;
  }
  .tier-filter::-webkit-scrollbar {
    display: none;
  }
  .tier-filter .rarity {
    flex: none;
    font-size: 11.5px;
    padding: 0.45em 0.95em;
  }
  .binder-list {
    gap: 10px;
  }
  .binder-meta {
    padding: 8px 36px 8px 10px;
  }
  .binder-meta strong {
    font-size: 13.5px;
    line-height: 1.3;
  }
  .binder-meta small {
    font-size: 11.5px;
    line-height: 1.35;
    margin-top: 2px;
  }

  /* 4. 卡片详情 / 结果页：保持原生 340×556 卡面比例不畸变，按小屏宽高阶梯等比缩放，确保更小尺寸设备也不挤压、不出界 */
  :root {
    --card-height: 556px;
    --card-scale: 0.88;
  }
  .result {
    width: min(94vw, 356px);
    padding-top: 2px;
  }
  .result-bar {
    height: 34px;
    margin-bottom: 4px;
  }
  #resultView #cardStage {
    width: 340px;
    height: var(--card-height);
    position: relative;
    left: 50%;
    margin-left: -170px;
    transform: scale(var(--card-scale, 1));
    transform-origin: top center;
    margin-bottom: calc(var(--card-height) * (var(--card-scale, 1) - 1));
  }
  #resultView .cta-row {
    margin: 8px 0 4px;
  }
  #resultView .cta-row .primary {
    min-height: 42px;
    height: 42px;
  }
  #resultView .result-feedback-row {
    margin-top: 4px;
  }
}
@media (max-width: 640px) and (max-height: 780px), (max-width: 380px) {
  :root {
    --card-scale: 0.82;
  }
}
@media (max-width: 640px) and (max-height: 700px), (max-width: 350px) {
  :root {
    --card-scale: 0.74;
  }
}
@media (max-width: 640px) and (max-height: 620px), (max-width: 325px) {
  :root {
    --card-scale: 0.66;
  }
}
@media (max-width: 640px) {

  /* 5. 市场页：与图鉴同宽、收紧顶部冗余留白，让卡包货架上移到上半屏 */
  .market {
    padding: 4px 0 20px;
  }
  .market h2 {
    margin: 0 0 8px;
    font-size: 20px;
    line-height: 1.25;
  }
  .market-free {
    gap: 8px;
  }
  .offer.free {
    padding: 9px 8px 8px;
    gap: 6px;
  }
  .offer.free .offer-pack {
    width: 60px;
    height: 86px;
  }
  .market-grid .offer-pack {
    width: 74px;
    height: 106px;
  }
  .market-bar {
    margin: 10px 2px 8px;
  }
  .market-shelf-title {
    font-size: 13px;
  }
  .market-timer {
    font-size: 12px;
  }
  .market-grid {
    gap: 10px;
  }
  .market-grid .offer {
    padding: 10px 8px 9px;
    gap: 6px;
  }
  .offer-name {
    font-size: 13px;
    line-height: 1.3;
  }
  .offer-name span {
    font-size: 11.5px;
  }
  .offer .claim,
  .offer.free .claim {
    min-height: 34px;
    font-size: 12px;
  }

  /* 6. 历史记录 / 奖杯页 / 底栏：字号与点击热区更舒展 */
  .history-item {
    padding: 10px 6px;
    gap: 12px;
  }
  .history-info b {
    font-size: 13.5px;
  }
  .history-item small {
    font-size: 12px;
    margin-top: 2px;
  }
  .trophy-row {
    padding: 10px 12px;
  }
  .trophy-text strong {
    font-size: 13.5px;
  }
  .trophy-text small {
    font-size: 12px;
    line-height: 1.4;
  }
  .shared-dock .entry {
    height: 41px;
    min-height: 41px;
    font-size: 11.5px;
  }
  .shared-dock .foot-row .mode-toggle {
    min-height: 28px;
    height: 28px;
    padding: 0 11px;
    font-size: 11.5px;
  }
}

/* ==================== 无卡包灰模占位 + 抽卡收藏圆形星标按钮 ==================== */
.pack-wrap.pack-empty {
  filter: grayscale(1) saturate(0.15) opacity(0.56);
  pointer-events: none;
}
.pack-wrap.pack-empty .mouth,
.pack-wrap.pack-empty .hint {
  display: none;
}
.result .cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.result .cta-row .primary {
  flex: 1 1 auto;
  min-width: 0;
}
.result .cta-row .cta-fav {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: grid;
  place-items: center;
  padding: 0;
  background: linear-gradient(180deg, #2d2438, #1a1524);
  color: rgba(255, 245, 224, 0.72);
  box-shadow:
    0 1px 0 #ffffff2a inset,
    0 8px 20px -6px rgba(18, 12, 32, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: transform 0.18s var(--ease), color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.result .cta-row .cta-fav svg {
  width: 20px;
  height: 20px;
}
.result .cta-row .cta-fav:active {
  transform: scale(0.92);
}
.result .cta-row .cta-fav[aria-pressed="true"] {
  background: linear-gradient(145deg, #4b3214, #2b1d0b);
  border-color: rgba(247, 206, 114, 0.72);
  color: #ffd76a;
  box-shadow:
    0 1px 0 rgba(255, 242, 198, 0.42) inset,
    0 8px 20px -6px rgba(186, 126, 22, 0.56),
    0 0 12px rgba(255, 204, 82, 0.32);
}
.result .cta-row .cta-fav[aria-pressed="true"] svg {
  fill: currentColor;
}
.result .cta-row .cta-fav[hidden] {
  display: none;
}
@media (max-width: 640px) {
  .result .cta-row .cta-fav {
    width: 42px;
    height: 42px;
  }
}

/* 防止外层容器被 scrollIntoView 或焦点滚动横向推歪：overflow: clip 仅裁剪不形成滚动容器 */
html.tab-layout,
html.tab-layout body,
html.tab-layout #frame {
  overflow: hidden;
  overflow: clip;
}
html.tab-layout #frame > main {
  overflow-x: hidden;
  overflow-x: clip;
  overflow-y: auto;
}

/* ==================== 柔和稀有光晕 + 20 格经验槽 + 前期异画礼 + 移动端防割裂隔离 ==================== */
#frame {
  position: relative;
  z-index: 1;
  isolation: isolate;
}
@media (pointer: coarse) {
  .frame.shake-1,
  .frame.shake-2,
  .frame.shake-3 {
    animation: none !important;
  }
}
.flash {
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: strict;
}
.flash.go {
  animation: flash-gentle 0.9s ease-out both !important;
}
@keyframes flash-gentle {
  0% { opacity: 0; }
  24% { opacity: 0.28; }
  100% { opacity: 0; }
}
.level-bar {
  gap: 2px;
}
/* 固定 3 格福利布局：上方 2 格 + 下方常驻全宽横幅（星彩异画礼），白天/黑夜清晰高对比 */
.market-free.has-alt-gift {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.market-free.has-alt-gift .offer.free.alt-gift {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  padding: 10px 14px;
  gap: 14px;
  background: linear-gradient(165deg, #f8f3ff, #eee4fb);
  box-shadow: 0 1px 0 #fff inset, 0 0 0 1px #cbb6e8, 0 8px 18px -14px rgba(72, 42, 118, 0.35);
}
.market-free.has-alt-gift .offer.free.alt-gift .free-side {
  align-items: flex-start;
  gap: 5px;
}
.market-free.has-alt-gift .offer.free.alt-gift .offer-name {
  text-align: left;
  color: #2f2342;
  white-space: nowrap;
}
.market-free.has-alt-gift .offer.free.alt-gift .offer-name span {
  font-size: 11px;
  font-weight: 600;
  color: #6f5596;
}
.market-free.has-alt-gift .offer.free.alt-gift .free-timer {
  text-align: left;
  color: #5c4d73;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}
.market-free.has-alt-gift .offer.free.alt-gift .claim {
  color: #fff8ee;
  background: linear-gradient(180deg, #624698, #442d73);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.market-free.has-alt-gift .offer.free.alt-gift.locked .claim,
.market-free.has-alt-gift .offer.free.alt-gift.taken .claim {
  color: #6a5b82;
  background: rgba(98, 70, 152, 0.12);
  border: 1px solid rgba(98, 70, 152, 0.22);
  box-shadow: none;
}
html[data-theme="dark"] .market-free.has-alt-gift .offer.free.alt-gift {
  background: linear-gradient(165deg, #2c2042, #1f1632);
  box-shadow: 0 0 0 1px rgba(208, 174, 246, 0.34), 0 8px 20px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .market-free.has-alt-gift .offer.free.alt-gift .offer-name {
  color: #f6eeff;
}
html[data-theme="dark"] .market-free.has-alt-gift .offer.free.alt-gift .offer-name span {
  color: #cbb2eb;
}
html[data-theme="dark"] .market-free.has-alt-gift .offer.free.alt-gift .free-timer {
  color: #d6c8eb;
}
html[data-theme="dark"] .market-free.has-alt-gift .offer.free.alt-gift.locked .claim,
html[data-theme="dark"] .market-free.has-alt-gift .offer.free.alt-gift.taken .claim {
  color: rgba(235, 224, 252, 0.56);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
}
/* 多卡连抽角标（市场货架 + 首页卡包托盘 + 抽卡结果按钮进度点） */
.pack-multi-pill {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe285, #f0b13a);
  color: #3a2000;
  font-size: 10px;
  font-weight: 800;
  vertical-align: 1px;
}
.tray-multi {
  position: absolute;
  top: 2px;
  right: 2px;
  padding: 1px 4px;
  border-radius: 4px;
  background: #ffd666;
  color: #2b1600;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
#againButton.pack-progress {
  gap: 8px;
}
#againButton .again-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
#againButton .again-dots:empty {
  display: none;
}
#againButton .again-dots i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 245, 224, 0.32);
  transition: background 0.18s ease, transform 0.18s ease;
}
#againButton .again-dots i.on {
  background: #ffd666;
  transform: scale(1.15);
}
/* 市场随机货架领取后：原包飞离，下轮将上架的新卡包顺势从下方上浮预告 */
.offer.upcoming-slot {
  opacity: 0.78;
}
.offer.upcoming-slot .offer-pack {
  position: relative;
}
.offer.upcoming-slot .offer-thumb {
  filter: saturate(0.75) brightness(0.92);
}
.upcoming-badge {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(20, 16, 36, 0.86);
  border: 1px solid rgba(255, 224, 150, 0.6);
  color: #ffe8a3;
  font-size: 9.5px;
  font-weight: 750;
  white-space: nowrap;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.offer.upcoming-rise .offer-pack,
.offer.upcoming-rise .offer-name {
  animation: upcoming-float-up 440ms cubic-bezier(0.22, 0.86, 0.32, 1) 110ms both;
}
@keyframes upcoming-float-up {
  0% {
    opacity: 0;
    transform: translate3d(0, 22px, 0) scale(0.86);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .offer.upcoming-rise .offer-pack,
  .offer.upcoming-rise .offer-name {
    animation: none;
  }
}

/* 顶栏右侧统一设置按钮（与「次元万象」同高，收纳礼物/反馈/主题/语言/音乐/音效/存档，释放底栏空间） */
.topbar-settings {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  border: 1px solid #dfd3be;
  background: rgba(255, 253, 248, 0.92);
  color: #5b4d3e;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 2px 8px -4px rgba(42, 28, 12, 0.25), inset 0 1px 0 #ffffff;
  cursor: pointer;
  transition: transform 0.16s var(--ease), background 0.18s ease, border-color 0.18s ease;
}
.topbar-settings:active {
  transform: scale(0.94);
}
.topbar-settings .settings-gear {
  display: inline-grid;
  place-items: center;
}
.topbar-settings .settings-gear svg {
  width: 14px;
  height: 14px;
}
html[data-theme="dark"] .topbar-settings {
  border-color: rgba(255, 236, 198, 0.18);
  background: rgba(31, 27, 48, 0.92);
  color: #f0e6d2;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.settings-seg-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.settings-seg-btn {
  margin: 0 !important;
  height: 34px;
  padding: 0 6px !important;
  font-size: 12px !important;
  background: #f5efe3 !important;
  color: #4d4033 !important;
  border: 1px solid #dfd3be !important;
  box-shadow: none !important;
}
.settings-seg-btn.active {
  background: linear-gradient(180deg, #3c3154, #261e38) !important;
  color: #fff2cc !important;
  border-color: rgba(230, 194, 122, 0.72) !important;
}
html[data-theme="dark"] .settings-seg-btn {
  background: #221d36 !important;
  color: #dcd2c0 !important;
  border-color: rgba(255, 236, 198, 0.16) !important;
}
html[data-theme="dark"] .settings-seg-btn.active {
  background: linear-gradient(180deg, #634d90, #3f315f) !important;
  color: #ffeab3 !important;
  border-color: rgba(244, 210, 128, 0.65) !important;
}
.shared-dock .counter {
  margin: 2px 0 max(6px, env(safe-area-inset-bottom));
}

/* 拆卡包与切入结果页：底栏与主页下方控件柔和下沉淡出，消除硬切消失与舞台跳动 */
.shared-dock {
  max-height: 120px;
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition:
    opacity 260ms ease,
    transform 300ms cubic-bezier(0.22, 0.85, 0.32, 1),
    max-height 260ms cubic-bezier(0.22, 0.85, 0.32, 1),
    padding-top 260ms ease;
  will-change: transform, opacity;
}
#frame.pack-opening .shared-dock {
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  pointer-events: none;
}
.shared-dock.dock-hidden {
  max-height: 0;
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  padding-top: 0;
  margin-top: 0;
  overflow: hidden;
  pointer-events: none;
}
#homeView #packHint,
#homeView #trayWrap,
#homeView #homeActions {
  transition:
    opacity 240ms ease,
    transform 280ms cubic-bezier(0.22, 0.85, 0.32, 1);
}
#frame.pack-opening #homeView #packHint,
#frame.pack-opening #homeView #trayWrap,
#frame.pack-opening #homeView #homeActions {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .shared-dock,
  #homeView #packHint,
  #homeView #trayWrap,
  #homeView #homeActions {
    transition: none;
  }
}
