/* ============================================
   像素风格学术主页 - style.css (统一版)
   ============================================ */

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

:root {
  --bg-color: #0f1020;
  --card-bg: #1a1b3a;
  --card-bg-soft: rgba(255, 255, 255, 0.03);

  --primary: #f8d030;
  --secondary: #ee1515;
  --accent: #3b4cca;
  --link: #00d4ff;
  --link-hover: #ffe066;

  --text: #e8e8f0;
  --text-dim: #a0a0c0;
  --text-mute: #7878a0;
  --border: #5050a0;
  --border-soft: rgba(80, 80, 160, 0.4);

  --snor-body: #5e8caf;
  --snor-body-dark: #426d8e;
  --snor-body-light: #7aa6c5;
  --snor-cream: #f5dc8c;
  --snor-cream-dark: #d8b85c;
  --snor-line: #1a1a2e;
}

html, body {
  background-color: var(--bg-color);
  color: var(--text);
  font-family: 'VT323', monospace;
  font-size: 20px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    linear-gradient(rgba(80, 80, 160, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 80, 160, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
}

.typewriter,
.section-title,
.status,
.activity-label {
  font-family: 'Press Start 2P', monospace;
}

/* ---------- CRT 扫描线 ---------- */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px,
    rgba(0, 0, 0, 0.18) 4px
  );
}

.crt-flicker {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9997;
  background: rgba(120, 120, 200, 0.03);
  animation: flicker 0.15s infinite alternate;
}

@keyframes flicker {
  from { opacity: 0.95; }
  to   { opacity: 1; }
}

/* ---------- 主容器 ---------- */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  position: relative;
  z-index: 1;
}

/* ============================================
   顶部对话框
   ============================================ */
.dialog-box {
  border: 4px solid var(--text);
  background: var(--card-bg);
  padding: 24px 130px 24px 28px;
  margin-bottom: 32px;
  box-shadow:
    0 0 0 4px var(--bg-color),
    0 0 0 8px var(--text),
    8px 8px 0 8px rgba(0,0,0,0.4);
  position: relative;
  min-height: 100px;
}

