/* ============================================================
   汉语编程爱好者 —— 暗夜梦幻科技风
   ============================================================ */
:root {
  --bg-0: #0a0e27;
  --bg-1: #1a0b2e;
  --cyan: #00f0ff;
  --violet: #a855f7;
  --gold: #f0c674;
  --text: rgba(235, 240, 255, .92);
  --text-dim: rgba(235, 240, 255, .55);
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(ellipse 120% 90% at 70% -10%, rgba(168, 85, 247, .16), transparent 55%),
    radial-gradient(ellipse 100% 80% at 15% 110%, rgba(0, 240, 255, .10), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1) 60%, #0a0618);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
  min-height: 100vh;
}

::selection { background: rgba(0, 240, 255, .25); }

/* ---------- 背景画布层 ---------- */
#stars, #hero-canvas, #dust {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#stars { z-index: 0; }
#hero-canvas { z-index: 1; opacity: 0; transition: opacity 2s ease; }
#hero-canvas.on { opacity: 1; }
#dust { z-index: 2; }

#glow {
  position: fixed;
  z-index: 3;
  width: 420px;
  height: 420px;
  left: 0; top: 0;
  margin: -210px 0 0 -210px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(0, 240, 255, .10) 0%,
    rgba(168, 85, 247, .07) 35%,
    transparent 70%);
  pointer-events: none;
  mix-blend-mode: screen;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: fixed;
  z-index: 20;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px clamp(20px, 5vw, 64px);
  backdrop-filter: blur(6px);
  background: linear-gradient(180deg, rgba(10, 14, 39, .75), transparent);
}
.logo {
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: .35em;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: text-shadow .3s;
}
.logo:hover { text-shadow: 0 0 16px rgba(0, 240, 255, .5); }
.logo span { color: var(--cyan); margin-left: .2em; }
.topbar nav a {
  color: var(--text-dim);
  text-decoration: none;
  margin-left: 28px;
  font-size: 14px;
  letter-spacing: .2em;
  transition: color .3s;
}
.topbar nav a:hover { color: var(--cyan); }
.topbar .nav-cta {
  border: 1px solid rgba(0, 240, 255, .4);
  border-radius: 999px;
  padding: 6px 18px;
  color: var(--cyan);
  transition: all .3s;
}
.topbar .nav-cta:hover {
  background: rgba(0, 240, 255, .12);
  box-shadow: 0 0 18px rgba(0, 240, 255, .35);
}

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  z-index: 5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 20px;
}
.slogan {
  font-family: var(--serif);
  font-size: clamp(34px, 7vw, 84px);
  letter-spacing: .28em;
  text-indent: .28em;
  /* 能量进度：底层白色打底，上层绚烂渐变由 JS 按能量 0→1000 拉宽 */
  background-image:
    linear-gradient(90deg, #00ffff, #4dffc3 30%, #c084ff 62%, #ff7ad9 82%, #ffe27a),
    linear-gradient(#ffffff, #ffffff);
  background-repeat: no-repeat, no-repeat;
  background-size: 0% 100%, 100% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 0 30px rgba(0, 240, 255, .45),
    0 0 80px rgba(168, 85, 247, .35);
  min-height: 1.4em;
  white-space: nowrap;
}

/* 鼠标充能 +1 漂浮字 */
.plus-one {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 240, 255, .9);
  animation: plus-rise 1s ease-out forwards;
}
@keyframes plus-rise {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-46px); }
}

/* 终局鼓励语字幕（解密特效） */
.praise-cap {
  position: fixed;
  z-index: 6;
  left: 0; right: 0;
  top: 80%;
  text-align: center;
  font-family: var(--serif);
  font-size: clamp(16px, 2.2vw, 24px);
  letter-spacing: .3em;
  text-indent: .3em;
  color: rgba(235, 240, 255, .9);
  text-shadow: 0 0 18px rgba(0, 240, 255, .5), 0 0 40px rgba(168, 85, 247, .35);
  pointer-events: none;
}
.sub {
  margin-top: 26px;
  font-size: clamp(13px, 1.6vw, 17px);
  letter-spacing: .5em;
  text-indent: .5em;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 2s ease 1.2s;
}
.sub.on { opacity: 1; }

