/* Game Container */
/* #game-container {
    position: relative;
    width: 90%;
    max-width: 900px;
    margin: 8vh auto 2vh auto;
    padding: 1rem;
    box-sizing: border-box;
} */
 
/* Prevent text selection across the entire project */
* {
    user-select: none;         /* Standard */
    -webkit-user-select: none; /* Safari/Chrome */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE/Edge */
}

#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 90%;
    max-width: 900px;
    margin: 10vh auto 2vh auto;      
    padding: 0.5rem;
    box-sizing: border-box;
    border-radius: 20px;
    background: #f9f9f9;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    min-height: calc(60vh);         
    max-height: calc(80vh);         
    overflow: hidden;              
}

#game-container:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.15), 0 0 12px rgba(52,153,255,0.1);
}

#game-container > * {
  position: relative;
  z-index: 1;
}

#game-container h2, 
#game-container p {
  margin: 0.3rem 0;
  color: inherit;
}

/* Stats Container CSS */
#stats-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.85);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-size: clamp(0.8rem, 2vw, 1.2rem);
    z-index: 100;
    max-width: 90vw;
    white-space: nowrap;
    overflow-x: auto;
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin-bottom: 1rem;
    text-align: center;
}

p {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    margin-bottom: 1rem;
    text-align: center;
}

/* Choice Buttons CSS */
/* #choices-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.choice-btn {
    flex: 1 1 40%;
    max-width: 300px;
    padding: 0.6rem 1rem;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    cursor: pointer;
    border-radius: 8px;
    border: 1px solid #ccc;
    background-color: #f4f4f4;
    transition: transform 0.2s ease, background 0.2s ease;
}

.choice-btn:hover {
    transform: scale(1.05);
    background-color: #e0f7fa;
} */

#choices-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    justify-items: center;
    align-items: center;
    margin-top: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.choice-btn {
    width: 100%;
    max-width: 280px;
    height: 90px;
    white-space: normal;
    word-wrap: break-word;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    cursor: pointer;
    border-radius: 12px;
    border: none;
    background: #ffffff;
    color: #333;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1), inset 0 -3px 6px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.choice-btn::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, #ff3c3c, #ffb74c, #3499ff, #ff3c3c);
    background-size: 400% 400%;
    filter: blur(20px);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.choice-btn:hover::before {
    opacity: 0.3;
    animation: moveGradient 5s linear infinite;
}

.choice-btn span {
    position: relative;
    z-index: 1;
}

.choice-btn:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15), inset 0 -3px 8px rgba(0,0,0,0.05);
}

.choice-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12), inset 0 -2px 4px rgba(0,0,0,0.05);
}

@keyframes moveGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Shared layout for Question + Ending screens */
.screen-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 850px;
    height: 550px;
    position: relative;
    margin: auto;
    padding: 1rem;
    box-sizing: border-box;
    gap: 1rem;
    text-align: center;
}

.fade-out {
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.fade-in {
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

.fade-in.show {
    opacity: 1;
}

/* Floating Change Animation */
/* .floating-change {
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    font-size: clamp(0.8rem, 1.5vw, 1.2rem);
    font-weight: bold;
    transition: all 2.0s ease-out;
    pointer-events: none;
} */

.floating-change {
    background: #f0f0f0;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: clamp(0.8rem, 1.5vw, 1.2rem);
    font-weight: bold;
    pointer-events: none;
    position: absolute;
    left: 50%;
    display: inline-block;
    transform-origin: center;
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 0;
    animation: floatUpSmooth 0.8s ease-out forwards;
    z-index: 9999;
    white-space: nowrap;     
    max-width: 90vw;    
    overflow: hidden;     
}

.floating-change .health { color: #e63946; }
.floating-change .wallet { color: #ffb703; }
.floating-change .env { color: #2a9d8f; }

@keyframes floatUpSmooth {
    0% {
        transform: translateX(-50%) translateY(0) scale(1);
        opacity: 1;
    }
    10% {
        opacity: 1;
    }
    75% {
        transform: translateX(-50%) translateY(-35px) scale(1.02);
        opacity: 0.8;
    }
    100% {
        transform: translateX(-50%) translateY(-50px) scale(1);
        opacity: 0;
    }
}

/* Media Queries for different screens */
@media (max-width: 600px) {
  body, html {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  #app {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
  }

  #stats-container {
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
    flex-shrink: 0;
  }

  #game-container {
    flex: 1;
    width: 100%;
    margin: 9vh auto;
    overflow-y: auto;
  }

  #choices-container {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 0.3rem;
    flex-shrink: 0;
  }

  .choice-btn {
    width: 100%;
    height: 55px;
    font-size: 0.9rem;
  }

  #journey-container {
    flex-shrink: 0;
  }
}

@media (min-width: 1200px) {
    #game-container {
        max-width: 850px;
        margin-top: 10vh;            
        min-height: calc(55vh);     
        max-height: calc(75vh);
    }
}

.ending-container {
    text-align: center;
    padding: 1rem;
}

