/* ============ 基础 ============ */
:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel2: #1c2330;
  --line: #2d333b;
  --text: #e6edf3;
  --muted: #8b949e;
  --green: #3fb950;
  --red: #f85149;
  --amber: #e3b341;
  --blue: #58a6ff;
  --cream: #f7e6cf;
  --ink: #3b2a1e;
  --coffee: #c08552;
  --mono: "JetBrains Mono", "Cascadia Code", "Fira Code", Consolas, "Courier New", monospace;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.lock { overflow: hidden; }
code {
  font-family: var(--mono);
  font-size: .9em;
  background: rgba(127, 127, 127, .16);
  padding: .05em .35em;
  border-radius: 4px;
}
button { font: inherit; color: inherit; cursor: pointer; }

.btn {
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  padding: .55em 1.1em;
  border-radius: 10px;
  transition: transform .15s, background .2s, border-color .2s;
}
.btn:hover { transform: translateY(-1px); border-color: #4b535d; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #d39260, #a96a3e); border-color: #c08552; color: #fff; font-weight: 700; }
.btn.primary:hover { border-color: #f0b07f; }
.btn.danger { border-color: rgba(248, 81, 73, .5); color: #ffaaa4; }
.btn.danger:hover { background: rgba(248, 81, 73, .15); }
.btn.ghost { background: transparent; }
.btn.big { font-size: clamp(16px, 1.6vw, 20px); padding: .8em 1.8em; border-radius: 14px; }

/* ============ HUD ============ */
.hud {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 20;
  display: flex;
  gap: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(13, 17, 23, .78);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .4s, transform .4s;
  pointer-events: none;
}
.hud.show { opacity: 1; transform: none; }
.hud b { color: var(--text); }

/* ============ 开场 ============ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 10vh 6vw;
  overflow: hidden;
  background: linear-gradient(180deg, #fff6e8 0%, var(--cream) 100%);
  color: var(--ink);
}
.sun {
  position: absolute;
  width: 70vmin;
  height: 70vmin;
  top: -22vmin;
  right: -18vmin;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd89a 0%, rgba(255, 216, 154, 0) 70%);
  animation: float 9s ease-in-out infinite;
  pointer-events: none;
}
.hero-clock {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: .3em;
  color: #a8825d;
}
.hero-title {
  position: relative;
  margin: .45em 0 .35em;
  min-height: 1.3em;
  font-size: clamp(28px, 5.4vw, 68px);
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1.25;
}
.caret {
  display: inline-block;
  width: .07em;
  height: .95em;
  margin-left: .08em;
  vertical-align: -.08em;
  background: currentColor;
  animation: blink 1s steps(1) infinite;
}
.hero-sub {
  margin: 0 0 3em;
  font-size: clamp(15px, 1.6vw, 19px);
  color: #8a6a4f;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 1s, transform 1s;
}
.hero-sub.show { opacity: 1; transform: none; }
.scroll-hint {
  display: inline-block;
  padding: .6em 1.5em;
  border: 1.5px solid rgba(59, 42, 30, .35);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  animation: bob 2.2s ease-in-out infinite;
}
.scroll-hint:hover { background: rgba(59, 42, 30, .06); }
.link-btn {
  margin-top: 1.4em;
  border: 0;
  background: none;
  font-size: 13px;
  color: #a8825d;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============ 工位 ============ */
.desk {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 6vw;
  padding: 12vh 8vw;
  background: var(--cream);
  color: var(--ink);
}
.desk-text p {
  margin: .15em 0;
  font-size: clamp(20px, 2.4vw, 32px);
  font-weight: 700;
}
.desk-text p.muted {
  margin-top: 1em;
  font-size: clamp(15px, 1.4vw, 18px);
  font-weight: 400;
  color: #8a6a4f;
}
.desk-text p.muted + p.muted { margin-top: .2em; }

.fade { opacity: 0; transform: translateY(18px); transition: opacity .9s, transform .9s; }
.fade.in { opacity: 1; transform: none; }
.desk-text .fade:nth-child(2) { transition-delay: .3s; }
.desk-text .fade:nth-child(3) { transition-delay: .7s; }
.desk-text .fade:nth-child(4) { transition-delay: 1.1s; }

.desk-art { position: relative; justify-self: center; padding-right: 70px; }
.monitor { width: min(420px, 72vw); }
.screen {
  padding: 12px 14px 14px;
  background: #0f1720;
  border: 10px solid #2b2b2b;
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 13px;
  color: #cfe3da;
  box-shadow: 0 24px 48px rgba(59, 42, 30, .25);
}
.screen-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 11px; color: #6c7a89; }
.screen-bar span { width: 8px; height: 8px; border-radius: 50%; background: #3a4552; }
.status-list { list-style: none; margin: 0; padding: 0; }
.status-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px dashed #1f2a36; }
.status-list i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-list em { margin-left: auto; font-style: normal; color: var(--green); }
.status-list small { color: var(--amber); font-size: 10px; opacity: .8; }
.all-good { margin-top: 10px; text-align: center; color: var(--green); }
.stand {
  width: 90px;
  height: 42px;
  margin: 0 auto;
  background: linear-gradient(#3a3a3a, #262626);
  clip-path: polygon(38% 0, 62% 0, 82% 100%, 18% 100%);
}
.cup { position: absolute; right: 0; bottom: 0; width: 120px; }
.steam path {
  fill: none;
  stroke: #b9a48e;
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0;
  animation: steam 3.2s ease-in-out infinite;
}
.steam path:nth-child(2) { animation-delay: 1.05s; }
.steam path:nth-child(3) { animation-delay: 2.1s; }

/* ============ 转场 ============ */
.dusk {
  min-height: 115vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 1.2em;
  padding: 0 6vw 18vh;
  text-align: center;
  background: linear-gradient(180deg, var(--cream) 0%, #c9ab8a 22%, #3a3330 52%, var(--bg) 78%);
}
.dusk p { margin: 0; font-size: clamp(18px, 2vw, 24px); color: #cdd5df; }
.mail {
  width: min(560px, 90vw);
  padding: 14px 18px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .4);
}
.mail-from { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.mail-subject { margin-top: 4px; font-size: 16px; }
.badge {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 .45em;
  margin-left: .3em;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  animation: pulse 1.2s ease-in-out infinite;
}

/* ============ 架构：滚动叙事 ============ */
.story { position: relative; padding: 0 4vw; }
.story-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 4vw;
  max-width: 1400px;
  margin: 0 auto;
}
.steps { padding: 20vh 0 45vh; }
.step {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: .22;
  transition: opacity .5s;
}
.step.active { opacity: 1; }
.step .line { margin: 0 0 .6em; font-size: clamp(20px, 2.2vw, 30px); font-weight: 700; line-height: 1.45; }
.step .aside {
  margin: 0;
  padding-left: 14px;
  border-left: 3px solid var(--line);
  font-size: 16px;
  color: var(--muted);
}
.step.active .aside { border-left-color: var(--amber); }
.step .aside.big { font-size: clamp(22px, 2.4vw, 32px); font-weight: 800; color: var(--red); border-left-color: var(--red); }
.hl { color: var(--amber); }

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: start;
  display: flex;
  align-items: center;
}
.arch {
  position: relative;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 16px 18px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  font-size: 13px;
  scrollbar-width: thin;
}
.arch-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.arch-name i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--green); vertical-align: 1px; transition: background .5s; }
.arch.lit .arch-name i { background: var(--red); animation: blink .8s steps(1) infinite; }
.arch-count b { font-size: 22px; color: var(--red); display: inline-block; }
.arch-count.bump b { animation: bump .45s; }
.arch-count em { font-style: normal; color: var(--amber); }

.a-node {
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--panel2);
  opacity: .3;
  filter: grayscale(1);
  transition: opacity .5s, filter .5s, border-color .5s, box-shadow .5s, background .5s;
}
.a-node.on {
  opacity: 1;
  filter: none;
  border-style: solid;
  border-color: rgba(248, 81, 73, .55);
  box-shadow: 0 0 0 1px rgba(248, 81, 73, .12), 0 0 26px rgba(248, 81, 73, .12);
}
.a-node.just { animation: pop-node .7s; }
.a-internet { text-align: center; width: max-content; margin: 0 auto; padding: 6px 16px; }
.a-internet.on { border-color: var(--line); box-shadow: none; }
.a-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-weight: 700; }
.a-title small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.a-wire { position: relative; width: 2px; height: 16px; margin: 0 auto; background: var(--line); }
.a-wire::after {
  content: "";
  position: absolute;
  left: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  animation: flow 1.4s linear infinite;
}
.a-bus {
  position: relative;
  height: 14px;
  margin: 12px 16.6% 0;
  border: 2px solid var(--line);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
}
.a-bus::before { content: ""; position: absolute; left: 50%; top: -14px; width: 2px; height: 12px; background: var(--line); }
.a-services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.a-services .span2 { grid-column: span 2; }
.a-kernel { margin-top: 10px; }
.a-kernel.on { background: repeating-linear-gradient(45deg, rgba(248, 81, 73, .12) 0 10px, rgba(248, 81, 73, .04) 10px 20px); }
.a-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.certline { margin-top: 6px; font-size: 12px; color: var(--muted); }
.certline b { color: var(--text); }
.certline i { margin: 0 6px; font-style: normal; color: var(--amber); }
.stores { margin-top: 4px; font-size: 12px; color: var(--muted); }
.stores > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 3px; }
.stores .chips { margin-top: 0; }
.a-ci { margin-top: 10px; }
.a-ci.on { border-color: rgba(63, 185, 80, .6); box-shadow: 0 0 26px rgba(63, 185, 80, .14); }
.pipe { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-family: var(--mono); font-size: 12px; }
.pipe span { padding: 1px 8px; border-radius: 6px; background: #0d1117; border: 1px solid var(--line); transition: all .5s; }
.pipe i { font-style: normal; color: var(--muted); }
.pipe .ok { color: var(--green); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chip {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  border: 1px solid rgba(248, 81, 73, .45);
  background: rgba(248, 81, 73, .14);
  color: #ffa39c;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.7;
  text-decoration: none;
  white-space: nowrap;
  opacity: 0;
  transform: scale(2.2) rotate(-10deg);
}
.a-node.on .chip { animation: stamp .38s cubic-bezier(.2, 1.6, .4, 1) forwards; animation-delay: var(--d, 0ms); }
.chip:hover { background: rgba(248, 81, 73, .3); }
.chip.poison { display: none; background: var(--red); color: #fff; border-color: var(--red); font-weight: 700; }

/* 同一个 CVE 在 Go 和 Rust 里撞号 */
.arch.twins .a-node.on .chip.twin {
  opacity: 1;
  transform: none;
  animation: twin 1s ease-in-out infinite;
}

/* 投毒揭晓 */
.arch.poisoned { border-color: rgba(248, 81, 73, .6); animation: alarm 1.6s ease-in-out infinite; }
.arch.poisoned .chip.poison { display: inline-block; }
.arch.poisoned .a-ai { background: rgba(248, 81, 73, .14); border-color: var(--red); }
.arch.poisoned .a-ci { border-color: var(--red); box-shadow: 0 0 30px rgba(248, 81, 73, .3); }
.arch.poisoned .pipe .pkg { background: var(--red); border-color: var(--red); color: #fff; }
.arch.poisoned .pipe .ok { color: var(--muted); text-decoration: line-through; }

/* ============ 揭晓 ============ */
.reveal {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 12vh 6vw;
  overflow: hidden;
  text-align: center;
}
.reveal::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(248, 81, 73, .28), transparent 65%);
  opacity: 0;
  pointer-events: none;
}
.reveal.in::before { animation: redflash 2.4s ease-out forwards; }
.reveal > * { position: relative; }
.reveal .pre { margin: 0; font-size: clamp(22px, 3vw, 36px); color: var(--muted); }
.glitch {
  position: relative;
  display: inline-block;
  margin: .1em 0 .3em;
  font-size: clamp(34px, 7vw, 96px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: .02em;
  color: #fff;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: .85;
  mix-blend-mode: screen;
  pointer-events: none;
}
.glitch::before { color: #ff3b3b; animation: gl1 2.3s infinite linear alternate-reverse; }
.glitch::after { color: #33e1ff; animation: gl2 3.1s infinite linear alternate-reverse; }
.org { margin: 0 0 2em; font-family: var(--mono); font-size: clamp(12px, 1.2vw, 14px); color: var(--muted); }
.tally {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 820px;
  margin: 0 0 2.6em;
  padding: 0;
}
.tally li {
  padding: .5em 1em;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--muted);
  opacity: 0;
  transform: translateY(10px) scale(.96);
  transition: opacity .5s, transform .5s;
}
.tally li b { margin-right: .3em; font-size: 1.35em; color: var(--red); font-family: var(--mono); }
.tally li:last-child b { color: var(--coffee); }
.reveal.in .tally li { opacity: 1; transform: none; }
.reveal.in .tally li:nth-child(1) { transition-delay: .6s; }
.reveal.in .tally li:nth-child(2) { transition-delay: .8s; }
.reveal.in .tally li:nth-child(3) { transition-delay: 1s; }
.reveal.in .tally li:nth-child(4) { transition-delay: 1.2s; }
.reveal.in .tally li:nth-child(5) { transition-delay: 1.4s; }
.reveal.in .tally li:nth-child(6) { transition-delay: 1.6s; }
.reveal .hint { margin-top: 1em; font-size: 13px; color: var(--muted); }

/* ============ 页脚 ============ */
.foot {
  max-width: 860px;
  margin: 0 auto;
  padding: 6vh 6vw 10vh;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.foot details { margin-bottom: 1.5em; text-align: left; }
.foot summary { cursor: pointer; text-align: center; color: var(--text); }
.foot blockquote {
  margin: 1em 0 0;
  padding: 1em 1.2em;
  border-left: 3px solid var(--amber);
  background: var(--panel);
  border-radius: 0 10px 10px 0;
  font-size: 13px;
  line-height: 1.8;
  word-break: break-all;
}
.foot blockquote p { margin: .4em 0; }
.foot > p { margin: .4em 0; }

/* ============ 值班小游戏 ============ */
.game {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: radial-gradient(ellipse at top, #141b26, var(--bg) 60%);
}
.game.outage::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 140px rgba(248, 81, 73, .55);
  animation: outage 1.2s ease-in-out infinite;
}
.game.shake { animation: shake .42s; }

.g-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.g-stat { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.g-clock { font-family: var(--mono); font-size: 22px; }
.g-num b { font-family: var(--mono); font-size: 16px; color: var(--red); }
.g-label { font-size: 12px; color: var(--muted); }
.g-label b { color: var(--text); font-family: var(--mono); }
.bar { width: 110px; height: 6px; margin-top: 3px; border-radius: 3px; background: rgba(0, 0, 0, .45); overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; background: var(--green); transition: width .3s, background .4s; }
.cup-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
  font-size: 20px;
  line-height: 1;
  transition: transform .15s;
}
.cup-btn:hover { transform: rotate(-12deg) scale(1.08); }
.g-speed {
  margin-left: auto;
  padding: .35em .9em;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  font-family: var(--mono);
  font-size: 13px;
}

.g-svc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 12px;
}
.svc { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); }
.svc i { width: 8px; height: 8px; border-radius: 50%; }
.svc.ok i { background: var(--green); box-shadow: 0 0 6px var(--green); }
.svc.vuln i { background: var(--amber); }
.svc.pwned { border-color: rgba(248, 81, 73, .6); color: #ffa39c; }
.svc.pwned i { background: var(--red); animation: blink .6s steps(1) infinite; }
.svc.down { color: var(--muted); text-decoration: line-through; }
.svc.down i { background: #555; }
.svc.work { border-color: rgba(88, 166, 255, .5); }
.svc.work i { background: var(--blue); animation: pulse .8s ease-in-out infinite; }

.g-main { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); min-height: 0; }
.g-main h3 { margin: 0 0 10px; font-size: 15px; }
.g-main h3 small { margin-left: 6px; font-weight: 400; font-size: 12px; color: var(--muted); }
.g-tasks { padding: 14px 16px; overflow: auto; }
.task-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.task {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .3s, opacity .3s, box-shadow .3s;
}
.task.sev-P0 { border-color: rgba(248, 81, 73, .5); }
.task.new { animation: slide-in .5s ease-out; }
.task.busy { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue) inset, 0 0 24px rgba(88, 166, 255, .15); }
.task.done { opacity: .5; border-color: rgba(63, 185, 80, .4); box-shadow: none; }
.t-head { display: flex; align-items: flex-start; gap: 8px; }
.t-title { font-weight: 700; font-size: 14px; line-height: 1.4; }
.sev { flex: none; margin-top: 1px; padding: 0 6px; border-radius: 4px; font-family: var(--mono); font-size: 11px; font-weight: 700; }
.sev-P0 .sev { background: var(--red); color: #fff; }
.sev-P1 .sev { background: var(--amber); color: #111; }
.sev-P2 .sev { background: #3a4452; color: var(--text); }
.t-desc { flex: 1; margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.t-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11.5px; color: var(--muted); }
.tag { padding: 0 6px; border-radius: 4px; background: rgba(248, 81, 73, .12); color: #ffa39c; }
.t-progress { height: 4px; border-radius: 2px; background: rgba(0, 0, 0, .45); overflow: hidden; }
.t-progress i { display: block; width: 0; height: 100%; background: var(--blue); transition: width .25s linear; }
.task.done .t-progress i { background: var(--green); }
.t-btn {
  padding: .45em;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  font-size: 13px;
  transition: background .2s, border-color .2s;
}
.t-btn:hover { border-color: var(--blue); }
.t-btn.off { opacity: .45; cursor: not-allowed; }
.task.busy .t-btn { border-color: var(--blue); color: var(--blue); opacity: 1; }
.task.done .t-btn { border-color: transparent; background: transparent; color: var(--green); cursor: default; }

.g-chat { display: flex; flex-direction: column; min-height: 0; padding: 14px 0 0; border-left: 1px solid var(--line); background: rgba(0, 0, 0, .25); }
.g-chat h3 { padding: 0 14px; }
.chat { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 0 14px 14px; overflow: auto; scrollbar-width: thin; }
.msg { display: flex; gap: 8px; animation: pop .3s ease-out; }
.msg .av { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--panel2); font-size: 16px; }
.msg .bd { min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; background: var(--panel); font-size: 13.5px; line-height: 1.55; word-break: break-word; }
.msg .meta { display: flex; gap: 8px; font-size: 11px; color: var(--muted); }
.msg .who { font-weight: 700; }
.msg.boss .who { color: var(--amber); }
.msg.mon .bd { border-color: rgba(248, 81, 73, .55); background: rgba(248, 81, 73, .08); }
.msg.bill .bd { border-color: rgba(227, 179, 65, .5); background: rgba(227, 179, 65, .07); }
.msg.sys .bd { background: transparent; border-style: dashed; color: var(--muted); }
.msg.me { flex-direction: row-reverse; }
.msg.me .bd { border-color: #2b5486; border-radius: 12px 4px 12px 12px; background: #1d3554; }
.msg.me .meta { justify-content: flex-end; }

.g-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.g-doing { min-width: 0; font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-doing::before { content: "$ "; color: var(--green); }
.g-actions { display: flex; flex: none; gap: 8px; }
.g-actions .btn { font-size: 13px; padding: .45em .9em; }

/* ============ 结局 ============ */
.ending {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 4vh 4vw;
  overflow: auto;
  background: rgba(5, 8, 12, .82);
  backdrop-filter: blur(6px);
  animation: fade-in .4s;
}
.e-card {
  width: min(720px, 100%);
  padding: 32px 30px 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .6);
  text-align: center;
  animation: rise .5s cubic-bezier(.2, 1.2, .4, 1);
}
.e-icon { font-size: 56px; line-height: 1; }
.e-kicker { margin: 12px 0 0; font-size: 12px; letter-spacing: .4em; color: var(--muted); }
.e-title { margin: .1em 0 .4em; font-size: clamp(26px, 4vw, 38px); }
.e-text { margin: 0 auto; max-width: 560px; color: #c9d1d9; }
.e-extra { margin-top: 10px; font-size: 13px; color: var(--amber); }
.e-extra p { margin: .3em 0; }
.e-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 22px 0 6px; text-align: left; }
.e-stats div { padding: 8px 10px; border-radius: 10px; background: var(--panel2); font-size: 12px; color: var(--muted); }
.e-stats b { display: block; font-family: var(--mono); font-size: 15px; color: var(--text); white-space: nowrap; }
.e-card h4 { margin: 18px 0 8px; font-size: 13px; color: var(--muted); font-weight: 400; letter-spacing: .2em; }
.e-ach { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.ach { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); opacity: .45; }
.ach.got { opacity: 1; color: var(--text); border-color: var(--coffee); background: rgba(192, 133, 82, .14); }
.e-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }

/* ============ 弹窗 / 提示 ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 8, 12, .7);
  animation: fade-in .25s;
}
.m-card {
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  text-align: center;
  animation: rise .35s cubic-bezier(.2, 1.2, .4, 1);
}
.m-card h3 { margin: 0 0 .5em; font-size: 22px; }
.m-card p { margin: 0 0 1.4em; color: #c9d1d9; }
.m-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  z-index: 80;
  padding: .6em 1.2em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #222b36;
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.tip {
  position: fixed;
  z-index: 90;
  padding: 4px 10px;
  border-radius: 6px;
  background: #000;
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -100%);
  transition: opacity .15s;
  pointer-events: none;
}
.tip.show { opacity: 1; }

/* ============ 动画 ============ */
@keyframes blink { 50% { opacity: 0; } }
@keyframes float { 50% { transform: translate(-2vmin, 2vmin); } }
@keyframes bob { 50% { transform: translateY(6px); } }
@keyframes steam {
  0% { opacity: 0; transform: translateY(8px); }
  30% { opacity: .85; }
  100% { opacity: 0; transform: translateY(-18px); }
}
@keyframes pulse { 50% { transform: scale(1.15); opacity: .7; } }
@keyframes stamp { to { opacity: 1; transform: none; } }
@keyframes twin {
  0%, 100% { background: rgba(227, 179, 65, .2); border-color: var(--amber); color: var(--amber); box-shadow: none; }
  50% { background: var(--amber); border-color: var(--amber); color: #111; box-shadow: 0 0 14px var(--amber); }
}
@keyframes pop-node {
  0% { transform: scale(.96); }
  40% { transform: scale(1.03); }
  100% { transform: none; }
}
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.5); }
  100% { transform: scale(1); }
}
@keyframes flow {
  0% { top: -4px; opacity: 0; }
  50% { opacity: 1; }
  100% { top: 14px; opacity: 0; }
}
@keyframes alarm {
  0%, 100% { box-shadow: 0 30px 80px rgba(0, 0, 0, .45), 0 0 0 rgba(248, 81, 73, 0); }
  50% { box-shadow: 0 30px 80px rgba(0, 0, 0, .45), 0 0 60px rgba(248, 81, 73, .35); }
}
@keyframes redflash {
  0% { opacity: 0; }
  12% { opacity: 1; }
  24% { opacity: .2; }
  36% { opacity: .9; }
  100% { opacity: .35; }
}
@keyframes gl1 {
  0% { clip-path: inset(10% 0 78% 0); transform: translate(-3px, -1px); }
  20% { clip-path: inset(62% 0 12% 0); transform: translate(3px, 1px); }
  40% { clip-path: inset(30% 0 52% 0); transform: translate(-2px, 2px); }
  60% { clip-path: inset(82% 0 4% 0); transform: translate(2px, -2px); }
  80% { clip-path: inset(46% 0 38% 0); transform: translate(-3px, 0); }
  100% { clip-path: inset(4% 0 86% 0); transform: translate(3px, 1px); }
}
@keyframes gl2 {
  0% { clip-path: inset(70% 0 10% 0); transform: translate(3px, 1px); }
  25% { clip-path: inset(15% 0 70% 0); transform: translate(-3px, -1px); }
  50% { clip-path: inset(48% 0 30% 0); transform: translate(2px, 2px); }
  75% { clip-path: inset(88% 0 2% 0); transform: translate(-2px, 0); }
  100% { clip-path: inset(25% 0 60% 0); transform: translate(3px, -1px); }
}
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: translate(-6px, 2px); }
  40% { transform: translate(5px, -2px); }
  60% { transform: translate(-4px, 1px); }
  80% { transform: translate(3px, -1px); }
}
@keyframes outage { 50% { opacity: .35; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
@keyframes slide-in { from { opacity: 0; transform: translateY(-12px) scale(.97); box-shadow: 0 0 0 2px var(--red); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.96); } }

/* ============ 窄屏 ============ */
@media (max-width: 900px) {
  .desk { grid-template-columns: 1fr; padding: 10vh 7vw; }
  .desk-art { padding-right: 56px; }
  .cup { width: 96px; }

  /* 架构图固定在上半屏，文字卡片从下方滑过 */
  .story { padding: 0 3vw; }
  .story-grid { grid-template-columns: 1fr; gap: 0; }
  .stage, .steps { grid-row: 1; grid-column: 1; }
  .stage { z-index: 1; align-items: flex-start; padding-top: 56px; }
  .arch { max-height: 58vh; padding: 12px; font-size: 11.5px; }
  .chip { font-size: 9.5px; padding: 0 4px; }
  .steps { position: relative; z-index: 2; padding: 70vh 0 30vh; }
  .step { min-height: 85vh; justify-content: flex-end; opacity: 0; pointer-events: none; }
  .step-card {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(13, 17, 23, .94);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, .5);
    pointer-events: auto;
  }
  .step-card.danger { border-color: var(--red); }
  .step .line { font-size: 19px; }
  .step .aside { font-size: 14px; }

  .g-top { gap: 8px 14px; padding: 8px 12px; }
  .g-clock { font-size: 18px; }
  .bar { width: 80px; }
  .g-main { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1.3fr) minmax(0, 1fr); }
  .g-chat { border-left: 0; border-top: 1px solid var(--line); padding-top: 10px; }
  .g-bottom { flex-direction: column; align-items: stretch; }
  .g-actions { justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
