/* Lancar Membaca by Jagoan Cilik. Dunia Jagoan Cilik (langit, bukit, tinta biru tua, tombol kuning) dengan rel kereta:
   tiap kata naik satu gerbong merah, tiap sublevel satu stasiun. Arah desain: siap-tka/DESIGN.md, gaya C Peta Petualangan. */
@font-face { font-family: Quicksand; font-weight: 300 700; font-display: swap; src: url("huruf/Quicksand.ttf") format("truetype"); }
@font-face { font-family: Poppins; font-weight: 800; font-display: swap; src: url("huruf/Poppins-ExtraBold.ttf") format("truetype"); }

:root {
  --langit: #BDE3FF;
  --rumput: #9BDFA0;
  --rumput-tua: #8AD692;
  --krem: #FFF3C4;
  --jendela: #FFF8E7;
  --tinta: #1A2B6B;
  --biru: #2340D6;
  --kuning: #FFC93C;
  --kuning-tua: #9A6200;
  --merah: #D2462C;
  --merah-tua: #9E2F18;
  --tepi: #6079C6;
  --hijau: #17703D;
  --oranye: #A34A06;
  --rel: #6B5B4E;
  --bantalan: #A88462;
  --kerikil: #EADDBF;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--langit); color: var(--tinta);
  font: 500 17px/1.45 Quicksand, system-ui, sans-serif;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--biru); outline-offset: 3px; border-radius: 8px; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { font-family: Poppins, Quicksand, sans-serif; font-weight: 800; line-height: 1.15; margin: 0; }
.memuat { padding: 48px 20px; text-align: center; font-weight: 700; }
.layar { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); position: relative; }

