/* =====================================================
   ENGLISH QUEST — side-scrolling forest adventure
   1. Layar & background bab
   2. HUD (hati, skor, koin)
   3. Progress bar "Collect the letters"
   4. Viewport / stage / parallax / world
   5. Karakter, platform, koin, bendera
   6. Kontrol on-screen
   7. Panel kata (bawah)
   8. Popup susun huruf & kuis
   9. Toast & responsif
   ===================================================== */

/* ============ 1. LAYAR & BACKGROUND ============ */
#screen-english {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: linear-gradient(180deg, #8FE3E8 0%, #CDEFC4 55%, #EAF8DD 100%);
  background-size: cover;
  background-attachment: scroll;
  overflow: hidden;
}
.screen.bg-english {
  background: linear-gradient(180deg, #8FE3E8 0%, #CDEFC4 100%);
}


/* ============ 2. HUD ============ */
.eq-hud {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  z-index: 10;
}
.eq-icon-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 3px solid #2E8B57;
  background: var(--putih);
  color: #2E8B57;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 4px 0 #1F6B41;
  cursor: pointer;
}
.eq-icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1F6B41; }
.eq-lives {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 2.2rem; letter-spacing: 5px;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.15));
}
.eq-hud-right { display: flex; gap: 12px; }
.eq-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-judul);
  background: #FFF7DE;
  border: 2px solid #F5A623;
  padding: 10px 18px;
  font-size: 1.3rem;
  box-shadow: 0 4px 0 #D9891A;
}

/* ============ 3. PROGRESS BAR (HIDDEN in Endless Mode) ============ */
.eq-progress-wrap {
  display: none;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(520px, 92vw);
  margin: 2px auto 8px;
  background: rgba(255,255,255,0.85);
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: 0 3px 0 rgba(0,0,0,0.08);
}
.eq-progress-label {
  font-family: var(--font-judul);
  font-size: 0.85rem;
  color: #2E8B57;
  white-space: nowrap;
}
.eq-progress-track {
  flex: 1;
  height: 12px;
  background: #E3F3E1;
  border-radius: 999px;
  overflow: hidden;
  border: 2px solid #B7E4B0;
}
.eq-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #FFD166, #F5A623);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.eq-progress-count { font-weight: 800; font-size: 0.85rem; color: #2E8B57; white-space: nowrap; }

/* ============ 4. VIEWPORT / STAGE / PARALLAX ============ */
.eq-viewport {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  z-index: 2;
  border: none;
}
.eq-stage {
  position: absolute;
  top: 0; left: 0;
  width: 900px; height: 380px;
  transform-origin: top left;
}
.eq-layer { position: absolute; top: 0; left: 0; height: 380px; }
.eq-bg-layer1 {
  width: 100%;
  height: 380px;
  background-image: url('../assets/images/backgrounds/bg_game1.webp');
  background-size: auto 380px;
  background-repeat: repeat-x;
  background-position: 0 0;
  will-change: background-position;
}
.eq-bg-layer2 {
  width: 100%;
  height: 380px;
  background-image: url('../assets/images/backgrounds/bg_game2.webp');
  background-size: auto 380px;
  background-repeat: repeat-x;
  background-position: 0 0;
  will-change: background-position;
}
.eq-trees { width: 1200px; }
.eq-tree { position: absolute; bottom: 60px; filter: drop-shadow(0 4px 2px rgba(0,0,0,0.15)); }

