/* ===============================
   GLOBAL RESET & VARIABLES
   =============================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --pink-pop: #FF6EC7;
  --blue-dream: #7FDBFF;
  --yellow-sunshine: #FFE66D;
  --lavender-love: #CDB4DB;
  --mint-fresh: #A8DADC;
  --coral-kiss: #FF8FA3;
  --purple-haze: #B8A4E6;

  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.9);

  --text-primary: #2D1E2F;
  --text-accent: #FF1493;

  --success: #77DD77;
  --danger: #FF6B9D;
  --gold: #FFD700;
}

/* ===============================
   BODY & BACKGROUND
   =============================== */

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(
    45deg,
    var(--pink-pop),
    var(--lavender-love),
    var(--blue-dream),
    var(--yellow-sunshine),
    var(--coral-kiss)
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===============================
   SCREEN SYSTEM
   =============================== */

.screen {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.screen.active {
  display: flex;
}

/* ===============================
   GAME LAYOUT (CORE)
   =============================== */

#game-screen {
  padding: 0;
  width: 100%;
  min-height: 100vh;
}

/* ===============================
   HEADER
   =============================== */

.game-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 14px 24px;
  background: linear-gradient(90deg, #FF6EC7, #B8A4E6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
}

.score-pill,
.timer-pill {
  background: white;
  padding: 10px 22px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 20px;
  border: 3px solid var(--gold);
}

/* ===============================
   IMAGE CONTAINER
   =============================== */

.image-container {
  position: fixed;
  top: 80px;
  bottom: 80px;
  left: 0;
  right: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 10px;
  overflow: hidden;
  z-index: 100;
}

/* ===============================
   IMAGE FRAME
   =============================== */

.fancy-frame {
  width: 92%;
  height: 100%;
  padding: 12px;
  border-radius: 30px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: linear-gradient(
    45deg,
    #FF6EC7,
    #FFE66D,
    #7FDBFF,
    #CDB4DB
  );
  background-size: 300% 300%;
  animation: frameGlow 3s ease infinite;
}

@keyframes frameGlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===============================
   IMAGE BEHAVIOR (SINGLE SOURCE OF TRUTH)
   =============================== */

/* DEFAULT — Desktop + Portrait Phone */
#game-image {
  display: block;
  width: auto;
  height: auto;

  max-width: 100%;
  max-height: 100%;

  object-fit: contain;
  border-radius: 20px;
  background: white;
}

/* ===============================
   PHONE LANDSCAPE (FOREHEAD MODE)
   =============================== */

@media (max-width: 900px) and (orientation: landscape) {

  /* Slightly reduce UI so image gets space */
  .game-header {
    padding: 8px 14px;
  }

  .score-pill,
  .timer-pill {
    font-size: 16px;
    padding: 6px 14px;
  }

  .game-controls {
    height: 70px;
  }

  /* Give image a bit more room vertically */
  .image-container {
    top: 64px;
    bottom: 70px;
  }

  /* Widen the frame slightly (safe) */
  .fancy-frame {
    width: 96%;
  }

  /* IMPORTANT:
     - NO crop
     - NO zoom
     - Image just allowed to be a bit larger */
  #game-image {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
  }
}

/* ===============================
   GAME CONTROLS
   =============================== */

.game-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  display: flex;
  z-index: 1000;
}

.game-btn {
  flex: 1;
  font-size: 18px;
  font-weight: 900;
  border: none;
  color: white;
}

.pass-btn {
  background: linear-gradient(135deg, var(--danger), #FF1493);
}

.correct-btn {
  background: linear-gradient(135deg, var(--success), #4CAF50);
}

/* ===============================
   MOBILE PORTRAIT TUNING
   =============================== */

@media (max-width: 768px) {
  .game-header {
    padding: 12px 18px;
  }

  .image-container {
    top: 70px;
    bottom: 100px;
  }

  .game-controls {
    height: 100px;
  }

  .game-btn {
    font-size: 22px;
  }
}

/* ===============================
   END SCREEN
   =============================== */

.final-score {
  font-family: 'Pacifico', cursive;
  font-size: clamp(48px, 12vw, 80px);
  background: linear-gradient(90deg, var(--gold), var(--coral-kiss));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===============================
   FOOTER
   =============================== */

.footer-section {
  padding: 3rem 1.5rem;
  text-align: center;
}

.footer-link {
  opacity: 0.7;
  text-decoration: none;
}

/* ===============================
   GLOBAL RESET & VARIABLES
   =============================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* ME! Music Video Palette */
  --pink-pop: #FF6EC7;
  --blue-dream: #7FDBFF;
  --yellow-sunshine: #FFE66D;
  --lavender-love: #CDB4DB;
  --mint-fresh: #A8DADC;
  --coral-kiss: #FF8FA3;
  --purple-haze: #B8A4E6;

  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.9);

  --text-primary: #2D1E2F;
  --text-accent: #FF1493;

  --primary-btn: #FF69B4;
  --primary-btn-shadow: #FF1493;
  --secondary-btn: #7FDBFF;
  --secondary-btn-shadow: #4A90E2;

  --success: #77DD77;
  --danger: #FF6B9D;
  --gold: #FFD700;
}

/* ===============================
   BODY & BACKGROUND
   =============================== */

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(
    45deg,
    var(--pink-pop),
    var(--lavender-love),
    var(--blue-dream),
    var(--yellow-sunshine),
    var(--coral-kiss)
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  25% { background-position: 50% 100%; }
  50% { background-position: 100% 50%; }
  75% { background-position: 50% 0%; }
  100% { background-position: 0% 50%; }
}

/* ===============================
   ANIMATED BACKGROUND ELEMENTS
   =============================== */

.animated-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 1;
  pointer-events: none;
}

.shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
  animation: float 20s infinite ease-in-out;
}

.shape-1 { width: 300px; height: 300px; background: var(--pink-pop); top: -150px; left: -150px; }
.shape-2 { width: 200px; height: 200px; background: var(--blue-dream); top: 50%; right: -100px; }
.shape-3 { width: 250px; height: 250px; background: var(--yellow-sunshine); bottom: -125px; left: 30%; }
.shape-4 { width: 180px; height: 180px; background: var(--lavender-love); top: 20%; left: 70%; }
.shape-5 { width: 220px; height: 220px; background: var(--mint-fresh); bottom: 30%; right: 20%; }

@keyframes float {
  0%,100% { transform: translate(0,0) rotate(0deg); }
  25% { transform: translate(30px,40px) rotate(90deg); }
  50% { transform: translate(-20px,80px) rotate(180deg); }
  75% { transform: translate(40px,30px) rotate(270deg); }
}

/* ===============================
   FLOATING HEARTS
   =============================== */

.floating-hearts {
  position: absolute;
  inset: 0;
}

.heart {
  position: absolute;
  font-size: 28px;
  opacity: 0.6;
  animation: floatUp 10s infinite ease-in;
}

@keyframes floatUp {
  0% { bottom: -50px; opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { bottom: 110vh; opacity: 0; transform: translateX(100px) rotate(360deg); }
}

/* ===============================
   SCREEN SYSTEM
   =============================== */

.screen {
  display: none;
  min-height: 100vh;
  padding: 20px;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 10;
  position: relative;
}

.screen.active {
  display: flex;
}

/* ===============================
   GLASS PANEL (CORE VISUAL)
   =============================== */

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  border: 3px solid var(--glass-border);
  border-radius: 40px;
  padding: 50px 40px;
  box-shadow:
    0 15px 50px rgba(255,105,180,0.3),
    0 8px 20px rgba(127,219,255,0.2),
    inset 0 0 30px rgba(255,255,255,0.5);
  max-width: 600px;
  width: 95%;
  animation: popIn 0.5s cubic-bezier(.68,-0.55,.265,1.55);
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ===============================
   HEADINGS & TEXT
   =============================== */

h1.logo-title {
  font-family: 'Pacifico', cursive;
  font-size: clamp(48px, 10vw, 72px);
  background: linear-gradient(45deg, var(--pink-pop), var(--purple-haze), var(--blue-dream));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
  animation: titleBounce 2s ease-in-out infinite;
}

@keyframes titleBounce {
  0%,100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

h2 {
  font-family: 'Pacifico', cursive;
  font-size: clamp(32px, 6vw, 48px);
  background: linear-gradient(90deg, var(--pink-pop), var(--blue-dream));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 30px;
}

.tagline {
  font-size: 14px;
  letter-spacing: 3px;
  font-weight: 800;
  margin-bottom: 30px;
  background: linear-gradient(90deg, var(--yellow-sunshine), var(--coral-kiss));
  padding: 8px 20px;
  border-radius: 20px;
  display: inline-block;
}

/* ===============================
   INSTRUCTIONS
   =============================== */

.instruction-box {
  text-align: left;
  margin-bottom: 30px;
  background: rgba(255,255,255,0.5);
  padding: 20px;
  border-radius: 20px;
}

ul { list-style: none; }
li { margin: 15px 0; font-weight: 600; }

/* ===============================
   BUTTON SYSTEM
   =============================== */

button {
  font-family: 'Poppins', sans-serif;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 800;
  text-transform: uppercase;
  transition: all .3s cubic-bezier(.68,-0.55,.265,1.55);
}

.primary-btn {
  background: linear-gradient(135deg, var(--pink-pop), var(--primary-btn-shadow));
  color: #fff;
  font-size: 20px;
  padding: 20px 50px;
  box-shadow: 0 8px 0 var(--primary-btn-shadow),
              0 12px 25px rgba(255,105,180,.4);
  width: 100%;
}

.secondary-btn {
  background: #fff;
  color: var(--secondary-btn);
  border: 3px solid var(--secondary-btn);
  padding: 15px 35px;
  font-size: 16px;
}

/* ===============================
   FOOTER
   =============================== */

.footer-section {
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
}

.footer-nav {
  display: flex;
  gap: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

.footer-link {
  font-size: 0.9rem;
  opacity: 0.75;
  text-decoration: none;
}

.footer-link:hover { opacity: 1; }

.footer-legal {
  font-size: 0.75rem;
  opacity: 0.55;
}


/* ===============================
   COUNTDOWN OVERLAY — FINAL
   Big, centered, cinematic
   =============================== */

#countdown-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;

  /* faint glassy cover */
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);

  z-index: 9999;
}

#countdown-overlay.active {
  display: flex;
}

/* Countdown number */
#countdown-overlay .countdown-text {
  position: relative;
  z-index: 10001;

  font-family: 'Pacifico', cursive;
  font-size: clamp(120px, 30vw, 240px);
  font-weight: 900;

  color: #111; /* BLACK number */
  text-align: center;

  /* subtle depth */
  text-shadow:
    0 6px 20px rgba(0, 0, 0, 0.25);

  animation: countdownPop 0.9s ease-in-out;
}

/* Nice pop animation */
@keyframes countdownPop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  60% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

/* Hide rotate hint during countdown */
#countdown-overlay.active #rotate-hint {
  display: none;
}
