/* Core Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: auto; font-family: 'Quicksand', sans-serif; background: #fff; overflow-x: hidden; }

/* HOST Screen */
#fbfg-host-screen {
  border: 4px solid transparent;
  border-radius: 16px;
  padding: 2rem;
  max-width: 600px;
  margin: 2rem auto;
  animation: fadeIn 0.8s ease-out;
  background: #fff7f0;
  text-align: center;
  box-shadow: 0 0 25px rgba(0,0,0,0.15);
  transition: border-color 0.4s ease;
}

.fbfg-host-title {
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.fbfg-host-intro {
  font-size: 1rem;
  color: #555;
  margin-bottom: 1.5rem;
}

.fbfg-host-gender-options {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.fbfg-gender-radio {
  border: 3px solid transparent;
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
  user-select: none;
}

.fbfg-gender-radio input {
  display: none;
}

.fbfg-gender-radio span {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border-radius: 25px;
  font-size: 1rem;
}

.fbfg-boy span {
  background: #90cdf4;
  color: #033b5c;
}
.fbfg-girl span {
  background: #fbb6ce;
  color: #630236;
}
.fbfg-twins span {
  background: #c3f5a9;
  color: #1e3f00;
}

.fbfg-gender-radio.selected {
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(0,0,0,0.2);
}

.fbfg-generated-link-wrapper {
  margin: 1.5rem 0;
}

#fbfg-generated-link {
  width: 100%;
  padding: 0.8rem;
  border: 2px solid #999;
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
}

.fbfg-host-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.fbfg-host-buttons .fbfg-btn {
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  animation: pulse 1.5s infinite alternate;
}

@keyframes pulse {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

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

.gender-boy #fbfg-host-screen {
  border-color: #3182ce;
  box-shadow: 0 0 15px #3182ce80;
}
.gender-girl #fbfg-host-screen {
  border-color: #d53f8c;
  box-shadow: 0 0 15px #d53f8c80;
}
.gender-twins #fbfg-host-screen {
  border-color: #38a169;
  box-shadow: 0 0 15px #38a16980;
}

#fbfg-end-screen.boy { background-color: #e0f3ff; }
#fbfg-end-screen.girl { background-color: #ffe3ef; }
#fbfg-end-screen.twins { background-color: #e6ffe6; }

/* Screens */
#fbfg-game { position: relative; width: 100%; height: 100%; overflow: hidden; }

.fbfg-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 100%; padding: 2rem;   
  border: 3px solid #ffc0cb;
  border-radius: 20px;
  background: #fff9fb;
  box-shadow: 0 0 15px rgba(255, 192, 203, 0.3); }
.hidden { display: none !important; }

.fbfg-btn {
    margin: 1rem;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(45deg, #ffd6e7, #ff89c4);
    color: white;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: transform 0.2s ease-in-out;
}
.fbfg-btn:hover {
    transform: scale(1.05);
}

.fbfg-mode-option {
  text-align: center;
}

.fbfg-mode-instruction {
  margin-top: 0.5rem;
  font-size: 1rem;
  color: #555;
  font-weight: 500;
  transition: all 0.3s ease;
}

.fbfg-social-share {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 100%;
  overflow: hidden;
}

/* Header Bar */
#fbfg-header {
    position: absolute;
    top: 0;
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: space-between;
    z-index: 10;
}

#fbfg-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#fbfg-timer-digit {
  font-size: 1.2rem;
  font-weight: bold;
  color: #333;
  white-space: nowrap;
  margin-bottom: 4px; /* Add spacing between digit and bar */
}

.fbfg-timer-container {
  position: absolute;
  top: 66px;
  left: 0;
  width: 100%;
  padding: 0.3rem 1rem;
  box-sizing: border-box;
  z-index: 9;
  background: transparent;
}

.fbfg-timer-container #fbfg-timer-bar {
  height: 16px;
  width: 100%;
  background: #4caf50;
  border-radius: 10px;
  transition: width 1s linear, background 0.5s ease;
}

.fbfg-timer-glow {
  animation: glowPulse 1s infinite alternate;
  box-shadow: 0 0 10px rgba(244, 67, 54, 0.7);
}

@keyframes glowPulse {
  from {
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.7);
  }
  to {
    box-shadow: 0 0 20px rgba(244, 67, 54, 1);
  }
}

#fbfg-score-wrapper {
  display: flex;
  align-items: center;
  font-size: 1.2rem;
  font-weight: bold;
  color: #333;
  gap: 0.3rem;
}
#fbfg-score-wrapper span {
  display: inline-block;
}

#fbfg-game-screen {
	height: 100vh;
}

/* Score Animation */
.score-popup {
  position: absolute;
  color: #4caf50;
  font-size: 1.5rem;
  font-weight: bold;
  z-index: 10;
  animation: scoreRise 1s ease-out forwards;
}
.score-popup:before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 0; bottom: 0;
  background: white;
  border-radius: 50%;
  opacity: 0.5;
}

