:root {
  --bg-top: #e6cff5;
  --bg-mid: #f4d6ea;
  --bg-bot: #fde7ee;
  --ink: #4a2f4a;
  --ink-soft: rgba(74, 47, 74, .72);
  --card: rgba(255, 255, 255, .72);
  --card-hi: rgba(255, 255, 255, .94);
  --line: rgba(255, 255, 255, .85);
  --accent: #7b4b8f;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 52%, var(--bg-bot) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  line-height: 1.5;
}

#app {
  width: 100%;
  max-width: 460px;
  padding: 62px 18px calc(48px + env(safe-area-inset-bottom));
}

/* ---- 顶部信息区 ---- */
.profile { text-align: center; margin-bottom: 8px; }

.avatar {
  width: 92px; height: 92px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 14px;
  border: 3px solid rgba(255, 255, 255, .95);
  box-shadow: 0 8px 22px rgba(123, 75, 143, .22);
  background: #fff;
}

.title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: .5px;
  color: #43264a;
}

.bio {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 7px;
  line-height: 1.65;
}

/* ---- 分区标题 / 分隔线 ---- */
.section-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  font-weight: 700;
  font-size: 14.5px;
  color: #5c3466;
  margin: 26px 0 14px;
  letter-spacing: .3px;
}
.section-title::before,
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(123, 75, 143, .35), transparent);
}

.divider { height: 0; border-top: 1px dashed rgba(123, 75, 143, .28); margin: 22px 6px; }

/* ---- 链接按钮 ---- */
.links { display: flex; flex-direction: column; gap: 12px; }

.link-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(123, 75, 143, .12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-decoration: none;
  color: var(--ink);
  transition: transform .1s ease, box-shadow .2s ease, background .2s ease;
}
.link-btn:hover { background: var(--card-hi); box-shadow: 0 10px 24px rgba(123, 75, 143, .18); }
.link-btn:active { transform: scale(.985); }

