/* ===================================
   闽味元宵 · 食趣配对 - Claymorphism Style
   Playful, Cartoon-like Game UI
   =================================== */

:root {
  /* 黏土风主题配色 */
  --primary-red: #e63946; /* 玩味红 */
  --primary-gold: #f4a236; /* 暖金色 */
  --secondary-red: #c1121f; /* 深红 */
  --warm-yellow: #ffd166; /* 明亮黄 */
  --cream: #fff8f0; /* 奶油白 */
  --dark-text: #2b2d42; /* 深色文字 */
  --light-bg: #f8efdc; /* 浅色背景 */
  --card-cream: #fff5eb; /* 卡片背景 */

  /* 黏土风配色 - 糖果色 */
  --candy-pink: #ff8fa3;
  --candy-orange: #ff9f43;
  --candy-yellow: #feca57;
  --candy-green: #5ad45a;
  --candy-blue: #54a0ff;

  /* 尺寸 - 更圆润 */
  --card-height: 200px;
  --card-gap: 16px;
  --border-radius: 20px;
  --border-thick: 4px;

  /* 动画 */
  --transition-fast: 0.2s ease-out;
  --transition-normal: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Source Sans 3", "Microsoft YaHei", sans-serif;
  background: url("../i/bg.png") repeat var(--light-bg);
  background-size: 800px;
  min-height: 100vh;
  color: var(--dark-text);
  overflow-x: hidden;
}

/* Banner Wrapper - Festival Lantern Style */
.banner-wrapper {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  background: transparent;
  padding: 40px 20px 30px;
  position: relative;
  overflow: visible;
}

/* Decorative lantern strings on sides */
.banner-wrapper::before,
.banner-wrapper::after {
  content: "";
  position: absolute;
  top: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #c41e3a 0%, #e63946 50%, #c41e3a 100%);
  border-radius: 2px;
  box-shadow: 0 4px 8px rgba(196, 30, 58, 0.4);
}

.banner-wrapper::before {
  left: 30px;
}

.banner-wrapper::after {
  right: 30px;
}

/* Lantern ornament dots */
.banner-wrapper::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 26px;
  width: 12px;
  height: 12px;
  background: radial-gradient(circle, #ffd700 0%, #f4a236 50%, #c41e3a 100%);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

.banner-wrapper::after {
  content: "";
  position: absolute;
  top: -8px;
  right: 26px;
  width: 12px;
  height: 12px;
  background: radial-gradient(circle, #ffd700 0%, #f4a236 50%, #c41e3a 100%);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

/* Banner Title - Playful Claymorphism Game Style */
.banner-title {
  text-align: center;
  margin: 0;
  position: relative;
  z-index: 1;
  width: 100%;
}

/* English title - Enhanced 3D claymorphism style */
.banner-title .title-en {
  display: inline-block;
  font-family: "Lilita One", cursive;
  font-size: 2.9rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 4px;
  position: relative;
  /* Rich gold gradient with warmer tones */
  background: linear-gradient(180deg, #fff8e7 0%, #ffe66d 12%, #ffd700 35%, #ffc107 60%, #f4a237 82%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* Multi-layer shadows for depth: base shadow + depth shadow + ambient occlusion */
  filter: drop-shadow(0 2px 0 rgba(184, 134, 11, 0.9)) drop-shadow(0 4px 0 rgba(154, 112, 48, 0.8))
    drop-shadow(0 6px 0 rgba(120, 85, 35, 0.6)) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35))
    drop-shadow(0 0 20px rgba(255, 215, 0, 0.15));
  /* Gentle floating animation */
  animation: title-float 3s ease-in-out infinite;
}

@keyframes title-float {
  0%,
  100% {
    transform: translateY(0) scale(1);
    filter: drop-shadow(0 2px 0 rgba(184, 134, 11, 0.9)) drop-shadow(0 4px 0 rgba(154, 112, 48, 0.8))
      drop-shadow(0 6px 0 rgba(120, 85, 35, 0.6)) drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35))
      drop-shadow(0 0 20px rgba(255, 215, 0, 0.15));
  }
  50% {
    transform: translateY(-3px) scale(1.01);
    filter: drop-shadow(0 2px 0 rgba(184, 134, 11, 0.9)) drop-shadow(0 4px 0 rgba(154, 112, 48, 0.8))
      drop-shadow(0 6px 0 rgba(120, 85, 35, 0.6)) drop-shadow(0 12px 24px rgba(0, 0, 0, 0.4))
      drop-shadow(0 0 30px rgba(255, 215, 0, 0.25));
  }
}

