/**
 * 卡通明亮主题 — 参考 Skills/StylePresets/JapaneseHealing + CardLayout + GridBackground
 */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-page: #FDF6EC;
  --bg-stage: #FFFBF5;
  --bg-warn: #FFF3E6;
  --bg-bright: #F0FAF4;
  --primary: #6CB4EE;
  --accent: #E8927C;
  --success: #7BC8A4;
  --warn: #FF6B6B;
  --warning: #FFD166;
  --text: #4A4A4A;
  --text-muted: #8C8C8C;
  --card: #FFFFFF;
  --grid: rgba(232, 146, 124, 0.12);
  --card-radius: 16px;
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --stage-ratio: 16 / 9;
  --emoji-font: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body.portrait-mobile {
  background: var(--bg-page);
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 1200px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--card);
  border-bottom: 2px solid #F0E6D8;
}

.header h1 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text);
}

.chapter-label {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  background: #E8F4FD;
  color: var(--primary);
  border: 2px solid #C9E4FF;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ctrl-btn-fs {
  width: 36px;
  height: 36px;
  color: var(--primary);
  border-color: #C9E4FF;
  background: #F8FCFF;
}

.ctrl-btn-fs .ico-ctrl {
  width: 20px;
  height: 20px;
}

.stage-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  min-height: 0;
}

.stage {
  position: relative;
  width: 100%;
  max-height: 100%;
  aspect-ratio: var(--stage-ratio);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--card-shadow), 0 0 0 3px #F0E6D8, 0 12px 40px rgba(232, 146, 124, 0.12);
}

/* 装饰：云朵 + 浮动气泡 */
.deco-cloud {
  position: absolute;
  pointer-events: none;
  opacity: 0.7;
}

.deco-cloud-1 {
  width: 100px; height: 50px;
  top: 8%; left: 4%;
  animation: cloudDrift 18s ease-in-out infinite;
}

.deco-cloud-2 {
  width: 80px; height: 40px;
  top: 12%; right: 6%;
  animation: cloudDrift 22s ease-in-out infinite reverse;
}

.deco-bubble {
  position: absolute;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #F0E6D8;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  pointer-events: none;
  animation: bubbleFloat 4s ease-in-out infinite;
}

.deco-bubble svg {
  width: 22px; height: 22px;
}

.deco-bubble-1 { top: 20%; left: 12%; animation-delay: 0s; }
.deco-bubble-2 { top: 60%; right: 10%; animation-delay: 1.2s; }
.deco-bubble-3 { bottom: 22%; left: 8%; animation-delay: 2.4s; }

/* 浮动装饰 SVG */
.deco-float {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  z-index: 1;
}

.deco-float-1 {
  width: 52px;
  top: 18%;
  right: 14%;
}

.deco-float-2 {
  width: 44px;
  bottom: 28%;
  left: 6%;
}

@keyframes cloudDrift {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(16px); }
}

@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* 章节角标 */
.chapter-tags {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  pointer-events: none;
}

.chapter-tag {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #C9E4FF;
  color: var(--primary);
  box-shadow: 0 2px 10px rgba(108, 180, 238, 0.2);
  opacity: 0;
}


/* GridBackground — 流动网格 */
.bg-layer {
  position: absolute;
  inset: 0;
  transition: background 0.6s ease;
}

.bg-default { background: var(--bg-stage); }
.bg-warn { background: var(--bg-warn); }
.bg-bright { background: var(--bg-bright); }

.grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridFlow 12s linear infinite;
  opacity: 0.8;
}

@keyframes gridFlow {
  from { background-position: 0 0; }
  to { background-position: 40px 40px; }
}

/* CardLayout + CardFadeIn */
.ca-card {
  background: var(--card);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  border: 2px solid #F0E6D8;
  transition: box-shadow 0.3s ease;
}

.topology.ca-card,
.risk-panel.ca-card,
.split-panel.ca-card {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFBF8 100%);
}

.intro-user .char-developer {
  animation: charWiggle 2.5s ease-in-out infinite;
}

@keyframes charWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ColorHighlight */
.highlight-warn {
  color: var(--warn);
  font-weight: 700;
}

/* ===== Scenes ===== */
.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  padding: 16px 24px 68px;
  z-index: 2;
}

.char-img {
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
  transition: filter 0.3s;
}

.char-alive {
  animation: charBreathe 2.2s ease-in-out infinite;
}

.char-evil-pulse {
  animation: evilPulse 1.8s ease-in-out infinite;
}

.char-guard-glow {
  animation: guardGlow 2.4s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(108, 180, 238, 0.45));
}

.agent-flying-active {
  filter: drop-shadow(0 0 10px rgba(255, 107, 107, 0.55)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

@keyframes charBreathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.02); }
}

@keyframes evilPulse {
  0%, 100% { filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08)); }
  50% { filter: drop-shadow(0 0 14px rgba(255, 107, 107, 0.5)); }
}

@keyframes guardGlow {
  0%, 100% { transform: translateY(0); filter: drop-shadow(0 4px 12px rgba(108, 180, 238, 0.35)); }
  50% { transform: translateY(-4px); filter: drop-shadow(0 6px 18px rgba(108, 180, 238, 0.55)); }
}

.char-developer { width: 130px; }
.char-small { width: 70px; }
.char-proxy { width: 85px; }
.char-cloud { width: 90px; }
.char-guard { width: 88px; }
.flow-icon { width: 72px; height: auto; }
.flow-icon-sm { width: 56px; }

/* --- Intro --- */
.scene-intro {
  justify-content: center;
  align-items: center;
  gap: 0;
}

.intro-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 4vw, 28px);
  width: 100%;
  max-width: 92%;
  z-index: 2;
}

.intro-user {
  position: relative;
  flex-shrink: 0;
  z-index: 2;
}

.intro-lurker {
  position: absolute;
  right: -18px;
  top: 8px;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 12px rgba(255, 107, 107, 0.35));
}

.char-lurker {
  width: 72px;
  opacity: 0.55;
  transform: scaleX(-1);
}

.intro-lurker-label {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.5rem;
  font-weight: 800;
  color: #FFF;
  background: rgba(26, 26, 26, 0.75);
  border: 1px solid #FF6B6B;
  white-space: nowrap;
}

/* 诱惑性大广告 — 第一幕视觉焦点 */
.intro-ad-hero {
  position: relative;
  flex: 1;
  max-width: 340px;
  min-width: 200px;
  padding: 16px 18px 14px;
  border-radius: 18px;
  background: linear-gradient(145deg, #FFF8E7 0%, #FFE8CC 35%, #FFD4A8 100%);
  border: 3px solid #FFB347;
  box-shadow:
    0 8px 28px rgba(255, 140, 0, 0.35),
    0 0 0 4px rgba(255, 209, 102, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
  opacity: 0;
  transform: scale(0.85);
}

.ad-shine {
  position: absolute;
  inset: -50%;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.65) 50%, transparent 60%);
  transform: translateX(-120%) rotate(25deg);
  pointer-events: none;
  z-index: 2;
}

