:root {
  --ink: #25355f;
  --sky: #dff5ff;
  --yellow: #ffd83d;
  --pink: #ff6b9c;
  --green: #4bc883;
  --red: #ff6363;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  width: 100%;
  min-height: calc(100 * min(var(--vh, 1vh), 1vh));
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.game-root {
  min-height: calc(100 * min(var(--vh, 1vh), 1vh));
  width: 100%;
  position: relative;
  overflow: hidden;
  background: transparent;
}

/* Animasi Bintang Latar Global */
.twinkle { animation: twinkle 4s infinite alternate; }
@keyframes twinkle {
  0% { opacity: 0.3; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.2); }
}

.screen {
  display: none;
  width: 100%;
  min-height: calc(100 * min(var(--vh, 1vh), 1vh));
  position: relative;
  z-index: 1;
}

/* 1. Animasi bila skrin BAHARU dibuka (Efek anjal / Spring) */
.screen.active {
  display: flex;
  animation: popMasuk 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both; 
}

/* 2. Animasi bila skrin LAMA ditutup */
.screen.keluar {
  animation: popKeluar 0.3s ease-in both;
}

.menu-shell, .game-shell, .finish-shell, .records-shell {
  width: 100%;
  max-width: 1080px;
  margin: auto;
}

.menu-shell { max-width: 850px; }

.kid-title {
  font-family: "Fredoka", sans-serif;
  letter-spacing: 0.03em;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 5px 12px rgba(0, 0, 0, 0.25);
}

/* Tajuk khas di atas kad berlatar putih supaya kekal bersih & jelas */
#welcome-screen .kid-title,
#finish-screen .kid-title,
#tentang-kami-modal .kid-title,
#modal-pasang-suara .kid-title {
  text-shadow: 0 2px 0 #cbd5e1;
}

.bubble-card {
  border: 5px solid #fff;
  border-radius: 32px;
  box-shadow: 0 12px 0 rgba(37, 53, 95, .13), 0 18px 30px rgba(37,53,95,.12);
}

.choice-card {
  border: 4px solid #fff;
  border-radius: 24px;
  box-shadow: 0 7px 0 rgba(37,53,95,.12);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.choice-card:hover, .choice-card:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 10px 0 rgba(37,53,95,.12);
}

.choice-card input:checked + span {
  outline: 4px solid #25355f;
  outline-offset: 3px;
  transform: scale(1.03);
}

.big-btn {
  border: 0;
  border-bottom: 6px solid rgba(37,53,95,.22);
  border-radius: 20px;
  min-height: 62px;
  transition: transform .16s ease, border-bottom-width .16s ease, filter .16s ease;
}

.big-btn:hover { filter: brightness(1.04); transform: translateY(-2px); }
.big-btn:active { transform: translateY(4px); border-bottom-width: 2px; }
.big-btn:focus-visible, .answer-btn:focus-visible, .match-item:focus-visible {
  outline: 4px solid #25355f;
  outline-offset: 4px;
}

