/* Kisah Nabi Anak, prototipe arahan dongeng-ceria. Token merek di :root. */
:root {
  --primary: oklch(0.6 0.19 38);
  --primary-foreground: oklch(0.99 0.012 75);
  --ring: oklch(0.6 0.19 38);
  --background: oklch(0.965 0.022 82);
  --surface: oklch(0.995 0.008 85);
  --foreground: oklch(0.27 0.035 55);
  --muted: oklch(0.925 0.028 78);
  --border: oklch(0.865 0.035 72);
  --radius: 1.25rem;
  --font-sans: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-heading: "Baloo 2", "Nunito", ui-rounded, system-ui, sans-serif;
  --teal: oklch(0.6 0.11 185);
  --teal-deep: oklch(0.45 0.09 185);
  --sun: oklch(0.84 0.14 88);
  --night: oklch(0.32 0.05 260);
  --good: oklch(0.62 0.14 150);
  --bad: oklch(0.55 0.2 25);
  --shadow-soft: 0 2px 0 oklch(0.8 0.04 70), 0 12px 24px -16px oklch(0.5 0.06 60);
  --shadow-press: 0 1px 0 oklch(0.8 0.04 70);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}
h1, h2, h3, .display {
  font-family: var(--font-heading);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}
h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); font-weight: 700; }
h2 { font-size: clamp(1.3rem, 3vw, 1.7rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 0.75rem; max-width: 65ch; }
a { color: var(--teal-deep); }
img, svg { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 8px; }

/* Latar langit pagi: satu lengkung matahari, bukan dekorasi ramai. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 88% -40px, oklch(0.9 0.1 85 / 0.55) 0 130px, transparent 131px),
    radial-gradient(circle at 6% 108%, oklch(0.88 0.06 170 / 0.35) 0 190px, transparent 191px);
}
.app { position: relative; z-index: 1; }

/* Kepala situs */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: oklch(0.985 0.012 82 / 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.6rem 1rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--foreground); }
.brand-name { font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; line-height: 1.1; }
.brand-sub { display: block; font-family: var(--font-sans); font-weight: 700; font-size: 0.72rem; color: var(--teal-deep); letter-spacing: 0.04em; }
.role-switch {
  margin-left: auto;
  display: flex;
  background: var(--muted);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.role-switch button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--foreground);
  min-height: 44px;
}
.role-switch button[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-press); }

/* Kerangka: rel kiri di desktop, tab bawah di HP */
.shell { display: block; max-width: 1120px; margin: 0 auto; padding: 0 1rem 7rem; }
.rail { display: none; }
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  background: var(--surface);
  border-top: 2px solid var(--border);
  padding: 0.35rem 0.4rem calc(0.4rem + env(safe-area-inset-bottom));
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none;
  color: var(--foreground);
  font-weight: 800; font-size: 0.72rem;
  padding: 0.5rem 0.2rem;
  border-radius: var(--radius);
  min-height: 56px; justify-content: center;
}
.bottom-nav a svg { width: 24px; height: 24px; }
.bottom-nav a[aria-current="page"] { background: var(--muted); color: var(--primary); }
.bottom-nav a.parent-only { display: none; }
body[data-role="orangtua"] .bottom-nav a.parent-only { display: flex; }
body[data-role="orangtua"] .bottom-nav a.kid-only { display: none; }

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: 230px 1fr; gap: 1.5rem; align-items: start; padding-bottom: 3rem; }
  .rail {
    display: block;
    position: sticky; top: 76px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 0.9rem;
  }
  .rail a {
    display: flex; align-items: center; gap: 0.7rem;
    text-decoration: none; color: var(--foreground);
    font-weight: 800; font-size: 0.95rem;
    padding: 0.7rem 0.8rem; border-radius: calc(var(--radius) * 0.7);
  }
  .rail a svg { width: 22px; height: 22px; flex: none; }
  .rail a:hover { background: var(--muted); }
  .rail a[aria-current="page"] { background: var(--primary); color: var(--primary-foreground); }
  .rail a.parent-only { display: none; }
  body[data-role="orangtua"] .rail a.parent-only { display: flex; }
  body[data-role="orangtua"] .rail a.kid-only { display: none; }
  .rail .rail-note { font-size: 0.8rem; color: var(--teal-deep); font-weight: 700; padding: 0.5rem 0.8rem 0; }
  .bottom-nav { display: none; }
}