.ad-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.ad-spark {
  position: absolute;
  font-size: 0.85rem;
  color: #FFB300;
  opacity: 0;
}

.ad-spark-1 { top: 8px; right: 12px; }
.ad-spark-2 { bottom: 36px; left: 10px; font-size: 0.7rem; }
.ad-spark-3 { top: 40%; right: 6px; color: #FF6B6B; }

.ad-badge-hot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 800;
  color: #FFF;
  background: linear-gradient(90deg, #FF6B6B, #FF8E53);
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
  margin-bottom: 8px;
  animation: adBadgePulse 1.2s ease-in-out infinite;
}

@keyframes adBadgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.ad-headline {
  font-family: var(--font-display);
  font-size: clamp(1rem, 3.2vw, 1.35rem);
  line-height: 1.35;
  color: #4A3728;
  margin-bottom: 8px;
}

.ad-highlight {
  background: linear-gradient(90deg, #FF6B6B, #FFB347);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1.1em;
}

.ad-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.ad-price {
  font-size: clamp(0.82rem, 2.2vw, 1rem);
  font-weight: 900;
  color: #E85555;
}

.ad-price em {
  font-style: normal;
  font-size: 1.35em;
  font-family: var(--font-display);
  color: #FF6B6B;
  text-shadow: 1px 1px 0 #FFF;
}

.ad-token {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.5);
  color: #8B6914;
  border: 1px solid #FFD166;
}

.ad-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
}

.ad-tag {
  font-size: 0.55rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(108, 180, 238, 0.2);
  color: #4A90C8;
  border: 1px solid #C9E4FF;
}

