/* link-grid 样式：2x2的可爱按钮网格 */
.link-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 10px;
    list-style: none;
    padding: 15px;
    background: rgba(255, 255, 255, 0.15);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    width: fit-content;
}

/* 每个格子（li）垂直居中 */
.link-grid li {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px; /* 你也可以改成 60px、40px 看更好看 */
}
/* 去掉模板自带的白竖线分隔（main.css 的 #header nav ul li 会加 border-left） */
#header nav .link-grid li {
    border-left: 0;
}

/* 按钮链接样式 */
.link-grid li a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background-color 0.3s;
}

/* hover 效果：轻盈透明渐变 */
.link-grid li a:hover {
    background-color: rgba(255, 255, 255, 0.3);
}
.social-icons a {
    font-size: 1.2rem;
    color: #fdcbf1;
    margin: 0 10px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-icons a:hover {
    transform: scale(1.2);
    color: #fdcbf1;
}
/* 夜光 GRID 发光 */
.glow-grid li a {
  position: relative;
  z-index: 1;
  transition: color 0.3s ease;
}
.glow-grid li a::before {
  content: "";
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  background: rgba(253,203,241,0.35);
  filter: blur(8px);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}
.glow-grid li a:hover::before {
  opacity: 1;
}
/* 修复：main.css 的 #header nav ul 会把自定义网格覆盖成 flex/白边框 */
#header nav ul.link-grid {
  display: grid;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding-left: 15px;
}
/* 四个导航按钮（Discord/bilibili/GitHub/Zerune）：宽屏 4x1 单行 */
@media screen and (min-width: 737px) {
  #header nav .link-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
  #header nav .link-grid li {
    height: 52px;
  }
  #header nav .link-grid li a {
    white-space: nowrap;
  }
}
/* 播放器按钮悬浮提示 */
.music-tip {
  position: fixed;
  transform: translateX(-50%);
  padding: 4px 9px;
  border-radius: 7px;
  background: rgba(20, 12, 24, 0.92);
  color: #fff;
  font-size: 0.68rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10002;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
@font-face {
  font-family: 'HFStickyNotes';
  src: url('../fonts/HFStickyNotes-2.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'LoveIsFree';
  src: url('../fonts/Love-is-free-2.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'SJNarrowLight';
  src: url('../fonts/SJ-Narrow-Light-2.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

.hfsticky {
  font-family: 'HFStickyNotes', sans-serif;
  font-size: 3rem;
  background: linear-gradient(90deg, #ee9ca7, #ffdde1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;

  line-height: 1.3;
  padding-top: 0.2em;
}

.love {
  font-family: 'LoveIsFree', cursive, sans-serif;
  font-size: 1.2rem;
  color: #ff6f91; /* 白红色系甜甜的 */
  margin-right: 8px;
}

.snow {
  font-family: 'SJNarrowLight', sans-serif;
  font-size: 1.2rem;
  color: #c2e9fb; /* 冰蓝色，像雪一样冷冽 */
  margin-right: 8px;
}

.sakura {
  font-family: 'SJNarrowLight', sans-serif;
  font-size: 1.2rem;
  color: #fadada; /* 浅樱花粉色，柔柔的 */
  margin-right: 8px;
}


/* ============================================================
 * 光标渐变线条拖尾 canvas
 * ============================================================ */
#trail {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 9995;
}

/* ============================================================
 * 樱花 WebGL 花瓣层（透明背景，叠在壁纸上）
 * ============================================================ */
#sakura {
  z-index: 2;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 100vw;
  pointer-events: none;
}

/* ============================================================
 * Custom cursor (pink dot + soft trailing glow)
 * ============================================================ */
.has-custom-cursor,
.has-custom-cursor * {
  cursor: none !important;
}

#cursor {
  position: fixed;
  left: 0; top: 0;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: #ffd3e0;
  box-shadow: 0 0 8px rgba(255, 182, 193, 0.9), 0 0 16px rgba(255, 182, 193, 0.5);
  pointer-events: none;
  z-index: 10001;
}

#cursor-glow {
  position: fixed;
  left: 0; top: 0;
  width: 46px; height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(253, 203, 241, 0.55), transparent 70%);
  pointer-events: none;
  z-index: 10000;
}

/* 光标空闲 8 秒 / 移出窗口时隐藏 */
.cursor-idle #cursor,
.cursor-idle #cursor-glow,
.cursor-idle #trail {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

p {
  white-space: nowrap;
}

/* ============================================================
 * Random "Your Name." movie wallpaper background
 * ============================================================ */
#bg-wallpaper {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #1a1020; /* 图片加载失败时的兜底底色 */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}
#bg-wallpaper::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(20, 10, 25, 0.35); /* 深色半透明，保证文字可读 */
}

/* ============================================================
 * Page loading overlay
 * Fades out once the page + sakura scene are ready
 * ============================================================ */
