:root{
  --bg: #1296ff;         /* bright blue */
  --yellow: #ffe85a;     /* yellow-ish */
  --red: #ff2b2b;
  --ink: #111;
}

*{ box-sizing:border-box; }
html, body{
  height:100%;
  margin:0;
  background: var(--bg);
  overflow:hidden;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.screen{
  position:absolute;
  inset:0;
  display:none;
  background: var(--bg);
}
.screen.active{ display:block; }

/* Landing */
#screenLanding{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 22px;
  padding: 24px;
}

#landingTitle{
  color: var(--yellow);
  font-weight: 900;
  text-align:center;
  line-height: 1.05;
  margin: 0;
  transform: translateY(-10vh);
  letter-spacing: 0.5px;
  text-shadow: 0 4px 0 rgba(0,0,0,0.15);
  font-size: clamp(34px, 6vw, 72px);
}
#landingTitle span{ display:block; }

#startBtn{
  width: min(360px, 80vw);
  height: min(150px, 18vh);
  border-radius: 26px;
  background: var(--yellow);
  border: 8px solid var(--red);
  color: var(--red);
  font-weight: 1000;
  font-size: clamp(34px, 6vw, 56px);
  cursor:pointer;
  box-shadow: 0 16px 34px rgba(0,0,0,0.22);
}
#startBtn:active{ transform: scale(0.98); }

/* Game HUD */
#hud{
  position:fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  pointer-events:none;
  z-index: 20;
}
#brand{
  color: var(--yellow);
  font-weight: 900;
  font-size: 20px;
  pointer-events:none;
  text-shadow: 0 3px 0 rgba(0,0,0,0.12);
}
.hudTab{
  pointer-events:auto;
  background: transparent;
  border: 2px solid rgba(255,232,90,0.9);
  color: var(--yellow);
  font-weight: 800;
  border-radius: 14px;
  padding: 8px 12px;
  cursor:pointer;
}

#stats{
  position:fixed;
  top: 52px;
  left: 10px;
  display:flex;
  gap: 14px;
  flex-wrap:wrap;
  color: var(--yellow);
  font-weight: 800;
  text-shadow: 0 3px 0 rgba(0,0,0,0.12);
  z-index: 20;
  pointer-events:none;
}
#modeText{ opacity:0.95; }

#topBanner{
  position:fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--yellow);
  font-weight: 1000;
  font-size: clamp(42px, 10vw, 96px);
  text-shadow: 0 6px 0 rgba(0,0,0,0.18);
  z-index: 30;
  pointer-events:none;
  opacity:0;
}

/* Stage */
#stage{
  position:absolute;
  inset:0;
}

/* Goats */
.goat{
  position:absolute;
  width: clamp(92px, 16vw, 150px);
  height: auto;
  transform: translate(-50%, -50%);
  user-select:none;
  touch-action:none;
  cursor: grab;
}
.goat:active{ cursor: grabbing; }

.goat svg{
  width:100%;
  height:auto;
  filter: drop-shadow(0 10px 10px rgba(0,0,0,0.20));
}

.goat .halo{ opacity:0; }
.goat.target .halo{ opacity:1; }

.goat.squish{
  transform: translate(-50%,-50%) scale(1.08, 0.92);
}

/* Boss (Wolf) */
#bossEl{
  position:absolute;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.25);
  z-index: 8;
  touch-action: manipulation;
  user-select:none;
}

#bossEl .bossInner{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-end;
  gap: 6px;
  padding-bottom: 10px;
  pointer-events:none;
}

#bossEl .bossTitle{
  color: rgba(255,232,90,0.98);
  font-weight: 1000;
  font-size: clamp(14px, 2.8vw, 22px);
  text-shadow: 0 4px 0 rgba(0,0,0,0.20);
}
#bossEl .bossHP{
  color: rgba(255,232,90,0.95);
  font-weight: 1000;
  font-size: clamp(12px, 2.4vw, 18px);
  opacity: 0.95;
}

#bossEl.hit{
  transform: translate(-50%, -50%) scale(0.92);
}

/* Goat dance */
.goat.dance{
  animation: goatDance 0.28s infinite alternate ease-in-out;
}
@keyframes goatDance{
  from { transform: translate(-50%,-50%) rotate(-8deg) scale(1.03); }
  to   { transform: translate(-50%,-50%) rotate(10deg)  scale(0.98); }
}

/* Overlays */
.overlay{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,0.35);
  z-index: 50;
}
.hidden{ display:none; }

.overlayCard{
  width: min(640px, 92vw);
  border-radius: 20px;
  background: rgba(17,17,17,0.92);
  color: var(--yellow);
  padding: 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);
}

#loseText{
  font-weight: 1000;
  text-align:center;
  font-size: clamp(44px, 9vw, 90px);
  margin: 6px 0 14px;
}

.overlayButtons{
  display:flex;
  gap: 12px;
  justify-content:center;
  flex-wrap:wrap;
}
.overlayButtons button{
  background: var(--yellow);
  color: var(--red);
  border: 5px solid var(--red);
  border-radius: 18px;
  font-weight: 1000;
  font-size: 20px;
  padding: 12px 16px;
  cursor:pointer;
}

/* High score prompt */
.highScorePrompt{
  margin: 10px auto 16px;
  padding: 12px;
  border: 2px solid rgba(255,232,90,0.6);
  border-radius: 14px;
}
.hsTitle{
  text-align:center;
  font-weight: 1000;
  font-size: 22px;
  margin-bottom: 10px;
}
.hsRow{
  display:flex;
  gap: 10px;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  margin-bottom: 10px;
}
.hsRow label{
  font-weight: 900;
}
#usernameInput{
  width: min(260px, 80vw);
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid rgba(255,232,90,0.65);
  background: rgba(255,255,255,0.12);
  color: var(--yellow);
  font-weight: 900;
  outline: none;
}
#saveHighScoreBtn{
  display:block;
  margin: 0 auto;
  background: var(--yellow);
  color: var(--red);
  border: 5px solid var(--red);
  border-radius: 18px;
  font-weight: 1000;
  font-size: 18px;
  padding: 10px 14px;
  cursor:pointer;
}
.hsSavedMsg{
  margin-top: 10px;
  text-align:center;
  font-weight: 900;
  opacity: 0.95;
}

/* Instructions */
.instructionsCard .instructionsHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 10px;
}
.instructionsTitle{
  font-weight:1000;
  font-size: 26px;
}
.closeX{
  background: transparent;
  color: var(--yellow);
  border: 2px solid rgba(255,232,90,0.9);
  border-radius: 14px;
  font-weight: 1000;
  padding: 8px 12px;
  cursor:pointer;
}
.instructionsBody{
  color: var(--yellow);
  font-weight: 700;
  line-height: 1.4;
}
.instructionsBody ul{
  margin-top: 8px;
}
