/* ============================================
   PETUALANGAN ALAM - Theme CSS
   ============================================ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: 'Comic Sans MS', 'Trebuchet MS', sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
  background: linear-gradient(180deg, #87ceeb 0%, #98d8e8 30%, #90ee90 70%, #228b22 100%);
  color: #2c3e50;
}

.screen {
  display: none;
  min-height: 100vh;
  position: relative;
  width: 100%;
}

.screen.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* ============================================
   MENU UTAMA
   ============================================ */

#menu-screen {
  position: relative;
  overflow: hidden;
  padding-bottom: 60px;
}

.sky {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(180deg, #4fc3f7 0%, #b3e5fc 60%, #c8e6c9 100%);
  z-index: 1;
}

.sun {
  position: absolute;
  top: 40px;
  right: 60px;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, #fff59d 0%, #ffeb3b 50%, #ffc107 100%);
  border-radius: 50%;
  box-shadow: 0 0 60px #ffeb3b, 0 0 100px #fff59d;
  z-index: 2;
  animation: sunPulse 4s ease-in-out infinite;
}

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

.cloud {
  position: absolute;
  background: white;
  border-radius: 50px;
  z-index: 3;
  opacity: 0.9;
  animation: floatCloud 30s linear infinite;
}

.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: white;
  border-radius: 50%;
}

.cloud1 {
  width: 100px;
  height: 30px;
  top: 80px;
  left: -100px;
}
.cloud1::before {
  width: 50px;
  height: 50px;
  top: -25px;
  left: 15px;
}
.cloud1::after {
  width: 40px;
  height: 40px;
  top: -15px;
  left: 50px;
}

.cloud2 {
  width: 80px;
  height: 25px;
  top: 140px;
  left: -80px;
  animation-delay: -10s;
  animation-duration: 40s;
}
.cloud2::before {
  width: 40px;
  height: 40px;
  top: -20px;
  left: 10px;
}
.cloud2::after {
  width: 35px;
  height: 35px;
  top: -15px;
  left: 40px;
}

.cloud3 {
  width: 90px;
  height: 28px;
  top: 50px;
  left: -90px;
  animation-delay: -20s;
  animation-duration: 50s;
}
.cloud3::before {
  width: 45px;
  height: 45px;
  top: -22px;
  left: 12px;
}
.cloud3::after {
  width: 38px;
  height: 38px;
  top: -18px;
  left: 45px;
}

@keyframes floatCloud {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(100vw + 200px)); }
}

.mountains {
  position: absolute;
  bottom: 40%;
  left: 0;
  width: 100%;
  height: 30%;
  z-index: 2;
}

.mountain {
  position: absolute;
  bottom: 0;
  width: 0;
  height: 0;
  border-style: solid;
}

.mountain-1 {
  left: 0;
  border-width: 0 250px 280px 250px;
  border-color: transparent transparent #6b8e23 transparent;
}

.mountain-2 {
  right: 10%;
  border-width: 0 300px 350px 300px;
  border-color: transparent transparent #556b2f transparent;
}

.mountain-3 {
  right: -5%;
  border-width: 0 200px 230px 200px;
  border-color: transparent transparent #7a8f3a transparent;
}

.mountain::before {
  content: '';
  position: absolute;
  top: 0;
  left: -250px;
  width: 250px;
  height: 280px;
  background: linear-gradient(180deg, transparent 30%, white 30%, white 35%, transparent 35%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.ground {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background: linear-gradient(180deg, #7cb342 0%, #558b2f 50%, #33691e 100%);
  z-index: 1;
}

.ground::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 30px;
  background: linear-gradient(180deg, transparent 0%, rgba(76, 175, 80, 0.3) 100%);
}

.river {
  position: absolute;
  bottom: 5%;
  left: 0;
  width: 100%;
  height: 12%;
  background: linear-gradient(180deg, #4fc3f7 0%, #29b6f6 50%, #0288d1 100%);
  z-index: 2;
  overflow: hidden;
}

.river::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 30px,
    rgba(255, 255, 255, 0.3) 30px,
    rgba(255, 255, 255, 0.3) 60px
  );
  animation: riverFlow 3s linear infinite;
}

@keyframes riverFlow {
  0% { transform: translateX(0); }
  100% { transform: translateX(-60px); }
}

.trees {
  position: absolute;
  bottom: 20%;
  left: 0;
  width: 100%;
  height: 200px;
  z-index: 3;
  pointer-events: none;
}

.tree {
  position: absolute;
  font-size: 4rem;
  animation: treeSway 4s ease-in-out infinite;
  filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.3));
}

