/* Joe Eddie's Alley Bowl - Vintage Bowling Lanes Style */
:root {
  /* Logo palette: deep red, teal, cream, gold */
  --vintage-red: #8B1538;
  --vintage-red-dark: #5C0E26;
  --vintage-teal: #2D6B6B;
  --vintage-teal-light: #3D8B8B;
  --cream: #FFF8F0;
  --cream-warm: #F5E6D3;
  --gold: #D4AF37;
  --gold-dark: #B8962E;
  --lane-wood: #8B4513;
  --lane-dark: #5D2E0C;
  --lane-light: #A0522D;
  --pin-white: #FFF8F0;
  --pin-shadow: #2C1810;
  --ball-maroon: #722F37;
  --ball-highlight: #9B4B54;
  --accent-gold: var(--gold);
  --accent-neon: var(--vintage-teal-light);
  --bg-dark: #0D0508;
  --text-cream: var(--cream-warm);
  --text-muted: #8B7355;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-dark);
  color: var(--text-cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* background-image set by background.js */
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.game-container {
  max-width: 900px;
  width: 100%;
  padding: 2rem;
}

.game-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.game-logo {
  max-width: 320px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 1rem;
  filter: drop-shadow(0 4px 20px rgba(139, 21, 56, 0.4));
}

.scoreboard {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 1rem 2rem;
  background: linear-gradient(180deg, rgba(139, 21, 56, 0.3), rgba(45, 107, 107, 0.2));
  border-radius: 12px;
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(212, 175, 55, 0.15);
}

.scoreboard .label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.scoreboard span:not(.label) {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-neon);
}

.best-score span:not(.label) {
  color: var(--accent-gold);
}

.new-record {
  font-size: 1.25rem;
  color: var(--accent-gold);
  margin-bottom: 1rem;
  animation: pulse 0.8s ease-in-out infinite;
}

.new-record.hidden {
  display: none;
}

@keyframes pulse {
  50% { transform: scale(1.05); opacity: 0.9; }
}

.game-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.lane-container {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.05s linear;
  box-shadow: 
    0 0 0 4px var(--vintage-red-dark),
    0 0 0 8px var(--vintage-red),
    0 20px 60px rgba(0, 0, 0, 0.6),
    inset 0 0 100px rgba(0, 0, 0, 0.3);
}

#game-canvas {
  display: block;
  width: 100%;
  max-width: 800px;
  max-height: 700px;
  height: auto;
  background: linear-gradient(
    180deg,
    var(--lane-light) 0%,
    var(--lane-wood) 20%,
    var(--lane-dark) 100%
  );
  cursor: crosshair;
}

.lane-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 12px;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.2);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.25rem 2rem;
  background: linear-gradient(180deg, rgba(139, 21, 56, 0.25), rgba(45, 107, 107, 0.15));
  border-radius: 12px;
  border: 2px solid var(--gold);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 800px;
}

.aim-control,
.power-control,
.spin-control {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 140px;
}

.spin-control label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.spin-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: var(--lane-dark);
  border-radius: 4px;
  outline: none;
}

.spin-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent-gold);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
  transition: transform 0.15s ease;
}

.aim-control label,
.power-control label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.aim-control input[type="range"],
.power-control input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: var(--lane-dark);
  border-radius: 4px;
  outline: none;
}

.aim-control input[type="range"]::-webkit-slider-thumb,
.power-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent-gold);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
  transition: transform 0.15s ease;
}

.aim-control input[type="range"]::-webkit-slider-thumb:hover,
.power-control input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.throw-btn {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  padding: 0.75rem 2rem;
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  color: var(--vintage-red-dark);
  border: 2px solid var(--cream);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.throw-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

.throw-btn:active {
  transform: translateY(0);
}

.throw-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.key-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  align-self: center;
}

.frame-scores {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 800px;
}

.frame-cell {
  width: 48px;
  padding: 0.5rem;
  background: linear-gradient(180deg, rgba(139, 21, 56, 0.4), rgba(45, 107, 107, 0.2));
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--gold);
}

.frame-cell .frame-num {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.frame-cell .rolls {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-cream);
  min-height: 1.2em;
}

