* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* 禁止移动设备双击放大 */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html {
  /* 禁止橡皮筋效果（过度滚动） */
  overscroll-behavior: none;
  /* 固定视口高度 */
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  /* iOS Safari 平滑滚动 */
  -webkit-overflow-scrolling: touch;
  /* 防止拖拽超出 */
  overscroll-behavior-y: contain;
  /* 禁止双击缩放 */
  touch-action: pan-y;
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
}

/* Loading Screen Styles */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-container {
  text-align: center;
  color: white;
  max-width: 400px;
  padding: 20px;
}

.loading-container h1 {
  font-size: 2rem;
  margin-bottom: 30px;
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 15px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
  border-radius: 10px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 1.2rem;
  font-weight: 500;
  opacity: 0.9;
}

/* Game Container Styles - Full width with 9:16 aspect ratio */
#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 15px 17px 30px 17px; /* 顶部15px，左右17px，底部30px */
  gap: 0;
  position: relative;
  width: 100%;
  max-width: 100vw;
  margin: 0 auto;
}

/* Canvas wrapper to maintain aspect ratio */
.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 100vw;
  flex-shrink: 0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  /* 添加内发光边框效果 */
  border: 3px solid rgba(255, 255, 255, 0.15);
  /* 允许游戏触摸交互 */
  touch-action: none;
}

.canvas-wrapper::before {
  content: '';
  display: block;
  padding-top: 177.78%; /* 1920/1080 * 100 = 177.78% for 9:16 ratio */
}

#unity-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #231F20;
  border-radius: 17px; /* 稍小于容器的圆角以避免边缘溢出 */
  /* 允许 Unity 游戏的所有触摸操作 */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Game Placeholder (shown before Unity loads) */
.game-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-image: url('../images/game-preview.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 20%;
  z-index: 10;
  transition: opacity 0.5s ease;
  border-radius: 17px; /* 与 canvas 保持一致 */
}

.game-placeholder.hidden {
  opacity: 0;
  pointer-events: none;
}

.placeholder-content {
  text-align: center;
  color: white;
  animation: float 3s ease-in-out infinite;
}

.placeholder-content h2 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  font-weight: 700;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.placeholder-content p {
  font-size: 1.2rem;
  opacity: 0.9;
  font-weight: 500;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

/* Action Buttons */
.action-buttons {
  padding: 30px 20px;
  text-align: center;
  width: 100vw; /* 使用视口宽度突破容器限制 */
  margin-left: -17px; /* 抵消父容器的左边距 */
  margin-right: -17px; /* 抵消父容器的右边距 */
  margin-bottom: -30px; /* 抵消父容器的底边距 */
  background: transparent; /* 透明背景 */
}

.download-btn {
  display: inline-block;
  padding: 20px 60px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 700;
  border-radius: 50px;
  box-shadow: 0 8px 20px rgba(245, 87, 108, 0.4);
  transition: all 0.3s ease;
  cursor: pointer;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(245, 87, 108, 0.5);
}

.download-btn:active {
  transform: translateY(0);
}

/* Loading Overlay for Download */
.download-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.download-overlay.active {
  display: flex;
}

.download-message {
  text-align: center;
  color: white;
}

.download-message h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  font-weight: 600;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Game Complete Popup */
.game-complete-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  backdrop-filter: blur(10px);
  animation: fadeIn 0.3s ease;
}

.game-complete-popup.active {
  display: flex;
}

.popup-content {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px 30px;
  border-radius: 20px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  position: relative;
}

.popup-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 35px;
  height: 35px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.popup-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.popup-close:active {
  transform: rotate(90deg) scale(0.9);
}

.popup-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  animation: bounce 1s ease infinite;
}

.popup-content h2 {
  color: white;
  font-size: 2rem;
  margin-bottom: 15px;
  font-weight: 700;
}

.popup-content p {
  color: rgba(255, 255, 255, 0.95);
  font-size: 1.1rem;
  margin-bottom: 10px;
  line-height: 1.5;
}

.popup-subtitle {
  font-weight: 600;
  margin-bottom: 25px !important;
}

.popup-btn {
  margin-top: 10px;
  min-width: 200px;
  box-shadow: 0 8px 25px rgba(240, 147, 251, 0.6) !important;
  border: none;
}

.popup-btn:hover {
  box-shadow: 0 12px 35px rgba(240, 147, 251, 0.7) !important;
  transform: translateY(-2px);
}

.popup-btn:active {
  box-shadow: 0 6px 20px rgba(240, 147, 251, 0.5) !important;
  transform: translateY(0);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Beta Full Popup (same structure as game complete) */
.beta-full-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10002;
  backdrop-filter: blur(10px);
  animation: fadeIn 0.3s ease;
}

.beta-full-popup.active {
  display: flex;
}