.ad-cta {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  color: #FFF;
  cursor: default;
  background: linear-gradient(90deg, #FF6B6B, #FFB347, #FF6B6B);
  background-size: 200% 100%;
  box-shadow: 0 4px 14px rgba(255, 107, 107, 0.45);
  animation: adCtaShimmer 2s linear infinite;
}

@keyframes adCtaShimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.comic-yummy-head {
  position: absolute;
  top: -34px;
  left: 50%;
  width: 68px;
  height: auto;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
  transform-origin: center bottom;
}

.dollar-eyes {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  opacity: 0;
}

.ico-coin {
  width: 22px;
  height: 22px;
}

/* 通用 SVG 图标尺寸 */
.ico-inline { width: 1.15em; height: 1.15em; vertical-align: -0.15em; margin-right: 2px; }
.ico-inline-sm { width: 16px; height: 16px; flex-shrink: 0; vertical-align: middle; }
.ico-check-item { width: 18px; height: 18px; flex-shrink: 0; }
.ico-ctrl { width: 18px; height: 18px; }
.cmd-arrow-svg, .flow-arrow-svg { width: 28px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.finale-icon { width: 22px; height: 22px; flex-shrink: 0; }

.notification {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  font-size: 0.58rem;
  font-weight: 600;
  border-left: 3px solid var(--warning);
  opacity: 0;
  transform: translateX(16px);
}

.warning-badge-svg {
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
}

.warning-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.explosion svg {
  width: 40px;
  height: 40px;
}

.injection-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.packet-visible {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
}

.swap-real, .swap-fake {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.split-label, .task-ok, .alert-box div {
  display: flex;
  align-items: center;
  gap: 5px;
}

.subtitle-speaker svg {
  width: 16px;
  height: 16px;
}

.defense-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.phone-wrap {
  position: absolute;
  bottom: 20%;
  right: 5%;
  width: 52px;
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

.phone-device {
  width: 100%;
  display: block;
}

.phone-notifs {
  position: absolute;
  top: 28%;
  left: -30%;
  width: 140%;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.notification {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  font-size: 0.58rem;
  font-weight: 600;
  border-left: 3px solid var(--warning);
  opacity: 0;
  transform: translateX(16px);
}

.intro-warning {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 243, 230, 0.92);
  opacity: 0;
  z-index: 5;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.warning-badge-svg {
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
}

.warning-text {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--warn);
}

.warning-sub {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Risks --- 拓扑：你 — 箭头 — 中转站 — 箭头 — 模型 */
.topology {
  display: grid;
  grid-template-columns: 1fr 56px 1fr 56px 1fr;
  align-items: start;
  justify-items: center;
  width: 100%;
  max-width: 620px;
  padding: 14px 12px 10px;
  margin-bottom: 8px;
  gap: 0;
}

.topo-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
}

.topo-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.topo-label-warn {
  color: var(--warn);
}

.topo-proxy {
  transform: scale(0);
  position: relative;
}

.proxy-bubble {
  position: absolute;
  top: -28px;
  right: -36px;
  width: 72px;
  height: auto;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.topo-arrow-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding-top: 28px;
}

.topo-arrow-svg {
  width: 100%;
  height: 24px;
  color: var(--warn);
}

.topo-arrow-svg path.danger {
  stroke: var(--warn);
  animation: arrowPulse 0.4s ease-in-out infinite;
}

@keyframes arrowPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.comic-stars {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 48px;
  height: auto;
  opacity: 0;
  pointer-events: none;
}

.comic-pow {
  position: absolute;
  right: -4px;
  bottom: 4px;
  width: 72px;
  height: auto;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  transform-origin: center center;
}

.speed-lines {
  position: absolute;
  width: 80px;
  height: auto;
  opacity: 0;
  left: 20%;
  top: 10%;
  pointer-events: none;
  z-index: 2;
}

.swoosh-text {
  position: absolute;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--warn);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  text-shadow: 2px 2px 0 #fff;
  white-space: nowrap;
}

.model-name {
  color: var(--primary);
}

.risk-panels {
  position: relative;
  width: 100%;
  max-width: 520px;
  min-height: 200px;
}

.risk-panel {
  position: absolute;
  inset: 0;
  padding: 14px 16px;
  opacity: 0;
  visibility: hidden;
  overflow: visible;
}

.risk-title {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.risk-title-spy .risk-spy-eye {
  width: 18px;
  height: 18px;
  margin-left: auto;
  opacity: 0;
  flex-shrink: 0;
}

.risk-title-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.risk-title-sub {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--warn);
  line-height: 1.35;
}

.risk-num {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  border-radius: 50%;
  background: #FFE8E8;
  color: var(--warn);
  font-size: 0.75rem;
  margin-right: 2px;
  flex-shrink: 0;
}

/* 风险① — 代码窥探终端 */
#risk-1 {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.code-leak-panel {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: 10px;
  border: 2px solid #FFD4D4;
  background: #1E272E;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(255, 107, 107, 0.08);
}

.code-terminal-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: #2D3436;
  border-bottom: 1px solid #636E72;
}

.term-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.term-dot-r { background: #FF6B6B; }
.term-dot-y { background: #FFD166; }
.term-dot-g { background: #7BC8A4; }

.term-label {
  margin-left: 6px;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.52rem;
  color: #636E72;
}

.code-scroll-window {
  position: relative;
  height: 76px;
  overflow: hidden;
}

.code-scroll-track {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px 10px;
  will-change: transform;
}

.code-scroll-track .code-line {
  display: block;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.62rem;
  color: #55EFC4;
  background: rgba(255, 255, 255, 0.06);
  padding: 5px 8px;
  border-radius: 5px;
  border-left: 3px solid #55EFC4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateX(12px);
}

.code-scroll-track .code-sensitive {
  color: #FF7675;
  border-left-color: #FF6B6B;
  background: rgba(255, 107, 107, 0.12);
}

.code-scroll-track .code-leak-tag {
  color: #FFD166;
  border-left-color: #FFD166;
  background: rgba(255, 209, 102, 0.1);
  font-size: 0.58rem;
}

.code-scroll-fade {
  position: absolute;
  left: 0;
  right: 0;
  height: 14px;
  pointer-events: none;
  z-index: 2;
}

.code-scroll-fade-top {
  top: 0;
  background: linear-gradient(to bottom, #1E272E 30%, transparent);
}

.code-scroll-fade-bottom {
  bottom: 0;
  background: linear-gradient(to top, #1E272E 40%, transparent);
}

.code-scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 107, 107, 0.9), transparent);
  box-shadow: 0 0 8px rgba(255, 107, 107, 0.6);
  top: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.code-scroll {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  height: 72px;
}

.code-scroll code {
  display: block;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.65rem;
  color: var(--success);
  background: #F0FAF4;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #D4EDDA;
}

.char-tiny { width: 44px; }
.char-mitm { width: 52px; }

/* 风险② — 中间人篡改 MITM */
#risk-2 {
  overflow: visible;
}

.mitm-attack-panel {
  position: relative;
}

.mitm-topology {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr 58px 1fr 44px;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  padding-bottom: 36px;
}

.mitm-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-muted);
}

.mitm-line {
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
  border-bottom: 2px dashed #C9B8A8;
}

.mitm-line-left { border-color: #7BC8A4; }
.mitm-line-left.mitm-line-danger { border-bottom-color: #FF6B6B; }
.mitm-line-right { border-color: #FF6B6B; }

.mitm-packet {
  position: absolute;
  left: 0;
  top: -22px;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.52rem;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 5px;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mitm-packet-clean {
  background: #F0FAF4;
  color: #2D6A4F;
  border: 1.5px solid #7BC8A4;
}

.mitm-packet-evil {
  background: #FFF0F0;
  color: #C0392B;
  border: 1.5px solid #FF6B6B;
  opacity: 0;
  left: auto;
  right: 0;
}

.mitm-hacker-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 2;
}

.mitm-hacker-glow {
  position: absolute;
  inset: -8px -6px;
  border-radius: 12px;
  background: radial-gradient(circle, rgba(255, 107, 107, 0.45) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}

.mitm-label {
  font-size: 0.52rem;
  font-weight: 800;
  color: var(--warn);
}

.mitm-hook {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%) scale(0.5);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.48rem;
  font-weight: 800;
  color: #FFF;
  background: #FF6B6B;
  white-space: nowrap;
  opacity: 0;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.5);
}

.mitm-stamp {
  position: absolute;
  bottom: 2px;
  left: 50%;
  margin-left: -29px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  box-sizing: border-box;
  border-radius: 50%;
  font-family: var(--font-display);
  color: #FFF;
  background: #FF6B6B;
  border: 2px dashed rgba(255, 255, 255, 0.95);
  opacity: 0;
  transform: scale(1.35) rotate(-12deg);
  transform-origin: center center;
  box-shadow: 0 3px 10px rgba(255, 107, 107, 0.45);
  line-height: 1.1;
  z-index: 5;
  pointer-events: none;
}

.mitm-stamp-main {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.mitm-stamp-sub {
  margin-top: 1px;
  font-size: 0.42rem;
  font-weight: 400;
  opacity: 0.92;
}

#risk-2 .comic-pow {
  right: 4px;
  top: 4px;
  bottom: auto;
}

.cmd-compare {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cmd-original,
.cmd-tampered {
  font-family: 'SF Mono', monospace;
  font-size: 0.68rem;
  padding: 7px 10px;
  border-radius: 8px;
}

.cmd-original {
  background: #F0FAF4;
  border: 2px solid var(--success);
  color: #2D6A4F;
}

.cmd-tampered {
  background: #FFF0F0;
  border: 2px solid var(--warn);
  opacity: 0;
}

.cmd-arrow {
  font-family: var(--emoji-font);
}

.explosion {
  position: absolute;
  right: 16px;
  bottom: 12px;
  font-family: var(--emoji-font);
  font-size: 2rem;
  opacity: 0;
}

.packet {
  background: #F0F8FF;
  border: 2px dashed var(--primary);
  border-radius: 10px;
  padding: 10px;
  position: relative;
}

.packet-visible { font-size: 0.78rem; }

.packet-hidden {
  display: block;
  margin-top: 6px;
  font-family: monospace;
  font-size: 0.58rem;
  color: var(--warn);
  opacity: 0;
}

.injection-label {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 10px;
  background: #FFE8E8;
  color: var(--warn);
  border-radius: 999px;
  opacity: 0;
}

.model-swap {
  display: flex;
  gap: 12px;
  align-items: center;
}

.swap-real,
.swap-fake {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.swap-real {
  background: #EDE7F6;
  color: #7E57C2;
  border: 2px solid #D1C4E9;
}

.swap-fake {
  background: #FFF0F0;
  border: 2px solid #FFCDD2;
  opacity: 0;
}

.swap-tag {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
  opacity: 0;
}

/* --- Agent --- */
.agent-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 600px;
}

.split-panel {
  padding: 14px;
  opacity: 0;
}

.split-label {
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--success);
}

.split-label-warn { color: var(--warn); }

.agent-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 90px;
}

.agent-flow-danger {
  position: relative;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-height: 120px;
}

.agent-chain-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  position: relative;
  min-height: 56px;
}

.note-pass {
  flex-shrink: 0;
}

.note-paper {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 5px 8px;
  background: #FFFDE7;
  color: #C0392B;
  border-radius: 6px;
  border: 2px solid var(--warning);
  transform: rotate(-4deg);
  max-width: 120px;
}

.note-label {
  font-size: 0.5rem;
  font-weight: 800;
  color: var(--warn);
  text-transform: none;
}

.note-cmd {
  display: block;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.48rem;
  font-weight: 700;
  color: #8B0000;
  line-height: 1.3;
  word-break: break-all;
}

.agent-exec-terminal {
  width: 100%;
  border-radius: 8px;
  border: 2px solid #FFCDD2;
  background: #1E272E;
  overflow: hidden;
  opacity: 0;
  transform: translateY(6px);
  box-shadow: inset 0 0 16px rgba(255, 107, 107, 0.12);
}

.agent-exec-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #2D3436;
  border-bottom: 1px solid #636E72;
}

