:root {
  --primary: #FF6B6B;
  --secondary: #4ECDC4;
  --accent: #FFE66D;
  --info: #1A535C;
  --background: #F7FFF7;
  --text: #2F4858;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background);
  background-image: url('data:image/svg+xml,%3Csvg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z" fill="%23d1d9ff" fill-opacity="0.3" fill-rule="evenodd"/%3E%3C/svg%3E');
  color: var(--text);
  line-height: 1.6;
  scroll-behavior: smooth;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

@media (max-width: 768px) {
  .container {
    padding: 0 15px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }
}

header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 20px 0;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo i {
  font-size: 2rem;
}

.logo h1 {
  font-size: 1.5rem;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 30px;
}

nav a {
  color: white;
  text-decoration: none;
  font-weight: bold;
  padding: 5px 10px;
  border-radius: 20px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

.mobile-menu {
  display: none;
  margin-top: 20px;
}

.mobile-menu.active {
  display: block;
}

.mobile-menu ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.hero {
  background: linear-gradient(135deg, var(--accent), var(--background));
  padding: 40px 0;
  text-align: center;
}

.topdiv {
  width: 100%;
  background-image: linear-gradient(to top, rgba(0, 0, 0, 0.3), rgba(255, 255, 255, 0.5)), url('../image/topbj.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  margin-bottom: 20px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  min-height: 300px;
  padding: 20px;
}

.hero h2 {
  font-size: 2.5rem;
  color: white;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* 头像和标题的响应式布局 */
.topdiv > div {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  max-width: 70%;
}

.topdiv img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 20px;
  flex-shrink: 0;
  border: 1px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.topdiv .top-title {
  margin: 0;
  flex-shrink: 1;
  min-width: 0;
  word-wrap: break-word;
  white-space: normal;
  font-size: 2.5rem;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  font-weight: bold;
  font-family: 'Comic Sans MS', '微软雅黑', sans-serif;
  text-align: left;
}

.topdiv .douyin-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 5px 0 0 0;
}

.topdiv .douyin-id {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  font-family: 'Comic Sans MS', '微软雅黑', sans-serif;
  flex-shrink: 1;
}

.topdiv .douyin-qr-container {
  position: relative;
  flex-shrink: 0;
}

.topdiv .qr-code-icon {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.topdiv .qr-code-icon:hover {
  background-color: rgba(0, 0, 0, 0.4);
  transform: scale(1.1);
}

.topdiv .qr-code-popup {
  position: absolute;
  top: -200px;
  right: -10px;
  background-color: white;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10;
  display: none;
  min-width: 200px;
  text-align: center;
}

.topdiv .qr-code-popup img {
  width: 180px;
  height: 180px;
  object-fit: contain;
}

/* 媒体查询 - 进一步调整标题大小 */
@media (max-width: 768px) {
  .topdiv .top-title {
    font-size: 2rem;
  }
  .topdiv .douyin-id {
    font-size: 0.9rem;
  }
  .topdiv .qr-code-icon {
    font-size: 1rem;
  }
  .topdiv .qr-code-popup {
    top: -180px;
    min-width: 180px;
  }
  .topdiv .qr-code-popup img {
    width: 160px;
    height: 160px;
  }
}

@media (max-width: 600px) {
  .topdiv .top-title {
    font-size: 1.1rem;
  }
  .topdiv .douyin-id {
    font-size: 0.8rem;
  }
  .topdiv .qr-code-icon {
    font-size: 0.9rem;
  }
  .topdiv .qr-code-popup {
    top: -160px;
    min-width: 160px;
  }
  .topdiv .qr-code-popup img {
    width: 140px;
    height: 140px;
  }
}

@media (max-width: 400px) {
  .topdiv .top-title {
    font-size: 0.9rem;
  }
  .topdiv .douyin-id {
    font-size: 0.7rem;
  }
  .topdiv .qr-code-icon {
    font-size: 0.8rem;
  }
  .topdiv .qr-code-popup {
    top: -140px;
    min-width: 140px;
  }
  .topdiv .qr-code-popup img {
    width: 120px;
    height: 120px;
  }
}

/* 媒体查询 - 调整大小 */
@media (max-width: 768px) {
  .topdiv > div {
    max-width: 80%;
  }
  
  .topdiv img {
    width: 100px;
    height: 100px;
    margin-right: 15px;
  }
  
  .topdiv h2 {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .topdiv > div {
    max-width: 90%;
  }
  
  .topdiv img {
    width: 80px;
    height: 80px;
    margin-right: 10px;
  }
  
  .topdiv h2 {
    font-size: 1.5rem;
  }
}

.hero p {
  font-size: 1.3rem;
  line-height: 1.8;
  margin-bottom: 30px;
  text-align: left;
  color: #555;
  font-family: '微软雅黑', '宋体', sans-serif;
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn {
  display: inline-block;
  padding: 12px 30px;
  border-radius: 30px;
  text-decoration: none;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  margin-right: 15px;
}

.games-section {
  padding: 60px 0;
}

.section-title {
  text-align: center;
  font-size: 2rem;
  color: var(--info);
  margin-bottom: 40px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
}

@media (min-width: 768px) {
  .games-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
  }
}

@media (min-width: 1024px) {
  .games-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 35px;
  }
}

.game-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  border: 2px solid #f0f0f0;
  transition: transform 0.2s ease;
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
  transform: translateY(20px);
}

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

/* 学科类别颜色 */
.subject-math {
  color: #4a86e8;
  font-weight: bold;
}

.subject-chinese {
  color: #e84a4a;
  font-weight: bold;
}

.subject-english {
  color: #4ae84a;
  font-weight: bold;
}

.subject-other {
  color: #999;
  font-weight: bold;
}

.game-image {
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  aspect-ratio: 1/1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.game-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-content {
  padding: 20px;
}

.game-title {
  font-size: 1.4rem;
  color: var(--info);
  margin-bottom: 12px;
  font-family: 'Comic Sans MS', '微软雅黑', sans-serif;
  font-weight: bold;
  line-height: 1.4;
}

.game-description {
  color: #666;
  margin-bottom: 18px;
  font-size: 1rem;
  line-height: 1.8;
  font-family: '微软雅黑', sans-serif;
}

.game-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 15px;
}

.qr-code-container {
  position: relative;
}

.qr-code-btn {
  background-color: var(--info);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.qr-code-btn:active {
  transform: scale(0.9);
}

.qr-code-popup {
  position: absolute;
  top: -180px;
  background-color: white;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10;
  display: none;
  min-width: 180px;
  text-align: center;
  white-space: nowrap;
}

.qr-code-popup.active {
  display: block;
}

.qr-code-image img {
  width: 150px;
  height: 150px;
}

.qr-code-popup p {
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--info);
}

.btn-play {
  background-color: var(--primary);
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  text-decoration: none;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.1s ease;
}

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

.about-section {
  padding: 60px 0;
  background: linear-gradient(135deg, var(--secondary), var(--accent));
}

.about-content {
  display: flex;
  align-items: center;
  gap: 50px;
  flex-wrap: wrap;
  justify-content: center;
}

.about-logo {
  width: 150px;
  height: 150px;
  background-color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.about-logo i {
  font-size: 4rem;
  color: var(--info);
}

.about-text {
  flex: 1;
  min-width: 300px;
}

.about-text h3 {
  font-size: 1.8rem;
  color: var(--info);
  margin-bottom: 15px;
}

.about-text p {
  margin-bottom: 15px;
  color: var(--info);
}

footer {
  background-color: var(--info);
  color: white;
  padding: 30px 0;
  text-align: center;
}

.loading {
  text-align: center;
  padding: 40px;
  font-size: 1.2rem;
  color: var(--info);
}

@media (max-width: 768px) {
  nav {
    display: none;
  }
  
  .mobile-menu-btn {
    display: block;
  }
  
  .logo h1 {
    font-size: 1.2rem;
  }
  
  .hero h2 {
    font-size: 1.8rem;
  }
  
  .hero-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
  }
  
  .btn-primary {
    margin-right: 0;
  }
  
  .games-grid {
    grid-template-columns: 1fr;
  }
  
  .about-content {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .game-footer {
    flex-direction: row;
    gap: 10px;
  }
  
  .qr-code-container {
    align-self: center;
  }
}
