:root {
  --fab-red: #e53935;
  --fab-green: #43a047;
  --fab-blue: #1e88e5;
  --ink: #0f172a;
  --bg: #f8fafc;
}

html,
body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial,
    sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 700;
  background: var(--fab-blue);
  color: white;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

button:disabled {
  opacity: 0.6;
  background: #94a3b8 !important; /* Force gray when disabled */
  cursor: not-allowed;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* Animation when button becomes enabled */
#start #startBtn:not(:disabled) {
  background: var(--fab-red) !important;
  box-shadow: 0 8px 20px rgba(229, 57, 53, 0.3);
  animation: buttonEnable 0.5s ease-out;
}

@keyframes buttonEnable {
  from {
    background: #94a3b8;
    transform: scale(0.95);
  }
  to {
    background: var(--fab-red);
    transform: scale(1);
  }
}

#start #startBtn:not(:disabled):hover {
  transform: scale(1.05);
  box-shadow: 0 10px 25px rgba(229, 57, 53, 0.4);
}

#start #startBtn:not(:disabled):active {
  transform: scale(0.95);
}

select {
  border: 0;
  background: transparent;
  font-weight: 600;
}

#app {
  max-width: 420px;
  height: 100dvh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
}

.screen.active {
  display: flex;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 20px;
}

.card {
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  padding: 22px;
  width: min(92%, 380px);
}

h1 {
  font-size: 28px;
  margin: 6px 0;
}

p {
  margin: 0;
  color: #334155;
}

.topbar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  z-index: 20;
}

.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
}

#hud {
  position: absolute;
  top: 56px;
  left: 10px;
  right: 10px;
  display: none;
  z-index: 15;
}

#hud.active {
  display: flex;
  justify-content: space-between;  /* Same as topbar */
  align-items: center;
}

/* Remove the grid completely */
.hudgrid {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* Pause button in the absolute center */
#pauseBtn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  padding: 5px 5px;
  min-width: 40px;
  z-index: 16;  /* Make sure it's above other HUD elements */
}

/* Lives/Chances box naturally aligns right */
.hudbox:last-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Make sure score is left-aligned */
#scoreBox {
  text-align: left;
}

/* Center the pause button */
#pauseBtn {
  margin: 0 auto;
}

/* Right-align the lives/chances box */
.hudbox:last-child {
  text-align: right;
  margin-left: auto;
}

/* Ensure lives dots are right-aligned */
.lives {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.hudbox {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 800;
  text-align: center;
}

.lives {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.life {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--fab-green);
}

#play {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.stage {
  position: absolute;
  inset: 0;
  z-index: 10;
}

.bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(#f1f5f9, #e2e8f0);
}

.podium {
  position: absolute;
  bottom: 16%;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  height: 60px;
  background: #334155;
  border-radius: 12px 12px 0 0;
}

.politician {
  width: 520px !important;
  position: absolute;
  left: 50%;
  bottom: 25%;
  transform: translate(-50%, 0);
  height: auto;
  z-index: 12;
  pointer-events: none;
}

.politician svg {
  display: block;
  width: 100%;
  max-width: 100vw;
  height: auto;
}

.hitbox {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  width: 30%;
  height: 40%;
  pointer-events: auto;
  z-index: 60;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.crowd {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120%;
  max-width: 500px;
  height: auto;
  z-index: 11;
  pointer-events: none;
  /*filter: drop-shadow(0 -5px 10px rgba(0,0,0,0.1));*/
  transition: transform 0.35s ease, filter 0.25s ease, opacity 0.25s ease;
}

.crowd img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0.9;
  clip-path: ellipse(100% 90% at 50% 100%);
  transform: perspective(800px) rotateX(25deg) scale(1.05);
  transform-origin: center bottom;
}

