:root {
  --krem: #FCF8F0;
  --teal: #244E45;
  --emas: #C08A3E;
  --sage: #4F8577;
  --teks: #333533;
  --kartu: #FFFFFF;
  --garis: #E6DFD0;
  --merah: #A8442F;
  --sage-muda: #E4EFEA;
  --emas-muda: #F6E9D2;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--krem);
  color: var(--teks);
  font-family: Lora, Georgia, serif;
  font-size: 17px;
  line-height: 1.55;
}
h1, h2, h3, .judul, .label, button, select, input { font-family: Montserrat, system-ui, sans-serif; }
h1 { font-size: 1.5rem; margin: .2rem 0 .6rem; color: var(--teal); }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; color: var(--teal); }
p { margin: .4rem 0; }
[hidden] { display: none !important; }

#aplikasi { max-width: 520px; margin: 0 auto; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.atas {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--teal); color: #fff;
}
.atas .judul { font-weight: 700; font-size: 1rem; letter-spacing: .2px; }
.atas .kecil { color: #E4EFEA; }
main { padding: 14px 16px; }
.kecil { font-size: .82rem; color: #6a6e6a; }
.kecil a { color: var(--teal); }
.label { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--emas); font-weight: 600; }
.galat { color: var(--merah); min-height: 1.2em; }

.kartu {
  background: var(--kartu); border: 1px solid var(--garis); border-radius: 14px;
  padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(36,78,69,.05);
}
.kartu.emas { background: var(--emas-muda); border-color: #E8D3AB; }
.kartu.sage { background: var(--sage-muda); border-color: #C6DDD3; }

button { font-size: 1rem; cursor: pointer; }
.tombol {
  min-height: 48px; padding: 10px 16px; border-radius: 12px; border: 1.5px solid var(--teal);
  background: #fff; color: var(--teal); font-weight: 600;
}
.tombol.utama { background: var(--teal); color: #fff; }
.tombol.emas { background: var(--emas); border-color: var(--emas); color: #fff; }
.tombol.merah { background: var(--merah); border-color: var(--merah); color: #fff; }
.tombol.kecil-t { min-height: 40px; padding: 6px 12px; font-size: .88rem; }
.tombol:disabled { opacity: .5; cursor: default; }
.baris { display: flex; gap: 10px; flex-wrap: wrap; }
.baris > .tombol { flex: 1 1 140px; }

select, input[type=text] {
  width: 100%; min-height: 48px; padding: 8px 12px; border-radius: 12px;
  border: 1.5px solid var(--garis); background: #fff; color: var(--teks); font-size: 1rem;
}
.kolom { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kolom .penuh { grid-column: 1 / -1; }
.field > span { display: block; font-size: .78rem; color: #6a6e6a; margin-bottom: 3px; font-family: Montserrat, sans-serif; }
.cek { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.cek input { width: 22px; height: 22px; accent-color: var(--teal); }

/* gerbang */
.gerbang { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.gerbang-isi { width: 100%; max-width: 420px; text-align: center; }
.gerbang-isi input { text-align: center; text-transform: uppercase; letter-spacing: 2px; margin: 8px 0; }

/* timer & tracker */
.timer { font-family: Montserrat, sans-serif; font-size: 3rem; font-weight: 700; color: var(--teal); text-align: center; font-variant-numeric: tabular-nums; }
.grid40 { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin: 10px 0; }
.grid40 div {
  aspect-ratio: 1; border-radius: 8px; border: 1.5px solid var(--garis); background: #fff;
  display: flex; align-items: center; justify-content: center; font-size: .72rem; font-family: Montserrat, sans-serif; color: #888;
}
.grid40 div.ok { background: var(--sage); border-color: var(--sage); color: #fff; font-weight: 700; }
.grid40 div.hariini { border-color: var(--emas); border-width: 2.5px; color: var(--emas); font-weight: 700; }
.grid40 div.ok.hariini { color: #fff; }
.statistik { display: flex; gap: 10px; }
.statistik > div { flex: 1; text-align: center; background: var(--sage-muda); border-radius: 12px; padding: 10px 4px; }
.statistik b { display: block; font-family: Montserrat, sans-serif; font-size: 1.6rem; color: var(--teal); }

/* daftar ulang */
.ulang { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--garis); }
.ulang:last-child { border-bottom: 0; }
.ulang b { font-family: Montserrat, sans-serif; font-size: .95rem; }

/* ayat */
.arab {
  font-family: 'Amiri Quran', 'Scheherazade New', 'Traditional Arabic', serif;
  direction: rtl; text-align: right; line-height: 2.1; color: #1f2a26;
}
.ayat { position: relative; transition: background .2s, border-color .2s; }
.ayat.aktif { background: var(--emas-muda); border-color: var(--emas); }
.ayat .no {
  display: inline-block; min-width: 34px; padding: 2px 8px; border-radius: 99px;
  background: var(--teal); color: #fff; font-family: Montserrat, sans-serif; font-size: .78rem; text-align: center;
}
.ayat .tag { margin-left: 8px; font-size: .78rem; color: var(--sage); font-family: Montserrat, sans-serif; font-weight: 600; }
.ayat .alat { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.tertutup {
  text-align: center; padding: 28px 12px; border-radius: 12px; border: 2px dashed var(--garis);
  background: repeating-linear-gradient(45deg, #faf5ea, #faf5ea 10px, #f5eedd 10px, #f5eedd 20px);
}
.petunjuk { text-align: center; color: var(--emas); font-size: 1.5rem; }

/* tab bawah */
.bawah {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 1px solid var(--garis); padding-bottom: env(safe-area-inset-bottom);
}
.bawah button {
  border: 0; background: none; padding: 8px 2px 8px; min-height: 64px; color: #6a6e6a;
  font-size: .72rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.bawah button svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ikon-besar { display: block; margin: 0 auto 6px; width: 54px; height: 54px; fill: none; stroke: var(--emas); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.sub { font-size: .8rem; font-weight: 500; opacity: .92; display: block; margin-top: 2px; font-family: Lora, serif; }
.status { display: grid; gap: 10px; margin: 8px 0; }
.status button { text-align: left; min-height: 64px; padding: 10px 16px; border-radius: 12px; border: 0; color: #fff; font-weight: 700; font-size: 1.02rem; }
.status .hijau { background: var(--sage); }
.status .kuning { background: var(--emas); }
.status .merah { background: var(--merah); }
.lencana { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: .72rem; font-weight: 700; color: #fff; font-family: Montserrat, sans-serif; vertical-align: middle; }
.lencana.merah { background: var(--merah); }
.lencana.h { background: var(--teal); }
.arti { font-size: .95rem; color: #4a4d4a; margin: 4px 0 6px; line-height: 1.5; }
.mini { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tabel-sesi { width: 100%; }
.catatan { border-left: 4px solid var(--emas); background: var(--emas-muda); padding: 10px 12px; border-radius: 0 10px 10px 0; font-size: .85rem; }
.bawah button { font-size: .7rem; }
.bawah button.aktif { color: var(--teal); box-shadow: inset 0 3px 0 var(--emas); }

.pilih { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 10px; }
.pilih button { text-align: left; min-height: 60px; padding: 8px 10px; border-radius: 12px; border: 1.5px solid var(--garis); background: #fff; color: var(--teks); font-weight: 600; font-size: .92rem; }
.pilih button span { display: block; font-weight: 500; font-size: .74rem; color: #6a6e6a; font-family: Lora, serif; }
.pilih button.aktif { border-color: var(--teal); background: var(--sage-muda); }
.lencana.k { background: var(--emas); }
.lencana.lulus { background: var(--sage); }
.catat-kecil { width: 100%; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--garis); background: #fff; font-size: 1rem; font-family: Lora, serif; }
.riwayat { opacity: .85; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom));
  background: var(--teal); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 20;
  max-width: 88vw; text-align: center; font-size: .92rem; box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.rekam-aktif { animation: denyut 1s infinite; }
@keyframes denyut { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .rekam-aktif { animation: none; } }
