/* أثر | ATHAR — تصميم واجهة الطالب */
:root {
  --ink: #241052;
  --primary: #4B1FA8;
  --primary-2: #6B3FD4;
  --gold: #F2C14E;
  --white: #FFFFFF;
  --muted: #6E6E7B;
  --bg: #F6F3FC;
  --card: #FFFFFF;
  --line: #E4DDF5;
  --soft: #EFE9FB;
  --ok: #1F8A5B;
  --warn: #9A6A12;
  --radius: 20px;
  --shadow: 0 6px 22px rgba(36, 16, 82, .10);
  --font: 'Cairo', 'Tajawal', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --tabs-h: 68px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Splash ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: radial-gradient(circle at 50% 30%, #5B2BC4 0%, #241052 70%);
  color: var(--white);
  transition: opacity .5s ease, visibility .5s ease;
}
.splash img { border-radius: 28px; box-shadow: 0 10px 40px rgba(0,0,0,.35); animation: pop .7s ease both; }
.splash h1 { font-size: 44px; font-weight: 800; margin-top: 10px; }
.splash p { color: var(--gold); font-weight: 600; }
.splash.hide { opacity: 0; visibility: hidden; }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Shell ---------- */
.app { max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; }
.view { padding-bottom: calc(var(--tabs-h) + 24px + env(safe-area-inset-bottom)); outline: none; animation: fade .3s ease both; }
.app.no-tabs .view { padding-bottom: 0; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.tabs {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; z-index: 20;
  display: flex; justify-content: space-around;
  background: var(--white); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 20px rgba(36, 16, 82, .08);
}
.app.no-tabs .tabs { display: none; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 14px; color: var(--muted);
  font-size: 12px; font-weight: 600; min-height: 52px; justify-content: center;
}
.tab .ic svg { width: 24px; height: 24px; }
.tab.active { color: var(--primary); background: var(--soft); }

/* ---------- Header ---------- */
.hero {
  background: linear-gradient(160deg, #241052 0%, #4B1FA8 100%);
  color: var(--white);
  padding: 22px 20px 54px;
  border-radius: 0 0 32px 32px;
}
.hero-row { display: flex; align-items: center; gap: 12px; }
.hero h1 { font-size: 24px; font-weight: 800; line-height: 1.4; }
.hero p { color: #D9CFF7; font-size: 14px; }
.hero .logo { width: 48px; height: 48px; border-radius: 14px; flex: none; }
.back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 14px; background: rgba(255,255,255,.14); flex: none;
}
.back svg { width: 22px; height: 22px; transform: scaleX(-1); }
.sheet { margin: -34px 16px 0; display: grid; gap: 14px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card h2 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.card p { color: #4a4660; font-size: 15px; }
.card.gold { background: linear-gradient(135deg, #FFF3D1, #FDE6A0); border-color: #F2D88A; }
.card.accent { background: linear-gradient(135deg, #4B1FA8, #6B3FD4); color: var(--white); border: none; }
.card.accent p { color: #E7DFFB; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  box-shadow: var(--shadow); min-height: 112px;
}
.tile .ico {
  width: 44px; height: 44px; border-radius: 14px; background: var(--soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.tile .ico svg { width: 24px; height: 24px; }
.tile strong { font-size: 15px; line-height: 1.4; }

.badge {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px;
  background: #FFF3D1; color: var(--warn); border: 1px solid #F2D88A;
}
.badge.ok { background: #E3F6EC; color: var(--ok); border-color: #B7E3CB; }

.list { list-style: none; display: grid; gap: 8px; margin-top: 10px; }
.list li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: #3b3752; }
.list li::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); margin-top: 11px; flex: none;
}

.section-title { font-size: 17px; font-weight: 700; margin: 6px 4px 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 16px; border: 0; cursor: pointer;
  font-weight: 700; font-size: 16px; width: 100%;
}
.btn-primary { background: var(--primary); color: var(--white); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-ghost { background: var(--soft); color: var(--primary); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Welcome ---------- */
.welcome {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between;
  padding: 48px 24px calc(28px + env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 25%, #5B2BC4 0%, #241052 75%);
  color: var(--white); text-align: center;
}
.welcome .slide { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 40px; animation: fade .4s ease both; }
.welcome .slide img { width: 120px; height: 120px; border-radius: 30px; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.welcome h1 { font-size: 30px; font-weight: 800; line-height: 1.4; }
.welcome p { color: #D9CFF7; font-size: 17px; max-width: 320px; }
.dots { display: flex; gap: 8px; justify-content: center; margin: 18px 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.35); }
.dot.on { background: var(--gold); width: 26px; border-radius: 6px; }
.welcome .actions { display: grid; gap: 10px; }
.link-btn { background: none; border: 0; color: #D9CFF7; font-weight: 600; min-height: 44px; cursor: pointer; }

/* ---------- Update bar / toast ---------- */
.update-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  background: var(--gold); color: var(--ink); padding: 10px 14px;
  display: flex; gap: 10px; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.update-bar button { border: 0; background: var(--ink); color: var(--white); border-radius: 10px; padding: 6px 14px; font-weight: 700; cursor: pointer; min-height: 36px; }
.toast {
  position: fixed; bottom: calc(var(--tabs-h) + 18px + env(safe-area-inset-bottom)); left: 50%;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 80;
  background: var(--ink); color: var(--white); padding: 10px 18px; border-radius: 14px; font-size: 14px; font-weight: 600;
  transition: all .3s ease; max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Offline / misc ---------- */
.offline-body { background: var(--ink); color: var(--white); }
.offline { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; }
.offline p { color: #D9CFF7; max-width: 320px; }
.offline .btn { max-width: 260px; }
.noscript { padding: 20px; text-align: center; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- v1: النماذج والمكونات ---------- */
.hero.center { text-align: center; padding-bottom: 60px; }
.hero.center h1 { margin-top: 8px; }
.logo-lg { width: 84px; height: 84px; border-radius: 24px; margin: 0 auto; }
.sheet.pad { margin-top: 24px; }
.center { text-align: center; }
.center-block { display: flex; justify-content: center; }
.small { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }
.big { font-size: 22px; margin: 4px 0; }
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
.field small { color: var(--muted); font-weight: 400; }
.inp { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; font: inherit; color: var(--ink); }
.inp.sm { min-height: 40px; width: auto; padding: 4px 10px; }
textarea.inp { resize: vertical; }
.inp:focus { border-color: var(--primary-2); outline: none; box-shadow: 0 0 0 3px rgba(107,63,212,.18); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: 15px; cursor: pointer; min-height: 32px; }
.check input { width: 22px; height: 22px; margin-top: 3px; flex: none; accent-color: var(--primary); }
fieldset.goals { border: 1.5px dashed var(--line); border-radius: 14px; padding: 10px 12px; display: grid; gap: 4px; }
fieldset.goals legend { padding: 0 6px; font-weight: 700; font-size: 14px; }
.form-err { color: #B3261E; background: #FDECEA; padding: 8px 12px; border-radius: 12px; font-size: 14px; }
.card.err { border-color: #F2B8B5; background: #FFF6F5; }
.link-btn.dark { color: var(--primary); display: inline-flex; align-items: center; }
.recovery { font-family: monospace; font-size: 22px; letter-spacing: 2px; background: #fff; border: 2px dashed var(--gold); border-radius: 14px; padding: 14px; margin: 12px 0; user-select: all; word-break: break-all; }
.loading { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 80px 20px; color: var(--muted); }
.spin { width: 34px; height: 34px; border: 4px solid var(--soft); border-top-color: var(--primary); border-radius: 50%; animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.row-card { display: flex; gap: 14px; align-items: center; }
.row-card.flat { box-shadow: none; border: 0; padding: 0; background: none; }
.row-card .ic svg { width: 28px; height: 28px; color: var(--primary); }
.banner { display: flex; flex-direction: column; gap: 2px; }
.banner span { font-size: 14px; color: var(--primary); font-weight: 700; }
.bar { height: 10px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary-2), var(--gold)); border-radius: 99px; transition: width .4s; }
.tag { display: inline-block; font-size: 12px; background: var(--soft); color: var(--primary); padding: 1px 9px; border-radius: 99px; margin-inline-start: 6px; font-weight: 600; }
.chip { border: 1.5px solid var(--line); background: #fff; color: var(--ink); border-radius: 99px; padding: 4px 14px; min-height: 36px; font-weight: 700; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.chip.ok, .chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip .ic svg { width: 16px; height: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.mini { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.timeline, .sugg, .tasks, .linklist, .review { list-style: none; display: grid; gap: 8px; margin-top: 8px; }
.timeline li { display: grid; grid-template-columns: 96px 1fr; gap: 8px; padding: 8px 10px; border-radius: 14px; background: var(--bg); align-items: center; }
.timeline li.prayer { background: #FFF3D1; } .timeline li.act { background: #EFE9FB; } .timeline li.done { opacity: .6; text-decoration: line-through; }
.timeline time { font-size: 13px; color: var(--muted); direction: ltr; text-align: right; }
.timeline .mini { grid-column: 1 / -1; margin: 0; }
.sugg li { padding: 10px; border: 1.5px dashed var(--line); border-radius: 14px; }
.tasks li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.tasks li.done span { text-decoration: line-through; color: var(--muted); }
.linklist a { display: flex; justify-content: space-between; padding: 12px 4px; border-bottom: 1px solid var(--line); font-weight: 600; }
.acc summary { font-weight: 700; cursor: pointer; font-size: 16px; min-height: 36px; }
.section-title { margin: 8px 4px 0; }
.src { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 8px; }
.prose p { margin: 8px 0; } .prose h3 { margin: 14px 0 4px; color: var(--primary); }
.prose .list { margin: 8px 0; }
.code { background: #1B1038; color: #F6F3FC; border-radius: 12px; padding: 12px; overflow-x: auto; font-size: 14px; direction: ltr; text-align: left; margin: 10px 0; }
.terms dt { font-weight: 700; margin-top: 8px; } .terms dd { color: #4a4660; }
.modal-back { position: fixed; inset: 0; background: rgba(20,8,50,.55); z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 560px; border-radius: 24px 24px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); max-height: 90vh; overflow: auto; display: grid; gap: 12px; }
.modal-actions { display: grid; gap: 8px; }
.opts { display: grid; gap: 8px; margin: 12px 0; }
.opt { text-align: start; border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 14px; font-weight: 600; cursor: pointer; min-height: 48px; }
.opt:active { background: var(--soft); }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 44px; margin: 8px 0; }
.spark i { flex: 1; background: var(--primary-2); border-radius: 4px 4px 0 0; min-height: 4px; }
.lesson-row { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); font-weight: 600; }
.lesson-row small { margin-inline-start: auto; color: var(--muted); }
.lesson-row.done { color: var(--ok); } .lesson-row.locked { opacity: .5; }
.ico.sm { width: 32px; height: 32px; border-radius: 10px; background: var(--soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ico.sm svg { width: 18px; height: 18px; }
.path .ico { width: 48px; height: 48px; border-radius: 14px; background: var(--soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }
.path.locked { opacity: .6; } .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
h3.mod { margin: 14px 0 0; color: var(--primary); font-size: 15px; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; } .step { font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 3px 12px; font-weight: 700; color: var(--muted); } .step.ok { color: var(--ok); border-color: #B7E3CB; background: #E3F6EC; }
.player { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); padding-bottom: 8px; }
.stage { position: relative; aspect-ratio: 16/9; background: #000; } .stage iframe, .stage .vid { width: 100%; height: 100%; border: 0; }
.pbar { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 10px; align-items: center; } .player > .small { padding: 0 12px; }
.qq { border: 0; margin: 14px 0; display: grid; gap: 4px; } .qq legend { font-weight: 700; margin-bottom: 6px; }
.review li { padding: 10px; border-radius: 12px; display: grid; gap: 2px; } .review .ok { background: #E3F6EC; } .review .bad { background: #FDECEA; }
.chat { display: grid; gap: 8px; max-height: 50vh; overflow: auto; padding: 4px; }
.bubble { padding: 10px 14px; border-radius: 16px; max-width: 88%; white-space: pre-wrap; } .bubble.me { background: var(--primary); color: #fff; justify-self: start; } .bubble.bot { background: #fff; border: 1px solid var(--line); justify-self: end; }
.chatform { display: grid; gap: 8px; position: sticky; bottom: calc(var(--tabs-h) + 8px); }
.tile.ach { opacity: .6; } .tile.ach.earned { opacity: 1; border-color: var(--gold); }
.code-ed { font-family: monospace; direction: ltr; text-align: left; font-size: 14px; }
.pg-frame { width: 100%; height: 340px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; }
.card.accent .big, .card.accent p { color: #fff; }
a.card { display: block; }
a.card.row-card { display: flex; }
.ts-box { min-height: 0; }
a.card.banner{display:flex}

/* الشهادة */
.certificate{border:3px double var(--gold,#E9B943);border-radius:18px;padding:28px 18px;text-align:center;background:#fffaf0;color:#170B35;margin-bottom:14px}
.certificate h1{color:#32116E;margin:6px 0}.certificate h2{font-size:1.8rem;margin:8px 0;color:#32116E}.certificate h3{margin:6px 0}
.certificate.revoked{opacity:.55}
@media print{.tabs,.hero,.no-print,nav{display:none!important}body{background:#fff}.certificate{border-color:#999;break-inside:avoid}}

.qibla-dial{position:relative;width:180px;height:180px;margin:12px auto;border:3px solid var(--gold,#E9B943);border-radius:50%}
.qibla-dial .qn{position:absolute;top:4px;left:50%;transform:translateX(-50%);font-weight:700}
.qibla-arrow{position:absolute;inset:0;display:flex;align-items:flex-start;justify-content:center;transition:transform .2s}
.qibla-arrow svg{width:120px;height:120px;margin-top:6px}
