/* ============== 设计 token ============== */
:root {
  --bg: #FFF9F0;
  --bg-2: #FCECD5;
  --paper: #FFFFFF;
  --ink: #4A3426;
  --ink-2: #7D5E46;
  --muted: #A68B6F;
  --line: #E9DCC8;
  --accent: #F36B3A;
  --accent-soft: #FFD6C2;
  --accent-deep: #D44E22;
  --cream: #FFF9F0;
  --cream-dark: #F5E6D0;
  --pencil: #4A3426;

  --common: linear-gradient(135deg, #D8C9B0, #BFAA88);
  --rare:   linear-gradient(135deg, #8B5CF6, #5B21B6);
  --legend: linear-gradient(135deg, #FBBF24, #F97316 50%, #DC2626);

  --r-md: 16px; --r-lg: 20px; --r-xl: 28px;
  --sh-card: 0 2px 8px rgba(61,41,20,.06), 0 8px 24px rgba(61,41,20,.04);
  --sh-pop:  0 12px 32px rgba(255,140,66,.25), 0 4px 12px rgba(61,41,20,.08);
  --safe-b: max(env(safe-area-inset-bottom), 16px);
  --safe-t: max(env(safe-area-inset-top), 20px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg:#1F1B17; --bg-2:#2A241D; --paper:#2E2722;
    --ink:#F5EBD8; --ink-2:#C9B89E; --line:#3D332A;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", system-ui, "Inter", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* ============== 手绘涂鸦背景 ============== */
.doodle-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  color: var(--pencil);
  opacity: 1;
  overflow: hidden;
}
.doodle-sheet {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.doodle-sheet .doodle {
  animation: doodle-bob 7s ease-in-out infinite;
}
.doodle-sheet .doodle:nth-child(2n) { animation-delay: -2s; animation-duration: 9s; }
.doodle-sheet .doodle:nth-child(3n) { animation-delay: -4s; animation-duration: 11s; }
.doodle-sheet .doodle:nth-child(4n) { animation-delay: -6s; animation-duration: 8s; }
@keyframes doodle-bob {
  0%, 100% { translate: 0 0; opacity: 0.07; }
  50% { translate: 0 -10px; opacity: 0.12; }
}

/* 顶部和底部让背景更柔和 */
.topbar, .bottom-nav {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
}
button, input { font-family: inherit; }

/* ============== 顶栏 ============== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  position: relative;
  max-width: 1100px; margin: 0 auto;
  padding: 14px 16px 12px;
  display: flex; align-items: center; gap: 12px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 20px;
  color: var(--ink);
  letter-spacing: -0.3px;
}
.brand-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), #FFF0E5);
  border-radius: 50%;
  font-size: 18px;
  box-shadow: 0 2px 6px rgba(243,107,58,.15);
}

.stats-badges {
  margin-left: auto;
  display: flex; gap: 8px;
}
.badge {
  display: flex; align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 6px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(74,52,38,.06);
}
.badge-icon {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 13px;
  background: var(--bg-2);
}
.badge-icon.cookie { background: #FFF0D6; }
.badge.legend .badge-icon { background: #FFF4D9; }
.badge.rare .badge-icon { background: #F0E8FF; }
.badge b { font-variant-numeric: tabular-nums; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
  display: grid; place-items: center;
  transition: all .2s;
  font-size: 18px;
  box-shadow: 0 2px 6px rgba(74,52,38,.06);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-soft); transform: rotate(25deg); }

@media (max-width: 420px) {
  .stats-badges { gap: 6px; }
  .badge { padding: 4px 8px 4px 5px; font-size: 12px; }
  .badge-icon { width: 22px; height: 22px; font-size: 12px; }
}

/* ============== 主区 ============== */
main {
  position: relative; z-index: 1;
  max-width: 1100px; margin: 0 auto;
  padding: 12px 16px calc(120px + var(--safe-b));
}
.gallery-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 4px 18px;
}
.gallery-title-group {
  display: flex; align-items: baseline; gap: 10px;
}
.gallery-head h2 {
  font-family: "Caveat", "Comic Sans MS", "PingFang SC", cursive;
  font-size: 26px; font-weight: 700; margin: 0;
  color: var(--ink); letter-spacing: 0.5px;
}
.paw-trail {
  font-size: 13px;
  opacity: .45;
  letter-spacing: 2px;
}
.gallery-head .count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* 空状态 */
.empty {
  margin-top: 18vh; text-align: center;
  color: var(--ink-2);
}
.empty .hand-title {
  font-family: "Caveat", "Comic Sans MS", "PingFang SC", cursive;
  font-size: clamp(42px, 12vw, 72px);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
  letter-spacing: 1px;
  transform: rotate(-3deg);
  text-shadow: 2px 2px 0 var(--bg-2);
}
.empty .down-arrow {
  font-size: 56px;
  color: var(--accent);
  margin: -8px 0 14px;
  animation: arrow-bounce 1.6s ease-in-out infinite;
  filter: drop-shadow(0 3px 0 rgba(0,0,0,.06));
}
@keyframes arrow-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(14px); }
}
.empty p { font-size: 14px; margin: 0 auto; max-width: 280px; line-height: 1.6; color: var(--muted); }

/* 网格 */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 480px)  { .grid { grid-template-columns: repeat(3, 1fr); gap: 14px; } }
@media (min-width: 768px)  { .grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(5, 1fr); gap: 18px; } }

/* 卡片 */
.card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--sh-card);
  cursor: pointer;
  overflow: hidden;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--sh-pop); }
.card img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; pointer-events: none;
  background: var(--bg-2);
}
.card .ribbon {
  position: absolute; top: 8px; left: 8px;
  padding: 3px 8px;
  font-size: 10px; font-weight: 700;
  border-radius: 6px;
  color: #fff;
  letter-spacing: 0.5px;
}
.card .num {
  position: absolute; top: 8px; right: 8px;
  font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,.95);
  background: rgba(0,0,0,.35);
  padding: 3px 7px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.card .name {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  color: #fff;
  font-weight: 700; font-size: 15px;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
  line-height: 1.2;
}
.card .name small {
  display: block; font-weight: 400;
  font-size: 10px; opacity: .85; margin-top: 2px;
}
.card[data-rarity="common"] .ribbon { background: var(--common); }
.card[data-rarity="rare"]   .ribbon { background: var(--rare); }
.card[data-rarity="legend"] .ribbon { background: var(--legend); }
.card[data-rarity="rare"]   { box-shadow: 0 4px 14px rgba(139,92,246,.25), var(--sh-card); }
.card[data-rarity="legend"] {
  box-shadow: 0 6px 20px rgba(249,115,22,.3), 0 2px 8px rgba(220,38,38,.2);
  animation: legend-glow 2.4s ease-in-out infinite;
}
@keyframes legend-glow {
  0%, 100% { box-shadow: 0 6px 20px rgba(249,115,22,.3), 0 2px 8px rgba(220,38,38,.2); }
  50%      { box-shadow: 0 10px 32px rgba(249,115,22,.55), 0 2px 12px rgba(220,38,38,.35); }
}

/* ============== 主按钮（悬浮） ============== */
.fab-wrap {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 16px 16px var(--safe-b);
  background: linear-gradient(to top, var(--bg) 30%, transparent);
  pointer-events: none;
  z-index: 20;
}
.fab {
  pointer-events: auto;
  max-width: 480px; margin: 0 auto;
  width: 100%; height: 60px;
  border: none; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  font-size: 17px; font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 10px 28px rgba(255,140,66,.4), 0 2px 8px rgba(231,107,31,.25);
  transition: transform .15s, box-shadow .2s;
}
.fab:active { transform: scale(0.97); }
.fab:hover { box-shadow: 0 14px 36px rgba(255,140,66,.55); }
.fab .ico { font-size: 22px; line-height: 1; }
.fab[disabled] { opacity: 0.6; pointer-events: none; }
input[type=file] { display: none; }