/* Tombol */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border-radius: 999px;
  border: 2px solid transparent;
  font-weight: 800; font-size: 1rem;
  padding: 0.8rem 1.6rem;
  min-height: 52px;
  text-decoration: none;
  transition: transform 180ms ease-out, box-shadow 180ms ease-out, background 180ms ease-out;
}
.btn:active { transform: translateY(2px); }
.btn-primary { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-soft); }
.btn-primary:active { box-shadow: var(--shadow-press); }
.btn-soft { background: var(--muted); color: var(--foreground); border-color: var(--border); }
.btn-ghost { background: transparent; color: var(--teal-deep); border-color: var(--border); }
.btn-big { width: 100%; font-size: 1.1rem; }
.btn svg { width: 20px; height: 20px; }

/* Kartu */
.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 1.1rem 1.2rem;
}
.card + .card { margin-top: 1rem; }
.kicker {
  display: inline-block;
  font-size: 0.75rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--teal-deep);
  margin-bottom: 0.35rem;
}

/* Lanjut belajar: kartu andalan beranda */
.resume-card {
  display: grid; gap: 1rem;
  background: var(--night);
  color: oklch(0.97 0.01 90);
  border: 2px solid var(--night);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  position: relative;
}
.resume-card::after {
  content: "";
  position: absolute; right: -50px; top: -50px;
  width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle, var(--sun) 0 55px, oklch(0.84 0.14 88 / 0.25) 56px 90px, transparent 91px);
}
.resume-card h2 { color: #fff; }
.resume-card p { color: oklch(0.9 0.02 90); }
.resume-card .btn-primary { justify-self: start; position: relative; z-index: 1; }
@media (min-width: 768px) { .resume-card { grid-template-columns: 1fr auto; align-items: center; } }

/* Bintang dan lencana */
.stars { color: var(--sun); font-size: 1.2rem; letter-spacing: 0.1em; }
.badge-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: oklch(0.93 0.08 88);
  border: 2px solid oklch(0.8 0.1 85);
  color: var(--foreground);
  border-radius: 999px;
  font-weight: 800; font-size: 0.85rem;
  padding: 0.3rem 0.8rem;
}

/* Sampul kisah: bingkai lengkung khas produk */
.story-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; list-style: none; margin: 0; padding: 0; }
@media (min-width: 768px) { .story-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .story-grid { grid-template-columns: repeat(4, 1fr); } }
.story-card {
  display: block;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  text-decoration: none; color: var(--foreground);
  transition: transform 180ms ease-out;
}
.story-card:active { transform: translateY(2px); }
.story-card .cover {
  height: 150px;
  border-radius: 999px 999px calc(var(--radius) * 0.6) calc(var(--radius) * 0.6);
  margin: 0.55rem 0.55rem 0;
  display: flex; align-items: flex-end; justify-content: center;
  position: relative; overflow: hidden;
  border: 2px solid oklch(1 0 0 / 0.35);
}
.story-card .cover svg { width: 96px; height: 96px; margin-bottom: 6px; }
.story-card .body { padding: 0.7rem 0.85rem 0.9rem; }
.story-card .body h3 { margin: 0 0 0.25rem; font-size: 1.02rem; }
.story-card .meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; font-size: 0.78rem; font-weight: 800; }
.tag { border-radius: 999px; padding: 0.1rem 0.6rem; border: 2px solid transparent; }
.tag-free { background: oklch(0.9 0.08 160); color: oklch(0.35 0.07 160); border-color: oklch(0.75 0.09 160); }
.tag-lock { background: var(--muted); color: var(--foreground); border-color: var(--border); }
.tag-done { background: var(--primary); color: var(--primary-foreground); }
.progress { height: 10px; background: var(--muted); border-radius: 999px; border: 1px solid var(--border); overflow: hidden; margin-top: 0.5rem; }
.progress i { display: block; height: 100%; background: var(--teal); border-radius: 999px; }

/* Layar baca */
.reader { display: grid; gap: 1rem; }
.reader-art {
  border-radius: var(--radius);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-soft);
  min-height: 240px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.reader-art svg { width: min(72%, 300px); height: auto; }
