/* CSS变量定义 - 深色模式 */
:root {
  --red: #ff4757; /* 保持不变 */
  --white: #1a1a1a; /* 深色背景 */
  --blue: #4a9eff; /* 调整为更亮的蓝色 */
  --green: #2ed573; /* 保持不变 */
  --yellow: #ffa502; /* 保持不变 */
  --purple: #8b5cf6; /* 调整为更亮的紫色 */
  --pink: #ff6b81; /* 保持不变 */
  --cyan: #00d2d3; /* 保持不变 */
  --text-primary: #ffffff; /* 主要文字颜色 */
  --text-secondary: #b0b0b0; /* 次要文字颜色 */
  --bg-card: #2a2a2a; /* 卡片背景 */
  --bg-hover: #3a3a3a; /* 悬停背景 */
}

/* 基础样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 页面主体样式 */
body {
  margin: 0;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f0f0f 100%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  color: var(--text-primary);
}

/* 标题和基础元素 */
h1 {
  text-align: center;
  color: var(--text-primary);
  font-size: 2.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
  margin-bottom: 1rem;
  position: relative;
  z-index: 10;
}

hr {
  border: none;
  height: 2px;
  background: rgba(255,255,255,0.2);
  margin: 2rem 0;
  position: relative;
  z-index: 10;
}

img {
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  border-radius: 50%;
  position: relative;
  z-index: 10;
  border: 2px solid rgba(255,255,255,0.1);
}
.back-button {
  text-decoration: none;
  display: inline-block;
  margin: 2rem auto;
  text-align: center;
}

.square {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  background-color: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 15px rgba(255, 71, 87, 0.2);
}

.square:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(255, 71, 87, 0.4);
  background-color: #ff6b6b;
}

.back-icon {
  width: 28px;
  height: 28px;
  color: white;
  transition: transform 0.3s ease;
}

/* 工具提示 */
.square::after {
  content: '返回班级网站';
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.square:hover::after {
  opacity: 1;
  bottom: -40px;
}
/* 链接样式 */
a {
  color: white;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  z-index: 10;
}

a:hover {
  transform: translateY(-2px);
  text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.header-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  margin-bottom: 2rem;
  position: relative;
  z-index: 10;
}

.header-content {
  flex: 0 1 auto;
  max-width: 60%;
  text-align: right; /* 文字右对齐，贴着图片 */
  margin-right: 2rem; /* 与图片的间距 */
  order: 1; /* 文字在左边 */
}

.header-intro {
  text-align: right; /* 整体右对齐 */
  margin: 1.5rem 0;
  position: relative;
  z-index: 10;
}

.header-image {
  flex: 0 0 auto;
  order: 2; /* 图片在最右边 */
}

/* 响应式调整：移动端恢复垂直布局 */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }

  .header-content {
    max-width: 100%;
    text-align: center; /* 移动端居中 */
    margin-right: 0;
  }

  .header-intro {
    text-align: center; /* 移动端居中 */
    margin: 1.2rem 0;
  }

  .header-image {
    order: 1; /* 移动端图片在下方 */
    margin-top: 1.5rem;
  }

  .header-content {
    order: 0; /* 移动端文字在上方 */
  }
}

/* 背景动画样式 - 深色模式 */
.background-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.layered-animations {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.75);
  width: 16rem;
  height: 16rem;
}

.layered-animations .shape {
  position: absolute;
  overflow: visible;
  width: 8rem;
  height: 8rem;
  stroke: currentColor;
  fill: transparent;
  opacity: 0.4;
  color: var(--red);
}

.layered-animations .small.shape {
  width: 1.5rem;
  height: 1.5rem;
  stroke: currentColor;
  stroke-width: 2px;
  fill: currentColor;
  opacity: 0.3;
  color: rgba(255, 255, 255, 0.6);
}

/* Section 基础样式 - 深色模式 */
section {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 100lvh;
  border-top: 1px dotted rgba(255, 71, 87, 0.3);
  border-bottom: 1px dotted rgba(255, 71, 87, 0.3);
  position: relative;
  z-index: 5;
}

section.spacer {
  min-height: 50lvh;
  border: none;
}

/* Sticky Container - 来自 onScroll responsive scope */
.sticky-container {
  margin-top: 0;
  align-items: flex-start;
  height: 200lvh;
  position: relative;
  z-index: 5;
}

.sticky-content {
  perspective: 1000px;
  perspective-origin: 50%;
  transform-style: preserve-3d;
  position: sticky;
  top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100lvh;
  width: 100%;
}