.typewriter {
  font-size: 18px;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  border-right: 4px solid var(--primary);
  width: 0;
  animation:
    typing 3s steps(28, end) forwards,
    blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to   { width: 24ch; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50%      { border-color: var(--primary); }
}

@keyframes typewriter-fade {
  from { opacity: 0; transform: translateY(-2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   个人信息区
   ============================================ */
.profile {
  display: flex;
  gap: 32px;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.avatar-frame {
  width: 140px;
  height: 140px;
  border: 4px solid var(--text);
  background: var(--card-bg);
  padding: 6px;
  box-shadow: 6px 6px 0 var(--accent);
  flex-shrink: 0;
  image-rendering: pixelated;
  animation: idle-bob 2.4s ease-in-out infinite;
  /* ★ 新增：让占位精灵球可以绝对定位在内部 */
  position: relative;
  overflow: hidden;
}

/* ★ 新增：avatar 未加载时显示的旋转精灵球占位 */
.avatar-frame::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70px;
  height: 70px;
  margin: -35px 0 0 -35px;
  border-radius: 50%;
  border: 3px solid #222;
  background:
    radial-gradient(circle at 50% 50%,
      #fff 0 18%,
      #222 18% 24%,
      transparent 24%),
    linear-gradient(to bottom,
      var(--secondary) 0%, var(--secondary) 47%,
      #222 47%, #222 53%,
      #f4f4f4 53%, #f4f4f4 100%);
  box-shadow: inset -6px -6px 0 -2px rgba(0,0,0,0.25);
  animation: pokeball-spin 1.4s linear infinite;
  z-index: 0;
}

/* 给一点点呼吸感的脉冲（可选） */
.avatar-frame::after {
  content: "";
  position: absolute;
  inset: 6px;
  background: transparent;
  pointer-events: none;
  z-index: 0;
}

@keyframes pokeball-spin {
  0%   { transform: rotate(0deg)   scale(1); }
  50%  { transform: rotate(180deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes idle-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  /* ★ 新增：让真实图片浮在占位精灵球之上 */
  position: relative;
  z-index: 1;
  background: var(--card-bg);
}

.pixel-pokeball {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 12%, #222 12% 16%, transparent 16%),
    linear-gradient(to bottom,
      var(--secondary) 0%, var(--secondary) 48%,
      #222 48%, #222 52%,
      #f4f4f4 52%, #f4f4f4 100%);
}

.profile-text {
  flex: 1;
  min-width: 240px;
}

.status {
  color: var(--primary);
  font-size: 12px;
  margin-bottom: 12px;
}

.about-text {
  color: var(--text-dim);
  margin-bottom: 16px;
  line-height: 1.7;
}

.inline-link {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px dotted var(--link);
  transition: all 0.15s ease;
  padding: 0 1px;
}

.inline-link:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
  background: rgba(0, 212, 255, 0.08);
}

.social-links {
  margin-top: 12px;
  font-size: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.social-link {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 2px dotted transparent;
  transition: all 0.15s;
  padding: 2px 4px;
}

.social-link:hover {
  color: var(--secondary);
  border-bottom-color: var(--secondary);
  transform: translateY(-2px);
}

.dot {
  color: var(--text-mute);
}

/* ============================================
   卡片区块
   ============================================ */
.card {
  background: var(--card-bg);
  border: 4px solid var(--border);
  padding: 24px 28px;
  margin-bottom: 28px;
  box-shadow: 6px 6px 0 rgba(0,0,0,0.4);
}

/* ============================================
   ★★★ 区块标题（已修复对齐） ★★★
   ============================================ */
.section-title {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  line-height: 1;
}

.title-main {
  font-size: 14px;
  color: var(--primary);
  line-height: 1;
  display: inline-block;
}

.title-links {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  top: 1px;
}

.title-link {
  color: var(--link);
  text-decoration: none;
  transition: all 0.15s;
  border-bottom: 1px dotted transparent;
  line-height: 1;
}

.title-link:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
  text-shadow: 0 0 6px var(--link-hover);
}

.card p {
  color: var(--text-dim);
}

/* ============================================
   论文列表
   ============================================ */
.paper-list { list-style: none; }

.paper-item {
  position: relative;
  padding: 16px 0 16px 36px;
  border-bottom: 1px dotted var(--border-soft);
  transition: transform 0.1s;
}

.paper-item:last-child { border-bottom: none; }

.paper-item::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 22px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    linear-gradient(to bottom,
      var(--secondary) 0%, var(--secondary) 45%,
      #222 45%, #222 55%,
      #f4f4f4 55%, #f4f4f4 100%);
  box-shadow: inset 0 0 0 2px #222;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.paper-item::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 28px;
  width: 6px;
  height: 6px;
  background: #fff;
  border: 2px solid #222;
  border-radius: 50%;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.paper-item:hover::before,
.paper-item:hover::after {
  opacity: 1;
}

.paper-item:hover::before {
  animation: pokeball-wiggle 0.5s ease-in-out;
}

@keyframes pokeball-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-15deg); }
  75%      { transform: rotate(15deg); }
}

.paper-title {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-weight: bold;
  font-size: 19px;
  line-height: 1.4;
  margin-bottom: 6px;
  transition: color 0.15s;
}

.paper-item:hover .paper-title {
  color: var(--primary);
}

.paper-meta {
  font-size: 17px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.paper-meta b {
  color: var(--link);
}

.venue {
  color: var(--text-mute);
  font-style: italic;
}

.venue-top {
  color: var(--primary);
  font-style: normal;
  font-weight: bold;
}

.paper-links {
  font-size: 16px;
}

.ext-link {
  color: var(--link);
  text-decoration: none;
  margin-right: 10px;
  transition: color 0.15s;
}

.ext-link:hover {
  color: var(--link-hover);
}

/* ============================================
   项目网格
   ============================================ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.project-item {
  border: 3px solid var(--border);
  padding: 16px;
  background: var(--card-bg-soft);
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}

.project-item:hover {
  border-color: var(--primary);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--primary);
}

.project-item h3 {
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 18px;
}

.project-item p {
  color: var(--text-dim);
  font-size: 17px;
}

/* ============================================
   活动列表
   ============================================ */
.activity-list {
  list-style: none;
}

.activity-list li {
  padding: 8px 0;
  color: var(--text-dim);
  font-size: 19px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.activity-arrow {
  color: var(--primary);
  font-size: 16px;
}

.activity-label {
  color: var(--primary);
  font-size: 11px;
  margin-right: 4px;
}

.activity-desc {
  color: var(--text-dim);
}

/* ============================================
   页脚
   ============================================ */
.footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 2px dashed var(--border);
  color: var(--text-mute);
}

.footer-note {
  margin-top: 8px;
  font-size: 16px;
}

/* ============================================
   角落跳动的精灵球
   ============================================ */
.floating-pokeball {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #222;
  background:
    linear-gradient(to bottom,
      var(--secondary) 0%, var(--secondary) 45%,
      #222 45%, #222 55%,
      #f4f4f4 55%, #f4f4f4 100%);
  z-index: 9999;
  animation: bounce-ball 1.6s infinite ease-in-out;
  cursor: pointer;
}

.floating-pokeball::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid #222;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

@keyframes bounce-ball {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-20px) rotate(180deg); }
}

/* ============================================
   ★★★ 卡比兽 ★★★
   ============================================ */
.snorlax-inline {
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  width: 100px;
  height: 90px;
  pointer-events: none;
  z-index: 5;
}

.snorlax {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 140px;
  height: 110px;
  transform: scale(0.7);
  transform-origin: bottom right;
  animation: snor-breathe 4s ease-in-out infinite;
}

@keyframes snor-breathe {
  0%, 100% { transform: scale(0.7) translateY(0); }
  50%      { transform: scale(0.71) translateY(-2px); }
}

.snor-shadow {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 8px;
  background: rgba(0,0,0,0.35);
  border-radius: 50%;
  filter: blur(1px);
  animation: snor-shadow-pulse 4s ease-in-out infinite;
}

@keyframes snor-shadow-pulse {
  0%, 100% { width: 130px; opacity: 0.35; }
  50%      { width: 124px; opacity: 0.28; }
}

.snor-body {
  position: absolute;
  bottom: 16px;
  left: 6px;
  width: 128px;
  height: 86px;
  background: var(--snor-body);
  border: 3px solid var(--snor-line);
  border-radius: 50% 50% 44% 44%;
  box-shadow:
    inset -10px -8px 0 -4px var(--snor-body-dark),
    inset 0 -3px 0 -1px rgba(0,0,0,0.15);
}

.snor-highlight {
  position: absolute;
  top: 8px;
  left: 14px;
  width: 22px;
  height: 14px;
  background: var(--snor-body-light);
  border-radius: 50%;
  opacity: 0.6;
}

.snor-belly {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 84px;
  height: 52px;
  background: var(--snor-cream);
  border: 3px solid var(--snor-line);
  border-radius: 50% 50% 45% 45%;
  border-bottom: none;
  box-shadow:
    inset -6px -4px 0 -3px var(--snor-cream-dark),
    inset 4px 4px 0 -3px rgba(255,255,255,0.4);
}

.snor-ear {
  position: absolute;
  top: 6px;
  width: 18px;
  height: 18px;
  background: var(--snor-body);
  border: 3px solid var(--snor-line);
  border-radius: 60% 60% 30% 30%;
  z-index: 1;
  box-shadow: inset -3px -2px 0 -1px var(--snor-body-dark);
}

.snor-ear-left  { left: 22px; transform: rotate(-30deg); }
.snor-ear-right { right: 22px; transform: rotate(30deg); }

.snor-eye {
  position: absolute;
  top: 22px;
  width: 16px;
  height: 9px;
  border: 3px solid var(--snor-line);
  border-color: transparent transparent var(--snor-line) transparent;
  border-radius: 0 0 60% 60% / 0 0 100% 100%;
  background: transparent;
}

.snor-eye::before {
  content: "";
  position: absolute;
  top: -7px;
  left: -3px;
  width: 16px;
  height: 4px;
  border-top: 2px solid rgba(26,26,46,0.5);
  border-radius: 100% 100% 0 0;
}

.snor-eye-left  { left: 30px; }
.snor-eye-right { right: 30px; }

.snor-blush {
  position: absolute;
  top: 32px;
  width: 10px;
  height: 5px;
  background: rgba(232, 128, 144, 0.5);
  border-radius: 50%;
}
.snor-blush-left  { left: 28px; }
.snor-blush-right { right: 28px; }

.snor-mouth {
  position: absolute;
  top: 42px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 10px;
  background: #2a1820;
  border: 2px solid var(--snor-line);
  border-radius: 30% 30% 60% 60%;
  overflow: hidden;
}

.snor-tongue {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 5px;
  background: #e88090;
  border-radius: 50% 50% 0 0;
}

.snor-arm {
  position: absolute;
  bottom: 18px;
  width: 18px;
  height: 24px;
  background: var(--snor-body);
  border: 3px solid var(--snor-line);
  border-radius: 50% 50% 35% 35%;
  z-index: 2;
  box-shadow: inset -3px -3px 0 -2px var(--snor-body-dark);
}

.snor-arm-left  { left: -3px;  transform: rotate(18deg); }
.snor-arm-right { right: -3px; transform: rotate(-18deg); }

.snor-claw {
  position: absolute;
  bottom: 0;
  width: 4px;
  height: 6px;
  background: var(--snor-cream);
  border: 1.5px solid var(--snor-line);
  border-radius: 0 0 50% 50%;
  border-top: none;
}

.snor-arm-left .snor-claw:nth-child(1)  { left: 1px; }
.snor-arm-left .snor-claw:nth-child(2)  { left: 6px; }
.snor-arm-left .snor-claw:nth-child(3)  { left: 11px; }
.snor-arm-right .snor-claw:nth-child(1) { right: 11px; }
.snor-arm-right .snor-claw:nth-child(2) { right: 6px; }
.snor-arm-right .snor-claw:nth-child(3) { right: 1px; }

.snor-foot {
  position: absolute;
  bottom: 0;
  width: 46px;
  height: 24px;
  background: var(--snor-body);
  border: 3px solid var(--snor-line);
  border-radius: 35% 35% 40% 40%;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 0 4px 4px;
  box-shadow: inset -4px -3px 0 -2px var(--snor-body-dark);
}

.snor-foot-left  { left: 10px; }
.snor-foot-right { right: 10px; }

.snor-toe {
  width: 7px;
  height: 9px;
  background: var(--snor-cream);
  border: 2px solid var(--snor-line);
  border-radius: 30% 30% 50% 50%;
  box-shadow: inset -1px -1px 0 0 var(--snor-cream-dark);
}

.zzz {
  position: absolute;
  font-family: 'Press Start 2P', monospace;
  color: #d6e4f5;
  text-shadow: 2px 2px 0 var(--snor-line);
  opacity: 0;
  z-index: 10;
}

.zzz-1 { top: 18px; right: -4px; font-size: 14px; animation: zzz-float 3s ease-in-out infinite; animation-delay: 0s; }
.zzz-2 { top: 6px;  right: 8px;  font-size: 11px; animation: zzz-float 3s ease-in-out infinite; animation-delay: 1s; }
.zzz-3 { top: -4px; right: 18px; font-size: 9px;  animation: zzz-float 3s ease-in-out infinite; animation-delay: 2s; }

@keyframes zzz-float {
  0%   { opacity: 0; transform: translate(0, 8px) rotate(-10deg); }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translate(14px, -18px) rotate(15deg); }
}

/* ============================================
   Trips & Talks 子页面专用
   ============================================ */
.back-link {
  display: inline-block;
  color: var(--primary);
  text-decoration: none;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  margin-bottom: 24px;
  padding: 8px 14px;
  border: 2px solid var(--primary);
  background: var(--card-bg);
  transition: all 0.15s;
}

.back-link:hover {
  background: var(--primary);
  color: var(--bg-color);
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--accent);
}

.trip-list {
  list-style: none;
  padding-left: 0;
}

.trip-list > li {
  position: relative;
  padding: 10px 0 10px 26px;
  color: var(--text-dim);
  font-size: 19px;
  line-height: 1.6;
  border-bottom: 1px dotted var(--border-soft);
}

.trip-list > li:last-child { border-bottom: none; }

.trip-list > li::before {
  content: "▸";
  position: absolute;
  left: 4px;
  top: 12px;
  color: var(--primary);
  font-size: 14px;
}

.talk-block {
  margin-bottom: 22px;
  padding: 14px 16px;
  background: var(--card-bg-soft);
  border-left: 3px solid var(--link);
}

.talk-title {
  color: var(--text);
  font-weight: bold;
  font-size: 19px;
  margin-bottom: 8px;
}

.talk-venues {
  list-style: none;
  padding-left: 0;
}

.talk-venues li {
  position: relative;
  padding: 4px 0 4px 22px;
  color: var(--text-dim);
  font-size: 17px;
}

.talk-venues li::before {
  content: "♦";
  position: absolute;
  left: 4px;
  top: 4px;
  color: var(--primary);
  font-size: 12px;
}

.talk-date {
  color: var(--primary);
  font-weight: bold;
}

/* ============================================
   响应式
   ============================================ */
@media (max-width: 700px) {
  .dialog-box { padding-right: 100px; }
  .snorlax-inline { width: 78px; height: 70px; right: 10px; }
  .snorlax { transform: scale(0.55); }
  @keyframes snor-breathe {
    0%, 100% { transform: scale(0.55) translateY(0); }
    50%      { transform: scale(0.56) translateY(-2px); }
  }

  /* ★ 移动端：让顶部标题自动换行，避免被卡比兽覆盖 */
  .typewriter {
    white-space: normal;
    overflow: visible;
    width: auto;
    border-right: none;
    word-break: break-word;
    animation: typewriter-fade 0.6s ease-in forwards,
               blink-caret 0.75s step-end infinite;
    display: inline-block;
    padding-right: 6px;
    /* 用 right border 模拟光标，配合 blink-caret */
    border-right: 3px solid var(--primary);
  }
}

@media (max-width: 500px) {
  body { font-size: 18px; }
  .typewriter {
    font-size: 13px;
    /* 继承 700px 断点中已经设置的 white-space:normal 等，这里只调字号 */
  }
  .title-main { font-size: 12px; }
  .title-links { font-size: 8px; }
  .container { padding: 20px 14px 60px; }
  .profile { gap: 20px; justify-content: center; }
  .dialog-box { padding: 18px 70px 18px 18px; min-height: 80px; }
  .snorlax-inline { width: 60px; height: 56px; right: 6px; }
  .snorlax { transform: scale(0.42); }
  @keyframes snor-breathe {
    0%, 100% { transform: scale(0.42) translateY(0); }
    50%      { transform: scale(0.43) translateY(-1px); }
  }

  /* 小屏幕的占位精灵球缩小一点 */
  .avatar-frame::before {
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
  }
}