/* ============================================================
   Labiba NS – Belajar Bersama!
   style.css – Semua style untuk sistem kuis
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Fredoka+One&display=swap");

/* ===== RESET & VARIABLES ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --blue-dark: #3a9aff;
  --blue-mid: #0056b3;
  --blue-light: #9cd5ff;
  --yellow: #f5c857;
  --bg: #e3f2fd;
  --white: #ffffff;
  --green: #4caf50;
  --red: #ef5350;
  --shadow: 0 6px 24px rgba(0, 86, 179, 0.18);
  --radius: 20px;
  --radius-lg: 32px;
}

html,
body {
  width: 100%;
  height: 100%;
  font-family: "Nunito", sans-serif;
  background: var(--bg);
  overflow: hidden;
}

/* ===== CLOUD BACKGROUND ===== */
.sky {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #b8e0ff 0%, #e3f2fd 100%);
  z-index: 0;
  overflow: hidden;
}
.cloud {
  position: absolute;
  background: #fff;
  border-radius: 50px;
  opacity: 0.7;
  animation: drift linear infinite;
}
.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}
.c1 {
  width: 140px;
  height: 50px;
  top: 8%;
  left: -160px;
  animation-duration: 28s;
}
.c1::before {
  width: 80px;
  height: 80px;
  top: -40px;
  left: 20px;
}
.c1::after {
  width: 60px;
  height: 60px;
  top: -28px;
  left: 65px;
}
.c2 {
  width: 100px;
  height: 38px;
  top: 22%;
  left: -130px;
  animation-duration: 35s;
  animation-delay: -12s;
}
.c2::before {
  width: 60px;
  height: 60px;
  top: -32px;
  left: 10px;
}
.c2::after {
  width: 45px;
  height: 45px;
  top: -22px;
  left: 50px;
}
.c3 {
  width: 180px;
  height: 60px;
  top: 60%;
  left: -210px;
  animation-duration: 40s;
  animation-delay: -5s;
}
.c3::before {
  width: 100px;
  height: 100px;
  top: -55px;
  left: 25px;
}
.c3::after {
  width: 75px;
  height: 75px;
  top: -40px;
  left: 90px;
}
.c4 {
  width: 120px;
  height: 44px;
  top: 78%;
  left: -150px;
  animation-duration: 32s;
  animation-delay: -20s;
}
.c4::before {
  width: 70px;
  height: 70px;
  top: -38px;
  left: 15px;
}
.c4::after {
  width: 55px;
  height: 55px;
  top: -27px;
  left: 60px;
}

@keyframes drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(110vw);
  }
}

/* ===== BINTANG MELAYANG ===== */
.star-float {
  position: fixed;
  pointer-events: none;
  font-size: 1.6rem;
  animation: starFloat 6s ease-in-out infinite;
  z-index: 1;
  opacity: 0.35;
}
.sf1 {
  top: 12%;
  left: 5%;
  animation-delay: 0s;
  font-size: 1.2rem;
}
.sf2 {
  top: 30%;
  right: 6%;
  animation-delay: -2s;
  font-size: 2rem;
}
.sf3 {
  top: 70%;
  left: 8%;
  animation-delay: -4s;
  font-size: 1.4rem;
}
.sf4 {
  top: 55%;
  right: 5%;
  animation-delay: -1s;
  font-size: 1rem;
}

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

/* ===== SCREEN (halaman virtual) ===== */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
}
.screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
}

/* ============================================================
   SPLASH SCREEN
   ============================================================ */
#splash {
  height: 100vh;
  background-image: url("img/bg-cloud.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
}

.splash-logo-wrap {
  padding-bottom: 30px;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.25));
}

/* @keyframes bounceLogo {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-14px) rotate(2deg);
  }
} */

.brand-name {
  font-family: "Fredoka One", cursive;
  font-size: 2.4rem;
  color: var(--yellow);
  letter-spacing: 2px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
  line-height: 1.1;
  text-align: center;
}

.brand-sub {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-top: 2px;
  text-align: center;
}