.agent-exec-label {
  margin-left: 4px;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.48rem;
  color: #B2BEC3;
}

.agent-exec-body {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.agent-cmd-line {
  display: block;
  font-family: 'SF Mono', 'Menlo', monospace;
  font-size: 0.52rem;
  color: #7BC8A4;
  line-height: 1.35;
  opacity: 0;
  transform: translateX(8px);
}

.agent-cmd-warn {
  color: #FF6B6B;
  font-weight: 700;
}

.agent-exec-terminal.agent-exec-active {
  opacity: 1;
  transform: translateY(0);
}

.agent-cmd-line.agent-cmd-visible {
  opacity: 1;
  transform: translateX(0);
}

.agent-flying {
  position: relative;
}

.alert-box {
  position: relative;
  bottom: auto;
  right: auto;
  width: 100%;
  padding: 6px 10px;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--warn);
  background: #FFF0F0 !important;
  border-color: #FFCDD2 !important;
  opacity: 0;
}

.flow-arrow {
  font-size: 1rem;
  color: var(--text-muted);
}

.task-ok {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--success);
}

/* --- Defense --- */
.scene-defense {
  justify-content: center;
  align-items: center;
  padding: 38px 16px 64px;
}

.defense-layout {
  display: grid;
  grid-template-columns: minmax(72px, 96px) 1fr;
  gap: 14px;
  width: 100%;
  max-width: 540px;
  align-items: start;
}

.defense-aside {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 12px;
}

.defense-hero {
  opacity: 0;
  flex-shrink: 0;
}

.defense-content {
  min-width: 0;
}

.defense-headline {
  font-family: var(--font-display);
  font-size: clamp(0.88rem, 2.4vw, 1.05rem);
  color: var(--primary);
  margin-bottom: 8px;
  opacity: 0;
}

.defense-list {
  list-style: none;
  width: 100%;
  max-width: none;
}

.defense-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 10px;
  margin-bottom: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  border-left: 4px solid var(--success);
  opacity: 0;
}

.defense-item-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.defense-item-title {
  font-size: clamp(0.68rem, 1.9vw, 0.76rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.defense-item-detail {
  font-size: clamp(0.58rem, 1.65vw, 0.66rem);
  font-weight: 500;
  color: var(--text-muted);
  line-height: 1.4;
}

.defense-item .check {
  color: var(--success);
  font-weight: 900;
  font-size: 0.9rem;
}

.finale {
  width: 100%;
  max-width: none;
}

.finale-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0;
}

.finale-icon {
  font-family: var(--emoji-font);
  font-size: 1.1rem;
}

.finale-quote {
  padding: 12px 16px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
  color: var(--text);
  background: linear-gradient(135deg, #E8F4FD, #F0FAF4) !important;
  border-color: #C9E4FF !important;
  opacity: 0;
}

.finale-keyphrase {
  display: inline-block;
  padding: 1px 8px 3px;
  margin: 0 2px;
  font-size: 1.15em;
  font-weight: 700;
  color: #C0392B;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, rgba(255, 107, 107, 0.14) 0%, rgba(255, 209, 102, 0.2) 100%);
  border-radius: 8px;
  border-bottom: 3px solid var(--warn);
}

/* THE END */
.the-end {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
}

.the-end[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.the-end.is-visible {
  pointer-events: auto;
}

.the-end-curtain {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(26, 38, 52, 0.72) 0%, rgba(26, 38, 52, 0.88) 100%);
  backdrop-filter: blur(4px);
}

.the-end-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px 32px;
}

.the-end-title {
  font-family: var(--font-display), Georgia, serif;
  font-size: clamp(2rem, 8vw, 3.2rem);
  font-weight: 400;
  letter-spacing: 0.18em;
  color: #FFF;
  text-shadow: 0 2px 20px rgba(255, 209, 102, 0.4), 0 0 40px rgba(108, 180, 238, 0.25);
  margin-bottom: 12px;
}

.the-end-sub {
  font-size: clamp(0.78rem, 2.5vw, 0.92rem);
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 20px;
  letter-spacing: 0.06em;
}

.the-end-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 0.88rem;
  color: var(--text);
  text-decoration: none;
  background: linear-gradient(135deg, #FFF 0%, #E8F4FD 100%);
  border: 2px solid #C9E4FF;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s;
}

.the-end-link:hover {
  transform: scale(1.04);
}

/* Subtitle */
.subtitle-bar {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  width: 88%;
  max-width: 640px;
  padding: 8px 16px 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: #E8DDD0 !important;
  backdrop-filter: blur(6px);
}

.subtitle-speaker {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: #E8F4FD;
  font-size: 0.85rem;
}

#subtitle-text {
  flex: 1;
  text-align: left;
  font-size: clamp(0.72rem, 1.7vw, 0.88rem);
  line-height: 1.45;
  min-height: 1.4em;
  font-weight: 500;
  color: var(--text);
}

/* 开场海报 — 封面图 + 图文入口 */
.start-poster {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, #FFFBF5 0%, #FFF8EE 45%, #FDF6EC 100%);
  backdrop-filter: blur(8px);
  transition: opacity 0.35s, visibility 0.35s;
  overflow: hidden;
}

.start-poster.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.poster-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: clamp(8px, 2vw, 16px) clamp(12px, 3vw, 24px) 4px;
}

.poster-cover-wrap {
  width: 100%;
  max-width: 340px;
  max-height: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid #F0E6D8;
  box-shadow: var(--card-shadow), 0 8px 32px rgba(232, 146, 124, 0.12);
}

.poster-cover-wrap picture,
.poster-cover-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(52vh, 420px);
  object-fit: contain;
  object-position: center top;
}

.poster-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px clamp(14px, 4vw, 28px) clamp(14px, 3vw, 18px);
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 2px solid #F0E6D8;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
}