/* Decorative cloud patterns around title */
.banner-title::before,
.banner-title::after {
  content: "☁";
  position: absolute;
  font-size: 1.5rem;
  color: rgba(255, 215, 0, 0.6);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  animation: cloud-float 4s ease-in-out infinite;
  pointer-events: none;
}

.banner-title::before {
  content: "☁";
  left: 20%;
  top: -10px;
  animation-delay: 0s;
}

.banner-title::after {
  content: "☁";
  right: 20%;
  top: -5px;
  animation-delay: 2s;
}

@keyframes cloud-float {
  0%,
  100% {
    transform: translateY(0) translateX(0);
    opacity: 0.6;
  }
  50% {
    transform: translateY(-5px) translateX(3px);
    opacity: 0.8;
  }
}

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  /* min-height: 100vh; */
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 245, 235, 0.95) 0%, rgba(255, 232, 214, 0.95) 100%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c41e3a' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  border-radius: 30px;
  margin-top: 15px;
  margin-bottom: 15px;
  box-shadow:
    0 8px 32px rgba(230, 57, 70, 0.15),
    inset 0 2px 20px rgba(255, 255, 255, 0.8);
  border: var(--border-thick) solid rgba(244, 162, 54, 0.4);
  position: relative;
  overflow: hidden;
}

/* 海浪纹装饰 - 底部 */
.container::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 10px,
    rgba(230, 57, 70, 0.05) 10px,
    rgba(230, 57, 70, 0.05) 20px
  );
  pointer-events: none;
}

/* Header */
/* Subtitle */
.subtitle {
  font-size: 1rem;
  color: var(--primary-gold);
  font-weight: 600;
  letter-spacing: 2px;
  background: var(--cream);
  padding: 8px 20px;
  border-radius: 20px;
  display: inline-block;
  box-shadow:
    0 4px 0 rgba(244, 162, 54, 0.3),
    inset 0 2px 10px rgba(255, 255, 255, 0.5);
  margin-top: 15px;
}

/* Footer */
.game-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px 0;
}

/* Game Platform - 黏土风格木质底座 */
.game-platform {
  width: 100%;
  position: relative;
  padding: 25px 30px;
  background:
    linear-gradient(180deg, #e8b86d 0%, #c49a5a 100%),
    url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c41e3a' fill-opacity='0.1' fill-rule='evenodd'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E");
  border-radius: 25px;
  box-shadow:
    0 10px 0 #a67c3d,
    0 15px 30px rgba(0, 0, 0, 0.2),
    inset 0 3px 15px rgba(255, 255, 255, 0.4),
    inset 0 -3px 10px rgba(0, 0, 0, 0.1);
  border: var(--border-thick) solid #d4a84b;
  max-width: 1060px;
  margin: 0 auto;
  overflow-x: auto;
}

/* 木纹装饰 */
.game-platform::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 18px;
  pointer-events: none;
}

/* 回纹边框装饰 */
.game-platform::after {
  content: "";
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  bottom: 15px;
  border: 2px solid rgba(196, 30, 58, 0.2);
  border-radius: 14px;
  pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(196, 30, 58, 0.1);
}

.cards-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(1, 1fr);
  gap: var(--card-gap);
  width: 100%;
  min-width: 900px;
  max-width: 1000px;
  padding: 25px;
  background: linear-gradient(135deg, #fff8f0 0%, #ffe8d6 100%);
  border-radius: var(--border-radius);
  box-shadow:
    inset 0 4px 20px rgba(0, 0, 0, 0.08),
    0 6px 20px rgba(0, 0, 0, 0.15);
  border: var(--border-thick) solid rgba(230, 57, 70, 0.3);
  position: relative;
  z-index: 1;
}

/* Card Styles - 黏土风卡片 */
.card {
  width: 100%;
  aspect-ratio: 3 / 4;
  perspective: 1000px;
  cursor: pointer;
  position: relative;
}

/* 卡片光晕效果 - 匹配成功时触发 */
.card.glow::after {
  content: "";
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.8) 0%, rgba(255, 165, 0, 0.4) 50%, transparent 70%);
  border-radius: calc(var(--border-radius) + 10px);
  animation: glow-pulse-match 0.8s ease-out forwards;
  pointer-events: none;
  z-index: 10;
}

