/* LearnAI — stylesheet */
:root {
  --ink: #101828;
  --ink-2: #1d2939;
  --paper: #f7f6f2;
  --surface: #ffffff;
  --line: #e6e4dd;
  --text: #1f2937;
  --muted: #667085;
  --accent: #ff6b3d;
  --accent-dark: #e4572a;
  --mint: #19c37d;
  --beginner: #22a06b;
  --intermediate: #2f6fed;
  --advanced: #8b5cf6;
  --expert: #f59e0b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.18);
  --font-head: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-body); color: var(--text); background: var(--paper); line-height: 1.55; font-size: 16px; }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink); line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 2.4rem; } h2 { font-size: 1.7rem; } h3 { font-size: 1.2rem; } h4 { font-size: 1.02rem; }
p { margin: 0 0 1rem; }
a { color: var(--ink); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
.muted { color: var(--muted); }
.tiny { font-size: .8rem; color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.mt { margin-top: 1.5rem; } .mb { margin-bottom: 1.5rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9em; background: #f0efe9; padding: .1em .35em; border-radius: 5px; }
pre { background: var(--ink); color: #e5e7eb; padding: 1rem 1.1rem; border-radius: 10px; overflow-x: auto; font-size: .88rem; line-height: 1.5; }
pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

/* top bar */
.topbar { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 62px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; font-weight: 700; }
.nav { display: flex; align-items: center; gap: 1.1rem; }
.nav a { color: #d0d5dd; text-decoration: none; font-weight: 500; font-size: .95rem; }
.nav a:hover { color: #fff; }
.nav .nav-user { color: #fff; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .65rem 1.15rem; border-radius: 10px; font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; font-family: var(--font-body); font-size: .95rem; line-height: 1.2; transition: transform .08s ease, background .15s ease; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff !important; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-dark { background: var(--ink); color: #fff !important; }
.btn-dark:hover { background: var(--ink-2); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); }
.btn-ghost { background: rgba(255,255,255,.1); color: #fff !important; }
.btn-ghost:hover { background: rgba(255,255,255,.18); }
.btn-sm { padding: .45rem .85rem; font-size: .85rem; }
.btn-lg { padding: .9rem 1.5rem; font-size: 1.05rem; }
.btn-danger { background: #fee4e2; color: #b42318 !important; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* flashes */
.flashes { margin-top: 1rem; }
.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: .5rem; font-weight: 500; }
.flash-ok { background: #e7f8f0; color: #067647; border: 1px solid #b7ebd2; }
.flash-error { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.course-card { display: block; text-decoration: none; color: inherit; transition: transform .12s ease, box-shadow .12s ease; border-top: 4px solid var(--line); }
.course-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -12px rgba(16,24,40,.28); }
.course-card h3 { margin: .6rem 0 .3rem; }
.course-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
.course-card-badges { display: flex; gap: .35rem; }
.course-icon { font-size: 1.9rem; line-height: 1; }
.course-meta { display: flex; gap: .4rem; font-size: .82rem; color: var(--muted); margin-top: .5rem; }
.course-card-progress { margin-top: .75rem; display: flex; align-items: center; gap: .6rem; }
.course-card-progress .bar { flex: 1; }
.lvl-border-beginner { border-top-color: var(--beginner); }
.lvl-border-intermediate { border-top-color: var(--intermediate); }
.lvl-border-advanced { border-top-color: var(--advanced); }
.lvl-border-expert { border-top-color: var(--expert); }

.badge { display: inline-block; padding: .18rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.lvl-beginner { background: #e6f6ee; color: var(--beginner); }
.lvl-intermediate { background: #e8effd; color: var(--intermediate); }
.lvl-advanced { background: #f1ebfe; color: var(--advanced); }
.lvl-expert { background: #fff3dc; color: #b45309; }
.badge-draft { background: #f2f4f7; color: var(--muted); }
.badge-ok { background: #e7f8f0; color: #067647; }
.badge-warn { background: #fff3dc; color: #b45309; }
.badge-kind { background: #f2f4f7; color: var(--muted); }

.bar { height: 8px; background: #ecebe5; border-radius: 999px; overflow: hidden; }
.bar-sm { height: 6px; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--mint), #0ea5e9); border-radius: 999px; transition: width .3s ease; }

/* hero */
.hero { background: var(--ink); color: #fff; padding: 4.5rem 0 4rem; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: -40% -20% auto auto; width: 60%; height: 140%; background: radial-gradient(closest-side, rgba(255,107,61,.35), transparent 70%); pointer-events: none; }
.hero::after { content: ""; position: absolute; left: -10%; bottom: -60%; width: 50%; height: 120%; background: radial-gradient(closest-side, rgba(25,195,125,.25), transparent 70%); pointer-events: none; }
.hero .wrap { position: relative; }
.hero h1 { color: #fff; font-size: 3rem; max-width: 720px; }
.hero p.lead { font-size: 1.2rem; color: #d0d5dd; max-width: 620px; }
.hero .eyebrow { color: var(--mint); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }
.hero-stats { display: flex; gap: 2rem; margin-top: 2rem; color: #d0d5dd; font-size: .9rem; }
.hero-stats strong { display: block; color: #fff; font-family: var(--font-head); font-size: 1.5rem; }
@media (max-width: 700px) { .hero h1 { font-size: 2.2rem; } .hero { padding: 3rem 0; } }

.section { padding: 3rem 0 1rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.section-head p { margin: 0; }

/* level ladder */
.ladder { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 900px) { .ladder { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .ladder { grid-template-columns: 1fr; } }
.ladder .step { position: relative; }
.ladder .step-num { font-family: var(--font-head); font-weight: 700; font-size: 2.4rem; opacity: .15; position: absolute; right: 1rem; top: .5rem; }
.ladder .lvl-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: .4rem; }
.dot-beginner { background: var(--beginner); } .dot-intermediate { background: var(--intermediate); }
.dot-advanced { background: var(--advanced); } .dot-expert { background: var(--expert); }

.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 800px) { .how { grid-template-columns: 1fr; } }
.how .card { border-top: 4px solid var(--accent); }
.how .num { font-family: var(--font-head); font-weight: 700; color: var(--accent); }

.cta-band { background: var(--ink); color: #fff; border-radius: 20px; padding: 2.5rem; margin: 3rem 0; display: flex; justify-content: space-between; align-items: center; gap: 2rem; flex-wrap: wrap; }
.cta-band h2 { color: #fff; margin: 0; }

/* forms */
form.stack { display: flex; flex-direction: column; gap: .9rem; }
label { font-weight: 500; font-size: .9rem; display: block; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea { width: 100%; padding: .65rem .8rem; border: 1px solid #d0d5dd; border-radius: 10px; font: inherit; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255,107,61,.35); border-color: var(--accent); }
textarea { min-height: 140px; resize: vertical; }
textarea.editor { min-height: 480px; font-family: ui-monospace, Consolas, monospace; font-size: .88rem; line-height: 1.5; }
.auth { max-width: 440px; margin: 3rem auto; }
.auth h1 { font-size: 1.8rem; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.check input { width: auto; }
.inline-form { display: inline; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: .92rem; background: #fff; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--line); border-radius: 10px; }
.table-wrap table { margin: 0; }
.table-wrap th, .table-wrap td { padding: .5rem .7rem; }

/* course page */
.course-hero { display: grid; grid-template-columns: 1.6fr 1fr; gap: 2rem; padding: 2.5rem 0 1rem; align-items: start; }
@media (max-width: 860px) { .course-hero { grid-template-columns: 1fr; } }
.course-hero h1 { font-size: 2.2rem; }
.course-side { position: sticky; top: 80px; }
.course-side .card { border-top: 4px solid var(--accent); }
.kv { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.kv:last-child { border-bottom: 0; }
.outline { margin-top: 1.5rem; }
.module { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .9rem; overflow: hidden; }
.module-head { display: flex; align-items: center; gap: .8rem; padding: .9rem 1.1rem; background: #fbfaf7; border-bottom: 1px solid var(--line); }
.module-head h3 { margin: 0; font-size: 1.05rem; flex: 1; }
.module-num { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; font-family: var(--font-head); font-weight: 600; font-size: .85rem; }
.module-num.done { background: var(--mint); }
.module-desc { padding: .6rem 1.1rem 0; color: var(--muted); font-size: .9rem; margin: 0; }
.lesson-list { list-style: none; margin: 0; padding: .4rem 0; }
.lesson-list li { display: flex; align-items: center; gap: .6rem; padding: .5rem 1.1rem; font-size: .93rem; border-top: 1px solid #f2f1ec; }
.lesson-list li a { text-decoration: none; color: var(--ink); flex: 1; }
.lesson-list li a:hover { text-decoration: underline; }
.lesson-list .tick { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #d0d5dd; display: inline-grid; place-items: center; font-size: .7rem; color: #fff; flex-shrink: 0; }
.lesson-list .tick.done { background: var(--mint); border-color: var(--mint); }
.lesson-list .kind { font-size: .72rem; color: var(--muted); }
.outcomes li { margin-bottom: .35rem; }
.prereq { background: #fff8eb; border: 1px solid #fde4b8; padding: .8rem 1rem; border-radius: 10px; font-size: .92rem; margin: 1rem 0; }

/* learn layout */
.learn { display: grid; grid-template-columns: 300px 1fr; gap: 0; min-height: calc(100vh - 62px); }
@media (max-width: 900px) { .learn { grid-template-columns: 1fr; } .learn-side { position: static !important; max-height: none !important; border-right: 0 !important; border-bottom: 1px solid var(--line); } }
.learn-side { background: #fff; border-right: 1px solid var(--line); padding: 1.25rem 1rem; position: sticky; top: 62px; max-height: calc(100vh - 62px); overflow-y: auto; }
.learn-side h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1rem 0 .4rem; }
.learn-side .course-link { font-family: var(--font-head); font-weight: 600; text-decoration: none; display: block; margin-bottom: .5rem; }
.learn-side ul { list-style: none; padding: 0; margin: 0; }
.learn-side li a { display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem; border-radius: 8px; text-decoration: none; font-size: .88rem; color: var(--text); }
.learn-side li a:hover { background: #f5f4ef; }
.learn-side li a.active { background: var(--ink); color: #fff; }
.learn-side .tick { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #d0d5dd; flex-shrink: 0; }
.learn-side .tick.done { background: var(--mint); border-color: var(--mint); }
.learn-side li a.active .tick { border-color: rgba(255,255,255,.5); }
.learn-main { padding: 2rem 2.5rem 4rem; max-width: 860px; }
@media (max-width: 700px) { .learn-main { padding: 1.5rem 1.25rem 3rem; } }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: .6rem; }
.crumbs a { color: var(--muted); }
.lesson-title { font-size: 2rem; }
.lesson-meta { color: var(--muted); font-size: .88rem; margin-bottom: 1.5rem; }
.prose h3 { margin-top: 1.8rem; font-size: 1.25rem; }
.prose h4 { margin-top: 1.3rem; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1rem; }
.prose li { margin-bottom: .35rem; }
.prose p { margin-bottom: 1rem; }
.prose pre { margin: 1rem 0 1.25rem; }
.callout { padding: .85rem 1rem .85rem 1.1rem; border-radius: 10px; margin: 1rem 0 1.25rem; font-size: .95rem; border-left: 4px solid; }
.callout.tip { background: #eef7f2; border-color: var(--mint); }
.callout.warn { background: #fff4f1; border-color: var(--accent); }
.callout.try { background: #eef3ff; border-color: var(--intermediate); }
.callout-label { display: inline-block; font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--intermediate); margin-right: .5rem; }
.lesson-actions { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.done-pill { display: inline-flex; align-items: center; gap: .4rem; color: #067647; font-weight: 600; }
.exercise-box { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-top: 2rem; }
.feedback { background: #eef7f2; border-radius: 10px; padding: .9rem 1rem; margin-top: .8rem; }

/* quiz */
.question { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.question h4 { margin-bottom: .7rem; }
.option { display: flex; align-items: flex-start; gap: .6rem; padding: .5rem .6rem; border-radius: 8px; cursor: pointer; }
.option:hover { background: #f7f6f2; }
.option input { margin-top: .25rem; }
.option.correct { background: #e7f8f0; }
.option.wrong { background: #fef3f2; }
.result-card { text-align: center; padding: 2rem; }
.result-card .score { font-family: var(--font-head); font-size: 3rem; font-weight: 700; }
.result-pass .score { color: #067647; } .result-fail .score { color: #b42318; }
.why { font-size: .88rem; color: var(--muted); margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--line); }

/* dashboard */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 1.5rem 0; }
@media (max-width: 800px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat strong { display: block; font-family: var(--font-head); font-size: 1.7rem; color: var(--ink); }
.stat span { font-size: .82rem; color: var(--muted); }
.enrolled-card { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; }
@media (max-width: 640px) { .enrolled-card { grid-template-columns: 1fr; } }
.enrolled-card .course-icon { font-size: 2.2rem; }
.enrolled-card h3 { margin: 0 0 .25rem; }
.enrolled-card .bar { margin-top: .5rem; }

/* certificate */
.cert { max-width: 860px; margin: 2rem auto; background: #fff; border: 10px double var(--ink); padding: 3rem 3.5rem; text-align: center; position: relative; }
.cert .cert-org { letter-spacing: .2em; text-transform: uppercase; font-size: .8rem; color: var(--muted); }
.cert h1 { font-size: 2.6rem; margin: .5rem 0 1.5rem; }
.cert .learner { font-family: var(--font-head); font-size: 2rem; color: var(--accent); margin: .5rem 0; }
.cert .course-name { font-family: var(--font-head); font-size: 1.5rem; margin: .5rem 0 1rem; }
.cert .cert-foot { display: flex; justify-content: space-between; margin-top: 2.5rem; font-size: .85rem; color: var(--muted); }
.cert .seal { position: absolute; right: 2rem; top: 2rem; width: 70px; height: 70px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; transform: rotate(-12deg); }
@media print { .topbar, .footer, .flashes, .no-print { display: none !important; } body { background: #fff; } .cert { margin: 0; border-width: 8px; } }

/* admin */
.admin-nav { display: flex; gap: .3rem; flex-wrap: wrap; margin: 1.5rem 0; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.admin-nav a { padding: .45rem .8rem; border-radius: 8px; text-decoration: none; font-weight: 500; font-size: .92rem; color: var(--muted); }
.admin-nav a.active, .admin-nav a:hover { background: var(--ink); color: #fff; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.editor-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 1000px) { .editor-wrap { grid-template-columns: 1fr; } }
.preview { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; min-height: 480px; max-height: 80vh; overflow-y: auto; }
.help { font-size: .82rem; color: var(--muted); background: #f5f4ef; padding: .6rem .8rem; border-radius: 8px; }
.sub { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 1rem 1.2rem; margin-bottom: 1rem; }
.sub-body { white-space: pre-wrap; background: #fbfaf7; padding: .8rem; border-radius: 8px; font-size: .92rem; margin: .6rem 0; }
details > summary { cursor: pointer; font-weight: 500; }

/* footer */
.footer { border-top: 1px solid var(--line); margin-top: 3rem; padding: 1.5rem 0; font-size: .88rem; }
.footer-in { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer a { color: var(--muted); }

/* filters */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0 1.5rem; }
.chip { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: #fff; text-decoration: none; font-size: .85rem; color: var(--text); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