#loading {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  background: #1a1020;
  color: #fadada;
  font-family: 'SJNarrowLight', 'Segoe UI', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#loading::before {
  content: "";
  width: 40px;
  height: 40px;
  border: 3px solid rgba(250, 218, 218, 0.25);
  border-top-color: #fadada;
  border-radius: 50%;
  animation: loading-spin 0.9s linear infinite;
}
#loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
@keyframes loading-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ============================================================
 * 通用：防止 100vw 固定层引发横向滚动 / 偏移
 * ============================================================ */
html, body {
  overflow-x: hidden;
}

/* ============================================================
 * 手机 / 竖屏适配：让按钮网格居中、不溢出
 * ============================================================ */
@media screen and (max-width: 736px) {
  #header nav {
    width: 100%;
    padding: 0 1.25rem;
  }
  #header nav .link-grid {
    display: grid;
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
    padding: 12px;
    padding-left: 12px;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, auto);
  }
  #header nav .link-grid li {
    border-top: 0; /* 覆盖 main.css 移动端的分隔线 */
    height: 48px;
  }
  #header nav .link-grid li a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    white-space: nowrap;
    padding: 10px 8px;
  }
}
/* 手机窄屏：四个导航按钮 1x4 竖排 */
@media screen and (max-width: 480px) {
  #header nav .link-grid {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, auto);
    max-width: 280px;
  }
  #header nav .link-grid li {
    height: 44px;
  }
}

/* ============================================================
 * Floating music player
 * ============================================================ */

/* ============================================================
 * Floating music player
 * ============================================================ */
/* ============================================================
 * Floating music player — 磨砂玻璃卡片式控制条（右下角固定）
 * ============================================================ */
#music-player {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  display: flex;
  align-items: center;
  padding: 6px;
  border-radius: 14px;
  background: rgba(28, 16, 34, 0.55);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.38);
  -webkit-user-select: none;
  user-select: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
#music-player.playing {
  border-color: rgba(253, 203, 241, 0.5);
  box-shadow: 0 12px 36px rgba(214, 188, 255, 0.35), 0 0 26px rgba(253, 203, 241, 0.18);
}
#music-toggle {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff !important; /* main.css 对 button 有 color !important，这里统一成白色图标 */
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
#music-toggle:hover {
  transform: scale(1.06);
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
/* 可展开的控制区（向右展开，纵向排布） */
#music-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0;
  border-radius: 12px;
  transform: translateX(6px);
  transition: max-width 0.3s ease, max-height 0.3s ease, opacity 0.25s ease, transform 0.3s ease, padding 0.3s ease;
}
#music-player.expanded #music-panel {
  max-width: 440px;
  max-height: 300px;
  opacity: 1;
  padding: 4px 8px;
  margin-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  transform: translateX(0);
}
#music-controls {
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.music-ctrl {
  width: 30px;
  height: 30px;
  padding: 0;
  min-width: 0;
  border: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.music-ctrl:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}
/* 打开歌词/歌单时，对应按钮填色（浅紫/玫瑰金）表示激活 */
#music-player.lyrics-open #music-lyrics,
#music-player.menu-open #music-playlist {
  background: linear-gradient(135deg, rgba(240, 201, 184, 0.55), rgba(214, 188, 255, 0.55));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
#music-mode {
  position: relative;
}
#music-mode .mode-badge {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 12px;
  height: 12px;
  border-radius: 6px;
  background: #fff;
  color: #4a2040;
  font-size: 0.55rem;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
  pointer-events: none;
}
/* 当前曲目信息 */
#music-title {
  flex-shrink: 1;
  min-width: 0;
  max-width: 150px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #fff;
  font-size: 0.78rem;
  padding: 0 2px;
}
#music-player .fa-music {
  transition: transform 0.3s ease;
}
/* 播放时音符旋转，作为状态指示 */
#music-player.playing .fa-music {
  animation: music-spin 3.2s linear infinite;
}
/* 音频文件缺失时的降级样式 */
#music-player.no-music #music-toggle {
  background: rgba(120, 120, 130, 0.5);
  color: #eee;
}
@keyframes music-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
/* 自动播放被拦截时的呼吸提示 */
#music-player.autoplay-blocked #music-toggle {
  animation: music-pulse 1.8s ease-in-out infinite;
}
@keyframes music-pulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(214, 188, 255, 0.45); }
  50% { box-shadow: 0 6px 28px rgba(253, 203, 241, 0.95); }
}
/* 歌单下拉菜单 */
#music-playlist-menu {
  position: absolute;
  bottom: 66px;
  right: 0;
  z-index: 9992;
  min-width: 210px;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  border-radius: 14px;
  background: rgba(24, 14, 28, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#music-player.menu-open #music-playlist-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.playlist-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #eee;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-item:hover { background: rgba(255, 255, 255, 0.12); }
.playlist-item.current {
  color: #ffc5e3;
  background: rgba(255, 197, 227, 0.14);
  font-weight: 600;
}
.playlist-item .p-num { opacity: 0.55; margin-right: 6px; }
/* 歌词字幕覆盖层（带入场动画 + 呼吸光晕） */
#music-subtitle {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(8px);
  z-index: 9989;
  max-width: 80vw;
  padding: 10px 20px;
  border-radius: 14px;
  background: rgba(15, 8, 20, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 197, 227, 0.35);
  color: #fff;
  font-size: 1.08rem;
  text-align: center;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#music-subtitle.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  animation: subtitle-glow 2.6s ease-in-out infinite;
}
#music-subtitle .sub-jp {
  display: block;
}
#music-subtitle .sub-cn {
  display: block;
  margin-top: 2px;
  font-size: 0.72em;
  letter-spacing: 0.08em;
  color: #ffd9ec;
  opacity: 0.85;
}
@keyframes subtitle-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(253, 203, 241, 0.25); }
  50% { box-shadow: 0 0 24px rgba(214, 188, 255, 0.55); }
}