.reader-text { font-size: 1.25rem; line-height: 1.8; font-weight: 600; }
.reader-text .hl { background: oklch(0.93 0.09 88); border-radius: 6px; padding: 0 4px; }
.reader-nav { display: flex; gap: 0.75rem; }
.reader-nav .btn { flex: 1; }
.page-dots { display: flex; gap: 0.4rem; justify-content: center; }
.page-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--border); border: 1px solid var(--border); }
.page-dots i[aria-current="true"] { background: var(--primary); border-color: var(--primary); }

/* Pemutar suara */
.player {
  display: flex; align-items: center; gap: 0.9rem;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-soft);
  padding: 0.9rem 1rem;
}
.play-btn {
  flex: none;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--primary); color: var(--primary-foreground);
  border: 0; box-shadow: var(--shadow-soft);
  display: flex; align-items: center; justify-content: center;
}
.play-btn svg { width: 26px; height: 26px; }
.player-track { flex: 1; }
.player-track .bar { height: 12px; background: var(--muted); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.player-track .bar i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width 400ms linear; }
.player-time { font-size: 0.8rem; font-weight: 800; white-space: nowrap; }

/* Kuis */
.quiz-q { font-size: 1.25rem; font-weight: 800; font-family: var(--font-heading); }
.quiz-opts { display: grid; gap: 0.7rem; margin-top: 0.8rem; }
.quiz-opt {
  display: flex; align-items: center; gap: 0.8rem;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  font-weight: 800; font-size: 1.05rem; text-align: left; width: 100%;
  min-height: 64px;
  transition: transform 150ms ease-out, border-color 150ms ease-out, background 150ms ease-out;
}
.quiz-opt:active { transform: scale(0.99); }
.quiz-opt .pic {
  flex: none; width: 52px; height: 52px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--muted); border: 2px solid var(--border);
}
.quiz-opt .pic svg { width: 30px; height: 30px; }
.quiz-opt.benar { border-color: var(--good); background: oklch(0.93 0.07 150); }
.quiz-opt.salah { border-color: var(--bad); background: oklch(0.93 0.06 25); }
.quiz-feedback { font-weight: 800; min-height: 1.8em; }
.quiz-feedback.ok { color: oklch(0.45 0.12 150); }
.quiz-feedback.no { color: var(--bad); }

/* Profil anak */
.kid-pick { display: grid; gap: 0.8rem; }
@media (min-width: 768px) { .kid-pick { grid-template-columns: 1fr 1fr; } }
.kid-card {
  display: flex; align-items: center; gap: 1rem;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-soft);
  padding: 1rem; width: 100%; text-align: left; font-size: 1rem;
}
.kid-card[aria-current="true"] { border-color: var(--primary); }
.avatar {
  flex: none; width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 700; font-size: 1.6rem; color: #fff;
  border: 3px solid oklch(1 0 0 / 0.5);
}
.pin-dots { display: flex; gap: 0.7rem; justify-content: center; margin: 1rem 0; }
.pin-dots i { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--border); background: var(--surface); }
.pin-dots i.on { background: var(--primary); border-color: var(--primary); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; max-width: 300px; margin: 0 auto; }
.pin-pad button {
  border: 2px solid var(--border); background: var(--surface);
  border-radius: var(--radius); min-height: 60px;
  font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700;
  box-shadow: var(--shadow-press);
}
.pin-pad button:active { transform: translateY(2px); }

/* Formulir */
.field { margin-bottom: 0.9rem; }
.field label { display: block; font-weight: 800; margin-bottom: 0.3rem; }
.field input, .field select {
  width: 100%; min-height: 52px;
  border: 2px solid var(--border); border-radius: calc(var(--radius) * 0.7);
  background: var(--surface); color: var(--foreground);
  font: inherit; font-weight: 600;
  padding: 0.6rem 0.9rem;
}
.field .hint { font-size: 0.85rem; color: var(--teal-deep); font-weight: 700; margin-top: 0.25rem; }
.field .err { font-size: 0.85rem; color: var(--bad); font-weight: 800; margin-top: 0.25rem; }