.answer-btn {
  min-height: 100px;
  border: 6px solid #fff;
  border-radius: 30px;
  font-family: "Fredoka", sans-serif;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 900;
  color: #1e3a8a;
  box-shadow: 0 10px 0 rgba(0,0,0,0.15);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.answer-btn:hover {
  transform: translateY(-6px) scale(1.05);
  filter: brightness(1.1);
}
.answer-btn:active {
  transform: translateY(10px) scale(0.95);
  box-shadow: 0 0 0 rgba(0,0,0,0);
  border-bottom-width: 6px;
}

.feedback-good { animation: popGood .6s ease; }
.feedback-bad { animation: shakeBad .5s ease; }

.draggable-token {
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.drag-target {
  min-width: 126px;
  min-height: 92px;
  border: 4px dashed #81a1cb;
  border-radius: 22px;
  transition: background .2s, border-color .2s;
}
.drag-target.over { background: #fff4b6; border-color: #f3ae17; }

.match-item {
  border: 4px solid #fff;
  border-radius: 18px;
  min-height: 66px;
  font-family: "Fredoka", sans-serif;
  transition: transform .15s ease, outline .15s ease;
}
.match-item.selected { outline: 5px solid #ffb20f; transform: scale(1.04); }
.match-item.done { background: #baf2c8 !important; pointer-events: none; }

#trace-canvas {
  width: min(100%, 420px);
  height: auto;
  background: radial-gradient(circle at center, #ffffff 0%, #f0f9ff 100%);
  border: none;
  border-radius: 28px;
  touch-action: none;
  display: block;
}

.stars { color: #ffb800; filter: drop-shadow(0 2px 0 #bf7d00); }
.hidden { display: none !important; }

@keyframes popMasuk {
  0% { opacity: 0; transform: scale(0.8) translateY(30px); }
  100% { opacity: 1; transform: none; }
}

@keyframes popKeluar {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.9); }
}

@keyframes popGood { 50% { transform: scale(1.04); background: #c6f6d5; } }
@keyframes shakeBad { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }

/* --- KOD UNTUK HILANGKAN LOADING SCREEN --- */
#loading-screen.hilang {
  opacity: 0;
  pointer-events: none !important;
}

/* --- ANIMASI ANGKASA --- */
.anim-bumi { animation: pusingBumi 60s linear infinite; }
@keyframes pusingBumi { 100% { transform: rotate(360deg); } }

.anim-bulan { animation: pusingBulan 20s linear infinite; }
@keyframes pusingBulan {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(15deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

.anim-jet { animation: terbangJet 12s ease-in-out infinite; }
@keyframes terbangJet {
  0% { right: -100px; transform: translateY(0) rotate(-10deg); }
  50% { transform: translateY(-50px) rotate(-10deg); }
  100% { right: 110vw; transform: translateY(0) rotate(-10deg); }
}

/* --- ANIMASI KUMPULAN AWAN --- */
.anim-awan-1 { animation: gerakKanan 15s ease-in-out infinite; }
.anim-awan-2 { animation: gerakKiri 12s ease-in-out infinite; }
.anim-awan-3 { animation: gerakKanan 18s ease-in-out infinite; }
.anim-awan-4 { animation: gerakKiri 20s ease-in-out infinite; }
.anim-awan-5 { animation: gerakKanan 14s ease-in-out infinite; }

@keyframes gerakKanan {
  0% { transform: translateX(0px); }
  50% { transform: translateX(40px); }
  100% { transform: translateX(0px); }
}

@keyframes gerakKiri {
  0% { transform: translateX(0px); }
  50% { transform: translateX(-40px); }
  100% { transform: translateX(0px); }
}

/* ========================================== */
/* GAYA SKRIN UTAMA: PLANET TERAPUNG & DOCK 3D */
/* ========================================== */

::-webkit-scrollbar {
  width: 0px;
  background: transparent;
}

@keyframes apungPlanet {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.anim-apung-1 { animation: apungPlanet 3.5s ease-in-out infinite; }
.anim-apung-2 { animation: apungPlanet 4.2s ease-in-out infinite 0.5s; }
.anim-apung-3 { animation: apungPlanet 3.8s ease-in-out infinite 1s; }
.anim-apung-4 { animation: apungPlanet 4.5s ease-in-out infinite 1.5s; }

.planet-card:hover {
  filter: brightness(1.1);
}
.planet-card:active {
  transform: scale(0.92) !important;
}

/* Butang Navigasi Bawah 3D (Gula-gula Ceria) */
.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  border-radius: 20px;
  border-top: 2px solid rgba(255, 255, 255, 0.5);
  border-bottom-width: 5px;
  border-bottom-style: solid;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
}

.dock-btn:hover {
  transform: translateY(-4px) scale(1.04);
  filter: brightness(1.08);
}

.dock-btn:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
}

/* Butang Tengah Istimewa: Arked Angkasa */
.dock-btn-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  border-radius: 24px;
  border-width: 3px;
  border-bottom-width: 6px;
  border-style: solid;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.7), 0 6px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer;
}

.dock-btn-center:hover {
  transform: translateY(-5px) scale(1.08);
  box-shadow: 0 0 30px rgba(250, 204, 21, 0.9), 0 8px 16px rgba(0, 0, 0, 0.5);
}

.dock-btn-center:active {
  transform: translateY(3px);
  border-bottom-width: 2px;
}

.dock-label {
  font-family: "Fredoka", sans-serif;
  font-size: clamp(0.7rem, 1.8vw, 0.95rem);
  font-weight: 700;
  margin-top: 2px;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

/* ========================================== */
/* KECERIAAN KOTAK SOALAN & JAWAPAN */
/* ========================================== */

#question-card {
  background: linear-gradient(180deg, #ffffff 0%, #f0f7ff 100%);
  border: 6px solid #fff;
  border-radius: 40px;
  box-shadow: 0 15px 0 #baddff, 0 20px 30px rgba(0,0,0,0.2);
  padding: 3rem 2rem;
}

#question-prompt {
  color: #1e3a8a;
  text-shadow: none;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

/* ========================================== */
/* ANIMASI PREMIUM KANVAS (DIORAMA HIDUP) */
/* ========================================== */

@keyframes auraGlow {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(56,189,248,0.5)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 30px rgba(56,189,248,1)); transform: scale(1.08); }
}
.anim-glow { animation: auraGlow 3s ease-in-out infinite; }

@keyframes bossFloat {
  0%, 100% { transform: translateY(0) rotate(-4deg); filter: drop-shadow(0 0 15px rgba(239,68,68,0.5)); }
  50% { transform: translateY(-20px) rotate(4deg); filter: drop-shadow(0 0 40px rgba(239,68,68,0.9)); }
}
.anim-boss { animation: bossFloat 4s ease-in-out infinite; }

@keyframes floatVehicle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.anim-terapung-kenderaan { animation: floatVehicle 2s ease-in-out infinite; }

/* ========================================== */
/* KAWALAN SKRIN MELINTANG (PORTRAIT BLOCKER) */
/* ========================================== */
@media screen and (max-width: 768px) and (orientation: portrait) {
  #landscape-warning {
    display: flex !important;
  }
  .game-root {
    display: none !important;
  }
}

/* ========================================== */
/* ANIMASI & REKAAN PREMIUM ARKED ANGKASA     */
/* ========================================== */

@keyframes shakeScreen {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-6px, 4px); }
  50% { transform: translate(6px, -4px); }
  75% { transform: translate(-4px, -2px); }
}
.animate-shake {
  animation: shakeScreen 0.25s ease-in-out;
}

