:root {
  --bg: #fff8f1;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #f1e4d6;
  --brand: #e8590c;
  --brand-dark: #c2410c;
  --soft: #fff1e6;
  --good: #2f9e44;
  --good-soft: #ebfbee;
  --bad: #e03131;
  --bad-soft: #fff5f5;
  --gold: #f59f00;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Nastaliq Urdu", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 17px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--brand); color: #fff;
  padding-top: max(10px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 800; font-size: 20px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; background: #fff; }
#who { margin-left: auto; font-size: 15px; opacity: .95; }
.top .link { color: #fff; }
main { max-width: 720px; margin: 0 auto; padding: 16px 14px 80px; }
h1 { font-size: 26px; margin: 6px 0 14px; line-height: 1.25; }
h2 { font-size: 20px; margin: 0 0 10px; }
h3 { font-size: 17px; margin: 14px 0 6px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 14px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.muted { color: var(--muted); }
.center { text-align: center; }
.pad { padding: 30px 0; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 15px; }
input[type=text], input[type=password], input[type=tel], select, textarea {
  width: 100%; font: inherit; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
.pin { letter-spacing: 10px; font-size: 26px; text-align: center; font-weight: 700; }
button, .btn {
  font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer;
  background: var(--brand); color: #fff; text-decoration: none; display: inline-block; text-align: center;
}
button:active, .btn:active { transform: scale(.98); }
button:disabled { opacity: .5; }
.btn.block, button.block { display: block; width: 100%; margin-top: 14px; }
.ghost { background: var(--soft); color: var(--brand-dark); }
.plain { background: #f3f4f6; color: var(--ink); }
.danger { background: var(--bad-soft); color: var(--bad); }
.link { background: none; color: var(--brand-dark); padding: 6px 4px; font-weight: 600; text-decoration: underline; }
.small { font-size: 14px; padding: 8px 12px; }
.error { color: var(--bad); font-weight: 600; margin-top: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 20; max-width: 90%; }

/* home */
.hello { display: flex; align-items: center; gap: 12px; }
.streak { margin-left: auto; background: var(--soft); color: var(--brand-dark); border-radius: 999px; padding: 6px 14px; font-weight: 800; white-space: nowrap; }
.lesson-item { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); margin-bottom: 10px; color: inherit; text-decoration: none; }
.lesson-item .ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--soft); font-size: 22px; flex: none; }
.lesson-item .t { font-weight: 700; }
.badge { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: #f3f4f6; color: var(--muted); white-space: nowrap; }
.badge.done { background: var(--good-soft); color: var(--good); }
.badge.started { background: var(--soft); color: var(--brand-dark); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.bar { height: 10px; background: #f3f4f6; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }

/* lesson */
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.step-num { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.video-wrap { background: #000; border-radius: 14px; overflow: hidden; margin: 0 auto; max-width: 420px; }
video { display: block; width: 100%; aspect-ratio: 9 / 16; background: #000; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.chip { background: #f3f4f6; color: var(--ink); font-weight: 600; padding: 8px 14px; border-radius: 999px; font-size: 15px; }
.chip.on { background: var(--brand); color: #fff; }
.diagram { background: var(--soft); border-left: 4px solid var(--brand); padding: 10px 12px; border-radius: 8px; margin: 8px 0 12px; }
ol.notes { padding-left: 26px; margin: 0; }
ol.notes li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
ol.notes li.later { display: none; }
.remember { background: #fff9db; border-radius: 12px; padding: 10px 14px; margin-top: 12px; }
.remember ul { margin: 4px 0 0; padding-left: 20px; }
.q { font-size: 19px; font-weight: 700; margin: 6px 0 12px; }
.opts { display: grid; gap: 10px; }
.opt { text-align: left; background: #fff; color: var(--ink); border: 2px solid var(--line); font-weight: 600; }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.feedback { margin-top: 12px; padding: 12px; border-radius: 12px; }
.feedback.good { background: var(--good-soft); }
.feedback.bad { background: var(--bad-soft); }
.stars { display: flex; gap: 6px; justify-content: center; margin: 6px 0 8px; }
.star { background: none; font-size: 40px; padding: 0 4px; color: #d1d5db; line-height: 1; }
.star.on { color: var(--gold); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 90px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.scheme li { margin-bottom: 4px; }
.rec { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* admin */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.big-pin { font-size: 40px; font-weight: 800; letter-spacing: 8px; text-align: center; color: var(--brand-dark); margin: 6px 0; }
pre.log { background: #111827; color: #e5e7eb; padding: 12px; border-radius: 12px; font-size: 13px; overflow: auto; max-height: 320px; white-space: pre-wrap; }
.check-list label { font-weight: 500; display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

@media print {
  .top, .noprint, #toast { display: none !important; }
  body.print-notes main > *:not(#notes-card) { display: none !important; }
  body.print-notes #notes-card { border: 0; box-shadow: none; }
  body.print-notes ol.notes li.later { display: list-item !important; }
  body { background: #fff; font-size: 14pt; }
}
