:root {
  --font-display: "Instrument Serif", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-body: "Inter", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-pixel: "Fusion Pixel", "Silkscreen", monospace;

  --ink: #241b33;
  --ink-soft: #5d5170;
  --paper: #fbf8ff;
  --accent: #7b4fc9;
  --accent-ink: #fff;
  --heart: #a66ee8;
  --gold: #f2c46d;
  --cloud: #fff;
  --card: #fff;
  --line: rgba(60, 30, 100, .12);
  --sky: linear-gradient(180deg, #cdb8f2 0%, #e9dcfa 55%, #fbf1f6 85%, var(--paper) 100%);
  --shadow: 0 18px 40px -18px rgba(70, 40, 120, .35);
  --outline: #3b1f66;
  --drop: rgba(59, 31, 102, .22);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #efe8fa;
    --ink-soft: #b4a7c9;
    --paper: #15101f;
    --accent: #b48cf5;
    --accent-ink: #1a1226;
    --heart: #c39bff;
    --cloud: #4a3a6b;
    --card: #221a33;
    --line: rgba(220, 200, 255, .12);
    --sky: linear-gradient(180deg, #2a1d45 0%, #241a3a 55%, #1b1429 85%, var(--paper) 100%);
    --shadow: 0 18px 40px -18px rgba(0, 0, 0, .7);
    --outline: #0c0714;
    --drop: rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  /* 天空渐变画在 body 上，这样漂浮层能夹在天空和文字之间 */
  background: var(--sky) top / 100% 100svh no-repeat, var(--paper);
  color: var(--ink);
  font: 16px/1.7 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
a { color: inherit; }
em { font-style: italic; color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; line-height: 1.02; }
main, footer, .hero { position: relative; z-index: 1; }

.tag {
  font-family: var(--font-pixel);
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}

/* ---------- 全站漂浮层 ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.s {
  --ol: 2px;
  position: absolute; left: 0; top: 0; width: 30px; height: 26px; overflow: visible; will-change: transform;
  filter: drop-shadow(var(--ol) 0 0 var(--outline)) drop-shadow(calc(var(--ol) * -1) 0 0 var(--outline))
          drop-shadow(0 var(--ol) 0 var(--outline)) drop-shadow(0 calc(var(--ol) * -1) 0 var(--outline))
          drop-shadow(calc(var(--ol) * 1.5) calc(var(--ol) * 1.5) 0 var(--drop));
}
.s.lg { --ol: 4px; }
.s use { animation: bob 5s ease-in-out infinite; }
.s:nth-child(2n) use { animation-duration: 6.5s; animation-delay: -2s; }
.s:nth-child(3n) use { animation-duration: 4.2s; animation-delay: -1s; }
.s.cloud { width: 96px; height: 48px; color: var(--cloud); }
.s.cloud.lg { width: 220px; height: 110px; }
.s.cloud.sm { width: 56px; height: 28px; }
.s.heart { color: var(--heart); }
.s.star { width: 26px; height: 26px; color: var(--gold); }
.s.star.lg { width: 84px; height: 84px; }
.s.heart.lg { width: 98px; height: 84px; }
.s.moon { width: 20px; height: 28px; color: var(--gold); }
.s.moon.lg { width: 60px; height: 84px; }
.s.flower { width: 28px; height: 20px; color: #f49ac1; }
.s.flower.lg { width: 98px; height: 70px; }
.s.bow.lg { width: 108px; height: 60px; }
.s.cat.lg { width: 80px; height: 70px; opacity: 1; color: var(--heart); }
.s.sparkle { width: 16px; height: 16px; color: var(--heart); }
.s.bow { width: 32px; height: 18px; color: var(--heart); }
.s.cat { width: 32px; height: 28px; color: var(--ink); }
.s.sm { transform-origin: center; scale: .7; }

/* ---------- 首屏 ---------- */
.hero {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  align-items: center;
  gap: 32px;
  padding: 96px max(16px, 6vw) 72px;
}
.title { font-size: clamp(88px, 15vw, 200px); letter-spacing: .01em; line-height: 1.12; display: flex; }
.title span { display: inline-block; animation: letter .9s cubic-bezier(.2, .9, .25, 1.2) both; animation-delay: calc(var(--d) * 70ms + 150ms); }
.role { font-family: var(--font-display); font-size: clamp(32px, 4.4vw, 52px); margin: 0 0 28px; line-height: 1; }

.info { display: grid; gap: 2px; margin: 0 0 32px; max-width: 34em; }
.info div { display: grid; grid-template-columns: 5em 1fr; gap: 12px; align-items: baseline; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.info dt { font-size: 15px; font-weight: 600; color: var(--accent); }
.info dd { margin: 0; font-size: clamp(17px, 1.4vw, 20px); color: var(--ink); }
.px-num { font-family: var(--font-pixel); font-size: 18px !important; color: var(--accent) !important; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px;
  background: var(--accent); color: var(--accent-ink);
  border: 2px solid var(--accent);
  border-radius: 999px; text-decoration: none; font-weight: 500;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s, background .2s, color .2s;
}
.btn:hover { transform: translateY(-2px); }
button.btn { font: inherit; font-weight: 500; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: none; }
.btn.ghost:hover { background: var(--accent); color: var(--accent-ink); }
.btn:focus-visible, .card:focus-visible, .links a:focus-visible { outline: 3px solid var(--heart); outline-offset: 3px; }
.btn-ico { width: 14px; height: 12px; }
.btn:hover .btn-ico { animation: beat .6s steps(2) infinite; }

/* 右侧头像 + 像素轨道 */
.hero-art { display: grid; place-items: center; }
.portrait { position: relative; width: min(520px, 100%); aspect-ratio: 1; }
.avatar {
  position: absolute; inset: 21.9%; width: 56.2%; height: 56.2%;
  border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 6px var(--paper), var(--shadow);
  animation: float 6s ease-in-out infinite;
}
.orbit { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.bubble {
  position: absolute; right: 2%; top: 6%;
  margin: 0; padding: 8px 12px;
  font-family: var(--font-pixel); font-size: 11px; line-height: 1.5;
  background: var(--card); color: var(--ink);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--accent);
  animation: bubble 5s steps(1) infinite;
}
.bubble::after {
  content: ""; position: absolute; left: 14px; bottom: -8px; width: 8px; height: 8px;
  background: var(--card); border: 2px solid var(--ink); border-top: 0; border-right: 0;
  transform: skewY(-45deg);
}
.scroll-hint {
  position: absolute; left: 50%; bottom: 20px; translate: -50% 0;
  font-family: var(--font-pixel); font-size: 11px; color: var(--accent); text-decoration: none;
  animation: bob 1.6s steps(2) infinite;
}

/* 入场动画 */
.rise { animation: rise .9s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--d) * 90ms + 200ms); }

@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
@keyframes letter { from { opacity: 0; transform: translateY(.5em) rotate(8deg); } }
@keyframes bob { 50% { transform: translateY(-10px); } }
@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes beat { 50% { transform: scale(1.3); } }
@keyframes bubble { 0%, 70% { opacity: 1; } 71%, 100% { opacity: 0; } }

/* ---------- 跑马灯 ---------- */
.marquee {
  position: relative; z-index: 1;
  overflow: hidden; white-space: nowrap;
  border-block: 2px solid var(--ink);
  background: var(--paper);
  font-family: var(--font-pixel); font-size: 13px; letter-spacing: .08em;
  padding: 12px 0;
}
.marquee-track { display: inline-flex; animation: marquee 90s linear infinite; }
.marquee-track span { flex: none; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- 成果：横向卡片 ---------- */
.works { height: calc(var(--n) * 80vh + 20vh); }
.works-sticky {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; gap: 4vh;
  perspective: 1400px;
}
.works-head {
  display: flex; justify-content: space-between; align-items: end;
  width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px;
}
h2 { font-size: clamp(44px, 7vw, 80px); }
.counter { font-family: var(--font-pixel); font-size: 14px; color: var(--ink-soft); margin: 0 0 8px; }
.counter .cur { color: var(--accent); font-size: 22px; }

.track { display: flex; gap: var(--gap, 48px); will-change: transform; transform-style: preserve-3d; }
.card {
  --w: min(640px, 82vw);
  position: relative; flex: 0 0 var(--w);
  display: grid; grid-template-columns: 42% 1fr; grid-template-rows: minmax(0, 1fr); /* 高图片不许把格子撑大 */
  height: min(380px, 52vh);
  background: var(--card);
  border: 1px solid var(--line); border-radius: 6px;
  box-shadow: var(--shadow);
  text-decoration: none; overflow: hidden;
  transform-style: preserve-3d;
  will-change: transform;
}
.card img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .6s; }
.card:hover img { transform: scale(1.05); }
.card img[src$=".svg"] { object-position: center; } /* HF 笑脸图：让中间的大笑脸露出来 */
.card-body { display: flex; flex-direction: column; gap: 6px; padding: 26px 26px 22px; min-width: 0; }
.badge {
  align-self: flex-start;
  font-family: var(--font-pixel); font-size: 10px; letter-spacing: .06em;
  padding: 4px 8px; margin-bottom: 4px;
  border: 2px solid var(--accent); color: var(--accent);
  box-shadow: 2px 2px 0 var(--accent);
}
.stat { margin: 0; font-family: var(--font-display); line-height: .9; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.card h3 { font-size: clamp(26px, 2.6vw, 34px); }
.stat b { font-weight: 400; font-size: clamp(44px, 5vw, 64px); }
.stat small { font-family: var(--font-pixel); font-size: 11px; color: var(--accent); }
.sub { margin: 0; color: var(--ink); font-weight: 500; }
.go { margin-top: auto; font-family: var(--font-pixel); font-size: 11px; color: var(--accent); } /* 自己贴到卡片底部 */
.card:hover .go { animation: beat .6s steps(2) infinite; display: inline-block; transform-origin: left; }
.dissolve { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; image-rendering: pixelated; }

.px-progress { width: min(320px, 60vw); height: 8px; margin: 0 auto; background: repeating-linear-gradient(90deg, var(--line) 0 8px, transparent 8px 12px); }
.px-progress i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 12px); }

/* ---------- 关于 ---------- */
.section { max-width: 1200px; margin: 0 auto; padding: 120px 16px; }
.about h2 { margin-bottom: 28px; }
.about > p:not(.tag) { max-width: 36em; color: var(--ink-soft); margin: 0 0 28px; font-size: 17px; }
.links { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 0; margin: 32px 0 0; }
.links a { font-family: var(--font-pixel); font-size: 12px; color: var(--accent); text-decoration: none; border-bottom: 2px dotted currentColor; }
.links a:hover { border-bottom-style: solid; }

.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s, transform .8s cubic-bezier(.2, .8, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
.reveal:nth-child(2) { transition-delay: .08s; }
.reveal:nth-child(3) { transition-delay: .16s; }
.reveal:nth-child(4) { transition-delay: .24s; }
.reveal:nth-child(5) { transition-delay: .32s; }

footer {
  display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between;
  max-width: 1200px; margin: 0 auto; padding: 32px 16px 48px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-soft);
}

/* 点击迸出的像素火花 */
.spark { position: fixed; width: 6px; height: 6px; pointer-events: none; z-index: 10; background: var(--heart); animation: spark .6s steps(6) forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }

/* ---------- 窄屏 ---------- */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding-top: 72px; }
  .hero-art { order: -1; }
  .portrait { width: min(340px, 86vw); }
  .card { grid-template-columns: 1fr; grid-template-rows: 44% minmax(0, 1fr); height: min(520px, 66vh); }
  .card-body { padding: 18px; }
  .stat b { font-size: 44px; }
  .card h3 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .orbit { display: none; }
}