/* ============== 遮罩 ============== */
.veil {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(31,27,23,.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
}
.veil.show { display: flex; animation: veil-in .2s ease; }
@keyframes veil-in { from { opacity: 0; } to { opacity: 1; } }
.veil-panel {
  width: 100%; max-width: 380px;
  background: var(--paper);
  border-radius: var(--r-xl);
  padding: 28px 22px 22px;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,.3);
  animation: panel-in .35s cubic-bezier(.2,.9,.2,1.05);
}
@keyframes panel-in {
  from { transform: scale(.85) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

/* 抓取中 */
.hunting .paws {
  display: flex; justify-content: center; gap: 14px;
  margin-bottom: 14px; font-size: 32px;
}
.hunting .paws span { animation: paw-bounce .9s ease-in-out infinite; }
.hunting .paws span:nth-child(2) { animation-delay: .15s; }
.hunting .paws span:nth-child(3) { animation-delay: .30s; }
@keyframes paw-bounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
.hunting h3 { margin: 0 0 4px; font-size: 17px; color: var(--ink); }
.hunting p { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.hunting .progress-wrap {
  width: 70%;
  max-width: 220px;
  height: 8px;
  margin: 0 auto;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(74,52,38,.1);
}
.hunting .progress-fill {
  height: 100%;
  width: 5%;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  border-radius: 999px;
  transition: width .3s ease-out;
}

/* 失败 */
.failed .failed-preview {
  width: 120px;
  height: 160px;
  margin: 0 auto 12px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid var(--line);
  box-shadow: 0 4px 12px rgba(74,52,38,.1);
}
.failed .failed-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.failed .face { font-size: 48px; margin-bottom: 8px; }
.failed h3 { margin: 0 0 6px; font-size: 18px; color: var(--ink); }
.failed p { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.failed .failed-tip {
  margin: 0 auto 18px;
  padding: 6px 12px;
  background: var(--bg-2);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-2);
  max-width: 90%;
}

/* 套层按钮通用 */
.panel-btns {
  display: flex; gap: 10px;
  margin-top: 4px;
}
.btn {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 999px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  box-shadow: 0 4px 12px rgba(255,140,66,.3);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }

/* 拓到了：结果卡 */
.caught { padding: 18px 18px 20px; }
.caught .flash {
  position: absolute; inset: 0;
  background: #fff;
  border-radius: var(--r-xl);
  pointer-events: none;
  animation: flash .55s ease-out;
  opacity: 0;
}
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
.caught .tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px; font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 14px;
}
.caught[data-rarity="common"] .tag { background: var(--common); }
.caught[data-rarity="rare"]   .tag { background: var(--rare); }
.caught[data-rarity="legend"] .tag { background: var(--legend); }
.caught .big-card {
  position: relative;
  aspect-ratio: 3/4;
  max-height: 380px;
  margin: 0 auto 14px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-2);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.caught .big-card img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.caught[data-rarity="legend"] .big-card::before {
  content: ""; position: absolute; inset: -4px;
  background: var(--legend);
  border-radius: calc(var(--r-lg) + 4px);
  z-index: -1;
  filter: blur(8px);
  opacity: .8;
  animation: legend-pulse 1.5s ease-in-out infinite;
}
@keyframes legend-pulse {
  0%, 100% { opacity: .6; }
  50%      { opacity: 1; }
}
.caught .name-big {
  font-size: 22px; font-weight: 800;
  color: var(--ink);
  margin: 0 0 2px;
  font-family: "Space Grotesk", system-ui, sans-serif;
}
.caught .meta {
  font-size: 12px; color: var(--muted);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.caught .meta span:not(:last-child)::after { content: " · "; }

/* 大图查看 */
.lightbox .veil-panel {
  max-width: 420px;
  padding: 18px 18px 20px;
}
.lightbox .big-card {
  position: relative;
  aspect-ratio: 3/4;
  max-height: 60vh;
  margin: 0 auto 14px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-2);
}
.lightbox .big-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 轻提示 (toast) */
.toast-container {
  position: fixed;
  left: 50%; bottom: calc(96px + var(--safe-b, 12px));
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 320px;
}
.toast-item {
  background: rgba(31, 27, 23, 0.95);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--r-md, 16rpx);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--sh-pop);
  text-align: center;
  border: 1.5px solid var(--line);
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  transition: opacity 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: auto;
  word-break: break-all;
}
.toast-item.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.toast-item.leaving {
  opacity: 0;
  transform: translateY(-8px) scale(0.9);
}

/* 设置面板（底部抽屉） */
.sheet {
  position: fixed; left: 0; right: 0; bottom: -100%;
  background: var(--paper);
  border-radius: 28px 28px 0 0;
  padding: 20px 20px var(--safe-b);
  z-index: 55;
  transition: bottom .3s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 -10px 30px rgba(0,0,0,.15);
  max-height: 80vh; overflow-y: auto;
}
.sheet.show { bottom: 0; }
.sheet .grab {
  width: 40px; height: 4px;
  background: var(--line);
  border-radius: 4px;
  margin: 0 auto 16px;
}
.sheet h3 {
  font-size: 17px; margin: 0 0 14px;
  color: var(--ink);
}
.sheet .row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
}
.sheet .row:first-of-type { border-top: none; }
.sheet .row .desc { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sheet .row select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
}
/* ============== 页内相机 ============== */
.camera {
  position: fixed; inset: 0; z-index: 70;
  background: #000;
  display: none;
  overflow: hidden;
}
.camera.show {
  display: block;
  animation: cam-in .35s cubic-bezier(.2,.9,.2,1);
}
.camera.fade-out {
  animation: cam-out .35s ease forwards;
  pointer-events: none;
}
@keyframes cam-in {
  from { opacity: 0; transform: scale(1.06); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes cam-out {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(1.02); }
}
.camera video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.camera-vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.4) 100%);
}
.camera-flash {
  position: absolute; inset: 0;
  pointer-events: none;
  background: #fff;
  opacity: 0;
  z-index: 5;
}
.camera-flash.fire { animation: cam-flash .45s ease-out; }
@keyframes cam-flash {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  100% { opacity: 0; }
}

.camera-grid {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
}
.reticle {
  width: min(60vw, 280px);
  aspect-ratio: 1/1;
  border: 2px solid rgba(255,255,255,.85);
  border-radius: 50%;
  box-shadow:
    0 0 0 9999px rgba(0,0,0,.05) inset,
    0 0 24px rgba(255,140,66,.3),
    0 0 0 6px rgba(255,140,66,.15);
  animation: reticle-pulse 2.4s ease-in-out infinite;
  transition: border-color .25s, box-shadow .25s;
}
.reticle.locked {
  border-color: #4ADE80;
  animation: reticle-locked 1.2s ease-in-out infinite;
}
@keyframes reticle-locked {
  0%, 100% {
    box-shadow:
      0 0 0 9999px rgba(0,0,0,.05) inset,
      0 0 30px rgba(74,222,128,.55),
      0 0 0 8px rgba(74,222,128,.2);
  }
  50% {
    box-shadow:
      0 0 0 9999px rgba(0,0,0,.05) inset,
      0 0 50px rgba(74,222,128,.8),
      0 0 0 14px rgba(74,222,128,.12);
  }
}
@keyframes reticle-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 9999px rgba(0,0,0,.05) inset,
      0 0 24px rgba(255,140,66,.3),
      0 0 0 6px rgba(255,140,66,.15);
  }
  50% {
    box-shadow:
      0 0 0 9999px rgba(0,0,0,.05) inset,
      0 0 40px rgba(255,140,66,.55),
      0 0 0 12px rgba(255,140,66,.08);
  }
}
.reticle-hint {
  position: absolute;
  top: calc(50% + min(35vw, 165px));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
  opacity: .9;
  transition: color .25s;
}
.reticle.locked ~ .reticle-hint,
.reticle-hint.locked {
  color: #4ADE80;
}

