/* ATC Bay Runner - Game Styles */
/* ATC Brand Colors: Blue #0066cc, Gold #FFD700 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  font-family: 'Hiragino Kaku Gothic ProN', 'メイリオ', sans-serif;
  overflow: auto;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* Game Container - SMALLER fixed window, never fullscreen */
#game-container {
  position: relative;
  width: 95%;
  max-width: 800px;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 4px solid #0066cc;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 102, 204, 0.5);
  margin: auto;
}

/* Canvas */
#gameCanvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

/* Overlays */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  transition: opacity 0.5s ease;
  pointer-events: auto;
  overflow-y: auto;
  padding: 20px;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Title Screen */
#title-screen {
  text-align: center;
  color: white;
}

#title-screen h1 {
  font-size: 1.5em;
  color: #FFD700;
  text-shadow: 2px 2px 0 #0066cc;
  margin-bottom: 10px;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

#title-screen .story {
  font-size: 0.75em;
  line-height: 1.5;
  max-width: 400px;
  margin: 0 auto 15px;
  color: #ddd;
}

#title-screen .story span {
  color: #FFD700;
}

.start-btn {
  font-size: 1.1em;
  padding: 10px 30px;
  background: linear-gradient(180deg, #0066cc 0%, #004499 100%);
  color: white;
  border: 3px solid #FFD700;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  animation: pulse 2s ease infinite;
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.start-btn:hover,
.start-btn:active {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
  }

  50% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.7);
  }
}

/* Game Over Screen */
#gameover-screen {
  text-align: center;
  color: white;
}

#gameover-screen h1 {
  font-size: 1.6em;
  color: #FF6B6B;
  text-shadow: 2px 2px 0 #990000;
  margin-bottom: 10px;
}

#gameover-screen .stats {
  font-size: 1em;
  margin-bottom: 15px;
  color: #FFD700;
}

/* Prize Screen */
#prize-screen {
  text-align: center;
  color: white;
}

#prize-screen h1 {
  font-size: 1.4em;
  color: #FFD700;
  text-shadow: 2px 2px 0 #0066cc;
  margin-bottom: 8px;
  animation: celebrate 0.5s ease infinite;
}

@keyframes celebrate {

  0%,
  100% {
    transform: scale(1) rotate(-1deg);
  }

  50% {
    transform: scale(1.02) rotate(1deg);
  }
}

#prize-screen .prize-subtitle {
  font-size: 0.9em;
  color: #4CAF50;
  margin-bottom: 10px;
}

#prize-image {
  max-width: 60%;
  max-height: 120px;
  border: 3px solid #FFD700;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(255, 215, 0, 0.4);
  margin-bottom: 10px;
}

#prize-name {
  font-size: 1em;
  color: #FFD700;
  margin-bottom: 10px;
}

/* Level Transition */
#level-transition {
  text-align: center;
  color: white;
}

#level-transition h1 {
  font-size: 1.8em;
  color: #4CAF50;
  text-shadow: 2px 2px 0 #2d6a2e;
  animation: levelUp 0.5s ease;
}

@keyframes levelUp {
  0% {
    transform: scale(0);
    opacity: 0;
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

#level-name {
  font-size: 1em;
  color: #FFD700;
  margin-top: 8px;
}

/* Mobile Touch Controls - INSIDE game container with good margins */
#touch-controls {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  z-index: 50;
  display: none;
  justify-content: space-between;
  pointer-events: none;
}

@media (max-width: 1024px) {
  #touch-controls {
    display: flex;
  }
}

#dpad {
  display: flex;
  gap: 15px;
  pointer-events: auto;
}

#dpad button,
#jump-btn {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: rgba(255, 215, 0, 0.7);
  border: 3px solid #FFD700;
  font-size: 1.3em;
  color: white;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
  touch-action: manipulation;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

#dpad button:active,
#jump-btn:active {
  background: rgba(255, 215, 0, 0.95);
  transform: scale(0.92);
}

#jump-btn {
  pointer-events: auto;
}

/* Instructions */
.instructions {
  font-size: 0.7em;
  color: #888;
  margin-top: 10px;
}

.instructions span {
  color: #FFD700;
  font-weight: bold;
}

/* Loading */
#loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #1a1a2e;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  color: white;
}

#loading h2 {
  font-size: 1.5em;
  color: #FFD700;
  margin-bottom: 15px;
}

.loading-bar {
  width: 200px;
  height: 15px;
  background: #333;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #0066cc;
}

.loading-fill {
  height: 100%;
  background: linear-gradient(90deg, #0066cc, #FFD700);
  width: 0%;
  transition: width 0.3s;
}

/* High Score Display */
.high-score-display {
  font-size: 0.9em;
  color: #FFD700;
  margin-bottom: 8px;
  text-shadow: 1px 1px 0 #0066cc;
}

/* Pause Screen */
#pause-screen {
  text-align: center;
  color: white;
}

#pause-screen h1 {
  font-size: 1.6em;
  color: #87CEEB;
  text-shadow: 2px 2px 0 #0066cc;
  margin-bottom: 15px;
}

.pause-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.start-btn.secondary {
  background: linear-gradient(180deg, #666 0%, #444 100%);
  border-color: #888;
}

.start-btn.secondary:hover {
  box-shadow: 0 0 15px rgba(136, 136, 136, 0.5);
}

/* Landscape Orientation Prompt */
#rotate-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  color: white;
  text-align: center;
  padding: 30px;
}

#rotate-prompt .rotate-icon {
  font-size: 3em;
  margin-bottom: 15px;
  animation: rotatePhone 2s ease-in-out infinite;
}

@keyframes rotatePhone {

  0%,
  100% {
    transform: rotate(0deg);
  }

  25% {
    transform: rotate(-15deg);
  }

  75% {
    transform: rotate(90deg);
  }
}

#rotate-prompt h2 {
  color: #FFD700;
  font-size: 1.3em;
  margin-bottom: 8px;
}

#rotate-prompt p {
  color: #ddd;
  font-size: 0.9em;
  max-width: 250px;
}

/* Show rotate prompt only on mobile portrait */
@media (max-width: 600px) and (orientation: portrait) {
  #rotate-prompt {
    display: flex;
  }
}

/* Smaller game window on mobile landscape - NOT fullscreen */
@media (max-width: 900px) and (orientation: landscape) {
  body {
    padding: 10px;
  }

  #game-container {
    max-width: 95%;
    max-height: 85vh;
  }

  #touch-controls {
    bottom: 12px;
    left: 15px;
    right: 15px;
  }

  #dpad button,
  #jump-btn {
    width: 48px;
    height: 48px;
    font-size: 1.1em;
  }

  #dpad {
    gap: 12px;
  }
}

/* Very small landscape screens */
@media (max-height: 350px) {
  #game-container {
    max-height: 90vh;
  }

  #touch-controls {
    bottom: 8px;
    left: 10px;
    right: 10px;
  }

  #dpad button,
  #jump-btn {
    width: 42px;
    height: 42px;
    font-size: 1em;
  }

  .overlay {
    padding: 10px;
  }

  #title-screen h1 {
    font-size: 1.2em;
    margin-bottom: 5px;
  }

  #title-screen .story {
    font-size: 0.65em;
    margin-bottom: 8px;
  }

  .start-btn {
    font-size: 0.9em;
    padding: 8px 20px;
  }

  .instructions {
    display: none;
  }
}