/* ============================================================
   LikeGirl 增强层 —— 叠加在原有样式之上，不改动原布局
   包含：三套主题 / 滚动进度条 / 底部 dock / 滚动渐显 /
         灯箱 / 打字机 / 无障碍
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root,
[data-theme="sakura"] {
  --lg-a1: #ff758c;
  --lg-a2: #ff7eb3;
  --lg-a3: #a18cd1;
  --lg-grad: linear-gradient(135deg, var(--lg-a1), var(--lg-a2), var(--lg-a3));
  --lg-hero-grad: linear-gradient(135deg, #ffd6e0 0%, #ffe9d6 42%, #d9e6ff 100%);
  --lg-hue: 340;
  --lg-shadow: rgba(255, 117, 140, .35);
}

[data-theme="ocean"] {
  --lg-a1: #4facfe;
  --lg-a2: #00c6ff;
  --lg-a3: #7b6cf6;
  --lg-grad: linear-gradient(135deg, var(--lg-a1), var(--lg-a2), var(--lg-a3));
  --lg-hero-grad: linear-gradient(135deg, #d6f0ff 0%, #e6f7ff 42%, #dcd6ff 100%);
  --lg-hue: 205;
  --lg-shadow: rgba(79, 172, 254, .35);
}

[data-theme="sunset"] {
  --lg-a1: #ff9a44;
  --lg-a2: #fc6076;
  --lg-a3: #ff6b6b;
  --lg-grad: linear-gradient(135deg, var(--lg-a1), var(--lg-a2), var(--lg-a3));
  --lg-hero-grad: linear-gradient(135deg, #ffe3cf 0%, #ffd6d6 42%, #ffe8c9 100%);
  --lg-hue: 20;
  --lg-shadow: rgba(252, 96, 118, .35);
}

/* 主题生效点：计时标题的渐变、卡片 hover 阴影 */
.time span {
  background-image: var(--lg-grad) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
  animation: none !important;
}

.card:hover,
.card-b:hover {
  box-shadow: 0 10px 26px var(--lg-shadow) !important;
}

/* ---------- 右上角主题按钮 ---------- */
#lg-theme {
  position: fixed;
  top: 4.9rem;
  right: 1rem;
  z-index: 9992;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(120, 130, 160, .18);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 22px rgba(60, 70, 100, .16);
  cursor: pointer;
  font-size: 1.12rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
}

#lg-theme:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 12px 26px var(--lg-shadow);
}

/* 切换提示 */
#lg-toast {
  position: fixed;
  top: 4.9rem;
  right: 4.4rem;
  z-index: 9992;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(28, 30, 42, .9);
  color: #fff;
  font-size: .82rem;
  letter-spacing: .04em;
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}

#lg-toast.show { opacity: 1; transform: translateX(0); }

/* ---------- 顶部 logo 防溢出 ---------- */
.header-wrap .header { gap: 12px; }
.header-wrap .header .logo h1 { white-space: nowrap; }
.header-wrap .header .word {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 城市与距离 ---------- */
.lg-city {
  display: block;
  margin-top: .35rem;
  font-family: 'Noto Serif SC', serif;
  font-style: normal;
  font-weight: 400;
  font-size: .82rem;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .82);
}

.lg-distance {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .9rem;
  margin: 1.5rem auto 0;
  padding: .5rem 1.4rem;
  width: fit-content;
  max-width: 92%;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
  border: 1px solid rgba(255, 255, 255, .35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-family: 'Noto Serif SC', serif;
  font-size: .86rem;
  letter-spacing: .08em;
  user-select: none;
}

.lg-distance span { opacity: .92; }
.lg-distance i { font-style: normal; opacity: .85; }
.lg-distance b {
  font-style: normal;
  font-size: 1.02rem;
  font-weight: 700;
  color: #fff;
}

/* ---------- 距离地图 ---------- */
.lg-map {
  position: relative;
  max-width: 760px;
  margin: 1.6rem auto 0;
  padding: .9rem .9rem .2rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, .74);
  border: 1px solid rgba(255, 255, 255, .65);
  box-shadow: 0 14px 40px rgba(20, 30, 60, .14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.lg-map-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .6), rgba(255, 255, 255, .12));
}

.lg-map-badge {
  display: block;
  text-align: center;
  margin: .3rem 0 .55rem;
  font-size: .76rem;
  letter-spacing: .09em;
  color: #7c8398;
}

/* 爱心可点 */
#lg-heart {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#lg-heart:active img { transform: scale(.92); }

/* ---------- 首页照片墙 ---------- */
.lg-photos {
  max-width: 780px;
  margin: 3.2rem auto 0;
  padding: 0 1.2rem;
}

.lg-photos-title {
  text-align: center;
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: #3b4157;
  letter-spacing: .12em;
  margin-bottom: 1.4rem;
}