@keyframes scoreRise {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-50px); }
}

/* Falling Face */
.fbfg-face {
  position: absolute;
  font-size: 2.5rem;
  width: 60px;
  height: 60px;
  text-align: center;
  line-height: 60px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: fall linear forwards;
  z-index: 5;
  cursor: pointer;
  transition: transform 0.2s ease-in-out;
}
.fbfg-face:active {
  transform: scale(1.2);
}

@keyframes fall {
    0% { top: -80px; }
    100% { top: 100vh; }
}

/* End Screen */
#fbfg-end-screen {
  padding: 2rem 1rem 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: auto !important;     /* Let it grow beyond viewport */
  overflow: visible !important;
}

#fbfg-end-screen h2 {
    font-size: 2rem;
}
#fbfg-final-score {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

/* Sparkle Overlay */
#fbfg-celebration {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

/* End Screen Gender Reveal Message */
.fbfg-gender-reveal-message {
  font-size: 2.5rem;
  color: #ff69b4;
  text-align: center;
  animation: pulseReveal 2s infinite;
  background: radial-gradient(circle, #fff0f8 0%, #ffe0ec 100%);
  padding: 1rem 1rem;
  border-radius: 16px;
  margin: 1rem auto;
  box-shadow: 0 0 20px rgba(255, 105, 180, 0.4);
  width: 100%;
  max-width: 95%;
  word-wrap: break-word;
}

@keyframes pulseReveal {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.9; }
  100% { transform: scale(1); opacity: 1; }
}

/* Twinkle Twinkle Theme Extra */
.theme-twinkle {
    position: relative;
    background: linear-gradient(#fff9fb, #ffe9f3);
    overflow: hidden;
}

.theme-twinkle::after {
    content: "🌟✨🌙⭐✨🌟🌙⭐✨🌟🌙⭐✨🌟🌙⭐✨🌟🌙⭐✨🌟🌙⭐";
    font-size: 2rem;
    line-height: 2.5rem;
    color: #ffc0cb;
    white-space: pre-wrap;
    letter-spacing: 10px;
    word-spacing: 20px;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.15;
    animation: scrollTwinkles 40s linear infinite;
    pointer-events: none;
}

@keyframes scrollTwinkles {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

/* Floating Moon and Stars */
.twinkle-decor {
  position: absolute;
  font-size: 2rem;
  animation: floatTwinkle 8s infinite linear;
  pointer-events: none;
  z-index: 1;
  opacity: 0.25; /* More transparent */
  filter: grayscale(60%); /* Slightly muted look */
}

@keyframes floatTwinkle {
  0% { transform: translateY(0) rotate(0deg); opacity: 0.2; }
  50% { opacity: 1; }
  100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

.theme-twinkle #fbfg-game-screen {
  background: linear-gradient(to bottom right, #fef6ff, #ffe3f0, #fddde6);
}

/* Sparkle shimmer animation */
@keyframes sparkleShimmer {
  0% { transform: scale(0.8); opacity: 0.4; }
  50% { transform: scale(1.2); opacity: 0.9; }
  100% { transform: scale(0.8); opacity: 0.4; }
}

.twinkle-sparkle {
  position: absolute;
  font-size: 1.2rem;
  color: #fff0f8;
  text-shadow: 0 0 8px #ffb6c1, 0 0 15px #ff69b4;
  animation: sparkleShimmer 2s infinite ease-in-out;
  pointer-events: none;
  z-index: 2;
}

body.td-animation-stack-type0 .td-animation-stack .entry-thumb, body.td-animation-stack-type0 .post img:not(.woocommerce-product-gallery img):not(.rs-pzimg), body.td-animation-stack-type0 .td-animation-stack .td-lazy-img {
	opacity: 1 !important;
}

@media (max-width: 600px) {
  .fbfg-social-share {
    text-align: center;
    align-items: center;
  }
  #fbfg-end-screen {
    padding-bottom: 4rem;
  }
  .fbfg-social-share a {
    font-size: 0.9rem;
    padding: 8px 12px;
    margin: 4px;
    border-radius: 8px;
  }
  .fbfg-social-share {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }
  .fbfg-host-gender-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }
  .fbfg-gender-radio {
    width: 70%;
    text-align: center;
    padding: 1rem;
    font-size: 1.1rem;
  }
  .fbfg-gender-radio span {
    display: block;
    padding: 0.7rem 1.2rem;
    font-size: 1rem;
  }
	.fbfg-host-buttons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
    flex-wrap: nowrap;
  }

  .fbfg-host-buttons .fbfg-btn {
    flex: 1 1 auto;
    white-space: nowrap;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    text-align: center;
  }
}

@media (max-width: 400px) {
  .fbfg-gender-reveal-message {
    font-size: 2rem;
    padding: 0.8rem;
  }
  #fbfg-final-score {
    font-size: 1.2rem;
  }
  #fbfg-end-screen h2 {
    font-size: 1.5rem;
  }
}