.splash-tagline {
  font-family: "Fredoka One", cursive;
  font-size: 1.8rem;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.15);
  text-align: center;
  padding: 0 20px;
}

/* ============================================================
   TOMBOL UMUM
   ============================================================ */
.btn {
  font-family: "Fredoka One", cursive;
  font-size: 1.3rem;
  padding: 14px 44px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  letter-spacing: 1px;
}
.btn:hover {
  transform: scale(1.06);
}
.btn:active {
  transform: scale(0.97);
}

.btn-yellow {
  background: var(--yellow);
  color: #0056b3;
  box-shadow:
    0 6px 0 #c9973a,
    var(--shadow);
}
.btn-yellow:hover {
  box-shadow:
    0 8px 0 #c9973a,
    0 10px 30px rgba(245, 200, 87, 0.4);
}

.btn-blue {
  background: var(--blue-dark);
  color: #fff;
  box-shadow:
    0 6px 0 #0056b3,
    var(--shadow);
}

.btn-outline {
  margin-left: -10px;
  background: transparent;
  color: #F5C857;
  border: 3px solid #F5C857;
  box-shadow: none;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  width: 100%;
  background: var(--blue-dark);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 86, 179, 0.25);
  flex-shrink: 0;
}

.icon-navbar {
  width: 70px;
  height: 65px;
}

.navbar-title {
  font-family: "Fredoka One", cursive;
  color: #fff;
  font-size: 1.15rem;
}

.navbar-brand {
  padding: 15px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 800;
}

/* ============================================================
   CATEGORY SCREEN
   ============================================================ */
#category {
  background-color: #0056b3;
  background: var(--bg);
  gap: 0;
  justify-content: flex-start;
}

.category-body {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  padding: 28px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.section-title {
  font-family: "Fredoka One", cursive;
  font-size: 1.6rem;
  color: var(--blue-mid);
  text-align: center;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 720px;
}

.cat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow:
    0 4px 0 #c0d8f0,
    var(--shadow);
  transition:
    transform 0.18s,
    box-shadow 0.18s;
  border: 3px solid transparent;
}
.cat-card:hover {
  transform: translateY(-6px);
  box-shadow:
    0 10px 0 #c0d8f0,
    0 14px 30px rgba(58, 154, 255, 0.2);
  border-color: var(--blue-dark);
}

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

.cat-label {
  font-family: "Fredoka One", cursive;
  font-size: 1rem;
  color: var(--blue-mid);
  text-align: center;
}

.cat-count {
  font-size: 0.75rem;
  color: #888;
  background: var(--bg);
  padding: 2px 10px;
  border-radius: 20px;
}

/* ============================================================
   QUIZ SCREEN
   ============================================================ */
#quiz {
  background: var(--bg);
  gap: 0;
  justify-content: flex-end;
}

.quiz-body {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  gap: 18px;
  overflow-y: auto;
}

/* Progress Bar */
.progress-wrap {
  width: 100%;
  max-width: 600px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar-bg {
  flex: 1;
  height: 16px;
  background: #cde5fa;
  border-radius: 20px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--yellow), #ffaa00);
  border-radius: 20px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-label {
  font-family: "Fredoka One", cursive;
  font-size: 1rem;
  color: var(--blue-mid);
  white-space: nowrap;
}

/* Kartu Soal */
.question-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 24px 22px;
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow);
  text-align: center;
}

.question-type-badge {
  display: inline-block;
  background: var(--blue-light);
  color: var(--blue-mid);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.question-text {
  font-family: "Fredoka One", cursive;
  font-size: 1.65rem;
  color: #1a3a5e;
  line-height: 1.3;
  margin-bottom: 10px;
}

.question-img {
  font-size: 5rem;
  margin: 8px 0;
  display: block;
}

/* Grid Jawaban */
.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
  max-width: 600px;
}
.answers-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

.ans-btn {
  background: var(--white);
  border: 3px solid #c0d8f0;
  border-radius: var(--radius);
  padding: 18px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: "Fredoka One", cursive;
  font-size: 1.15rem;
  color: var(--blue-mid);
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    border-color 0.15s;
  box-shadow: 0 4px 0 #c0d8f0;
  min-height: 90px;
  position: relative;
  overflow: hidden;
}
.ans-btn .ans-icon {
  font-size: 2.4rem;
}

