:root {
  --accent: #4fd1c5;
  --accent-2: #63b3ed;
  --text: #e6f1ff;
  --muted: #8aa4c0;
  --glass: rgba(10, 22, 40, 0.55);
  --border: rgba(99, 179, 237, 0.25);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 70% 40%, #3a4f9c 0%, #22306b 45%, #141c45 100%);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

/* 卡通星空 */
body::before, body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-repeat: repeat;
  animation: twinkle 4s ease-in-out infinite alternate;
}
body::before {
  background-image:
    radial-gradient(2px 2px at 20px 30px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 140px 80px, #ffe28a 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 90px 160px, #fff 50%, transparent 51%),
    radial-gradient(2.5px 2.5px at 210px 200px, #bde0fe 50%, transparent 51%);
  background-size: 260px 260px;
}
body::after {
  background-image:
    radial-gradient(3px 3px at 60px 110px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 300px 40px, #fcbad3 50%, transparent 51%),
    radial-gradient(2px 2px at 220px 330px, #fff 50%, transparent 51%);
  background-size: 380px 380px;
  animation-delay: -2s;
}
@keyframes twinkle { from { opacity: 0.35; } to { opacity: 1; } }

#globe { position: fixed; inset: 0; cursor: grab; z-index: 1; }
#globe:active { cursor: grabbing; }

.card {
  position: fixed;
  top: 50%;
  left: clamp(16px, 5vw, 72px);
  transform: translateY(-50%);
  width: min(360px, calc(100vw - 32px));
  padding: 32px 28px 26px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1), opacity 0.4s;
  z-index: 10;
}

.card.collapsed { transform: translate(calc(-100% - 80px), -50%); }
.card.collapsed .toggle { transform: rotate(180deg); right: -60px; }

.toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: transform 0.4s, right 0.5s;
}
.toggle:hover { border-color: var(--accent); color: var(--accent); }

.avatar-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 18px;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.85);
  background: #22306b;
  position: relative;
  z-index: 1;
}

/* 原图是全身照，放大裁出头肩部分 */
.avatar img {
  position: absolute;
  width: 257%;
  max-width: none;
  left: -88%;
  top: -178%;
}

/* 雷达扫描环 */
.ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px dashed var(--accent);
  opacity: 0.7;
  animation: spin 18s linear infinite;
}
.ring::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px solid var(--accent-2);
  opacity: 0;
  animation: pulse 2.6s ease-out infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.25); opacity: 0; }
}

h1 { font-size: 28px; letter-spacing: 2px; }

.role {
  margin-top: 6px;
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 1px;
}

.bio {
  margin: 16px 0;
  font-size: 14px;
  line-height: 1.75;
  color: var(--muted);
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.tags li {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(79, 209, 197, 0.08);
}

.links {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.links a, .links button {
  color: var(--text);
  background: none;
  font: inherit;
  text-decoration: none;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.25s;
}
.links a:hover, .links button:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 16px rgba(79, 209, 197, 0.35);
}

.statusbar {
  position: fixed;
  right: 16px;
  bottom: 14px;
  padding: 6px 14px;
  font: 12px/1.4 Consolas, "Courier New", monospace;
  color: var(--muted);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  z-index: 10;
  pointer-events: none;
}
.statusbar .sep { margin: 0 8px; opacity: 0.4; }
#coords { color: var(--accent); display: inline-block; min-width: 190px; }

.tooltip {
  position: fixed;
  pointer-events: none;
  padding: 8px 12px;
  font-size: 13px;
  background: rgba(10, 22, 40, 0.9);
  border: 1px solid var(--accent);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 20;
}
.tooltip small { color: var(--muted); }

@media (max-width: 720px) {
  .card {
    top: auto;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    padding: 22px 18px 18px;
  }
  .card.collapsed { transform: translate(-50%, calc(100% + 80px)); }
  .card.collapsed .toggle { right: 14px; top: -50px; }
  .avatar-wrap { width: 96px; height: 96px; margin-bottom: 12px; }
  .bio { display: none; }
  h1 { font-size: 22px; }
  .statusbar .hint, .statusbar .sep:last-of-type { display: none; }
  .statusbar { left: 50%; right: auto; transform: translateX(-50%); bottom: 10px; white-space: nowrap; }
}

/* ================= 开场故事 ================= */
.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(ellipse at 50% 110%, #1a2150 0%, #000 60%);
  color: #f5f5f7;
  font-family: -apple-system, "SF Pro Display", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  cursor: pointer;
  transition: opacity 1.2s ease, transform 1.2s cubic-bezier(.2,.8,.2,1);
}
.intro[hidden] { display: none; }
.intro.leaving { opacity: 0; transform: scale(1.12); pointer-events: none; }

.intro-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 6vw;
}
.intro-stage > * { grid-area: 1 / 1; }

