/* ==========================================================
   WBA 生存服务器 · 液态玻璃 (Liquid Glass) 主题
   - 毛玻璃：backdrop-filter 模糊 + 饱和度提升
   - 高光边：inset 顶边高光模拟玻璃边缘折光
   - 背景极光光斑：给玻璃提供可折射的颜色
   ========================================================== */

/* ========== 基础与 MC 配色 ========== */
:root {
  --grass: #5D9C3A;
  --grass-dark: #3E6B25;
  --stone: #2A2A2A;
  --sky: #6BB5E0;
  --gold: #E8A33D;
  --fail: #B5533C;
  --bg: #101014;
  --text: #F2F2F4;
  --text-dim: #A8A8B0;
  --border: rgba(255, 255, 255, 0.14);
  --highlight: rgba(255, 255, 255, 0.30);   /* 玻璃顶边高光 */
  --radius: 18px;
  --blur: blur(22px) saturate(160%);
}

html {
  color-scheme: dark;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: rgba(93, 156, 58, 0.55); }

/* ========== 背景极光光斑（玻璃折射的底料） ========== */
body::before,
body::after {
  content: '';
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  pointer-events: none;
}
body::before {
  width: 60vw; height: 60vw;
  min-width: 420px; min-height: 420px;
  top: -20vw; left: -15vw;
  background: radial-gradient(circle,
    rgba(93, 156, 58, 0.55) 0%,
    rgba(93, 156, 58, 0.22) 35%,
    transparent 70%);
  animation: drift1 26s ease-in-out infinite alternate;
}
body::after {
  width: 52vw; height: 52vw;
  min-width: 380px; min-height: 380px;
  bottom: -18vw; right: -12vw;
  background: radial-gradient(circle,
    rgba(107, 181, 224, 0.45) 0%,
    rgba(107, 181, 224, 0.18) 35%,
    transparent 70%);
  animation: drift2 32s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(9vw, 7vh) scale(1.18); } }
@keyframes drift2 { to { transform: translate(-7vw, -9vh) scale(1.12); } }

/* ========== 丝滑动效系统 ========== */
/* 统一缓动：快进慢出，接近物理弹簧手感 */
:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* 导航栏入场 */
@keyframes navIn {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}
nav { animation: navIn 0.6s var(--ease-out) 0.05s backwards; }

/* 横幅文字入场 */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero h1 { animation: riseIn 0.8s var(--ease-out) 0.12s backwards; }
.hero p  { animation: riseIn 0.8s var(--ease-out) 0.26s backwards; }

/* 滚动渐显：JS 加 .in 触发，只动 transform/opacity（GPU 合成） */
.reveal {
  opacity: 0;
  transform: translateY(26px);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
  animation: riseIn 0.7s var(--ease-out) var(--d, 0s) backwards;
  will-change: transform, opacity;
}
/* 卡片错峰入场 */
.ip-section .ip-card.reveal:nth-child(2) { --d: 0.12s; }
.features .feature-card.reveal:nth-child(2) { --d: 0.1s; }
.features .feature-card.reveal:nth-child(3) { --d: 0.2s; }

/* 表情图标轻轻漂浮 */
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
.feature-card .emoji { animation: bob 3.4s ease-in-out infinite; }
.features .feature-card:nth-child(2) .emoji { animation-delay: 0.5s; }
.features .feature-card:nth-child(3) .emoji { animation-delay: 1s; }

/* ========== 键盘焦点（无障碍） ========== */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}

/* 跳过导航链接（无障碍） */
.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 200;
  padding: 10px 18px;
  background: var(--gold);
  color: #161616;
  border-radius: 10px;
  font-weight: bold;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 16px; }

/* 仅供读屏器使用 */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ========== 导航栏：悬浮玻璃胶囊 ========== */
nav {
  position: sticky;
  top: 12px;
  z-index: 100;
  margin: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 999px;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.13),
    rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 var(--highlight),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    0 8px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
nav .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
  font-size: 1.15rem;
  color: var(--gold);
  text-shadow: 0 1px 8px rgba(232, 163, 61, 0.4);
}
nav .logo img {
  width: 32px; height: 32px;
  border-radius: 8px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}