.camera-topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between;
  padding: max(env(safe-area-inset-top), 16px) 16px 0;
  z-index: 10;
}
.cam-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: background .2s, transform .15s;
}
.cam-btn:active { transform: scale(0.9); }
.cam-btn:hover { background: rgba(0,0,0,.65); }

.camera-bottombar {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 32px max(env(safe-area-inset-bottom), 28px);
  z-index: 10;
}
.cam-side {
  width: 48px; height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.3);
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: grid; place-items: center;
}
.shutter {
  width: 76px; height: 76px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.95);
  background: transparent;
  cursor: pointer;
  display: grid; place-items: center;
  padding: 0;
  transition: transform .15s;
}
.shutter span {
  width: 60px; height: 60px;
  border-radius: 50%;
  background: #fff;
  transition: transform .15s, background .15s;
}
.shutter:active span { transform: scale(.86); background: var(--accent); }
.shutter.firing span {
  animation: shutter-fire .4s ease;
}
@keyframes shutter-fire {
  0%   { transform: scale(1); }
  30%  { transform: scale(.6); background: var(--accent); }
  100% { transform: scale(1); background: #fff; }
}

/* ============== 一堆动效 ============== */

/* FAB 空状态时呼吸 */
.fab.pulse {
  animation: fab-pulse 2.2s ease-in-out infinite;
}
@keyframes fab-pulse {
  0%, 100% { box-shadow: 0 10px 28px rgba(255,140,66,.4), 0 2px 8px rgba(231,107,31,.25); }
  50%      { box-shadow: 0 14px 38px rgba(255,140,66,.7),  0 2px 8px rgba(231,107,31,.4),  0 0 0 8px rgba(255,140,66,.15); }
}

/* 新抓的卡飘进图鉴 */
.card.fresh {
  animation: card-fresh .7s cubic-bezier(.2,.9,.2,1.1);
}
@keyframes card-fresh {
  0%   { transform: scale(.4) translateY(-40px) rotate(-6deg); opacity: 0; }
  60%  { transform: scale(1.05) translateY(8px) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) translateY(0) rotate(0); opacity: 1; }
}

/* 抓到瞬间：卡面金色扫光 */
.caught .big-card { position: relative; isolation: isolate; }
.caught .big-card::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg,
    transparent 30%,
    rgba(255,255,255,.65) 50%,
    transparent 70%);
  transform: translateX(-100%);
  animation: card-sweep 1.2s ease-out .15s;
  pointer-events: none;
  mix-blend-mode: overlay;
}
@keyframes card-sweep {
  to { transform: translateX(100%); }
}

/* 传说卡：彩虹粒子 canvas 容器 */
.particles {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* 失败抖动 */
.failed .veil-panel { animation: shake .5s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60%  { transform: translateX(-8px); }
  40%, 80%  { transform: translateX(8px); }
}

/* 顶栏数字翻滚 */
.stats b.bump { animation: num-bump .5s cubic-bezier(.2,.9,.2,1.3); }
@keyframes num-bump {
  0%   { transform: translateY(0); color: var(--accent); }
  40%  { transform: translateY(-6px); color: var(--accent-deep); }
  100% { transform: translateY(0); }
}

/* 整页"惊喜抖动"（抓到传说时） */
@keyframes whole-shake {
  0%, 100% { transform: translate(0, 0); }
  20%      { transform: translate(-2px, 1px); }
  40%      { transform: translate(2px, -1px); }
  60%      { transform: translate(-1px, 2px); }
  80%      { transform: translate(1px, -2px); }
}
body.shake { animation: whole-shake .4s; }

/* 主按钮按下时的水波 */
.fab { position: relative; overflow: hidden; }
.fab .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  transform: scale(0);
  animation: ripple .6s ease-out;
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(3); opacity: 0; }
}

/* ============== 相框系统 ============== */
/* 通用 frame 容器，aspect-ratio 锁定 3:4 */
.frame {
  position: relative;
  aspect-ratio: 3 / 4;
  width: 100%;
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex; flex-direction: column;
  background: #fff;
  transform-style: preserve-3d;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s;
}
.frame .photo {
  flex: 1;
  position: relative;
  overflow: hidden;
}
.frame .photo img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  transform: scale(0.92);
  /* 白边已由服务端烧入图片，这里只留底部柔和漫射投影做贴纸悬浮感 */
  filter:
    drop-shadow(0 8px 20px rgba(0, 0, 0, 0.12))
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.06));
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.frame:hover .photo img {
  transform: scale(0.98) translateY(-2px);
}
.frame .meta-top, .frame .meta-bottom {
  position: relative;
  z-index: 2;
}

/* ----- A. 极简卡纸（paper） ----- */
.frame-paper {
  background: #FCF6EC;
  border: 1.5px solid var(--line);
  box-shadow:
    0 8px 20px rgba(74,52,38,0.06),
    inset 0 0 0 1px rgba(255,255,255,0.6);
}
.frame-paper .meta-top {
  padding: 10px 12px 6px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--ink-2);
}
.frame-paper .meta-top .tag {
  padding: 2px 8px; border-radius: 6px; color: #fff;
  font-size: 8px; font-weight: 800; letter-spacing: 0.5px;
}
.frame-paper[data-rarity="common"] .meta-top .tag { background: var(--common); }
.frame-paper[data-rarity="rare"]   .meta-top .tag { background: var(--rare); }
.frame-paper[data-rarity="legend"] .meta-top .tag { background: var(--legend); }
.frame-paper .meta-top .num {
  font-family: "Space Grotesk", monospace;
  color: var(--muted);
}
.frame-paper .photo {
  margin: 0 8px;
  border-radius: 4px;
  background: #FFFFFF;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.frame-paper .meta-bottom {
  padding: 8px 12px 12px;
  text-align: center;
  border-top: 1px dashed rgba(61,41,20,.18);
  margin: 6px 8px 0;
}
.frame-paper .meta-bottom .name {
  position: static;
  font-size: 14px; font-weight: 700;
  color: var(--ink);
  text-shadow: none;
  line-height: 1.2;
  margin-bottom: 2px;
}
.frame-paper .meta-bottom .date {
  font-size: 10px; color: var(--muted);
  font-family: "Space Grotesk", monospace;
  letter-spacing: 0.5px;
}
.frame-paper .meta-bottom .breed {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 1px;
  margin-bottom: 3px;
}

