:root {
  --green-900: #0b3f38;
  --green: #0f5c52;
  --green-300: #6ee7d5;
  --gold: #c8a25a;
}

body { font-family: 'Inter', system-ui, -apple-system, sans-serif; font-size: 15px; }
.font-display { font-family: 'Lora', Georgia, serif; }
.font-700 { font-weight: 700; }

.mark {
  display: block;
  width: 30px; height: 30px;
  border-radius: 7px;
  background: #fff;
  object-fit: contain;
  padding: 2px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}

.label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #a8a29e;
}

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost, .btn-again, .btn-got {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 500;
  padding: .55rem 1.1rem;
  border-radius: .6rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-900); }
.btn-ghost { border-color: #d6d3d1; color: #44403c; background: transparent; }
.btn-ghost:hover { border-color: var(--green); color: var(--green); }
.dark .btn-ghost { border-color: #44403c; color: #d6d3d1; }
.dark .btn-ghost:hover { border-color: var(--green-300); color: var(--green-300); }
.btn-again {
  justify-content: center;
  background: rgba(185,28,28,.07);
  border-color: rgba(185,28,28,.25);
  color: #b91c1c;
  font-weight: 600;
}
.btn-again:hover { background: rgba(185,28,28,.13); }
.dark .btn-again { color: #fca5a5; border-color: rgba(248,113,113,.3); background: rgba(248,113,113,.08); }
.btn-got {
  justify-content: center;
  background: rgba(15,92,82,.08);
  border-color: rgba(15,92,82,.28);
  color: var(--green);
  font-weight: 600;
}
.btn-got:hover { background: rgba(15,92,82,.15); }
.dark .btn-got { color: var(--green-300); border-color: rgba(110,231,213,.3); background: rgba(110,231,213,.08); }

/* ---------- Deck / lesson choices ---------- */
.choice {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  text-align: left;
  width: 100%;
  border: 1px solid #e7e5e4;
  border-radius: .75rem;
  background: #fff;
  padding: .8rem 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s;
}
.dark .choice { background: #1c1917; border-color: #292524; }
.choice:hover { border-color: var(--green); }
.choice[aria-pressed="true"] {
  border-color: var(--green);
  background: rgba(15,92,82,.05);
  box-shadow: inset 0 0 0 1px var(--green);
}
.dark .choice[aria-pressed="true"] { border-color: var(--green-300); box-shadow: inset 0 0 0 1px var(--green-300); background: rgba(110,231,213,.06); }
.choice-name { font-weight: 600; font-size: .92rem; color: #1c1917; }
.dark .choice-name { color: #fafaf9; }
.choice-meta { font-size: .75rem; color: #78716c; }
.dark .choice-meta { color: #a8a29e; }

.pill {
  border: 1px solid #e7e5e4;
  background: #fff;
  border-radius: 999px;
  padding: .3rem .8rem;
  font-size: .8rem;
  font-family: inherit;
  color: #57534e;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.dark .pill { background: #1c1917; border-color: #292524; color: #a8a29e; }
.pill:hover { border-color: var(--green); color: var(--green); }
.pill[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.dark .pill[aria-pressed="true"] { background: var(--green-300); border-color: var(--green-300); color: #06201c; }

/* ---------- Progress ---------- */
.progress { height: 5px; background: #e7e5e4; border-radius: 999px; overflow: hidden; }
.dark .progress { background: #292524; }
.progress-fill { height: 100%; width: 0; background: var(--green); border-radius: 999px; transition: width .25s ease; }
.dark .progress-fill { background: var(--green-300); }

/* ---------- Card ---------- */
.card-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 15rem;
  border: 1px solid #e7e5e4;
  border-radius: 1.1rem;
  background: #fff;
  padding: 2rem 1.25rem;
  text-align: center;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 14px 36px -22px rgba(15,92,82,.3);
}
.dark .card-face { background: #1c1917; border-color: #292524; }
.card-face:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.card-face .front {
  font-family: 'Amiri', serif;
  font-size: clamp(3.2rem, 18vw, 5.5rem);
  line-height: 1.25;
  color: var(--green);
  direction: rtl;
}
.dark .card-face .front { color: var(--green-300); }

.card-face .forms {
  font-family: 'Amiri', serif;
  font-size: clamp(1.1rem, 5vw, 1.5rem);
  color: #a8a29e;
  direction: rtl;
  letter-spacing: .1em;
}

.card-face .hint { font-size: .72rem; color: #a8a29e; }

.card-face .back {
  margin-top: .35rem;
  padding-top: .9rem;
  border-top: 1px solid #e7e5e4;
  width: 100%;
  font-size: .95rem;
  line-height: 1.65;
  color: #44403c;
}
.dark .card-face .back { color: #d6d3d1; border-top-color: #292524; }

#answer-row.show { display: grid; }

/* ---------- Stats rows ---------- */
.stat-row { display: flex; align-items: center; justify-content: space-between; font-size: .85rem; padding: .3rem 0; }
.stat-row + .stat-row { border-top: 1px solid #f5f5f4; }
.dark .stat-row + .stat-row { border-top-color: #262626; }
.stat-row span:last-child { font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
.dark .stat-row span:last-child { color: var(--green-300); }

/* ---------- Milestones: reading ability + al-Fatihah ---------- */
.milestone {
  border: 1px solid #e7e5e4;
  border-radius: .85rem;
  background: #fff;
  padding: 1rem 1.1rem;
}
.dark .milestone { background: #1c1917; border-color: #292524; }
.milestone-done { border-color: var(--green); box-shadow: inset 0 0 0 1px rgba(15,92,82,.25); }
.dark .milestone-done { border-color: var(--green-300); box-shadow: inset 0 0 0 1px rgba(110,231,213,.25); }
.milestone-title { font-family: 'Lora', serif; font-weight: 600; font-size: .98rem; color: #1c1917; }
.dark .milestone-title { color: #fafaf9; }
.milestone-num {
  font-size: .82rem; font-weight: 600; color: var(--green);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.dark .milestone-num { color: var(--green-300); }
.milestone-note { margin-top: .6rem; font-size: .78rem; line-height: 1.6; color: #78716c; }
.dark .milestone-note { color: #a8a29e; }

/* al-Fatihah word grid */
.fatiha { display: flex; flex-direction: column; gap: .45rem; }
.verse-line { display: flex; align-items: flex-start; gap: .5rem; }
.verse-no {
  flex: 0 0 auto;
  margin-top: .35rem;
  min-width: 1.15rem; height: 1.15rem;
  border-radius: 999px;
  background: #f5f5f4;
  color: #a8a29e;
  font-family: 'Inter', sans-serif;
  font-size: .62rem;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.dark .verse-no { background: #292524; color: #78716c; }
.verse-words { display: flex; flex-wrap: wrap; gap: .3rem; }

.fw {
  font-family: 'Amiri', serif;
  font-size: 1.15rem;
  line-height: 1.5;
  padding: .1rem .5rem .2rem;
  border-radius: .4rem;
  border: 1px solid transparent;
}
.fw-mastered { background: var(--green); color: #fff; }
.dark .fw-mastered { background: var(--green-300); color: #06201c; }
.fw-learning { background: rgba(15,92,82,.09); color: var(--green); border-color: rgba(15,92,82,.3); }
.dark .fw-learning { background: rgba(110,231,213,.1); color: var(--green-300); border-color: rgba(110,231,213,.3); }
.fw-untouched { background: #f5f5f4; color: #a8a29e; }
.dark .fw-untouched { background: #292524; color: #78716c; }
.fw-stage1 { color: #d6d3d1; border: 1px dashed #d6d3d1; }
.dark .fw-stage1 { color: #57534e; border-color: #44403c; }

.legend {
  display: flex; flex-wrap: wrap; gap: .25rem .9rem;
  margin-top: .85rem;
  font-size: .68rem; color: #a8a29e;
}
.legend span { display: inline-flex; align-items: center; gap: .3rem; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.dot-mastered { background: var(--green); }
.dark .dot-mastered { background: var(--green-300); }
.dot-learning { background: rgba(15,92,82,.15); border: 1px solid rgba(15,92,82,.45); }
.dark .dot-learning { background: rgba(110,231,213,.15); border: 1px solid rgba(110,231,213,.45); }
.dot-untouched { background: #e7e5e4; }
.dark .dot-untouched { background: #44403c; }
.dot-stage1 { border: 1px dashed #d6d3d1; }
.dark .dot-stage1 { border-color: #57534e; }