.ans-btn:hover:not(:disabled) {
  transform: translateY(-4px);
  box-shadow:
    0 8px 0 #9cc0e0,
    0 12px 24px rgba(58, 154, 255, 0.2);
  border-color: var(--blue-dark);
}

.ans-btn.correct {
  background: #e8f5e9;
  border-color: var(--green);
  box-shadow: 0 4px 0 #388e3c;
  color: #2e7d32;
  animation: correctPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ans-btn.wrong {
  background: #ffebee;
  border-color: var(--red);
  box-shadow: 0 4px 0 #c62828;
  color: #c62828;
  animation: shake 0.4s ease;
}

@keyframes correctPop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}

.ans-btn:disabled {
  cursor: default;
}

/* Banner Feedback */
.feedback-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 14px 24px;
  text-align: center;
  font-family: "Fredoka One", cursive;
  font-size: 1.5rem;
  letter-spacing: 1px;
  z-index: 200;
  transform: translateY(-100%);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.feedback-banner.show {
  transform: translateY(0);
}
.feedback-banner.correct {
  background: var(--green);
  color: #fff;
}
.feedback-banner.wrong {
  background: var(--red);
  color: #fff;
}

/* Tombol Navigasi Kuis */
.quiz-nav {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 600px;
  justify-content: space-between;/
}

/* ============================================================
   RESULT SCREEN
   ============================================================ */
#result {
  background: linear-gradient(160deg, #3a9aff 0%, #0056b3 100%);
  gap: 20px;
  text-align: center;
  padding: 24px;
}

.result-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 32px 40px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  max-width: 440px;
  width: 100%;
}

.result-title {
  font-family: "Fredoka One", cursive;
  font-size: 2rem;
  color: var(--yellow);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.result-score {
  font-family: "Fredoka One", cursive;
  font-size: 5rem;
  color: #fff;
  text-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
  line-height: 1;
}

.result-score-label {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.result-msg {
  font-size: 1.05rem;
  color: #fff;
  line-height: 1.5;
  margin: 12px 0;
}

.stars-row {
  font-size: 2.4rem;
  letter-spacing: 6px;
  margin: 8px 0;
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.result-logo {
  width: 120px;
  height: auto;
  margin-bottom: 12px;
  animation: bounceLogo 2.4s ease-in-out infinite;
}

/* ============================================================
   CONFETTI
   ============================================================ */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 999;
  animation: confettiFall linear forwards;
}

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

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s;
}
.modal-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal h2 {
  font-family: "Fredoka One", cursive;
  font-size: 1.6rem;
  color: var(--blue-mid);
  margin-bottom: 12px;
}

.modal p {
  font-size: 1rem;
  color: #444;
  line-height: 1.6;
  margin-bottom: 8px;
}

/* ============================================================
   TOMBOL SUARA
   ============================================================ */
.sound-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.sound-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ============================================================
   BADGE SKOR
   ============================================================ */
.score-badge {
  background: var(--yellow);
  color: var(--blue-mid);
  font-family: "Fredoka One", cursive;
  font-size: 0.95rem;
  padding: 4px 14px;
  border-radius: 20px;
}

/* ============================================================
   KOTAK PETUNJUK
   ============================================================ */
.hint-box {
  background: #fff9e6;
  border: 2px dashed var(--yellow);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 0.95rem;
  color: #5a4000;
  width: 100%;
  max-width: 600px;
  display: none;
  text-align: center;
}
.hint-box.show {
  display: block;
  animation: popIn 0.3s;
}

/* ============================================================
   RESPONSIVE – MOBILE
   ============================================================ */
@media (max-width: 500px) {
  .answers-grid {
    grid-template-columns: 1fr 1fr;
  }
  .question-text {
    font-size: 1.35rem;
  }
  .result-score {
    font-size: 4rem;
  }
  .category-grid {
    grid-template-columns: 1fr 1fr;
  }
}