.poster-guide-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  padding: 14px 20px;
  border-radius: 16px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #FF8E53 0%, #FF6B6B 55%, #E85555 100%);
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 6px 24px rgba(255, 107, 107, 0.45);
  transition: transform 0.15s, box-shadow 0.2s;
}

.poster-guide-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 28px rgba(255, 107, 107, 0.55);
}

.poster-guide-btn:active {
  transform: scale(0.98);
}

.poster-guide-icon {
  flex-shrink: 0;
  font-size: 1.5rem;
  line-height: 1;
}

.poster-guide-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  min-width: 0;
}

.poster-guide-text {
  font-family: var(--font-display);
  font-size: clamp(1rem, 3vw, 1.18rem);
  line-height: 1.25;
  font-weight: 400;
}

.poster-guide-sub {
  font-size: clamp(0.62rem, 1.7vw, 0.72rem);
  opacity: 0.92;
  margin-top: 3px;
  font-weight: 500;
}

.poster-guide-arrow {
  flex-shrink: 0;
  font-size: 1.4rem;
  font-weight: 700;
  opacity: 0.9;
}

.poster-deep-hint {
  font-size: clamp(0.72rem, 2vw, 0.82rem);
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.poster-loader {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  transition: opacity 0.35s, max-height 0.35s, margin 0.35s;
}

.poster-loader.is-done {
  opacity: 0;
  max-height: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}

.poster-loader-track {
  height: 5px;
  border-radius: 999px;
  background: #E8F4FD;
  overflow: hidden;
  border: 1px solid #C9E4FF;
}

.poster-loader-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6CB4EE, #4A9AD4);
  transition: width 0.25s ease-out;
}

.poster-loader-text {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.poster-play-btn:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.poster-play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  padding: 10px 20px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(135deg, #6CB4EE 0%, #4A9AD4 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(108, 180, 238, 0.45);
  transition: transform 0.15s, box-shadow 0.2s;
}

.poster-play-btn--secondary {
  background: var(--card);
  color: var(--text);
  border: 2px solid #C9E4FF;
  box-shadow: 0 2px 10px rgba(108, 180, 238, 0.15);
}

.poster-play-btn--secondary:hover {
  background: #F8FCFF;
  box-shadow: 0 4px 14px rgba(108, 180, 238, 0.25);
}

.poster-play-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 22px rgba(108, 180, 238, 0.55);
}

.poster-play-btn--secondary:hover {
  box-shadow: 0 4px 14px rgba(108, 180, 238, 0.25);
}

.poster-play-btn:active {
  transform: scale(0.98);
}

.poster-play-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(108, 180, 238, 0.15);
  font-size: 0.9rem;
}

.poster-play-btn--secondary .poster-play-icon {
  background: #E8F4FD;
  color: var(--primary);
}

.poster-play-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.poster-play-text {
  font-family: var(--font-display);
  font-size: clamp(0.88rem, 2.5vw, 1rem);
  line-height: 1.2;
}

.poster-play-meta {
  font-size: clamp(0.58rem, 1.6vw, 0.68rem);
  opacity: 0.88;
  margin-top: 2px;
}

.poster-play-btn--secondary .poster-play-meta {
  color: var(--text-muted);
}

/* 移动端竖屏：自动旋转为横屏布局（无需用户转设备） */
#app.force-landscape {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 100dvh;
  height: 100vw;
  max-width: none;
  margin: 0;
  padding: 0;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center center;
  z-index: 1;
}

#app.force-landscape .header {
  padding: 4px 12px;
}

#app.force-landscape .header h1 {
  font-size: 0.78rem;
}

#app.force-landscape .stage-wrapper {
  padding: 2px 8px;
}

#app.force-landscape .scene {
  padding: 4px 12px 48px;
}

#app.force-landscape .agent-split {
  grid-template-columns: 1fr 1fr;
  max-width: 92%;
}

#app.force-landscape .topology {
  grid-template-columns: 1fr 40px 1fr 40px 1fr;
}

#app.force-landscape .subtitle-bar {
  bottom: 6px;
  width: 96%;
}

#app.force-landscape .controls {
  padding: 6px 12px 8px;
}

/* ===== 全屏模式 ===== */
#app:fullscreen,
#app:-webkit-full-screen {
  max-width: none;
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--bg-page);
}

#app:fullscreen .stage-wrapper,
#app:-webkit-full-screen .stage-wrapper {
  flex: 1;
  padding: 8px 16px;
  min-height: 0;
}

#app:fullscreen .stage,
#app:-webkit-full-screen .stage {
  width: min(100%, calc((100dvh - 130px) * 16 / 9));
  max-height: calc(100dvh - 120px);
  margin: 0 auto;
}

#app:fullscreen .header,
#app:-webkit-full-screen .header {
  flex-shrink: 0;
}

#app:fullscreen .controls,
#app:-webkit-full-screen .controls {
  flex-shrink: 0;
}

#app.force-landscape:fullscreen,
#app.force-landscape:-webkit-full-screen {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 100dvh;
  height: 100vw;
  max-width: none;
  margin: 0;
  padding: 0;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center center;
}

#app.force-landscape:fullscreen .stage,
#app.force-landscape:-webkit-full-screen .stage {
  width: min(100%, calc((100dvh - 100px) * 16 / 9));
  max-height: calc(100dvh - 90px);
}

/* Controls */
.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 2px solid #F0E6D8;
}

.ctrl-btn {
  width: 40px;
  height: 40px;
  border: 2px solid #F0E6D8;
  border-radius: 50%;
  background: var(--bg-page);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
}

.ctrl-btn:hover {
  background: #E8F4FD;
  transform: scale(1.05);
}

.ctrl-btn-mute {
  font-size: 0.85rem;
}

.progress-wrap {
  flex: 1;
}

#progress {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: #F0E6D8;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

#progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  cursor: pointer;
}

#progress::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  cursor: pointer;
}

#time-display {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 3px;
}