.eq-world {
  position: absolute;
  top: 0; left: 0;
  height: 380px;
  will-change: transform;
}
.eq-ground {
  position: absolute;
  left: 0; bottom: 0;
  height: 70px;
  background: linear-gradient(180deg, #8BC34A 0%, #689F38 40%, #6D4C21 40%, #5B3A1E 100%);
  border-top: 6px solid #558B2F;
}
.eq-pit-marker {
  position: absolute;
  top: 0; bottom: 0;
  background: #7FD8E8;
  box-shadow: inset 0 8px 10px rgba(0,0,0,0.25);
}

/* ============ 5. KARAKTER, PLATFORM, KOIN, BENDERA ============ */
.eq-platform {
  position: absolute;
  background: linear-gradient(180deg, #A5D66B, #7CB342);
  border: 3px solid #558B2F;
  border-radius: 14px;
  box-shadow: 0 6px 0 rgba(85,139,47,0.5);
}

.eq-player {
  position: absolute;
  width: clamp(50px, 12vw, 70px); 
  height: clamp(57px, 13.7vw, 80px);
  transform-origin: center bottom;
}
.eq-sprite {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background-size: contain; background-repeat: no-repeat; background-position: center bottom;
  opacity: 0;
}
.eq-sprite.active { opacity: 1; }

.eq-coin {
  position: absolute;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFF3C4, #F5A623);
  border: 3px solid #D9891A;
  box-shadow: 0 5px 0 #B9760F;
  color: #7A4A0E;
  animation: eqFloat 1.6s ease-in-out infinite;
}
.eq-coin-taken { animation: eqPop 0.4s ease-out forwards !important; }
@keyframes eqFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes eqPop { to { transform: translateY(-30px) scale(1.6); opacity: 0; } }

.eq-bonus {
  position: absolute;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  animation: eqFloat 1.3s ease-in-out infinite;
}

.eq-gift {
  position: absolute;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  animation: eqFloatGift 1.8s ease-in-out infinite;
  filter: drop-shadow(0 5px 3px rgba(0,0,0,0.3));
}
.eq-gift:hover { filter: brightness(1.1); }
@keyframes eqFloatGift {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.05); }
}

.eq-flag {
  position: absolute;
  bottom: 70px;
}

/* ============ 6. KONTROL ON-SCREEN ============ */
.eq-controls {
  position: absolute;
  bottom: 30px; left: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 24px;
}
.eq-dpad { display: none; } /* Sembunyikan D-pad untuk mode Auto-runner */
.eq-btn {
  font-family: var(--font-judul);
  font-weight: 800;
  font-size: 1.4rem;
  width: 62px; height: 62px;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFE9A8, #F5A623);
  border: 3px solid #D9891A;
  box-shadow: 0 5px 0 #B9760F;
  color: #7A4A0E;
  cursor: pointer;
  user-select: none;
  touch-action: none;
}
.eq-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #B9760F; }
.eq-btn-jump {
  width: auto;
  padding: 12px 36px;
  border-radius: 999px;
  font-size: 1.25rem;
  background: linear-gradient(180deg, #9EE6A0, #4CAF50);
  border-color: #2E8B3A;
  box-shadow: 0 5px 0 #276E2E;
  color: var(--putih);
  margin-left: auto; /* Agar berada di kanan jika D-pad hidden */
}

/* ============ 7. PANEL KATA (BAWAH) (HIDDEN in Endless Mode) ============ */
.eq-word-panel {
  display: none;
}
.eq-word-title {
  display: block;
  font-family: var(--font-judul);
  color: #2E8B57;
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.eq-word-slots-static { display: flex; justify-content: center; gap: 8px; }
.eq-slot-static {
  width: 40px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--putih);
  border: 3px solid #B7E4B0;
  border-bottom-width: 5px;
  border-radius: 10px;
  font-family: var(--font-judul);
  font-weight: 800;
  font-size: 1.3rem;
  color: #B7B7B7;
}
.eq-slot-static-filled {
  color: #2E8B57;
  border-color: #4CAF50;
  background: #EAF9EA;
  animation: pop 0.3s ease;
}

/* ============ 8. POPUP SUSUN HURUF & KUIS ============ */
.eq-overlay {
  position: absolute !important;
  inset: 0;
  background: rgba(20, 50, 30, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 60;
  animation: masuk 0.25s ease;
  padding: 16px;
}
.eq-popup {
  background: #FFFDF6;
  border: 4px solid #4CAF50;
  border-radius: 26px;
  padding: 26px 24px;
  width: min(460px, 94vw);
  text-align: center;
  box-shadow: 0 10px 0 rgba(0,0,0,0.18);
  animation: popupMasuk 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.eq-popup-icon { display: flex; justify-content: center; margin-bottom: 10px; }
.eq-popup-title {
  font-family: var(--font-judul);
  font-size: 1.25rem;
  color: #2E8B57;
  margin: 8px 0 14px;
}
.eq-slots { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; }
.eq-slot {
  width: 46px; height: 54px;
  border-radius: 12px;
  border: 3px dashed #B7E4B0;
  background: #F3FBF1;
  font-family: var(--font-judul);
  font-weight: 800;
  font-size: 1.3rem;
  color: #A9A9A9;
  cursor: pointer;
}
.eq-slot-filled {
  border-style: solid;
  border-color: #4CAF50;
  color: #2E8B57;
  background: #E4F5E1;
}
.eq-slots.eq-shake { animation: goyang 0.4s ease; }

.eq-tray {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  min-height: 56px;
  padding: 8px;
  background: #FFF7DE;
  border: 3px dashed #F5D48A;
  border-radius: 14px;
  margin-bottom: 10px;
}
.eq-tray-chip {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFF3C4, #F5A623);
  border: 3px solid #D9891A;
  box-shadow: 0 4px 0 #B9760F;
  font-family: var(--font-judul);
  font-weight: 800;
  font-size: 1.15rem;
  color: #7A4A0E;
  cursor: pointer;
}
.eq-tray-chip:hover { transform: translateY(-2px); }

.eq-popup-msg { min-height: 1.4em; font-weight: 800; margin-bottom: 8px; }
.eq-msg-good { color: var(--hijau); }
.eq-msg-bad { color: var(--merah); }

.eq-popup-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

.eq-quiz-options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.eq-quiz-btn { width: 100%; }

/* ============ 9. TOAST & RESPONSIF ============ */
.eq-toast {
  position: absolute;
  top: 96px; left: 50%;
  transform: translateX(-50%);
  background: #2E8B57;
  color: var(--putih);
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 5px 0 rgba(0,0,0,0.2);
  z-index: 30;
  animation: masuk 0.25s ease;
  text-align: center;
  max-width: 90vw;
}
.eq-toast-out { animation: naik 0.3s ease forwards; }

@media (max-width: 1024px) and (max-height: 600px) and (orientation: landscape) {
  .eq-hud { padding: 8px 14px; }
  .eq-icon-btn { width: 38px; height: 38px; font-size: 1rem; }
  .eq-chip { padding: 6px 12px; font-size: 1rem; }
  .eq-lives { font-size: 1.5rem; }
  .eq-controls { bottom: 14px; padding: 6px 16px; }
  .eq-btn-jump { padding: 8px 26px; font-size: 1.1rem; }
}



/* --- Layar akhir Kata Petualang --- */
.eq-end-stars {
  margin: 10px 0 16px;
}

/* --- Topbar kanan (tombol game + koin berdampingan) --- */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}


/* ================================================
   KATA PETUALANG v2 — musuh, partikel, dan "juice"
   ================================================ */

/* --- Musuh patroli --- */
.eq-enemy {
  position: absolute;
  top: calc(100% - 70px - 46px);   /* berdiri di atas tanah */
  width: clamp(32px, 8vw, 46px);
  height: clamp(32px, 8vw, 46px);
  display: flex; align-items: center; justify-content: center;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.25));
  animation: enemyJalan 0.5s ease-in-out infinite;
  z-index: 3;
}
@keyframes enemyJalan {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-4px) rotate(4deg); }
}
.eq-enemy-mati {
  animation: enemyMati 0.35s ease forwards !important;
}
@keyframes enemyMati {
  to { transform: scale(0) rotate(180deg); opacity: 0; }
}

