* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* 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: 0;
  gap: 0;
  position: relative;
  width: 100%;
  max-width: 100vw;
  margin: 0 auto;
  min-height: 100vh;
}

/* Canvas wrapper to maintain aspect ratio */
.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 100vw;
  flex-shrink: 0;
}

.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;
}

/* Action Buttons */
.action-buttons {
  padding: 30px 20px;
  text-align: center;
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.download-btn {
  display: inline-block;
  padding: 16px 40px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  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); }
}

/* Tap to Play Overlay - centered on canvas */
.tap-to-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.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;
  min-width: 200px;
  text-align: center;
}

@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: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill-small {
  height: 100%;
  background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
  border-radius: 10px;
  width: 0%;
  transition: width 0.3s ease;
}

.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: 14px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  transition: color 0.3s ease;
  padding: 8px 12px;
  display: inline-block;
}

.footer-links a:hover {
  color: white;
  text-decoration: underline;
}

.footer-links span {
  margin: 0 8px;
  opacity: 0.5;
}

/* 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;
  }

  .action-buttons {
    margin-top: 15px
  }

  .download-btn {
    padding: 12px 28px;
    font-size: 0.95rem;
  }
}