.site-copyright {
  flex-shrink: 0;
  text-align: center;
  padding: 5px 16px 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--card);
  border-top: 1px solid #F0E6D8;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
  .header {
    padding: 6px 12px;
  }

  .header h1 {
    font-size: 0.82rem;
  }

  .chapter-label {
    font-size: 0.65rem;
    padding: 3px 10px;
  }

  .stage-wrapper {
    padding: 4px 8px;
  }

  .stage {
    border-radius: 14px;
  }

  .scene {
    padding: 8px 10px 56px;
  }

  .subtitle-bar {
    bottom: 8px;
    width: 94%;
    padding: 6px 10px 6px 8px;
  }

  #subtitle-text {
    font-size: 0.68rem;
  }

  .intro-ad-hero {
    max-width: 260px;
    min-width: 160px;
    padding: 12px 14px 10px;
  }

  .ad-headline { font-size: 0.95rem; }

  .intro-layout { max-width: 98%; gap: 8px; }

  .char-developer { width: 80px; }

  .phone-wrap { width: 44px; bottom: 16%; right: 3%; }
  .comic-yummy-head { width: 52px; top: -28px; }
  .char-lurker { width: 56px; }
  .notification { font-size: 0.5rem; padding: 4px 6px; }

  .topology {
    grid-template-columns: 1fr 28px 1fr 28px 1fr;
    padding: 8px 4px 6px;
    max-width: 100%;
  }

  .topo-arrow-seg { padding-top: 18px; }
  .topo-label { font-size: 0.58rem; }
  .proxy-bubble { width: 52px; top: -22px; right: -24px; }

  .risk-panels { min-height: 176px; }
  .risk-panel { padding: 10px 12px; }
  .risk-title { font-size: 0.72rem; margin-bottom: 8px; }
  .code-scroll-window { height: 66px; }
  .code-scroll-track .code-line { font-size: 0.55rem; padding: 4px 6px; }
  .code-scroll { height: 58px; }
  .code-scroll code { font-size: 0.55rem; }
  .comic-pow { width: 56px; }
  .char-small { width: 52px; }
  .char-proxy { width: 62px; }
  .char-cloud { width: 62px; }
  .char-guard { width: 64px; }
  .char-tiny { width: 36px; }
  .char-mitm { width: 44px; }
  .mitm-packet { font-size: 0.46rem; max-width: 88px; }
  .mitm-topology { padding-bottom: 32px; }
  .mitm-stamp { width: 54px; height: 54px; margin-left: -27px; }
  .mitm-stamp-main { font-size: 0.62rem; }
  .mitm-stamp-sub { font-size: 0.38rem; }

  .defense-item, .finale-row { font-size: 0.62rem; }
  .finale-quote { font-size: 0.78rem; padding: 10px 12px; }

  .deco-float-1 { width: 36px; }
  .deco-float-2 { width: 32px; }
  .deco-cloud-1, .deco-cloud-2 { opacity: 0.4; }

  .ctrl-btn {
    width: 44px;
    height: 44px;
  }

  #progress {
    height: 8px;
  }

  #progress::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
  }

  #progress::-moz-range-thumb {
    width: 20px;
    height: 20px;
  }
}

/* 横屏手机 / 小平板 — 保持左右分栏，紧凑布局 */
@media (max-width: 900px) and (orientation: landscape),
       (max-height: 500px) {
  .header { padding: 4px 12px; }
  .header h1 { font-size: 0.78rem; }
  .stage-wrapper { padding: 2px 8px; }

  .scene {
    padding: 4px 12px 48px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 4px;
  }

  .scene-intro {
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .intro-layout {
    flex-direction: row;
    align-items: center;
    width: 96%;
  }

  .intro-user { transform: none; }
  .phone-wrap { position: absolute; bottom: 14%; right: 3%; width: 40px; }
  .comic-yummy-head { width: 44px; top: -24px; }

  .topology {
    grid-template-columns: 1fr 40px 1fr 40px 1fr;
    margin-bottom: 4px;
  }

  .risk-panels { min-height: 88px; max-width: 90%; }

  .agent-split {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    max-width: 92%;
  }

  .split-panel { padding: 8px; }
  .agent-flow { min-height: 70px; gap: 4px; }
  .flow-icon { width: 52px; }
  .flow-icon-sm { width: 44px; }

  .scene-defense {
    padding: 8px 8px 52px;
    justify-content: flex-start;
    overflow-y: auto;
  }

  .defense-layout {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .defense-aside {
    display: none;
  }
  .defense-list { max-width: 100%; }
  .defense-item { padding: 5px 10px; margin-bottom: 3px; }

  .subtitle-bar {
    bottom: 6px;
    width: 96%;
  }

  .controls {
    padding: 6px 12px 8px;
    gap: 8px;
  }

  .hint-title { font-size: 1rem; }
  .warning-text { font-size: 1.2rem; }
}

/* ===== CSS 伪全屏（iOS / 不支持元素全屏的环境） ===== */
html.pseudo-fs,
html.pseudo-fs body {
  overflow: hidden !important;
  width: 100%;
  height: 100%;
  height: -webkit-fill-available;
}

html.pseudo-fs body {
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
}

html.mobile-fs-active {
  background: #1a1a1a;
}

#app.pseudo-fs {
  position: fixed;
  z-index: 2147483646;
  max-width: none;
  margin: 0;
  background: var(--bg-page);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* 伪全屏时舞台最大化 */
html.mobile-fs-active #app.pseudo-fs .stage-wrapper {
  flex: 1;
  min-height: 0;
  padding: 2px 4px;
}

html.mobile-fs-active #app.pseudo-fs .stage {
  aspect-ratio: unset;
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 8px;
}

html.mobile-fs-active #app.pseudo-fs .controls {
  flex-shrink: 0;
  padding: 4px 8px;
  padding-bottom: max(4px, env(safe-area-inset-bottom));
}

/* 移动端退出全屏 — 伪全屏时显示 */
.mobile-exit-fs {
  display: none;
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  z-index: 2147483647;
  width: 36px;
  height: 36px;
  border: 2px solid #F0E6D8;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  align-items: center;
  justify-content: center;
}

html.mobile-fs-active .mobile-exit-fs:not([hidden]) {
  display: flex;
}

.is-mobile html.mobile-fs-active .controls {
  position: relative;
  z-index: 2;
}

/* documentElement 原生全屏 */
html:fullscreen,
html:-webkit-full-screen {
  width: 100%;
  height: 100%;
  background: var(--bg-page);
}

html:fullscreen body,
html:-webkit-full-screen body {
  height: 100%;
  overflow: hidden;
}

html:fullscreen #app,
html:-webkit-full-screen #app {
  max-width: none;
  width: 100%;
  height: 100%;
  margin: 0;
}

html:fullscreen #app .stage-wrapper,
html:-webkit-full-screen #app .stage-wrapper,
html.mobile-fs-active #app.pseudo-fs .stage-wrapper {
  flex: 1;
  min-height: 0;
  padding: 4px 8px;
}

html:fullscreen #app .stage,
html:-webkit-full-screen #app .stage,
html.mobile-fs-active #app.pseudo-fs .stage {
  aspect-ratio: unset;
  width: 100%;
  height: 100%;
  max-height: none;
  border-radius: 12px;
}

/* 底部控制栏全屏按钮 — 仅移动端显示 */
.ctrl-btn-fs-bar {
  display: none;
  color: var(--primary);
  border-color: #C9E4FF;
  background: #F8FCFF;
}

