/* 现代风格主样式表 */
:root {
  --primary: #2ecc71;
  --secondary: #3498db;
  --accent: #e74c3c;
  --dark: #2c3e50;
  --light: #ecf0f1;
  --bg-color: #0f172a;
  --secondary-bg: #1e293b;
  --text-color: #e2e8f0;
  --text-muted: #94a3b8;
  --accent-color: #60a5fa;
  --border-color: #334155;
  --light-gray: #f3f4f6;
  --hover-color: #2563eb;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background: var(--bg-color);
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem;
}

header {
  padding: 2rem 0;
}

nav {
  display: flex;
  gap: 2rem;
  justify-content: flex-end;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  position: relative;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-color);
  transition: width 0.3s ease;
}

nav a:hover::after {
  width: 100%;
}

section {
  margin: 6rem 0;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--secondary-bg);
  border-radius: 1rem;
  font-size: 0.8rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

h1 {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
  color: var(--text-color);
}

h2 {
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  letter-spacing: -0.025em;
  color: var(--text-color);
}

h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

p {
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.divider {
  height: 1px;
  background: var(--border-color);
  margin: 2rem 0;
  width: 2rem;
}

.timeline {
  margin-top: 2rem;
}

.timeline-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  border-left: 2px solid var(--border-color);
  padding-left: 1rem;
  margin-left: 0.5rem;
}

.year {
  color: var(--accent-color);
  font-weight: 500;
  min-width: 4rem;
}

.event {
  color: var(--text-muted);
}

.skills-grid {
  display: grid;
  gap: 1.5rem;
}

.skill-bar {
  height: 4px;
  background: var(--secondary-bg);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.skill-bar div {
  height: 100%;
  background: var(--accent-color);
  border-radius: 2px;
}

.contact-info {
  display: flex;
  gap: 2rem;
}

.contact-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

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

footer {
  margin-top: 6rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
}

footer p {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

footer small {
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  body {
    padding: 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  section {
    margin: 4rem 0;
  }

  .timeline-item {
    flex-direction: column;
    gap: 0.25rem;
  }

  .year {
    min-width: auto;
  }
}

#particles {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
}

.floating-nav {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 1.5rem;
  z-index: 100;
}

.nav-item {
  width: 50px;
  height: 50px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  display: grid;
  place-items: center;
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}

.nav-item:hover {
  transform: translateY(-5px) scale(1.2);
  background: var(--primary);
}

.parallax-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  padding: 4rem 10%;
}

.profile-card {
  perspective: 1000px;
  min-height: 400px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s;
}

.profile-card:hover .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 2rem;
  backdrop-filter: blur(10px);
  display: grid;
  place-content: center;
  text-align: center;
}

.card-back {
  transform: rotateY(180deg);
  background: rgba(0,0,0,0.6);
}

.glitched-text {
  position: relative;
  font-size: 2.5rem;
  text-shadow: 3px 3px 0 var(--accent);
}

.glitched-text::before,
.glitched-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
}

.glitched-text::before {
  left: 2px;
  text-shadow: -3px 0 cyan;
  animation: glitch-1 2s infinite;
}

.glitched-text::after {
  left: -2px;
  text-shadow: 3px 0 magenta;
  animation: glitch-2 2s infinite;
}

@keyframes glitch-1 {
  0% { clip-path: inset(20% 0 30% 0) }
  100% { clip-path: inset(10% 0 40% 0) }
}

@keyframes glitch-2 {
  0% { clip-path: inset(40% 0 10% 0) }
  100% { clip-path: inset(30% 0 20% 0) }
}

.gallery-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  padding: 2rem;
}

.project-item {
  position: relative;
  height: 300px;
  border-radius: 15px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.project-item:hover {
  transform: translateY(-10px);
}

.project-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.9));
  padding: 1.5rem;
  color: white;
}

@keyframes rotateBadge {
  100% { transform: rotate(360deg); }
}

.experience-badge {
  position: absolute;
  top: -15px;
  right: -15px;
  width: 60px;
  height: 60px;
  background: var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  animation: rotateBadge 20s linear infinite;
  box-shadow: 0 0 15px rgba(231,76,60,0.5);
}

.skill-chart {
  display: grid;
  gap: 1.5rem;
  padding: 2rem;
}

.chart-item {
  position: relative;
  height: 40px;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  overflow: hidden;
}

.chart-progress {
  height: 100%;
  background: var(--primary);
  width: 0;
  transition: width 1s ease-out;
}