.intro-text { text-align: center; }
.intro-text .line {
  font-size: clamp(30px, 5.6vw, 76px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(40px) scale(0.98);
  filter: blur(12px);
  transition: opacity 1s cubic-bezier(.2,.8,.2,1), transform 1s cubic-bezier(.2,.8,.2,1), filter 1s;
  transition-delay: var(--d, 0s);
}
.intro-text.show .line { opacity: 1; transform: none; filter: none; }
.intro-text:not(.show) .line { transition-delay: 0s; transition-duration: 0.6s; }

.intro em {
  font-style: normal;
  background: linear-gradient(90deg, #5ec8f2, #a78bfa 50%, #ff8fa3);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.intro-scene {
  margin: 0;
  text-align: center;
  opacity: 0;
  transform: translateY(24px) scale(0.92);
  transition: opacity 1s ease, transform 1.2s cubic-bezier(.2,.8,.2,1);
}
.intro-scene.show { opacity: 1; transform: none; }
.scene-svg {
  width: min(900px, 92vw, 110vh);
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(79, 179, 255, 0.18);
}
.intro-scene figcaption {
  margin-top: 8px;
  font-size: clamp(20px, 3vw, 38px);
  font-weight: 700;
  line-height: 1.4;
}

.intro-skip {
  position: absolute;
  top: 22px;
  right: 24px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #f5f5f7;
  font-size: 14px;
  cursor: pointer;
  backdrop-filter: blur(10px);
}
.intro-skip:hover { background: rgba(255, 255, 255, 0.18); }

.intro-progress {
  position: absolute;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}
.intro-progress .bar {
  width: 34px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}
.intro-progress .bar i { display: block; height: 100%; width: 0; background: #f5f5f7; }
.intro-progress .bar.done i { width: 100%; }
.intro-progress .bar.active i { animation: fill-bar var(--dur) linear forwards; }
@keyframes fill-bar { to { width: 100%; } }

.intro-hint {
  position: absolute;
  bottom: 18px;
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 2px;
}

/* 插画动效 */
.scene-svg .land { animation: land-spin 12s linear infinite; }
@keyframes land-spin { to { transform: translateX(-400px); } }

.scene-svg .orbit { animation: orbit 3s linear infinite; }
@keyframes orbit { to { stroke-dashoffset: -240; } }

.scene-svg .tail { transform-origin: 872px 528px; animation: wag 0.4s ease-in-out infinite alternate; }
@keyframes wag { from { transform: rotate(-18deg); } to { transform: rotate(14deg); } }

.scene-svg .dog-head { transform-origin: 800px 410px; animation: head-tilt 3.2s ease-in-out infinite; }
@keyframes head-tilt { 0%, 60%, 100% { transform: rotate(0); } 70%, 90% { transform: rotate(-10deg); } }

.scene-svg .kid-head { transform-origin: 575px 285px; animation: kid-sway 4s ease-in-out infinite alternate; }
@keyframes kid-sway { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }

.scene-svg .eyes { transform-origin: 578px 188px; animation: blink 4.5s infinite; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }

.scene-svg .stars > * { animation: twinkle 2.4s ease-in-out infinite alternate; }
.scene-svg .stars > :nth-child(2n) { animation-delay: -1.2s; }

.scene-svg .bubble { transform-origin: 676px 100px; transform: scale(0); transition: transform 0.6s cubic-bezier(.3,1.6,.5,1) 0.6s; }
.intro-scene.show .bubble { transform: scale(1); }
.intro-scene[data-variant="wonder"] .b-seed,
.intro-scene[data-variant="seed"] .b-wonder { display: none; }

.scene-svg .globe-glow { transform-origin: 335px 280px; animation: glow-pulse 2.4s ease-in-out infinite alternate; }
.intro-scene[data-variant="seed"] .globe-glow { animation-duration: 1.2s; }
.intro-scene[data-variant="seed"] .grid { stroke: #ffe28a; stroke-opacity: 0.95; }
@keyframes glow-pulse { from { opacity: 0.6; } to { opacity: 1; transform: scale(1.06); } }

/* 开场时隐藏主页面 UI */
.card, .statusbar { transition: opacity 0.8s ease 0.4s, transform 0.5s cubic-bezier(.2,.8,.2,1); }
body.intro-active .card, body.intro-active .statusbar { opacity: 0; pointer-events: none; transition-delay: 0s; }

@media (max-width: 720px) {
  .intro-progress .bar { width: 22px; }
  .intro-scene figcaption br { display: none; }
}