.lg-photos-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.lg-photo {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 5;
  border-radius: 16px;
  overflow: hidden;
  background: var(--lg-hero-grad);
  box-shadow: 0 8px 20px rgba(60, 70, 100, .1);
  cursor: zoom-in;
  transition: transform .3s cubic-bezier(.22, 1, .36, 1), box-shadow .3s ease;
}

.lg-photo:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(60, 70, 100, .18);
}

/* 视频格子：本身就在播放，不用 zoom 光标 */
.lg-photo.is-video { cursor: default; }
.lg-photo.is-video:hover { transform: none; }

/* 还没填照片时的占位 */
.lg-photo.is-empty { cursor: default; }
.lg-photo.is-empty:hover { transform: none; }

.lg-photo-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  color: rgba(255, 255, 255, .85);
  user-select: none;
}

.lg-photo img,
.lg-photo video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* 外链图挂了也不显示 alt 文字，留下干净的渐变块 */
  color: transparent;
  font-size: 0;
  transition: transform .45s cubic-bezier(.22, 1, .36, 1);
}

.lg-photo:hover img { transform: scale(1.07); }

.lg-photo figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 26px 12px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .62));
  color: #fff;
  font-size: .8rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 点滴页倒计时 ---------- */
.lg-countdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  max-width: 720px;
  margin: 0 auto 2.6rem;
  padding: 0 1rem;
}

.lg-cd-card {
  background: #fff;
  border: 1px solid rgba(208, 206, 206, .4);
  border-radius: 16px;
  padding: 24px 14px;
  text-align: center;
  box-shadow: 0 8px 12px #ebedf0;
  transition: transform .25s cubic-bezier(.22, 1, .36, 1), box-shadow .25s ease;
}

.lg-cd-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px var(--lg-shadow);
}

.lg-cd-icon { font-size: 1.9rem; line-height: 1; }
.lg-cd-title { color: #7c8398; font-size: .84rem; margin: 10px 0 6px; letter-spacing: .03em; }
.lg-cd-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: #33384d;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.lg-cd-value small { font-size: .78rem; font-weight: 400; color: #a8aebf; }
.lg-cd-clock {
  font-size: .72rem;
  color: #a8aebf;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
.lg-cd-done { color: var(--lg-a1); font-size: 1.25rem; }
.lg-cd-past { color: #8b91a8; font-size: 1.5rem; font-weight: 600; }
.lg-cd-past small { font-size: .78rem; font-weight: 400; }

/* ---------- 粒子画布 ---------- */
/* 放在内容之上、dock/灯箱之下，爱心点击的爆发才看得见 */
#lg-particles {
  position: fixed;
  inset: 0;
  z-index: 9989;
  pointer-events: none;
}

/* 给底部 dock 留出空间，正文不被遮挡 */
body { padding-bottom: 92px; }

/* 首屏头像：正方形图裁切，避免变形 */
.bg-img .middle img {
  object-fit: cover;
}

/* 外链头像加载失败时的渐变圆形占位 */
.lg-avatar-fb {
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  background: var(--lg-grad);
  border: .2rem solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  font-size: 3rem;
  color: #fff;
  user-select: none;
}

#pjax-container,
.footer-warp {
  position: relative;
  z-index: 1;
}

/* ---------- 滚动进度条 ---------- */
#lg-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--lg-grad);
  z-index: 9998;
  transition: width .1s linear;
  box-shadow: 0 0 10px var(--lg-shadow);
}

/* ---------- 底部悬浮 dock ---------- */
#lg-dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 9990;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(120, 130, 160, .16);
  box-shadow: 0 12px 34px rgba(60, 70, 100, .16);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  max-width: calc(100vw - 20px);
  overflow-x: auto;
  scrollbar-width: none;
}

#lg-dock::-webkit-scrollbar { display: none; }

.lg-dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 11px;
  border-radius: 999px;
  color: #7c8398;
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s ease, background .2s ease, transform .2s ease;
  font-family: inherit;
}

.lg-dock-item:hover { color: #3d4358; transform: translateY(-2px); }

.lg-dock-item.active {
  color: #fff;
  background: var(--lg-grad);
  box-shadow: 0 6px 16px var(--lg-shadow);
}

.lg-dock-ico { font-size: 1.02rem; line-height: 1; }
.lg-dock-txt { font-size: .64rem; letter-spacing: .04em; }

/* ---------- 滚动渐显 ---------- */
.lg-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .8s cubic-bezier(.22, 1, .36, 1),
              transform .8s cubic-bezier(.22, 1, .36, 1);
}

.lg-reveal.lg-in { opacity: 1; transform: none; }

/* ---------- 打字机 ---------- */
.lg-typewriter {
  margin: 3.4rem auto 2rem;
  text-align: center;
}