/* ----- B. 水彩晕染（watercolor）—— 每张随机一个色系 ----- */
.frame-watercolor {
  border: none;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-card);
  overflow: hidden;
}
.frame-watercolor .meta-top {
  padding: 10px 12px 4px;
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
}
.frame-watercolor .meta-top .tag {
  padding: 2px 8px; border-radius: 6px; color: #fff;
  font-size: 8px; font-weight: 800; letter-spacing: 0.5px;
}
.frame-watercolor[data-rarity="common"] .meta-top .tag { background: var(--common); }
.frame-watercolor[data-rarity="rare"]   .meta-top .tag { background: var(--rare); }
.frame-watercolor[data-rarity="legend"] .meta-top .tag { background: var(--legend); }
.frame-watercolor .meta-top .num {
  font-family: "Space Grotesk", monospace;
  font-size: 10px; font-weight: 700;
  color: rgba(74,52,38,.6);
}
.frame-watercolor .photo {
  margin: 0 10px;
  border-radius: 6px;
  overflow: hidden;
  position: relative; z-index: 1;
  background: rgba(255,255,255,.3);
  box-shadow: 0 4px 12px rgba(74,52,38,.1);
}
.frame-watercolor .photo img {
  transform: scale(1);
  filter: drop-shadow(0 2px 4px rgba(74,52,38,.08));
}
.frame-watercolor:hover .photo img {
  transform: scale(1.02);
}
.frame-watercolor .meta-bottom {
  padding: 8px 12px 12px;
  text-align: center;
  position: relative; z-index: 1;
}
.frame-watercolor .meta-bottom .name {
  position: static;
  font-size: 14px; font-weight: 700;
  color: var(--ink);
  text-shadow: none;
  line-height: 1.2;
  margin-bottom: 2px;
}
.frame-watercolor .meta-bottom .date {
  font-size: 10px;
  color: rgba(74,52,38,.5);
  font-family: "Space Grotesk", monospace;
  letter-spacing: 0.5px;
}
.frame-watercolor .meta-bottom .breed {
  font-size: 11px;
  color: rgba(74,52,38,.55);
  font-weight: 500;
  margin-top: 1px;
  margin-bottom: 3px;
}
/* 水彩色系变体 */
.frame-watercolor-w1 { background: linear-gradient(145deg, #FFEAE0 0%, #F5D0C5 100%); }
.frame-watercolor-w2 { background: linear-gradient(145deg, #E2F0F9 0%, #C5E0F0 100%); }
.frame-watercolor-w3 { background: linear-gradient(145deg, #F5F0E2 0%, #EDE4C5 100%); }
.frame-watercolor-w4 { background: linear-gradient(145deg, #EDE6F5 0%, #D8CCE8 100%); }
.frame-watercolor-w5 { background: linear-gradient(145deg, #E4EDE4 0%, #C8DCC8 100%); }
.frame-watercolor-w6 { background: linear-gradient(145deg, #FEF3D6 0%, #F7E2B5 100%); }
/* 稀有/传说水彩强化 */
.frame-watercolor[data-rarity="rare"] {
  box-shadow: 0 4px 14px rgba(139,92,246,.25), var(--sh-card);
}
.frame-watercolor[data-rarity="legend"] {
  box-shadow: 0 6px 20px rgba(249,115,22,.3), var(--sh-card);
  animation: legend-glow 2.4s ease-in-out infinite;
}

/* ----- C. 拍立得（polaroid） ----- */
.frame-polaroid {
  background: #F7F3EF;
  border-radius: 3px;
  box-shadow: 0 6px 20px rgba(74,52,38,.1), 0 2px 4px rgba(74,52,38,.06);
  padding: 0;
  display: flex; flex-direction: column;
}
.frame-polaroid .meta-top {
  display: none;
}
.frame-polaroid .photo {
  flex: 1;
  margin: 10px 10px 0;
  border-radius: 2px;
  overflow: hidden;
  background: #E8E2DA;
  box-shadow: 0 0 0 1px rgba(74,52,38,.08), 0 2px 8px rgba(74,52,38,.12);
}
.frame-polaroid .photo img {
  transform: scale(1);
  filter: none;
}
.frame-polaroid:hover .photo img {
  transform: scale(1.02);
}
.frame-polaroid .meta-bottom {
  padding: 12px 12px 14px;
  text-align: center;
}
.frame-polaroid .meta-bottom .name {
  position: static;
  font-family: "Caveat", "PingFang SC", cursive;
  font-size: 15px;
  font-weight: 700;
  color: #4A3426;
  text-shadow: none;
  line-height: 1.2;
  margin-bottom: 2px;
}
.frame-polaroid .meta-bottom .date {
  font-size: 10px;
  color: rgba(74,52,38,.4);
  font-family: "Caveat", "Space Grotesk", monospace;
  letter-spacing: 0.3px;
}
.frame-polaroid .meta-bottom .breed {
  font-size: 11px;
  color: rgba(74,52,38,.5);
  font-weight: 500;
  margin-top: 1px;
  margin-bottom: 3px;
}
.frame-polaroid[data-rarity="rare"] {
  box-shadow: 0 6px 20px rgba(139,92,246,.2), 0 2px 4px rgba(74,52,38,.06);
}
.frame-polaroid[data-rarity="legend"] {
  box-shadow: 0 8px 24px rgba(249,115,22,.25), 0 2px 4px rgba(74,52,38,.06);
  animation: legend-glow 2.4s ease-in-out infinite;
}

/* ----- D. 手账本（journal） ----- */
.frame-journal {
  background: #FCF9F2;
  border: 1px solid #E6DDD0;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-card);
  position: relative;
  overflow: hidden;
}
/* 横线背景 */
.frame-journal::before {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0 21px,
    rgba(200,185,160,.25) 21px 22px
  );
  pointer-events: none;
  z-index: 0;
}
/* 左侧红线 */
.frame-journal::after {
  content: "";
  position: absolute;
  top: 0; left: 18px; bottom: 0;
  width: 1.5px;
  background: rgba(230,100,100,.15);
  pointer-events: none;
  z-index: 0;
}
.frame-journal .meta-top {
  padding: 10px 12px 4px;
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
}
.frame-journal .meta-top .tag {
  padding: 2px 8px; border-radius: 6px; color: #fff;
  font-size: 8px; font-weight: 800; letter-spacing: 0.5px;
}
.frame-journal[data-rarity="common"] .meta-top .tag { background: var(--common); }
.frame-journal[data-rarity="rare"]   .meta-top .tag { background: var(--rare); }
.frame-journal[data-rarity="legend"] .meta-top .tag { background: var(--legend); }
.frame-journal .meta-top .num {
  font-family: "Space Grotesk", monospace;
  font-size: 10px;
  color: rgba(74,52,38,.4);
}
.frame-journal .photo {
  margin: 4px 14px 6px;
  border-radius: 4px;
  overflow: hidden;
  position: relative; z-index: 1;
  background: #fff;
  border: 1px solid rgba(74,52,38,.1);
  box-shadow:
    0 2px 8px rgba(74,52,38,.06),
    0 1px 0 rgba(255,255,255,.6) inset;
  transform: rotate(-0.5deg);
}
.frame-journal .photo img {
  transform: scale(1);
  filter: none;
}
.frame-journal:hover .photo {
  transform: rotate(0deg);
  transition: transform .2s;
}
.frame-journal .meta-bottom {
  padding: 6px 14px 12px 22px;
  text-align: left;
  position: relative; z-index: 1;
}
.frame-journal .meta-bottom .name {
  position: static;
  font-family: "Caveat", "PingFang SC", cursive;
  font-size: 14px;
  font-weight: 700;
  color: #4A3426;
  text-shadow: none;
  line-height: 1.2;
  margin-bottom: 1px;
}
.frame-journal .meta-bottom .date {
  font-size: 9px;
  color: rgba(74,52,38,.4);
  font-family: "Caveat", "Space Grotesk", monospace;
}
.frame-journal .meta-bottom .breed {
  font-size: 10px;
  color: rgba(74,52,38,.5);
  font-weight: 500;
  margin-top: 1px;
  margin-bottom: 2px;
}
.frame-journal[data-rarity="rare"] {
  box-shadow: 0 4px 14px rgba(139,92,246,.2), var(--sh-card);
}
.frame-journal[data-rarity="legend"] {
  box-shadow: 0 6px 20px rgba(249,115,22,.25), var(--sh-card);
  animation: legend-glow 2.4s ease-in-out infinite;
}

/* ----- E. 复古胶片（vintage） ----- */
.frame-vintage {
  background: #E8DDD0;
  border-radius: 2px;
  border: none;
  box-shadow: 0 4px 16px rgba(74,52,38,.12), 0 1px 3px rgba(74,52,38,.08);
  position: relative;
  overflow: hidden;
}
/* 四角圆化 + 胶片齿孔 */
.frame-vintage::before {
  content: "";
  position: absolute; inset: 0;
  border: 6px solid #D4C5B2;
  border-radius: 2px;
  pointer-events: none;
  z-index: 3;
}
.frame-vintage .meta-top {
  padding: 14px 14px 4px;
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 2;
}
.frame-vintage .meta-top .tag {
  padding: 2px 8px; border-radius: 6px; color: #fff;
  font-size: 8px; font-weight: 800; letter-spacing: 0.5px;
  text-transform: uppercase;
}
.frame-vintage[data-rarity="common"] .meta-top .tag { background: var(--common); }
.frame-vintage[data-rarity="rare"]   .meta-top .tag { background: var(--rare); }
.frame-vintage[data-rarity="legend"] .meta-top .tag { background: var(--legend); }
.frame-vintage .meta-top .num {
  font-family: "Space Grotesk", monospace;
  font-size: 9px;
  letter-spacing: 1px;
  color: rgba(74,52,38,.45);
}
.frame-vintage .photo {
  margin: 2px 14px 6px;
  border-radius: 0;
  overflow: hidden;
  position: relative; z-index: 2;
  background: #D4C5B2;
  box-shadow: 0 0 0 1px rgba(74,52,38,.12);
}
.frame-vintage .photo::after {
  content: "";
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent 0 2px,
      rgba(74,52,38,.02) 2px 3px
    );
  pointer-events: none;
  mix-blend-mode: multiply;
  z-index: 1;
}
.frame-vintage .photo img {
  transform: scale(1);
  filter: saturate(0.85) contrast(1.05);
}
.frame-vintage:hover .photo img {
  transform: scale(1.02);
}
.frame-vintage .photo img {
  transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.frame-vintage .meta-bottom {
  padding: 8px 14px 14px;
  text-align: center;
  position: relative; z-index: 2;
}
.frame-vintage .meta-bottom .name {
  position: static;
  font-family: "Space Grotesk", "PingFang SC", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #5A4030;
  text-shadow: none;
  line-height: 1.2;
  margin-bottom: 2px;
}
.frame-vintage .meta-bottom .date {
  font-size: 9px;
  color: rgba(74,52,38,.45);
  font-family: "Space Grotesk", monospace;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.frame-vintage .meta-bottom .breed {
  font-size: 10px;
  color: rgba(74,52,38,.5);
  font-weight: 500;
  margin-top: 1px;
  margin-bottom: 2px;
  font-style: italic;
}
.frame-vintage[data-rarity="rare"] {
  box-shadow: 0 4px 14px rgba(139,92,246,.2), 0 1px 3px rgba(74,52,38,.08);
}
.frame-vintage[data-rarity="legend"] {
  box-shadow: 0 6px 20px rgba(249,115,22,.25), 0 1px 3px rgba(74,52,38,.08);
  animation: legend-glow 2.4s ease-in-out infinite;
}

.caught-multi h3 {
  margin: 0 0 14px;
  font-size: 18px;
  color: var(--ink);
}
.caught-multi .multi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
  margin: 0 auto 10px;
  max-height: 50vh;
  overflow-y: auto;
}
.caught-multi .multi-card {
  cursor: pointer;
  transition: transform .2s cubic-bezier(.2,.8,.2,1);
}
.caught-multi .multi-card:hover {
  transform: translateY(-4px) scale(1.02);
}
.caught-multi .multi-card .frame {
  aspect-ratio: 3 / 4;
  min-width: 90px;
}
.caught-multi .multi-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--muted);
}
.caught-multi .meta-line {
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ============== 拖拽高亮 ============== */
body.drag-over::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(255, 140, 66, .15);
  border: 4px dashed var(--accent);
  pointer-events: none;
  animation: drag-pulse .8s ease-in-out infinite;
}
@keyframes drag-pulse {
  0%, 100% { opacity: .6; }
  50% { opacity: 1; }
}

/* ============== 翻牌动效 ============== */
.flip-stage {
  perspective: 1200px;
  width: min(70vw, 280px);
  margin: 0 auto 16px;
}
.flip-card {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.4, .15, .25, 1.1);
  transform: rotateY(180deg);
}
.flip-card.flipped { transform: rotateY(0deg); }

.flip-front, .flip-back {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--r-lg);
  overflow: hidden;
}
.flip-back {
  background:
    radial-gradient(ellipse at center, rgba(255,140,66,.2) 0%, transparent 60%),
    linear-gradient(135deg, #2A1810 0%, #1A0F08 100%);
  border: 4px solid #FBBF24;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.1),
    inset 0 0 30px rgba(251,191,36,.2);
  transform: rotateY(180deg);
  display: grid; place-items: center;
  color: #FBBF24;
}
.flip-back::before {
  /* 卡背图案：放射状条纹 */
  content: "";
  position: absolute; inset: 12px;
  border: 1px dashed rgba(251,191,36,.4);
  border-radius: 12px;
}
.flip-back .logo {
  font-size: 52px;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
  animation: back-pulse 1.6s ease-in-out infinite;
}
@keyframes back-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.08); }
}
.flip-back .brand {
  position: absolute; bottom: 20px;
  font-family: "Space Grotesk", monospace;
  font-size: 11px;
  letter-spacing: 4px;
  font-weight: 700;
  color: #FBBF24;
}
.flip-front {
  transform: rotateY(0deg);
}

/* 翻牌时金光扫过 */
.flip-stage.shine .flip-card::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg,
    transparent 35%,
    rgba(251,191,36,.45) 50%,
    transparent 65%);
  transform: translateX(-100%) translateZ(20px);
  animation: shine-sweep 1.2s ease-out .4s;
  pointer-events: none;
  z-index: 10;
  border-radius: var(--r-lg);
}
@keyframes shine-sweep {
  to { transform: translateX(100%) translateZ(20px); }
}

/* ============== 弹卡面板调整 ============== */
.caught { padding: 24px 20px 20px; }
.caught .tag-row {
  margin-bottom: 14px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.caught .tag-row .score {
  color: var(--ink-2);
  margin-left: 8px;
}
.caught .name-big {
  font-size: 22px; font-weight: 800;
  color: var(--ink);
  margin: 0 0 2px;
  font-family: "Space Grotesk", "PingFang SC", system-ui, sans-serif;
}
.caught .meta-line {
  font-size: 12px; color: var(--muted);
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}

/* 网格卡片：替换原来的直接 img 渲染，用 frame */
.grid .frame {
  cursor: pointer;
  transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s;
  box-shadow: var(--sh-card);
}
.grid .frame:hover { transform: translateY(-4px); box-shadow: var(--sh-pop); }
.grid .frame .name { font-size: 13px; }
.grid .frame .photo { margin: 0 6px; }
.grid .frame-paper .meta-top { padding: 8px 10px 4px; font-size: 9px; }
.grid .frame-paper .meta-bottom { padding: 6px 10px 8px; margin: 4px 6px 0; }
.grid .frame-paper .meta-bottom .name { font-size: 12px; }
.grid .frame-paper .meta-bottom .breed { font-size: 9px; margin-bottom: 2px; }
.grid .frame-paper .meta-bottom .date { font-size: 9px; }
.grid .frame-watercolor .meta-top { padding: 8px 10px 2px; font-size: 9px; }
.grid .frame-watercolor .photo { margin: 0 8px; border-radius: 4px; }
.grid .frame-watercolor .meta-bottom { padding: 6px 10px 10px; }
.grid .frame-watercolor .meta-bottom .name { font-size: 12px; }
.grid .frame-watercolor .meta-bottom .breed { font-size: 9px; margin-bottom: 2px; }
.grid .frame-watercolor .meta-bottom .date { font-size: 9px; }

.grid .frame-polaroid .photo { margin: 8px 8px 0; }
.grid .frame-polaroid .meta-bottom { padding: 8px 8px 10px; }
.grid .frame-polaroid .meta-bottom .name { font-size: 13px; }
.grid .frame-polaroid .meta-bottom .breed { font-size: 9px; margin-bottom: 2px; }
.grid .frame-polaroid .meta-bottom .date { font-size: 9px; }

.grid .frame-journal .meta-top { padding: 8px 10px 2px; font-size: 9px; }
.grid .frame-journal .photo { margin: 4px 10px 4px; border-radius: 3px; }
.grid .frame-journal .meta-bottom { padding: 4px 10px 8px 16px; }
.grid .frame-journal .meta-bottom .name { font-size: 12px; }
.grid .frame-journal::after { left: 12px; }

.grid .frame-vintage .meta-top { padding: 12px 10px 2px; font-size: 9px; }
.grid .frame-vintage .photo { margin: 2px 10px 4px; }
.grid .frame-vintage .meta-bottom { padding: 4px 10px 10px; }
.grid .frame-vintage .meta-bottom .name { font-size: 11px; }
.grid .frame-vintage::before { border-width: 4px; }

/* ============== 详情页相框切换器 ============== */
.frame-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 8px 8px 4px;
  padding: 8px 4px;
  background: var(--bg);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  position: relative;
}
.frame-switcher::before {
  content: "◀ 滑动 ▶";
  position: absolute;
  top: -8px;
  right: 8px;
  font-size: 8px;
  color: var(--muted);
  opacity: 0.5;
  letter-spacing: 0.5px;
  background: var(--bg);
  padding: 0 6px;
}
.fs-chip {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--paper);
  cursor: pointer;
  transition: all .15s cubic-bezier(.2,.8,.2,1);
  user-select: none;
  border: 1.5px solid var(--line);
  -webkit-tap-highlight-color: transparent;
}
.fs-chip:active { transform: scale(.92); }
.fs-chip.active {
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(243,107,58,.15);
}
.fs-chip:hover { border-color: var(--accent-soft); }

/* 设置抽屉：相框选择 */
.frame-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.frame-pick {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color .2s, transform .15s;
}
.frame-pick:active { transform: scale(.96); }
.frame-pick.active { border-color: var(--accent); }
.frame-pick .label {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 6px 8px;
  font-size: 11px; font-weight: 700;
  text-align: center;
  background: rgba(0,0,0,.55);
  color: #fff;
  backdrop-filter: blur(4px);
}
.frame-pick-paper { background: #FDF8EE; border: 1px solid rgba(0,0,0,.08); }
.frame-pick-paper.active { border-color: var(--accent); }
.frame-pick-paper .preview {
  position: absolute; inset: 6px;
  border-radius: 4px;
  background:
    linear-gradient(to bottom, #FFE4B5, #DEB887);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}
.frame-pick-watercolor {
  background: linear-gradient(145deg, #F5D0C5, #C5E0F0);
  border: 1px solid rgba(0,0,0,.06);
}
.frame-pick-watercolor .preview {
  position: absolute; inset: 8px;
  border-radius: 4px;
  background: rgba(255,255,255,.4);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.frame-pick-polaroid {
  background: #F5F0EB;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 3px;
}
.frame-pick-polaroid .preview {
  position: absolute; top: 8px; left: 8px; right: 8px;
  height: 58%;
  border-radius: 2px;
  background: linear-gradient(180deg, #DCCFC0 0%, #C8B8A8 100%);
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.frame-pick-polaroid .label {
  top: auto;
  bottom: 12px;
  background: none;
  backdrop-filter: none;
  color: #4A3426;
  font-size: 10px;
}
.frame-pick-journal {
  background: #FCF9F2;
  border: 1px solid rgba(0,0,0,.08);
  background-image: repeating-linear-gradient(
    0deg,
    transparent 0 12px,
    rgba(200,185,160,.2) 12px 13px
  );
}
.frame-pick-journal .preview {
  position: absolute; inset: 8px;
  border-radius: 3px;
  background: rgba(255,255,255,.5);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.frame-pick-vintage {
  background: #E8DDD0;
  border: 4px solid #D4C5B2;
  border-radius: 2px;
}
.frame-pick-vintage .preview {
  position: absolute; inset: 8px;
  border-radius: 0;
  background: linear-gradient(180deg, #D4C5B2 0%, #C8B8A0 100%);
}

/* ============== 猫咪档案编辑表单 ============== */
.profile-edit-fields {
  margin: 16px 0 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.edit-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.edit-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.edit-group input, .edit-group textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}
.edit-group input:focus, .edit-group textarea:focus {
  border-color: var(--accent);
}
.edit-group textarea {
  height: 60px;
  resize: none;
}

/* ============== 页面切换 ============== */
.page-view {
  display: none;
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity .35s cubic-bezier(.2,.8,.2,1), transform .35s cubic-bezier(.2,.8,.2,1);
}
.page-view.active {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}
.page-view.leaving {
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
}

/* ============== 底部导航栏 ============== */
.bottom-nav {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: max(env(safe-area-inset-bottom), 12px);
  height: 68px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 32px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  z-index: 20;
  box-shadow:
    0 8px 24px rgba(74,52,38,.1),
    0 2px 8px rgba(74,52,38,.06),
    inset 0 1px 0 rgba(255,255,255,.8);
}
.nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  background: none;
  border: none;
  width: 56px;
  height: 52px;
  border-radius: 18px;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
  gap: 3px;
  outline: none;
}
.nav-tab .nav-icon {
  width: 22px; height: 22px;
  display: grid; place-items: center;
}
.nav-tab .nav-icon svg { width: 100%; height: 100%; }
.nav-tab.active {
  color: var(--accent);
  background: linear-gradient(180deg, #FFF0E8, #FFE8DB);
  box-shadow: inset 0 1px 2px rgba(243,107,58,.12);
}
.nav-tab.soon {
  opacity: .45;
  cursor: not-allowed;
}

.fab-center {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #FF9A6C 0%, transparent 45%),
    linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  border: 4px solid var(--bg);
  box-shadow:
    0 8px 22px rgba(243,107,58,.45),
    0 3px 8px rgba(212,78,34,.3),
    inset 0 -3px 8px rgba(0,0,0,.12);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 21;
  margin-top: -28px;
  transition: transform .15s, box-shadow .2s;
  outline: none;
}
.fab-center:active {
  transform: scale(0.92);
  box-shadow:
    0 4px 12px rgba(243,107,58,.4),
    0 2px 5px rgba(212,78,34,.25),
    inset 0 -2px 6px rgba(0,0,0,.12);
}
.fab-center .paw-svg {
  width: 36px; height: 36px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.2));
}
.fab-center .paw-svg svg { width: 100%; height: 100%; }
.fab-center.pulse {
  animation: paw-pulse 2.2s ease-in-out infinite;
}
@keyframes paw-pulse {
  0%, 100% { box-shadow: 0 8px 22px rgba(243,107,58,.45), 0 3px 8px rgba(212,78,34,.3), inset 0 -3px 8px rgba(0,0,0,.12); }
  50%      { box-shadow: 0 12px 32px rgba(243,107,58,.7), 0 4px 12px rgba(212,78,34,.45), inset 0 -3px 8px rgba(0,0,0,.12), 0 0 0 10px rgba(243,107,58,.15); }
}

@media (max-width: 380px) {
  .bottom-nav { left: 10px; right: 10px; height: 62px; border-radius: 26px; }
  .nav-tab { width: 48px; height: 46px; font-size: 10px; }
  .fab-center { width: 58px; height: 58px; margin-top: -24px; }
  .fab-center .paw-svg { width: 32px; height: 32px; }
}

/* ============== 猫咪百科 Pokedex ============== */
.pokedex-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 4px 4px 18px;
}
.pokedex-head h2 {
  font-family: "Caveat", "Comic Sans MS", "PingFang SC", cursive;
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  letter-spacing: 0.5px;
}
.pokedex-head .count {
  font-size: 13px;
  color: var(--muted);
}
.pokedex-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (min-width: 480px) { .pokedex-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; } }
@media (min-width: 768px) { .pokedex-grid { grid-template-columns: repeat(6, 1fr); gap: 14px; } }

.pokedex-item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--sh-card);
  transition: transform 0.2s, border-color 0.2s;
  cursor: pointer;
  aspect-ratio: 1 / 1.1;
  justify-content: center;
}
.pokedex-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}
.pokedex-item.locked {
  background: var(--bg-2);
  opacity: 0.6;
}
.pokedex-item .avatar {
  font-size: 28px;
  margin-bottom: 6px;
  filter: grayscale(100%);
  opacity: 0.4;
  transition: filter 0.2s, opacity 0.2s;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.pokedex-item .avatar-photo {
  background-size: cover;
  background-position: center;
  background-color: var(--bg-2);
  border: 2px solid var(--accent-soft);
  box-shadow: 0 2px 6px rgba(243,107,58,.18);
  font-size: 0;
}
.pokedex-item:not(.locked) .avatar {
  filter: none;
  opacity: 1;
}
.pokedex-item:not(.locked):hover .avatar-photo {
  transform: scale(1.08);
  border-color: var(--accent);
}
.pokedex-item:not(.locked):hover {
  background: linear-gradient(180deg, #FFF6EE, var(--paper));
}
.pokedex-item .breed-en {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
  line-height: 1.1;
}
.pokedex-item .breed-zh {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.1;
}
.pokedex-item.locked .breed-zh {
  color: var(--muted);
  opacity: 0.5;
}
.pokedex-item .count-badge {
  font-size: 9px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  padding: 1px 6px;
  border-radius: 99px;
  margin-top: 6px;
  font-weight: 700;
}

/* ============== 地图样式 ============== */
.cat-map {
  width: 100%;
  height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 4px;
  background: var(--bg-2);
}

/* ============== 页面锁屏 ============== */
body.lock-scroll {
  overflow: hidden;
  height: 100dvh;
}

/* ============== 心情标签 ============== */
.mood-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mood-tag {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s cubic-bezier(.2,.8,.2,1);
  user-select: none;
}
.mood-tag:active {
  transform: scale(.92);
}
.mood-tag.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-deep);
  box-shadow: 0 2px 6px rgba(243,107,58,.15);
}
.mood-tag:hover {
  border-color: var(--accent-soft);
}

/* 失败页缩略图缩小 */
.failed .failed-preview {
  width: 80px;
  height: 106px;
  margin: 0 auto 10px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid var(--line);
  box-shadow: 0 4px 12px rgba(74,52,38,.1);
  position: relative;
}
.failed .failed-preview::after {
  content: "✕";
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(220,38,38,.85);
  color: #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 700;
}

.badge-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
}

.gallery-head-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ============== 足迹地图页面 ============== */
#page-map {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: var(--bg);
  /* 留出底部导航栏的位置 */
  padding-bottom: calc(90px + env(safe-area-inset-bottom));
}
.big-map-container {
  width: 100%;
  height: 100%;
  position: relative;
}
.big-map {
  width: 100%;
  height: 100%;
  background: var(--bg-2);
}

/* 自定义地图标记 (Marker) */
.cat-map-marker {
  position: relative;
  width: 48px;
  height: 48px;
  cursor: pointer;
  filter: drop-shadow(0 4px 10px rgba(74,52,38,0.25));
  display: flex;
  align-items: center;
  justify-content: center;
}
.marker-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  border: 3px solid var(--muted);
  background-color: var(--paper);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.cat-map-marker:hover .marker-avatar {
  transform: scale(1.15);
}
.marker-pin {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
}

/* 地图弹出框 (Popup) 自定义 */
.mapboxgl-popup-content, .maplibregl-popup-content {
  border-radius: var(--r-md) !important;
  border: 1.5px solid var(--line) !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
  font-family: inherit !important;
  padding: 12px 14px !important;
  box-shadow: 0 8px 24px rgba(74,52,38,0.15) !important;
}
.mapboxgl-popup-close-button, .maplibregl-popup-close-button {
  padding: 4px 8px !important;
  font-size: 14px !important;
  color: var(--muted) !important;
  outline: none !important;
}
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip,
.maplibregl-popup-anchor-top .maplibregl-popup-tip {
  border-bottom-color: var(--line) !important;
}
.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip {
  border-top-color: var(--line) !important;
}

.cat-map-popup h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}
.cat-map-popup p {
  margin: 3px 0;
  font-size: 12px;
  color: var(--ink-2);
}
.cat-map-popup .popup-breed {
  font-weight: 700;
  color: var(--accent);
}
.cat-map-popup .popup-btn {
  margin-top: 10px;
  width: 100%;
  padding: 8px;
  font-size: 12px;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.15s;
}
.cat-map-popup .popup-btn:active {
  background: var(--accent-deep);
}




/* ============== 完成度进度条 ============== */
.completeness { margin: 0 0 16px; }
.completeness .bar {
  height: 8px;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(74,52,38,.08);
}
.completeness .bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  border-radius: 999px;
  transition: width .5s cubic-bezier(.2,.8,.2,1);
}
.completeness .meta-row {
  display: flex;
  gap: 14px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}