.scroll-hint {
  position: absolute;
  bottom: 42px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 44px;
  border: 1px solid rgba(235, 240, 255, .35);
  border-radius: 14px;
  display: flex;
  justify-content: center;
}
.scroll-hint span {
  width: 3px; height: 9px;
  border-radius: 2px;
  background: var(--cyan);
  margin-top: 8px;
  animation: drop 1.8s ease-in-out infinite;
}
@keyframes drop {
  0%   { transform: translateY(0);    opacity: 1; }
  70%  { transform: translateY(16px); opacity: 0; }
  100% { transform: translateY(0);    opacity: 0; }
}

/* ---------- 通用区块 ---------- */
.section {
  position: relative;
  z-index: 5;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(90px, 14vh, 150px) clamp(20px, 5vw, 40px);
}
section[id] { scroll-margin-top: 76px; }
.section-title {
  font-family: var(--serif);
  font-size: clamp(26px, 4vw, 40px);
  letter-spacing: .3em;
  margin-bottom: 56px;
  color: var(--text);
  position: relative;
  padding-bottom: 18px;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 64px; height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  box-shadow: 0 0 12px rgba(0, 240, 255, .6);
}

/* ---------- 关于 ---------- */
.about-text p {
  font-size: clamp(15px, 1.8vw, 18px);
  line-height: 2.2;
  color: var(--text-dim);
  margin-bottom: 1.4em;
  max-width: 46em;
}
.about-text p:first-child {
  color: var(--text);
  font-size: clamp(18px, 2.4vw, 24px);
  font-family: var(--serif);
  letter-spacing: .1em;
}

/* ---------- 特性卡片 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 26px;
  perspective: 1200px;
}
.card {
  position: relative;
  padding: 36px 28px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  border: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px);
  transform-style: preserve-3d;
  transition: border-color .4s, box-shadow .4s;
  will-change: transform;
  overflow: hidden;
}
.card::after {           /* 光泽扫过 */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, .10), transparent 45%);
  opacity: 0;
  transition: opacity .4s;
  pointer-events: none;
}
.card:hover { border-color: rgba(0, 240, 255, .45); box-shadow: 0 0 30px rgba(0, 240, 255, .15), 0 18px 40px rgba(0,0,0,.35); }
.card:hover::after { opacity: 1; }
.card-icon {
  font-family: var(--serif);
  font-size: 34px;
  width: 64px; height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--cyan);
  border: 1px solid rgba(0, 240, 255, .35);
  text-shadow: 0 0 14px rgba(0, 240, 255, .8);
  margin-bottom: 22px;
  background: rgba(0, 240, 255, .05);
}
.card:nth-child(2) .card-icon { color: var(--violet); border-color: rgba(168, 85, 247, .4); text-shadow: 0 0 14px rgba(168, 85, 247, .8); background: rgba(168, 85, 247, .05); }
.card:nth-child(4) .card-icon { color: var(--gold); border-color: rgba(240, 198, 116, .4); text-shadow: 0 0 14px rgba(240, 198, 116, .8); background: rgba(240, 198, 116, .05); }
.card h3 {
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: .18em;
  margin-bottom: 14px;
}
.card p {
  font-size: 14px;
  line-height: 2;
  color: var(--text-dim);
}

