/* ============================================================
   Tulis Cerita · v2 — gaya "Buku Tulis Uli": kertas bergaris, sampul warna-warni,
   tombol tebal ala mainan. Urutan: 1 dasar · 2 tombol · 3 maskot/hero · 4 rak · 5 sheet
   6 editor · 7 laci alat · 8 buku · 9 hias · 10 dialog/toast · 11 animasi · 12 responsif
   ============================================================ */

/* ---------- 1. DASAR ---------- */
:root {
  --oranye: #ff8a4c; --oranye-tua: #d9622a; --hijau: #28b99a; --hijau-tua: #1a8f76;
  --kuning: #ffbe1b; --kuning-tua: #e09a00; --merah: #ff5c6c; --biru: #4c9dff; --ungu: #a066ff;
  --teks: #3b2a1c; --teks-2: #7a634e; --kertas: #fffdf6; --garis: #d8e7f7;
  --bayang: 0 5px 0 rgba(90, 55, 25, .14), 0 10px 22px rgba(90, 55, 25, .10);
  --r: 22px;
  --font: "Nunito", "Baloo 2", "Quicksand", ui-rounded, "Segoe UI Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
html { overflow-x: hidden; }
body {
  font-family: var(--font); color: var(--teks); font-weight: 600; font-size: 17px;
  background: linear-gradient(170deg, #ffe9d2 0%, #fff6e8 40%, #eefaf4 100%);
  min-height: 100vh; overflow-x: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
b, strong { font-weight: 900; }
[hidden] { display: none !important; }

.latar { position: fixed; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.titik { position: absolute; border-radius: 50%; opacity: .35; }
.t1 { width: 260px; height: 260px; background: #ffd0a8; left: -80px; top: 40px; }
.t2 { width: 200px; height: 200px; background: #bfeedd; right: -70px; top: 320px; }
.t3 { width: 160px; height: 160px; background: #ffe58a; left: 30%; bottom: -60px; }

.layar { display: none; max-width: 820px; margin: 0 auto; padding: 10px 14px 80px; }
.layar.aktif { display: block; animation: masuk .25s ease; }

.bar-atas { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; min-height: 52px; }
.bar-judul { font-weight: 900; color: var(--teks-2); font-size: 1rem; flex: 1; text-align: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.btn-bulat {
  width: 48px; height: 48px; border-radius: 50%; background: #fff; display: inline-grid; place-items: center;
  font-size: 1.35rem; font-weight: 900; color: var(--oranye-tua); text-decoration: none; flex-shrink: 0;
  box-shadow: 0 4px 0 rgba(90, 55, 25, .15);
}
.btn-bulat:active { transform: translateY(3px); box-shadow: none; }
.btn-bulat.besar { width: 58px; height: 58px; font-size: 1.5rem; }
.btn-bulat:disabled { opacity: .35; }

/* ---------- 2. TOMBOL ---------- */
.tombol {
  background: #fff; border: 3px solid #ffe0c4; color: var(--oranye-tua); font-weight: 900; font-size: 1.02rem;
  padding: 12px 18px; border-radius: 18px; box-shadow: 0 4px 0 rgba(180, 110, 50, .18); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 52px;
}
.tombol:active { transform: translateY(3px); box-shadow: none; }
.tombol:disabled { opacity: .45; transform: none; }
.tombol.utama { background: linear-gradient(135deg, #ffad6e, #ff7a38); border: 0; color: #fff; box-shadow: 0 5px 0 #c4561f; }
.tombol.hijau { background: linear-gradient(135deg, #34d6b4, #1fa183); border: 0; color: #fff; box-shadow: 0 5px 0 #157a63; }
.tombol.kuning { background: linear-gradient(135deg, #ffd34d, #ffb300); border: 0; color: #5a3a00; box-shadow: 0 5px 0 #c98a00; }
.tombol.bahaya { background: transparent; border: 2px dashed #ffc9c9; color: #c2312a; width: 100%; margin-top: 14px; box-shadow: none; font-size: .9rem; min-height: 44px; }
.tombol.bahaya-isi { background: #ff5c6c; border: 0; color: #fff; box-shadow: 0 5px 0 #c23040; }
.tombol.lebar { display: flex; width: 100%; }
.tombol.besar { font-size: 1.2rem; min-height: 62px; }
.mini { background: #fff; color: var(--oranye-tua); font-weight: 800; padding: 8px 14px; border-radius: 999px; font-size: .85rem; box-shadow: 0 2px 8px rgba(120, 80, 40, .14); }
.mini:active { transform: scale(.96); }
.baris-tombol { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.baris-tombol.tengah { justify-content: center; }

/* ---------- 3. MASKOT & HERO ---------- */
.hero { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 4px 12px; margin: 4px 0 12px; }
.maskot { width: 110px; height: 110px; cursor: pointer; grid-row: span 2; }
.maskot.kecil { width: 96px; height: 96px; margin: 0 auto; cursor: default; }
.uli { width: 100%; height: 100%; overflow: visible; }
.uli .mata { animation: kedip 4.5s infinite; transform-origin: 60px 51px; }
.uli .sayap-pena { animation: tulis 1.6s ease-in-out infinite; transform-origin: 92px 70px; }
.maskot.lompat { animation: lompat .5s ease; }
.hero-teks h1 { font-size: 2.1rem; margin: 0; line-height: 1.05; color: var(--oranye-tua); }
.hero-teks h1 span { color: var(--hijau-tua); }
.hero-teks p { margin: 4px 0 0; color: var(--teks-2); font-size: .95rem; }
.gelembung {
  position: relative; background: #fff; border-radius: 16px; padding: 10px 14px; font-size: .92rem;
  box-shadow: var(--bayang); align-self: start;
}
.gelembung::before { content: ""; position: absolute; left: -9px; top: 14px; border: 9px solid transparent; border-left: 0; border-right-color: #fff; }

.profil-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #fff;
  border-radius: var(--r); padding: 10px 14px; box-shadow: var(--bayang); margin-bottom: 14px;
}
.kotak-pesan { background: #fff; border: 3px dashed #ffd2a8; border-radius: var(--r); padding: 18px; text-align: center; }
.kotak-pesan .kecil { color: var(--teks-2); font-size: .85rem; margin: 16px 0 8px; }
.kotak-pulih { background: #fff7d6; border: 3px solid #ffe08a; border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px; }
.kotak-pulih p { margin: 0; }

/* ---------- 4. RAK ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.kotak { background: #fff; border-radius: 18px; padding: 10px 6px; text-align: center; box-shadow: var(--bayang); }
.kotak b { display: block; font-size: 1.6rem; color: var(--oranye-tua); line-height: 1.1; }
.kotak small { color: var(--teks-2); font-size: .75rem; }
.judul-bagian { font-size: 1.1rem; margin: 22px 0 10px; color: var(--teks-2); }
.kosong { color: var(--teks-2); text-align: center; padding: 14px; }

.rak {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 22px 14px;
  padding: 14px 12px 18px; border-radius: var(--r);
  background: #fbe9d4;
  box-shadow: inset 0 0 0 4px #e7c19c;
}
.rak-kosong { grid-column: 1 / -1; text-align: center; padding: 20px; }
.rak-kosong span { font-size: 3rem; }
.buku-rak { display: flex; flex-direction: column; align-items: stretch; min-width: 0; padding: 0 4px 8px; border-bottom: 12px solid #c88a5a; border-radius: 0 0 4px 4px; }
.sampul-mini {
  --w: var(--oranye);
  position: relative; height: 170px; border-radius: 6px 14px 14px 6px; overflow: hidden; text-align: left;
  background: linear-gradient(90deg, rgba(0, 0, 0, .18) 0 10px, rgba(255, 255, 255, .15) 10px 13px, transparent 13px), var(--w);
  box-shadow: 0 6px 0 rgba(0, 0, 0, .15), 0 10px 18px rgba(0, 0, 0, .12); color: #fff;
  transition: transform .15s;
}
.sampul-mini:hover { transform: translateY(-3px) rotate(-1deg); }
.sampul-mini:active { transform: scale(.97); }
.stk-wrap { position: absolute; inset: 0; pointer-events: none; }
.stk { position: absolute; transform: translate(-50%, -50%); font-size: 1.6rem; line-height: 1; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .15)); }
.stk.k1 { font-size: 1.5rem; } .stk.k2 { font-size: 2.2rem; } .stk.k3 { font-size: 3.1rem; }
.sampul-mini .stk.k1 { font-size: 1.3rem; } .sampul-mini .stk.k2 { font-size: 1.6rem; } .sampul-mini .stk.k3 { font-size: 2rem; }
.judul-mini {
  position: absolute; left: 18px; right: 8px; top: 50%; transform: translateY(-50%); font-weight: 900; font-size: .98rem; line-height: 1.2;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .2); background: rgba(255, 255, 255, .22); padding: 6px 8px; border-radius: 10px;
  word-break: break-word; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.pita-status { position: absolute; right: 0; bottom: 8px; background: #fff; color: var(--oranye-tua); font-size: .7rem; font-weight: 900; padding: 3px 8px; border-radius: 999px 0 0 999px; }
.pita-status.selesai { color: #166534; background: #dcfce7; }
.info-mini { font-size: .72rem; color: var(--teks-2); margin: 8px 0 4px; text-align: center; }
.aksi-mini { display: flex; gap: 6px; justify-content: center; }
.aksi-mini .mini { padding: 7px 9px; font-size: .78rem; white-space: nowrap; }

.lencana-wrap { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.lcn { background: #fff; border-radius: 18px; padding: 10px 8px; text-align: center; box-shadow: var(--bayang); opacity: .55; }
.lcn.dapat { opacity: 1; background: linear-gradient(160deg, #fff, #fff4d0); }
.lcn span { font-size: 1.8rem; display: block; }
.lcn b { display: block; font-size: .85rem; }
.lcn small { display: block; font-size: .7rem; color: var(--teks-2); }

/* ---------- 5. SHEET MULAI ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.sheet-latar { position: absolute; inset: 0; background: rgba(40, 20, 0, .35); opacity: 0; transition: opacity .25s; }
.sheet-isi {
  position: absolute; left: 50%; bottom: 0; width: min(100%, 640px); max-height: 92vh; overflow-y: auto;
  background: #fffaf2; border-radius: 28px 28px 0 0; padding: 8px 16px 22px;
  transform: translate(-50%, 105%); transition: transform .3s cubic-bezier(.2, .9, .3, 1.1);
}
.sheet:not(.buka) .sheet-isi { visibility: hidden; transition: transform .3s, visibility 0s .3s; }
.sheet.buka { pointer-events: auto; }
.sheet.buka .sheet-latar { opacity: 1; }
.sheet.buka .sheet-isi { transform: translate(-50%, 0); }
.sheet-pegangan { width: 54px; height: 6px; border-radius: 3px; background: #e7cdb3; margin: 4px auto 10px; }
.sheet h2 { margin: 0 0 10px; text-align: center; font-size: 1.3rem; }
.sub-sheet { margin: 18px 0 8px; font-size: 1rem; color: var(--teks-2); }
.sheet.demo .sub-sheet, .sheet.demo .pilih-target, .sheet.demo .tab[data-tab="pembuka"], .sheet.demo .tab[data-tab="bebas"] { display: none; }
.tab-mulai { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: #f6e6d4; padding: 5px; border-radius: 18px; margin-bottom: 14px; }
.sheet.demo .tab-mulai { grid-template-columns: 1fr; }
.tab { padding: 10px 4px; border-radius: 14px; font-weight: 900; font-size: .88rem; color: var(--teks-2); min-height: 46px; }
.tab.aktif { background: #fff; color: var(--oranye-tua); box-shadow: 0 3px 0 rgba(0, 0, 0, .08); }
.panel-tab { display: none; }
.panel-tab.aktif { display: block; animation: masuk .2s ease; }

.mesin { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; background: linear-gradient(180deg, #a066ff, #7b45d9); padding: 12px 10px; border-radius: 22px; box-shadow: 0 6px 0 #5a2fb0; }
.gulung { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #fff; }
.gulung small { font-weight: 900; font-size: .8rem; letter-spacing: .03em; }
.jendela { width: 100%; height: 104px; background: #fff; border-radius: 14px; overflow: hidden; display: grid; place-items: center; box-shadow: inset 0 4px 8px rgba(0, 0, 0, .18); color: var(--teks); }
.pita { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 4px; }
.g-emoji { font-size: 2.6rem; line-height: 1.1; }
.g-teks { font-size: .78rem; font-weight: 900; line-height: 1.15; }
.gulung.berputar .pita { animation: goyang .1s linear infinite; filter: blur(.6px); }
.gulung.berhenti .jendela { animation: mantul .35s ease; }
.gulung.terkunci .jendela { box-shadow: inset 0 0 0 4px var(--kuning); }
.kunci { background: rgba(255, 255, 255, .22); border-radius: 999px; padding: 4px 14px; font-size: 1.05rem; min-height: 36px; }
.hasil-ide { background: #fff; border-radius: 18px; padding: 12px 14px; margin-top: 12px; border: 3px dashed #d9c2ff; }
.ide-kalimat { margin: 0; font-size: 1rem; line-height: 1.5; font-style: italic; }

.kartu-pembuka { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.pembuka { text-align: left; background: #fff; border: 3px solid #ffe0c4; border-radius: 16px; padding: 10px 12px; font-weight: 800; display: flex; gap: 10px; align-items: center; min-height: 54px; }
.pembuka span { font-size: 1.5rem; }
.pembuka.aktif { border-color: var(--oranye); background: #fff1e4; }
.info-bebas { text-align: center; padding: 24px 10px; background: #fff; border-radius: 18px; border: 3px dashed #cfe7dc; margin: 0; }

.pilih-target { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.chip-target { background: #fff; border: 3px solid #e8f0ea; border-radius: 16px; padding: 8px 2px; display: flex; flex-direction: column; align-items: center; }
.chip-target span { font-size: 1.4rem; }
.chip-target b { font-size: 1.15rem; }
.chip-target small { font-size: .72rem; color: var(--teks-2); }
.chip-target.aktif { border-color: var(--hijau); background: #e7faf4; }

/* ---------- 6. EDITOR ---------- */
.status-simpan { font-size: .78rem; font-weight: 900; padding: 6px 10px; border-radius: 999px; background: #fff; color: var(--teks-2); white-space: nowrap; min-width: 48px; text-align: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.status-simpan[data-s="tersimpan"] { color: #166534; background: #dcfce7; }
.status-simpan[data-s="menyimpan"] { color: #7a5600; background: #fff3c4; }
.status-simpan[data-s="menulis"] { color: var(--oranye-tua); }
.status-simpan[data-s="offline"] { color: #9b1c1c; background: #ffe4e4; }

.target-bar { background: #fff; border-radius: 18px; padding: 10px 14px; box-shadow: var(--bayang); margin-bottom: 12px; cursor: pointer; }
.target-jalur { position: relative; height: 16px; background: #f0e6dc; border-radius: 999px; margin: 10px 26px 8px 4px; }
.target-isi { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px; background: linear-gradient(90deg, #ffd34d, #34d6b4); transition: width .4s ease; }
.target-uli { position: absolute; top: 50%; left: 0; transform: translateY(-58%); font-size: 1.6rem; transition: left .4s ease; }
.target-bendera { position: absolute; right: -26px; top: 50%; transform: translateY(-60%); font-size: 1.3rem; }
.target-teks { font-size: .9rem; color: var(--teks-2); display: flex; gap: 4px; flex-wrap: wrap; align-items: baseline; }
.target-teks b { color: var(--teks); font-size: 1.1rem; }
.target-pesan { margin-left: auto; font-weight: 900; color: var(--hijau-tua); }
.target-bar.capai { background: linear-gradient(90deg, #fff, #e7faf4); }
.target-bar.capai .target-uli { animation: lompat .8s ease infinite; }

.kertas {
  position: relative; background: var(--kertas); border-radius: 8px 22px 22px 8px; padding: 16px 16px 18px 30px;
  box-shadow: var(--bayang); border-left: 6px solid #ffb4b4;
}
.kertas::before { content: ""; position: absolute; left: 14px; top: 10px; bottom: 10px; width: 2px; background: #ffc7c7; }
.kertas .lencana { position: absolute; right: 12px; top: -12px; }
.lbl { display: block; font-size: .78rem; font-weight: 900; color: var(--teks-2); margin: 6px 0 4px; text-transform: uppercase; letter-spacing: .05em; }
#in-judul {
  width: 100%; font-family: inherit; font-size: 1.4rem; font-weight: 900; color: var(--oranye-tua); padding: 6px 2px;
  border: 0; border-bottom: 3px dashed #ffd2a8; background: transparent; outline: none;
}
#in-judul:focus { border-bottom-color: var(--oranye); }
#in-isi {
  width: 100%; font-family: inherit; font-size: 1.15rem; font-weight: 600; color: var(--teks); line-height: 36px;
  min-height: 324px; padding: 0 4px; border: 0; outline: none; resize: none; overflow: hidden; background-color: transparent;
  background-image: repeating-linear-gradient(180deg, transparent 0 35px, var(--garis) 35px 36px);
  background-attachment: local;
}
#in-isi::placeholder, #in-judul::placeholder { color: #c7b39f; }
.ide-tempel { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px; }
.ide-tempel span { background: #f3ebff; color: #5a2fb0; border-radius: 999px; padding: 4px 10px; font-size: .8rem; font-weight: 900; }
.lencana { display: inline-block; font-size: .75rem; font-weight: 900; padding: 4px 10px; border-radius: 999px; background: #fff0dc; color: var(--oranye-tua); box-shadow: 0 2px 6px rgba(0, 0, 0, .08); }
.lencana.selesai { background: #dcfce7; color: #166534; }

/* ---------- 7. ALAT & LACI ---------- */
.alat { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 12px 0 0; position: sticky; bottom: 8px; z-index: 5; background: rgba(255, 250, 242, .92); padding: 6px; border-radius: 20px; box-shadow: 0 4px 16px rgba(90, 55, 25, .15); backdrop-filter: blur(4px); }
.alat-btn { background: #fff; border-radius: 14px; padding: 6px 2px; font-size: .72rem; font-weight: 900; color: var(--teks-2); display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 58px; box-shadow: 0 3px 0 rgba(0, 0, 0, .08); }
.alat-btn span { font-size: 1.45rem; line-height: 1; font-weight: 900; color: var(--oranye-tua); }
.alat-btn.aktif { background: #fff1e4; box-shadow: inset 0 0 0 3px var(--oranye); }
.alat-btn.mati { opacity: .45; }
.alat-btn:active { transform: translateY(2px); }
.laci { background: #fff; border-radius: 20px; padding: 10px; margin-top: 10px; box-shadow: var(--bayang); animation: masuk .2s ease; }
.laci-tab { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.tab-stk { white-space: nowrap; padding: 7px 12px; border-radius: 999px; background: #f6efe6; font-weight: 900; font-size: .82rem; }
.tab-stk.aktif { background: var(--oranye); color: #fff; }
.laci-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 6px; }
.stk-btn { font-size: 1.85rem; height: 54px; border-radius: 14px; background: #fffaf2; }
.stk-btn:active { transform: scale(1.25); }
.stk-terbang { position: fixed; z-index: 80; font-size: 2rem; pointer-events: none; transition: transform .5s cubic-bezier(.3, .7, .4, 1), opacity .5s; }
.gunung { display: flex; align-items: center; justify-content: center; gap: 4px; margin-bottom: 8px; }
.tahap { display: flex; flex-direction: column; align-items: center; padding: 6px 12px; border-radius: 14px; background: #f6efe6; font-size: .8rem; font-weight: 900; min-width: 76px; }
.tahap span { font-size: 1.5rem; }
.tahap.aktif { background: #e7faf4; box-shadow: inset 0 0 0 3px var(--hijau); color: var(--hijau-tua); }
.panah { color: #c9b29b; font-size: 1.4rem; font-weight: 900; }
.laci-judul { margin: 6px 0 8px; text-align: center; font-size: .95rem; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chip { background: #fff7d6; border: 2px solid #ffe08a; border-radius: 999px; padding: 8px 12px; font-weight: 800; font-size: .9rem; min-height: 42px; }
.chip.rasa { background: #ffeef3; border-color: #ffc4d4; }
.chip:active { transform: scale(.95); }
.rasa-judul { width: 100%; text-align: center; font-size: .78rem; font-weight: 900; color: var(--teks-2); margin-top: 6px; }
.ingat { font-size: .9rem; font-weight: 800; color: #5a2fb0; }
.aksi-tulis { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 14px; }

/* ---------- 8. BUKU ---------- */
.panggung { display: grid; place-items: center; perspective: 1600px; padding: 6px 0 4px; }
.buku {
  --lebar: min(92vw, 440px, calc((100vh - 250px) * .75));
  position: relative; width: max(240px, var(--lebar)); height: calc(max(240px, var(--lebar)) * 4 / 3);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.halaman {
  position: absolute; inset: 0; border-radius: 6px 18px 18px 6px; overflow: hidden; background: var(--kertas);
  box-shadow: -6px 0 0 #e9d8c4 inset, 0 8px 0 rgba(90, 55, 25, .15), 0 14px 28px rgba(90, 55, 25, .18);
  display: flex; flex-direction: column;
}
.halaman.ukur { visibility: hidden; pointer-events: none; z-index: -1; }
.halaman.isi { padding: 7% 8% 4% 10%; background-image: repeating-linear-gradient(180deg, transparent 0 calc(1.15rem * 1.7 - 1px), var(--garis) calc(1.15rem * 1.7 - 1px) calc(1.15rem * 1.7)); background-position: 0 calc(7% + 2px); }
.teks-hal { flex: 1; overflow: hidden; font-size: 1.15rem; line-height: 1.7; }
.teks-hal p { margin: 0; text-indent: 1.4em; word-break: break-word; }
.teks-hal p.lanjut { text-indent: 0; }
.halaman.kosong .teks-hal { color: var(--teks-2); font-style: italic; text-align: center; display: grid; place-items: center; }
.kaki-hal { text-align: center; font-size: .8rem; color: var(--teks-2); padding-top: 4px; }
.halaman.dibaca { box-shadow: 0 0 0 5px var(--kuning), 0 8px 0 rgba(90, 55, 25, .15), 0 14px 28px rgba(90, 55, 25, .18); }
.halaman.sampul {
  --w: var(--oranye);
  background: linear-gradient(90deg, rgba(0, 0, 0, .2) 0 14px, rgba(255, 255, 255, .18) 14px 18px, transparent 18px),
    radial-gradient(circle at 70% 20%, rgba(255, 255, 255, .25), transparent 50%), var(--w);
  color: #fff;
}
.sampul-isi { position: relative; flex: 1; display: grid; place-items: center; padding: 10%; }
.lapis-stk { position: absolute; inset: 0; }
.halaman.sampul .stk.k1 { font-size: 2rem; } .halaman.sampul .stk.k2 { font-size: 3rem; } .halaman.sampul .stk.k3 { font-size: 4.4rem; }
.sampul-teks { position: relative; text-align: center; background: rgba(255, 255, 255, .9); color: var(--teks); border-radius: 18px; padding: 16px 14px; box-shadow: 0 6px 0 rgba(0, 0, 0, .12); max-width: 88%; pointer-events: none; }
.sampul-teks h2 { margin: 0 0 6px; font-size: 1.55rem; line-height: 1.15; color: var(--oranye-tua); word-break: break-word; }
.sampul-teks p { margin: 0; color: var(--teks-2); }
.sampul-tanda { position: absolute; bottom: 4%; left: 50%; transform: translateX(-50%); font-size: .8rem; background: rgba(0, 0, 0, .2); padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.halaman.akhir { display: grid; place-items: center; text-align: center; background: radial-gradient(circle at 50% 40%, #fff6dc, var(--kertas) 70%); }
.akhir-isi { padding: 10%; }
.tamat { font-size: 2rem; font-weight: 900; color: var(--oranye-tua); }
.akhir-stk { font-size: 2.4rem; margin: 10px 0; }
.halaman.balik { z-index: 3; transform-origin: left center; backface-visibility: hidden; }
.halaman.balik.maju { animation: balikMaju .6s ease-in forwards; }
.halaman.balik.mundur { animation: balikMundur .6s ease-out forwards; }
.navi-buku { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 16px 0 6px; }
.no-hal { font-weight: 900; color: var(--teks-2); min-width: 64px; text-align: center; }

/* ---------- 9. HIAS ---------- */
.petunjuk { text-align: center; color: var(--teks-2); font-size: .88rem; margin: 0 0 8px; }
#layar-hias .buku { --lebar: min(80vw, 360px, calc((100vh - 400px) * .75)); }
.bisa-seret { cursor: grab; touch-action: none; user-select: none; z-index: 2; transition: font-size .15s; }
.bisa-seret.diseret { cursor: grabbing; filter: drop-shadow(0 6px 4px rgba(0, 0, 0, .3)); z-index: 4; }
.bisa-seret.akan-buang { opacity: .4; }
.laci.terbuka { margin-top: 14px; }
.warna-label { font-size: .85rem; color: var(--teks-2); align-self: center; }
.pilih-warna { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.warna { width: 38px; height: 38px; border-radius: 50%; box-shadow: 0 3px 0 rgba(0, 0, 0, .15); }
.warna.aktif { outline: 4px solid #fff; box-shadow: 0 0 0 7px var(--teks); }

/* ---------- 10. DIALOG, TOAST, KONFETI ---------- */
.dialog { position: fixed; inset: 0; z-index: 90; background: rgba(40, 20, 0, .4); display: grid; place-items: center; padding: 16px; animation: masuk .2s ease; }
.dialog-isi { background: #fffaf2; border-radius: 26px; padding: 20px; text-align: center; width: min(100%, 400px); box-shadow: var(--bayang); }
.dialog-ikon { font-size: 3rem; }
.dialog-isi p { font-size: 1.05rem; }
.rayakan-isi h2 { margin: 6px 0; color: var(--hijau-tua); }
.toast { position: fixed; left: 50%; top: 14px; transform: translate(-50%, -150%); z-index: 95; background: #3b2a1c; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: .9rem; max-width: 92vw; text-align: center; transition: transform .25s; pointer-events: none; }
.toast.tampil { transform: translate(-50%, 0); }
#konfeti { position: fixed; inset: 0; pointer-events: none; z-index: 99; display: none; }
#konfeti.tampil { display: block; }

/* ---------- 11. ANIMASI ---------- */
@keyframes masuk { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes kedip { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes tulis { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-12deg); } }
@keyframes lompat { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } }
@keyframes goyang { 0% { transform: translateY(-6px); } 50% { transform: translateY(6px); } 100% { transform: translateY(-6px); } }
@keyframes mantul { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes balikMaju { from { transform: rotateY(0); } to { transform: rotateY(-180deg); } }
@keyframes balikMundur { from { transform: rotateY(-180deg); } to { transform: rotateY(0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- 12. RESPONSIF ---------- */
@media (max-width: 420px) {
  .hero { grid-template-columns: 88px 1fr; }
  .maskot { width: 88px; height: 88px; }
  .hero-teks h1 { font-size: 1.75rem; }
  .rak { grid-template-columns: repeat(2, 1fr); }
  .alat-btn { font-size: .66rem; }
  .tab { font-size: .78rem; }
  .g-emoji { font-size: 2.2rem; }
  .aksi-tulis { grid-template-columns: 1fr; }
}
@media (min-width: 900px) {
  .layar { padding-top: 18px; }
  .hero { grid-template-columns: 140px 1fr; }
  .maskot { width: 140px; height: 140px; }
}
