/* ============================================================================
   GOLEARNAI — learning-specific components, layered on top of glass.css.
   Reuses glass.css design tokens (--bg, --yellow, --text, --glass-*, etc.).
   ============================================================================ */
:root {
  --sans: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', sans-serif;
  --mono: 'Courier New', Consolas, Monaco, monospace;
  --ai-from: #7c3aed;
  --ai-to:   #6366f1;
  --code-bg: #0d1117;
  --sidebar-w: 290px;
}

body { font-family: var(--sans); color: var(--text); }
a { color: #7ab4ff; }
.text-muted-2 { color: var(--muted); }

/* ── Brand word in navbar ── */
.brand-word { font-weight: 800; letter-spacing: .02em; color: var(--text); font-size: 1.05rem; }
.brand-word .brand-ai {
  background: linear-gradient(90deg, var(--yellow), #ffd600);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.nav-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .8rem; font-weight: 600; text-decoration: none;
  color: var(--text); background: var(--glass-bg);
  border: 1px solid var(--glass-bd); border-radius: 18px; padding: .35rem .8rem;
  transition: border-color .2s, transform .15s;
}
.nav-pill:hover { border-color: var(--yellow-bd); transform: translateY(-1px); color: var(--text); }
.nav-avatar-circle {
  width: 36px; height: 36px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: .74rem; font-weight: 800;
  color: #fff; letter-spacing: .03em; text-transform: uppercase;
  box-shadow: 0 0 0 2.5px rgba(255,255,255,.18), 0 2px 10px rgba(0,0,0,.45);
}

/* ── Alerts ── */
.gc-alert {
  border-radius: 12px; padding: .7rem 1rem; margin-bottom: .6rem; font-size: .9rem;
  background: var(--glass-bg); border: 1px solid var(--glass-bd); color: var(--text);
}
.gc-alert-success { border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.12); }
.gc-alert-error, .gc-alert-danger { border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.12); }