@keyframes glow-pulse-match {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* 匹配成功时的强烈光晕 */
.card.match-success {
  animation: match-glow 0.6s ease-out;
}

@keyframes match-glow {
  0% {
    filter: brightness(1);
  }
  30% {
    filter: brightness(1.5) drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
  }
  60% {
    filter: brightness(1.2) drop-shadow(0 0 10px rgba(255, 165, 0, 0.5));
  }
  100% {
    filter: brightness(1);
  }
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-style: preserve-3d;
}

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

.card.matched .card-inner {
  animation: match-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes match-bounce {
  0% {
    transform: rotateY(180deg) scale(1);
  }
  30% {
    transform: rotateY(180deg) scale(1.15);
  }
  60% {
    transform: rotateY(180deg) scale(0.95);
  }
  100% {
    transform: rotateY(180deg) scale(1);
  }
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: var(--border-thick) solid var(--primary-gold);
  overflow: hidden;
}

.card.flipped .card-back {
  visibility: hidden;
}

/* Card Back - 黏土风背面使用图片 */
.card-back {
  background: linear-gradient(145deg, var(--primary-red) 0%, var(--secondary-red) 100%);
  color: var(--warm-yellow);
  box-shadow:
    0 6px 0 var(--secondary-red),
    0 10px 20px rgba(0, 0, 0, 0.2),
    inset 0 4px 15px rgba(255, 255, 255, 0.3),
    inset 0 -4px 10px rgba(0, 0, 0, 0.2);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: var(--border-thick) solid var(--primary-gold);
  overflow: hidden;
  transition:
    box-shadow 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 背景图片 */
.card-back-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("../i/cover.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: calc(var(--border-radius) - 4px);
  z-index: 0;
}

.card.flipped .card-back {
  visibility: hidden;
}

.card-back::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border: 3px dashed rgba(255, 209, 102, 0.4);
  border-radius: 14px;
  z-index: 1;
  pointer-events: none;
}

/* 回纹装饰角 */
.card-back::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  width: 20px;
  height: 20px;
  /* border: 3px solid rgba(255, 209, 102, 0.6); */
  border-radius: 4px;
  z-index: 2;
  box-shadow:
    calc(100% - 10px) 0 0 rgba(255, 209, 102, 0.6),
    0 calc(100% - 10px) 0 rgba(255, 209, 102, 0.6),
    calc(100% - 10px) calc(100% - 10px) 0 rgba(255, 209, 102, 0.6);
  pointer-events: none;
}

.card-back-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.card-back .lantern-icon {
  font-size: 2.5rem;
  color: var(--warm-yellow);
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.2));
  animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 5px rgba(255, 209, 102, 0.8)) drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.2));
  }
  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 0 15px rgba(255, 209, 102, 1)) drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.2));
  }
}

.card-back .min-text {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--warm-yellow);
  text-shadow:
    2px 2px 0 rgba(0, 0, 0, 0.3),
    0 0 20px rgba(255, 209, 102, 0.5);
}

/* Card Front - 黏土风正面 */
.card-front {
  background:
    linear-gradient(145deg, #fffef8 0%, #fff5eb 100%),
    url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23c41e3a' fill-opacity='0.03' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='2'/%3E%3Ccircle cx='13' cy='13' r='2'/%3E%3C/g%3E%3C/svg%3E");
  transform: rotateY(180deg);
  border-color: var(--primary-gold);
  padding: 12px 8px;
  box-shadow:
    0 6px 0 rgba(244, 162, 54, 0.5),
    0 10px 20px rgba(0, 0, 0, 0.15),
    inset 0 4px 15px rgba(255, 255, 255, 0.8),
    inset 0 -4px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.card-front::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border: 2px solid rgba(244, 162, 54, 0.3);
  border-radius: 14px;
  pointer-events: none;
}

/* 闽文化云纹角花 */
.card-front::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  background:
    radial-gradient(circle at 0 0, rgba(196, 30, 58, 0.3) 2px, transparent 2px),
    radial-gradient(circle at 100% 0, rgba(196, 30, 58, 0.3) 2px, transparent 2px),
    radial-gradient(circle at 0 100%, rgba(196, 30, 58, 0.3) 2px, transparent 2px),
    radial-gradient(circle at 100% 100%, rgba(196, 30, 58, 0.3) 2px, transparent 2px);
  border-radius: 50%;
  z-index: 1;
}