.frame-cell .roll-strike {
  color: var(--accent-gold);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

.frame-cell .roll-spare {
  color: var(--vintage-teal-light);
  font-weight: 700;
  text-shadow: 0 0 6px rgba(61, 139, 139, 0.5);
}

.frame-cell .score {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-neon);
  margin-top: 0.25rem;
}

.frame-cell.active {
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.game-over {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.game-over.hidden {
  display: none;
}

.game-over-content {
  text-align: center;
  padding: 3rem;
  background: linear-gradient(180deg, var(--vintage-red-dark), var(--bg-dark));
  border-radius: 16px;
  border: 3px solid var(--gold);
  box-shadow: 0 0 60px rgba(212, 175, 55, 0.3), inset 0 0 40px rgba(0, 0, 0, 0.3);
}

.game-over-brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  opacity: 0.9;
}

.game-over-content h2 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.5rem;
  letter-spacing: 0.1em;
  color: var(--cream);
  margin-bottom: 0.5rem;
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.game-over-content p {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--text-cream);
}

.game-over-content p.game-over-brand {
  margin-bottom: 0.5rem;
}

#final-score {
  color: var(--accent-neon);
  font-weight: 700;
  font-size: 1.5rem;
}

#restart-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 2rem;
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  color: var(--vintage-red-dark);
  border: 2px solid var(--cream);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#restart-btn:hover {
  background: #E5C04A;
  transform: scale(1.05);
}

.achievements {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  min-height: 2rem;
}

.achievement-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.3), rgba(212, 175, 55, 0.1));
  border: 1px solid var(--accent-gold);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--accent-gold);
  animation: badgePop 0.5s ease-out;
}

@keyframes badgePop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* Music Player - Joe Eddie Radio */
.music-player {
  width: 100%;
  max-width: 800px;
  margin-top: 1.5rem;
}

.player-toggle-btn {
  width: 100%;
  padding: 0.6rem 1rem;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, rgba(139, 21, 56, 0.6), rgba(45, 107, 107, 0.4));
  color: var(--gold);
  border: 2px solid var(--gold);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.player-toggle-btn:hover {
  background: linear-gradient(180deg, rgba(139, 21, 56, 0.8), rgba(45, 107, 107, 0.5));
}

.player-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: linear-gradient(180deg, rgba(139, 21, 56, 0.3), rgba(45, 107, 107, 0.2));
  border: 2px solid var(--gold);
  border-top: none;
  border-radius: 0 0 8px 8px;
}

.player-panel.open {
  max-height: 340px;
}

.player-now {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.player-now span {
  color: var(--cream);
  font-weight: 600;
}

.player-controls {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
}

.player-controls button {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: rgba(0, 0, 0, 0.3);
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: none;
}

.player-controls button svg {
  flex-shrink: 0;
  pointer-events: none;
}


.player-controls button:hover {
  background: var(--gold);
  color: var(--vintage-red-dark);
}

.player-volume {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
}

body.ios .player-volume {
  display: none;
}

.player-volume-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.player-volume input[type="range"] {
  -webkit-appearance: none;
  width: 70px;
  height: 6px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 3px;
  outline: none;
}

.player-volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--gold);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(212, 175, 55, 0.5);
}

.player-tracks {
  max-height: 140px;
  overflow-y: auto;
  padding: 0.5rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(0, 0, 0, 0.3);
}

.player-tracks::-webkit-scrollbar {
  width: 8px;
}

.player-tracks::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

.player-tracks::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 4px;
}

.player-tracks::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dark);
}

.player-track {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  text-align: left;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-cream);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.player-track:hover,
.player-track.active {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold);
  color: var(--gold);
}

.player-empty {
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.game-footer {
  text-align: center;
  padding: 1.5rem 2rem;
  margin-top: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.game-footer a {
  color: var(--gold);
  text-decoration: none;
  transition: color 0.2s ease;
}

.game-footer a:hover {
  color: var(--cream);
}

button:focus-visible,
input[type="range"]:focus-visible,
.player-track:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .game-logo {
    max-width: 260px;
  }

  .controls {
    flex-direction: column;
  }

  .aim-control,
  .power-control {
    width: 100%;
  }
}
