/* ==========================================================
   SANGEET BEAT HERO — Retro 4-Lane Indian Wedding Rhythm Game
   Mobile-First Portrait Viewport (Touch & Keyboard)
   ========================================================== */

/* --- Modal Overlay & Container --- */
.bh-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(10, 4, 8, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  font-family: 'Press Start 2P', monospace;
  box-sizing: border-box;
}

.bh-modal.active {
  display: flex;
}

/* --- Game Cabinet Viewport (9:16 Portrait) --- */
.bh-cabinet {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 440px;
  max-height: 920px;
  background: #14050d;
  background: radial-gradient(circle at 50% 25%, #240a17 0%, #14050d 70%, #0a0206 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.85);
  border: 2px solid rgba(255, 215, 0, 0.35);
}

@media (min-width: 600px) {
  .bh-cabinet {
    border-radius: 20px;
    height: 95vh;
  }
}

/* --- Baraat Fever Border Pulse --- */
.bh-cabinet.fever-mode {
  border-color: #ffd700;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.6), inset 0 0 20px rgba(255, 215, 0, 0.2);
  animation: bhFeverBorder 0.6s ease-in-out infinite alternate;
}

@keyframes bhFeverBorder {
  0% { box-shadow: 0 0 18px rgba(255, 215, 0, 0.4), inset 0 0 12px rgba(255, 215, 0, 0.15); }
  100% { box-shadow: 0 0 35px rgba(255, 123, 0, 0.7), inset 0 0 25px rgba(255, 123, 0, 0.3); }
}

/* --- Top Header / HUD Bar --- */
.bh-hud {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 6px;
  background: linear-gradient(180deg, rgba(20, 5, 13, 0.95) 0%, rgba(20, 5, 13, 0.5) 100%);
  border-bottom: 1.5px solid rgba(255, 215, 0, 0.25);
  font-size: 10px;
  color: #fff;
}

.bh-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.4);
  color: #ffd700;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 9px;
  transition: all 0.15s ease;
}

.bh-close-btn:hover {
  background: rgba(231, 76, 60, 0.3);
  border-color: #e74c3c;
  color: #fff;
}

.bh-hud-stats {
  display: flex;
  gap: 14px;
  align-items: center;
}

.bh-stat-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.bh-stat-label {
  font-size: 7px;
  color: #f1c40f;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.bh-stat-value {
  font-size: 11px;
  color: #fff;
  font-weight: bold;
}

.bh-multiplier-pill {
  background: #e74c3c;
  color: #fff;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: bold;
  transition: transform 0.1s ease;
}

