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

html, body {
  width: 100%;
  height: 100%;
  background: #080810;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
}

#game-wrapper {
  position: relative;
  width: 1024px;
  height: 768px;
  max-width: 100vw;
  max-height: 100vh;
  aspect-ratio: 4 / 3;
  box-shadow: 0 0 40px rgba(255, 100, 0, 0.3), 0 0 80px rgba(0, 0, 0, 0.9);
  border: 3px solid #ff6600;
  border-radius: 8px;
  overflow: hidden;
  background: #04040a;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ─── High Scores & Initials Box ──────────────────────────────────── */
#initials-box {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 10, 25, 0.94);
  border: 3px solid #ffaa00;
  padding: 35px 45px;
  border-radius: 12px;
  box-shadow: 0 0 35px #ffaa00, inset 0 0 15px rgba(255, 170, 0, 0.3);
  z-index: 50;
  min-width: 340px;
}

#hs-new-label {
  color: #ffcc00;
  font-size: 22px;
  text-shadow: 0 0 15px #ffcc00;
  margin-bottom: 12px;
  text-align: center;
}

#hs-enter-label {
  color: #aaa;
  font-size: 13px;
  margin-bottom: 20px;
  letter-spacing: 2px;
  text-align: center;
}

#spinner-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin: 10px 0 20px 0;
}

.spinner-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.spin-btn {
  width: 68px;
  height: 38px;
  font-size: 20px;
  font-weight: bold;
  background: rgba(255, 170, 0, 0.15);
  color: #ffcc00;
  border: 2px solid #ffcc00;
  border-radius: 6px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, transform 0.1s;
}

.spin-btn:hover {
  background: rgba(255, 170, 0, 0.4);
}

.spin-window {
  width: 68px;
  height: 140px;
  overflow: hidden;
  position: relative;
  border: 2px solid #ffaa00;
  border-radius: 8px;
  background: rgba(5, 5, 15, 0.85);
}

.spin-window::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, transparent 28%, transparent 72%, rgba(0,0,0,0.85) 100%);
}

.spin-window::after {
  content: '';
  position: absolute;
  z-index: 3;
  pointer-events: none;
  top: 45px;
  left: 0;
  right: 0;
  height: 48px;
  border-top: 2px solid rgba(255, 204, 0, 0.7);
  border-bottom: 2px solid rgba(255, 204, 0, 0.7);
  background: rgba(255, 204, 0, 0.12);
}

.spinner-col.active-col .spin-window {
  box-shadow: 0 0 20px #ffcc00;
  border-color: #ffcc00;
}

.spin-strip {
  display: flex;
  flex-direction: column;
}

.spin-cell {
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: bold;
  color: rgba(255, 204, 0, 0.35);
}

.spin-cell.curr {
  color: #ffcc00;
  text-shadow: 0 0 14px #ffcc00, 0 0 28px #ffcc00;
}

#hs-confirm-btn {
  margin-top: 10px;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: bold;
  font-family: inherit;
  background: #251800;
  color: #ffcc00;
  border: 2px solid #ffcc00;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

#hs-confirm-btn.active-btn, #hs-confirm-btn:hover {
  background: #ffcc00;
  color: #000;
  box-shadow: 0 0 20px #ffcc00;
}

/* ─── High Scores Overlay ─────────────────────────────────────────── */
#high-scores {
  display: none;
  flex-direction: column;
  align-items: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 20, 15, 0.94);
  border: 3px solid #00ffaa;
  padding: 30px 40px;
  border-radius: 12px;
  box-shadow: 0 0 35px #00ffaa;
  z-index: 50;
  min-width: 360px;
}

#hs-title {
  color: #00ffaa;
  font-size: 20px;
  letter-spacing: 3px;
  border-bottom: 2px solid #00ffaa;
  padding-bottom: 12px;
  margin-bottom: 20px;
  text-shadow: 0 0 12px #00ffaa;
  text-align: center;
}

#score-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 16px;
  color: #bbb;
  gap: 15px;
}

.score-row.top {
  color: #ffcc00;
  text-shadow: 0 0 14px #ffcc00;
  font-size: 18px;
}

.score-rank { width: 40px; color: #00ffaa; }
.score-name { flex-grow: 1; text-align: center; letter-spacing: 2px; }
.score-val { color: #fff; width: 90px; text-align: right; }

#post-menu {
  display: flex;
  gap: 20px;
  margin-top: 25px;
}

.post-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-family: inherit;
  background: rgba(0, 50, 30, 0.8);
  color: #00ffaa;
  border: 2px solid #00ffaa;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.post-btn.active-btn, .post-btn:hover {
  background: #00ffaa;
  color: #000;
  box-shadow: 0 0 15px #00ffaa;
}

/* ─── Touch Controls for Mobile ──────────────────────────────────── */
#touch-controls {
  display: none;
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  justify-content: space-between;
  align-items: center;
  z-index: 40;
}

.touch-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(255, 102, 0, 0.3);
  border: 2px solid #ff6600;
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: manipulation;
}

.flap-btn {
  width: 90px;
  height: 90px;
  font-size: 18px;
  background: rgba(255, 204, 0, 0.4);
  border-color: #ffcc00;
}

@media (max-width: 768px) {
  #touch-controls {
    display: flex;
  }
}
