/* ── Agee Hoops Game Styles ─────────────────────────────────────── */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0a0a0f;
  color: #fff;
}

#gameContainer {
  position: relative;
  width: 100%;
  height: 100%;
}

/* ── Canvas ─────────────────────────────────────────────────────── */
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── HUD Overlay ────────────────────────────────────────────────── */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(10,8,24,0.7), transparent);
  pointer-events: none;
  font-family: 'Courier New', monospace;
}

.hud-left, .hud-right {
  display: flex;
  gap: 1.5rem;
}

.hud-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.stat-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: rgba(255, 215, 0, 0.6);
  letter-spacing: 0.1em;
  font-weight: 700;
}

.stat-value {
  font-size: 1.5rem;
  color: #ffd700;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
  min-width: 60px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-value.stat-pulse {
  animation: stat-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes stat-bounce {
  0% { transform: scale(1); text-shadow: 0 0 8px rgba(255, 215, 0, 0.5); }
  50% { transform: scale(1.15); text-shadow: 0 0 20px rgba(255, 215, 0, 0.9); }
  100% { transform: scale(1); text-shadow: 0 0 8px rgba(255, 215, 0, 0.5); }
}

/* ── Shot Meter ─────────────────────────────────────────────────── */
.shot-meter {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  text-align: center;
  font-family: 'Courier New', monospace;
  animation: meter-enter 0.3s ease-out;
}

@keyframes meter-enter {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.shot-meter[hidden] {
  display: none;
  animation: none;
}

.meter-label {
  font-size: 0.9rem;
  color: #ffd700;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: 0.1em;
  animation: pulse-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
  }
  50% {
    text-shadow: 0 0 16px rgba(255, 215, 0, 0.8);
  }
}

.meter-bar {
  width: 200px;
  height: 24px;
  background: rgba(20, 16, 40, 0.9);
  border: 2px solid rgba(255, 215, 0, 0.7);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5), 0 0 16px rgba(255, 215, 0, 0.3);
}

.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff88, #ffd700, #ff8800);
  width: 0%;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), inset 0 0 10px rgba(255, 255, 255, 0.3);
  transition: width 0.05s linear;
  position: relative;
}

.meter-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: -2px 0 8px rgba(255, 215, 0, 0.8);
}

.meter-hint {
  font-size: 0.75rem;
  color: rgba(255, 215, 0, 0.6);
  margin-top: 0.5rem;
  letter-spacing: 0.08em;
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ── Splash Container (score popups) ────────────────────────────── */
.splash-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 30;
}

.splash-text {
  position: fixed;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 2rem;
  pointer-events: none;
  animation: splash-float 1.5s ease-out forwards;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.8);
}

.splash-text.swish {
  color: #00ff88;
  text-shadow: 0 0 16px rgba(0, 255, 136, 0.8);
}

.splash-text.score {
  color: #ffd700;
}

@keyframes splash-float {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(0, -80px) scale(0.8);
  }
}

/* ── Screen Overlays ────────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 8, 24, 0.95);
  backdrop-filter: blur(4px);
  font-family: 'Cinzel', serif;
  padding: 2rem;
}

.screen.active {
  display: flex;
}

.screen-content {
  text-align: center;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fade-in 0.4s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.title {
  font-size: 3.5rem;
  color: #ffd700;
  letter-spacing: 0.12em;
  text-shadow: 0 0 24px rgba(255, 215, 0, 0.6);
}

.subtitle {
  font-size: 1.2rem;
  color: rgba(255, 215, 0, 0.7);
  letter-spacing: 0.08em;
  font-style: italic;
}

.best-score {
  font-size: 1rem;
  color: rgba(255, 215, 0, 0.6);
}

#bestScoreValue {
  color: #00ff88;
  font-weight: 700;
}

.instructions {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
}

.instructions p {
  margin: 0.5rem 0;
}

.instructions strong {
  color: #ffd700;
}

.score-box {
  background: rgba(20, 16, 40, 0.6);
  border: 2px solid rgba(255, 215, 0, 0.4);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.score-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Courier New', monospace;
}

.score-line .label {
  color: rgba(255, 215, 0, 0.6);
}

.score-line .value {
  color: #00ff88;
  font-weight: 700;
  font-size: 1.2rem;
}

.leaderboard-prompt {
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.4);
  border-radius: 6px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.leaderboard-prompt p {
  color: #00ff88;
  font-size: 0.95rem;
  margin: 0;
}

#playerName {
  padding: 0.75rem;
  border: 1px solid rgba(0, 255, 136, 0.4);
  background: rgba(10, 8, 24, 0.8);
  color: #fff;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  text-align: center;
}

#playerName::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  padding: 0.75rem 2rem;
  border: 2px solid rgba(255, 215, 0, 0.5);
  background: rgba(20, 16, 40, 0.7);
  color: #ffd700;
  border-radius: 4px;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  background: rgba(20, 16, 40, 0.95);
  border-color: rgba(255, 215, 0, 0.8);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.3);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
  border-color: rgba(255, 215, 0, 0.6);
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0.1));
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.btn-secondary {
  color: #00ff88;
  border-color: rgba(0, 255, 136, 0.5);
}

.btn-secondary:hover {
  border-color: rgba(0, 255, 136, 0.8);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.3);
}

/* ── Mobile Controls ────────────────────────────────────────────── */
.mobile-controls {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

.mobile-controls.active {
  display: flex;
}

.joystick-base {
  width: 110px;
  height: 110px;
  background: rgba(20, 16, 40, 0.55);
  border: 2px solid rgba(255, 215, 0, 0.6);
  border-radius: 50%;
  position: relative;
  pointer-events: auto;
  touch-action: none;
}

.joystick-stick {
  width: 44px;
  height: 44px;
  background: rgba(255, 215, 0, 0.85);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

.mobile-action-buttons {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  pointer-events: auto;
}

.mobile-charge-bars {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 140px;
}

.mobile-charge-track {
  height: 10px;
  background: rgba(20, 16, 40, 0.7);
  border: 1px solid rgba(255, 215, 0, 0.5);
  border-radius: 5px;
  overflow: hidden;
}

.mobile-charge-fill {
  height: 100%;
  width: 0%;
  transition: width 0.05s linear;
}

.mobile-angle-fill {
  background: linear-gradient(90deg, #00aaff, #00ff88);
}

.mobile-power-fill {
  background: linear-gradient(90deg, #00ff88, #ffd700, #ff8800);
}

.mobile-action-row {
  display: flex;
  gap: 0.75rem;
}

.mobile-btn {
  border: 2px solid rgba(255, 215, 0, 0.6);
  border-radius: 50%;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: #ffd700;
  background: rgba(20, 16, 40, 0.6);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-btn-angle {
  width: 68px;
  height: 68px;
  font-size: 0.7rem;
}

.mobile-btn-shoot {
  width: 84px;
  height: 84px;
  font-size: 0.85rem;
  background: rgba(255, 102, 0, 0.35);
  border-color: rgba(255, 140, 0, 0.8);
}

.mobile-btn:active {
  background: rgba(255, 215, 0, 0.35);
}

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hud {
    padding: 0.75rem;
    gap: 0.5rem;
  }

  .hud-left, .hud-right {
    gap: 1rem;
  }

  .stat-value {
    font-size: 1.2rem;
  }

  .title {
    font-size: 2.5rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .screen-content {
    gap: 1rem;
  }

  .btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
  }

  .shot-meter {
    bottom: 1.5rem;
  }

  .meter-bar {
    width: 150px;
  }
}