@keyframes apungNaik {
  0% { opacity: 1; transform: translate(-50%, 0) scale(0.7); }
  40% { opacity: 1; transform: translate(-50%, -25px) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -55px) scale(0.9); }
}
.teks-skor-apung {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  font-family: 'Fredoka', sans-serif;
  font-weight: 900;
  text-shadow: 0 3px 6px rgba(0,0,0,0.6);
  animation: apungNaik 0.75s ease-out forwards;
}

@keyframes jatuh {
  0% { top: -110px; transform: rotate(0deg) scale(0.95); }
  100% { top: 115%; transform: rotate(360deg) scale(1.1); }
}

.asteroid-batu {
  position: absolute;
  width: 88px;
  height: 88px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="45" fill="%238B7355" stroke="%235C4033" stroke-width="6"/><circle cx="30" cy="30" r="10" fill="%235C4033" opacity="0.5"/><circle cx="70" cy="60" r="14" fill="%235C4033" opacity="0.5"/><circle cx="40" cy="70" r="8" fill="%235C4033" opacity="0.5"/></svg>');
  background-size: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 3px 3px 0 #1e293b, -2px -2px 0 #1e293b, 2px -2px 0 #1e293b, -2px 2px 0 #1e293b;
  cursor: crosshair;
  user-select: none;
  filter: drop-shadow(0 8px 15px rgba(0,0,0,0.5));
  animation: jatuh linear forwards;
}

@media (min-width: 768px) {
  .asteroid-batu { width: 105px; height: 105px; font-size: 3rem; }
}

.asteroid-hancur {
  animation: letup-asteroid 0.3s ease-out forwards !important;
}
@keyframes letup-asteroid {
  0% { transform: scale(1); filter: brightness(1.5); opacity: 1; }
  50% { transform: scale(1.6); filter: brightness(2) drop-shadow(0 0 25px #ffcc00); opacity: 0.9; }
  100% { transform: scale(0); opacity: 0; }
}

/* Komet Huruf (Bahasa) */
.komet-huruf {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-size: 2.3rem;
  font-weight: 900;
  color: #1e3a8a;
  border: 4px solid #ffffff;
  box-shadow: 0 0 20px #38bdf8;
  animation: jatuh linear forwards;
  background: radial-gradient(circle at 50% 60%, #ffffff, #ffe066 55%, #f59e0b 100%);
  filter: drop-shadow(0 -18px 15px rgba(56,189,248,0.85));
}

@media (min-width: 768px) {
  .komet-huruf { width: 84px; height: 84px; font-size: 3rem; }
}

.komet-hilang {
  animation: letup-asteroid 0.25s ease-out forwards !important;
}

#pangkat-pemain-home {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  font-weight: 900;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}