/* ==========================================================
   TPA/TPQ MAROGAN RAIHAN — Media Pembelajaran Interaktif
   base.css : variabel, layout, tombol, latar, navigasi
   ========================================================== */

:root {
  --hijau: #2e9e6b;
  --hijau-d: #1f7a51;
  --biru: #2f7fd6;
  --biru-d: #1f5fa6;
  --kuning: #ffc53d;
  --oranye: #ff8a3d;
  --merah: #e5544b;
  --ungu: #8a63d2;
  --teks: #23343f;
  --teks-l: #5b7180;
  --krem: #fffbf2;
  --putih: #ffffff;
  --radius: 22px;
  --shadow: 0 10px 26px rgba(31, 68, 94, 0.14);
  --shadow-s: 0 4px 12px rgba(31, 68, 94, 0.12);
}

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

html, body { height: 100%; }

body {
  font-family: "Segoe UI", "Nunito", system-ui, -apple-system, sans-serif;
  background: var(--krem);
  color: var(--teks);
  overflow: hidden;
  font-size: 17px;
  line-height: 1.55;
}

/* ---------- LATAR (Visual 1 di semua slide) ---------- */
#latar {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 197, 61, 0.35) 0 90px, transparent 91px),
    radial-gradient(circle at 88% 12%, rgba(47, 127, 214, 0.20) 0 70px, transparent 71px),
    radial-gradient(circle at 82% 88%, rgba(46, 158, 107, 0.22) 0 110px, transparent 111px),
    radial-gradient(circle at 8% 82%, rgba(138, 99, 210, 0.18) 0 80px, transparent 81px),
    linear-gradient(160deg, #eaf7ff 0%, #f4fff4 52%, #fff6e6 100%);
}
#latar::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(47, 127, 214, 0.16) 1.6px, transparent 1.7px),
    radial-gradient(circle, rgba(46, 158, 107, 0.14) 1.6px, transparent 1.7px);
  background-size: 46px 46px, 46px 46px;
  background-position: 0 0, 23px 23px;
  opacity: 0.75;
}

/* ---------- WADAH SLIDE ---------- */
/* ---------- PANGGUNG BERSKALA (1280x720, diperkecil otomatis) ---------- */
#bingkai {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#layar {
  width: var(--panggung-lebar, 1280px);
  height: var(--panggung-tinggi, 720px);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transform-origin: center center;
}

/* skala diterapkan oleh skala.js */
html.panggung #layar {
  transform: scale(var(--skala, 1));
}

/* di layar tegak, panggung diputar agar tetap mendatar */
html.panggung.mode-portrait #layar {
  transform: rotate(90deg) scale(var(--skala, 1));
}

.slide {
  display: none;
  width: 100%;
  max-height: 100%;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, 0.94);
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: 26px 30px 30px;
  scrollbar-width: thin;
  animation: masuk 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.slide.aktif { display: block; }

@keyframes masuk {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* ---------- JUDUL ---------- */
.judul-slide {
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 800;
  color: var(--biru-d);
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.sub-slide {
  text-align: center;
  color: var(--teks-l);
  font-size: 15px;
  margin-bottom: 18px;
}
.badge {
  display: inline-block;
  background: var(--kuning);
  color: #6b4b00;
  font-weight: 800;
  font-size: 13px;
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 10px;
}

/* ---------- BAR ATAS ---------- */
.bar-atas {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.bar-atas .kiri, .bar-atas .kanan { display: flex; gap: 8px; align-items: center; }

/* ---------- TOMBOL IKON ---------- */
.tombol-ikon {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 15px;
  background: var(--putih);
  box-shadow: var(--shadow-s);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--biru-d);
  transition: transform 0.16s ease, background 0.16s ease;
  flex: 0 0 auto;
}
.tombol-ikon:hover { background: #eef6ff; transform: translateY(-2px); }
.tombol-ikon:active { transform: scale(0.93); }
.tombol-ikon.aktif { background: var(--kuning); color: #6b4b00; }

/* ---------- TOMBOL UTAMA ---------- */
.tombol {
  border: none;
  border-radius: 18px;
  background: var(--biru);
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  font-weight: 800;
  padding: 16px 30px;
  cursor: pointer;
  box-shadow: 0 6px 0 var(--biru-d), var(--shadow-s);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.tombol:hover { filter: brightness(1.06); }
.tombol:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--biru-d); }
.tombol.hijau  { background: var(--hijau);  box-shadow: 0 6px 0 var(--hijau-d), var(--shadow-s); }
.tombol.hijau:active { box-shadow: 0 1px 0 var(--hijau-d); }
.tombol.kuning { background: var(--kuning); color: #6b4b00; box-shadow: 0 6px 0 #cf9b13, var(--shadow-s); }
.tombol.kuning:active { box-shadow: 0 1px 0 #cf9b13; }
.tombol.oranye { background: var(--oranye); box-shadow: 0 6px 0 #cf6520, var(--shadow-s); }
.tombol.oranye:active { box-shadow: 0 1px 0 #cf6520; }
.tombol.besar { font-size: 22px; padding: 20px 46px; border-radius: 22px; }
.tombol.kecil { font-size: 15px; padding: 10px 18px; border-radius: 13px; box-shadow: 0 4px 0 var(--biru-d); }

/* ---------- KARTU ---------- */
.kartu {
  background: var(--putih);
  border: 2px solid #e6eef4;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-s);
}

/* ---------- FEEDBACK / TOAST ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 30px);
  background: var(--hijau-d);
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  padding: 14px 32px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 99;
}
#toast.tampil { opacity: 1; transform: translate(-50%, 0); }
#toast.salah { background: var(--oranye); }

/* ---------- BINTANG ---------- */
.bintang-baris { display: flex; gap: 6px; justify-content: center; font-size: 30px; }
.bintang-baris span { color: #dfe8ef; transition: color 0.3s ease, transform 0.3s ease; }
.bintang-baris span.nyala { color: var(--kuning); transform: scale(1.08); }

/* ---------- UTIL ---------- */
.tengah { text-align: center; }
.tersembunyi { display: none !important; }
.arab {
  font-family: "Scheherazade New", "Amiri", "Traditional Arabic", "Times New Roman", serif;
  direction: rtl;
  unicode-bidi: isolate;
}

/* ---------- RESPONSIF ---------- */
/* Tidak ada media query lebar layar di sini: tata letak dikunci
   pada panggung 1280x720 lalu diskalakan oleh skala.js. */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