.is-mobile .ctrl-btn-fs-bar {
  display: flex;
}

/* ===== is-mobile 细致化布局 ===== */
/* 移动端隐藏顶栏，舞台与控制栏占满可视区域 */
.is-mobile .header {
  display: none !important;
}

.is-mobile .stage-wrapper {
  flex: 1;
  min-height: 0;
  padding: 2px 6px;
  align-items: stretch;
}

.is-mobile .stage {
  aspect-ratio: unset;
  height: 100%;
  width: 100%;
  max-height: none;
  border-radius: 10px;
}

.is-mobile .scene {
  padding: 22px 6px 44px;
  overflow: hidden;
  justify-content: flex-start;
}

.is-mobile .chapter-tags {
  top: 2px;
}

.is-mobile .chapter-tag {
  font-size: 0.52rem;
  padding: 2px 7px;
  gap: 3px;
}

/* 风险 / 防护 / Agent 场景：角标移到底部，避免遮挡顶部内容 */
.is-mobile .stage[data-chapter="risks"] .chapter-tags,
.is-mobile .stage[data-chapter="defense"] .chapter-tags,
.is-mobile .stage[data-chapter="agent"] .chapter-tags {
  top: auto;
  bottom: 48px;
  left: 8px;
  transform: none;
}

.is-mobile .subtitle-bar {
  bottom: 4px;
  width: 97%;
  padding: 5px 8px;
  border-radius: 10px;
}

.is-mobile #subtitle-text {
  font-size: 0.62rem;
  line-height: 1.35;
}

/* 装饰元素 — 移动端隐藏防重叠 */
.is-mobile .deco-cloud,
.is-mobile .deco-bubble,
.is-mobile .deco-float,
.is-mobile .comic-yummy,
.is-mobile .speed-lines,
.is-mobile .comic-stars {
  display: none !important;
}

/* --- Intro --- */
.is-mobile .scene-intro {
  justify-content: center;
  padding-top: 8px;
}

.is-mobile .intro-layout {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 92%;
  width: auto;
}

.is-mobile .char-developer {
  width: 48px;
  flex-shrink: 0;
}

.is-mobile .comic-yummy-head {
  width: 40px;
  top: -22px;
}

.is-mobile .intro-lurker {
  right: -10px;
  top: 4px;
}

.is-mobile .char-lurker {
  width: 44px;
}

.is-mobile .intro-lurker-label {
  font-size: 0.42rem;
  padding: 1px 6px;
}

.is-mobile .intro-ad-hero {
  flex: 0 0 auto;
  width: min(100%, 210px);
  max-width: 210px;
  min-width: 0;
  height: auto;
  padding: 8px 10px 7px;
  border-radius: 12px;
  border-width: 2px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.is-mobile .ad-badge-hot {
  align-self: center;
  width: auto;
  max-width: 100%;
  white-space: nowrap;
  font-size: 0.48rem;
  padding: 2px 7px;
  margin-bottom: 4px;
}

.is-mobile .ad-headline {
  font-size: 0.68rem;
  line-height: 1.3;
  margin-bottom: 4px;
  text-align: center;
}

.is-mobile .ad-price-row {
  justify-content: center;
  gap: 4px;
  margin-bottom: 4px;
}

.is-mobile .ad-price {
  font-size: 0.62rem;
}

.is-mobile .ad-tags {
  justify-content: center;
  gap: 3px;
  margin-bottom: 6px;
}

.is-mobile .ad-tag {
  font-size: 0.48rem;
  padding: 1px 6px;
}

.is-mobile .ad-cta {
  font-size: 0.58rem;
  padding: 4px 8px;
  width: 100%;
}

.is-mobile .ad-trust {
  font-size: 0.48rem;
  margin-top: 4px;
}

.is-mobile .phone-wrap {
  width: 32px;
  bottom: 12%;
  right: 2%;
  opacity: 0.7;
}

.is-mobile .notification {
  display: none;
}

/* --- Risks --- */
.is-mobile .scene-risks {
  justify-content: flex-start;
  padding-top: 8px;
  gap: 0;
}

.is-mobile .topology {
  flex-shrink: 0;
  transform: none;
  transform-origin: unset;
  margin-bottom: 0;
  max-width: 100%;
  grid-template-columns: 1fr 18px 1fr 18px 1fr;
  padding: 16px 2px 4px;
  overflow: visible;
}

.is-mobile .topo-proxy {
  overflow: visible;
}

.is-mobile .topo-arrow-seg {
  padding-top: 12px;
}

.is-mobile .topo-label {
  font-size: 0.48rem;
}

.is-mobile .char-small {
  width: 36px;
}

.is-mobile .char-proxy {
  width: 40px;
}

.is-mobile .char-cloud {
  width: 40px;
}

.is-mobile .proxy-bubble {
  width: 32px;
  top: -6px;
  right: -8px;
}

.is-mobile .risk-panels {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  min-height: 72px;
  max-height: 38vh;
  margin-top: 2px;
}

.is-mobile .risk-panel {
  padding: 5px 7px;
  overflow: hidden;
}

.is-mobile #risk-2 {
  overflow: visible;
}

.is-mobile .risk-title {
  font-size: 0.62rem;
  margin-bottom: 4px;
  gap: 2px;
}

.is-mobile .risk-title-sub {
  font-size: 0.48rem;
}

.is-mobile .risk-num {
  width: 16px;
  height: 16px;
  line-height: 16px;
  font-size: 0.58rem;
}

.is-mobile .code-leak-panel {
  max-height: calc(38vh - 28px);
}

.is-mobile .code-scroll-window {
  height: 52px;
}

.is-mobile .code-scroll-track .code-line {
  font-size: 0.48rem;
  padding: 3px 5px;
}

.is-mobile .term-label {
  font-size: 0.44rem;
}

.is-mobile .mitm-topology {
  transform: scale(0.88);
  transform-origin: top center;
  grid-template-columns: 28px 1fr 36px 1fr 28px;
  gap: 2px;
  margin-bottom: 2px;
}

.is-mobile .mitm-packet {
  font-size: 0.38rem;
  max-width: 64px;
  padding: 2px 3px;
}

.is-mobile .mitm-topology {
  padding-bottom: 28px;
}

.is-mobile .mitm-stamp {
  width: 48px;
  height: 48px;
  margin-left: -24px;
  bottom: 0;
}

.is-mobile .mitm-stamp-main {
  font-size: 0.54rem;
}

.is-mobile .mitm-stamp-sub {
  font-size: 0.36rem;
}

.is-mobile .char-mitm {
  width: 34px;
}

.is-mobile .comic-pow {
  width: 44px;
}