.card-front .theme-icon {
  position: relative;
  font-size: 3rem;
  margin-bottom: 10px;
  background: linear-gradient(145deg, var(--primary-red), var(--candy-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.1));
}

.card-front .theme-icon-img {
  position: relative;
  width: 120px;
  height: 120px;
  /* margin-bottom: 8px; */
  object-fit: contain;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.1));
  flex-shrink: 0;
}

/* Card front - English name (primary, larger) */
.card-front .theme-name-en {
  position: relative;
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark-text);
  line-height: 1.3;
  text-transform: uppercase;
}

/* Card front - Chinese name (secondary, smaller accent) */
.card-front .theme-name-cn {
  position: relative;
  font-size: 0.75rem;
  color: var(--primary-red);
  font-weight: 500;
  letter-spacing: 1px;
  opacity: 0.75;
}

/* Card Hover - 黏土按压效果 */
.card:hover:not(.flipped):not(.matched) .card-back {
  box-shadow:
    0 12px 0 var(--secondary-red),
    0 18px 30px rgba(0, 0, 0, 0.25),
    inset 0 4px 15px rgba(255, 255, 255, 0.3),
    inset 0 -4px 10px rgba(0, 0, 0, 0.2);
  transform: translateY(-4px);
}

.card:active:not(.flipped):not(.matched) .card-back {
  box-shadow:
    0 2px 0 var(--secondary-red),
    0 4px 10px rgba(0, 0, 0, 0.2),
    inset 0 4px 15px rgba(255, 255, 255, 0.3),
    inset 0 -4px 10px rgba(0, 0, 0, 0.2);
  transform: translateY(2px);
}

/* Footer */
.footer {
  text-align: center;
  padding: 40px 0 0;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

/* AI Disclaimer - subtle bilingual notice */
.disclaimer {
  font-size: 0.7rem;
  color: rgba(100, 100, 100, 0.6);
  letter-spacing: 0.5px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 15px auto;
  user-select: none;
}

.disclaimer .divider {
  color: rgba(100, 100, 100, 0.4);
}

.new-game-btn {
  font-family: "Source Sans 3", "Microsoft YaHei", sans-serif;
  background: linear-gradient(145deg, var(--primary-red), var(--secondary-red));
  color: white;
  border: none;
  padding: 16px 40px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 25px;
  cursor: pointer;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  letter-spacing: 1px;
  box-shadow:
    0 6px 0 var(--secondary-red),
    0 10px 25px rgba(0, 0, 0, 0.2),
    inset 0 3px 10px rgba(255, 255, 255, 0.3);
  border: var(--border-thick) solid rgba(255, 255, 255, 0.2);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

/* New Game Button - text style */
.new-game-btn .btn-text {
  font-size: 1.1rem;
  font-weight: 600;
}

.new-game-btn::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 15px;
  right: 15px;
  height: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent);
  border-radius: 10px;
}

.new-game-btn:hover {
  transform: translateY(-3px);
  box-shadow:
    0 9px 0 var(--secondary-red),
    0 15px 30px rgba(0, 0, 0, 0.25),
    inset 0 3px 10px rgba(255, 255, 255, 0.3);
}

.new-game-btn:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 var(--secondary-red),
    0 4px 10px rgba(0, 0, 0, 0.2),
    inset 0 3px 10px rgba(255, 255, 255, 0.3);
}

.new-game-btn img.btn-icon {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-normal);
}

.new-game-btn:hover img.btn-icon {
  transform: rotate(360deg);
}

/* Floating Help Button - 悬浮玩法说明按钮 */
.floating-help-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--primary-gold), var(--warm-yellow));
  border: var(--border-thick) solid rgba(255, 255, 255, 0.3);
  box-shadow:
    0 6px 0 rgba(212, 175, 55, 0.5),
    0 10px 25px rgba(0, 0, 0, 0.25),
    inset 0 3px 10px rgba(255, 255, 255, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  z-index: 100;
  padding: 0;
}

/* Music Button - positioned above help button */
#musicBtn {
  bottom: 100px;
  right: 30px;
}