/* ---------- 文章 / 教程 ---------- */
.articles { padding-bottom: 40px; }
.articles-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 36px; }
.more { font-family: var(--font-pixel); font-size: 12px; color: var(--accent); text-decoration: none; border-bottom: 2px dotted currentColor; margin-bottom: 10px; }
.more:hover { border-bottom-style: solid; }
.posts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
.post {
  position: relative; aspect-ratio: 3 / 4.2; overflow: hidden;
  border-radius: 6px; box-shadow: var(--shadow); text-decoration: none; color: #fff;
  background: var(--card);
}
.post.reveal.in { transition: opacity .8s, transform .4s cubic-bezier(.2, .8, .2, 1); }
.post img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .6s; }
.post::after { /* 底部渐暗，保证白字看得清 */
  content: ""; position: absolute; inset: 40% 0 0; pointer-events: none;
  background: linear-gradient(transparent, rgba(20, 10, 35, .88));
}
.post-tag {
  position: absolute; left: 12px; top: 12px; z-index: 1;
  font-family: var(--font-pixel); font-size: 9px; letter-spacing: .06em;
  padding: 3px 7px; background: var(--accent); color: #fff; box-shadow: 2px 2px 0 #241b33;
}
.post-info { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 16px; }
.post-meta { font-family: var(--font-pixel); font-size: 10px; opacity: .8; }
.post h3 { font-size: clamp(20px, 1.8vw, 26px); line-height: 1.2; margin-top: 6px; }
.post:hover { transform: translateY(-6px) rotate(-1deg); }
.post:hover img { transform: scale(1.06); }
.post:focus-visible { outline: 3px solid var(--heart); outline-offset: 3px; }
@media (max-width: 1100px) { .posts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .posts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .post:first-child { grid-column: 1 / -1; aspect-ratio: 4 / 3; } .post:first-child img { object-position: center 35%; } }
@media (max-width: 480px) { .posts { gap: 12px; } .post-info { padding: 12px; } .post h3 { font-size: 17px; } }
.post img.crop-bottom { scale: 1.35; transform-origin: top; } /* 这张封面底部自带文字，放大把它挤出去 */

