/* -----------------------------------------------------
   GLOBAL
----------------------------------------------------- */
body {
    margin: 0;
    padding: 0;
    font-family: 'Baloo 2', sans-serif;
    overflow-x: hidden;
    background: #f7f7f7;
}

/* Background video */
#bg-video {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    filter: brightness(0.9);
    z-index: -3;
}

/* Soft overlay */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.2);
    z-index: -2;
}

#confetti-layer,
#sparkle-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
}

/* -----------------------------------------------------
   START SCREEN
----------------------------------------------------- */
#start-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#start-card {
    width: 85%;
    max-width: 430px;
    background: #ffffffee;
    padding: 40px 30px 35px;
    border-radius: 28px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.25);
    text-align: center;
    animation: fadeUp 0.7s ease-out;
}

#logo-img {
    width: 210px;
    margin-bottom: 24px;
}

/* Clean Baloo 2 title */
#game-title {
    font-size: 64px;
    font-weight: 800;
    color: #1f2a5f;
    margin: 0;
    text-shadow: 0 4px 10px rgba(0,0,0,0.2);
    animation: fadeUpTitle 0.7s ease-out;
}

#subtitle {
    margin: 12px 0 24px;
    font-size: 18px;
    color: #555;
}

/* Start button */
#start-btn {
    font-size: 24px;
    padding: 14px 40px;
    background: linear-gradient(#b8ffb8, #8ee58e);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#start-btn:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 10px 20px rgba(0,0,0,0.28);
}

.play-icon {
    font-size: 20px;
}

/* -----------------------------------------------------
   TILE SCREEN
----------------------------------------------------- */
#tile-screen {
  display: none;
  min-height: 100vh;
  width: 100%;
  padding: 14px 16px;
  box-sizing: border-box;
  padding-top: 14px;
  display: none;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;

  animation: fadeIn 0.5s ease-out;
}

#choose-text {
    font-size: 32px;
    color: #ffffff;
    margin-top: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
}

#choose-subtext {
    margin-top: 2px;
    font-size: 18px;
    color: #406466;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* Progress bar */
#progress-container {
    width: 85%;
    max-width: 450px;
    height: 18px;
    border-radius: 16px;
    margin: 18px auto 10px;
    overflow: hidden;
    background: #ffffff55;
}

#progress-bar {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #43b649, #ff914d);
    transition: width 0.4s ease;
}

/* Tile grid */
#tile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    width: 90%;
    max-width: 600px;
    margin: 24px auto;
}

/* Tiles */
.tile {
    background: #ffffffee;
    height: 95px;
    border-radius: 18px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #333;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tile:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 18px rgba(0,0,0,0.24);
}

/* Completed tile (correct) */
.tile.done {
    background: #b6ffb6;
    color: #2a7a2a;
}

.tile.done::after {
    content: "✔";
    font-size: 26px;
    position: absolute;
    bottom: 6px;
    right: 10px;
}

/* Wrong tile */
.tile.wrong {
    background: #ffb6b6;
    color: #7a2a2a;
}

/* Zoom-out animation on click */
@keyframes tileZoomOut {
    0%   { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.7); opacity: 0; }
}
.tile.zoom-out {
    animation: tileZoomOut 0.35s ease-out forwards;
}

/* -----------------------------------------------------
   QUESTION SCREEN
----------------------------------------------------- */
#question-screen {
  display: none;
  min-height: 100vh;
  width: 100%;
  padding: 12px 12px 16px;
  box-sizing: border-box;
  display: none;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  
}
#question-container{
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* Timer */
#timer-bar {
    width: 85%;
    max-width: 480px;
    height: 16px;
    background: #ffffff55;
    border-radius: 15px;
    margin: 16px auto;
    overflow: hidden;
    position: relative;
}
#timer-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    width: var(--timer-width, 0%);
    background: linear-gradient(90deg, #ff3b3b, #ffcc00);
    transition: width 1s linear;
}

/* Question text */
.question-main {
    font-size: 25px;
    font-weight: 800;
    color: #1f2a5f;
    margin: 6px 0 0;
    text-shadow: 0 4px 8px rgba(0,0,0,0.2);
    animation: popIn 0.6s ease-out;
}

.question-sub {
    font-size: 20px;
    font-weight: 600;
    color: #1e3a8a;
    margin: 2px 0 6px;
    opacity: 0;
    transform: translateY(8px);
    animation: fadeUpSmall 0.6s ease-out 0.25s forwards;
}

