:root { --bg: #0f0f1a; --bg2: #161627; --card: #1b1b2f; --line: #2a2a45; --text: #f1f0fa; --muted: #a4a3c0; --accent: #7c5cff; --green: #34d399; --red: #fb7185; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.7 "Tajawal", system-ui, sans-serif; overflow-x: clip; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
input, select { font: inherit; width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); color: var(--text); outline: none; }
input:focus { border-color: var(--accent); }
label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; border: 0; border-radius: 12px; padding: 10px 18px; font-weight: 700; color: #fff; background: var(--accent); }
.btn.big { padding: 13px 22px; font-size: 17px; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn:disabled { opacity: .6; }
.link { background: none; border: 0; color: var(--muted); padding: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.err { color: var(--red); margin: 0; }
.tag { display: inline-flex; font-size: 12.5px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); }
.tag.ok { color: var(--green); border-color: rgba(52,211,153,.4); }

.top { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px clamp(14px, 4vw, 40px); background: rgba(15,15,26,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), #22d3ee); font-weight: 800; font-size: 20px; }
.brand b { display: block; font-size: 17px; } .brand small { color: var(--muted); font-size: 12px; display: block; margin-top: -3px; }
#nav { display: flex; align-items: center; gap: 14px; font-size: 15px; }
#nav .who { color: var(--muted); font-size: 13px; direction: ltr; }
main { max-width: 1200px; margin: 0 auto; padding: 24px clamp(14px, 4vw, 40px) 60px; min-height: 70vh; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; border-top: 1px solid var(--line); }
.foot a { color: var(--text); }

.auth { display: grid; place-items: center; padding: 30px 0; }
.card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 26px; display: grid; gap: 14px; }
.hero { padding: 10px 0 24px; } .hero h1 { font-size: clamp(26px, 4vw, 38px); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.course { background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; transition: transform .2s, border-color .2s; }
.course:hover { transform: translateY(-4px); border-color: var(--c); }
.course .cover { aspect-ratio: 16/8; background: radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--c) 80%, #fff 10%), var(--c) 40%, #111 120%); display: grid; place-items: center; padding: 20px; text-align: center; }
.course .cover span { font-size: 22px; font-weight: 800; text-shadow: 0 2px 10px rgba(0,0,0,.4); }
.course .in { padding: 16px 18px 18px; } .course h2 { font-size: 18px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); align-items: center; }

.course-page { display: grid; grid-template-columns: 1fr 330px; gap: 22px; align-items: start; }
.course-hero { background: radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--c) 45%, transparent), transparent 70%), var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 28px; display: grid; gap: 10px; justify-items: start; }
.course-hero h1 { font-size: clamp(24px, 3.4vw, 34px); }
.lesson-head { margin-bottom: 12px; } .lesson-head h1 { font-size: 22px; margin-top: 4px; }
.lessons { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: grid; gap: 6px; position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow: auto; }
.lessons h3 { font-size: 16px; padding: 4px 6px 8px; }
.ls { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 12px; }
a.ls:hover, .ls.on { background: rgba(124,92,255,.15); }
.ls.off { opacity: .55; }
.ls .t { display: grid; font-size: 14.5px; } .ls small { color: var(--muted); font-size: 12px; }
.notice { font-size: 13px; color: var(--muted); background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-top: 10px; }

.protected { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.vp { position: relative; background: #000; border-radius: 16px; overflow: hidden; aspect-ratio: 16/9; outline: none; user-select: none; -webkit-user-select: none; }
.vp:fullscreen { border-radius: 0; aspect-ratio: auto; width: 100vw; height: 100vh; }
.vp video { width: 100%; height: 100%; display: block; object-fit: contain; }
.vp-wm { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.vp-shield { position: absolute; inset: 0 0 52px; z-index: 2; }
.vp-big { position: absolute; inset: 0; display: grid; place-items: center; font-size: 44px; z-index: 2; pointer-events: none; color: #fff; text-shadow: 0 4px 20px rgba(0,0,0,.6); }
.vp-msg { position: absolute; inset: 0; z-index: 6; background: rgba(10,10,20,.92); display: grid; place-items: center; align-content: center; gap: 12px; padding: 24px; text-align: center; }
.vp-msg p { max-width: 460px; margin: 0; }
.vp-blank video { visibility: hidden; }
.vp-bar { position: absolute; inset: auto 0 0 0; z-index: 4; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: linear-gradient(transparent, rgba(0,0,0,.8)); direction: ltr; transition: opacity .3s; }
.vp.idle .vp-bar { opacity: 0; }
.vp-bar button { background: none; border: 0; color: #fff; font-size: 18px; width: 30px; }
.vp-bar select { width: auto; padding: 3px 6px; font-size: 13px; background: rgba(0,0,0,.5); border-color: rgba(255,255,255,.2); }
.vp-time { font-size: 13px; color: #ddd; white-space: nowrap; font-variant-numeric: tabular-nums; }
.vp-seek { position: relative; flex: 1; height: 6px; background: rgba(255,255,255,.2); border-radius: 4px; }
.vp-seek .vp-buf, .vp-seek .vp-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; }
.vp-buf { background: rgba(255,255,255,.3); } .vp-fill { background: var(--accent); }
.vp-seek input { position: absolute; inset: -8px 0; width: 100%; opacity: 0; cursor: pointer; padding: 0; }
.doc { display: grid; gap: 12px; } .doc canvas { width: 100%; height: auto; border-radius: 10px; background: #fff; }

@media (max-width: 900px) {
  .course-page { grid-template-columns: 1fr; }
  .lessons { position: static; max-height: none; }
  #nav { gap: 10px; font-size: 14px; } #nav .who { display: none; }
  .vp { border-radius: 10px; }
  .vp-speed { display: none; }
}

.dl { max-width: 900px; margin: 0 auto; display: grid; gap: 16px; }
.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dl-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: grid; gap: 10px; align-content: start; }
.dl-card.pick { border-color: var(--accent); }
.dl-card ol { margin: 6px 0 0; padding-inline-start: 20px; color: var(--muted); font-size: 14.5px; display: grid; gap: 4px; }
@media (max-width: 760px) { .dl-grid { grid-template-columns: 1fr; } }