.is-mobile .swoosh-text {
  font-size: 0.72rem;
}

/* --- Agent --- */
.is-mobile .scene-agent {
  justify-content: center;
  padding-top: 22px;
}

.is-mobile .agent-split {
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  max-width: 99%;
  width: 99%;
}

.is-mobile .split-panel {
  padding: 5px 6px;
  border-radius: 10px;
}

.is-mobile .split-label {
  font-size: 0.56rem;
  margin-bottom: 4px;
}

.is-mobile .agent-flow {
  min-height: 58px;
  gap: 2px;
}

.is-mobile .agent-flow-danger {
  min-height: 0;
  gap: 4px;
}

.is-mobile .agent-chain-row {
  min-height: 44px;
  gap: 2px;
}

.is-mobile .note-paper {
  max-width: 72px;
  padding: 3px 5px;
}

.is-mobile .note-label {
  font-size: 0.42rem;
}

.is-mobile .note-cmd {
  font-size: 0.38rem;
}

.is-mobile .agent-exec-terminal {
  border-radius: 6px;
}

.is-mobile .agent-exec-label {
  font-size: 0.38rem;
}

.is-mobile .agent-cmd-line {
  font-size: 0.4rem;
}

.is-mobile .agent-exec-body {
  padding: 4px 5px;
  gap: 2px;
}

.is-mobile .alert-box {
  padding: 4px 6px;
  font-size: 0.44rem;
}

.is-mobile .flow-icon {
  width: 36px;
}

.is-mobile .flow-icon-sm {
  width: 30px;
}

.is-mobile .flow-arrow {
  font-size: 0.72rem;
}

.is-mobile .task-ok {
  font-size: 0.52rem;
}

.is-mobile .note-paper {
  font-size: 0.48rem;
  padding: 3px 5px;
}

.is-mobile .alert-box {
  font-size: 0.44rem;
  padding: 2px 5px;
  bottom: -2px;
}

.is-mobile .char-tiny {
  width: 28px;
}

/* --- Defense --- */
.is-mobile .scene-defense {
  padding: 6px 4px 44px;
  justify-content: flex-start;
  align-items: stretch;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.is-mobile .defense-layout {
  grid-template-columns: 1fr;
  gap: 4px;
  max-width: 100%;
  width: 100%;
  flex-shrink: 0;
}

.is-mobile .defense-aside {
  display: none;
}

.is-mobile .defense-headline {
  font-size: 0.72rem;
  margin-bottom: 4px;
  padding-top: 2px;
}

.is-mobile .defense-item {
  font-size: 0.54rem;
  padding: 4px 6px;
  margin-bottom: 2px;
  border-radius: 8px;
  gap: 5px;
}

.is-mobile .ico-check-item {
  width: 12px;
  height: 12px;
  margin-top: 1px;
}

.is-mobile .defense-item-title {
  font-size: 0.56rem;
}

.is-mobile .defense-item-detail {
  font-size: 0.48rem;
}

.is-mobile .defense-item .ico-check {
  width: 12px;
  height: 12px;
}

.is-mobile .finale-row {
  font-size: 0.54rem;
  gap: 4px;
}

.is-mobile .finale-quote {
  font-size: 0.64rem;
  padding: 6px 8px;
  line-height: 1.35;
  border-radius: 10px;
}

.is-mobile .finale-keyphrase {
  font-size: 1.1em;
  padding: 0 5px 2px;
}

.is-mobile .the-end-title {
  font-size: clamp(1.6rem, 10vw, 2.4rem);
  letter-spacing: 0.12em;
}

.is-mobile .the-end-sub {
  font-size: 0.68rem;
}

.is-mobile .the-end-link {
  font-size: 0.76rem;
  padding: 8px 16px;
}

.is-mobile .controls {
  padding: 5px 10px 6px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  gap: 6px;
}

.is-mobile .ctrl-btn {
  width: 38px;
  height: 38px;
}

.is-mobile .ctrl-btn-fs {
  width: 34px;
  height: 34px;
}

.is-mobile #time-display {
  font-size: 0.62rem;
}

.is-mobile .site-copyright {
  padding: 3px 10px 6px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  font-size: 0.58rem;
}

.is-mobile .poster-body {
  padding: 4px 8px 2px;
}

.is-mobile .poster-cover-wrap {
  max-width: 220px;
  border-radius: 12px;
}

.is-mobile .poster-cover-img {
  max-height: min(38vh, 280px);
}

.is-mobile .poster-footer {
  padding: 8px 10px 10px;
  gap: 6px;
}

.is-mobile .poster-guide-btn {
  padding: 11px 14px;
  gap: 8px;
  border-radius: 14px;
}

.is-mobile .poster-guide-icon {
  font-size: 1.2rem;
}

.is-mobile .poster-guide-text {
  font-size: 0.88rem;
}

.is-mobile .poster-guide-sub {
  font-size: 0.52rem;
}

.is-mobile .poster-deep-hint {
  font-size: 0.62rem;
}

.is-mobile .poster-play-btn {
  padding: 8px 14px;
  gap: 8px;
  max-width: none;
}

.is-mobile .poster-play-icon {
  width: 28px;
  height: 28px;
  font-size: 0.82rem;
}

.is-mobile .poster-play-text {
  font-size: 0.82rem;
}

.is-mobile .poster-play-meta {
  font-size: 0.5rem;
}

.is-mobile .poster-loader-text {
  font-size: 0.62rem;
}

/* 竖屏伪全屏 / force-landscape 叠加 */
#app.force-landscape.pseudo-fs,
html:fullscreen #app.force-landscape,
html:-webkit-full-screen #app.force-landscape {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 100dvh;
  height: 100vw;
  max-width: none;
  margin: 0;
  padding: 0;
  transform: translate(-50%, -50%) rotate(90deg);
  transform-origin: center center;
  z-index: 99999;
}

#app.force-landscape.pseudo-fs .stage,
html:fullscreen #app.force-landscape .stage,
html:-webkit-full-screen #app.force-landscape .stage {
  aspect-ratio: unset;
  width: 100%;
  height: 100%;
  max-height: none;
}

/* ===== MP4 导出录屏模式 (?export=1) ===== */
html.export-mode,
html.export-mode body {
  overflow: hidden;
  background: var(--bg-page);
}

html.export-mode #app {
  max-width: none;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
}

html.export-mode .header,
html.export-mode .controls,
html.export-mode .start-poster,
html.export-mode .mobile-exit-fs,
html.export-mode .site-copyright {
  display: none !important;
}

html.export-mode .stage-wrapper {
  flex: 1;
  padding: 12px 24px 8px;
  min-height: 0;
}

html.export-mode .stage {
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
}