nav ul { display: flex; list-style: none; gap: 6px; }
nav ul a {
  display: inline-block;
  color: var(--text);
  text-decoration: none;
  font-weight: bold;
  padding: 8px 16px;
  border-radius: 999px;
  transition: background 0.3s var(--ease-out), color 0.3s, box-shadow 0.3s;
}
nav ul a:hover {
  color: var(--grass);
  background: rgba(255, 255, 255, 0.08);
}
nav ul a.active {
  color: #fff;
  background: linear-gradient(180deg,
    rgba(93, 156, 58, 0.6),
    rgba(62, 107, 37, 0.55));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 2px 10px rgba(93, 156, 58, 0.35);
}

/* ========== 顶部横幅 ========== */
.hero {
  text-align: center;
  padding: 80px 20px;
  background-image: linear-gradient(rgba(16, 16, 20, 0.55), rgba(16, 16, 20, 0.8)), url('../images/banner.jpg');
  /* 支持 WebP 的浏览器用更小的 webp，老浏览器回落 jpg */
  background-image: linear-gradient(rgba(16, 16, 20, 0.55), rgba(16, 16, 20, 0.8)), url('../images/banner.webp');
  background-position: center;
  background-size: cover;
  background-color: #222;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8);
  text-wrap: balance;
}
.hero p {
  font-size: 1.2rem;
  color: #D8D8DC;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7);
}

/* ========== IP 卡片（金色折光顶） ========== */
.ip-section {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: -30px;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}
.ip-section--flat { margin-top: 0; }
.ip-card {
  background: linear-gradient(180deg,
    rgba(232, 163, 61, 0.14),
    rgba(255, 255, 255, 0.06) 45%,
    rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  width: 320px;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(232, 163, 61, 0.10);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out);
}
.ip-card:hover {
  transform: translateY(-5px) scale(1.015);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 18px 48px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(232, 163, 61, 0.18);
}
.ip-card h3 {
  color: var(--sky);
  margin-bottom: 10px;
  text-shadow: 0 1px 10px rgba(107, 181, 224, 0.4);
}
.card-desc { color: var(--text-dim); margin-bottom: 15px; font-size: 0.95rem; }

/* 内嵌「液体」文本框：深色玻璃内凹 */
.ip-text {
  font-family: monospace;
  font-size: 1.15rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.35);
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 15px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.12);
  user-select: all;
  overflow-wrap: anywhere;
  touch-action: manipulation;
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.45),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
}
.ip-text:hover {
  border-color: rgba(232, 163, 61, 0.6);
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.45),
    0 0 14px rgba(232, 163, 61, 0.25);
}
.ip-text.copied {
  border-color: rgba(93, 156, 58, 0.8);
  color: #A8E08A;
}
.ip-text.copy-fail {
  border-color: rgba(181, 83, 60, 0.8);
  color: #E09A8A;
}

/* ========== 玻璃按钮 ========== */
.btn {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg,
    rgba(93, 156, 58, 0.92),
    rgba(62, 107, 37, 0.92));
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 11px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.25s var(--ease-out), filter 0.25s, box-shadow 0.25s;
  width: 100%;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  font-size: 1rem;
  touch-action: manipulation;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -6px 12px rgba(0, 0, 0, 0.18),
    0 4px 16px rgba(93, 156, 58, 0.25);
}
/* 划过的高光扫光 */
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.28) 50%,
    transparent 60%);
  transform: translateX(-120%);
  transition: transform 0.6s var(--ease-out);
  pointer-events: none;
}
.btn:hover {
  filter: brightness(1.12);
  transform: translateY(-2px) scale(1.015);
}
.btn:hover::before { transform: translateX(120%); }
.btn:active { transform: translateY(1px) scale(0.97); filter: brightness(0.95); }
.btn.copied {
  background: linear-gradient(180deg,
    rgba(62, 107, 37, 0.95),
    rgba(46, 80, 28, 0.95));
}
.btn.copy-fail {
  background: linear-gradient(180deg,
    rgba(181, 83, 60, 0.92),
    rgba(140, 60, 42, 0.92));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 4px 16px rgba(181, 83, 60, 0.3);
}