.floating-help-btn::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 15px;
  right: 15px;
  height: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), transparent);
  border-radius: 10px;
}

.floating-help-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow:
    0 9px 0 rgba(212, 175, 55, 0.5),
    0 15px 30px rgba(0, 0, 0, 0.3),
    inset 0 3px 10px rgba(255, 255, 255, 0.5);
}

.floating-help-btn:active {
  transform: translateY(3px) scale(0.98);
  box-shadow:
    0 2px 0 rgba(212, 175, 55, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.2),
    inset 0 3px 10px rgba(255, 255, 255, 0.5);
}

.floating-help-btn .help-icon {
  width: 28px;
  height: 28px;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.2));
  animation: help-icon-pulse 2s ease-in-out infinite;
}

/* Music Icon Styles */
#musicIcon {
  display: block;
  width: 28px;
  height: 28px;
  background-image: url('../i/music-on.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  animation: music-icon-pulse 2s ease-in-out infinite;
}

/* Music off state */
#musicIcon.music-off {
  background-image: url('../i/music-off.png');
}

@keyframes music-icon-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes help-icon-pulse {
  0%,
  100% {
    transform: rotate(-10deg) scale(1);
  }
  50% {
    transform: rotate(10deg) scale(1.1);
  }
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  /* padding: 20px; */
}

.modal-overlay.active {
  display: flex;
}

/* Modal - 黏土风格 */
.modal {
  background: linear-gradient(145deg, #fffef8 0%, #fff5eb 100%);
  border-radius: 25px;
  max-width: 600px;
  max-height: 95vh;
  width: 100%;
  overflow: hidden;
  box-shadow:
    0 10px 0 rgba(230, 57, 70, 0.3),
    0 20px 50px rgba(0, 0, 0, 0.3),
    inset 0 3px 20px rgba(255, 255, 255, 0.8);
  border: var(--border-thick) solid var(--primary-gold);
  animation: modal-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  background: linear-gradient(145deg, var(--primary-red), var(--secondary-red));
  padding: 25px;
  text-align: center;
  position: relative;
  flex-shrink: 0;
  box-shadow:
    inset 0 3px 15px rgba(255, 255, 255, 0.3),
    inset 0 -3px 10px rgba(0, 0, 0, 0.2);
}

.modal-header::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 20px;
  right: 20px;
  height: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent);
  border-radius: 10px;
}

.modal-icon {
  width: 48px;
  height: 48px;
  display: inline-block;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.2));
  animation: star-spin 2s ease-in-out infinite;
}

@keyframes star-spin {
  0%,
  100% {
    transform: rotate(-10deg) scale(1);
  }
  50% {
    transform: rotate(10deg) scale(1.1);
  }
}

.modal-icon.gold {
  color: var(--warm-yellow);
  animation: trophy-bounce 1s ease-in-out infinite;
}

@keyframes trophy-bounce {
  0%,
  100% {
    transform: translateY(0) rotate(-5deg);
  }
  50% {
    transform: translateY(-10px) rotate(5deg);
  }
}

.modal-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* Modal title - English (primary) */
.modal-title .title-en {
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

/* Modal title - Chinese (secondary accent) */
.modal-title .title-cn {
  font-size: 0.9rem;
  color: var(--warm-yellow);
  font-weight: 500;
  opacity: 0.85;
}

.modal-body {
  padding: 30px 25px;
  overflow-y: auto;
  flex: 1;
}

/* Modal body scrollbar styles - Chrome/Safari/Edge */
.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: rgba(244, 162, 54, 0.1);
  border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary-gold), var(--primary-red));
  border-radius: 10px;
  border: 2px solid rgba(244, 162, 54, 0.1);
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-red), var(--secondary-red));
}

/* Modal body scrollbar styles - Firefox */
.modal-body {
  scrollbar-width: thin;
  scrollbar-color: var(--primary-gold) rgba(244, 162, 54, 0.1);
}

.culture-info {
  text-align: center;
}

/* Culture info - English name (primary, larger) */
.culture-name-en {
  font-size: 1.6rem;
  color: var(--primary-red);
  font-weight: 700;
  margin-bottom: 6px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.1);
  text-transform: uppercase;
}

/* Culture info - Chinese name (secondary, smaller accent) */
.culture-name-cn {
  font-size: 0.95rem;
  color: var(--primary-gold);
  font-weight: 500;
  letter-spacing: 1px;
  margin-bottom: 18px;
  opacity: 0.85;
}

