/* =========================================================
   科技粒子风主题  —  Huizi 个人站点
   配色：深空蓝底 + 青/紫霓虹高亮 + 玻璃拟态
   ========================================================= */

:root {
  --bg:        #060914;
  --bg-soft:   #0b1020;
  --panel:     rgba(18, 26, 46, 0.55);
  --panel-br:  rgba(120, 160, 255, 0.14);
  --text:      #e8eefc;
  --text-dim:  #93a0c0;
  --text-mut:  #64708f;
  --accent:    #00f0ff;
  --accent2:   #a855f7;
  --line:      rgba(120, 160, 255, 0.10);
  --radius:    16px;
  --maxw:      1100px;
  --font:      "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono:      "JetBrains Mono", "Fira Code", "Consolas", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 背景网格 + 渐变光晕 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(0, 240, 255, 0.10), transparent 60%),
    radial-gradient(800px 600px at 100% 0%, rgba(168, 85, 247, 0.12), transparent 55%),
    linear-gradient(180deg, #060914 0%, #070b18 100%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(120, 160, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 255, 0.04) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 80%);
}

a { color: inherit; text-decoration: none; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ===================== 导航 ===================== */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(6, 9, 20, 0.6);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .5px; }
.brand .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
  animation: pulse 2.4s infinite;
}
.brand span { font-family: var(--mono); }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1);} 50%{opacity:.5;transform:scale(.8);} }

.nav-links { display: flex; gap: 28px; }
.nav-links a { color: var(--text-dim); font-size: 15px; position: relative; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after { width: 100%; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -6px; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .25s;
}
.nav-links a:hover::after { width: 100%; }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 24px; cursor: pointer; }

/* ===================== 通用区块 ===================== */
section { padding: 92px 0; position: relative; }
.eyebrow {
  font-family: var(--mono); font-size: 13px; letter-spacing: 3px;
  color: var(--accent); text-transform: uppercase; margin-bottom: 14px;
}
.h2 { font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: -.5px; margin-bottom: 14px; }
.lead { color: var(--text-dim); max-width: 620px; }