.tomato {
  position: absolute;
  width: 48px;
  height: 48px;
  z-index: 50;
  pointer-events: none;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.tomato img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Special tomato types */
.tomato.golden { 
  filter: hue-rotate(45deg) brightness(1.5) saturate(2);
  opacity:0.9;
}
.tomato.rotten { 
  filter: hue-rotate(270deg) brightness(0.4) saturate(0.3) contrast(1.2); 
  opacity: 0.75;
}
.tomato.giant { 
  transform: scale(2); 
}
.tomato.giant img {
  transform: scale(2);
}


/* COMMENTING OUT THESE SECTIONS:
.tomato::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: radial-gradient(circle, #4a7c59, #2d5a3d);
  border-radius: 50% 50% 0 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tomato::after {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 8px;
  background: linear-gradient(45deg, #6b8e23, #7cb342);
  border-radius: 50%;
  clip-path: polygon(30% 0%, 70% 0%, 100% 50%, 70% 100%, 30% 100%, 0% 50%);
  animation: tomatoGlow 1s ease-in-out infinite alternate;
}

*/

/* ALSO COMMENTING OUT:
@keyframes tomatoGlow {
  0% {
    opacity: 0.3;
    transform: scale(1);
  }

  100% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

*/

.p {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fab-blue);
  opacity: 0;
  z-index: 60;
}

.stain {
  position: absolute;
  width: 120px;
  height: 90px;
  left: 50%;
  transform: translateX(-50%);
  bottom: 150px;
  border-radius: 50%;
  background: rgba(185, 28, 28, 0.85);
  opacity: 0;
  z-index: 20;
  pointer-events: none;
}

.stain.show {
  animation: stainGrow 0.4s ease-out forwards;
}

@keyframes stainGrow {
  0% {
    transform: translateX(-50%) scale(0.6);
    opacity: 0;
  }

  100% {
    transform: translateX(-50%) scale(1);
    opacity: 0.6;
  }
}

.float {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 30%;
  font-weight: 900;
  font-size: 22px;
  opacity: 0;
  z-index: 70;
}

.float.show {
  animation: float 0.6s ease-out forwards;
}

@keyframes float {
  0% {
    opacity: 0;
    transform: translate(-50%, 10px);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -20px);
  }
}

@keyframes rippleExpand {
  0% {
    transform: scale(0);
    opacity: 0.7;
  }

  100% {
    transform: scale(3);
    opacity: 0;
  }
}

.fab-shield {
  position: absolute;
  border-radius: 50%; /* Circular shape */
  background: #FFCC00; /* Solid yellow background */
  border: 3px solid var(--fab-green);
  pointer-events: none;
  z-index: 45;
  box-shadow: 0 10px 30px rgba(67, 160, 71, 0.4);
  overflow: hidden; /* This clips anything outside the circle */
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab-shield img {
  width: 65%; /* Make logo smaller so corners don't show */
  height: 65%;
  object-fit: contain;
  position: relative;
  z-index: 2;
}

/* Add a white circle behind the logo for better contrast */
.fab-shield::before {
  content: "";
  position: absolute;
  width: 80%;
  height: 80%;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation: shieldPulse 1.25s ease-in-out;
}

/*.fab-shield::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0) 70%
  );
  animation: shieldPulse 1.25s ease-in-out;
}*/

@keyframes shieldPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.6;
  }

  50% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.9;
  }
}

.politician-animated {
  animation: politicianBob 2s ease-in-out infinite;
  /* NO transform properties here! */
}

@keyframes politicianBob {
  0%, 100% { transform: translate(-50%, 0px); }
  50% { transform: translate(-50%, -8px); }
}

@keyframes politicianHit {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5) saturate(0.5); }
}

@keyframes politicianHappy {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2) hue-rotate(10deg); }
}

/* === Hotfix: remove dark spot behind politician & normalize tomato shadows === */
.podium {
  display: none !important;
}

/* remove the block behind the character */
/* If you prefer a subtle stage instead of removing, change to:
.podium { background: rgba(51,65,85,0.15) !important; }
*/
/* Normalize tomato shadow alphas (use 0.xx decimals instead of 25/15/2/3) */
.tomato {
  /*box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25),*/
    inset -8px -8px 12px rgba(0, 0, 0, 0.15),
    inset 8px 8px 12px rgba(255, 255, 255, 0.2);
}