/* Stack - 卡牌堆叠区域 */
.stack {
  --w: 22.5vh;
  --h: 30vh;
  position: relative;
  flex-grow: 0;
  flex-shrink: 0;
  transform-style: preserve-3d;
  width: var(--w);
  height: var(--h);
  will-change: transform;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Card 样式 */
.card {
  transform-style: preserve-3d;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  margin-left: -50%;
  margin-top: -50%;
  border-radius: 1rem;
  transform-origin: center center;
  box-shadow: 0 .125em .75em 1px rgba(0,0,0,.05),
              0 0 .125em 1px rgba(0,0,0,.1);
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  z-index: 1;
  backface-visibility: hidden;
}


.card:nth-child(1) { z-index: 20; }
.card:nth-child(2) { z-index: 19; }
.card:nth-child(3) { z-index: 18; }
.card:nth-child(4) { z-index: 17; }
.card:nth-child(5) { z-index: 16; }
.card:nth-child(6) { z-index: 15; }
.card:nth-child(7) { z-index: 14; }
.card:nth-child(8) { z-index: 13; }
.card:nth-child(9) { z-index: 12; }
.card:nth-child(10) { z-index: 11; }

.card:hover {
  box-shadow: 0 .25em 1.5em 2px rgba(0,0,0,.15),
              0 0 .25em 2px rgba(0,0,0,.2);
  transform: translateY(-5px);
}

.card > div {
  transform-style: preserve-3d;
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-position: center;
  border-radius: inherit;
  display: flex;
  justify-content: center;
  align-items: center;
}

.back {
  z-index: 0;
  background-image: url(https://assets.codepen.io/1137/card-back.svg);
  transform: rotateY(180deg);
  background-color: var(--red);
  background-size: 89%;
  background-repeat: no-repeat;
}

.front {
  z-index: 1;
  backface-visibility: hidden;
  background-image: url(card.svg);
  /* background-color: var(--bg-card); */
  color: #1a1a1a;
  padding: 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}

.front::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: rotate(45deg);
  transition: all 0.5s ease;
  opacity: 0;
}

.card:hover .front::before {
  animation: shimmer 0.5s ease;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(45deg);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(45deg);
    opacity: 0;
  }
}

.front h3 {
  margin: 0;
  font-size: clamp(0.9rem, 2.5vw, 1.3rem);
  font-weight: 600;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  z-index: 1;
  position: relative;
}

/* Footer 链接 - 深色模式 */
body > p:last-child {
  text-align: center;
  margin-top: 3rem;
  position: relative;
  z-index: 10;
}

body > p:last-child a {
  background: rgba(255,255,255,0.1);
  padding: 0.5rem 1rem;
  border-radius: 25px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text-primary);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .stack {
    --w: 18vh;
    --h: 24vh;
    width: var(--w);
    height: var(--h);
  }

  .layered-animations {
    transform: translate(-50%, -50%) scale(1.2);
  }

  .front h3 {
    font-size: 0.8rem;
  }

  h1 {
    font-size: 2rem;
  }
}

@media (orientation: landscape) {
  .layered-animations {
    transform: translate(-50%, -50%) scale(2);
  }
}

/* 动画状态类 */
.card.animating {
  transition: none;
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 加载动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1, img, body > p:last-child {
  animation: fadeInUp 0.8s ease forwards;
}

img {
  animation-delay: 0.2s;
}

body > p:last-child {
  animation-delay: 0.4s;
}

/* 额外的视觉增强 - 深色模式 */
.background-animation::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.3) 100%);
  pointer-events: none;
}
.header-intro {
  text-align: center;
  margin: 1.5rem 0;
  position: relative;
  z-index: 10;
}

.tagline {
  color: var(--text-secondary);
  font-size: 1.2rem;
  margin-bottom: 1.2rem;
  opacity: 0.9;
}

.typing-container {
  font-family: 'Consolas', 'Monaco', 'Courier New', ui-monospace, monospace;
  font-size: 1rem;
  color: var(--text-primary);
  min-height: 3em;
  margin-top: 1rem;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
  line-height: 1.6;
  background: linear-gradient(135deg, rgba(30, 30, 30, 0.9), rgba(40, 40, 40, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  position: relative;
  backdrop-filter: blur(10px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

/* 代码块装饰 */
.typing-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    var(--red) 0%,
    var(--blue) 25%,
    var(--green) 50%,
    var(--yellow) 75%,
    var(--purple) 100%);
  opacity: 0.8;
}

.typing-container::after {
  content: '// ';
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  color: var(--red);
  font-weight: bold;
  opacity: 0.6;
  font-size: 0.9rem;
  z-index: 1;
}

/* 调整文字位置以避免与装饰重叠 */
.typing-text {
  display: block;
  margin-left: 2rem;
  vertical-align: top;
  overflow: visible;
}

.typing-text h2 {
  color: var(--blue);
  font-size: 1.3rem;
  margin: 0.8rem 0;
  font-weight: 600;
  border-left: 3px solid var(--blue);
  padding-left: 0.8rem;
}

.typing-text h3 {
  color: var(--purple);
  font-size: 1.1rem;
  margin: 0.6rem 0;
  font-weight: 500;
  border-left: 2px solid var(--purple);
  padding-left: 0.6rem;
}

.typing-text p {
  margin: 0.4rem 0;
  line-height: 1.6;
}

.typing-text strong {
  color: var(--red);
  font-weight: 600;
}

.typing-text em {
  color: var(--green);
  font-style: italic;
}

.typing-text code {
  background: rgba(0,0,0,0.3);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: inherit;
  color: var(--blue);
  border: 1px solid rgba(255,255,255,0.15);
  font-weight: 500;
}

.typing-text .highlight {
  background: linear-gradient(120deg, transparent 0%, rgba(255, 71, 87, 0.2) 50%, transparent 100%);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 71, 87, 0.3);
}

.cursor {
  display: inline-block;
  width: 3px;
  height: 1.3em;
  background-color: var(--red);
  animation: blink 1s infinite;
  vertical-align: text-bottom;
  margin-left: 2px;
  border-radius: 1px;
  box-shadow: 0 0 6px rgba(255, 71, 87, 0.5);
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 6px rgba(255, 71, 87, 0.5);
  }
  50% {
    opacity: 0.3;
    box-shadow: 0 0 2px rgba(255, 71, 87, 0.3);
  }
}