/* 富文本内容容器 */
.culture-content {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 5px;
}

/* 滚动条样式 - Chrome/Safari/Edge */
.culture-content::-webkit-scrollbar {
  width: 8px;
}

.culture-content::-webkit-scrollbar-track {
  background: rgba(244, 162, 54, 0.1);
  border-radius: 10px;
}

.culture-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary-gold), var(--primary-red));
  border-radius: 10px;
  border: 2px solid rgba(244, 162, 54, 0.1);
}

.culture-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary-red), var(--secondary-red));
}

/* 滚动条样式 - Firefox */
.culture-content {
  scrollbar-width: thin;
  scrollbar-color: var(--primary-gold) rgba(244, 162, 54, 0.1);
}

/* Culture content - default p tag style */
.culture-content p {
  background: linear-gradient(145deg, #fff8f0, #ffe8d6);
  padding: 18px 22px;
  border-radius: 15px;
  border: 3px solid rgba(244, 162, 54, 0.3);
  box-shadow:
    inset 0 2px 10px rgba(255, 255, 255, 0.5),
    0 3px 10px rgba(0, 0, 0, 0.05);
  margin: 0;
  line-height: 1.8;
  color: var(--dark-text);
  font-size: 0.95rem;
}

/* Culture content image */
.culture-content img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin-top: 12px;
  border: 2px solid rgba(244, 162, 54, 0.3);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.modal-footer {
  padding: 15px 25px 25px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

.modal-btn {
  font-family: "Source Sans 3", "Microsoft YaHei", sans-serif;
  background: linear-gradient(145deg, var(--primary-red), var(--secondary-red));
  color: white;
  border: none;
  padding: 14px 30px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 140px;
  box-shadow:
    0 5px 0 var(--secondary-red),
    0 8px 20px rgba(0, 0, 0, 0.15),
    inset 0 3px 10px rgba(255, 255, 255, 0.3);
  border: 3px solid rgba(255, 255, 255, 0.2);
  transition: all var(--transition-fast);
  position: relative;
}

/* Modal button - text style */
.modal-btn img.btn-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* Modal button - text style */
.modal-btn .btn-text {
  font-size: 1rem;
  font-weight: 600;
}

.modal-btn::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 10px;
  right: 10px;
  height: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent);
  border-radius: 8px;
}

.modal-btn:hover {
  transform: translateY(-3px);
  box-shadow:
    0 8px 0 var(--secondary-red),
    0 12px 25px rgba(0, 0, 0, 0.2),
    inset 0 3px 10px rgba(255, 255, 255, 0.3);
}

.modal-btn:active {
  transform: translateY(3px);
  box-shadow:
    0 2px 0 var(--secondary-red),
    0 4px 10px rgba(0, 0, 0, 0.15),
    inset 0 3px 10px rgba(255, 255, 255, 0.3);
}