#options-wrapper {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.option {
    width: 40%;
    max-width: 260px;
    border-radius: 18px;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
    transition: transform 0.2s ease;
    background: #fff;
}

.option:hover {
    transform: scale(1.05);
}

/* Correct / wrong feedback */
.option.correct-glow {
    border: 4px solid #00c853;
    animation: correctGlow 0.5s ease-out;
}
.option.wrong-glow {
    border: 4px solid #ff1744;
    animation: wrongGlow 0.5s ease-out;
}

@keyframes correctGlow {
    0% { box-shadow: 0 0 0px #00c853; }
    50% { box-shadow: 0 0 24px #00c853; }
    100% { box-shadow: 0 0 0px #00c853; }
}
@keyframes wrongGlow {
    0% { box-shadow: 0 0 0px #ff1744; }
    50% { box-shadow: 0 0 24px #ff1744; }
    100% { box-shadow: 0 0 0px #ff1744; }
}

/* Character area (optional art) */
#character-area {
    margin-top: 20px;
    height: 120px;
}

/* ================================
   ✅ FINAL POPUP (Always on top)
================================ */
#final-popup{
  position: fixed;
  inset: 0;
  display: none;                 /* shown by JS */
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.55);
  z-index: 999999 !important;    /* ✅ important for WordPress overlays */
  padding: 16px;                 /* ✅ prevents cut-off on small screens */
  box-sizing: border-box;
}

#final-box{
  width: min(92vw, 520px);
  background: #ffffffee;
  border-radius: 26px;
  text-align: center;
  padding: 34px 22px 24px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
  animation: popIn 0.6s ease-out;
}

/* Title (green like screenshot) */
#final-text{
  font-size: 32px;
  font-weight: 800;
  color: #35b24a;
  margin: 0 0 12px;
  text-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

#final-score{
  font-size: 22px;
  font-weight: 800;
  color: #1f2a5f;
  margin: 8px 0 10px;
}

/* ✅ Buttons row */
.final-actions{
  margin-top: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;                     /* ✅ space between buttons */
  flex-wrap: wrap;               /* ✅ if space is less, it wraps nicely */
}

/* Play Again (Green) */
#restart-btn{
  font-size: 22px;
  padding: 12px 26px;
  border-radius: 18px;
  border: none;
  cursor: pointer;
  background: linear-gradient(#b8ffb8, #8ee58e);
  box-shadow: 0 8px 18px rgba(0,0,0,0.22);
  transition: transform 0.15s ease;
}
#restart-btn:hover{
  transform: translateY(-1px) scale(1.03);
}

/* ✅ Next Game (Blue like your image) */
#next-game-btn{
  display: inline-flex !important;   /* ✅ ensure it never becomes hidden */
  align-items: center;
  justify-content: center;
  font-size: 22px;
  padding: 12px 26px;
  border-radius: 18px;
  border: none;
  cursor: pointer;
  background: linear-gradient(180deg, #9fd3ff, #5aaeff);
  color: #0b2a4a;
  box-shadow: 0 8px 18px rgba(0,0,0,0.22);
  transition: transform 0.15s ease;
}
#next-game-btn:hover{
  transform: translateY(-1px) scale(1.03);
}

/* ✅ Mobile fix: make buttons full width + clear spacing */
@media (max-width: 520px){
  .final-actions{
    flex-direction: column;
    gap: 12px;
  }
  #restart-btn,
  #next-game-btn{
    margin-top: 10px;
    width: 100%;
    max-width: 320px;
  }
}

/* -----------------------------------------------------
   ANIMATIONS
----------------------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeUp {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUpTitle {
    0% { opacity: 0; transform: translateY(18px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUpSmall {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

/* -----------------------------------------------------
   RESPONSIVE
----------------------------------------------------- */
@media (max-width: 600px) {
    #tile-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .tile {
        height: 90px;
    }
    #options-wrapper {
        flex-direction: column;
    }
    .option {
        width: 80%;
        max-width: 320px;
        margin: 0 auto;
    }
    #game-title {
        font-size: 52px;
    }
    .question-main{ font-size: 20px; }
    .question-sub{ font-size: 13px; }
}
/* ================================
   ⭐ Mascot Reaction
=================================== */
#mascot-area {
    margin-top: 0px;
    height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 40px;
    opacity: 0;
    transition: opacity 0.4s;
}

#mascot-text {
    font-size: 0px;
    font-weight: 600;
    margin-top: 1px;
    color: #1f2a5f;
}

