:root {
  --primary: #0e7c5b;
  --primary-foreground: #ffffff;
  --ring: #0e7c5b;
  --background: #fff8ec;
  --surface: #ffffff;
  --foreground: #24312b;
  --muted: #f1e8d2;
  --muted-ink: #6b6a5e;
  --border: #2a3a32;
  --accent: #f5a623;
  --accent-ink: #24312b;
  --danger: #d64545;
  --radius: 20px;
  --font-sans: "Nunito", system-ui, -apple-system, sans-serif;
  --font-heading: "Baloo 2", "Nunito", system-ui, sans-serif;
  --font-arabic: "Amiri", serif;
  --shadow-block: 0 4px 0 var(--border);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: 92px;
}

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
p { margin: 0 0 12px; }

.ar { font-family: var(--font-arabic); direction: rtl; }

/* ---------- Shell ---------- */
.topbar {
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-row {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand { font-family: var(--font-heading); font-weight: 800; font-size: 20px; text-decoration: none; color: #fff; }
.stars-pill {
  background: #fff;
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  margin-left: auto;
  white-space: nowrap;
}
.role-switch { display: flex; background: rgba(255,255,255,.2); border-radius: 999px; padding: 3px; }
.role-switch a {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 999px;
}
.role-switch a[aria-current="page"] { background: #fff; color: var(--primary); }

.layout { max-width: 1120px; margin: 0 auto; padding: 16px; }

.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 3px solid var(--border);
  display: flex;
  z-index: 20;
}
.tabbar a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--foreground);
  font-weight: 800;
  font-size: 13px;
  padding: 10px 4px 14px;
}
.tabbar a .ic { font-size: 24px; display: block; }
.tabbar a[aria-current="page"] { color: var(--primary); }

@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 216px; }
  .tabbar {
    top: 0; bottom: 0; left: 0; right: auto;
    width: 216px;
    flex-direction: column;
    border-top: none;
    border-right: 3px solid var(--border);
    padding-top: 76px;
  }
  .tabbar a { flex: none; text-align: left; padding: 12px 20px; font-size: 15px; }
  .tabbar a .ic { display: inline; font-size: 20px; margin-right: 10px; }
}

/* ---------- Toy blocks ---------- */
.block {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-block);
  padding: 16px;
  margin-bottom: 16px;
}
.block.hero { background: var(--primary); color: #fff; border-color: #0a5a42; box-shadow: 0 4px 0 #0a5a42; }
.block.hero .muted-line { color: #d9efe5; }
.block.plain { box-shadow: none; border-width: 1px; border-color: #d8cdae; }
.calm { border-radius: 12px; box-shadow: none; border: 1px solid #d8cdae; }

.grid { display: grid; gap: 12px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) {
  .grid.cols-2 { grid-template-columns: repeat(3, 1fr); }
  .grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.grid.cols-4 { grid-template-columns: repeat(2, 1fr); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 3px solid var(--border);
  background: var(--surface);
  color: var(--foreground);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-block);
}
.btn:active { transform: translateY(3px); box-shadow: none; }
.btn.primary { background: var(--primary); border-color: #0a5a42; color: #fff; box-shadow: 0 4px 0 #0a5a42; }
.btn.accent { background: var(--accent); border-color: #b87a12; color: var(--accent-ink); box-shadow: 0 4px 0 #b87a12; }
.btn.big { font-size: 20px; padding: 16px 30px; min-height: 60px; }
.btn.ghost { box-shadow: none; }
.btn:focus-visible, a:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }

/* ---------- Huruf tiles ---------- */
.huruf-tile {
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-block);
  text-decoration: none;
  color: var(--foreground);
  padding: 12px 8px;
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.huruf-tile .ar { font-size: 44px; line-height: 1.3; }
.huruf-tile.done { background: #e2f3ea; }
.huruf-tile .st { font-size: 12px; font-weight: 800; }
.huruf-tile .st.ok { color: var(--primary); }
.huruf-tile .st.no { color: var(--muted-ink); }

/* ---------- Misc ---------- */
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 800;
  background: var(--muted);
}
.pill.green { background: var(--primary); color: #fff; }
.pill.gold { background: var(--accent); color: var(--accent-ink); }
.progress { height: 14px; background: var(--muted); border-radius: 999px; overflow: hidden; border: 2px solid var(--border); }
.progress > span { display: block; height: 100%; background: var(--accent); }
.progress.green > span { background: var(--primary); }

.surah-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-block);
  padding: 14px 16px;
  margin-bottom: 12px;
  text-decoration: none;
  color: var(--foreground);
}
.surah-row .num {
  width: 48px; height: 48px; flex: none;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.surah-row .ar { font-size: 30px; margin-left: auto; }

.quiz-opt {
  width: 100%;
  font-size: 22px;
  min-height: 72px;
}
.quiz-opt.correct { background: #e2f3ea; border-color: var(--primary); }
.quiz-opt.wrong { background: #fde7e7; border-color: var(--danger); }
.feedback { font-family: var(--font-heading); font-size: 22px; font-weight: 800; text-align: center; margin: 12px 0; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 800; margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  border: 2px solid var(--border);
  padding: 10px 14px;
  font-size: 16px;
  font-family: var(--font-sans);
  background: #fff;
}
table.laporan { width: 100%; border-collapse: collapse; font-size: 15px; }
table.laporan th, table.laporan td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #d8cdae; font-variant-numeric: tabular-nums; }
.bar-row { display: grid; grid-template-columns: 40px 1fr 52px; gap: 8px; align-items: center; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.bar { height: 16px; background: var(--muted); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); }

.empty { text-align: center; padding: 32px 16px; }
.empty .big { font-size: 48px; }
.player { text-align: center; padding: 8px 0 4px; }
.player .ar { font-size: 40px; }
.ayat { border-bottom: 2px dashed #d8cdae; padding: 12px 0; }
.ayat:last-child { border-bottom: none; }
.ayat .ar { font-size: 32px; text-align: right; }
.footer-note { text-align: center; color: var(--muted-ink); font-size: 14px; margin: 24px 0 8px; }
.see-link { display: inline-block; margin-top: 8px; font-weight: 800; color: var(--primary); }
.star-row { letter-spacing: 2px; font-size: 22px; }
.star-row .off { filter: grayscale(1); opacity: .35; }
