@font-face {
  font-family: 'Amiri';
  src: url('../fonts/amiri-arabic-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}
@font-face {
  font-family: 'Amiri';
  src: url('../fonts/amiri-arabic-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}
@font-face {
  font-family: 'Amiri Quran';
  src: url('../fonts/amiri-quran-arabic-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F;
}

:root {
  --paper: #f5f0e4;
  --soft: #ebe4d2;
  --ink: #202722;
  --muted: #5d665f;
  --line: #d9d2c0;
  --accent: #2f5d46;
  --accent-ink: #ffffff;
  --ok: #2c6e3f;
  --near: #8f6200;
  --off: #b0392b;
  --arabic: 'Amiri', 'Noto Naskh Arabic', 'Scheherazade New', 'Traditional Arabic', serif;
  --quran: 'Amiri Quran', 'Amiri', 'Noto Naskh Arabic', 'Scheherazade New', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171c18;
    --soft: #222a23;
    --ink: #e8e4d8;
    --muted: #a2a89f;
    --line: #2f372f;
    --accent: #86c19e;
    --accent-ink: #10150f;
    --ok: #79c58d;
    --near: #e0b350;
    --off: #ef8c7d;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: 17px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-underline-offset: 0.2em; }

.top, main {
  max-width: 44rem;
  margin: 0 auto;
  padding-left: 1.1rem;
  padding-right: 1.1rem;
}
.top { padding-top: 1rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--line); }
main { padding-top: 1.4rem; padding-bottom: 5rem; }
main:focus { outline: none; }

.brand {
  font-family: var(--arabic);
  font-weight: 700;
  font-size: 1.7rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.01em;
}
#nav { display: flex; flex-wrap: wrap; gap: 0.2rem 1.2rem; margin-top: 0.3rem; }
#nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
#nav a:hover { color: var(--ink); }
#nav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }

h1 { font-size: 1.7rem; line-height: 1.25; margin: 0.2rem 0 0.8rem; font-weight: 650; }
h2 { font-size: 1.15rem; margin: 2rem 0 0.5rem; font-weight: 650; }
p { margin: 0.5rem 0 0.8rem; }
.small, .meta { font-size: 0.88rem; color: var(--muted); }
.meta { margin-left: 0.6rem; }
.crumb { margin: 0 0 0.6rem; font-size: 0.9rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- huruf Arab ---------- */
.ar { font-family: var(--arabic); font-feature-settings: 'liga', 'calt', 'ccmp'; }
.ar-md { font-size: 1.8rem; line-height: 1.7; }
.ar-lg { font-size: 2.4rem; line-height: 1.6; }
.ar-xl { font-size: 2.9rem; line-height: 1.5; }
.ar-hero { font-size: 7rem; line-height: 1.15; }
.ayat { font-family: var(--quran); font-size: 2rem; line-height: 2.3; display: block; text-align: right; }
.inl { font-size: 1.35em; line-height: 1; }

/* ---------- tombol ---------- */
.btn {
  font: inherit;
  display: inline-block;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.45rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.small-btn { padding: 0.2rem 0.65rem; font-size: 0.88rem; }

/* ---------- beranda ---------- */
.intro p { max-width: 36rem; }
.path { list-style: none; padding: 0; margin: 2rem 0; }
.path li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 1rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}
.path li:last-child { border-bottom: 1px solid var(--line); }
.path a { font-size: 1.15rem; font-weight: 600; }
.path .desc { flex-basis: 100%; order: 3; color: var(--muted); font-size: 0.92rem; }
.path .prog { margin-left: auto; font-size: 0.85rem; color: var(--muted); }
.how p { max-width: 36rem; }

/* ---------- hijaiyah ---------- */
.letters {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: 0.3rem 0.2rem;
  margin: 1.2rem 0;
}
.letter {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.3rem 0.1rem 0.4rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.letter:hover { background: var(--soft); }
.letter .nm { font-size: 0.78rem; color: var(--muted); }
.letter.done { border-bottom-color: var(--accent); }

.hero { display: flex; align-items: center; gap: 1.4rem; margin: 0.2rem 0 0.6rem; }
.hero h1 { margin: 0; }
.forms { display: flex; flex-wrap: wrap; gap: 0.4rem 2rem; margin: 0.4rem 0 0.6rem; }
.form { text-align: center; }
.form span { display: block; font-size: 0.8rem; color: var(--muted); margin-top: -0.4rem; }
.facts { margin: 1rem 0; }
.facts dt { font-size: 0.8rem; color: var(--muted); margin-top: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
.facts dd { margin: 0.1rem 0 0; }
.contoh { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 0.5rem; margin-bottom: 0.2rem; }

.syls { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.syl {
  font: inherit;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.1rem 0.9rem 0.3rem;
  cursor: pointer;
}
.syl:hover { background: var(--soft); }
.syl span:last-child { font-size: 0.8rem; color: var(--muted); }
.syltable .syl { border-color: transparent; padding: 0 0.3rem; width: 100%; }

.tablewrap { overflow-x: auto; margin: 0.8rem 0; }
.syltable { width: 100%; border-collapse: collapse; text-align: center; }
.syltable th, .syltable td { padding: 0.15rem 0.3rem; border-bottom: 1px solid var(--line); font-weight: 400; }
.syltable thead th { font-size: 0.82rem; color: var(--muted); padding-bottom: 0.4rem; }
.syltable tbody th { text-align: left; font-size: 0.9rem; color: var(--muted); }

.subnav { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; margin: 0.4rem 0 0.4rem; }
.subnav a { text-decoration: none; color: var(--muted); padding: 0.2rem 0; border-bottom: 2px solid transparent; }
.subnav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- kuis ---------- */
.quiz { margin: 0.5rem 0; }
.quiz-q { margin: 0.2rem 0; text-align: center; }
.opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin: 0.4rem 0 0.8rem; }
.opt {
  font: inherit;
  font-size: 1.15rem;
  min-width: 4.5rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--muted);
  border-radius: 8px;
  padding: 0.45rem 1.2rem;
  cursor: pointer;
}
.opt:disabled { cursor: default; }
.opt.right { border-color: var(--ok); border-width: 2px; color: var(--ok); font-weight: 700; }
.opt.wrong { border-color: var(--off); border-width: 2px; color: var(--off); text-decoration: line-through; }
.score strong { font-size: 1.3rem; }

/* ---------- baris latihan ---------- */
.rows { margin: 0.6rem 0; }
.row { border-top: 1px solid var(--line); padding: 0.6rem 0; }
.row:last-child { border-bottom: 1px solid var(--line); }
.row-main { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.2rem 1rem; }
.row-text { flex: 1 1 14rem; min-width: 0; }
.row-text .lbl { display: block; font-size: 0.8rem; color: var(--muted); }
.row-side { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.5rem; }
.mark { font-size: 0.82rem; color: var(--muted); }
.row.open { background: var(--soft); margin: 0 -0.6rem; padding-left: 0.6rem; padding-right: 0.6rem; }

.practice { margin: 0.6rem 0 0.4rem; padding: 0.2rem 0 0.2rem 0.9rem; border-left: 3px solid var(--accent); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.level { display: inline-block; width: 4.5rem; height: 0.5rem; background: var(--line); border-radius: 3px; overflow: hidden; }
.level i { display: block; height: 100%; width: 0; background: var(--accent); }
.note { font-size: 0.9rem; color: var(--muted); min-height: 1.4em; margin: 0.5rem 0 0.2rem; }
.live { font-size: 1.5rem; color: var(--muted); margin: 0; min-height: 0; }
.live:empty { display: none; }
.result { margin-top: 0.4rem; }
.result:empty { display: none; }
.target { font-size: 2.1rem; line-height: 2.1; margin: 0.2rem 0; }
.w-ok { color: var(--ok); }
.w-near { color: var(--near); text-decoration: underline wavy; text-underline-offset: 0.3em; }
.w-off { color: var(--off); text-decoration: underline; text-underline-offset: 0.3em; }
.w-miss { color: var(--off); text-decoration: line-through; }
.issues { margin: 0.3rem 0 0.6rem; padding-left: 1.2rem; font-size: 0.92rem; }
.recarea { margin-top: 0.6rem; }
.recarea:empty { display: none; }
.recarea audio { display: block; width: 100%; max-width: 22rem; margin: 0.2rem 0 0.5rem; }

/* ---------- Al-Qur'an ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; }
.search {
  font: inherit;
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  margin: 0.3rem 0 0.6rem;
}
.surahs { list-style: none; margin: 0; padding: 0; }
.surahs li { display: flex; align-items: baseline; gap: 0.8rem; padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
.surahs .num { width: 2rem; color: var(--muted); font-size: 0.85rem; text-align: right; }
.surahs .meta { margin-left: auto; }
.surahs .empty { color: var(--muted); }
.surah-head h1 { margin-bottom: 0; }
.surah-head .sub { margin: 0 0 0.4rem; color: var(--muted); }
.surah-head > .ar { display: block; text-align: right; }
.basmalah { margin: 0.6rem 0; padding-bottom: 0.4rem; border-bottom: 1px solid var(--line); }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2.4rem; font-size: 0.92rem; }

/* ---------- progres ---------- */
.plain { border-collapse: collapse; width: 100%; max-width: 30rem; }
.plain th, .plain td { text-align: left; font-weight: 400; padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.plain td { text-align: right; }
.plainlist { list-style: none; padding: 0; }
.plainlist li { padding: 0.3rem 0; border-bottom: 1px solid var(--line); }

@media (max-width: 30rem) {
  html { font-size: 16px; }
  .ar-hero { font-size: 5.5rem; }
  .ayat { font-size: 1.8rem; }
  .target { font-size: 1.8rem; }
  .row.open { margin: 0 -0.3rem; padding-left: 0.3rem; padding-right: 0.3rem; }
}