.tree-1 { left: 5%; bottom: 20%; }
.tree-2 { left: 25%; bottom: 25%; animation-delay: -1s; font-size: 5rem; }
.tree-3 { right: 20%; bottom: 22%; animation-delay: -2s; }
.tree-4 { right: 5%; bottom: 18%; animation-delay: -3s; }

@keyframes treeSway {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

.animals {
  position: absolute;
  bottom: 8%;
  left: 0;
  width: 100%;
  z-index: 4;
  pointer-events: none;
}

.animal {
  position: absolute;
  font-size: 2.5rem;
  animation: animalMove 15s linear infinite;
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.3));
}

.animal:nth-child(1) { animation-delay: 0s; bottom: 30%; }
.animal:nth-child(2) { animation-delay: -3s; bottom: 15%; font-size: 1.8rem; }
.animal:nth-child(3) { animation-delay: -6s; bottom: 5%; }
.animal:nth-child(4) { animation-delay: -9s; bottom: 25%; font-size: 2rem; }

@keyframes animalMove {
  0% { left: -50px; }
  100% { left: calc(100% + 50px); }
}

.menu-content {
  position: relative;
  z-index: 10;
  max-width: 900px;
  margin: 0 auto;
  padding: 30px 20px;
  text-align: center;
}

.title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  color: white;
  text-shadow:
    3px 3px 0 #2e7d32,
    6px 6px 0 rgba(0, 0, 0, 0.2);
  margin-bottom: 10px;
  animation: titleBounce 2s ease-in-out infinite;
}

.title-icon {
  display: inline-block;
  animation: spin 4s linear infinite;
}

@keyframes titleBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.subtitle {
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  color: white;
  background: rgba(46, 125, 50, 0.7);
  display: inline-block;
  padding: 8px 20px;
  border-radius: 25px;
  margin-bottom: 8px;
  font-weight: bold;
}

.grade {
  color: #fff;
  background: rgba(255, 152, 0, 0.85);
  display: inline-block;
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: bold;
  margin-bottom: 20px;
}

.player-info {
  margin: 20px auto;
  background: rgba(255, 255, 255, 0.95);
  padding: 15px 20px;
  border-radius: 20px;
  max-width: 400px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.player-info label {
  font-size: 1.1rem;
  color: #2e7d32;
  font-weight: bold;
  display: block;
  margin-bottom: 8px;
}

#playerName {
  width: 100%;
  padding: 12px 15px;
  font-size: 1.1rem;
  border: 3px solid #66bb6a;
  border-radius: 15px;
  font-family: inherit;
  text-align: center;
  outline: none;
  transition: all 0.3s;
}

#playerName:focus {
  border-color: #2e7d32;
  box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
  transform: scale(1.02);
}

.game-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.stat {
  background: rgba(255, 255, 255, 0.95);
  padding: 12px 25px;
  border-radius: 25px;
  font-size: 1.2rem;
  font-weight: bold;
  color: #2e7d32;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  font-size: 1.5rem;
  animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-15deg); }
  75% { transform: rotate(15deg); }
}

.section-title {
  color: white;
  font-size: 1.5rem;
  margin: 30px 0 20px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}