.link-btn .ico {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 11px;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}
.link-btn .ico-fallback {
  width: 38px; height: 38px; flex: none;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  background: linear-gradient(135deg, #b58ad6, #e79ec4);
  color: #fff;
}

.link-btn .txt {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-btn .arrow { flex: none; font-size: 18px; color: rgba(123, 75, 143, .55); }

/* 强调按钮（shake） */
.link-btn.emph { animation: shake 2.6s ease-in-out infinite; }
@keyframes shake {
  0%, 86%, 100% { transform: rotate(0); }
  88% { transform: rotate(-2.5deg); }
  91% { transform: rotate(2.5deg); }
  94% { transform: rotate(-2deg); }
  97% { transform: rotate(1.5deg); }
}

/* 板块标题强调（抖动：横移 + 微旋，幅度比按钮小以免整条标题倾斜） */
.section-title.emph {
  color: var(--accent);
  animation: secshake 2.8s ease-in-out infinite;
  transform-origin: center;
}
@keyframes secshake {
  0%, 84%, 100% { transform: translateX(0) rotate(0deg); }
  87% { transform: translateX(-5px) rotate(-1.1deg); }
  90% { transform: translateX(5px) rotate(1.1deg); }
  93% { transform: translateX(-4px) rotate(-.85deg); }
  96% { transform: translateX(3px) rotate(.6deg); }
}
@media (prefers-reduced-motion: reduce) {
  .link-btn.emph, .section-title.emph { animation: none; }
}

/* 分区内链接（两列） */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid .link-btn { padding: 11px 12px; }
.grid .link-btn .txt { font-size: 14px; }

/* ---- 底部 ---- */
.footer {
  margin-top: 34px;
  text-align: center;
  font-size: 12px;
  color: rgba(74, 47, 74, .5);
  line-height: 1.9;
}
.footer a { color: rgba(74, 47, 74, .62); }

/* ---- 初始弹窗 ---- */
.popup-mask {
  position: fixed; inset: 0;
  background: rgba(40, 20, 45, .5);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 26px;
  z-index: 99;
  animation: fadeIn .2s ease;
}
.popup-mask[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.popup-box {
  background: #fff;
  border-radius: 18px;
  padding: 24px 22px 18px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(40, 20, 45, .3);
  animation: popIn .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes popIn { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.popup-text {
  white-space: pre-line;
  font-size: 15px;
  line-height: 2;
  color: #4a2f4a;
}
.popup-btn {
  margin-top: 18px;
  width: 100%;
  padding: 11px 0;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #b58ad6, #e79ec4);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 2px;
  cursor: pointer;
}
.popup-btn:active { opacity: .88; }

/* ---- 顶部功能栏（参考 link3：白色胶囊 + 图标键 + 细分隔线） ---- */
.topbar {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;   /* 中间空白不挡点击，仅胶囊可点 */
  z-index: 90;
}

.topbar .pill {
  display: flex;
  align-items: center;
  height: 40px;
  background: var(--card-hi);
  border: 1px solid var(--line);
  border-radius: 21px;
  box-shadow: 0 6px 18px rgba(123, 75, 143, .14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
  pointer-events: auto;
}

.ico-btn {
  width: 42px;
  height: 40px;
  flex: none;
  padding: 0;
  border: none;
  background: none;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, transform .12s ease;
}
.ico-btn:hover { color: var(--accent); background: rgba(255, 255, 255, .5); }
.ico-btn:active { transform: scale(.9); }
.ico-btn svg {
  width: 19px; height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}
.ico-btn[hidden] { display: none; }

/* 细分隔线；紧跟在被隐藏按钮后面的分隔线一并隐藏 */
.sep { width: 1px; height: 18px; flex: none; background: rgba(74, 47, 74, .16); }
.ico-btn[hidden] + .sep { display: none; }

/* 音乐键：播放中显示音符（无斜线）+ 跳动；已关闭显示带斜线音符、颜色变淡 */
#bgmBtn .off { display: none; }
#bgmBtn.playing { color: var(--accent); }
#bgmBtn.playing .bgm-ico.on { animation: bgmbob 1.6s ease-in-out infinite; }
#bgmBtn.paused .on { display: none; }
#bgmBtn.paused .off { display: block; }
@keyframes bgmbob {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-2px) rotate(-6deg); }
}

/* 收藏键：已收藏时星标实心 */
#favBtn.faved { color: var(--accent); }
#favBtn.faved svg { fill: currentColor; }

@media (prefers-reduced-motion: reduce) {
  #bgmBtn.playing .bgm-ico.on { animation: none; }
}

/* ---- 轻提示条 ---- */
.tip {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(40, 20, 45, .88);
  color: #fff;
  font-size: 13px;
  line-height: 1.4;
  padding: 9px 16px;
  border-radius: 20px;
  max-width: 78vw;
  text-align: center;
  z-index: 200;
  pointer-events: none;
  animation: fadeIn .18s ease;
}
.tip[hidden] { display: none; }

/* ---- 我的浏览记录（本地 localStorage 底部面板，不上传服务器） ---- */
.hs-mask {
  position: fixed; inset: 0;
  background: rgba(40, 20, 45, .5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 120;
  animation: fadeIn .2s ease;
}
.hs-mask[hidden] { display: none; }
.hs-box {
  background: #fff;
  width: 100%;
  max-width: 460px;
  max-height: 76vh;
  border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column;
  box-shadow: 0 -12px 40px rgba(40, 20, 45, .28);
  animation: slideUp .24s cubic-bezier(.2, .9, .3, 1.05);
  overflow: hidden;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.hs-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid rgba(123, 75, 143, .12);
}
.hs-title { flex: 1; font-size: 16px; font-weight: 800; color: #43264a; }
.hs-clear {
  border: none; background: rgba(123, 75, 143, .1); color: #7b4b8f;
  font-size: 13px; font-family: inherit; font-weight: 700;
  padding: 6px 12px; border-radius: 12px; cursor: pointer;
}
.hs-clear:active { background: rgba(123, 75, 143, .2); }
.hs-close {
  border: none; background: none; color: rgba(74, 47, 74, .5);
  font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.hs-close:active { opacity: .6; }
.hs-list { flex: 1; overflow-y: auto; padding: 6px 10px 10px; -webkit-overflow-scrolling: touch; }
.hs-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(123, 75, 143, .08);
  text-decoration: none; color: var(--ink);
}
.hs-item:active { background: rgba(123, 75, 143, .06); }
.hs-item-title {
  flex: 1; font-size: 14.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hs-item-time { flex: none; font-size: 12px; color: rgba(74, 47, 74, .5); }
.hs-empty {
  text-align: center; color: rgba(74, 47, 74, .5);
  font-size: 14px; line-height: 1.9; padding: 40px 20px;
}
.hs-foot {
  padding: 10px 16px 14px;
  font-size: 11.5px; color: rgba(74, 47, 74, .45);
  text-align: center;
  border-top: 1px solid rgba(123, 75, 143, .08);
}