.lg-typewriter-title {
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: .1em;
  margin-bottom: 1.6rem;
  background: var(--lg-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

#lg-lovewords {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.2rem;
  text-align: center;
  min-height: 4.4em;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lg-lovewords p {
  font-family: 'Noto Serif SC', serif;
  font-weight: 700;
  font-size: clamp(1rem, 2.6vw, 1.35rem);
  color: #4a5068;
  letter-spacing: .04em;
  margin: 0;
  line-height: 1.8;
}

#lg-lovewords p::after {
  content: '|';
  margin-left: 2px;
  color: var(--lg-a1);
  animation: lg-blink .9s step-end infinite;
}

@keyframes lg-blink { 50% { opacity: 0; } }

/* 想对你说：自己打字 */
.lg-tw-form {
  display: flex;
  gap: 10px;
  max-width: 520px;
  margin: 1.2rem auto 0;
  padding: 0 1.2rem;
}

.lg-tw-form input {
  flex: 1;
  min-width: 0;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid rgba(208, 206, 206, .8);
  background: #fff;
  font-family: inherit;
  font-size: .92rem;
  color: #3b4157;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.lg-tw-form input:focus {
  border-color: var(--lg-a1);
  box-shadow: 0 0 0 3px var(--lg-shadow);
}

.lg-tw-form button {
  flex: 0 0 auto;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: var(--lg-grad);
  color: #fff;
  font-family: inherit;
  font-size: .92rem;
  letter-spacing: .05em;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.lg-tw-form button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px var(--lg-shadow);
}

.lg-tw-tip {
  text-align: center;
  font-size: .78rem;
  color: #a8aebf;
  margin: .7rem 0 0;
  min-height: 1.2em;
}

.lg-tw-tip a {
  color: var(--lg-a1);
  text-decoration: none;
  margin-left: 6px;
  cursor: pointer;
}

.lg-tw-tip a:hover { text-decoration: underline; }

/* ---------- 灯箱 ---------- */
#lg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9995;
  background: rgba(18, 20, 30, .93);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 44px 20px 30px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}

#lg-lightbox.open { opacity: 1; pointer-events: auto; }

#lg-lightbox img {
  max-width: 90vw;
  max-height: 76vh;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  object-fit: contain;
  transform: scale(.95);
  transition: transform .24s cubic-bezier(.22, 1, .36, 1);
}

#lg-lightbox.open img { transform: scale(1); }

#lg-lb-caption {
  margin-top: 16px;
  color: rgba(255, 255, 255, .78);
  font-size: .9rem;
  text-align: center;
  max-width: 80vw;
}

#lg-lb-counter {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, .55);
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
}

#lg-lb-close {
  position: absolute;
  top: 12px;
  right: 20px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease;
}

#lg-lb-close:hover { background: rgba(255, 255, 255, .22); }

.lg-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease;
}

.lg-lb-nav:hover { background: rgba(255, 255, 255, .2); }
#lg-lb-prev { left: 16px; }
#lg-lb-next { right: 16px; }

/* 图片可点击提示 */
.love_img img,
.lovelist img,
.little_texts img {
  cursor: zoom-in;
}

/* ---------- 时钟数字等宽，跳动不抖 ---------- */
.time b,
.time span {
  font-variant-numeric: tabular-nums;
}

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  body { padding-bottom: 84px; }
  .header-wrap .header .logo h1 { font-size: 1.04rem; }
  .header-wrap .header .word { width: 46%; font-size: .76rem; }
  #lg-theme { top: 4.6rem; right: .7rem; width: 40px; height: 40px; }
  #lg-toast { top: 4.6rem; right: 3.6rem; font-size: .76rem; padding: 7px 13px; }
  .lg-photos-row { grid-template-columns: 1fr; gap: 12px; }
  .lg-photos { padding: 0 .9rem; margin-top: 2.4rem; }
  .lg-tw-form { max-width: 100%; padding: 0 .9rem; }
  .lg-tw-form button { padding: 0 18px; }
  .lg-distance { font-size: .78rem; gap: .6rem; padding: .45rem 1rem; }
  .lg-map { padding: .55rem .55rem .1rem; margin-top: 1.1rem; border-radius: 16px; }
  .lg-map-badge { font-size: .7rem; }
  #lg-dock { bottom: 12px; padding: 6px 7px; gap: 0; }
  .lg-dock-item { padding: 5px 7px; }
  .lg-dock-ico { font-size: .95rem; }
  .lg-dock-txt { font-size: .58rem; }
  .lg-lb-nav { width: 40px; height: 40px; font-size: 1.4rem; }
  #lg-lb-prev { left: 8px; }
  #lg-lb-next { right: 8px; }
  #lg-lightbox { padding: 40px 8px 20px; }
  .lg-avatar-fb { width: 6rem; height: 6rem; font-size: 1.8rem; }
}

/* ---------- 无障碍：减弱动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  .lg-reveal { opacity: 1 !important; transform: none !important; }
  #lg-lovewords p::after { animation: none; }
  #lg-lightbox img { transform: none !important; }
  * {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
