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

:root {
  --sat: env(safe-area-inset-top);
  --sab: env(safe-area-inset-bottom);
  --sal: env(safe-area-inset-left);
  --sar: env(safe-area-inset-right);
}

:root {
  --game-background: #000;
  --game-accent: #FFD700;
  --game-highlight: #FF69B4;
  --game-text: #ffffff;
}

body { 
  background: var(--game-background); 
  margin: 0; 
  padding: 0;
  padding-top: var(--sat);
  padding-bottom: var(--sab);
  padding-left: var(--sal);
  padding-right: var(--sar);
  display: flex; 
  align-items: center; 
  justify-content: center; 
  min-height: 100vh;
  height: 100vh;
  font-family: Arial, sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 2s ease-in-out;
}

.game-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px;
  padding-top: max(10px, env(safe-area-inset-top) + 10px);
  width: 100%;
  max-width: 400px;
  min-height: 100vh;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Full width for larger screens */
@media (min-width: 430px) {
  .game-container {
    max-width: 100%;
  }
}

/* Header Section */
.game-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  padding: 10px 15px 10px 5px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.header-left {
  display: flex;
  align-items: center;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex: 1;
}

.game-title {
  color: var(--game-highlight);
  font-size: 1.2em;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
  margin-bottom: 3px;
  transition: color 2s ease-in-out;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: monospace;
  font-size: 0.8em;
  color: var(--game-accent);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  justify-content: flex-end;
  transition: color 2s ease-in-out;
}

.header-stat {
  white-space: nowrap;
}

.header-stat .label {
  color: #FFD700;
}

.header-stat .value {
  color: #FFFFFF;
}

/* Maze Container */
.maze-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  flex: 1;
}

/* Game Message Overlay */
.game-message-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: yellow;
  font-family: monospace;
  font-size: 1.5em;
  font-weight: bold;
  text-shadow: 2px 2px 8px #000, -2px -2px 8px #000;
  text-align: center;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  max-width: 90%;
  word-wrap: break-word;
}

.game-message-overlay.show {
  opacity: 1;
}

/* Controls Container */
.controls-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  /* margin-top: 15px; */
}

canvas { 
  border: 2px solid #fff; 
  background: #111; 
  display: block; 
  margin: 0 auto;
  max-width: 100%;
  max-height: 70vh;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#levelDisplay, #livesDisplay, #scoreDisplay {
  background: none;
  padding: 0;
  border: none;
  font-size: inherit;
  white-space: nowrap;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
} 