/* ── Buttons ── */
.btn-yellow {
  background: var(--yellow); color: #012A4A; font-weight: 700; border: none;
  border-radius: 28px; padding: .7rem 1.8rem; font-size: 1rem; text-decoration: none;
  display: inline-flex; align-items: center; gap: .5rem; transition: transform .15s, box-shadow .2s, background .2s;
}
.btn-yellow:hover { background: #fffb6e; transform: translateY(-2px); box-shadow: 0 8px 26px rgba(248,237,8,.35); color: #012A4A; }
.btn-glass {
  background: var(--glass-bg); color: var(--text); border: 1px solid var(--glass-bd);
  border-radius: 28px; padding: .7rem 1.6rem; text-decoration: none; display: inline-flex; align-items: center; gap: .5rem;
  transition: border-color .2s, transform .15s;
}
.btn-glass:hover { border-color: var(--yellow-bd); transform: translateY(-2px); color: var(--text); }

/* ============================================================================
   HOME — prompt hero + recent courses
   ============================================================================ */
.home-hero { padding: 4.5rem 0 2rem; text-align: center; position: relative; }
.home-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(124,58,237,.2); border: 1px solid rgba(124,58,237,.4); color: #c4b5fd;
  padding: 5px 14px; border-radius: 20px; font-size: .76rem; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; margin-bottom: 1.3rem;
}
.home-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: #a78bfa; animation: ping 1.6s ease-in-out infinite; }
@keyframes ping { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .4; transform: scale(1.4);} }
.home-title { font-size: clamp(2.2rem, 4.5vw, 3.8rem); font-weight: 800; line-height: 1.08; letter-spacing: -.02em; }
.home-title .grad {
  background: linear-gradient(90deg, var(--yellow), #ffd600);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.home-sub { color: var(--muted); font-size: 1.08rem; max-width: 620px; margin: 1rem auto 0; line-height: 1.65; }

.prompt-card {
  max-width: 720px; margin: 2rem auto 0; background: var(--glass-bg);
  border: 1px solid var(--glass-bd); border-radius: 22px; padding: 1rem;
  box-shadow: 0 18px 60px rgba(0,10,50,.45); backdrop-filter: blur(var(--glass-blur)) saturate(180%);
}
.prompt-card textarea {
  width: 100%; background: transparent; border: none; resize: none; outline: none;
  color: var(--text); font-size: 1.05rem; line-height: 1.5; padding: .6rem .7rem; min-height: 70px;
}
.prompt-card textarea::placeholder { color: var(--muted); }
.prompt-row { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: 0 .4rem; }
.prompt-hint { font-size: .78rem; color: var(--muted); }
.example-chips { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: 1.2rem; }
.example-chip {
  background: var(--card-bg); border: 1px solid var(--card-bd); color: var(--text);
  font-size: .82rem; border-radius: 18px; padding: .35rem .9rem; cursor: pointer; transition: border-color .2s, transform .15s;
}
.example-chip:hover { border-color: var(--yellow-bd); transform: translateY(-1px); }

/* Weekly generation quota banner */
.quota-banner {
  max-width: 720px; margin: 1.1rem auto 0; text-align: center; font-size: .88rem;
  color: var(--muted); background: var(--glass-bg); border: 1px solid var(--glass-bd);
  border-radius: 14px; padding: .6rem 1rem;
}
.quota-banner strong { color: var(--text); }
.quota-banner i { color: var(--yellow); margin-right: 5px; }
.quota-banner.limit { color: #f3d77a; background: var(--yellow-dim); border-color: var(--yellow-bd); }
.btn-yellow[disabled], .btn-yellow[aria-disabled="true"] {
  opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; background: #cabf3a;
}

/* Course search */
.course-search {
  display: flex; align-items: center; gap: .6rem; max-width: 620px; margin: 0 auto 1.6rem;
  background: var(--glass-bg); border: 1px solid var(--glass-bd); border-radius: 16px;
  padding: .4rem .4rem .4rem .9rem; position: relative;
}
.course-search > i.bi-search { color: var(--muted); font-size: 1rem; }
.course-search input {
  flex: 1; background: transparent; border: none; outline: none; color: var(--text);
  font-size: .95rem; padding: .5rem .2rem; min-width: 0;
}
.course-search input::placeholder { color: var(--muted); }
.course-search .btn-glass { padding: .5rem 1.1rem; border-radius: 12px; white-space: nowrap; }
.course-search .search-clear {
  color: var(--muted); text-decoration: none; font-size: 1.3rem; line-height: 1; padding: 0 .3rem;
}
.course-search .search-clear:hover { color: var(--yellow); }
@media (max-width: 480px) {
  .course-search { flex-wrap: wrap; padding: .5rem .7rem; }
  .course-search input { flex: 1 1 100%; }
  .course-search .btn-glass { flex: 1; text-align: center; justify-content: center; }
}

.section-head { text-align: center; margin: 3.5rem 0 1.6rem; }
.section-head h2 { font-size: clamp(1.5rem, 2.5vw, 2.1rem); font-weight: 800; }
.section-head p { color: var(--muted); }

.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.1rem; }
.course-card {
  background: var(--card-bg); border: 1px solid var(--card-bd); border-radius: 18px; padding: 1.3rem 1.25rem;
  text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: .6rem;
  transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s, border-color .25s; position: relative;
}
.course-card:hover {
  transform: translateY(-6px); border-color: var(--yellow-bd);
  box-shadow: 0 18px 48px rgba(0,20,80,.4); color: var(--text);
}
.course-card .cc-topic {
  align-self: flex-start; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--yellow); background: var(--yellow-dim); border: 1px solid var(--yellow-bd); padding: 2px 10px; border-radius: 12px;
}
.course-card .cc-title { font-size: 1.12rem; font-weight: 700; line-height: 1.25; }
.course-card .cc-desc { font-size: .86rem; color: var(--muted); line-height: 1.5; flex-grow: 1; }
.course-card .cc-meta { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .76rem; color: var(--muted); margin-top: .3rem; }
.course-card .cc-meta i { color: #7ab4ff; }
.course-card .cc-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .4rem; border-top: 1px solid var(--glass-bd2); padding-top: .7rem; }
.course-card .cc-author { font-size: .76rem; color: var(--muted); }
.course-card .cc-view { font-size: .82rem; font-weight: 700; color: var(--yellow); display: inline-flex; gap: 4px; align-items: center; }
.empty-state { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

/* ============================================================================
   GENERATING — progress
   ============================================================================ */
.gen-wrap { max-width: 640px; margin: 5rem auto; text-align: center; }
.gen-card { background: var(--glass-bg); border: 1px solid var(--glass-bd); border-radius: 22px; padding: 2.5rem 2rem; }
.gen-spinner { width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 1.4rem;
  background: linear-gradient(135deg, var(--ai-from), var(--ai-to)); display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: #fff; box-shadow: 0 8px 30px rgba(124,58,237,.45); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.08);} }
.progress-track { height: 12px; background: rgba(255,255,255,.08); border-radius: 8px; overflow: hidden; margin: 1.5rem 0 .6rem; }
.progress-fill { height: 100%; width: 0; border-radius: 8px; background: linear-gradient(90deg, var(--ai-from), var(--ai-to)); transition: width .6s ease; }
.progress-pct { font-weight: 800; font-size: 1.1rem; }

/* ============================================================================
   LEARNING — sidebar + content
   ============================================================================ */
.learn-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: calc(100vh - 58px); }
.learn-sidebar {
  background: var(--glass-bg2); border-right: 1px solid var(--glass-bd); padding: 1.1rem .8rem;
  position: sticky; top: 58px; height: calc(100vh - 58px); overflow-y: auto; backdrop-filter: blur(24px);
}
.ls-course-title { font-size: 1rem; font-weight: 800; padding: .2rem .5rem .1rem; }
.ls-progress-row { display: flex; align-items: center; gap: .5rem; padding: .2rem .5rem .8rem; font-size: .74rem; color: var(--muted); }
.ls-mini-track { flex: 1; height: 6px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden; }
.ls-mini-fill { height: 100%; background: linear-gradient(90deg, var(--yellow), #ffd600); }
.ls-list { list-style: none; margin: 0; padding: 0; }
.ls-item { display: flex; align-items: center; gap: .55rem; padding: .55rem .6rem; border-radius: 10px;
  text-decoration: none; color: var(--text); font-size: .86rem; line-height: 1.3; transition: background .15s; }
.ls-item:hover { background: rgba(255,255,255,.05); color: var(--text); }
.ls-item.active { background: var(--yellow-dim); border: 1px solid var(--yellow-bd); }
.ls-num { width: 22px; height: 22px; min-width: 22px; border-radius: 6px; background: rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; color: var(--muted); }
.ls-item.done .ls-num { background: rgba(34,197,94,.2); color: #4ade80; }
.ls-item.active .ls-num { background: var(--yellow); color: #012A4A; }
.ls-cap { color: var(--yellow); }
.ls-star { margin-left: auto; color: var(--yellow); font-size: .8rem; }

.learn-main { padding: 2rem clamp(1rem, 4vw, 3.5rem) 4rem; max-width: 920px; }
.lesson-eyebrow { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.lesson-h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 800; margin: .2rem 0 1rem; }
.lesson-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.6rem; }
.tool-btn { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 600;
  background: var(--glass-bg); border: 1px solid var(--glass-bd); color: var(--text); border-radius: 18px;
  padding: .4rem .9rem; cursor: pointer; transition: border-color .2s, transform .15s; }
.tool-btn:hover { border-color: var(--yellow-bd); transform: translateY(-1px); }
.tool-btn.is-on { background: rgba(34,197,94,.16); border-color: rgba(34,197,94,.5); color: #4ade80; }
.tool-btn.bm.is-on { background: var(--yellow-dim); border-color: var(--yellow-bd); color: var(--yellow); }

/* ── Lesson prose (rendered Markdown) ── */
.prose { font-size: 1rem; line-height: 1.75; color: #e6eefb; }
.prose h2 { font-size: 1.5rem; font-weight: 800; margin: 2rem 0 .8rem; }
.prose h3 { font-size: 1.2rem; font-weight: 700; margin: 1.6rem 0 .6rem; color: #cfe2ff; }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { margin: 0 0 1rem 1.3rem; }
.prose li { margin: .3rem 0; }
.prose a { color: #7ab4ff; }
.prose strong { color: #fff; }
.prose blockquote { border-left: 3px solid var(--yellow); background: var(--yellow-dim); padding: .7rem 1rem;
  border-radius: 0 10px 10px 0; margin: 1rem 0; color: #f3edc0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2rem 0; font-size: .9rem; }
.prose th, .prose td { border: 1px solid var(--glass-bd); padding: .55rem .8rem; text-align: left; }
.prose th { background: rgba(255,255,255,.05); font-weight: 700; }
.prose code { font-family: var(--mono); background: rgba(255,255,255,.08); padding: .12em .4em; border-radius: 5px; font-size: .88em; }
.prose pre { margin: 1.2rem 0; }
.prose pre code { background: none; padding: 0; }
.prose .admonition { border: 1px solid var(--glass-bd); border-left: 4px solid #7ab4ff; background: var(--glass-bg);
  border-radius: 0 10px 10px 0; padding: .8rem 1rem; margin: 1.2rem 0; }
.prose .admonition-title { font-weight: 700; margin-bottom: .3rem; color: #7ab4ff; }
.prose .admonition.tip { border-left-color: #4ade80; } .prose .admonition.tip .admonition-title { color: #4ade80; }
.prose .admonition.warning { border-left-color: #f59e0b; } .prose .admonition.warning .admonition-title { color: #f59e0b; }

/* ── Pygments highlight (dark) ── */
.highlight { background: var(--code-bg); border: 1px solid rgba(255,255,255,.1); border-radius: 12px; overflow: auto; }
.highlight pre { margin: 0; padding: 1rem 1.2rem; font-family: var(--mono); font-size: .85rem; line-height: 1.7; color: #e6edf3; background: none; }
.highlight .k, .highlight .kn, .highlight .kd, .highlight .kc, .highlight .kr { color: #f472b6; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd { color: #86efac; }
.highlight .nf, .highlight .fm { color: #818cf8; }
.highlight .nc, .highlight .nn { color: #67e8f9; }
.highlight .mi, .highlight .mf, .highlight .mh { color: #fbbf24; }
.highlight .c, .highlight .c1, .highlight .cm { color: #6272a4; font-style: italic; }
.highlight .o, .highlight .ow { color: #ff9d6c; }
.highlight .nb, .highlight .bp { color: #7ab4ff; }
.highlight .nd { color: #f59e0b; }

/* ── Code block wrapper (copy button) ── */
.codeblock { position: relative; }
.code-copy { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14); color: #cdd9e8; border-radius: 6px; font-size: .72rem;
  padding: 3px 8px; cursor: pointer; opacity: 0; transition: opacity .2s; }
.codeblock:hover .code-copy { opacity: 1; }
.code-copy:hover { background: rgba(255,255,255,.16); }

/* ── Interactive code examples (CodeMirror) ── */
.example-block { margin: 1.6rem 0; border: 1px solid var(--glass-bd); border-radius: 14px; overflow: hidden; background: var(--code-bg); }
.example-bar { display: flex; align-items: center; gap: 8px; padding: .55rem .9rem; background: rgba(255,255,255,.04); border-bottom: 1px solid rgba(255,255,255,.07); }
.example-bar .dot-r,.example-bar .dot-y,.example-bar .dot-g { width: 10px; height: 10px; border-radius: 50%; }
.dot-r { background:#ef4444;} .dot-y { background:#f59e0b;} .dot-g { background:#22c55e;}
.example-bar .ex-title { font-size: .76rem; color: var(--muted); font-family: var(--mono); margin-left: 6px; }
.example-bar .ex-actions { margin-left: auto; display: flex; gap: 6px; }
.ex-btn { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: #cdd9e8;
  border-radius: 6px; font-size: .72rem; padding: 3px 9px; cursor: pointer; }
.ex-btn:hover { background: rgba(255,255,255,.14); }
.CodeMirror { height: auto !important; background: var(--code-bg) !important; color: #e6edf3 !important;
  font-family: var(--mono) !important; font-size: 14px !important; line-height: 1.7 !important; }
.CodeMirror-gutters { background: #161b22 !important; border-right: 1px solid rgba(255,255,255,.06) !important; }

/* ── Quiz ── */
.quiz-section { margin: 2.4rem 0; }
.quiz-card { background: var(--glass-bg); border: 1px solid var(--glass-bd); border-radius: 14px; padding: 1.2rem 1.3rem; margin-bottom: 1rem; }
.quiz-q { font-weight: 700; margin-bottom: .8rem; }
.quiz-opt { display: block; width: 100%; text-align: left; background: var(--card-bg); border: 1px solid var(--card-bd);
  color: var(--text); border-radius: 10px; padding: .6rem .9rem; margin-bottom: .5rem; cursor: pointer; transition: border-color .15s, background .15s; }
.quiz-opt:hover { border-color: var(--yellow-bd); }
.quiz-opt.correct { background: rgba(34,197,94,.16); border-color: rgba(34,197,94,.55); }
.quiz-opt.wrong { background: rgba(239,68,68,.16); border-color: rgba(239,68,68,.55); }
.quiz-explain { margin-top: .5rem; font-size: .85rem; color: var(--muted); display: none; }
.quiz-explain.show { display: block; }

/* ── Section titles inside lesson ── */
.lesson-section-title { font-size: 1.3rem; font-weight: 800; margin: 2.4rem 0 1rem; display: flex; align-items: center; gap: .5rem; }
.lesson-section-title i { color: var(--yellow); }

/* ── Note panel ── */
.note-area { width: 100%; min-height: 110px; background: var(--code-bg); border: 1px solid var(--glass-bd);
  border-radius: 12px; color: var(--text); padding: .8rem 1rem; font-family: var(--sans); font-size: .92rem; resize: vertical; }
.note-status { font-size: .76rem; color: var(--muted); margin-top: .35rem; }

/* ── Lesson nav ── */
.lesson-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; border-top: 1px solid var(--glass-bd); padding-top: 1.5rem; }
.lesson-nav a { flex: 1; text-decoration: none; }
.lesson-nav .ln-card { background: var(--card-bg); border: 1px solid var(--card-bd); border-radius: 12px; padding: .8rem 1rem; transition: border-color .2s, transform .15s; }
.lesson-nav .ln-card:hover { border-color: var(--yellow-bd); transform: translateY(-2px); }
.lesson-nav .ln-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.lesson-nav .ln-title { font-weight: 700; font-size: .9rem; color: var(--text); }
.lesson-nav .next { text-align: right; }

/* ── Mobile sidebar drawer ── */
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; }
@media (max-width: 900px) {
  .learn-shell { grid-template-columns: 1fr; }
  .learn-main { padding: 1.4rem 1.1rem 4rem; max-width: 100%; }
  .learn-sidebar {
    position: fixed; left: 0; top: 56px; z-index: 1100; width: 86%; max-width: 330px;
    height: calc(100vh - 56px); transform: translateX(-105%);
    transition: transform .28s cubic-bezier(.16,1,.3,1); box-shadow: 0 0 60px rgba(0,0,0,.65);
  }
  .learn-sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: block; position: fixed; inset: 56px 0 0 0; z-index: 1050;
    background: rgba(0,0,0,.5); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .25s ease;
  }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .sidebar-toggle {
    display: inline-flex; align-items: center; gap: 6px; position: fixed; bottom: 18px; left: 18px; z-index: 1150;
    background: var(--yellow); color: #012A4A; font-weight: 700; border: none;
    border-radius: 24px; padding: .6rem 1.1rem; font-size: .85rem; cursor: pointer;
    box-shadow: 0 8px 26px rgba(248,237,8,.4);
  }
  body.drawer-open { overflow: hidden; }
}

/* ── Auth ── */
.auth-wrap { max-width: 430px; margin: 4rem auto; }
.auth-card { background: var(--glass-bg); border: 1px solid var(--glass-bd); border-radius: 20px; padding: 2.2rem 2rem;
  box-shadow: 0 18px 60px rgba(0,10,50,.45); }
.auth-card h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: .3rem; }
.auth-card .sub { color: var(--muted); font-size: .9rem; margin-bottom: 1.4rem; }
.auth-field { margin-bottom: 1rem; }
.auth-field label { font-size: .8rem; font-weight: 600; color: var(--muted); display: block; margin-bottom: .35rem; }
.auth-field input, .auth-field textarea {
  width: 100%; background: var(--code-bg); border: 1px solid var(--glass-bd); border-radius: 10px;
  color: var(--text); padding: .6rem .8rem; font-size: .95rem; outline: none; }
.auth-field input:focus { border-color: var(--yellow-bd); }
.auth-error { color: #f87171; font-size: .8rem; margin-top: .3rem; }
.auth-foot { text-align: center; margin-top: 1.2rem; color: var(--muted); font-size: .88rem; }
.auth-foot a { color: var(--yellow); text-decoration: none; }
.helptext, .helptext li { font-size: .74rem; color: var(--muted); }

/* ============================================================================
   LESSON LOADING + STREAMING REVEAL
   ============================================================================ */
.lesson-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; padding: 3rem 1rem; min-height: 280px; transition: opacity .3s ease;
}
.lesson-loading.done { opacity: 0; }
.ll-spinner {
  width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: #fff; background: linear-gradient(135deg, var(--ai-from), var(--ai-to));
  box-shadow: 0 8px 34px rgba(124,58,237,.5); animation: ll-pulse 1.6s ease-in-out infinite;
}
@keyframes ll-pulse { 0%,100% { transform: scale(1); box-shadow: 0 8px 34px rgba(124,58,237,.4);} 50% { transform: scale(1.1); box-shadow: 0 12px 46px rgba(124,58,237,.7);} }
.ll-text { color: var(--muted); font-size: 1rem; font-weight: 600; letter-spacing: .01em; }
.ll-dots span { animation: ll-dot 1.4s infinite; opacity: .2; }
.ll-dots span:nth-child(2) { animation-delay: .2s; }
.ll-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes ll-dot { 0%,80%,100% { opacity: .2; } 40% { opacity: 1; } }

/* Streamed-in blocks start hidden, then fade/slide in as "revealed". */
.streaming .stream-block { opacity: 0; transform: translateY(10px); }
.stream-block { transition: opacity .45s ease, transform .45s ease; }
.stream-block.revealed { opacity: 1; transform: none; }
.stream-caret {
  display: inline-block; width: 8px; height: 1.05em; margin-left: 3px; vertical-align: text-bottom;
  background: var(--yellow); border-radius: 2px; animation: caret-blink .8s step-end infinite;
}
@keyframes caret-blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* ============================================================================
   GLOBAL POLISH + RESPONSIVE
   ============================================================================ */
body { animation: pageFade .4s ease both; }
@keyframes pageFade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  body, .stream-block, .course-card, .btn-yellow, .tool-btn { animation: none !important; transition: none !important; }
}

/* Wide content (tables/code) scrolls instead of breaking the layout on mobile. */
.prose { overflow-wrap: break-word; }
.prose table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Tablet */
@media (max-width: 992px) {
  .home-hero { padding: 3rem 0 1.5rem; }
  .course-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
}

/* Phones */
@media (max-width: 600px) {
  .top-nav { padding: .6rem .4rem; }
  .home-hero { padding: 2.2rem 0 1rem; }
  .home-title { font-size: clamp(1.8rem, 7vw, 2.4rem); }
  .home-sub { font-size: .98rem; }
  .prompt-card { margin-top: 1.4rem; border-radius: 18px; }
  .prompt-row { flex-direction: column; align-items: stretch; gap: .6rem; }
  .prompt-row .btn-yellow { width: 100%; justify-content: center; }
  .course-grid { grid-template-columns: 1fr; }
  .lesson-h1 { font-size: 1.5rem; }
  .learn-main { padding: 1.1rem .9rem 5rem; }
  .lesson-toolbar { gap: .45rem; }
  .auth-wrap { margin: 2rem auto; padding: 0 .9rem; }
  .auth-card { padding: 1.6rem 1.2rem; }
  .lesson-nav { flex-direction: column; }
}

/* Large desktops: a touch more breathing room. */
@media (min-width: 1400px) {
  .learn-main { max-width: 1000px; }
}

/* ============================================================================
   STICKY NAV + NO HORIZONTAL OVERFLOW
   ============================================================================ */
body { overflow-x: hidden; }
/* !important required to beat glass.css's `.top-nav { position: relative !important }`
   so the nav actually sticks on desktop (not just <=900px). */
.top-nav, nav.navbar { position: sticky !important; top: 0 !important; z-index: 1000 !important; }
img, svg, table, pre, .CodeMirror { max-width: 100%; }

/* ============================================================================
   COURSE CARD — owner-only delete
   ============================================================================ */
.course-card-wrap { position: relative; }
.cc-delete-form { position: absolute; top: 10px; right: 10px; z-index: 5; margin: 0; }
.cc-delete {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--glass-bd);
  background: rgba(8,16,38,.62); color: var(--muted); cursor: pointer; display: flex;
  align-items: center; justify-content: center; font-size: .92rem;
  opacity: 0; transform: translateY(-4px); backdrop-filter: blur(8px);
  transition: opacity .2s ease, transform .2s ease, background .2s, color .2s, border-color .2s;
}
.course-card-wrap:hover .cc-delete { opacity: 1; transform: none; }
.cc-delete:hover { background: rgba(239,68,68,.22); border-color: rgba(239,68,68,.55); color: #f87171; }
/* Touch devices have no hover — always show the control. */
@media (hover: none) { .cc-delete { opacity: 1; transform: none; } }

/* ============================================================================
   MOBILE: glassmorphism drawer + responsive editor
   ============================================================================ */
@media (max-width: 900px) {
  .learn-sidebar {
    background: rgba(6,16,40,.72);
    backdrop-filter: blur(26px) saturate(160%);
    -webkit-backdrop-filter: blur(26px) saturate(160%);
    border-right: 1px solid var(--glass-bd);
    -webkit-overflow-scrolling: touch;   /* independent momentum scroll */
  }
}
@media (max-width: 600px) {
  .CodeMirror { font-size: 13px !important; line-height: 1.6 !important; }
  .example-block { border-radius: 10px; }
  .example-bar { flex-wrap: wrap; gap: 6px; }
  .example-bar .ex-actions { margin-left: auto; }
  .ex-btn { padding: 3px 7px; font-size: .68rem; }
  .lesson-section-title { font-size: 1.15rem; }
  .prose { font-size: .96rem; }
  .prose h2 { font-size: 1.3rem; }
  .cc-delete { opacity: 1; transform: none; }
}
