/* ============================================================
   Shane's Wild Night - Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Boogaloo&family=Nunito:wght@400;700;900&display=swap');

:root {
  --bg: #0d0d1a;
  --surface: #161628;
  --card: #1e1e38;
  --accent: #f5a623;
  --accent2: #e84393;
  --green: #2ecc71;
  --red: #e74c3c;
  --blue: #3498db;
  --text: #f0e6ff;
  --muted: #8888aa;
  --hud-h: 64px;
  --dpad-h: 160px;
  --glow: 0 0 20px rgba(245,166,35,0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: 'Nunito', sans-serif;
  color: var(--text);
}

/* ======================== SCREENS ======================== */
#app {
  width: 100%;
  height: 100%;
  position: relative;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.hidden { display: none !important; }

/* ======================== START SCREEN ======================== */
#start-screen {
  background: radial-gradient(ellipse at 50% 0%, #2a1a5e 0%, #0d0d1a 70%);
  gap: 24px;
}

.title-block {
  text-align: center;
}

.game-title {
  font-family: 'Boogaloo', cursive;
  font-size: clamp(2.2rem, 7vw, 4rem);
  color: var(--accent);
  text-shadow: 0 0 30px rgba(245,166,35,0.6), 0 4px 0 rgba(0,0,0,0.5);
  line-height: 1.1;
  margin-bottom: 8px;
}

.subtitle {
  font-size: clamp(0.9rem, 3vw, 1.15rem);
  color: var(--muted);
  font-style: italic;
}

.instructions {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 20px 28px;
  max-width: 480px;
  width: 100%;
}

.instructions h3 {
  font-family: 'Boogaloo', cursive;
  font-size: 1.15rem;
  color: var(--accent);
  margin-bottom: 10px;
  margin-top: 12px;
}
.instructions h3:first-child { margin-top: 0; }

.instructions ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.instructions li {
  font-size: 0.88rem;
  color: var(--text);
  opacity: 0.9;
  line-height: 1.4;
}

/* ======================== BUTTONS ======================== */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #e07b00);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 48px;
  font-family: 'Boogaloo', cursive;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(245,166,35,0.45), 0 4px 12px rgba(0,0,0,0.4);
  transition: transform 0.12s, box-shadow 0.12s;
  letter-spacing: 0.5px;
}

.btn-primary:hover, .btn-primary:active {
  transform: scale(1.06);
  box-shadow: 0 0 36px rgba(245,166,35,0.65), 0 6px 16px rgba(0,0,0,0.5);
}

/* ======================== HUD ======================== */
#hud {
  width: 100%;
  height: var(--hud-h);
  background: var(--surface);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 12px;
  flex-shrink: 0;
  z-index: 10;
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 60px;
}

.hud-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#score, #lives, #beers {
  font-family: 'Boogaloo', cursive;
  font-size: 1.3rem;
  color: var(--accent);
}

#lives { font-size: 1rem; }

.status-item { min-width: 120px; }

#status-label {
  font-family: 'Boogaloo', cursive;
  font-size: 1rem;
  text-align: center;
  color: var(--green);
  animation: pulse 0.8s infinite alternate;
}

@keyframes pulse {
  from { opacity: 1; }
  to   { opacity: 0.5; }
}

/* ======================== GAME SCREEN ======================== */
#game-screen {
  padding: 0;
  justify-content: flex-start;
  background: var(--bg);
}

#canvas-wrapper {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #05050f;
}

#game-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
}

/* ======================== D-PAD ======================== */
#dpad {
  width: 100%;
  height: var(--dpad-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px;
  background: var(--surface);
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.dpad-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.dpad-middle {
  gap: 4px;
}

.dpad-btn {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--card);
  color: var(--text);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.1s, transform 0.1s;
  -webkit-appearance: none;
  outline: none;
}

.dpad-btn:active {
  background: var(--accent);
  transform: scale(0.93);
}

.dpad-center {
  width: 52px;
  height: 52px;
}

/* ======================== GAME OVER ======================== */
#gameover-screen {
  background: rgba(10,10,26,0.95);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.overlay-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 40px 40px 32px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

#end-title {
  font-family: 'Boogaloo', cursive;
  font-size: 2.8rem;
  color: var(--accent);
  text-shadow: var(--glow);
}

#end-message {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.5;
}

.final-score {
  font-family: 'Boogaloo', cursive;
  font-size: 1.6rem;
  color: var(--green);
}

/* ======================== RESPONSIVE ======================== */
@media (max-width: 480px) {
  .instructions {
    padding: 16px 18px;
  }
  .dpad-btn {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  #dpad {
    height: 100px;
    flex-direction: row;
    gap: 20px;
  }
  .dpad-row {
    flex-direction: column;
  }
  .dpad-middle {
    flex-direction: row;
    align-items: center;
  }
  .dpad-btn {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }
}

/* ======================== SCREEN ON DESKTOP ======================== */
@media (min-width: 769px) {
  #dpad {
    display: none;
  }
  #game-screen #canvas-wrapper {
    padding: 16px;
  }
}

/* invincible flash */
@keyframes invincible-border {
  0%   { box-shadow: 0 0 0 4px #f5a623; }
  25%  { box-shadow: 0 0 0 4px #e84393; }
  50%  { box-shadow: 0 0 0 4px #3498db; }
  75%  { box-shadow: 0 0 0 4px #2ecc71; }
  100% { box-shadow: 0 0 0 4px #f5a623; }
}
#game-canvas.invincible {
  animation: invincible-border 0.4s linear infinite;
  border-radius: 4px;
}

/* ======================== VICTORY SCREEN ======================== */
#win-screen {
  background: #0d0d1a;
  padding: 0;
  z-index: 200;
}

#win-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Eminem image — nearly fills screen */
#win-eminem-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

#win-eminem-img {
  height: 88vh;
  max-height: 88vh;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Speech bubble */
#speech-bubble {
  position: absolute;
  top: 5vh;
  left: 50%;
  transform: translateX(-10%);
  background: #fff;
  color: #111;
  border-radius: 20px;
  padding: 18px 22px;
  max-width: min(380px, 55vw);
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.5s ease;
}

#speech-bubble.visible {
  opacity: 1;
}

/* Tail pointing down-left toward Eminem's mouth */
#speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -18px;
  left: 28px;
  border: 10px solid transparent;
  border-top-color: #fff;
}

#speech-text {
  font-family: 'Boogaloo', cursive;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  line-height: 1.4;
  color: #111;
}

/* Shane hearts — fades in on top of eminem */
#win-shane-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}

#win-shane-img.fadeIn {
  opacity: 1;
}

/* Play Again footer */
#win-footer {
  position: absolute;
  bottom: 5vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transition: opacity 0.8s ease;
  z-index: 10;
}

#win-footer.visible {
  opacity: 1;
}

#win-footer .final-score {
  font-size: 1.4rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}
