:root {
  --merah: #e2231a;
  --merah-tua: #b3150e;
  --biru: #12358f;
  --kuning: #ffc928;
  --krem-kertas: #fffdf6;
  --latar: #fff4f1;
  --teks: #2a2330;
  --teks-lembut: #6b6272;
  --garis: #f1cfc9;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Fredoka", system-ui, sans-serif;
  background: var(--latar);
  color: var(--teks);
  line-height: 1.6;
  font-size: 17px;
}

h1, h2 { line-height: 1.15; }

/* ===== Hero ===== */
.hero {
  background: var(--merah);
  color: #fff;
  text-align: center;
  padding: 3.5rem 1.25rem 4.5rem;
  position: relative;
}
.stripe {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 14px;
  background: linear-gradient(90deg, var(--biru) 0 33.3%, var(--kuning) 33.3% 66.6%, var(--biru) 66.6% 100%);
}
.hero-small { font-size: 1.05rem; font-weight: 500; opacity: .95; margin-bottom: .75rem; }
.hero h1 {
  font-size: clamp(2.2rem, 8vw, 3.6rem);
  font-weight: 700;
  max-width: 14ch;
  margin: 0 auto 1rem;
  animation: masuk .9s cubic-bezier(.2,.9,.3,1.2) both;
}
.hero-sub { max-width: 34ch; margin: 0 auto; font-size: 1.1rem; }

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

/* ===== Layout ===== */
main {
  max-width: 620px;
  margin: 0 auto;
  padding: 2rem 1.1rem 1rem;
  display: grid;
  gap: 2.2rem;
}
h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: .4rem; }

.card {
  background: #fff;
  border: 2px solid var(--garis);
  border-radius: 22px;
  padding: 1.5rem 1.25rem;
}
.hint { color: var(--teks-lembut); margin-bottom: 1.1rem; }

/* ===== Progress ===== */
.progress {
  height: 16px;
  background: #ffe6e2;
  border-radius: 99px;
  overflow: hidden;
}
.bar {
  height: 100%;
  width: 0;
  background: var(--merah);
  border-radius: 99px;
  transition: width .5s ease;
}
.progress-text { margin: .45rem 0 1.1rem; font-weight: 500; font-size: .95rem; }