/* animations */
.mascot-happy {
    animation: mascotBounce 0.6s ease;
}

.mascot-sad {
    animation: mascotShake 0.4s ease;
}

@keyframes mascotBounce {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes mascotShake {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(-8px); }
    50%  { transform: translateX(8px); }
    100% { transform: translateX(0); }
}


/* ================================
   ⭐ Star Reward Meter
=================================== */
#star-meter{
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 1px;
}

.star{
  font-size: 22px;
  color: #cfcfcf;
  transition: transform 0.25s, color 0.25s;
  margin-top: 0px;
}

.star.filled{
  transform: scale(1.18);

}
#hotspot-wrapper{
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2px;
}

/* ✅ box shrinks to image size */
#hotspot-box{
  position: relative;
  display: inline-block;     /* IMPORTANT */
  max-width: 92vw;
  max-height: 62vh;
  margin: 0 auto;
}

/* ✅ image decides the box width */
#hotspot-image{
  display: block;
  width: auto;               /* IMPORTANT */
  height: auto;
  max-width: 92vw;
  max-height: 62vh;
  object-fit: contain;
  border-radius: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.18);
}
/* Cat hotspot area */
#hotspot-area {
    position: absolute;
  border: 4px solid #00c853;
  border-radius: 16px;
  opacity: 0;
  transform: scale(0.5);
  box-shadow: 0 0 20px #00c853;
  transition: 0.3s ease;
  cursor: pointer;
}

/* Wrong click shake */
.shake-wrong {
    animation: shakeWrong 0.4s;
}

@keyframes shakeWrong {
    0% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    50% { transform: translateX(10px); }
    75% { transform: translateX(-10px); }
    100% { transform: translateX(0); }
}
/* =========================================
   ✨ PREMIUM CONFETTI EFFECT
========================================= */

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 18px;
    background-color: red;
    opacity: 0;
    animation: confetti-fall 1.4s ease-out forwards;
    border-radius: 2px;
}

/* Circle variant */
.confetti-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* Star variant (small) */
.confetti-star {
    width: 14px;
    height: 14px;
    background-color: currentColor;
    clip-path: polygon(
        50% 0%,
        61% 35%,
        98% 35%,
        68% 57%,
        79% 91%,
        50% 70%,
        21% 91%,
        32% 57%,
        2% 35%,
        39% 35%
        98% 35%,
        68% 57%,
        79% 91%,
        50% 70%,
    );
}

/* Falling animation */
@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-20px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

#fullscreenBtn{
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  background: rgba(255,255,255,0.9);
  color: #1f2a5f;
  border: none;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}

/* ✅ iOS fallback fullscreen (FAKE) */
#game-root.fake-fullscreen{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
}

body.no-scroll{
  overflow: hidden;
}
#choose-text{
  font-weight: 800;
  background: linear-gradient(90deg,#2d6cdf,#6c63ff,#c77dff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}
/* highlight words in question */
.hl-above { color: #F05454; font-weight: 800; }
.hl-below { color: #F05454; font-weight: 800; }

#progress-container, #timer-bar::after, #progress-bar, #timer-bar {
  margin: 0 !important;
  padding: 0 !important;
}

/* ================================
   ✅ CENTER: TILE SCREEN
================================ */
#tile-screen{
  min-height: 100vh;
  display: none;              /* shown by JS */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px 16px;
  box-sizing: border-box;
}

#progress-container{
  width: min(85vw, 700px);
  margin: 0 auto 16px;
}

#tile-grid{
  width: min(90vw, 620px);
  margin: 18px auto 0;
}


/* ================================
   ✅ CENTER: QUESTION SCREEN
================================ */
#question-screen{
  min-height: 100vh;
  display: none;              /* shown by JS */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px 16px;
  box-sizing: border-box;
}

#question-container{
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Timer centered */
#timer-bar{
  width: min(85vw, 700px);
  margin: 0 auto 14px;
}

/* Hotspot image scaling on big screens */
#hotspot-box{
  margin: 0 auto;
}
#hotspot-image{
  width: 100%;
  height: auto;
  max-height: 62vh;
  object-fit: contain;
}

/* Options center (if you ever use A/B rounds later) */
#options-wrapper{
  width: 100%;
  justify-content: center;
}

/* Stars center */
#star-meter{
  display: flex;
  justify-content: center;
}

/* Mobile tweaks */
@media (max-width: 600px){
  #hotspot-box{ width: 92vw; }
  #hotspot-image{ max-height: 52vh; }
}