/* Tabel laporan */
.table-wrap { overflow-x: auto; border: 2px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.report { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 560px; }
table.report th, table.report td { padding: 0.7rem 0.9rem; text-align: left; border-bottom: 1px solid var(--border); }
table.report th { background: var(--muted); font-weight: 800; white-space: nowrap; }
table.report tr:last-child td { border-bottom: 0; }
table.report td.num { font-variant-numeric: tabular-nums; font-weight: 800; }

/* Unduhan */
.dl-row { display: flex; align-items: center; gap: 0.9rem; padding: 0.8rem 0; border-bottom: 1px solid var(--border); }
.dl-row:last-child { border-bottom: 0; }
.dl-row .info { flex: 1; }
.dl-row .info b { display: block; }
.dl-row .info small { color: var(--teal-deep); font-weight: 700; }
.storage { background: var(--muted); border: 2px solid var(--border); border-radius: 999px; height: 18px; overflow: hidden; }
.storage i { display: block; height: 100%; background: var(--teal); }

/* Bayar */
.qr-box {
  width: 220px; height: 220px; margin: 0 auto;
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.price { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; color: var(--primary); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; counter-reset: s; }
.steps li { display: flex; gap: 0.7rem; align-items: flex-start; font-weight: 600; }
.steps li::before {
  counter-increment: s; content: counter(s);
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: var(--primary-foreground);
  font-family: var(--font-heading); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Lencana */
.lencana-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.8rem; list-style: none; margin: 0; padding: 0; }
@media (min-width: 768px) { .lencana-grid { grid-template-columns: repeat(5, 1fr); } }
.lencana {
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 0.9rem 0.5rem; text-align: center; font-size: 0.8rem; font-weight: 800;
}
.lencana svg { width: 44px; height: 44px; }
.lencana.locked { opacity: 0.55; filter: grayscale(0.7); }

/* Status offline */
.offline-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: oklch(0.9 0.08 160); color: oklch(0.35 0.07 160);
  border: 2px solid oklch(0.75 0.09 160);
  border-radius: 999px; font-weight: 800; font-size: 0.82rem; padding: 0.25rem 0.8rem;
}

/* Landing */
.hero { display: grid; gap: 1.5rem; align-items: center; padding: 2.5rem 0 1rem; }
@media (min-width: 900px) { .hero { grid-template-columns: 1.1fr 0.9fr; } }
.hero-art {
  border-radius: var(--radius); border: 2px solid var(--border);
  box-shadow: var(--shadow-soft);
  background: linear-gradient(160deg, oklch(0.55 0.1 220), oklch(0.4 0.06 260));
  min-height: 300px; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.hero-art svg { width: min(80%, 340px); height: auto; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1rem; }
.feature-list { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 1.5rem; }
@media (min-width: 768px) { .feature-list { grid-template-columns: repeat(3, 1fr); } }
.feature-list .card h3 { display: flex; align-items: center; gap: 0.5rem; }
.feature-list .card svg { width: 26px; height: 26px; color: var(--primary); }
.plan-strip { display: flex; flex-wrap: wrap; gap: 0.7rem; align-items: center; justify-content: space-between; }
.site-footer { margin-top: 3rem; border-top: 2px solid var(--border); padding: 1.2rem 0 2rem; font-size: 0.85rem; font-weight: 700; color: var(--teal-deep); }

/* Auth */
.auth-wrap { max-width: 480px; margin: 2rem auto; }
.auth-card { padding: 1.6rem; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 0.7rem;
  width: 100%; min-height: 56px;
  background: var(--surface); border: 2px solid var(--border); border-radius: 999px;
  font-weight: 800; font-size: 1rem; color: var(--foreground);
  box-shadow: var(--shadow-soft); text-decoration: none;
}
.google-btn:active { transform: translateY(2px); box-shadow: var(--shadow-press); }
.divider { display: flex; align-items: center; gap: 0.7rem; color: var(--teal-deep); font-weight: 800; font-size: 0.85rem; margin: 1rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 2px; background: var(--border); border-radius: 2px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.6rem 0 0.8rem; }
.section-head a { font-weight: 800; font-size: 0.9rem; white-space: nowrap; }
.empty { text-align: center; padding: 2rem 1rem; }
.empty svg { width: 72px; height: 72px; opacity: 0.8; }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: var(--foreground); color: var(--background);
  font-weight: 800; padding: 0.7rem 1.3rem; border-radius: 999px;
  opacity: 0; transition: opacity 200ms ease-out, transform 200ms ease-out;
  z-index: 50; max-width: 92vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 1024px) { .toast { bottom: 30px; } }
