/* =====================================================
   ✦  Kigurumi Card  ✦  共用样式
   ===================================================== */

/* 本地装饰字体，避免被 Google Fonts CDN 阻塞 */
@font-face {
  font-family: 'Pacifico';
  src: url('fonts/pacifico.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  /* 全部用系统字体；中文落到 PingFang/微软雅黑，零网络等待 */
  font-family:
    -apple-system, BlinkMacSystemFont,
    'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', 'Segoe UI',
    'Hiragino Sans GB', system-ui, sans-serif;
  color: #5a3a5a;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ========== 背景：渐变 + 樱花 + 星星 ========== */
.bg-gradient {
  /* 用 transform 驱动渐变漂移，比 background-position 走 GPU，省一大块主线程 */
  position: fixed;
  top: -8%; left: -8%;
  width: 116%; height: 116%;     /* 比 130% 小，GPU 纹理省一半内存 */
  z-index: -3;
  background:
    radial-gradient(ellipse at 15% 8%,  #ffd6e8 0%, transparent 50%),
    radial-gradient(ellipse at 85% 25%, #d6c8ff 0%, transparent 55%),
    radial-gradient(ellipse at 50% 95%, #c8f0e8 0%, transparent 60%),
    radial-gradient(ellipse at 90% 80%, #ffe4cc 0%, transparent 50%),
    linear-gradient(135deg, #fff0f6 0%, #f0e6ff 50%, #e6f9ff 100%);
  animation: bg-drift 50s ease-in-out infinite alternate;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}
@keyframes bg-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-6%, -5%, 0); }
}

/* 用户开了系统级"减少动效"，关停所有装饰动画（NFC 卡用户也许在低电量模式） */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .sakura-layer, .stars-layer, .avatar-sparkle, .avatar-ring { display: none; }
}

.sakura-layer, .stars-layer {
  position: fixed; inset: 0; pointer-events: none; overflow: hidden;
}
.sakura-layer { z-index: -2; }
.stars-layer  { z-index: -1; }

.petal {
  position: absolute; top: -10%;
  background: radial-gradient(ellipse at 30% 30%, #ffe0ec 0%, #ffb6d9 60%, #ff8fb8 100%);
  border-radius: 150% 0 150% 0;
  opacity: .8;
  animation: fall linear infinite;
  filter: drop-shadow(0 2px 4px rgba(255,130,180,.3));
}
@keyframes fall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg);   opacity: 0; }
  10%  { opacity: .9; }
  100% { transform: translateY(110vh) translateX(60px) rotate(720deg); opacity: 0; }
}

.star {
  position: absolute;
  color: #fff;
  text-shadow: 0 0 8px rgba(255,180,220,.8);
  animation: twinkle 3s ease-in-out infinite;
  font-size: 10px;
}
@keyframes twinkle {
  0%, 100% { opacity: .2; transform: scale(.8); }
  50%      { opacity: 1;  transform: scale(1.2); }
}

/* ========== 主容器 ========== */
.card {
  max-width: 540px;
  margin: 0 auto;
  padding: 32px 18px 50px;
  position: relative;
}

/* ========== 头像 ========== */
.profile { text-align: center; }

.avatar-wrap {
  position: relative;
  width: 140px; height: 140px;
  margin: 8px auto 22px;
}
.avatar, .avatar-fallback {
  width: 100%; height: 100%; border-radius: 50%;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow:
    0 10px 35px rgba(255, 130, 180, .35),
    0 0 0 2px #ffb6d9 inset,
    inset 0 -10px 30px rgba(255,200,230,.4);
  background: linear-gradient(135deg, #ffd6e8 0%, #d6c8ff 50%, #c8f0e8 100%);
}
.avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  font-size: 60px; color: #fff;
  font-family: 'Pacifico', cursive;
}
.avatar-ring {
  position: absolute; inset: -12px;
  border-radius: 50%;
  border: 2px dashed #ffb6d9;
  animation: spin 18s linear infinite;
  pointer-events: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.avatar-sparkle {
  position: absolute;
  font-size: 18px;
  color: #ffb6d9;
  filter: drop-shadow(0 0 4px #ffd6e8);
  animation: sparkle 2.5s ease-in-out infinite;
  pointer-events: none;
  font-weight: 900;
}
.avatar-sparkle.s1 { top: -4px;  right: 6px;  animation-delay: 0s;   }
.avatar-sparkle.s2 { bottom: 8px; left: -6px; animation-delay: .8s;  color: #b985ff; }
.avatar-sparkle.s3 { top: 50%;   right: -10px; animation-delay: 1.6s; color: #6bb7ff; }
@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(.5) rotate(0deg); }
  50%      { opacity: 1; transform: scale(1)  rotate(180deg); }
}

/* ========== 名字 / kig id ========== */
.name {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 1px;
  margin-bottom: 4px;
  /* 静态 3 色渐变；之前的 shimmer 动画是用 background-position 的 CPU 重绘，每帧都要重新栅格化文字，主线程杀手 */
  background: linear-gradient(90deg, #ff6b9d, #b985ff, #6bb7ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.shimmer { /* class kept for API stability; animation removed for performance */ }

.kig-name {
  font-size: 14px;
  color: #b985ff;
  margin-bottom: 16px;
  font-weight: 500;
  letter-spacing: 1px;
}

/* ========== 标签 ========== */
.tags {
  display: flex; gap: 8px; flex-wrap: wrap;
  justify-content: center; margin-bottom: 18px;
}
.tag {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .9);
  color: #c44a8a;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(255,130,180,.12);
  transition: transform .2s ease;
}
.tag:hover { transform: translateY(-2px); }
.tag:nth-child(4n+2) { color: #8a5ad6; }
.tag:nth-child(4n+3) { color: #4a8acc; }
.tag:nth-child(4n)   { color: #4ab39a; }

/* ========== 简介 ========== */
.bio {
  font-size: 14px;
  line-height: 1.9;
  color: #6a4a6a;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 16px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 6px 22px rgba(255, 130, 180, .12);
  white-space: pre-line;
}

/* ========== Section 标题 ========== */
.section-title {
  font-size: 16px;
  font-weight: 900;
  text-align: center;
  margin: 30px 0 16px;
  color: #c44a8a;
  letter-spacing: 3px;
  text-transform: uppercase;
}
.section-title em {
  font-style: normal;
  font-family: 'Pacifico', cursive;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 1px;
  vertical-align: middle;
  background: linear-gradient(90deg, #ff6b9d, #b985ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.section-title span {
  display: inline-block;
  margin: 0 8px;
  color: #ffb6d9;
  animation: bounce 1.6s ease-in-out infinite;
  vertical-align: middle;
}
.section-title span:last-child { animation-delay: .8s; }
@keyframes bounce {
  0%, 100% { transform: translateY(0)    rotate(0deg); }
  50%      { transform: translateY(-4px) rotate(20deg); }
}

/* ========== 联系方式（大卡片） ========== */
.contact-list {
  display: flex; flex-direction: column; gap: 12px;
}

.contact-card {
  display: flex; align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 8px 24px rgba(255, 130, 180, .14);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
  appearance: none; -webkit-appearance: none;
  font-family: inherit;
  text-align: left;
  width: 100%;
  contain: layout style;        /* 隔离卡片内部布局/样式重算，互不影响 */
}
.contact-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform .7s ease;
  pointer-events: none;
}
.contact-card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(255,130,180,.22); }
.contact-card:hover::before { transform: translateX(100%); }
.contact-card:active { transform: scale(.98); }
.contact-card.disabled { opacity: .65; cursor: not-allowed; }
.contact-card.disabled:hover { transform: none; box-shadow: 0 8px 24px rgba(255, 130, 180, .14); }

.contact-card .icon {
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
.contact-card .icon svg { width: 30px; height: 30px; }
.contact-card .info  { flex: 1; min-width: 0; }
.contact-card .label {
  font-size: 17px;
  font-weight: 900;
  color: #5a3a5a;
  margin-bottom: 2px;
  letter-spacing: .5px;
}
.contact-card .value {
  font-size: 13px;
  color: #b985ff;
  font-family: 'M PLUS Rounded 1c', monospace;
  font-weight: 500;
  word-break: break-all;
}
.contact-card .hint {
  display: block;
  font-size: 12px;
  color: #c44a8a;
  margin-top: 4px;
  font-weight: 700;
}
.contact-card .arrow {
  flex-shrink: 0;
  font-size: 22px;
  color: #ffb6d9;
  transition: transform .25s ease;
}
.contact-card:hover .arrow { transform: translateX(4px); }

/* QQ —— 白→浅粉，让粉色企鹅图标读得清楚 */
.contact-card.qq     .icon {
  background: linear-gradient(135deg, #ffffff, #ffe4ec);
  box-shadow: 0 6px 18px rgba(243, 152, 212, .25);
}
.contact-card.qq     .icon svg { width: 36px; height: 36px; }

/* VRChat —— 粉紫渐变，黑白 logo 像贴纸 */
.contact-card.vrchat .icon {
  background: linear-gradient(135deg, #ff6b9d, #b985ff);
  box-shadow: 0 6px 18px rgba(185, 133, 255, .35);
}
.contact-card.vrchat .icon svg { width: 34px; height: 34px; }

/* 网易云 —— 招牌红 */
.contact-card.wyy    .icon {
  background: linear-gradient(135deg, #ff5664, #c9261d);
  box-shadow: 0 6px 18px rgba(201, 38, 29, .3);
}
.contact-card.wyy    .icon svg { width: 36px; height: 36px; }

/* 通用 link */
.contact-card.link   .icon { background: linear-gradient(135deg, #ffc36b, #ff8a3b); }

/* ========== 照片墙 ========== */
.gallery { margin-top: 14px; }
.gallery-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.gallery-header .section-title { margin: 30px 0 0; }
.gallery-header .section-title.nm { margin: 30px 0 0; }
.view-all {
  font-size: 13px;
  color: #c44a8a;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .6);
  border: 1px solid rgba(255,182,217,.5);
  margin-top: 30px;
  transition: all .2s ease;
  white-space: nowrap;
}
.view-all:hover { background: #ffb6d9; color: #fff; transform: translateX(4px); }

.marquee-link { display: block; }

.marquee {
  position: relative;
  width: 100%;
  overflow: hidden;
  margin-bottom: 10px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.marquee-track {
  display: flex;
  gap: 14px;
  width: max-content;
  animation: scroll-x 38s linear infinite;
  padding: 16px 0;
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.marquee.reverse .marquee-track { animation-direction: reverse; animation-duration: 48s; }
.marquee-link:hover .marquee-track { animation-play-state: paused; }

@keyframes scroll-x {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

.photo {
  flex: 0 0 auto;
  width: 150px; height: 200px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(255, 130, 180, .25);
  background: linear-gradient(135deg, #ffd6e8, #d6c8ff);
  position: relative;
  border: 3px solid #fff;
  transform: translateZ(0) rotate(var(--r, 0deg));
  transition: transform .3s ease, box-shadow .3s ease;
  contain: layout paint;
}
.marquee-link:hover .photo:hover {
  transform: rotate(0deg) scale(1.06);
  box-shadow: 0 14px 32px rgba(255, 130, 180, .4);
  z-index: 2;
}
.photo img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.photo.placeholder::after {
  content: '♡';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: rgba(255,255,255,.85);
  font-family: 'Pacifico', cursive;
}

/* ========== Footer ========== */
.foot {
  text-align: center;
  margin-top: 36px;
  font-size: 12px;
  color: #b985ff;
  letter-spacing: 3px;
  opacity: .85;
  font-family: 'Pacifico', cursive;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(90, 58, 90, .92);
  color: #fff;
  padding: 12px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0,0,0,.3);
  z-index: 200;
  transition: bottom .35s cubic-bezier(.5,1.6,.4,1);
  max-width: 80vw;
  text-align: center;
  backdrop-filter: blur(10px);
}
.toast.show { bottom: 32px; }

/* =====================================================
   ✦  Gallery 页面
   ===================================================== */
.gallery-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 26px 14px 60px;
}

.g-header {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 4px 22px;
  position: sticky; top: 0;
  z-index: 10;
}

.back-btn {
  display: inline-flex; align-items: center;
  padding: 8px 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.9);
  color: #c44a8a;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(255,130,180,.18);
  transition: all .2s ease;
}
.back-btn:hover { transform: translateX(-3px); background: #fff; }

.g-title {
  flex: 1;
  font-family: 'Pacifico', cursive;
  font-size: 26px;
  text-align: center;
  background: linear-gradient(90deg, #ff6b9d, #b985ff, #6bb7ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 400;
}

.g-count {
  font-size: 13px;
  color: #b985ff;
  font-weight: 700;
  padding: 6px 14px;
  background: rgba(255,255,255,.7);
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.9);
  white-space: nowrap;
}

.masonry {
  column-count: 2;
  column-gap: 12px;
}
@media (min-width: 600px)  { .masonry { column-count: 3; } }
@media (min-width: 900px)  { .masonry { column-count: 4; } }

.m-item {
  break-inside: avoid;
  margin: 0 0 12px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(135deg, #ffd6e8, #d6c8ff);
  box-shadow: 0 6px 18px rgba(255,130,180,.2);
  cursor: zoom-in;
  position: relative;
  display: block;
  transition: transform .3s ease, box-shadow .3s ease;
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp .55s ease forwards;
}
.m-item:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 12px 28px rgba(255,130,180,.32);
}
.m-item img { width: 100%; height: auto; display: block; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: #b985ff;
}
.empty-state .big { font-size: 56px; margin-bottom: 12px; font-family: 'Pacifico', cursive; color: #ffb6d9; }
.empty-state p   { font-size: 14px; line-height: 1.8; }
.empty-state code {
  display: inline-block;
  background: rgba(255,255,255,.7);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: monospace;
  color: #c44a8a;
  margin: 0 2px;
}

/* Lightbox —— 用 opacity/visibility 切换，display 切换没法 transition */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 10, 25, .9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center; justify-content: center;
  padding: 20px;
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s ease, visibility .3s ease;
}
.lightbox.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.lightbox img {
  max-width: 100%; max-height: 88vh;
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0,0,0,.6);
  border: 4px solid #fff;
  transform: scale(.88);
  opacity: 0;
  transition:
    transform .45s cubic-bezier(.34, 1.56, .64, 1),
    opacity .3s ease;
  will-change: transform, opacity;
}
.lightbox.show img {
  transform: scale(1);
  opacity: 1;
}
/* 切换上一张 / 下一张时的过渡 */
.lightbox.show img.swapping {
  transform: scale(.97);
  opacity: 0;
  transition: transform .15s ease, opacity .15s ease;
}

.lightbox .nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  user-select: none;
  transition: background .2s ease, transform .2s ease;
}
.lightbox .nav:hover { background: rgba(255,255,255,.3); }
.lightbox .nav.prev { left: 16px; }
.lightbox .nav.next { right: 16px; }
.lightbox .nav.prev:active { transform: translateY(-50%) translateX(-3px); }
.lightbox .nav.next:active { transform: translateY(-50%) translateX(3px); }

.lightbox .counter {
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.85);
  font-size: 13px;
  background: rgba(0,0,0,.4);
  padding: 6px 14px; border-radius: 16px;
  font-weight: 700;
}
