/* === GLOBAL === */
body, html {
  font-family: "Poppins", sans-serif;
  height: 100vh;
  width: 100%;
  margin: 0;

  display: flex;
  justify-content: center;
  align-items: center;

  /* WARNA DASAR */
  background-color: #8fd3f4;

  /* GRADIENT + TEKSTUR */
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.45) 0%, transparent 35%),
    radial-gradient(circle at 80% 30%, rgba(255,255,255,0.35) 0%, transparent 40%),
    radial-gradient(circle at 30% 80%, rgba(255,255,255,0.25) 0%, transparent 45%),
    linear-gradient(135deg, #89f7fe, #66a6ff);

  position: relative;
  overflow: hidden;
}


#gameContainer {
  width: 100%;
  height: 100vh;
  background-image: url("img/bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
}

@view-transition { navigation: auto; }

/* === CANVAS === */
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;

  /* FIX: jangan timpa tombol mobile */
  position: relative !important;
  z-index: 1 !important;
}

/* === FIX FULL CENTER FOR START SCREEN === */

#questionModal,
#learningModal,
#endScreen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

#startScreen {
  background: linear-gradient(180deg, #5C9FFF 0%, #87CEEB 100%);
}

/* === TITLE === */
.title {
  font-size: 38px;        /* lebih besar */
  font-weight: 800;
  color: #4f46e5;         /* WARNA UTAMA (ungu/biru) */
  text-align: center;
  animation: bounce 1s infinite;
}
@keyframes glitch {
  0%   { text-shadow: 2px 0 #4f46e5; }
  25%  { text-shadow: -2px 0 #4f46e5; }
  50%  { text-shadow: 0 2px #4f46e5; }
  75%  { text-shadow: 0 -2px #4f46e5; }
  100% { text-shadow: 2px 0 #4f46e5; }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* === BUTTON UTAMA === */
.startButton, .continueButton, .submitButton, .restartButton {
  padding: 20px 40px;
  font-size: 1.5em;
  font-weight: bold;
  border-radius: 10px;
  cursor: pointer;
}

/* Individual Button Styles */
.startButton {
  background: linear-gradient(180deg, #4CAF50 0%, #2E7D32 100%);
  color: white;
  border: 4px solid #1B5E20;
  box-shadow: 0 6px 0 #1B5E20;
}

.startButton:hover {
  background: linear-gradient(180deg, #66BB6A 0%, #388E3C 100%);
  transform: translateY(2px);
  box-shadow: 0 4px 0 #1B5E20;
}

.instructions {
  margin-top: 30px;
  background: rgba(255, 255, 255, 0.9);
  padding: 20px 30px;
  border-radius: 15px;
  border: 3px solid #333;
  text-align: center;
}

.instructions p {
  margin: 10px 0;
  font-size: 1.2em;
  color: #333;
}

/* === HUD === */
#hud {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 5;
  background: rgba(0, 0, 0, 0.7);
  padding: 15px 25px;
  border-radius: 10px;
  border: 3px solid #FFD700;
}

#hud div {
  color: white;
  font-size: 1.3em;
  margin: 5px 0;
  text-shadow: 2px 2px 0 #000;
}

.heart {
  color: #FF0000;
  font-size: 1.5em;
}

/* === MUSIC BUTTON === */
#musicControl {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 5;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 15px;
  border-radius: 10px;
  border: 3px solid #FFD700;
  cursor: pointer;
  font-size: 1.5em;
  transition: 0.2s;
}

#musicControl:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: scale(1.1);
}

#musicControl.muted {
  opacity: 0.5;
}

/* === QUESTION MODAL === */
#questionModal {
  background: rgba(0, 0, 0, 0.8);
  display: none;
  z-index: 15;
}

.questionBox {
  background: white;
  padding: 10px;
  border-radius: 20px;
  border: 5px solid #FFD700;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.answerInput {
  width: 80%;
  padding: 15px;
  font-size: 1.5em;
  border: 3px solid #4CAF50;
  border-radius: 10px;
  text-align: center;
}

.feedback {
  margin-top: 20px;
  font-size: 1.5em;
  font-weight: bold;
  min-height: 30px;
}

.feedback.correct { color: #4CAF50; }
.feedback.wrong { color: #F44336; }

/* === LEARNING MODAL === */
#learningModal {
  display: none;
  background: rgba(0,0,0,0.85);
}

.learningBox {
background: #6c63ff;
color: #ffffff;
  padding: 40px;
  border-radius: 20px;
  border: 5px solid #4facfe;
  max-width: 600px;
  text-align: left;
  color: white;
}

/* === END SCREEN === */
#endScreen {
  display: none;
}

.endTitle {
  font-size: 3.5em;
  margin-bottom: 20px;
}

.restartButton {
  margin-top: 20px;
  background: linear-gradient(180deg, #FF9800 0%, #E65100 100%);
  border: 4px solid #BF360C;
  color: white;
  box-shadow: 0 6px 0 #BF360C;
}

#startScreen {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;

  width: 100%;
  height: auto;

  display: flex !important;
  flex-direction: column;
  justify-content: center !important;
  align-items: center !important;
  text-align: center !important;
  gap: 20px;
  padding: 0;
  margin: 0;
}

/* === BIRD & MARIO === */
#bird, .bird {
  image-rendering: pixelated;
  background-size: contain;
  background-repeat: no-repeat;
  width: 40px;
  height: 40px;
  transition: transform 0.1s ease;
}

#mario, .mario {
  image-rendering: pixelated;
  background-size: contain;
  background-repeat: no-repeat;
  width: 40px;
  height: 40px;
  animation: marioJump 0.5s ease-in-out infinite alternate;
}

@keyframes marioJump {
  0% { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

/* === MOBILE CONTROLS (FIXED VERSION) === */
#mobileControls {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  display: flex;
  justify-content: space-between;
  gap: 10px;

  /* supaya pasti muncul */
  z-index: 999999 !important;
}

.ctrlBtn {
  width: 70px;
  height: 70px;
  font-size: 32px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(5px);
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

/* Paksakan tombol selalu tampil */
#mobileControls { 
  display: flex !important; 
}
#mobileControls.hidden {
  display: none !important;
}


/* === MOBILE FIX (HP VIEWPORT) === */
@media (max-width: 600px) {
  #gameCanvas {
    height: 80vh !important;  /* supaya tombol kebagian ruang */
  }

  #mobileControls {
    bottom: 10px !important;
  }
}