.modal-btn.secondary {
  background: linear-gradient(145deg, #6b7280, #4b5563);
  box-shadow:
    0 5px 0 #374151,
    0 8px 20px rgba(0, 0, 0, 0.15),
    inset 0 3px 10px rgba(255, 255, 255, 0.2);
}

.modal-btn.secondary:hover {
  box-shadow:
    0 8px 0 #374151,
    0 12px 25px rgba(0, 0, 0, 0.2),
    inset 0 3px 10px rgba(255, 255, 255, 0.2);
}

.modal-btn.secondary:active {
  box-shadow:
    0 2px 0 #374151,
    0 4px 10px rgba(0, 0, 0, 0.15),
    inset 0 3px 10px rgba(255, 255, 255, 0.2);
}

/* Certificate Modal */
.certificate-modal {
  max-width: 500px;
}

/* How to Play Modal */
.how-to-play-modal {
  max-width: 550px;
}

.how-to-play-content {
  text-align: left;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 25px;
  padding: 15px;
  background: linear-gradient(145deg, #fff8f0, #ffe8d6);
  border-radius: 12px;
  border: 2px solid rgba(244, 162, 54, 0.3);
}

.step-content {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.step-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: linear-gradient(145deg, var(--primary-red), var(--secondary-red));
  color: white;
  font-weight: 700;
  font-size: 1.2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.step h3 {
  font-size: 1.1rem;
  color: var(--primary-red);
  margin-bottom: 8px;
  font-weight: 700;
}

.step p {
  color: var(--dark-text);
  line-height: 1.6;
  margin-bottom: 5px;
}

.step .cn-text {
  color: #888;
  font-size: 0.9rem;
}

.tip-box {
  background: linear-gradient(145deg, #fff9e6, #fff3cd);
  border: 2px solid rgba(244, 162, 54, 0.5);
  border-radius: 12px;
  padding: 18px 20px;
  margin-top: 20px;
}

.tip-box h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  color: var(--primary-red);
  margin-bottom: 12px;
  font-weight: 700;
}

.tip-box .tip-icon {
  width: 20px;
  height: 20px;
}

.tip-box p {
  color: var(--dark-text);
  line-height: 1.6;
  margin-bottom: 5px;
}

.tip-box .cn-text {
  color: #888;
  font-size: 0.9rem;
}

.certificate-container {
  background: linear-gradient(145deg, #fff8f0, #ffe8d6);
  border-radius: 18px;
  padding: 18px;
  border: var(--border-thick) solid var(--primary-gold);
  box-shadow:
    inset 0 3px 15px rgba(255, 255, 255, 0.5),
    0 5px 15px rgba(0, 0, 0, 0.1);
}

.certificate-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

/* Confetti */
.confetti {
  position: fixed;
  width: 12px;
  height: 12px;
  top: -15px;
  z-index: 999;
  animation: confetti-fall 3s ease-out forwards;
  border-radius: 3px;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* 粒子爆炸效果 */
.particle {
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  z-index: 100;
}

@keyframes particle-explode {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0);
    opacity: 0;
  }
}

/* 火花效果 */
.spark {
  position: fixed;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99;
  animation: spark-fly 0.8s ease-out forwards;
}

@keyframes spark-fly {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0);
    opacity: 0;
  }
}

/* 星光闪烁效果 */
.star-burst {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 11;
}

.star-burst::before {
  content: "✨";
  position: absolute;
  font-size: 1.5rem;
  animation: star-twinkle 0.6s ease-out forwards;
}

@keyframes star-twinkle {
  0% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.5) rotate(180deg);
  }
  100% {
    opacity: 0;
    transform: scale(0) rotate(360deg);
  }
}

/* 浮动文字效果 */
.float-text {
  position: fixed;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-gold);
  text-shadow:
    2px 2px 0 var(--primary-red),
    0 0 20px rgba(255, 215, 0, 0.8);
  pointer-events: none;
  z-index: 1000;
  animation: float-up 1s ease-out forwards;
}

@keyframes float-up {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-80px) scale(1.5);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
    margin: 10px;
  }

  .banner-wrapper {
    padding: 30px 15px;
  }

  .banner-wrapper::before,
  .banner-wrapper::after {
    display: none;
  }

  .banner-title .title-en {
    font-size: 2.5rem;
    letter-spacing: 2px;
  }

  .banner-title::before,
  .banner-title::after {
    font-size: 1.2rem;
  }

  .game-platform {
    padding: 15px 10px;
  }

  .cards-container {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    padding: 15px;
    width: 100%;
    min-width: auto;
    max-width: 100%;
  }

  :root {
    --card-height: 120px;
  }

  .card-front .theme-icon-img {
    width: 70px;
    height: 70px;
  }

  .card-front .theme-name-en {
    font-size: 0.7rem;
  }

  .card-front .theme-name-cn {
    font-size: 0.6rem;
  }

  .new-game-btn {
    padding: 14px 30px;
    font-size: 1rem;
  }

  .floating-help-btn {
    width: 55px;
    height: 55px;
    bottom: 25px;
    right: 25px;
  }

  #musicBtn {
    bottom: 90px;
    right: 25px;
  }

  .floating-help-btn .help-icon {
    width: 24px;
    height: 24px;
  }
}