/* Tap to Play Overlay - button centered independently */
.tap-to-play {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  cursor: pointer;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tap-to-play.hidden {
  opacity: 0;
  pointer-events: none;
}

.play-button {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  font-size: 1.5rem;
  font-weight: 600;
  padding: 20px 60px;
  border-radius: 50px;
  box-shadow: 0 10px 30px rgba(245, 87, 108, 0.5);
  animation: pulse 2s ease-in-out infinite;
  white-space: nowrap;
  text-align: center;
  margin: 0;
  flex-shrink: 0;
}

.play-tip {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  margin-top: 70px;
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  opacity: 0.95;
  line-height: 1.4;
  padding: 0 20px;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Unity Loading Progress (shown after clicking Tap to Play) */
.loading-progress {
  text-align: center;
  color: white;
  padding: 20px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 20px;
  min-width: 250px;
}

.loading-progress .progress-text {
  font-size: 1rem;
  margin-bottom: 15px;
  font-weight: 500;
}

.progress-bar-small {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-fill-small {
  height: 100%;
  background: linear-gradient(90deg, 
    #667eea 0%, 
    #764ba2 25%,
    #f093fb 50%, 
    #f5576c 75%,
    #feca57 100%
  );
  background-size: 200% 100%;
  border-radius: 10px;
  width: 0%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  animation: gradientShift 3s ease infinite, glow 1.5s ease-in-out infinite;
  box-shadow: 0 0 15px rgba(102, 126, 234, 0.6);
}

/* 扫光效果 */
.progress-fill-small::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.4), 
    transparent
  );
  animation: shine 2s ease-in-out infinite;
}

/* 渐变移动动画 */
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* 扫光动画 */
@keyframes shine {
  0% { left: -100%; }
  50%, 100% { left: 100%; }
}

/* 发光脉冲 */
@keyframes glow {
  0%, 100% { 
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.6),
                0 0 30px rgba(102, 126, 234, 0.3);
  }
  50% { 
    box-shadow: 0 0 25px rgba(245, 87, 108, 0.8),
                0 0 40px rgba(245, 87, 108, 0.4);
  }
}

.progress-percent {
  font-size: 1.2rem;
  font-weight: 600;
}

/* Footer Styles */
footer {
  background: rgba(0, 0, 0, 0.2);
  padding: 20px;
  text-align: center;
  margin-top: auto;
}

.footer-links {
  color: white;
  font-size: 13px; /* 稍微减小字体以适应小屏幕 */
  white-space: nowrap; /* 防止换行 */
}

.footer-links a {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  transition: color 0.3s ease;
  padding: 8px 8px; /* 减少左右padding以节省空间 */
  display: inline-block;
}

.footer-links a:hover {
  color: white;
  text-decoration: underline;
}

.footer-links span {
  margin: 0 5px; /* 减少分隔符间距 */
  opacity: 0.5;
}

.footer-copyright {
  margin-top: 15px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 1.6;
  padding: 0 20px;
}

.footer-copyright p {
  margin: 5px 0;
}

.footer-email {
  margin-top: 8px;
}

.footer-email a {
  color: #4facfe;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-email a:hover {
  color: #00f2fe;
  text-decoration: underline;
}

/* Game Description */
.game-description {
  padding: 40px 25px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  margin: 0;
}

.game-description h3 {
  color: white;
  font-size: 1.5rem;
  margin-bottom: 15px;
  font-weight: 700;
  text-align: center;
}

.game-description p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 15px;
  text-align: left;
}

.game-description ul {
  list-style: none;
  padding: 0;
  margin: 20px 0;
}

.game-description ul li {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  line-height: 1.8;
  padding-left: 0;
  margin-bottom: 8px;
}

.game-description .cta-text {
  font-weight: 600;
  color: #feca57;
  text-align: center;
  margin-top: 20px;
  font-size: 1.05rem;
}

/* FAQ Section */
.faq-section {
  padding: 40px 25px;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
}

.faq-section h3 {
  color: white;
  font-size: 1.5rem;
  margin-bottom: 20px;
  font-weight: 700;
  text-align: center;
}

.faq-list {
  max-width: 600px;
  margin: 0 auto;
}

.faq-item {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.faq-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.faq-question {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
}

.faq-icon {
  font-size: 1.5rem;
  font-weight: 300;
  transition: transform 0.3s ease;
  color: rgba(255, 255, 255, 0.7);
  min-width: 24px;
  text-align: center;
}

.faq-item.active .faq-icon {
  transform: rotate(45deg);
  color: #feca57;
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 20px;
}

.faq-item.active .faq-answer {
  max-height: 200px;
  padding: 0 20px 16px 20px;
}

.faq-answer p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0;
}

.faq-answer a {
  color: #4facfe;
  text-decoration: none;
  transition: color 0.3s ease;
}

.faq-answer a:hover {
  color: #00f2fe;
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
  .loading-container h1 {
    font-size: 1.5rem;
  }
game-container {
    padding: 10px;
  }

  #unity-container {
    max-width: 100%;
    width: min(100%, 540px){
    max-width: 100%;
  }

  .download-btn {
    padding: 14px 32px;
    font-size: 1rem;
  }

  .footer-links {
    font-size: 13px;
  }

  .footer-links span {
    margin: 0 5px;
  }
}

@m#game-container {
    padding: 5px;
  }

  #unity-container {
    border-radius: 8px;
  }

  .download-btn {
    padding: 12px 28px;
    font-size: 0.95rem;
  }

  .download-btn {
    padding: 12px 28px;
    font-size: 0.95rem;
  }
}