/* 进度条 */
#music-progress {
  display: flex;
  align-items: center;
  gap: 4px;
}
#music-time-cur, #music-time-total {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.56rem;
  min-width: 26px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
#music-seek {
  flex: 1;
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
}
#music-seek-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, #fdcbf1, #d6bcff);
  transition: width 0.15s linear;
}
#music-seek.dragging #music-seek-fill {
  transition: none;
}

/* 音量滑块（放在控制按钮最右侧） */
#music-vol-range {
  width: 40px;
  height: 4px;
  accent-color: #f7b8dd;
  cursor: pointer;
}

/* 整页底部音频可视化（矮条、铺满整条底部宽度） */
#page-visualizer {
  position: fixed;
  left: 0;
  bottom: 0;
  display: block;
  width: 100vw;
  height: 48px;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(to top, rgba(253, 203, 241, 0.28), rgba(214, 188, 255, 0.1) 55%, transparent);
}

/* 迷你模式：收成一条小横条 */
#music-mini {
  display: none;
  align-items: center;
  gap: 6px;
}
#music-player.mini #music-mini {
  display: flex;
}
#music-player.mini #music-toggle,
#music-player.mini #music-panel {
  display: none;
}
#music-mini .mini-icon {
  color: #ffc5e3;
  font-size: 1rem;
}
#music-mini-title {
  max-width: 150px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #fff;
  font-size: 0.8rem;
  padding: 0 4px;
}

/* 歌词面板 */
#music-lyrics-panel {
  display: none;
  max-height: 150px;
  overflow-y: auto;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px;
}
#music-player.lyrics-open #music-lyrics-panel {
  display: block;
}
.lyrics-line {
  padding: 3px 8px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.6);
  border-radius: 6px;
  line-height: 1.35;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.lyrics-line:hover {
  background: rgba(255, 255, 255, 0.1);
}
.lyrics-line.active {
  color: #fff;
  background: rgba(253, 203, 241, 0.18);
  font-weight: 600;
  font-size: 0.95rem;
}
.lyrics-line .lyrics-cn {
  color: #ffd9ec;
  opacity: 0.8;
  margin-left: 8px;
  font-size: 0.85em;
  font-weight: 400;
}
/* 自定义滚动条（不用原生丑滚动条） */
#music-lyrics-panel::-webkit-scrollbar,
#music-playlist-menu::-webkit-scrollbar {
  width: 6px;
}
#music-lyrics-panel::-webkit-scrollbar-track,
#music-playlist-menu::-webkit-scrollbar-track {
  background: transparent;
}
#music-lyrics-panel::-webkit-scrollbar-thumb,
#music-playlist-menu::-webkit-scrollbar-thumb {
  background: rgba(253, 203, 241, 0.45);
  border-radius: 3px;
}
#music-lyrics-panel::-webkit-scrollbar-thumb:hover,
#music-playlist-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(253, 203, 241, 0.7);
}
#music-lyrics-panel,
#music-playlist-menu {
  scrollbar-width: thin;
  scrollbar-color: rgba(253, 203, 241, 0.5) transparent;
}

/* 头部生日倒计时（在 Love Snow Sakura 下方） */
#birthday-countdown {
  margin-top: 16px;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: #ffd9ec;
  opacity: 0.9;
}

/* 点击涟漪 */
.ripple {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  border: 2px solid rgba(253, 203, 241, 0.7);
  transform: translate(-50%, -50%) scale(0);
  animation: ripple-grow 0.65s ease-out forwards;
  z-index: 9999;
}
@keyframes ripple-grow {
  from { transform: translate(-50%, -50%) scale(0); opacity: 0.8; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ---- 播放器响应式适配 ---- */
/* 中等屏幕：稍收窄，保持单行 */
@media screen and (min-width: 737px) and (max-width: 1100px) {
  #music-player.expanded #music-panel {
    max-width: 400px;
  }
  #music-title {
    max-width: 110px;
  }
}
/* 小屏 / 竖屏：标题独占一行，按钮固定尺寸换行成两行 */
@media screen and (max-width: 736px) {
  #music-player {
    right: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
  }
  #music-player.expanded #music-panel {
    max-width: calc(100vw - 90px);
  }
  #music-controls {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }
  #music-title {
    flex: 1 1 100%;
    max-width: 100%;
    text-align: center;
    padding: 0;
  }
  .music-ctrl {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }
  #music-vol-range {
    flex: 0 0 auto;
    width: 90px;
  }
  #music-playlist-menu {
    max-width: calc(100vw - 40px);
  }
}
