:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --text: #1c1c1e;
  --muted: #6a6a70;
  --line: #e2e2dd;
  --accent: #0f6b5c;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ec;
  --fire: #fff0e3;
  --fire-ink: #8f4300;
  --rec: #ecedff;
  --rec-ink: #383c96;
  --new: #ecf6e6;
  --new-ink: #386419;
  --warn: #fff6d4;
  --warn-ink: #6e5200;
  --banner: #ffe2e2;
  --banner-ink: #a10000;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315;
    --surface: #1d1d20;
    --text: #f0f0f2;
    --muted: #a2a2aa;
    --line: #303035;
    --accent: #43b9a4;
    --accent-ink: #0b1d1a;
    --accent-soft: #1b3530;
    --fire: #3a2410;
    --fire-ink: #ffb877;
    --rec: #222448;
    --rec-ink: #bcbfff;
    --new: #1e3216;
    --new-ink: #acdc8f;
    --warn: #383010;
    --warn-ink: #ffe08a;
    --banner: #481616;
    --banner-ink: #ffb4b4;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
#app { max-width: 640px; margin: 0 auto; padding: 0 16px 24px; }
a { color: var(--accent); }
html:not(.v2) h1 { font-size: 1.5rem; line-height: 1.25; margin: 8px 0 8px; }
html:not(.v2) h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 8px; }
html:not(.v2) p { margin: 0 0 12px; }
.small { font-size: 0.85rem; }
.muted { color: var(--muted); }
.lead { color: var(--muted); }
.kicker { color: var(--muted); font-size: 0.85rem; margin: 0; }

.banner {
  margin: 0 -16px; padding: 8px 16px;
  background: var(--banner); color: var(--banner-ink);
  font-size: 0.85rem; font-weight: 600; text-align: center;
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 6px; }
.brand { font-weight: 800; text-decoration: none; color: var(--text); letter-spacing: -0.01em; }
.back { text-decoration: none; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.list { display: grid; gap: 10px; margin: 16px 0; }
.card, .row {
  display: flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text); text-decoration: none;
}
.card { flex-direction: column; gap: 2px; padding: 14px 16px; }
a.card:active, a.row:active { transform: scale(0.99); }
.card-title { font-weight: 650; }
.card-sub { color: var(--muted); font-size: 0.9rem; }
.card-off, .row-off { opacity: 0.55; }

.row { align-items: center; gap: 12px; padding: 12px 14px; }
.num {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.85rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-title { font-weight: 600; }
.row-sub { color: var(--muted); font-size: 0.85rem; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 12px 0 0; }
.tab {
  padding: 8px 12px; text-decoration: none; color: var(--muted); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.empty {
  margin: 20px 0; padding: 24px 16px; text-align: center; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
}

.pill {
  display: inline-block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.03em;
  padding: 2px 8px; border-radius: 999px; vertical-align: middle;
}
.pill-draft, .pill-review { background: var(--warn); color: var(--warn-ink); }
.pill-approved { background: var(--new); color: var(--new-ink); }

.legend { margin: 20px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.legend summary { cursor: pointer; font-weight: 600; }
.legend p { margin: 10px 0 0; font-size: 0.9rem; }

/* progress */
.progress { display: grid; gap: 6px; margin: 10px 0 14px; }
.bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.2s; }

/* question */
.q { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag { font-size: 0.8rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.tag-came-before { background: var(--fire); color: var(--fire-ink); }
.tag-recurring { background: var(--rec); color: var(--rec-ink); }
.tag-practice { background: var(--new); color: var(--new-ink); }
.q-text { font-size: 1.15rem; font-weight: 650; line-height: 1.4; margin: 4px 0 12px; }
.again { background: var(--warn); color: var(--warn-ink); padding: 8px 12px; border-radius: 8px; font-size: 0.9rem; }
.ans { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.points { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.pt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: var(--bg); cursor: pointer; }
.pt input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.pt:has(input:checked) { background: var(--accent-soft); }
.phrases { margin: 0; padding-left: 20px; }
.phrases li { margin-bottom: 4px; font-style: italic; }
.clar { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--rec); color: var(--rec-ink); font-size: 0.9rem; }
.ar { font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif; font-size: 1.05rem; line-height: 1.9; }
.ar h2 { letter-spacing: 0; }
.ar p { margin-bottom: 10px; }

.recall {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 16px -16px -16px; padding: 12px 16px; background: var(--surface);
  border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
}

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: var(--surface); color: var(--accent); border-color: var(--line); }
.btn-block { width: 100%; margin-top: 12px; }
.btn:focus-visible, a:focus-visible, .pt:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.done { text-align: center; padding: 24px 0; }

.foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 0.9rem; }