.bh-multiplier-pill.fever {
  background: linear-gradient(135deg, #ffd700, #ff5722);
  color: #14050d;
  animation: bhPulseFever 0.3s infinite alternate;
}

@keyframes bhPulseFever {
  0% { transform: scale(1); }
  100% { transform: scale(1.15); }
}

/* --- Stage Zone (Top: 36%) --- */
.bh-stage {
  position: relative;
  height: 35%;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8px;
  background: radial-gradient(ellipse at bottom, rgba(231, 76, 60, 0.15) 0%, transparent 70%);
  overflow: hidden;
}

.bh-stage-lights {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  display: flex;
  justify-content: space-around;
  pointer-events: none;
  opacity: 0.7;
}

.bh-stage-light {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffd700;
  box-shadow: 0 0 10px #ffd700;
  opacity: 0.75;
  will-change: transform, opacity;
  animation: bhLightTwinkle 0.8s infinite alternate;
}

.bh-stage-light:nth-child(2) { animation-delay: 0.2s; background: #e74c3c; box-shadow: 0 0 10px #e74c3c; }
.bh-stage-light:nth-child(3) { animation-delay: 0.4s; background: #2ecc71; box-shadow: 0 0 10px #2ecc71; }
.bh-stage-light:nth-child(4) { animation-delay: 0.6s; background: #f39c12; box-shadow: 0 0 10px #f39c12; }

@keyframes bhLightTwinkle {
  0% { opacity: 0.45; transform: scale(0.88); }
  100% { opacity: 1; transform: scale(1.12); }
}

/* Couple Pixel Sprite Display */
.bh-sprite-container {
  position: relative;
  width: 190px;
  height: 160px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bh-sprite-img {
  width: auto;
  height: 145px;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-crisp-edges;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  transition: transform 0.08s ease-out;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
  will-change: transform;
}

.bh-sprite-img.beat-bounce {
  transform: translateY(3px) scale(1.02, 0.98);
}

.bh-sprite-img.cheer-pop {
  transform: translateY(-5px) scale(1.04, 1.04) rotate(-0.8deg);
}

.bh-sprite-img.fever-pop {
  transform: translateY(2px) scale(1.02, 0.98) rotate(0.8deg);
}

.bh-sprite-img.miss-wobble {
  animation: bhWobble 0.25s ease-in-out;
}

@keyframes bhWobble {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-1deg); }
  75% { transform: translateX(4px) rotate(1deg); }
}

/* Floating Judgments ("Shaandar!", "Wah Wah!", "Arre Yaar!") */
.bh-judgment-layer {
  position: absolute;
  top: 15%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 20;
}

.bh-judgment {
  font-size: 13px;
  font-weight: bold;
  text-shadow: 0 2px 0 #000, 0 0 8px currentColor;
  opacity: 0;
  white-space: nowrap;
  text-align: center;
  will-change: transform, opacity;
}

.bh-judgment.animate {
  animation: bhJudgmentPop 0.42s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

.bh-judgment.perfect   { color: #f1c40f; }
.bh-judgment.great     { color: #2ecc71; }
.bh-judgment.good      { color: #3498db; }
.bh-judgment.miss      { color: #e74c3c; }
.bh-judgment.buff-wait  { opacity: 1 !important; color: #f39c12 !important; font-size: 11px !important; animation: bhPulseFever 0.6s infinite alternate !important; }

@keyframes bhJudgmentPop {
  0% { transform: scale(0.6) translateY(12px); opacity: 0; }
  35% { transform: scale(1.2) translateY(-2px); opacity: 1; }
  100% { transform: scale(1) translateY(-14px); opacity: 0; }
}

/* Combo Popup in Stage */
.bh-combo-display {
  position: absolute;
  bottom: 6px;
  font-size: 10px;
  color: #ffd700;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.bh-combo-display.visible {
  opacity: 1;
}

/* --- Highway Zone (Bottom: 65%) --- */
.bh-highway-container {
  position: relative;
  flex: 1;
  width: 100%;
  background: #0f030a;
  background: linear-gradient(180deg, #180612 0%, #0d0208 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 2px solid rgba(255, 215, 0, 0.4);
}

/* 4 Vertical Lanes Grid */
.bh-lanes-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  pointer-events: none;
}

.bh-lane-col {
  position: relative;
  height: 100%;
  border-right: 1px dashed rgba(255, 215, 0, 0.15);
}

.bh-lane-col:last-child {
  border-right: none;
}

.bh-lane-col.lane-0 { background: linear-gradient(180deg, transparent 0%, rgba(46, 204, 113, 0.05) 100%); }
.bh-lane-col.lane-1 { background: linear-gradient(180deg, transparent 0%, rgba(243, 156, 18, 0.05) 100%); }
.bh-lane-col.lane-2 { background: linear-gradient(180deg, transparent 0%, rgba(241, 196, 15, 0.05) 100%); }
.bh-lane-col.lane-3 { background: linear-gradient(180deg, transparent 0%, rgba(231, 76, 60, 0.05) 100%); }

.bh-lane-col.active-flash {
  background: rgba(255, 255, 255, 0.18) !important;
}

/* Main Canvas Layer for scrolling notes & particles */
.bh-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transform: translateZ(0);
  will-change: transform;
}

/* --- Hit Line & Receptors (Bottom Area) --- */
.bh-receptors-row {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 85px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: linear-gradient(180deg, rgba(20, 5, 13, 0.4) 0%, rgba(14, 3, 10, 0.95) 100%);
  z-index: 15;
  pointer-events: auto;
}

.bh-hit-guide-text {
  position: absolute;
  bottom: 88px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 7px;
  color: rgba(255, 215, 0, 0.75);
  letter-spacing: 0.5px;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  animation: bhPulseGuide 1.5s ease-in-out infinite alternate;
}

@keyframes bhPulseGuide {
  0% { opacity: 0.55; }
  100% { opacity: 0.95; }
}

.bh-receptor-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px 0 8px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.bh-receptor-btn:active,
.bh-receptor-btn.pressed {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(0.95);
}

.bh-receptor-btn.lane-0.pressed { background: rgba(46, 204, 113, 0.35); }
.bh-receptor-btn.lane-1.pressed { background: rgba(243, 156, 18, 0.35); }
.bh-receptor-btn.lane-2.pressed { background: rgba(241, 196, 15, 0.35); }
.bh-receptor-btn.lane-3.pressed { background: rgba(231, 76, 60, 0.35); }

.bh-receptor-icon {
  font-size: 22px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
  pointer-events: none;
}

.bh-receptor-key {
  font-size: 7px;
  font-family: inherit;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 5px;
  border-radius: 3px;
  border: 1px solid rgba(255, 215, 0, 0.35);
  pointer-events: none;
}

/* --- Song Selector on Start Screen --- */
.bh-song-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  margin-bottom: 18px;
}

.bh-song-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 215, 0, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.bh-song-card:hover {
  background: rgba(255, 215, 0, 0.1);
  border-color: rgba(255, 215, 0, 0.5);
}

.bh-song-card.selected {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.2) 0%, rgba(231, 76, 60, 0.2) 100%);
  border-color: #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.bh-song-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bh-song-title {
  font-size: 8px;
  color: #fff;
  font-weight: bold;
}

.bh-song-meta {
  font-size: 6px;
  color: #f1c40f;
}

.bh-song-badge {
  font-size: 6px;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.5);
  color: #ffd700;
  border: 1px solid rgba(255, 215, 0, 0.3);
}

/* --- Start Overlay ("Ready, Set, Sangeet!") --- */
.bh-start-overlay,
.bh-result-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(14, 4, 10, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  text-align: center;
  box-sizing: border-box;
  overflow-y: auto;
}

.bh-banner-badge {
  background: linear-gradient(135deg, #ffd700, #f39c12);
  color: #14050d;
  font-size: 8px;
  padding: 5px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.bh-title-text {
  font-size: 16px;
  color: #ffd700;
  line-height: 1.5;
  margin-bottom: 8px;
  text-shadow: 0 3px 0 #8b0000;
}

.bh-subtitle-text {
  font-size: 8px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 320px;
}

.bh-primary-btn {
  background: linear-gradient(180deg, #ffd700 0%, #e67e22 100%);
  border: 2px solid #fff;
  color: #14050d;
  font-family: inherit;
  font-size: 11px;
  font-weight: bold;
  padding: 14px 22px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 6px 0 #935116, 0 8px 18px rgba(255, 215, 0, 0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bh-primary-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #935116, 0 4px 10px rgba(255, 215, 0, 0.2);
}

.bh-instruction-keys {
  margin-top: 24px;
  display: flex;
  gap: 8px;
  font-size: 7px;
  color: rgba(255, 215, 0, 0.8);
}

/* --- Countdown Overlay --- */
.bh-countdown {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  pointer-events: none;
}

.bh-countdown.active {
  display: flex;
}

.bh-countdown-num {
  font-size: 42px;
  color: #ffd700;
  text-shadow: 0 4px 0 #8b0000, 0 0 25px #ffd700;
  animation: bhCountdownPulse 0.75s ease-out infinite;
}

@keyframes bhCountdownPulse {
  0% { transform: scale(1.6); opacity: 0; }
  40% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.2; }
}

/* --- Results Screen Stats Box --- */
.bh-results-card {
  width: 100%;
  max-width: 340px;
  background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 215, 0, 0.3);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bh-rank-badge {
  font-size: 10px;
  color: #ffd700;
  line-height: 1.5;
  padding: 6px 10px;
  background: rgba(255, 215, 0, 0.12);
  border-radius: 6px;
  border: 1px dashed rgba(255, 215, 0, 0.4);
}

.bh-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bh-res-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0,0,0,0.4);
  padding: 8px;
  border-radius: 6px;
}

.bh-res-lbl {
  font-size: 7px;
  color: #f1c40f;
  margin-bottom: 4px;
}

.bh-res-val {
  font-size: 11px;
  color: #fff;
}

.bh-actions-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 280px;
}

.bh-secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 215, 0, 0.4);
  color: #fff;
  font-family: inherit;
  font-size: 9px;
  padding: 11px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.bh-secondary-btn:hover {
  background: rgba(255, 215, 0, 0.18);
}

/* Secret Level Unlock Button inside Pokemon victory box */
.beat-hero-unlock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 14px;
  padding: 13px 16px;
  background: linear-gradient(180deg, #ffd700 0%, #d35400 100%);
  border: 2px solid #fff;
  border-radius: 12px;
  color: #14050d;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  font-weight: bold;
  line-height: 1.5;
  cursor: pointer;
  box-shadow: 0 4px 0 #935116, 0 6px 16px rgba(255, 215, 0, 0.4);
  animation: bhSecretButtonPulse 1.4s infinite alternate;
  text-decoration: none;
  box-sizing: border-box;
}

.beat-hero-unlock-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #935116, 0 2px 8px rgba(255, 215, 0, 0.3);
}

@keyframes bhSecretButtonPulse {
  0% { transform: scale(1); box-shadow: 0 4px 0 #935116, 0 0 10px rgba(255, 215, 0, 0.3); }
  100% { transform: scale(1.02); box-shadow: 0 4px 0 #935116, 0 0 22px rgba(255, 215, 0, 0.7); }
}