.tomato::before {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#loadingContainer {
  height: 40px; /* Fixed height to prevent layout shift */
  margin-bottom: 20px;
  transition: opacity 0.5s ease;
}

.loading-bar {
  width: 200px;
  height: 12px;
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  overflow: hidden;
  margin: 0 auto;
  position: relative;
}

.loading-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, 
    var(--fab-blue) 0%, 
    #4da6ff 100%);
  border-radius: 12px;
  transition: width 0.4s ease;
  position: relative;
  overflow: hidden;
}

.bubble {
  position: absolute;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  animation: floatBubble 2s infinite ease-in-out;
}

.bubble1 {
  width: 6px;
  height: 6px;
  left: 20%;
  animation-delay: 0s;
}

.bubble2 {
  width: 4px;
  height: 4px;
  left: 50%;
  animation-delay: 0.5s;
}

.bubble3 {
  width: 5px;
  height: 5px;
  left: 80%;
  animation-delay: 1s;
}

@keyframes floatBubble {
  0%, 100% {
    bottom: 2px;
    opacity: 0.8;
  }
  50% {
    bottom: 8px;
    opacity: 0.4;
  }
}

#loadingContainer {
  transition: opacity 0.5s ease;
}

/* === Size bump: politician +35% === */
.politician {
  width: 352px !important;  /* or 520px to apply the size bump */
  position: absolute;
  left: 50%;
  bottom: 25%;  /* depending on your crowd positioning */
  transform: translateX(-50%);
  height: auto;
  z-index: 12;
  pointer-events: none;
}

/* === Fab Yellow Start Screen === */
#start {
  background: linear-gradient(
    135deg,
    #ffd700,
    #ffc107
  ); /* Golden yellow gradient */
}

#start .card {
  background: rgba(255, 255, 255, 0); /* Transparent white */
  border: 2px solid rgba(255, 255, 255, 0.5);
}

#start::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 35px,
    rgba(255, 255, 255, 0.1) 35px,
    rgba(255, 255, 255, 0.1) 70px
  );
  pointer-events: none;
}

#start h1 {
  font-size: 35px;
  font-weight: 900;
  background: linear-gradient(135deg, #e53935 0%, #1e88e5 50%, #43a047 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  letter-spacing: 2px;
  animation: titleShine 3s ease-in-out infinite;
  position: relative;
}

#start h1::after {
  content: "✨";
  position: absolute;
  right: -30px;
  top: 0;
  font-size: 24px;
  animation: sparkle 1s ease-in-out infinite;
}

@keyframes titleShine {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

@keyframes sparkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  50% { transform: scale(1.2) rotate(180deg); opacity: 0.7; }
}

#start p {
  color: #334155;
  font-weight: 500;
}

#start #startBtn {
  background: var(--fab-red);
  box-shadow: 0 8px 20px rgba(229, 57, 53, 0.3);
  transform: scale(1);
  transition: transform 0.2s ease;
}

#start #startBtn:active {
  transform: scale(0.95);
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.tip {
  background: white;
  padding: 30px;
  border-radius: 20px;
  max-width: 300px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.tip p {
  margin-bottom: 20px;
  font-size: 16px;
  line-height: 1.5;
}

.game-over-card {
  background: linear-gradient(135deg, #FFD700, #FFC107);
  padding: 20px;
  border-radius: 20px;
  max-width: 280px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.game-over-logo {
  width: 80px;
  height: auto;
  margin-bottom: 15px;
  animation: pulse 2s infinite;
}

/* === Fab Yellow Results Screen === */
#results {
  background: linear-gradient(135deg, #FFD700, #FFC107); /* Same as start screen */
}

#results .card {
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

#results::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: 
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 35px,
      rgba(255, 255, 255, 0.1) 35px,
      rgba(255, 255, 255, 0.1) 70px
    );
  pointer-events: none;
}