.gradient-text {
  background: linear-gradient(95deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* 卡片玻璃拟态 */
.card {
  background: var(--panel);
  border: 1px solid var(--panel-br);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 12px 40px rgba(0, 240, 255, 0.12);
}

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: 15px;
  border: 1px solid transparent; cursor: pointer; transition: .25s;
}
.btn-primary {
  background: linear-gradient(95deg, var(--accent), var(--accent2));
  color: #04121a; box-shadow: 0 8px 30px rgba(0, 240, 255, 0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(0, 240, 255, 0.4); }
.btn-ghost { border-color: var(--panel-br); color: var(--text); background: rgba(255,255,255,.02); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ===================== Hero ===================== */
.hero { min-height: 92vh; display: flex; align-items: center; position: relative; padding-top: 40px; }
#particles {
  position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: -1;
  pointer-events: none;
}
.hero .wrap { position: relative; z-index: 1; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  border: 1px solid var(--panel-br); padding: 6px 14px; border-radius: 999px;
  background: var(--panel); margin-bottom: 22px;
}
.hero-tag .blink { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }
.hero h1 { font-size: clamp(38px, 7vw, 76px); font-weight: 900; line-height: 1.05; letter-spacing: -1.5px; margin-bottom: 18px; text-shadow: 0 0 36px rgba(0,240,255,0.28), 0 0 12px rgba(168,85,247,0.22); }
.hero .tagline { font-size: clamp(16px, 2.4vw, 22px); color: var(--text-dim); margin-bottom: 26px; }
.hero .bio { max-width: 560px; color: var(--text-dim); margin-bottom: 32px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-meta { margin-top: 40px; display: flex; gap: 34px; flex-wrap: wrap; }
.hero-meta .m-num { font-family: var(--mono); font-size: 28px; font-weight: 700; color: var(--text); }
.hero-meta .m-lbl { font-size: 13px; color: var(--text-mut); }

/* ===================== 关于 ===================== */
.about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: center; }
.about-text p { color: var(--text-dim); margin-bottom: 16px; }

/* 技能 */
.skills { display: grid; gap: 16px; }
.skill { }
.skill-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 7px; }
.skill-head .ic { font-family: var(--mono); color: var(--accent); }
.skill-bar { height: 7px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.skill-bar > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 999px; transition: width 1.2s cubic-bezier(.2,.8,.2,1);
}

/* ===================== 博客 ===================== */
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.post-card { padding: 24px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.post-card .pc-date { font-family: var(--mono); font-size: 12px; color: var(--text-mut); }
.post-card h3 { font-size: 20px; font-weight: 700; line-height: 1.35; }
.post-card p { color: var(--text-dim); font-size: 14.5px; flex: 1; }
.post-card .tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 12px; color: var(--accent); border: 1px solid var(--panel-br); padding: 3px 10px; border-radius: 999px; }
.post-card .read { font-size: 14px; color: var(--accent); font-weight: 600; }

/* ===================== 文章页 ===================== */
.article { max-width: 760px; margin: 0 auto; padding-top: 120px; padding-bottom: 80px; }
.article .a-meta { font-family: var(--mono); font-size: 13px; color: var(--text-mut); margin-bottom: 12px; }
.article h1 { font-size: clamp(28px, 5vw, 46px); font-weight: 850; line-height: 1.2; margin-bottom: 18px; letter-spacing: -.5px; }
.article .a-tags { display: flex; gap: 8px; margin: 18px 0 30px; }
.article .content { font-size: 17px; color: #d4ddf0; }
.article .content h2 { font-size: 26px; margin: 38px 0 14px; }
.article .content h3 { font-size: 21px; margin: 30px 0 12px; }
.article .content p { margin: 16px 0; }
.article .content ul, .article .content ol { margin: 16px 0 16px 22px; }
.article .content li { margin: 8px 0; }
.article .content a { color: var(--accent); border-bottom: 1px solid rgba(0,240,255,.4); }
.article .content strong { color: #fff; }
.article .content blockquote {
  border-left: 3px solid var(--accent); padding: 8px 18px; margin: 20px 0;
  background: rgba(0,240,255,.05); color: var(--text-dim); border-radius: 0 8px 8px 0;
}
.article .content code { font-family: var(--mono); background: rgba(120,160,255,.12); padding: 2px 7px; border-radius: 6px; font-size: .9em; color: #aee9ff; }
.article .content pre.code-block {
  background: #05080f; border: 1px solid var(--panel-br); border-radius: 12px;
  padding: 18px; overflow: auto; margin: 22px 0;
}
.article .content pre.code-block code { background: none; padding: 0; color: #cfe3ff; font-size: 14px; line-height: 1.6; }
.article .content img { max-width: 100%; border-radius: 12px; margin: 20px 0; border: 1px solid var(--panel-br); }
.article .content hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }

.back-link { display: inline-flex; gap: 8px; align-items: center; color: var(--text-dim); margin-bottom: 24px; }
.back-link:hover { color: var(--accent); }

/* ===================== 联系 ===================== */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.socials { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 20px; }
.social {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  border: 1px solid var(--panel-br); background: var(--panel); font-family: var(--mono);
  font-weight: 700; color: var(--text); transition: .25s;
}
.social:hover { transform: translateY(-4px); border-color: var(--accent); color: var(--accent); box-shadow: 0 8px 24px rgba(0,240,255,.2); }
.contact-card { padding: 34px; }
.contact-card .row { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.contact-card .row:last-child { border-bottom: 0; }
.contact-card .k { color: var(--text-mut); font-family: var(--mono); font-size: 14px; }
.contact-card .v { color: var(--text); }

/* ===================== 页脚 ===================== */
.footer { border-top: 1px solid var(--line); padding: 30px 0; text-align: center; color: var(--text-mut); font-size: 14px; }
.footer .mono { font-family: var(--mono); }

/* ===================== 滚动动效 ===================== */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s, transform .7s; }
.reveal.in { opacity: 1; transform: none; }

/* ===================== 响应式 ===================== */
@media (max-width: 820px) {
  .nav-links {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 10px 22px 18px;
    background: rgba(6,9,20,.96); border-bottom: 1px solid var(--line);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .nav-toggle { display: block; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
  section { padding: 64px 0; }
}

/* ===== 右下角悬浮音乐播放器 ===== */
.music-player { position: fixed; right: 22px; bottom: 22px; z-index: 60; font-family: inherit; }
.mp-toggle {
  width: 54px; height: 54px; border-radius: 50%;
  border: 1px solid rgba(0,240,255,.5); background: rgba(10,14,24,.7);
  backdrop-filter: blur(8px); color: var(--accent); font-size: 22px;
  cursor: pointer; box-shadow: 0 0 18px rgba(0,240,255,.25);
  display: flex; align-items: center; justify-content: center; transition: .3s;
}
.mp-toggle:hover { transform: scale(1.08); box-shadow: 0 0 26px rgba(0,240,255,.5); }
.mp-disc { animation: mpPulse 2.4s ease-in-out infinite; }
.music-player.open .mp-toggle { opacity: 0; pointer-events: none; transform: scale(.6); }
.mp-panel {
  position: absolute; right: 0; bottom: 0; width: 320px; max-width: 86vw;
  background: rgba(12,16,28,.82); backdrop-filter: blur(14px);
  border: 1px solid rgba(0,240,255,.25); border-radius: 18px; padding: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(12px) scale(.96); pointer-events: none; transition: .3s;
}
.music-player.open .mp-panel { opacity: 1; transform: none; pointer-events: auto; }
.mp-now { display: flex; gap: 12px; align-items: center; }
.mp-cover {
  width: 56px; height: 56px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 18px rgba(0,240,255,.3);
}
.mp-disc-spin { font-size: 24px; color: #08101a; }
.mp-disc-spin.spin { animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.mp-meta { min-width: 0; }
.mp-title { font-weight: 700; color: #eaf6ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-artist { font-size: 12px; color: #7fa8c0; }
.mp-progress { margin: 14px 0 4px; }
.mp-bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); cursor: pointer; position: relative; }
.mp-bar i { position: absolute; left: 0; top: 0; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.mp-time { font-size: 11px; color: #7fa8c0; display: block; margin-top: 4px; }
.mp-controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.mp-btn { background: transparent; border: none; color: #cfe8f5; font-size: 18px; cursor: pointer; transition: .2s; }
.mp-btn:hover { color: var(--accent); transform: scale(1.12); }
.mp-play {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #08101a; font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.mp-vol { display: flex; align-items: center; gap: 4px; font-size: 14px; color: #7fa8c0; margin-left: auto; }
.mp-vol input { width: 64px; accent-color: var(--accent); }
.mp-list-btn { font-size: 16px; }
.mp-list { max-height: 0; overflow: hidden; transition: .3s; margin-top: 0; }
.music-player.show-list .mp-list {
  max-height: 240px; overflow: auto; margin-top: 12px;
  border-top: 1px solid rgba(255,255,255,.08); padding-top: 8px;
}
.mp-item { display: flex; align-items: center; gap: 8px; padding: 8px 6px; border-radius: 8px; cursor: pointer; transition: .15s; }
.mp-item:hover { background: rgba(0,240,255,.08); }
.mp-item.active { background: rgba(0,240,255,.14); }
.mp-item.active .mp-i-title { color: var(--accent); }
.mp-i-idx { font-size: 11px; color: #4f6b7d; width: 18px; text-align: right; flex: none; }
.mp-i-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #dff1fb; font-size: 13px; }
.mp-i-artist { font-size: 11px; color: #7fa8c0; flex: none; }
@keyframes mpPulse { 0%,100% { opacity: .7; } 50% { opacity: 1; } }
.mp-close {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px;
  border-radius: 50%; border: none; background: rgba(255,255,255,.08);
  color: #cfe8f5; font-size: 20px; line-height: 1; cursor: pointer; transition: .2s;
}
.mp-close:hover { background: rgba(255,255,255,.18); color: #fff; }
/* 收起成小圆钮时，正在播放则让音符旋转，一眼看出在放歌 */
.music-player.playing .mp-toggle .mp-disc { animation: spin 4s linear infinite; color: var(--accent2); }

/* 文章上一篇 / 下一篇导航 */
.post-pager {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin: 48px auto 0; max-width: 760px; padding: 0 24px;
}
.pager-link {
  font-size: 14px; color: var(--text); text-decoration: none;
  padding: 10px 16px; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08);
  transition: .2s; white-space: nowrap;
}
.pager-link:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 18px rgba(0,240,255,.18); }
.pager-link.mid { flex: none; }
.pager-link.disabled { color: #5a6b78; border-color: rgba(255,255,255,.04); pointer-events: none; }

/* =========================================================
   游戏页
   ========================================================= */
.game-hero { padding: 46px 0 12px; text-align: center; }
.game-hero .h2 { font-size: clamp(22px, 3.2vw, 32px); }
.game-hero .eyebrow { margin-bottom: 8px; }
.game-hero .h2 { margin: 0 0 6px; }
.game-hero p.lead { max-width: 560px; margin: 8px auto 0; font-size: 15px; }

.game-tabs {
  display: flex; justify-content: center; gap: 12px;
  flex-wrap: wrap; margin: 26px 0 30px;
}
.g-tab {
  font: inherit; cursor: pointer;
  padding: 10px 26px; border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-dim, #9aa7c7);
  transition: all 0.25s;
}
.g-tab:hover { border-color: var(--accent); color: var(--accent); }
.g-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #04101c; font-weight: 600;
  border-color: transparent;
  box-shadow: 0 0 18px rgba(0,240,255,0.35);
}

.g-panel { display: none; }
.g-panel.show { display: block; animation: gFade 0.35s ease; }
@keyframes gFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.game-board {
  position: relative;
  max-width: 580px; margin: 0 auto;
  border-radius: 18px; overflow: hidden;
  background: rgba(8,12,28,0.55);
  border: 1px solid rgba(0,240,255,0.18);
  box-shadow: 0 0 40px rgba(0,240,255,0.10), inset 0 0 60px rgba(168,85,247,0.05);
}
.game-board canvas { display: block; width: 100%; height: auto; }
.game-board canvas:focus { outline: none; }

/* 俄罗斯方块：棋盘靠左、计分/说明靠右，画布按视口高度自适应，
   100% 缩放下整页完整可见（画布内部逻辑分辨率不变） */
.tetris-flex {
  display: flex; gap: 28px;
  justify-content: center; align-items: flex-start;
  flex-wrap: wrap;
}
.tetris-side {
  display: flex; flex-direction: column; gap: 20px;
  align-items: center; justify-content: center;
  min-width: 190px; padding-top: 30px;
}
.game-hud.vertical {
  flex-direction: column; gap: 16px; margin: 0;
}
#tetrisCanvas {
  width: auto;
  height: min(44vh, 430px);
  max-width: 100%;
  margin: 0 auto;
}
.tetris-side .game-tips { margin: 0; max-width: 220px; }

/* 消消乐：棋盘靠左、计分/说明靠右（与俄罗斯方块一致） */
.match3-flex {
  display: flex; gap: 28px;
  justify-content: center; align-items: flex-start;
  flex-wrap: wrap;
}
.match3-side {
  display: flex; flex-direction: column; gap: 20px;
  align-items: center; justify-content: center;
  min-width: 190px; padding-top: 30px;
}
.match3-side .game-tips { margin: 0; max-width: 230px; }
#match3Canvas {
  width: auto;
  height: min(38vh, 400px);
  max-width: 100%;
  margin: 0 auto;
}

.game-hud {
  display: flex; justify-content: center; gap: 34px;
  margin: 16px 0 8px; flex-wrap: wrap;
}
.game-hud .hud-item { text-align: center; }
.game-hud .hud-k { font-size: 12px; letter-spacing: 2px; color: var(--text-dim, #9aa7c7); }
.game-hud .hud-v { font-size: 22px; font-weight: 700; color: var(--accent); font-family: var(--mono, monospace); }

.game-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4,8,20,0.72); backdrop-filter: blur(3px);
  cursor: pointer; z-index: 2;
}
.game-overlay p {
  color: #fff; font-size: 18px; letter-spacing: 1px;
  text-shadow: 0 0 12px rgba(0,240,255,0.8);
  padding: 0 20px; text-align: center;
}

/* 记忆翻牌 */
.mem-grid-hint { text-align: center; color: var(--text-dim, #9aa7c7); margin: 4px 0 18px; font-size: 14px; }
#memoryGrid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; max-width: 480px; margin: 0 auto;
}
.mem-card {
  aspect-ratio: 1; border: none; cursor: pointer;
  background: transparent; perspective: 600px; padding: 0;
}
.mem-inner {
  position: relative; display: block; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.mem-card.flipped .mem-inner { transform: rotateY(180deg); }
.mem-front, .mem-back {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; backface-visibility: hidden;
  font-size: 30px; font-weight: 700;
}
.mem-front {
  background: linear-gradient(135deg, rgba(0,240,255,0.10), rgba(168,85,247,0.10));
  border: 1px solid rgba(0,240,255,0.30);
  color: rgba(0,240,255,0.55);
  box-shadow: inset 0 0 24px rgba(0,240,255,0.08);
}
.mem-back {
  transform: rotateY(180deg);
  background: rgba(8,12,28,0.85);
  border: 1px solid rgba(168,85,247,0.45);
  text-shadow: 0 0 14px currentColor;
}
.mem-card.done { pointer-events: none; }
.mem-card.done .mem-inner { animation: memPop 0.4s ease; }
.mem-card.done .mem-back {
  border-color: rgba(0,240,255,0.7);
  box-shadow: 0 0 16px rgba(0,240,255,0.35);
}
@keyframes memPop {
  0% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.12); }
  100% { transform: rotateY(180deg) scale(1); }
}
.mem-reset-row { text-align: center; margin-top: 22px; }

.game-tips {
  max-width: 580px; margin: 14px auto 0;
  text-align: center; color: var(--text-dim, #9aa7c7);
  font-size: 13px; line-height: 1.9;
}