/* ---------- 终端 ---------- */
.terminal {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(6, 8, 24, .85);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 0 40px rgba(168, 85, 247, .08);
  margin-bottom: 44px;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, .04);
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.terminal-bar i {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
}
.terminal-bar i:nth-child(1) { background: #ff5f57; }
.terminal-bar i:nth-child(2) { background: #febc2e; }
.terminal-bar i:nth-child(3) { background: #28c840; }
.terminal-bar span {
  margin-left: 10px;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: .15em;
}
.terminal-body {
  padding: 24px 26px 30px;
  font-family: var(--mono);
  font-size: clamp(12px, 1.5vw, 14.5px);
  line-height: 2;
  color: #b7f5ff;
  min-height: 300px;
  white-space: pre-wrap;
  word-break: break-all;
}
.terminal-body .kw  { color: var(--violet); }
.terminal-body .str { color: var(--gold); }
.terminal-body .fn  { color: var(--cyan); }
.terminal-body .cm  { color: rgba(235,240,255,.35); }
.cursor {
  display: inline-block;
  width: .6em; height: 1.1em;
  background: var(--cyan);
  vertical-align: -0.15em;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 进入代码展示厅（唯一站内链接） ---------- */
.enter-card {
  display: block;
  position: relative;
  border-radius: 18px;
  text-decoration: none;
  padding: 1px;                      /* 边框流光用 */
  background: linear-gradient(120deg, rgba(0,240,255,.5), rgba(168,85,247,.5), rgba(240,198,116,.5));
  background-size: 300% 300%;
  animation: flow 8s ease infinite;
  transition: transform .4s;
}
.enter-card:hover { transform: translateY(-4px); }
@keyframes flow {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.enter-inner {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 34px 40px;
  border-radius: 17px;
  background: rgba(10, 12, 34, .92);
  backdrop-filter: blur(8px);
}
.enter-label {
  font-size: 12px;
  letter-spacing: .4em;
  color: var(--text-dim);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 5px 14px 5px 18px;
}
.enter-title {
  font-family: var(--serif);
  font-size: clamp(20px, 3vw, 28px);
  letter-spacing: .22em;
  color: var(--text);
  flex: 1;
  text-shadow: 0 0 20px rgba(0, 240, 255, .3);
}
.enter-arrow {
  font-size: 26px;
  color: var(--cyan);
  transition: transform .35s;
}
.enter-card:hover .enter-arrow { transform: translateX(10px); }

/* ---------- AI时代（整屏） ---------- */
.ai-era {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ai-lead p {
  font-family: var(--serif);
  font-size: clamp(18px, 2.6vw, 27px);
  line-height: 2.1;
  letter-spacing: .12em;
  color: var(--text);
}
.ai-lead-em {
  margin-top: 14px;
  color: var(--cyan) !important;
  text-shadow: 0 0 18px rgba(0, 240, 255, .45);
}
.ai-points {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 26px;
  margin: 46px 0 60px;
}
.ai-point {
  position: relative;
  padding: 30px 28px 30px 32px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  border: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.ai-point::before {        /* 左侧流光竖线 */
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--violet), var(--gold));
  box-shadow: 0 0 14px rgba(0, 240, 255, .55);
}
.ai-k {
  display: block;
  font-family: var(--serif);
  font-size: clamp(18px, 2.2vw, 23px);
  letter-spacing: .2em;
  color: var(--text);
  margin-bottom: 14px;
  text-shadow: 0 0 16px rgba(168, 85, 247, .35);
}
.ai-point p {
  font-size: 14.5px;
  line-height: 2.1;
  color: var(--text-dim);
}
.ai-quote {
  font-family: var(--serif);
  font-size: clamp(26px, 4.6vw, 46px);
  letter-spacing: .18em;
  text-align: center;
  line-height: 1.8;
  background: linear-gradient(90deg, #00ffff, #c084ff 55%, #ffe27a);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 22px rgba(0, 240, 255, .30));
}

/* ---------- 页脚 ---------- */
.footer {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: 70px 20px 46px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  background: rgba(6, 8, 22, .5);
}
.footer-name {
  font-family: var(--serif);
  letter-spacing: .35em;
  margin-bottom: 14px;
}
.footer-copy {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: .12em;
  margin-bottom: 10px;
}
.beian {
  font-size: 12px;
  color: rgba(235, 240, 255, .38);
  text-decoration: none;
  letter-spacing: .08em;
}
.beian:hover { color: var(--cyan); }

/* ---------- 滚动显现 ---------- */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  filter: blur(6px);
  transition: opacity 1s ease, transform 1s ease, filter 1s ease;
}
.reveal.visible { opacity: 1; transform: none; filter: none; }

/* ---------- 背景音乐开关 ---------- */
.music-toggle {
  position: fixed;
  z-index: 30;
  right: 26px;
  bottom: 26px;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(0, 240, 255, .4);
  background: rgba(10, 14, 39, .7);
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding-bottom: 15px;
  transition: box-shadow .3s, border-color .3s;
}
.music-toggle:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 22px rgba(0, 240, 255, .35);
}
.music-toggle i {
  width: 3px;
  height: 6px;
  border-radius: 2px;
  background: rgba(235, 240, 255, .35);
  transition: background .3s;
}
.music-toggle.playing i {
  background: var(--cyan);
  animation: eq 0.9s ease-in-out infinite;
}
.music-toggle.playing i:nth-child(1) { animation-delay: 0s; }
.music-toggle.playing i:nth-child(2) { animation-delay: .25s; }
.music-toggle.playing i:nth-child(3) { animation-delay: .5s; }
.music-toggle.playing i:nth-child(4) { animation-delay: .12s; }
@keyframes eq {
  0%, 100% { height: 6px; }
  50% { height: 20px; }
}

/* ---------- 飞船控制台（左下角） ---------- */
.ship-ctl {
  position: fixed;
  z-index: 30;
  left: 22px;
  bottom: 22px;
  padding: 14px 16px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(10, 14, 39, .72);
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .4);
  user-select: none;
  /* 初始隐藏：鼠标充能到 1000 后解锁浮现 */
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity .9s ease, transform .9s ease;
}
.ship-ctl.unlocked {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}
.ctl-title {
  font-size: 11px;
  letter-spacing: .35em;
  color: var(--text-dim);
  margin-bottom: 10px;
  text-align: center;
}
.ctl-grid {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  gap: 6px;
  justify-content: center;
  margin-bottom: 8px;
}
.ctl-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 8px;
}
.ship-ctl button:not(.ctl-prog) {
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(0, 240, 255, .3);
  background: rgba(0, 240, 255, .06);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ship-ctl button:hover {
  background: rgba(0, 240, 255, .16);
  box-shadow: 0 0 14px rgba(0, 240, 255, .3);
}
.ship-ctl button:active { transform: scale(.92); }
.ship-ctl .ctl-del { color: #ff8f8f; border-color: rgba(255, 120, 120, .35); background: rgba(255, 120, 120, .06); }
.ship-ctl .ctl-del:hover { background: rgba(255, 120, 120, .14); box-shadow: 0 0 14px rgba(255, 120, 120, .3); }

/* 程序显示屏（第二排）：宽度随指令长度自适应，无括号 */
.ship-ctl .ctl-prog {
  display: block;
  width: fit-content;
  min-width: 44px;
  margin: 0 auto 8px;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(168, 85, 247, .4);
  background: rgba(168, 85, 247, .07);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: .25em;
  color: var(--text);
  padding: 6px 14px;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}
.ship-ctl .ctl-prog:hover { background: rgba(168, 85, 247, .14); box-shadow: 0 0 16px rgba(168, 85, 247, .35); }
.ship-ctl .ctl-prog .cur {
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, .9);
}
.ship-ctl.running .ctl-prog {
  border-color: rgba(0, 240, 255, .6);
  box-shadow: 0 0 18px rgba(0, 240, 255, .3);
  animation: prog-breathe 1.3s ease-in-out infinite;
}

/* 第三排：探索收集进度（五颗五角星） */
.ctl-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 19px;
  line-height: 1;
  color: rgba(235, 240, 255, .22);
}
.ctl-stars span { transition: color .4s, text-shadow .4s, transform .4s; }
.ctl-stars span.lit {
  text-shadow: 0 0 12px currentColor, 0 0 26px currentColor;
  transform: scale(1.12);
}
@keyframes prog-breathe {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 240, 255, .2); }
  50% { box-shadow: 0 0 22px rgba(0, 240, 255, .45); }
}
.ctl-readout {
  font-family: var(--mono);
  font-size: 10.5px;
  color: rgba(0, 240, 255, .75);
  text-align: center;
  letter-spacing: .05em;
  margin-bottom: 6px;
  min-height: 14px;
}
.ctl-hint {
  font-size: 10px;
  color: rgba(235, 240, 255, .35);
  text-align: center;
  letter-spacing: .08em;
}

/* ---------- 辅助 ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .topbar { padding: 14px 16px; }
  .logo { font-size: 15px; letter-spacing: .15em; }
  .topbar nav a {
    margin-left: 14px;
    font-size: 12px;
    letter-spacing: .06em;
    white-space: nowrap;
  }
  .topbar .nav-cta { padding: 4px 12px; }
  .slogan { letter-spacing: .18em; text-indent: .18em; }
  .terminal-body { min-height: 340px; }
  .enter-inner { padding: 26px 22px; gap: 14px; flex-wrap: wrap; }
}
@media (max-width: 400px) {
  .logo span { display: none; }
  .topbar nav a { margin-left: 10px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .2s !important; }
}