.game-card {
  background: linear-gradient(135deg, #fff 0%, #f1f8e9 100%);
  border: 4px solid #66bb6a;
  border-radius: 20px;
  padding: 25px 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  position: relative;
  font-family: inherit;
  overflow: hidden;
}

.game-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.3) 50%, transparent 70%);
  transform: rotate(45deg);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%) rotate(45deg); }
  100% { transform: translateX(100%) rotate(45deg); }
}

.game-card:hover {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 15px 30px rgba(0,0,0,0.25);
  border-color: #2e7d32;
}

.game-card:active {
  transform: translateY(-2px) scale(1.01);
}

.game-icon {
  font-size: 4rem;
  margin-bottom: 10px;
  animation: bounce 2s ease-in-out infinite;
  display: inline-block;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.game-card h3 {
  color: #2e7d32;
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.game-card p {
  color: #558b2f;
  font-size: 0.95rem;
}

.game-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.8rem;
  background: rgba(255, 235, 59, 0.9);
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.game-badge.unlocked {
  background: linear-gradient(135deg, #ffd54f, #ff9800);
  animation: badgeShine 2s ease-in-out infinite;
}

@keyframes badgeShine {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.1) rotate(15deg); }
}

.menu-footer {
  margin-top: 40px;
  text-align: center;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.95);
  color: #2e7d32;
  border: 3px solid #66bb6a;
  padding: 12px 25px;
  font-size: 1.1rem;
  border-radius: 25px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  transition: all 0.3s;
  margin: 10px 5px;
}

.btn-secondary:hover {
  background: #66bb6a;
  color: white;
  transform: scale(1.05);
}