/* 关于我：可接服务，像素小框 */
.services { margin: 0 0 32px; }
.services-label { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--accent); }
.services ul { list-style: none; display: flex; flex-wrap: wrap; gap: 14px; padding: 0; margin: 0; }
.services li {
  padding: 8px 16px; font-size: 17px; color: var(--ink); white-space: nowrap;
  background: var(--card); border: 2px solid var(--accent); box-shadow: 4px 4px 0 var(--accent);
}

/* 手机上左右分不开：大号漂浮物缩小一半、调淡，免得压住文字 */
@media (max-width: 820px) {
  .s.lg { scale: .5; opacity: .45; }
  .s.lg.heart, .s.lg.cat, .s.lg.bow, .s.lg.flower { display: none; }
}

/* 卡片数据格：2x2，数字用 K 缩写 */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 8px 0 0; }
.stats div { border-top: 2px dashed var(--line); padding-top: 6px; }
.stats dt { font-family: var(--font-pixel); font-size: 10px; letter-spacing: .06em; color: var(--accent); }
.stats dd { margin: 0; font-family: var(--font-display); font-size: clamp(34px, 3.4vw, 48px); line-height: 1; }
.stats b { font-weight: 400; }
@media (max-width: 820px) { .stats dd { font-size: 32px; } .stats { gap: 6px 14px; } }
.card-sub { margin: -2px 0 0; font-family: var(--font-pixel); font-size: 11px; letter-spacing: .04em; color: var(--accent); }
