@font-face { font-family: "Cairo"; src: url("/assets/fonts/Cairo.ttf"); font-weight: 200 1000; }

:root {
  --bg: #f5f5f2; --card: #fff; --ink: #1c1d1f; --muted: #6a6f73; --line: #e3e4e0;
  --dark: #1c1d1f; --dark-2: #2d2f31; --accent: #7a4ad8; --accent-dark: #4a2a91; --tint: #f1ecfc;
  --ok: #1e9e6a; --ok-soft: #e4f6ee; --bad: #d64545; --bad-soft: #fdeaea; --warn: #e2a03f;
  --radius: 14px; --shadow: 0 2px 10px rgba(0,0,0,.06); --shadow-lg: 0 18px 50px rgba(0,0,0,.14);
  --ease: cubic-bezier(.2,.8,.2,1);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Cairo", "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
.en { direction: ltr; unicode-bidi: isolate; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; background: var(--dark); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.06); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; white-space: nowrap; }
.brand .logo { font-size: 24px; }
.brand small { font-weight: 600; font-size: 12px; background: rgba(255,255,255,.14); padding: 2px 10px; border-radius: 20px; }
.topbar-slot { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-slot .course-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; opacity: .92; }

/* ---------- view transitions & entrance animations ---------- */
.view { animation: viewIn .45s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { opacity: 0; animation: rise .55s var(--ease) forwards; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(226,160,63,.55); } 50% { box-shadow: 0 0 0 14px rgba(226,160,63,0); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #ececea 25%, #f6f6f4 37%, #ececea 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 10px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } .rise { opacity: 1; } }

/* ---------- catalogue ---------- */
.page { max-width: 1320px; margin: 0 auto; padding: 0 22px 70px; }
.hero { margin: 26px 0 8px; border-radius: 22px; padding: 34px 38px; color: #fff; background: radial-gradient(circle at 12% 120%, rgba(255,255,255,.18) 0, transparent 40%), linear-gradient(120deg, #4a2a91, #7a4ad8 55%, #0f9aa8); position: relative; overflow: hidden; }
.hero::after { content: "📐🧪🌍📖💻"; position: absolute; left: 30px; bottom: -14px; font-size: 64px; letter-spacing: 10px; opacity: .18; }
.hero h1 { margin: 0 0 6px; font-size: 34px; line-height: 1.3; }
.hero p { margin: 0; opacity: .9; font-size: 17px; max-width: 720px; }
.stats { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
.stat { background: rgba(255,255,255,.14); backdrop-filter: blur(6px); border-radius: 14px; padding: 10px 18px; min-width: 120px; }
.stat b { display: block; font-size: 26px; line-height: 1.2; }
.stat span { font-size: 13px; opacity: .85; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 34px 0 14px; }
.section-h h2 { margin: 0; font-size: 22px; }
.section-h span { color: var(--muted); font-size: 14px; }

.continue { display: grid; grid-template-columns: 300px 1fr; gap: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.continue:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.continue img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 16/9; display: block; }
.continue picture, .course-card .cover picture { display: block; width: 100%; height: 100%; min-height: 0; overflow: hidden; }
.continue .body { padding: 18px 24px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.continue .kicker { color: var(--accent); font-weight: 700; font-size: 13px; }
.continue .t { font-size: 20px; font-weight: 800; }
.continue .play { align-self: flex-start; margin-top: 8px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.course-card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.course-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.course-card .cover { position: relative; aspect-ratio: 16/9; background: var(--tint); display: flex; align-items: center; justify-content: center; font-size: 64px; overflow: hidden; }
.course-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.course-card:hover .cover img { transform: scale(1.05); }
.course-card .cover .badge { position: absolute; top: 10px; right: 10px; background: rgba(28,29,31,.78); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 20px; }
.course-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; font-size: 12.5px; font-weight: 700; padding: 2px 10px; border-radius: 20px; background: var(--tint); color: var(--accent-dark); }
.course-card .t { font-weight: 800; font-size: 17px; line-height: 1.5; }
.course-card .meta { color: var(--muted); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; margin-top: auto; }
.bar { height: 6px; background: #e9e9e6; border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width 1s var(--ease); }
.course-card .prog { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.course-card .prog .bar { flex: 1; }

.upload-zone { border: 2px dashed #c8c2d8; border-radius: var(--radius); padding: 22px; text-align: center; background: #fbfaff; color: var(--muted); transition: border-color .2s, background .2s, transform .2s; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 230px; }
.upload-zone:hover, .upload-zone.drag { border-color: var(--accent); background: var(--tint); transform: scale(1.01); }
.upload-zone .big { font-size: 46px; }
.upload-zone b { color: var(--ink); font-size: 16px; }
.upload-zone input { display: none; }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 10px; padding: 9px 18px; font-weight: 700; background: var(--accent); color: #fff; transition: transform .15s var(--ease), filter .15s, box-shadow .2s; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.07); box-shadow: 0 6px 16px rgba(122,74,216,.3); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--tint); color: var(--accent-dark); }
.btn.ghost:hover { box-shadow: none; }
.btn.light { background: #fff; color: var(--ink); }
.btn.small { padding: 4px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ---------- learn layout ---------- */
.learn { display: grid; grid-template-columns: minmax(0, 1fr) 380px; min-height: calc(100vh - 60px); }
.learn-main { min-width: 0; }
.learn-side { background: var(--card); border-inline-start: 1px solid var(--line); height: calc(100vh - 60px); position: sticky; top: 60px; overflow-y: auto; }
@media (max-width: 1050px) { .learn { grid-template-columns: 1fr; } .learn-side { position: static; height: auto; border: 0; } }

/* progress ring */
.ring-prog { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.ring-prog svg { width: 38px; height: 38px; transform: rotate(-90deg); }
.ring-prog circle { fill: none; stroke-width: 4; }
.ring-prog .track { stroke: rgba(255,255,255,.2); }
.ring-prog .val { stroke: #8ef0c4; stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease); }
.ring-prog b { font-size: 14px; }

/* ---------- player ---------- */
.player { position: relative; background: #000; aspect-ratio: 16/9; max-height: calc(100vh - 160px); width: 100%; overflow: hidden; user-select: none; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player .big-play { position: absolute; inset: 0; margin: auto; width: 96px; height: 96px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: var(--accent-dark); font-size: 40px; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 40px rgba(0,0,0,.35); transition: transform .2s var(--ease), opacity .3s; padding-inline-start: 6px; }
.player .big-play:hover { transform: scale(1.08); }
.player.playing .big-play { opacity: 0; pointer-events: none; transform: scale(1.3); }

.captions { position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); max-width: 82%; text-align: center; pointer-events: none; transition: bottom .25s var(--ease); }
.player:not(.show-controls).playing .captions { bottom: 26px; }
.captions span { display: inline; background: rgba(0,0,0,.72); color: #fff; font-size: clamp(15px, 2.2vw, 26px); line-height: 1.75; padding: 3px 14px; border-radius: 8px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.captions.off { display: none; }
.captions .cue { animation: viewIn .25s var(--ease); display: inline-block; }

.controls { position: absolute; inset-inline: 0; bottom: 0; padding: 26px 14px 10px; background: linear-gradient(transparent, rgba(0,0,0,.78)); color: #fff; transition: opacity .3s, transform .3s var(--ease); }
.player.playing:not(.show-controls) .controls { opacity: 0; transform: translateY(10px); }
.player.playing:not(.show-controls) { cursor: none; }
.seek { position: relative; height: 18px; display: flex; align-items: center; cursor: pointer; }
.seek .rail { position: absolute; inset-inline: 0; height: 5px; top: 6.5px; transition: height .15s, top .15s; }
.seek:hover .rail { height: 8px; top: 5px; }
.seek .seg { position: absolute; top: 0; bottom: 0; background: rgba(255,255,255,.28); border-radius: 3px; overflow: hidden; }
.seek .seg i { position: absolute; top: 0; bottom: 0; right: 0; width: 0; background: var(--warn); }
.seek .seg b { position: absolute; top: 0; bottom: 0; right: 0; width: 0; background: rgba(255,255,255,.35); }
.seek .qmark { position: absolute; top: -5px; width: 12px; height: 12px; transform: translateX(50%) rotate(45deg); background: #ffd166; border: 2px solid #1c1d1f; border-radius: 2px; z-index: 2; transition: transform .2s; }
.seek:hover .qmark { transform: translateX(50%) rotate(45deg) scale(1.2); }
.seek .knob { position: absolute; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--warn); transform: translateX(50%) scale(0); transition: transform .15s; z-index: 3; }
.seek:hover .knob { transform: translateX(50%) scale(1); }
.seek .tip { position: absolute; bottom: 22px; transform: translateX(50%); background: #fff; color: var(--ink); font-size: 12.5px; font-weight: 700; padding: 4px 10px; border-radius: 8px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; box-shadow: var(--shadow-lg); }
.seek:hover .tip { opacity: 1; }
.ctrl-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.ctrl-row .spacer { flex: 1; }
.cbtn { background: none; border: 0; color: #fff; height: 36px; min-width: 36px; padding: 0 8px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 15px; transition: background .15s; }
.cbtn:hover { background: rgba(255,255,255,.14); }
.cbtn.on { background: rgba(255,255,255,.22); }
.cbtn svg { width: 22px; height: 22px; fill: currentColor; }
.ctime { font-size: 14px; direction: ltr; font-variant-numeric: tabular-nums; opacity: .92; }
.chapter-name { font-size: 14px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }

/* chapter toast */
.toast { position: absolute; top: 18px; right: 18px; background: rgba(255,255,255,.95); color: var(--ink); border-radius: 12px; padding: 8px 16px; font-weight: 800; box-shadow: var(--shadow-lg); animation: slideDown .4s var(--ease); display: flex; gap: 8px; align-items: center; }
.toast small { display: block; font-weight: 600; color: var(--muted); font-size: 12px; }

/* question & completion overlays */
.overlay { position: absolute; inset: 0; background: rgba(20, 16, 40, .62); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: viewIn .3s var(--ease); z-index: 5; }
.ov-card { background: #fff; border-radius: 22px; padding: 26px 30px; max-width: 640px; width: 100%; text-align: center; box-shadow: var(--shadow-lg); animation: pop .45s var(--ease); }
.ov-card .ov-icon { font-size: 52px; line-height: 1; }
.ov-card h3 { margin: 10px 0 6px; font-size: 26px; }
.ov-card p { margin: 0 0 14px; color: var(--muted); }
.ov-card .qtext { font-size: clamp(22px, 3vw, 34px); font-weight: 800; color: var(--accent-dark); background: var(--tint); border: 3px solid var(--accent); border-radius: 16px; padding: 12px 18px; margin: 10px 0 16px; animation: pulse 2s infinite; direction: rtl; unicode-bidi: isolate; }
.ov-card .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* chapter timeline */
.timeline { display: flex; gap: 8px; overflow-x: auto; padding: 14px 22px; background: var(--card); border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.tl-item { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; border-radius: 30px; background: #f2f2ef; font-size: 13.5px; font-weight: 700; border: 2px solid transparent; transition: background .2s, border-color .2s, transform .2s; cursor: pointer; }
.tl-item:hover { transform: translateY(-2px); }
.tl-item .dot { width: 24px; height: 24px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); border: 2px solid #ddd; transition: all .3s; }
.tl-item .tm { color: var(--muted); font-weight: 600; font-size: 12px; direction: ltr; }
.tl-item.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.tl-item.current { background: var(--tint); border-color: var(--accent); }
.tl-item.current .dot { background: var(--accent); border-color: var(--accent); color: #fff; animation: pop .4s var(--ease); }
.tl-item.q .dot { border-color: var(--warn); }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); background: var(--card); position: relative; }
.tab { background: none; border: 0; padding: 14px 16px; font-weight: 700; color: var(--muted); position: relative; transition: color .2s; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); }
.tab-ink { position: absolute; bottom: -1px; height: 3px; background: var(--ink); border-radius: 3px; transition: right .35s var(--ease), width .35s var(--ease); }
.tab-body { padding: 24px 26px 60px; max-width: 980px; }
.tab-body .pane { animation: viewIn .35s var(--ease); }

.ov-h { font-size: 26px; font-weight: 800; margin: 0 0 6px; line-height: 1.4; }
.ov-sub { color: var(--muted); margin: 0 0 18px; }
.kpis { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 22px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; min-width: 120px; }
.kpi b { display: block; font-size: 22px; }
.kpi span { color: var(--muted); font-size: 13px; }
.goal-box { background: var(--tint); border-inline-start: 5px solid var(--accent); padding: 12px 16px; border-radius: 10px; margin: 0 0 22px; line-height: 1.8; }
.learn-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; padding: 0; list-style: none; }
.learn-list li { display: flex; gap: 10px; align-items: center; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .2s, transform .2s; }
.learn-list li:hover { border-color: var(--accent); transform: translateY(-2px); }
.next-card { margin-top: 22px; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; background: linear-gradient(120deg, var(--tint), #fff); border: 1px solid var(--line); }
.next-card .ic { font-size: 30px; }

.transcript-search { width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; font: inherit; margin-bottom: 12px; background: #fff; }
.cue-row { display: flex; gap: 14px; padding: 8px 12px; border-radius: 10px; cursor: pointer; line-height: 1.9; transition: background .2s; }
.cue-row:hover { background: #f0efea; }
.cue-row .tm { color: var(--accent); font-weight: 700; font-size: 13px; direction: ltr; min-width: 44px; padding-top: 3px; }
.cue-row.active { background: var(--tint); }
.cue-row.active .tx { font-weight: 700; }
.cue-row.hide { display: none; }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.file { display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; transition: transform .2s var(--ease), box-shadow .2s; }
.file:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.file .ic { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 26px; background: var(--tint); flex: none; }
.file b { display: block; }
.file span { color: var(--muted); font-size: 13px; }

/* ---------- quiz ---------- */
.quiz { max-width: 760px; }
.quiz-start { text-align: center; padding: 30px 20px; background: var(--card); border-radius: 18px; border: 1px solid var(--line); }
.quiz-start .ic { font-size: 64px; animation: pop .6s var(--ease); }
.quiz-start h3 { font-size: 26px; margin: 8px 0; }
.quiz-start ul { list-style: none; padding: 0; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 16px 0 22px; color: var(--muted); }
.quiz-start li { background: #f2f2ef; border-radius: 20px; padding: 4px 14px; font-size: 14px; }
.q-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: var(--muted); font-weight: 700; font-size: 14px; }
.q-top .bar { flex: 1; height: 8px; }
.q-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 24px; animation: rise .4s var(--ease) both; }
.q-card.shake { animation: shake .5s; }
.q-type { font-size: 12.5px; font-weight: 700; color: var(--accent-dark); background: var(--tint); display: inline-block; padding: 2px 10px; border-radius: 20px; }
.q-text { font-size: 22px; font-weight: 800; margin: 12px 0 18px; line-height: 1.6; unicode-bidi: plaintext; }
.opts { display: grid; gap: 10px; }
.opts.tf { grid-template-columns: 1fr 1fr; }
.opt { text-align: start; padding: 14px 18px; border: 2px solid var(--line); background: #fff; border-radius: 14px; font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 12px; transition: border-color .15s, background .15s, transform .15s; unicode-bidi: plaintext; }
.opt .k { width: 30px; height: 30px; border-radius: 50%; background: #f2f2ef; display: flex; align-items: center; justify-content: center; font-size: 14px; flex: none; transition: all .2s; }
.opt:hover:not(:disabled) { border-color: var(--accent); transform: translateX(-3px); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); animation: pop .35s var(--ease); }
.opt.right .k { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .k { background: var(--bad); color: #fff; }
.opt:disabled { cursor: default; }
.num-row { display: flex; gap: 10px; }
.num-row input { flex: 1; font: inherit; font-size: 22px; font-weight: 800; padding: 10px 16px; border: 2px solid var(--line); border-radius: 14px; text-align: center; transition: border-color .2s; }
.num-row input:focus { outline: none; border-color: var(--accent); }
.num-row input.right { border-color: var(--ok); background: var(--ok-soft); }
.num-row input.wrong { border-color: var(--bad); background: var(--bad-soft); }
.feedback { margin-top: 16px; padding: 14px 16px; border-radius: 14px; line-height: 1.8; animation: rise .35s var(--ease) both; }
.feedback.ok { background: var(--ok-soft); color: #11623f; }
.feedback.no { background: var(--bad-soft); color: #8c2323; }
.feedback b { display: block; font-size: 17px; }
.q-nav { display: flex; justify-content: flex-end; margin-top: 16px; }
.result { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 28px 20px; }
.score-ring { width: 170px; height: 170px; margin: 0 auto 6px; position: relative; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 12; }
.score-ring .track { stroke: #eee; }
.score-ring .val { stroke-linecap: round; transition: stroke-dashoffset 1.4s var(--ease); }
.score-ring .num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score-ring .num b { font-size: 40px; line-height: 1; }
.score-ring .num span { color: var(--muted); font-size: 13px; }
.badge-pass { display: inline-flex; gap: 8px; align-items: center; font-weight: 800; padding: 6px 16px; border-radius: 30px; margin: 10px 0; animation: pop .5s .9s var(--ease) both; }
.badge-pass.ok { background: var(--ok-soft); color: var(--ok); }
.badge-pass.no { background: #fff4e0; color: #a86400; }
.review { text-align: start; margin-top: 18px; display: grid; gap: 8px; }
.review div { display: flex; gap: 10px; padding: 8px 12px; border-radius: 10px; background: #f7f7f4; font-size: 14.5px; }

/* ---------- sidebar curriculum ---------- */
.side-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.side-head h3 { margin: 0 0 4px; font-size: 17px; }
.side-head .sub { color: var(--muted); font-size: 13px; }
.side-head .bar { margin-top: 10px; height: 8px; }
.unit { border-bottom: 1px solid var(--line); }
.unit-h { width: 100%; background: #f7f7f4; border: 0; text-align: start; padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 800; font-size: 14.5px; }
.unit-h .chev { transition: transform .3s var(--ease); }
.unit.closed .chev { transform: rotate(90deg); }
.unit-b { overflow: hidden; transition: max-height .4s var(--ease); max-height: 2000px; }
.unit.closed .unit-b { max-height: 0; }
.lesson-h { padding: 12px 20px 4px; font-size: 13px; color: var(--muted); font-weight: 700; }
.obj { display: flex; gap: 12px; padding: 11px 20px; align-items: flex-start; cursor: pointer; transition: background .15s; position: relative; }
.obj:hover { background: #f7f6fb; }
.obj.current { background: var(--tint); }
.obj.current::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); animation: viewIn .3s; }
.obj .st { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #c9c9c4; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; margin-top: 2px; transition: all .3s; }
.obj.done .st { background: var(--ok); border-color: var(--ok); color: #fff; animation: pop .4s var(--ease); }
.obj.locked { cursor: default; }
.obj.locked .ttl { color: var(--muted); }
.obj .ttl { font-size: 14px; line-height: 1.6; font-weight: 600; }
.obj .sub { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 12.5px; margin-top: 4px; flex-wrap: wrap; }
.obj .mini { width: 70px; height: 4px; }
.obj .tag { background: #f2f2ef; border-radius: 6px; padding: 0 8px; }
.obj .tag.ok { background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; }
.empty { color: var(--muted); padding: 30px; text-align: center; }

/* ---------- app shell (all sizes) ---------- */
html, body { overflow-x: clip; -webkit-tap-highlight-color: transparent; }
.topbar-slot { overflow: hidden; }
.back-btn { display: none; background: none; border: 0; color: #fff; font-size: 24px; width: 40px; height: 40px; border-radius: 50%; flex: none; }
.back-btn:active { background: rgba(255,255,255,.15); }
.bottom-nav, .tab[data-tab="curriculum"], .gesture, .m-only { display: none; }
.view.fwd { animation: slideFwd .38s var(--ease); }
.view.back { animation: slideBack .38s var(--ease); }
@keyframes slideFwd { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes slideBack { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }

/* install prompt (bottom sheet) */
.install { position: fixed; inset-inline: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60; background: var(--dark); color: #fff; border-radius: 18px; padding: 14px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-lg); animation: sheetUp .45s var(--ease); max-width: 520px; margin: 0 auto; }
.install[hidden] { display: none; }
.install img { width: 46px; height: 46px; border-radius: 12px; flex: none; }
.install div { flex: 1; font-size: 14px; line-height: 1.6; }
.install b { display: block; font-size: 15px; }
.install .x { background: none; border: 0; color: #aaa; font-size: 22px; }
@keyframes sheetUp { from { transform: translateY(120%); } to { transform: none; } }

/* achievements */
.me-head { display: flex; align-items: center; gap: 16px; margin: 26px 0 18px; }
.me-avatar { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, #4a2a91, #0f9aa8); color: #fff; font-size: 30px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); }
.me-head h1 { margin: 0; font-size: 24px; } .me-head p { margin: 2px 0 0; color: var(--muted); }
.me-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.me-stat { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.me-stat .ic { font-size: 24px; } .me-stat b { display: block; font-size: 28px; line-height: 1.3; } .me-stat span { color: var(--muted); font-size: 13px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge-card { background: var(--card); border-radius: 16px; padding: 16px 12px; text-align: center; box-shadow: var(--shadow); transition: transform .2s var(--ease); }
.badge-card .bi { font-size: 40px; display: block; margin-bottom: 6px; }
.badge-card b { display: block; font-size: 14px; } .badge-card span { color: var(--muted); font-size: 12px; }
.badge-card.locked { opacity: .45; filter: grayscale(1); }
.badge-card.got .bi { animation: pop .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms); }
.me-course { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); margin-bottom: 10px; }
.me-course .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--tint); display: flex; align-items: center; justify-content: center; font-size: 22px; flex: none; }
.me-course .grow { flex: 1; min-width: 0; } .me-course b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-course .bar { margin-top: 6px; }

/* touch players (any size) */
.player.touch .controls { padding-top: 40px; }
.player.touch .seek .rail { height: 7px; top: 5.5px; }
.player.touch .seek .knob { transform: translateX(50%) scale(1); }
.player.touch .cbtn { height: 42px; min-width: 42px; }
.player.touch.playing:not(.show-controls) .big-play { opacity: 0; }
.player.touch.show-controls .big-play { opacity: 1; pointer-events: auto; transform: none; }
.gesture { position: absolute; top: 0; bottom: 0; width: 40%; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 4; }
.gesture.l { left: 0; border-radius: 0 50% 50% 0; } .gesture.r { right: 0; border-radius: 50% 0 0 50%; }
.gesture.show { display: flex; animation: ripple .6s ease-out forwards; background: rgba(255,255,255,.14); }
.gesture span { background: rgba(0,0,0,.55); color: #fff; font-weight: 800; padding: 8px 16px; border-radius: 30px; font-size: 18px; direction: ltr; }
@keyframes ripple { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }
.player:fullscreen { max-height: none; aspect-ratio: auto; }
.player:fullscreen video { object-fit: contain; }

/* ---------- phones: native-app layout ---------- */
@media (max-width: 760px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.in-course { padding-bottom: 0; }
  .topbar { height: calc(54px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; gap: 8px; }
  .brand small, .topbar-slot .course-name, .ring-prog > span { display: none; }
  .brand { font-size: 16px; }
  body.in-course .back-btn { display: inline-flex; align-items: center; justify-content: center; }
  body.in-course .brand span:not(.logo) { display: none; }
  body.in-course .topbar-slot .course-name { display: block; max-width: 60vw; font-size: 14px; }
  .topbar-slot { margin-inline-start: auto; }

  .bottom-nav { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 55; height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: rgba(255,255,255,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
  body.in-course .bottom-nav { display: none; }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11.5px; font-weight: 700; color: var(--muted); transition: color .2s; }
  .bottom-nav a .ni { font-size: 22px; transition: transform .3s var(--ease); filter: grayscale(.6); }
  .bottom-nav a.active { color: var(--ink); }
  .bottom-nav a.active .ni { transform: translateY(-3px) scale(1.12); filter: none; }
  .bottom-nav a:active .ni { transform: scale(.85); }
  .nav-ink { position: absolute; top: 0; height: 3px; width: calc(100% / 3 - 40px); background: var(--ink); border-radius: 0 0 4px 4px; transition: right .35s var(--ease); }
  .install { bottom: calc(76px + env(safe-area-inset-bottom)); }

  /* home */
  .page { padding: 0 14px 30px; }
  .hero { margin: 14px 0 4px; padding: 20px 18px; border-radius: 20px; }
  .hero::after { font-size: 40px; bottom: -8px; }
  .hero h1 { font-size: 22px; } .hero p { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .stats { flex-wrap: nowrap; overflow-x: auto; margin: 14px -18px 0; padding: 0 18px 2px; scrollbar-width: none; gap: 8px; }
  .stats::-webkit-scrollbar { display: none; }
  .stat { min-width: 104px; padding: 8px 12px; flex: none; } .stat b { font-size: 21px; }
  .section-h { margin: 22px 0 10px; } .section-h h2 { font-size: 18px; }
  .continue { grid-template-columns: 128px 1fr; border-radius: 16px; }
  .continue img { aspect-ratio: auto; height: 100%; }
  .continue .body { padding: 12px 14px; gap: 4px; } .continue .t { font-size: 15px; } .continue .kicker { font-size: 12px; }
  .continue .play { padding: 6px 12px; font-size: 13px; margin-top: 4px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .course-card { flex-direction: row; border-radius: 16px; min-height: 112px; }
  .course-card:hover { transform: none; }
  .course-card:active { transform: scale(.98); }
  .course-card .cover { width: 116px; aspect-ratio: auto; flex: none; font-size: 40px; }
  .course-card .cover .badge { top: auto; bottom: 6px; right: 6px; font-size: 10.5px; padding: 1px 7px; }
  .course-card .body { padding: 10px 12px; gap: 4px; min-width: 0; }
  .course-card .t { font-size: 14.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .course-card .meta { font-size: 11.5px; gap: 8px; }
  .chip { font-size: 11px; padding: 1px 8px; }
  .upload-zone { min-height: 120px; padding: 16px; } .upload-zone .big { font-size: 32px; }

  /* course screen: sticky player, curriculum becomes a tab */
  .learn { display: block; min-height: 0; }
  .learn-side { display: none; }
  .player { position: sticky; top: calc(54px + env(safe-area-inset-top)); z-index: 20; max-height: none; }
  .player .big-play { width: 68px; height: 68px; font-size: 28px; }
  .captions { bottom: 58px; max-width: 94%; } .captions span { font-size: 14.5px; padding: 2px 10px; }
  .player:not(.show-controls).playing .captions { bottom: 12px; }
  .controls { padding: 30px 8px 4px; }
  .ctrl-row { gap: 2px; margin-top: 2px; } .ctime { font-size: 12.5px; }
  .chapter-name, [data-a="back"], [data-a="fwd"] { display: none; }
  .cbtn[data-a="auto"] { font-size: 0; } .cbtn[data-a="auto"]::before { content: "⏸️"; font-size: 16px; }
  .timeline { padding: 10px 12px; gap: 6px; scrollbar-width: none; } .timeline::-webkit-scrollbar { display: none; }
  .tl-item { font-size: 12.5px; padding: 4px 10px 4px 8px; } .tl-item .dot { width: 22px; height: 22px; }
  .tabs { position: sticky; z-index: 15; top: calc(54px + env(safe-area-inset-top) + 56.25vw); padding: 0 6px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 12px 10px; white-space: nowrap; font-size: 14px; }
  .tab[data-tab="curriculum"] { display: inline-block; }
  .m-only { display: block; }
  .tab-body { padding: 16px 14px calc(30px + env(safe-area-inset-bottom)); }
  .tab-body .curriculum-pane { margin: -16px -14px 0; }
  .ov-h { font-size: 20px; } .kpis { gap: 8px; } .kpi { min-width: 0; flex: 1 1 40%; padding: 8px 12px; } .kpi b { font-size: 18px; }
  .learn-list { grid-template-columns: 1fr; }
  .files { grid-template-columns: 1fr; }
  .ov-card { padding: 18px 16px; border-radius: 18px; } .ov-card h3 { font-size: 19px; } .ov-card .ov-icon { font-size: 40px; }
  .ov-card .qtext { font-size: 22px; padding: 8px 12px; margin: 6px 0 12px; }
  .ov-card .actions .btn { flex: 1 1 100%; justify-content: center; padding: 12px; }
  .toast { top: 10px; right: 10px; font-size: 13px; padding: 6px 12px; }

  /* quiz: thumb-friendly with a sticky action bar */
  .q-card { padding: 18px 16px; border-radius: 16px; }
  .q-text { font-size: 19px; margin: 10px 0 14px; }
  .opts.tf { grid-template-columns: 1fr 1fr; }
  .opt { min-height: 56px; font-size: 16.5px; padding: 12px 14px; }
  .opt:hover:not(:disabled) { transform: none; }
  .opt:active:not(:disabled) { transform: scale(.98); background: #faf9ff; }
  .num-row input { font-size: 24px; padding: 12px; }
  .q-nav { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); margin-top: 14px; }
  .q-nav .btn { width: 100%; justify-content: center; padding: 14px; font-size: 16px; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
  .quiz-start { padding: 24px 14px; } .quiz-start .btn { width: 100%; justify-content: center; padding: 14px; }
  .score-ring { width: 150px; height: 150px; }
}
@media (max-width: 760px) and (orientation: landscape) {
  .player { position: relative; top: 0; }
  .tabs { position: static; }
}
