:root {
  --indigo: #6366f1;
  --indigo-d: #4f46e5;
  --violet: #8b5cf6;
  --purple: #a855f7;
  --ink: #0f172a;
  --ink-2: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 10px 30px -10px rgba(79,70,229,.25);
  --shadow-lg: 0 30px 60px -15px rgba(79,70,229,.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* ===== NAV ===== */
nav.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 20px; }
.logo { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; }
.logo-badge {
  width: 36px; height: 36px; border-radius: 10px; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-size: 18px; box-shadow: var(--shadow);
}
.logo a:hover { opacity: .8; }
.nav-right { display: flex; align-items: center; gap: 14px; }
.search-box { position: relative; }
.search-box input {
  width: 280px; padding: 10px 14px 10px 38px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; font: inherit; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.search-box input:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.search-box .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .5; }
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #fff;
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  overflow: hidden; display: none; max-height: 400px; overflow-y: auto; z-index: 100;
}
.search-results.show { display: block; }
.search-results a { display: block; padding: 12px 16px; border-bottom: 1px solid #f1f5f9; }
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: #f8fafc; }
.search-results .r-title { font-weight: 700; font-size: 14px; color: var(--ink); }
.search-results .r-snip { font-size: 12px; color: var(--muted); margin-top: 2px; }
.search-empty { padding: 16px; color: var(--muted); font-size: 14px; text-align: center; }
.nav-stats { font-size: 14px; color: var(--muted); font-weight: 600; }
.pill { background: var(--grad-soft); color: var(--indigo); padding: 7px 14px; border-radius: 999px; border: 1px solid #e0e7ff; }
.btn-logout { background: transparent; border: 1px solid var(--border); padding: 8px 14px; border-radius: 10px; cursor: pointer; font: inherit; font-weight: 600; font-size: 14px; color: var(--muted); transition: all .15s; }
.btn-logout:hover { background: #fef2f2; border-color: #fecaca; color: #dc2626; }

/* ===== HERO ===== */
.hero { position: relative; overflow: hidden; background: var(--grad); color: #fff; padding: 90px 0 110px; }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.hero::before { width: 420px; height: 420px; background: #f0abfc; top: -120px; right: -60px; }
.hero::after { width: 360px; height: 360px; background: #38bdf8; bottom: -140px; left: -80px; }
.hero-inner { position: relative; z-index: 2; display: grid; grid-template-columns: 1.4fr 1fr; gap: 60px; align-items: center; }
.badge-top {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  margin-bottom: 24px; backdrop-filter: blur(8px);
}
.hero h1 { font-size: 52px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 20px; }
.hero p.lead { font-size: 19px; opacity: .92; max-width: 560px; margin-bottom: 32px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 15px 28px; border-radius: 12px; font-weight: 700; font-size: 16px; cursor: pointer; border: none; transition: transform .15s, box-shadow .15s, background .15s; font-family: inherit; }
.btn-light { background: #fff; color: var(--indigo); box-shadow: var(--shadow); }
.btn-light:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-ghost { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.22); transform: translateY(-2px); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-outline { background: #fff; color: var(--indigo); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--indigo); background: #f8faff; }
.btn-sm { padding: 10px 18px; font-size: 14px; border-radius: 10px; }

.ring-card { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); border-radius: 24px; padding: 32px; backdrop-filter: blur(10px); text-align: center; }
.ring { width: 160px; height: 160px; margin: 0 auto 18px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring .track { stroke: rgba(255,255,255,.2); }
.ring .bar { stroke: #fff; stroke-linecap: round; }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; font-weight: 800; }
.ring-card .label { font-size: 15px; opacity: .9; line-height: 1.5; }

/* ===== SECTIONS ===== */
section { padding: 80px 0; }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 56px; }
.section-head .eyebrow { color: var(--violet); font-weight: 700; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; }
.section-head h2 { font-size: 38px; font-weight: 800; letter-spacing: -0.02em; margin: 10px 0 14px; }
.section-head p { color: var(--muted); font-size: 17px; }

/* ===== MODULES ===== */
.modules-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.module-card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 30px; position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; display: block; }
.module-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: transparent; }
.module-card .glow { position: absolute; top: -60px; right: -60px; width: 160px; height: 160px; border-radius: 50%; opacity: .12; filter: blur(30px); }
.mc-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 26px; background: var(--grad-soft); margin-bottom: 18px; box-shadow: inset 0 0 0 1px rgba(99,102,241,.12); }
.module-card h3 { font-size: 21px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.01em; }
.module-card .desc { color: var(--muted); font-size: 15px; margin-bottom: 20px; min-height: 44px; }
.mc-meta { display: flex; gap: 16px; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 16px; flex-wrap: wrap; }
.mc-meta span { display: inline-flex; align-items: center; gap: 6px; }
.progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.progress-bar { flex: 1; height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--grad); border-radius: 999px; transition: width .5s ease; }
.progress-row .num { font-size: 13px; font-weight: 700; color: var(--ink-2); min-width: 38px; text-align: right; }
.mc-cta { display: inline-flex; align-items: center; gap: 8px; color: var(--indigo); font-weight: 700; font-size: 15px; }
.mc-cta .arr { transition: transform .2s; }
.module-card:hover .mc-cta .arr { transform: translateX(4px); }

/* ===== STATS ===== */
.stats-strip { background: var(--ink); color: #fff; padding: 40px 0; }
.stats-inner { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; text-align: center; }
.stat .big { font-size: 36px; font-weight: 800; background: linear-gradient(135deg,#a78bfa,#f0abfc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat .lbl { font-size: 14px; opacity: .7; margin-top: 4px; }

/* ===== FEATURES ===== */
.features { background: linear-gradient(180deg, #faf9ff 0%, #f8fafc 100%); }
.features-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 24px; transition: transform .15s, box-shadow .15s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; font-size: 22px; margin-bottom: 14px; box-shadow: var(--shadow); }
.feature h4 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 14px; }

/* ===== FOOTER ===== */
footer { background: var(--ink); color: rgba(255,255,255,.6); padding: 40px 0; font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }

/* ===== LOGIN ===== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--grad); position: relative; overflow: hidden; padding: 24px; }
.login-wrap::before, .login-wrap::after { content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.login-wrap::before { width: 400px; height: 400px; background: #f0abfc; top: -100px; right: -80px; }
.login-wrap::after { width: 350px; height: 350px; background: #38bdf8; bottom: -120px; left: -80px; }
.login-card { position: relative; z-index: 2; background: #fff; border-radius: 24px; padding: 44px; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); }
.login-card .lc-logo { width: 64px; height: 64px; border-radius: 18px; background: var(--grad); display: grid; place-items: center; font-size: 30px; margin: 0 auto 22px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 26px; font-weight: 800; text-align: center; margin-bottom: 8px; letter-spacing: -0.01em; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 15px; margin-bottom: 28px; }
.login-card label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.login-card input[type=password] { width: 100%; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--border); font: inherit; font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.login-card input[type=password]:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 18px; }
.error-msg { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 18px; font-weight: 600; }
.login-hint { text-align: center; color: var(--muted-2); font-size: 13px; margin-top: 20px; }
.login-hint code { background: #f1f5f9; padding: 2px 8px; border-radius: 6px; color: var(--indigo); font-weight: 700; }

/* ===== LESSON LAYOUT ===== */
.lesson-layout { display: grid; grid-template-columns: 300px 1fr; gap: 0; max-width: 1280px; margin: 0 auto; padding: 32px 24px; align-items: start; }
.lesson-sidebar { position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 20px; }
.lesson-sidebar::-webkit-scrollbar { width: 6px; }
.lesson-sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.sb-module { margin-bottom: 22px; }
.sb-module-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin-bottom: 10px; padding-left: 12px; }
.sb-link { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 2px; transition: background .15s; line-height: 1.4; }
.sb-link:hover { background: #f1f5f9; }
.sb-link.active { background: var(--grad-soft); color: var(--indigo); }
.sb-link .mark { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.sb-link.done .lesson-title { color: var(--muted); }
.sb-link.done .lesson-title.queued { text-decoration: line-through; text-decoration-color: var(--muted-2); }

/* ===== LESSON CONTENT ===== */
.lesson-main { min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 48px 56px; box-shadow: var(--shadow-sm); }
.lesson-breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 18px; font-weight: 600; }
.lesson-breadcrumb a:hover { color: var(--indigo); }
.lesson-content { font-size: 17px; line-height: 1.75; color: var(--ink-2); }
.lesson-content h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 8px; line-height: 1.2; }
.lesson-content h2 { font-size: 24px; font-weight: 800; color: var(--ink); margin: 40px 0 14px; letter-spacing: -0.01em; }
.lesson-content h3 { font-size: 19px; font-weight: 700; color: var(--ink); margin: 28px 0 10px; }
.lesson-content p { margin: 14px 0; }
.lesson-content ul, .lesson-content ol { margin: 14px 0; padding-left: 24px; }
.lesson-content li { margin: 6px 0; }
.lesson-content blockquote { border-left: 4px solid var(--violet); background: var(--grad-soft); padding: 14px 18px; border-radius: 0 12px 12px 0; margin: 18px 0; color: var(--ink-2); }
.lesson-content blockquote p { margin: 4px 0; }
.lesson-content code { background: #f1f5f9; color: var(--indigo); padding: 2px 7px; border-radius: 6px; font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace; font-size: 14px; }
.lesson-content pre { background: #0f172a; color: #e2e8f0; padding: 20px; border-radius: 14px; overflow-x: auto; margin: 18px 0; font-size: 14px; line-height: 1.6; }
.lesson-content pre code { background: transparent; color: inherit; padding: 0; font-size: 14px; }
.lesson-content table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 15px; }
.lesson-content th, .lesson-content td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; }
.lesson-content th { background: #f8fafc; font-weight: 700; color: var(--ink); }
.lesson-content tr:nth-child(even) td { background: #fafbfc; }
.lesson-content hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.lesson-content input[type="checkbox"] { width: 16px; height: 16px; margin-right: 6px; vertical-align: middle; accent-color: var(--indigo); }
.lesson-content li.task { list-style: none; margin-left: -20px; }
.lesson-content img { max-width: 100%; border-radius: 12px; }
.lesson-content strong { color: var(--ink); font-weight: 700; }
.lesson-content a { color: var(--indigo); text-decoration: underline; text-decoration-color: rgba(99,102,241,.3); }

/* ===== NOTES & ACTIONS ===== */
.lesson-actions { margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--border); }
.notes-block { background: #faf9ff; border: 1px solid #ede9fe; border-radius: 16px; padding: 22px; margin-bottom: 22px; }
.notes-block h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.notes-block textarea { width: 100%; min-height: 130px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: #fff; font: inherit; font-size: 14px; resize: vertical; font-family: inherit; transition: border-color .15s; }
.notes-block textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,.12); }
.notes-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 12px; }
.save-status { font-size: 13px; color: var(--muted); font-weight: 600; }
.save-status.ok { color: #16a34a; }
.btn-save { background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 9px; border: none; font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; transition: background .15s; }
.btn-save:hover { background: var(--ink-2); }

.complete-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.complete-toggle { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 700; font-size: 16px; user-select: none; }
.complete-toggle input { display: none; }
.ct-box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--border); display: grid; place-items: center; transition: all .15s; flex-shrink: 0; }
.ct-box .chk { opacity: 0; color: #fff; font-size: 16px; transition: opacity .1s; }
.complete-toggle input:checked + .ct-box { background: var(--grad); border-color: transparent; }
.complete-toggle input:checked + .ct-box .chk { opacity: 1; }
.nav-arrows { display: flex; gap: 10px; }

.lesson-footer-note { margin-top: 24px; text-align: center; font-size: 13px; color: var(--muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 980px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-sidebar { position: static; max-height: none; margin-bottom: 24px; padding-right: 0; }
  .lesson-main { padding: 32px 24px; }
}
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .hero h1 { font-size: 38px; }
  .modules-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .stats-inner { grid-template-columns: repeat(2, 1fr); gap: 28px; }
  .hero { padding: 60px 0 80px; }
  .nav-stats { display: none; }
  .search-box input { width: 200px; }
  .lesson-content h1 { font-size: 28px; }
}
@media (max-width: 560px) {
  .search-box { display: none; }
  .hero h1 { font-size: 30px; }
  .section-head h2 { font-size: 28px; }
}