/* ===== Checklist ===== */
.checklist { list-style: none; display: grid; gap: .6rem; }
.checklist label {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .8rem 1rem;
  border-radius: 14px;
  border: 2px solid var(--garis);
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.checklist label:hover { border-color: var(--merah); }
.checklist input {
  appearance: none;
  -webkit-appearance: none;
  width: 26px; height: 26px;
  border: 2.5px solid var(--merah);
  border-radius: 8px;
  flex: none;
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.checklist input::after {
  content: "";
  width: 7px; height: 13px;
  border: solid #fff;
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .2s;
  margin-top: -2px;
}
.checklist input:checked { background: var(--merah); transform: scale(1.08); }
.checklist input:checked::after { transform: rotate(45deg) scale(1); }
.checklist input:focus-visible { outline: 3px solid var(--biru); outline-offset: 3px; }
.checklist li.done label { background: #fff8dc; border-color: var(--kuning); }
.checklist li.done .nama { text-decoration: line-through; color: var(--teks-lembut); }

.bubble {
  margin-top: 1.2rem;
  background: var(--biru);
  color: #fff;
  padding: .9rem 1.1rem;
  border-radius: 16px 16px 16px 4px;
  font-weight: 500;
}

/* ===== Struk ===== */
.receipt-wrap { text-align: center; }
.receipt {
  font-family: "Courier Prime", "Courier New", monospace;
  background: var(--krem-kertas);
  max-width: 340px;
  margin: 1rem auto 1.3rem;
  padding: 1.4rem 1.2rem 1.8rem;
  text-align: left;
  font-size: .95rem;
  box-shadow: 0 10px 0 -6px #f1cfc9, 0 14px 22px rgba(90, 30, 20, .12);
  transform: rotate(-1.2deg);
  /* tepi bergerigi di bawah */
  --z: 10px;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--z) 100%;
          mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / var(--z) 100%;
}
.receipt hr { border: 0; border-top: 2px dashed #cbbfae; margin: .8rem 0; }
.r-head { font-weight: 700; text-align: center; font-size: 1.05rem; }
.r-center { text-align: center; }
.r-foot { margin-top: 1rem; }
.r-lines { list-style: none; min-height: 3.2rem; }
.r-lines li { display: flex; justify-content: space-between; gap: .75rem; animation: cetak .35s ease both; }
.r-lines li span:first-child { flex: 1; }
.r-lines .kosong { color: #9b9082; display: block; }
.r-total { display: flex; justify-content: space-between; font-weight: 700; }

@keyframes cetak {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 1.1rem;
  background: var(--kuning);
  color: var(--teks);
  border: 0;
  border-radius: 99px;
  padding: .85rem 1.8rem;
  cursor: pointer;
  box-shadow: 0 5px 0 #d9a508;
  transition: transform .1s, box-shadow .1s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #d9a508; }
.btn:focus-visible { outline: 3px solid var(--biru); outline-offset: 4px; }

/* ===== Pesan ===== */
.letter { font-size: 1.08rem; }

footer { text-align: center; padding: 2rem 1rem 3rem; color: var(--teks-lembut); }

/* ===== Hujan emoji ===== */
.pop-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
.pop {
  position: absolute;
  top: -40px;
  font-size: 1.7rem;
  animation: jatuh linear forwards;
}
@keyframes jatuh {
  to { transform: translateY(110vh) rotate(360deg); opacity: .9; }
}

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

/* ===================== FITUR BARU ===================== */

/* Layar pembuka */
.intro {
  position: fixed; inset: 0; z-index: 100;
  background: var(--merah);
  display: grid; place-items: center;
  padding: 1.5rem; text-align: center; color: #fff;
  transition: opacity .6s, visibility .6s;
}
.intro.hilang { opacity: 0; visibility: hidden; }
.intro-box { max-width: 360px; }
.intro-emoji { font-size: 4rem; animation: goyang 1.4s ease-in-out infinite; }
.intro h1 { font-size: 2rem; margin: .5rem 0 .75rem; }
.intro p { margin-bottom: 1.4rem; }
@keyframes goyang {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}

/* Tombol musik */
.musik {
  position: fixed; right: 14px; bottom: 14px; z-index: 60;
  width: 52px; height: 52px; border-radius: 50%;
  border: 3px solid #fff; background: var(--biru); color: #fff;
  font-size: 1.4rem; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.musik:focus-visible { outline: 3px solid var(--kuning); outline-offset: 3px; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap;
  padding: .7rem .8rem;
  background: rgba(255, 244, 241, .94);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--garis);
}
.nav a {
  color: var(--merah-tua); text-decoration: none; font-weight: 600; font-size: .95rem;
  padding: .3rem .85rem; border-radius: 99px; border: 2px solid var(--garis); background: #fff;
}
.nav a:hover { border-color: var(--merah); }
.nav a:focus-visible { outline: 3px solid var(--biru); outline-offset: 2px; }
section[id] { scroll-margin-top: 70px; }

/* Kata semangat */
.quote-card { text-align: center; }
.quote {
  font-size: 1.3rem; font-weight: 500; min-height: 5.5em;
  display: grid; place-items: center; margin: 1rem 0 1.2rem; padding: 0 .4rem;
}
.quote.ganti { animation: masuk .5s ease both; }
.semua { margin-top: 1.4rem; text-align: left; }
.semua summary { cursor: pointer; font-weight: 600; color: var(--biru); }
.semua ol { margin: .8rem 0 0 1.3rem; display: grid; gap: .5rem; }

/* Game */
.game-bar { display: flex; justify-content: space-between; font-weight: 500; margin-bottom: .6rem; }
#gameCanvas {
  display: block; width: 100%; max-width: 360px; height: auto;
  margin: 0 auto; border-radius: 16px; border: 3px solid var(--merah);
  cursor: ew-resize;
}
#gInfo { margin: 1rem 0; }
#btnGame:disabled { opacity: .5; cursor: not-allowed; }

/* Kuis */
.q-meta { color: var(--teks-lembut); font-size: .95rem; margin-bottom: .4rem; }
.q-text { font-size: 1.2rem; font-weight: 600; margin-bottom: 1rem; }
.opsi { display: grid; gap: .6rem; margin-bottom: 1rem; }
.opsi-btn {
  font: inherit; text-align: left; background: #fff; color: var(--teks);
  border: 2px solid var(--garis); border-radius: 14px; padding: .8rem 1rem; cursor: pointer;
}
.opsi-btn:hover:not(:disabled) { border-color: var(--merah); }
.opsi-btn:focus-visible { outline: 3px solid var(--biru); outline-offset: 2px; }
.opsi-btn:disabled { cursor: default; }
.opsi-btn.benar { background: #e3f6e5; border-color: #2e9d3f; }
.opsi-btn.salah { background: #ffe3e0; border-color: var(--merah); }
.q-fb { margin-bottom: 1rem; }

/* Peta */
.map-wrap { border-radius: 16px; overflow: hidden; border: 3px solid var(--biru); margin-bottom: 1rem; }
.map-wrap iframe { display: block; width: 100%; height: 320px; border: 0; }
.btn-link { display: inline-block; text-decoration: none; }