/* --- Pemain kebal sesaat: berkedip --- */
.eq-invul { animation: kedip 0.2s steps(2) infinite; }
@keyframes kedip { 50% { opacity: 0.35; } }

/* --- Partikel saat mengambil huruf / mengalahkan musuh --- */
.eq-spark {
  position: absolute;
  pointer-events: none;
  z-index: 6;
  animation: sparkNaik 0.65s ease-out forwards;
}
@keyframes sparkNaik {
  0%   { transform: translateY(0) scale(0.6); opacity: 1; }
  100% { transform: translateY(-46px) scale(1.5); opacity: 0; }
}

/* --- Koin huruf & bonus: mengambang + berkilau --- */
.eq-coin, .eq-bonus {
  animation: koinNgambang 1.6s ease-in-out infinite;
}
.eq-coin:nth-child(odd), .eq-bonus:nth-child(odd) { animation-delay: 0.4s; }
@keyframes koinNgambang {
  0%, 100% { transform: translateY(0); filter: brightness(1); }
  50%      { transform: translateY(-7px); filter: brightness(1.15); }
}

/* --- Bendera finish: berkibar memanggil --- */
.eq-flag {
  animation: benderaKibar 0.9s ease-in-out infinite;
  transform-origin: bottom center;
}
@keyframes benderaKibar {
  0%, 100% { transform: rotate(-6deg) scale(1); }
  50%      { transform: rotate(6deg) scale(1.08); }
}

/* --- Tanah mengikuti tema ronde --- */
.eq-ground {
  background: linear-gradient(var(--tanah, #63A93C) 30%, var(--tanah-tua, #4C8A2B) 30%);
}