.btn-primary {
  background: linear-gradient(135deg, #ff9800, #f57c00);
  color: white;
  border: none;
  padding: 15px 30px;
  font-size: 1.2rem;
  border-radius: 25px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  box-shadow: 0 5px 15px rgba(245, 124, 0, 0.4);
  transition: all 0.3s;
  margin: 10px 5px;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(245, 124, 0, 0.5);
}

.footer-text {
  color: white;
  font-size: 1rem;
  margin-top: 15px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* ============================================
   LAYAR GAME
   ============================================ */

#game-screen {
  background: linear-gradient(180deg, #b3e5fc 0%, #c8e6c9 60%, #a5d6a7 100%);
  min-height: 100vh;
  padding: 0;
}

.game-header {
  background: linear-gradient(135deg, #2e7d32, #66bb6a);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.game-header h2 {
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  flex: 1;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.btn-back {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1rem;
  font-family: inherit;
  font-weight: bold;
  transition: all 0.3s;
}

.btn-back:hover {
  background: white;
  color: #2e7d32;
  transform: scale(1.05);
}

.game-info {
  display: flex;
  gap: 15px;
  font-size: 1.1rem;
  font-weight: bold;
}

.info-item {
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 15px;
}

.game-decorations {
  position: fixed;
  top: 80px;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.deco-leaf, .deco-flower, .deco-butterfly {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.3;
  animation: float 8s ease-in-out infinite;
}

.deco-leaf { top: 10%; left: 5%; animation-delay: 0s; }
.deco-flower { top: 20%; right: 8%; animation-delay: -2s; }
.deco-butterfly { top: 40%; left: 10%; animation-delay: -4s; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(20deg); }
}

.game-area {
  position: relative;
  z-index: 10;
  max-width: 800px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* ============================================
   QUIZ GAME
   ============================================ */

.quiz-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 25px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  animation: slideUp 0.5s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.quiz-progress {
  text-align: center;
  color: #2e7d32;
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 20px;
}

.quiz-emoji {
  font-size: 6rem;
  text-align: center;
  margin: 20px 0;
  animation: bounce 2s ease-in-out infinite;
  filter: drop-shadow(3px 3px 6px rgba(0,0,0,0.2));
}

.quiz-question {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  color: #2c3e50;
  text-align: center;
  margin: 20px 0;
  font-weight: bold;
  line-height: 1.4;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 25px;
}

.quiz-option {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border: 3px solid #66bb6a;
  border-radius: 18px;
  padding: 18px;
  font-size: 1.1rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  color: #2c3e50;
  transition: all 0.3s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.quiz-option:hover:not(:disabled) {
  background: linear-gradient(135deg, #c8e6c9, #a5d6a7);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.quiz-option:disabled {
  cursor: not-allowed;
}

.quiz-option.correct {
  background: linear-gradient(135deg, #81c784, #4caf50);
  color: white;
  border-color: #2e7d32;
  animation: correctPulse 0.6s ease;
}

.quiz-option.wrong {
  background: linear-gradient(135deg, #ef9a9a, #e57373);
  color: white;
  border-color: #c62828;
  animation: shake 0.5s ease;
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.quiz-fact {
  background: #fff8e1;
  border-left: 5px solid #ffa726;
  padding: 15px;
  border-radius: 10px;
  margin-top: 20px;
  color: #5d4037;
  font-size: 1rem;
  line-height: 1.5;
  text-align: center;
}

.quiz-fact::before {
  content: '💡 ';
}

/* ============================================
   PLANT PUZZLE
   ============================================ */

.puzzle-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 25px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  text-align: center;
}

.puzzle-image {
  font-size: 7rem;
  margin: 20px 0;
  filter: drop-shadow(3px 3px 6px rgba(0,0,0,0.2));
}

.puzzle-clue {
  font-size: 1.3rem;
  color: #2c3e50;
  margin: 20px 0;
  line-height: 1.5;
}

.puzzle-letters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 25px 0;
}

.letter-btn {
  background: linear-gradient(135deg, #a5d6a7, #66bb6a);
  color: white;
  border: none;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: all 0.3s;
}

.letter-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  background: linear-gradient(135deg, #66bb6a, #2e7d32);
}

.letter-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.puzzle-answer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 20px 0;
  min-height: 50px;
}

.answer-slot {
  width: 45px;
  height: 50px;
  border-bottom: 4px solid #2e7d32;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: #2e7d32;
  background: #f1f8e9;
  border-radius: 5px;
}

.answer-slot.filled {
  background: #c8e6c9;
  border-bottom-color: #1b5e20;
}

.puzzle-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.puzzle-message {
  margin-top: 15px;
  font-size: 1.2rem;
  font-weight: bold;
  min-height: 30px;
}

.puzzle-message.success { color: #2e7d32; }
.puzzle-message.error { color: #c62828; }

/* ============================================
   ECOSYSTEM MATCHING
   ============================================ */

.ecosystem-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 25px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.ecosystem-question {
  text-align: center;
  font-size: 1.3rem;
  color: #2c3e50;
  margin-bottom: 25px;
  font-weight: bold;
}

.ecosystem-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: center;
}

.eco-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eco-item {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
  border: 3px solid #66bb6a;
  border-radius: 15px;
  padding: 15px;
  font-size: 1.1rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  text-align: center;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.eco-item:hover {
  transform: scale(1.05);
  background: linear-gradient(135deg, #c8e6c9, #a5d6a7);
}

.eco-item.selected {
  background: linear-gradient(135deg, #ffeb3b, #ffc107);
  border-color: #ff9800;
  color: #5d4037;
}

.eco-item.matched {
  background: linear-gradient(135deg, #81c784, #4caf50);
  color: white;
  border-color: #2e7d32;
  cursor: default;
  opacity: 0.7;
}

.eco-item.wrong {
  background: linear-gradient(135deg, #ef9a9a, #e57373);
  color: white;
  border-color: #c62828;
  animation: shake 0.5s;
}

/* ============================================
   MEMORY GAME
   ============================================ */

.memory-container {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 25px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.memory-info {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.memory-info > div {
  background: linear-gradient(135deg, #c8e6c9, #a5d6a7);
  color: #1b5e20;
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 1.1rem;
}

.memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 500px;
  margin: 0 auto;
}

.memory-card {
  aspect-ratio: 1;
  background: linear-gradient(135deg, #66bb6a, #2e7d32);
  border: 3px solid #1b5e20;
  border-radius: 15px;
  cursor: pointer;
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s;
  position: relative;
  transform-style: preserve-3d;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.memory-card .card-front {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: linear-gradient(135deg, #a5d6a7, #66bb6a);
  border-radius: 12px;
  color: white;
  backface-visibility: hidden;
  transform: rotateY(180deg);
}

.memory-card .card-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: white;
  background: linear-gradient(135deg, #2e7d32, #1b5e20);
  border-radius: 12px;
  backface-visibility: hidden;
}

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

.memory-card.matched {
  background: linear-gradient(135deg, #ffd54f, #ff9800);
  border-color: #f57c00;
  animation: matchedPop 0.6s ease;
}

.memory-card.matched .card-front {
  background: linear-gradient(135deg, #fff59d, #ffd54f);
}

@keyframes matchedPop {
  0%, 100% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.15); }
}

/* ============================================
   MESSAGE & RESULT
   ============================================ */

.message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.98);
  padding: 25px 40px;
  border-radius: 20px;
  font-size: 1.5rem;
  font-weight: bold;
  z-index: 1000;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  text-align: center;
  border: 4px solid;
  animation: popIn 0.4s ease;
}

.message.success { color: #2e7d32; border-color: #4caf50; }
.message.error { color: #c62828; border-color: #e57373; }
.message.info { color: #1976d2; border-color: #42a5f5; }

.message.hidden { display: none; }

@keyframes popIn {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

#result-screen {
  background: linear-gradient(135deg, #4fc3f7 0%, #66bb6a 50%, #2e7d32 100%);
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

#result-screen.active {
  display: flex;
}

.result-content {
  background: rgba(255, 255, 255, 0.98);
  padding: 40px 30px;
  border-radius: 30px;
  text-align: center;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  animation: resultPop 0.6s ease;
}

@keyframes resultPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.result-emoji {
  font-size: 6rem;
  margin-bottom: 20px;
  animation: bounce 1.5s ease-in-out infinite;
}

#resultTitle {
  font-size: 2.2rem;
  color: #2e7d32;
  margin-bottom: 10px;
}

#resultMessage {
  color: #555;
  font-size: 1.1rem;
  margin-bottom: 25px;
}

.result-stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
  font-size: 3rem;
}

.result-stars .star {
  animation: starPop 0.5s ease backwards;
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.2));
}

.result-stars .star.empty {
  filter: grayscale(1) opacity(0.3);
}

.result-stars .star:nth-child(1) { animation-delay: 0.1s; }
.result-stars .star:nth-child(2) { animation-delay: 0.3s; }
.result-stars .star:nth-child(3) { animation-delay: 0.5s; }

@keyframes starPop {
  0% { transform: scale(0) rotate(0deg); }
  60% { transform: scale(1.3) rotate(360deg); }
  100% { transform: scale(1) rotate(360deg); }
}

.result-score {
  font-size: 1.5rem;
  color: #ff9800;
  font-weight: bold;
  margin: 20px 0;
  background: #fff8e1;
  padding: 12px;
  border-radius: 15px;
}

.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ============================================
   CONFETTI
   ============================================ */

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  pointer-events: none;
  z-index: 9999;
  animation: confettiFall 3s linear forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
  .game-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .game-card {
    padding: 18px 10px;
  }

  .game-icon {
    font-size: 3rem;
  }

  .game-card h3 {
    font-size: 1rem;
  }

  .game-card p {
    font-size: 0.8rem;
  }

  .quiz-options {
    grid-template-columns: 1fr;
  }

  .ecosystem-board {
    grid-template-columns: 1fr;
  }

  .memory-board {
    grid-template-columns: repeat(3, 1fr);
  }

  .menu-content {
    padding: 20px 15px;
  }
}