/* 平板小屏优化 */
@media (max-width: 600px) {
  .container {
    padding: 12px;
    margin: 8px;
  }

  .banner-wrapper {
    padding: 25px 15px;
  }

  .banner-title .title-en {
    font-size: 2rem;
    letter-spacing: 2px;
  }

  .banner-title::before,
  .banner-title::after {
    font-size: 1rem;
    top: -15px;
  }

  .subtitle {
    font-size: 0.85rem;
    padding: 6px 15px;
  }

  .game-platform {
    padding: 15px 10px;
  }

  .cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
    width: 100%;
    min-width: auto;
    max-width: 100%;
  }

  :root {
    --card-height: 110px;
  }

  .new-game-btn {
    padding: 12px 25px;
    font-size: 0.95rem;
  }

  .floating-help-btn {
    width: 50px;
    height: 50px;
    bottom: 40px;
    right: 20px;
  }

  #musicBtn {
    bottom: 100px;
    right: 20px;
  }

  .floating-help-btn .help-icon {
    width: 22px;
    height: 22px;
  }
}

/* 小屏手机优化 */
@media (max-width: 480px) {
  .container {
    padding: 10px;
    margin: 5px;
    border-radius: 20px;
  }

  .banner-wrapper {
    padding: 20px 12px;
  }

  .banner-title .title-en {
    font-size: 1.6rem;
    letter-spacing: 1px;
  }

  .banner-title::before,
  .banner-title::after {
    display: none;
  }

  .subtitle {
    font-size: 0.75rem;
    padding: 5px 12px;
    border-radius: 15px;
  }

  /* 按钮全宽显示 */
  .new-game-btn {
    width: 100%;
    max-width: 280px;
    padding: 14px 20px;
    font-size: 0.9rem;
  }

  .footer {
    flex-direction: column;
    gap: 12px;
  }

  .game-platform {
    padding: 12px 10px;
    border-radius: 20px;
  }

  /* 卡片 3 列×2 行布局 */
  .cards-container {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    row-gap: 12px;
    padding: 10px;
    width: 100%;
    min-width: auto;
    max-width: 100%;
  }

  :root {
    --card-height: 100px;
    --card-gap: 8px;
    --border-radius: 15px;
  }

  .card-front .theme-icon-img {
    width: 50px;
    height: 50px;
  }

  .card-front .theme-name-en {
    font-size: 0.55rem;
  }

  .card-front .theme-name-cn {
    font-size: 0.5rem;
  }

  /* 模态框优化 */
  .modal {
    max-width: 90%;
    margin: 10px;
  }

  .modal-header {
    padding: 20px;
  }

  .modal-icon {
    width: 32px;
    height: 32px;
  }

  .modal-title,
  .modal-title .title-en {
    font-size: 1.3rem;
  }

  .modal-body {
    padding: 20px 15px;
  }

  .culture-icon {
    font-size: 3rem;
  }

  .culture-name {
    font-size: 1.2rem;
  }

  .culture-desc {
    font-size: 0.85rem;
    padding: 12px;
  }

  /* 按钮全宽 */
  .modal-footer {
    flex-direction: column;
    padding: 15px 20px 20px;
  }

  .modal-btn {
    width: 100%;
    min-width: auto;
  }

  .footer {
    flex-direction: column;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .floating-help-btn {
    width: 50px;
    height: 50px;
    bottom: 40px;
    right: 15px;
  }

  #musicBtn {
    bottom: 100px;
    right: 15px;
  }

  .floating-help-btn .help-icon {
    width: 22px;
    height: 22px;
  }
}

/* 超小屏优化 */
@media (max-width: 400px) {
  .cards-container {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 6px;
    row-gap: 12px;
    padding: 8px;
  }

  :root {
    --card-height: 90px;
  }

  .card-front .theme-icon-img {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .card-front .theme-name-en {
    font-size: 0.5rem;
  }

  .card-front .theme-name-cn {
    font-size: 0.45rem;
  }

  .modal {
    margin: 8px;
  }

  .modal-btn {
    min-width: 100px;
    padding: 12px 15px;
    font-size: 0.85rem;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-btn {
    width: 100%;
  }

  .floating-help-btn {
    width: 45px;
    height: 45px;
    bottom: 50px;
    right: 6px;
  }

  #musicBtn {
    bottom: 100px;
    right: 6px;
  }

  .floating-help-btn .help-icon {
    width: 20px;
    height: 20px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus states */
.new-game-btn:focus,
.modal-btn:focus {
  outline: 3px solid var(--primary-gold);
  outline-offset: 3px;
}

/* Print styles for certificate */
@media print {
  .modal-overlay {
    position: absolute;
    background: white;
  }

  .certificate-container {
    border: none;
    box-shadow: none;
  }
}