/* Tombol: satu tombol utama kuning bertepi bawah per layar, sisanya putih bertepi biru. */
.tombol {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 22px;
  border-radius: 20px; border: 2px solid var(--tepi); background: #fff; font-weight: 700; font-size: 18px; text-decoration: none;
}
.tombol.utama { background: var(--kuning); border-color: var(--kuning-tua); box-shadow: 0 5px 0 var(--kuning-tua); font-family: Poppins, Quicksand, sans-serif; font-weight: 800; }
.tombol.utama:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--kuning-tua); }
.tombol:disabled { opacity: .55; cursor: default; }
.tombol.penuh { width: 100%; }
.ikon-tombol { width: 48px; height: 48px; border-radius: 16px; border: 2px solid var(--tepi); background: #fff; display: inline-grid; place-items: center; padding: 0; }
.ikon-tombol svg { width: 24px; height: 24px; fill: var(--tinta); }
.tautan { background: none; border: 0; padding: 10px 4px; font-weight: 700; color: var(--biru); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }

/* Bukit di dasar layar masuk dan peta: tempat kereta berjalan. */
.bukit { position: absolute; left: 0; right: 0; bottom: 0; height: 120px; pointer-events: none; overflow: hidden; z-index: 0; }
.bukit::before, .bukit::after { content: ""; position: absolute; bottom: -90px; border-radius: 50%; }
.bukit::before { left: -20%; width: 90%; height: 200px; background: var(--rumput-tua); }
.bukit::after { right: -25%; width: 100%; height: 190px; background: var(--rumput); }

/* Gerbong kata */
.kereta { display: flex; align-items: flex-end; justify-content: center; flex-wrap: wrap; gap: 14px 0; }
.lok { width: 92px; height: auto; margin-right: -2px; flex: none; align-self: flex-end; }
.gerbong {
  position: relative; background: var(--merah); border-radius: 16px 16px 12px 12px; padding: 10px 10px 22px;
  margin: 0 0 12px 12px; flex: none; transition: transform .25s;
}
.gerbong::before { content: ""; position: absolute; left: -14px; bottom: 24px; width: 14px; height: 6px; background: var(--rel); border-radius: 3px; }
.gerbong .roda { position: absolute; bottom: -12px; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle, var(--kuning) 0 4px, #2B2B3C 5px); }
.gerbong .roda:first-of-type { left: 14px; }
.gerbong .roda:last-of-type { right: 14px; }
.jendela { display: block; background: var(--jendela); border-radius: 12px; padding: 4px 14px 8px; text-align: center; min-width: 56px; }
.kata { font: 700 32px/1.25 Quicksand, sans-serif; letter-spacing: .01em; white-space: nowrap; }
.besar .kata { font-size: clamp(42px, 13vw, 84px); }
.besar .jendela { padding: 6px 22px 12px; }
.besar.gerbong { padding: 12px 12px 26px; }
.besar .roda { width: 32px; height: 32px; bottom: -15px; }
.suku-tanda .suku { display: inline-block; margin: 0 .05em; padding-bottom: .04em; border-bottom: .085em solid var(--biru); border-radius: 2px; }
.suku-tanda .suku:nth-child(even) { border-bottom-color: var(--merah); }
.gerbong.nyala { transform: translateY(-6px); }
.gerbong.nyala .jendela { box-shadow: 0 0 0 4px var(--kuning); }
.gerbong.kosong { background: transparent; border: 3px dashed var(--tepi); }
.gerbong.kosong .roda { background: #fff; border: 3px dashed var(--tepi); }
.gerbong.kosong .jendela { background: transparent; color: transparent; }
button.gerbong { border: 0; font: inherit; color: var(--tinta); }

/* Layar masuk */
.masuk { display: flex; flex-direction: column; padding-top: 28px; padding-bottom: 150px; }
.masuk .kepala { display: flex; align-items: flex-end; gap: 4px; }
.masuk .kepala .kakjago { width: 128px; flex: none; }
.masuk h1 { font-size: 34px; }
.masuk .merek { font-weight: 700; margin-top: 4px; }
.masuk .kereta { margin: 18px 0 8px; justify-content: flex-start; }
.masuk .kereta .kata { font-size: 24px; }
.kartu { background: #fff; border-radius: 26px; padding: 20px; position: relative; z-index: 1; }
.kartu p { margin: 0 0 14px; }
label.judul-isian { display: block; font-weight: 700; margin-bottom: 6px; }
.isian { width: 100%; min-height: 52px; border: 2px solid var(--tepi); border-radius: 16px; padding: 12px 14px; background: #fff; font-size: 18px; }
.pesan-galat { color: var(--merah-tua); font-weight: 700; margin: 10px 0 0; }
.catatan { font-size: 15px; margin: 12px 0 0; }

/* Kak Jago bicara: dua gambar (mulut tutup dan buka) bergantian selama suaranya diputar. */
.kakjago { position: relative; background: none; border: 0; padding: 0; }
.kakjago img { width: 100%; height: auto; }
.kakjago img + img { position: absolute; inset: 0; opacity: 0; }
.kakjago.buka img + img { opacity: 1; }
.kakjago.buka img:first-child { opacity: 0; }

/* Kenalan */
.kenalan { padding-top: 24px; padding-bottom: 32px; }
.kenalan h1 { font-size: 26px; margin: 8px 0 18px; }
.pilihan { display: grid; gap: 10px; margin: 8px 0 20px; }
.pilihan label { display: flex; gap: 12px; align-items: center; border: 2px solid var(--tepi); border-radius: 20px; padding: 12px 14px; background: #fff; font-weight: 700; min-height: 56px; }
.pilihan input { width: 22px; height: 22px; accent-color: var(--biru); flex: none; }
.pilihan label:has(input:checked) { border-color: var(--kuning-tua); background: #FFF7DD; }
.pilihan small { display: block; font-weight: 500; }

/* Peta */
.atas { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 6px; position: sticky; top: 0; z-index: 5; background: var(--langit); }
.atas h1 { font-size: 22px; }
.atas p { margin: 0; font-size: 15px; font-weight: 700; }
.sapa { display: flex; align-items: center; gap: 10px; margin: 6px 0 4px; }
.sapa .kakjago { width: 72px; flex: none; }
.gelembung { background: #fff; border-radius: 20px; padding: 10px 14px; font-weight: 700; position: relative; }
.gelembung::before { content: ""; position: absolute; left: -8px; top: 50%; margin-top: -8px; border: 8px solid transparent; border-left: 0; border-right-color: #fff; }
.peta { position: relative; margin: 8px -16px 0; }
.peta svg.jalur { position: absolute; inset: 0; width: 100%; height: 100%; }
.stasiun {
  position: absolute; transform: translate(-50%, -50%); width: 88px; height: 88px; border-radius: 50%; padding: 0;
  border: 5px solid var(--tepi); background: #fff; overflow: hidden; display: grid; place-items: center; z-index: 2;
}
.stasiun img { width: 100%; height: 100%; object-fit: cover; }
.stasiun .tanpa-gambar { font: 700 20px/1 Quicksand, sans-serif; }
.stasiun.selesai { border-color: var(--biru); }
.stasiun.sekarang { border-color: var(--kuning); box-shadow: 0 0 0 4px var(--kuning-tua); }
.stasiun.terkunci { border-color: #9AA6C8; }
.stasiun.terkunci img, .stasiun.terkunci .tanpa-gambar { filter: grayscale(1); opacity: .5; }
.label-stasiun { position: absolute; transform: translateY(-50%); width: 38%; font-size: 14px; line-height: 1.3; z-index: 2; pointer-events: none; }
.label-stasiun b { display: block; font: 800 17px/1.2 Poppins, sans-serif; }
.label-stasiun.kanan { text-align: left; }
.label-stasiun.kiri { text-align: right; }
.tanda { position: absolute; z-index: 3; transform: translate(-50%, 0); display: inline-flex; align-items: center; gap: 4px; border-radius: 16px; padding: 3px 10px; font-weight: 800; font-size: 14px; white-space: nowrap; pointer-events: none; }
.tanda.mulai { background: var(--kuning); border: 2px solid var(--kuning-tua); }
.tanda.cek { background: var(--biru); color: #fff; width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 50%; }
.tanda.cek svg { width: 18px; height: 18px; fill: #fff; }
.tanda.kunci { background: #fff; border: 2px solid #9AA6C8; width: 30px; height: 30px; padding: 0; justify-content: center; border-radius: 50%; }
.tanda.kunci svg { width: 16px; height: 16px; fill: var(--tinta); }
.papan-level { position: absolute; left: 50%; transform: translate(-50%, -50%); z-index: 2; background: var(--tinta); color: #fff; border-radius: 16px; padding: 8px 16px; text-align: center; white-space: nowrap; }
.papan-level b { font: 800 16px/1.2 Poppins, sans-serif; display: block; }
.papan-level span { font-size: 14px; font-weight: 700; }
.papan-level.menyusul { background: #fff; color: var(--tinta); border: 2px dashed var(--tepi); white-space: normal; width: 76%; }
.lok-peta { position: absolute; width: 64px; z-index: 3; transform: translate(-50%, -50%); transition: left 1.4s ease-in-out, top 1.4s ease-in-out; pointer-events: none; }
.lok-peta.balik { transform: translate(-50%, -50%) scaleX(-1); }

/* Main */
.main { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.main-atas { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.kemajuan { flex: 1; height: 14px; border-radius: 7px; background: #fff; border: 2px solid var(--tepi); overflow: hidden; }
.kemajuan i { display: block; height: 100%; background: var(--biru); border-radius: 5px; transition: width .4s; }
.petunjuk { display: flex; align-items: center; gap: 10px; min-height: 84px; }
.petunjuk .kakjago { width: 66px; flex: none; }
.panggung { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 12px 0; }
.dengar { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 16px; border-radius: 20px; border: 2px solid var(--tepi); background: #fff; font-weight: 700; }
.dengar svg { width: 22px; height: 22px; fill: var(--biru); }
.bawah { display: grid; gap: 10px; }
.bawah .dua { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.untuk-bunda { font-size: 15px; text-align: center; margin: 0; font-weight: 600; }
.pilih-suku { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 0; min-height: 96px; }
.pilih-suku .gerbong { cursor: pointer; }
.pilih-gambar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.pilih-gambar button { aspect-ratio: 1; border-radius: 22px; border: 4px solid var(--tepi); background: #FFF6E0; padding: 0; overflow: hidden; }
.pilih-gambar button img { width: 100%; height: 100%; object-fit: cover; }
.pilih-gambar button.salah { opacity: .35; border-color: #9AA6C8; }
.pilih-gambar button.benar { border-color: var(--hijau); box-shadow: 0 0 0 4px #BFE8CC; }
.goyang { animation: goyang .4s; }
.tunjuk-ini { animation: denyut 1s infinite; }
.jalan-masuk { animation: masuk .45s ease-out; }

/* Selesai */
.selesai-layar { text-align: center; padding-top: 28px; padding-bottom: 150px; }
.selesai-layar .kakjago { width: 170px; margin: 0 auto; }
.selesai-layar h1 { font-size: 28px; margin: 12px 0 6px; }
.angka-besar { font: 800 44px/1 Poppins, sans-serif; color: var(--biru); }
.daftar-ulang { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.daftar-ulang li { background: var(--jendela); border: 2px solid var(--kuning-tua); border-radius: 16px; padding: 4px 12px; font-weight: 700; font-size: 20px; }

/* Lembar (dialog) */
#lembar { position: fixed; inset: 0; z-index: 20; background: rgba(26, 43, 107, .45); display: flex; align-items: flex-end; justify-content: center; }
#lembar[hidden] { display: none; }
.isi-lembar { background: #fff; width: 100%; max-width: 480px; border-radius: 26px 26px 0 0; padding: 22px 16px calc(20px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; }
.isi-lembar h2 { font-size: 22px; margin-bottom: 8px; }
.isi-lembar p { margin: 0 0 14px; }
.isi-lembar .tombol + .tombol { margin-top: 10px; }
.contoh-kata { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }
.contoh-kata li { background: var(--jendela); border-radius: 12px; padding: 2px 10px; font-weight: 700; font-size: 18px; }
.baris-setelan { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #DCE3F5; min-height: 56px; }
.baris-setelan:last-of-type { border-bottom: 0; }
.saklar { width: 28px; height: 28px; accent-color: var(--biru); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--tinta); color: #fff; padding: 10px 18px; border-radius: 16px; font-weight: 700; opacity: 0; transition: opacity .2s, transform .2s; z-index: 30; pointer-events: none; max-width: calc(100% - 32px); }
#toast.tampil { opacity: 1; transform: translate(-50%, 0); }

@keyframes goyang { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes denyut { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes masuk { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes napas { 0%, 100% { transform: translate(-50%, -50%) scale(1); } 50% { transform: translate(-50%, -50%) scale(1.07); } }
.stasiun.sekarang { animation: napas 1.8s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Tambahan kecil */
.jarak-atas { margin-top: 16px; }
.kenalan h2.sub { font-size: 20px; margin: 22px 0 4px; }
.isian-baris { display: flex; gap: 8px; flex: 1; max-width: 300px; }
.isian-baris .isian { min-width: 0; }
form.baris-setelan { flex-wrap: wrap; }
.baris-setelan small { font-weight: 500; }
.tombol.bahaya { color: var(--merah-tua); border-color: var(--merah-tua); }
.kereta.kalimat .kata { font-size: clamp(28px, 8vw, 38px); }
.kereta.kalimat .gerbong { margin-left: 8px; }