.completeness .meta-row span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.completeness .meta-row i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

/* ============== 工具栏 ============== */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  min-width: 140px;
  position: relative;
}
.search-box input {
  width: 100%;
  height: 38px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 14px 0 36px;
  font-size: 13px;
  outline: none;
  transition: border-color .2s;
}
.search-box input:focus { border-color: var(--accent); }
.search-box .s-ico {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}
.sort-select {
  height: 38px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 14px;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.sort-select:focus { border-color: var(--accent); }
.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}
.chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
  transition: all .15s cubic-bezier(.2,.8,.2,1);
  user-select: none;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chip:active { transform: scale(.94); }
.chip:hover { border-color: var(--accent-soft); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 3px 8px rgba(243,107,58,.25);
}
.chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.no-match {
  margin-top: 18vh;
  text-align: center;
  color: var(--muted);
  grid-column: 1 / -1;
}
.no-match .ico {
  font-size: 40px;
  margin-bottom: 8px;
  opacity: .6;
}
.no-match p { margin: 0; font-size: 13px; }
.no-match button {
  margin-top: 12px;
  background: none;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 16px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ============== 统计页 ============== */
.stats-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 4px 4px 18px;
}
.stats-head h2 {
  font-family: "Caveat", "Comic Sans MS", "PingFang SC", cursive;
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  letter-spacing: 0.5px;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (min-width: 640px) { .stat-grid { grid-template-columns: 1fr 1fr 1fr; } }
.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: var(--sh-card);
}
.stat-card h4 {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .5px;
}
.stat-big {
  font-family: "Space Grotesk", monospace;
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.stat-big small {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-left: 2px;
}
.stat-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.bar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bar-list .row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.bar-list .row .lbl {
  width: 56px;
  color: var(--ink-2);
  font-weight: 600;
  flex: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-list .row .track {
  flex: 1;
  height: 10px;
  background: var(--bg-2);
  border-radius: 6px;
  overflow: hidden;
}
.bar-list .row .track > i {
  display: block;
  height: 100%;
  border-radius: 6px;
  transition: width .6s cubic-bezier(.2,.8,.2,1);
}
.bar-list .row .val {
  width: 28px;
  text-align: right;
  font-family: "Space Grotesk", monospace;
  color: var(--ink);
  font-weight: 600;
  flex: none;
}
.activity {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 60px;
  margin-top: 4px;
}
.activity .day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.activity .day .col {
  width: 100%;
  background: linear-gradient(180deg, var(--accent), var(--accent-soft));
  border-radius: 4px 4px 2px 2px;
  min-height: 3px;
  transition: height .5s cubic-bezier(.2,.8,.2,1);
}
.activity .day .col.empty { background: var(--bg-2); }
.activity .day .lb {
  font-size: 9px;
  color: var(--muted);
  font-family: "Space Grotesk", monospace;
}
.top-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.top-list .ti {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.top-list .ti .av {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-2);
}
.top-list .ti .nm {
  flex: 1;
  color: var(--ink);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-list .ti .ct {
  font-family: "Space Grotesk", monospace;
  color: var(--accent);
  font-weight: 700;
}
.stat-full { grid-column: 1 / -1; }

/* ============== 骨架屏 ============== */
.skeleton-card {
  aspect-ratio: 3 / 4;
  border-radius: var(--r-lg);
  background: var(--paper);
  border: 1.5px solid var(--line);
  box-shadow: var(--sh-card);
  padding: 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.skeleton-photo {
  flex: 1;
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--cream) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-text {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--cream) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}
.skeleton-text.name {
  width: 60%;
  height: 16px;
}
.skeleton-text.breed {
  width: 40%;
  height: 12px;
}
.skeleton-text.date {
  width: 50%;
  height: 10px;
  margin-top: auto;
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============== 占位卡 ============== */
.card.placeholder {
  aspect-ratio: 3 / 4;
  border-radius: var(--r-lg);
  background: var(--bg-2);
  border: 1.5px dashed var(--line);
  display: grid;
  place-items: center;
  opacity: .6;
  box-shadow: none;
}
.card.placeholder .q {
  font-family: "Caveat", "Comic Sans MS", "PingFang SC", cursive;
  font-size: 48px;
  color: var(--muted);
  font-weight: 700;
}

/* ============== 品种详情弹窗 ============== */
.veil-panel.breed-detail {
  max-width: 480px;
  padding: 24px 20px 20px;
  text-align: center;
}
.breed-detail h3 {
  font-family: "Caveat", "Comic Sans MS", "PingFang SC", cursive;
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}
.breed-detail .breed-en-tag {
  font-size: 11px;
  color: var(--muted);
  margin: 4px 0 14px;
  letter-spacing: 0.5px;
  font-family: "Space Grotesk", monospace;
}
.breed-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin: 0 auto 16px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 4px;
}
.breed-detail-card {
  cursor: pointer;
  transition: transform .2s cubic-bezier(.2,.8,.2,1);
}
.breed-detail-card:hover {
  transform: translateY(-4px) scale(1.02);
}
.breed-detail-card .frame {
  aspect-ratio: 3 / 4;
  min-width: 90px;
}

/* ============== 空状态 ============== */
.empty-collection {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px 40px;
  text-align: center;
  color: var(--ink-2);
}

.empty-illustration {
  position: relative;
  width: 140px;
  height: 120px;
  margin-bottom: 24px;
}

.empty-illustration .cat-head {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 95px;
  height: 65px;
  background: var(--bg-2);
  border: 3px solid var(--ink);
  border-radius: 50px 50px 10px 10px;
  animation: cat-peek 4s ease-in-out infinite;
}

.empty-illustration .ear-l {
  position: absolute;
  top: -12px;
  left: 8px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 20px solid var(--ink);
  transform: rotate(-15deg);
}

.empty-illustration .ear-r {
  position: absolute;
  top: -12px;
  right: 8px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 20px solid var(--ink);
  transform: rotate(15deg);
}

.empty-illustration .eyes {
  position: absolute;
  top: 22px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  padding: 0 22px;
}

.empty-illustration .eye {
  width: 8px;
  height: 8px;
  background: var(--ink);
  border-radius: 50%;
  animation: cat-blink 4s infinite;
}

.empty-illustration .nose {
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--ink);
}

.empty-illustration .whiskers {
  position: absolute;
  top: 28px;
  width: 100%;
}

.empty-illustration .whisker {
  position: absolute;
  width: 15px;
  height: 2px;
  background: var(--ink);
}

.empty-illustration .whisker-l1 { left: -8px; top: 2px; transform: rotate(10deg); }
.empty-illustration .whisker-l2 { left: -8px; top: 8px; transform: rotate(-5deg); }
.empty-illustration .whisker-r1 { right: -8px; top: 2px; transform: rotate(-10deg); }
.empty-illustration .whisker-r2 { right: -8px; top: 8px; transform: rotate(5deg); }

.empty-collection h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px 0;
}

.empty-collection p {
  font-size: 15px;
  max-width: 260px;
  line-height: 1.5;
  margin: 0 0 24px 0;
  color: var(--muted);
}
.empty-collection p span {
  color: var(--accent);
  font-weight: bold;
}

.guide-arrow {
  font-size: 28px;
  color: var(--accent);
  animation: bounce-arrow 1.5s infinite;
}

@keyframes cat-peek {
  0%, 100% { transform: translate(-50%, 0); }
  45%, 55% { transform: translate(-50%, -15px); }
}

@keyframes cat-blink {
  0%, 90%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}

@keyframes bounce-arrow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(10px); }
}

/* ============== 下拉刷新 ============== */
#page-collection {
  position: relative;
}
.ptr-indicator {
  position: absolute;
  top: -45px;
  left: 0;
  right: 0;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  font-weight: 600;
  transition: opacity 0.2s;
}
.ptr-indicator.pulling, .ptr-indicator.loading {
  opacity: 1;
}
.ptr-indicator.loading .ptr-icon {
  animation: ptr-spin 1s linear infinite;
}
.ptr-icon {
  font-size: 16px;
  transition: transform 0.2s;
  display: inline-block;
}
@keyframes ptr-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#collection-body {
  transition: transform 0.15s ease-out;
  transform-origin: top;
}