.project-grid {
  display: grid;
}

.skill {
  background: var(--secondary-bg);
  padding: 1rem;
  border-radius: 0.5rem;
}

.skill:hover {
  box-shadow: 0 0 20px rgba(96, 165, 250, 0.1);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.project-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
}

.project-card h3 {
  color: #333;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.project-card p {
  color: #666;
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tech-tag {
  background: #f0f0f0;
  color: #444;
  padding: 0.25rem 0.75rem;
  border-radius: 15px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.tech-tag:hover {
  background: #e0e0e0;
}

/* 游戏区域样式 */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.game-card {
    background: var(--secondary-bg);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-5px);
}

.play-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 1rem;
}

.play-btn:hover {
    background: var(--hover-color);
}

/* 游戏弹窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-color);
    padding: 2rem;
    border-radius: 16px;
    position: relative;
    max-width: 90%;
    width: fit-content;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: var(--text-color);
}

.game-container {
    margin-top: 1rem;
}

#snakeCanvas {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.start-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.start-btn:hover {
    background: var(--hover-color);
}

@media (max-width: 640px) {
    .modal-content {
        padding: 1rem;
        width: 95%;
    }

    #snakeCanvas {
        width: 100%;
        height: auto;
    }
}

/* 移动端控制按钮样式 */
.mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    pointer-events: none;
}

.controls-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    pointer-events: all;
}

.control-btn {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 25px;
    background: rgba(96, 165, 250, 0.5);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(5px);
}

.control-btn:active {
    transform: scale(0.95);
    background: rgba(96, 165, 250, 0.7);
}

/* 移动端适配 */
@media (max-width: 640px) {
    .mobile-controls {
        display: flex;
    }
}

/* 排行榜样式 */
.leaderboard {
    margin-top: 2rem;
    background: var(--secondary-bg);
    border-radius: 12px;
    padding: 1rem;
}

.leaderboard h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
    text-align: center;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.leaderboard-item {
    display: grid;
    grid-template-columns: 40px 1fr 80px;
    align-items: center;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.leaderboard-item .rank {
    color: var(--accent-color);
    font-weight: 600;
    text-align: center;
}

.leaderboard-item .name {
    color: var(--text-color);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 0.5rem;
}

.leaderboard-item .score {
    color: var(--text-muted);
    text-align: right;
}

/* 前三名特殊样式 */
.leaderboard-item:nth-child(1) .rank {
    color: gold;
}

.leaderboard-item:nth-child(2) .rank {
    color: silver;
}

.leaderboard-item:nth-child(3) .rank {
    color: #cd7f32;
}

/* 调整游戏信息布局 */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--secondary-bg);
    border-radius: 8px;
}

.game-info p {
    margin: 0;
    color: var(--text-color);
}

.game-info p:last-child {
    margin-top: 0.5rem;
}

/* 移动端适配 */
@media (max-width: 640px) {
    .leaderboard-item {
        grid-template-columns: 30px 1fr 60px;
        font-size: 0.9rem;
    }

    .game-info {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* 俄罗斯方块样式 */
.tetris-container {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.tetris-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.next-piece {
    background: var(--secondary-bg);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.next-piece h3 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

#tetrisCanvas {
    background: #1a1a1a;
    border-radius: 8px;
}

#nextPieceCanvas {
    background: #1a1a1a;
    border-radius: 4px;
}

/* 连连看样式 */
.link-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.link-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--secondary-bg);
    border-radius: 8px;
}

#linkCanvas {
    background: #1a1a1a;
    border-radius: 8px;
}

/* 游戏控制按钮样式增强 */
.tetris-controls .control-btn {
    min-width: 60px;
}

.tetris-controls .controls-row:last-child .control-btn {
    width: 120px;
}

/* 移动端适配增强 */
@media (max-width: 768px) {
    .tetris-container {
        flex-direction: column;
    }

    .tetris-info {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    #tetrisCanvas, #linkCanvas {
        width: 100%;
        height: auto;
    }

    .next-piece {
        width: 100%;
    }

    .link-info {
        flex-direction: column;
        gap: 1rem;
    }
}

/* 3D模型查看器样式 */
.model-viewer {
    margin-top: 1rem;
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.model-viewer:hover {
    transform: translateY(-5px);
}

.model-viewer iframe {
    display: block;
    width: 100%;
    height: 300px;
    border: none;
}

/* 调整技能卡片样式以适应3D模型 */
.skill {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.skill:hover {
    transform: translateY(-5px);
}