/* ========== 内容区块 ========== */
.container {
  max-width: 1000px;
  margin: 60px auto;
  padding: 0 20px;
}
.container--top { margin-top: 0; }
.section-title {
  text-align: center;
  margin-bottom: 40px;
  color: var(--gold);
  font-size: 2rem;
  text-shadow: 0 2px 16px rgba(232, 163, 61, 0.35);
  text-wrap: balance;
}
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}
.feature-card {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.09),
    rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow:
    inset 0 1px 0 var(--highlight),
    0 10px 30px rgba(0, 0, 0, 0.4);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out);
}
.feature-card:hover {
  transform: translateY(-5px) scale(1.015);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 16px 40px rgba(0, 0, 0, 0.5);
}
.feature-card .emoji {
  font-size: 2.5rem;
  margin-bottom: 10px;
  display: block;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.5));
}
.feature-card h3 { margin-bottom: 10px; }
.feature-card p { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 15px; }

/* 文章卡（关于页） */
.article-card {
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  text-align: left;
  line-height: 1.8;
  box-shadow:
    inset 0 1px 0 var(--highlight),
    0 10px 30px rgba(0, 0, 0, 0.4);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.article-card h3 {
  color: var(--gold);
  margin: 25px 0 15px;
  text-shadow: 0 1px 10px rgba(232, 163, 61, 0.3);
}
.article-card h3:first-child { margin-top: 0; }
.rule-list { padding-left: 20px; color: var(--text-dim); }

/* ========== 页脚：玻璃条 ========== */
footer {
  text-align: center;
  padding: 30px;
  padding-bottom: calc(30px + env(safe-area-inset-bottom)); /* 手势条避让 */
  margin-top: 60px;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.03));
  border-top: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

/* ========== 滚动条（玻璃风） ========== */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.28); }

/* ========== 背景音乐按钮（玻璃悬浮球） ========== */
.music-toggle {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 150;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.14),
    rgba(255, 255, 255, 0.05));
  box-shadow:
    inset 0 1px 0 var(--highlight),
    0 6px 18px rgba(0, 0, 0, 0.45);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  touch-action: manipulation;
  transition: transform 0.3s var(--ease-out), background 0.3s;
}
.music-toggle:hover { transform: scale(1.1); }
.music-toggle:active { transform: scale(0.94); }
.music-toggle .music-icon {
  font-size: 20px;
  line-height: 1;
  display: block;
}
/* 播放中：音符缓缓旋转 */
.music-toggle.playing .music-icon {
  animation: spinNote 4s linear infinite;
}
@keyframes spinNote {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
/* 暂停中：红色斜杠 */
.music-toggle::after {
  content: '';
  position: absolute;
  width: 22px; height: 2px;
  background: var(--fail);
  border-radius: 2px;
  transform: rotate(-45deg);
  opacity: 0;
  transition: opacity 0.25s;
}
.music-toggle.paused::after { opacity: 1; }

/* ========== 不支持 backdrop-filter 的兜底 ========== */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  nav, .ip-card, .feature-card, .article-card, footer {
    background: var(--stone);
  }
  .ip-card { background: #2E2A22; }
}

/* ========== 移动端 ========== */
@media (max-width: 768px) {
  :root { --blur: blur(14px) saturate(140%); }  /* 省电 */
  nav {
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 26px;
    top: 8px;
    margin: 8px 12px;
  }
  nav ul { flex-wrap: wrap; justify-content: center; gap: 4px; }
  nav ul a { padding: 7px 13px; }
  .hero { padding: 50px 16px; }
  .hero h1 { font-size: 1.8rem; }
  .hero p { font-size: 1rem; }
  .ip-card { width: 100%; max-width: 400px; }
  .container { margin: 40px auto; }
  .section-title { font-size: 1.6rem; margin-bottom: 30px; }
  .article-card { padding: 20px; }
  body::before { min-width: 320px; min-height: 320px; }
  body::after { min-width: 300px; min-height: 300px; }
}

/* ========== 减弱动画偏好 ========== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before, body::after,
  nav, .hero h1, .hero p, .feature-card .emoji,
  .reveal.in, .music-toggle .music-icon { animation: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
  .btn::before { transition: none; }
  .ip-card, .feature-card, .btn, nav ul a {
    transition: none;
  }
}