.final-stats-container {
    display: inline-block;
    background-color:white;
    color: #333;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-top: 0.5rem;
    font-size: 1.1rem;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.play-again-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

/* .play-again-btn {
    padding: 0.6rem 1.6rem;
    font-size: clamp(1rem, 1.2vw + 0.5rem, 1.2rem);
    border-radius: 10px;
    border: none;
    background-color: green; 
    color: white;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s ease, background-color 0.3s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.play-again-btn:hover {
    transform: scale(1.1);
    background-color: lightseagreen;
}

.play-again-btn:active {
    transform: scale(0.95);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.play-again-btn {
    animation: pulse 2s infinite;
} */

.play-again-btn {
  position: relative;
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.8rem 2rem;
  font-size: 1.3rem;
  font-weight: 600;
  color: white;
  text-decoration: none;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #f75f5f, #ffb43c, #3499ff);
  background-size: 200% 200%;
  transition: all 0.4s ease, background-position 0.8s ease, transform 0.2s ease;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.play-again-btn:hover {
  background-position: right center;
  filter: brightness(1.1);
  box-shadow: 
      0 0 20px rgba(0, 89, 255, 0.6),
      0 0 40px rgba(255, 183, 76, 0.4),
      0 0 60px rgba(212, 1, 1, 0.3);
  transform: translateY(-3px) scale(1.05);
}

.play-again-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* Dark Mode Toggle Switch */
/* .dark-mode-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
}

.mode-icon {
    pointer-events: none;
    transition: opacity 0.3s;
} */

/* Highlight current mode */
/* body.dark-mode .mode-icon:first-child {
    opacity: 0.4;
}

body.dark-mode .mode-icon:last-child {
    opacity: 1;
} */

/* .mode-icon:first-child {
    opacity: 1;
}

.mode-icon:last-child {
    opacity: 0.4;
} */

/* Toggle slider */
/* .switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 26px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:checked + .slider:before {
  transform: translateX(24px);
} */

/* Dark Mode */
/* body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-mode #game-container {
    background-color: #1e1e1e;
}

body.dark-mode #stats-container {
    background: rgba(50, 50, 50, 0.85);
    color: #f0f0f0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

body.dark-mode .choice-btn {
    background-color: #333;
    color: #f0f0f0;
    border: 1px solid #555;
}

body.dark-mode .choice-btn:hover {
    background-color: #444;
}

body.dark-mode .floating-change {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

body.dark-mode .final-stats-container {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
} */

/* Play Again Button Dark mode CSS */
/* body.dark-mode .play-again-btn {
    background-color: lightblue;
    color: #000;
}

body.dark-mode .play-again-btn:hover {
    background-color: deepskyblue;
} */

/* #journey-container {
  margin: 20px auto;
  width: 90%;
  height: 100px;
  position: relative;
}

#path {
  position: relative;
  top: 50px;
  left: 0;
  width: 100%;
  height: 6px;
  background: lightgray;
  border-radius: 3px;
}

#character {
  position: absolute;
  top: 25px;
  left: 0;
  font-size: 28px;
  transition: left 0.8s ease-in-out;
}

.marker {
  position: absolute;
  top: 65px;
  transform: translateX(-50%);
  font-size: 14px;
  color: #555;
}

#food {
  position: absolute;
  font-size: 2rem;
  bottom: 40px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
}

#food.show {
  opacity: 1;
  transform: scale(1.2);
} */

#journey-container {
  margin: 2rem auto;
  width: 90%;
  max-width: 800px;
  position: relative;
}

/* Path line */
#path {
  position: relative;
  top: 50%;
  left: 0;
  width: 100%;
  height: 12px;
  background: linear-gradient(135deg, #f75f5f, #ffb43c, #3499ff);
  border-radius: 50px;
  overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.15), 
              0 2px 6px rgba(0, 0, 0, 0.1);
  transition: background 0.4s ease;
}

/* Character */
#character {
  position: absolute;
  z-index: 2;
  top: calc(50% - 20px);
  left: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.2));
}

/* Markers */
.marker {
  position: absolute;
  top: calc(50% + 20px);
  transform: translateX(-50%);
  font-size: 0.9rem;
  color: #444;
  font-weight: 500;
  white-space: nowrap;
}

/* Food Emojis popup */
#food {
  position: absolute;
  z-index: 1;
  font-size: 2rem;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.25));
}

#food.show {
  opacity: 1;
  transform: translateX(-50%) scale(1.2);
}

/* Dark Mode Progress Path */
/* body.dark-mode #path {
  background: #444;
}

body.dark-mode #character {
  color: #ffeb3b;
}

body.dark-mode .marker {
  color: #ccc;
}

body.dark-mode #food {
  color: #ff9800;
} */

.go-back-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  color: #333;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: background 0.3s ease, transform 0.2s ease;
  z-index: 1000;
}

.go-back-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateX(-3px);
}

