/* Reset and Core Styling */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #111;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Layout centering container */
#game-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 10px;
}

/* Responsive aspect-ratio locking container */
#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 77.77vh; /* 224 / 288 = 0.7777 height-to-width ratio */
  max-height: 128.57vw; /* 288 / 224 = 1.2857 width-to-height ratio */
  aspect-ratio: 224 / 288;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

/* Canvas styling */
#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-color: #000;
}

/* ── High Score Overlay ────────────────────────────────────────── */
#hs-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  font-family: 'Press Start 2P', monospace;
  color: #fff;
  padding: 10px;
}

#initials-box, #leaderboard-box {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid #00ffff;
  border-radius: 8px;
  padding: 16px;
  width: 92%;
  max-width: 320px;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.25);
}

#hs-new-label {
  font-size: 11px;
  color: #ffcc00;
  text-shadow: 0 0 8px #ffcc00;
  margin-bottom: 2px;
}

#hs-enter-label {
  font-size: 7px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.5px;
}

/* Spinning Letter Reels Styling */
#wheel-reels-container {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin: 10px 0;
}

.wheel-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 32, 0.8);
  border: 2px solid #00aaff;
  border-radius: 6px;
  padding: 4px 8px;
  width: 56px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wheel-slot.active {
  background: rgba(26, 26, 68, 0.95);
  border: 3px solid #ffdd00;
  box-shadow: 0 0 12px rgba(255, 221, 0, 0.6);
}

.reel-arrow {
  font-size: 9px;
  color: #ffdd00;
  visibility: hidden;
}

.wheel-slot.active .reel-arrow {
  visibility: visible;
}

.reel-letter {
  font-family: 'Press Start 2P', monospace;
  text-align: center;
}

.letter-prev, .letter-next {
  font-size: 9px;
  color: #555588;
  margin: 3px 0;
}

.letter-curr {
  font-size: 20px;
  color: #00ffcc;
  margin: 2px 0;
}

.wheel-slot.active .letter-curr {
  color: #ffdd00;
  font-size: 22px;
  text-shadow: 0 0 8px #ffdd00;
}

#hs-help-label, #post-menu-help {
  font-size: 6.5px;
  color: #00ffff;
  margin-top: 4px;
  text-align: center;
  letter-spacing: 0.4px;
  line-height: 1.4;
}

#hs-submit-btn {
  background: #ff2200;
  border: 2px solid #ffffff;
  border-radius: 4px;
  color: #ffffff;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: 8px 14px;
  cursor: pointer;
  outline: none;
  box-shadow: 0 3px 0 #990000;
  transition: all 0.1s;
  width: 100%;
}

#hs-submit-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #990000;
}

#leaderboard-title {
  font-size: 10px;
  color: #00ffff;
  text-shadow: 0 0 6px #00ffff;
  margin-bottom: 6px;
}

#leaderboard-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 4px;
}

.score-rank { color: #888888; }
.score-name { color: #ffdd00; text-transform: uppercase; }
.score-val { color: #ffffff; text-align: right; }

.score-row.top .score-name { color: #ff2200; text-shadow: 0 0 4px #ff2200; }
.score-row.top .score-val { color: #ffdd00; text-shadow: 0 0 4px #ffdd00; }

#post-menu-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
}

.post-opt-btn {
  background: rgba(10, 10, 32, 0.8);
  border: 2px solid #00aaff;
  border-radius: 6px;
  color: #00aaff;
  font-family: 'Press Start 2P', monospace;
  font-size: 8.5px;
  padding: 8px 12px;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
  width: 100%;
  text-align: center;
}

.post-opt-btn.active {
  background: rgba(26, 26, 68, 0.95);
  border: 2px solid #ffdd00;
  color: #ffdd00;
  box-shadow: 0 0 10px rgba(255, 221, 0, 0.4);
}

/* ── Touch Controls Overlay ────────────────────────────────────── */
#touch-controls {
  display: none;
  justify-content: space-between;
  align-items: center;
  position: absolute;
  bottom: 20px;
  left: 5%;
  right: 5%;
  z-index: 10;
  pointer-events: none;
  width: 90%;
}

@media (pointer: coarse) {
  #touch-controls {
    display: flex;
  }
}

#dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
}

.dpad-row {
  display: flex;
  align-items: center;
}

.dpad-center {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.04);
}

.dpad-btn {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.dpad-btn:active {
  background: rgba(0, 255, 255, 0.25);
  border-color: #00ffff;
  color: #00ffff;
}

#action-btn {
  width: 72px;
  height: 72px;
  background: rgba(255, 34, 0, 0.25);
  border: 3px solid rgba(255, 34, 0, 0.5);
  border-radius: 50%;
  color: #ffffff;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 0 10px rgba(255, 34, 0, 0.3);
}

#action-btn:active {
  background: rgba(255, 34, 0, 0.6);
  border-color: #ffaa00;
  box-shadow: 0 0 20px rgba(255, 34, 0, 0.8);
}