/* Points floating CSS - path bar */
/* .floating-change {
  font-size: 1.2rem;
  font-weight: bold;
  z-index: 9999;
  background: #f0f0f0;
}

.floating-change .health { color: #e63946; }
.floating-change .wallet { color: #ffb703; }
.floating-change .env { color: #2a9d8f; } */

/* Confetti CSS */
.confetti {
  position: fixed;
  top: -10px;
  border-radius: 50%;
  pointer-events: none;
  animation: fall linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* Quick Click CSS */
.spacer {
    height: var(--spacer-height, 10px); 
}

.game-hint {
  font-size: 1.0rem;
  font-style: italic;
  color: #666;
  margin-top: 3rem;
  margin-bottom: 1rem;
}

/* Memory Game CSS */
.memory-card {
    width: 55px;
    height: 55px;
    perspective: 600px;
    cursor: pointer;
}

.memory-rule {
    font-size: 1.2rem;      
    text-align: center;
    margin: 1rem 0;
    color: #333;           
    font-style: italic;     
}

.card-inner {
    width: 100%;
    height: 100%;
    transition: transform 0.5s;
    transform-style: preserve-3d;
    position: relative;
}

.memory-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    border-radius: 6px;
    backface-visibility: hidden;
    /* background: #f0f0f0; */
    background: #fefefe;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-back {
    background: #fffae5;
    transform: rotateY(180deg);
}

.memory-card .card-back,
.memory-card .card-front {
  transition: background-color 0.4s ease, transform 0.18s ease;
}

.memory-card.matched .card-back {
  background: #76e42d;
  color: #1b5e20;
  font-weight: bold;
  transform: scale(1.1);
}

.memory-card.matched .card-front {
  background: #a5d6a7;
}

.memory-card.matched {
  animation: popMatched 0.4s ease forwards;
}

@keyframes popMatched {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Eco Plate CSS */
/* .plate-container {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: #f9f9f9;
    border: 4px solid #4caf50;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem auto;
    position: relative;
}

.plate {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: #fffbe6;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
} */

.plate-container {
    width: 180px;
    height: 180px;
    aspect-ratio: 1/1;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffffff, #f1f1f1);
    border: 4px solid #f5e6a7; 
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem auto;
    position: relative;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    transition: border-color 0.3s ease; 
}

/* Success (veggie) border */
.plate-container.success {
    border-color: #4caf50;
}

/* Fail (junk) border */
.plate-container.fail {
    border-color: #f44336;
}

.plate {
    width: 140px;
    height: 140px;
    aspect-ratio: 1/1;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #fffdf5, #fff5cc);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
}

.food-item {
    flex: 1 1 auto;
    font-size: clamp(1.3rem, 4vw, 2.5rem);
    cursor: grab;
    margin: 0.5rem;
    display: inline-block;
}

.eco-rule {
    font-size: 1.4rem;        
    font-style: italic;       
    text-align: center;
    margin: 2rem 0 1rem 0;
    color: #333;             
}

/* Make only emojis non-italic */
.eco-rule .emoji {
    font-style: normal;
}

/* Supermarket Dash CSS */
#supermarket-dash .game-hint {
  font-size: 0.95rem;
  margin: 12px 0 16px;
  padding: 0;
  border-radius: 0;
  background: none;
  color: #333;
  border: none;
  box-shadow: none;
  max-width: 85%;
  line-height: 1.6;
  text-align: center;
  font-style: normal;
}

.dash-hint {
    font-size: 1.0rem;
    margin: 12px 0 16px;
    line-height: 1.6;
    text-align: center;
    font-style: normal;
    max-width: 85%;
    color: #333; 
}

.dash-hint .healthy { color: #34d399; font-weight: bold; }
.dash-hint .junk { color: #ef4444; font-weight: bold; }
.dash-hint .coin { color: #facc15; font-weight: bold; }

.dash-play-area {
  width: 360px !important;
  height: 500px !important;
  margin: 0 auto 18px;
  border-radius: 14px;
  background: #f0f0f0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
  position: relative;
  overflow: hidden;
  transition: background-color 0.3s ease;
}

/* Healthy food flash */
.healthy-catch {
  animation: healthyFlash 0.25s ease;
}

@keyframes healthyFlash {
  0%   { background-color: #f8fdfb; }
  50%  { background-color: rgba(52, 211, 153, 0.15); }
  100% { background-color: #ffffff; }
}

/* Junk food flash */
.junk-catch {
  animation: junkFlash 0.25s ease;
}

@keyframes junkFlash {
  0%   { background-color: #fdf8f8; }
  50%  { background-color: rgba(239, 68, 68, 0.15); }
  100% { background-color: #ffffff; }
}

/* Coin flash */
.coin-catch {
  animation: coinFlash 0.25s ease;
}

@keyframes coinFlash {
  0%   { background-color: #fffef8; }
  50%  { background-color: rgba(250, 204, 21, 0.15); }
  100% { background-color: #ffffff; }
}

.dropped-food {
    font-size: 1.8rem;
}

