@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Syne:wght@400;600;700;800&display=swap');

:root {
  --bg: #0a0a0f;
  --surface: #111118;
  --surface2: #1a1a24;
  --border: #2a2a3a;
  --accent: #00e5ff;
  --accent2: #7c3aed;
  --accent3: #f59e0b;
  --green: #10b981;
  --red: #ef4444;
  --text: #e2e8f0;
  --muted: #64748b;
  --code-bg: #0d1117;
}

* { margin:0; padding:0; box-sizing:border-box; }
body { background:var(--bg); color:var(--text); font-family:'Syne',sans-serif; min-height:100vh; overflow-x:hidden; }

body::before {
  content:''; position:fixed; inset:0;
  background-image: linear-gradient(rgba(0,229,255,0.03) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(0,229,255,0.03) 1px, transparent 1px);
  background-size:40px 40px; pointer-events:none; z-index:0;
}

/* ===== HEADER ===== */
header {
  position:sticky; top:0; z-index:100;
  background:rgba(10,10,15,0.95); backdrop-filter:blur(20px);
  border-bottom:1px solid var(--border);
  padding:0 2rem;
  display:flex; align-items:center; justify-content:space-between;
  height:60px;
}
.logo { font-size:1.1rem; font-weight:800; letter-spacing:-0.5px; }
.logo span { color:var(--accent); }
.badge { background:var(--accent2); color:#fff; font-size:0.65rem; font-weight:700; padding:2px 8px; border-radius:20px; letter-spacing:1px; }
.header-right { display:flex; align-items:center; gap:10px; }
.header-right span { font-size:0.75rem; color:var(--muted); }

/* ===== NAV TABS ===== */
.nav-tabs {
  display:flex; gap:4px; padding:1rem 2rem 0; overflow-x:auto;
  position:relative; z-index:1; border-bottom:1px solid var(--border);
  scrollbar-width:none;
}
.nav-tabs::-webkit-scrollbar { display:none; }
.tab-btn {
  background:none; border:none; color:var(--muted); font-family:'Syne',sans-serif;
  font-size:0.8rem; font-weight:600; padding:8px 16px; cursor:pointer;
  border-bottom:2px solid transparent; transition:all 0.2s; white-space:nowrap;
  letter-spacing:0.5px; text-transform:uppercase;
}
.tab-btn:hover { color:var(--text); }
.tab-btn.active { color:var(--accent); border-bottom-color:var(--accent); }

/* ===== MAIN ===== */
main { position:relative; z-index:1; max-width:1100px; margin:0 auto; padding:2rem; }
.tab-content { display:none; }
.tab-content.active { display:block; animation:fadeIn 0.3s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

/* ===== HERO ===== */
.hero {
  background:linear-gradient(135deg, var(--surface) 0%, var(--surface2) 100%);
  border:1px solid var(--border); border-radius:16px;
  padding:2.5rem; margin-bottom:2rem; position:relative; overflow:hidden;
}
.hero::after {
  content:''; position:absolute; top:-40px; right:-40px; width:200px; height:200px;
  background:radial-gradient(circle, rgba(0,229,255,0.1) 0%, transparent 70%); border-radius:50%;
}
.hero h1 { font-size:2rem; font-weight:800; letter-spacing:-1px; line-height:1.1; margin-bottom:0.5rem; }
.hero h1 em { color:var(--accent); font-style:normal; }
.hero p { color:var(--muted); font-size:0.95rem; max-width:600px; line-height:1.6; }
.hero-tags { display:flex; flex-wrap:wrap; gap:8px; margin-top:1.2rem; }
.tag { background:var(--surface2); border:1px solid var(--border); border-radius:6px; padding:4px 12px; font-size:0.75rem; font-weight:600; color:var(--accent); font-family:'JetBrains Mono',monospace; }

/* ===== TOPICS GRID ===== */
.topics-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:1rem; margin-bottom:2rem; }
.topic-card {
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  padding:1.5rem; cursor:pointer; transition:all 0.25s; position:relative; overflow:hidden;
}
.topic-card::before {
  content:''; position:absolute; inset:0; opacity:0; transition:opacity 0.25s;
  background:linear-gradient(135deg, rgba(0,229,255,0.05) 0%, transparent 60%);
}
.topic-card:hover { border-color:var(--accent); transform:translateY(-2px); }
.topic-card:hover::before { opacity:1; }
.topic-num { font-family:'JetBrains Mono',monospace; font-size:0.7rem; color:var(--accent); font-weight:700; margin-bottom:0.5rem; letter-spacing:2px; }
.topic-card h3 { font-size:1rem; font-weight:700; margin-bottom:0.5rem; }
.topic-card p { font-size:0.8rem; color:var(--muted); line-height:1.5; }
.topic-card .difficulty { position:absolute; top:1rem; right:1rem; font-size:0.65rem; font-weight:700; padding:2px 8px; border-radius:10px; }
.diff-easy { background:rgba(16,185,129,0.15); color:var(--green); }
.diff-med { background:rgba(245,158,11,0.15); color:var(--accent3); }
.diff-hard { background:rgba(239,68,68,0.15); color:var(--red); }

/* ===== LESSON LAYOUT ===== */
.lesson-container { display:grid; grid-template-columns:240px 1fr; gap:1.5rem; }
.lesson-sidebar { position:sticky; top:80px; height:fit-content; }
.sidebar-nav { background:var(--surface); border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.sidebar-section { padding:0.75rem 1rem; font-size:0.7rem; font-weight:700; color:var(--muted); letter-spacing:2px; text-transform:uppercase; border-bottom:1px solid var(--border); }
.sidebar-item { padding:0.6rem 1rem; font-size:0.82rem; cursor:pointer; transition:all 0.15s; border-left:3px solid transparent; color:var(--muted); }
.sidebar-item:hover { background:var(--surface2); color:var(--text); }
.sidebar-item.active { background:rgba(0,229,255,0.08); color:var(--accent); border-left-color:var(--accent); }

/* ===== LESSON CONTENT ===== */
.lesson-content { min-width:0; }
.lesson-panel { display:none; }
.lesson-panel.active { display:block; animation:fadeIn 0.3s ease; }

.concept-block {
  background:var(--surface); border:1px solid var(--border); border-radius:12px;
  padding:1.5rem; margin-bottom:1.2rem;
}
.concept-block h2 { font-size:1.2rem; font-weight:700; margin-bottom:0.8rem; display:flex; align-items:center; gap:10px; }
.concept-block h2 .icon { width:28px; height:28px; background:rgba(0,229,255,0.1); border-radius:6px; display:flex; align-items:center; justify-content:center; font-size:0.9rem; }
.concept-block p, .concept-block li { font-size:0.88rem; color:var(--muted); line-height:1.7; }
.concept-block ul { padding-left:1.2rem; }
.concept-block li { margin-bottom:4px; }

.highlight-box {
  background:rgba(0,229,255,0.05); border:1px solid rgba(0,229,255,0.2);
  border-radius:8px; padding:1rem; margin:0.8rem 0; font-size:0.85rem; line-height:1.6;
}
.warn-box {
  background:rgba(245,158,11,0.05); border:1px solid rgba(245,158,11,0.2);
  border-radius:8px; padding:1rem; margin:0.8rem 0; font-size:0.85rem; color:var(--accent3); line-height:1.6;
}
.success-box {
  background:rgba(16,185,129,0.05); border:1px solid rgba(16,185,129,0.2);
  border-radius:8px; padding:1rem; margin:0.8rem 0; font-size:0.85rem; color:var(--green); line-height:1.6;
}

/* ===== CODE BLOCKS ===== */
.code-block {
  background:var(--code-bg); border:1px solid var(--border); border-radius:10px;
  overflow:hidden; margin:0.8rem 0;
}
.code-header {
  background:var(--surface2); padding:8px 14px; font-size:0.72rem; font-weight:700;
  color:var(--muted); display:flex; justify-content:space-between; align-items:center;
  border-bottom:1px solid var(--border);
}
.code-lang { color:var(--accent); }
.copy-btn {
  background:none; border:1px solid var(--border); color:var(--muted); font-size:0.7rem;
  padding:3px 10px; border-radius:4px; cursor:pointer; font-family:'Syne',sans-serif; font-weight:600; transition:all 0.15s;
}
.copy-btn:hover { border-color:var(--accent); color:var(--accent); }
pre { padding:1.2rem 1.4rem; overflow-x:auto; font-family:'JetBrains Mono',monospace; font-size:0.82rem; line-height:1.7; }
.kw { color:#ff79c6; } .fn { color:#50fa7b; } .cm { color:#6272a4; } .str { color:#f1fa8c; }
.num { color:#bd93f9; } .ty { color:#8be9fd; } .op { color:#ff79c6; }

/* ===== TRACE BOX ===== */
.trace-box {
  background:var(--code-bg); border:1px solid var(--border); border-radius:10px;
  padding:1.2rem; margin:0.8rem 0; font-family:'JetBrains Mono',monospace; font-size:0.8rem; line-height:2;
}
.trace-step { display:flex; gap:1rem; align-items:center; padding:4px 0; border-bottom:1px solid rgba(255,255,255,0.03); }
.trace-step:last-child { border-bottom:none; }
.ts-idx { color:var(--accent2); width:60px; text-align:right; flex-shrink:0; }
.ts-arr { color:var(--accent); flex:1; }
.ts-note { color:var(--muted); font-size:0.75rem; }

/* ===== QUIZ ===== */
.quiz-block { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:1.5rem; margin-bottom:1.2rem; }
.quiz-block h3 { font-size:1rem; font-weight:700; margin-bottom:1rem; }
.quiz-q { font-size:0.88rem; color:var(--text); margin-bottom:0.8rem; line-height:1.5; font-family:'JetBrains Mono',monospace; }
.quiz-options { display:flex; flex-direction:column; gap:8px; }
.quiz-opt {
  background:var(--surface2); border:1px solid var(--border); border-radius:8px;
  padding:0.7rem 1rem; font-size:0.85rem; cursor:pointer; transition:all 0.2s;
  display:flex; align-items:center; gap:10px; font-family:'JetBrains Mono',monospace;
}
.quiz-opt:hover { border-color:var(--accent); }
.quiz-opt.correct { background:rgba(16,185,129,0.1); border-color:var(--green); color:var(--green); }
.quiz-opt.wrong { background:rgba(239,68,68,0.1); border-color:var(--red); color:var(--red); }
.quiz-opt.reveal { background:rgba(16,185,129,0.05); border-color:var(--green); color:var(--green); }
.opt-key { font-weight:700; color:var(--accent); font-size:0.75rem; }
.quiz-explain { background:rgba(16,185,129,0.05); border:1px solid rgba(16,185,129,0.2); border-radius:8px; padding:0.8rem; margin-top:0.8rem; font-size:0.82rem; color:var(--green); display:none; line-height:1.6; }
.quiz-score { display:flex; gap:16px; margin-bottom:1.5rem; align-items:center; }
.quiz-score span { font-family:'JetBrains Mono',monospace; font-size:0.82rem; }
#score-display { color:var(--accent); font-weight:700; }

/* ===== PATTERN / CHEAT CARDS ===== */
.pattern-grid { display:grid; grid-template-columns:1fr 1fr; gap:1rem; margin:0.8rem 0; }
.pattern-card { background:var(--code-bg); border:1px solid var(--border); border-radius:8px; padding:1rem; }
.pattern-card h4 { font-size:0.8rem; font-weight:700; color:var(--accent); margin-bottom:0.5rem; font-family:'JetBrains Mono',monospace; }
.pattern-card p { font-size:0.78rem; color:var(--muted); line-height:1.5; }

.complexity { display:inline-flex; gap:12px; margin:0.5rem 0; }
.cx { font-family:'JetBrains Mono',monospace; font-size:0.78rem; background:var(--surface2); padding:3px 10px; border-radius:4px; border:1px solid var(--border); }
.cx b { color:var(--accent3); }

.cheat-grid { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
.cheat-card { background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:1.2rem; }
.cheat-card h4 { font-size:0.85rem; font-weight:700; color:var(--accent); margin-bottom:0.8rem; border-bottom:1px solid var(--border); padding-bottom:0.5rem; }
.cheat-row { display:flex; justify-content:space-between; align-items:center; padding:5px 0; border-bottom:1px solid rgba(255,255,255,0.03); font-size:0.78rem; }
.cheat-row:last-child { border-bottom:none; }
.cheat-row span:first-child { color:var(--muted); }
.cheat-row span:last-child { font-family:'JetBrains Mono',monospace; color:var(--accent); }

/* ===== PROGRESS ===== */
.progress-bar-wrap { background:var(--surface2); border-radius:999px; height:6px; margin:0.5rem 0; overflow:hidden; }
.progress-bar { height:100%; border-radius:999px; background:linear-gradient(90deg,var(--accent2),var(--accent)); transition:width 0.5s ease; }

/* ===== BUTTONS ===== */
.btn { display:inline-flex; align-items:center; gap:8px; background:var(--accent); color:#000; font-family:'Syne',sans-serif; font-weight:700; font-size:0.82rem; padding:8px 18px; border-radius:8px; border:none; cursor:pointer; transition:all 0.2s; letter-spacing:0.3px; }
.btn:hover { transform:translateY(-1px); box-shadow:0 4px 20px rgba(0,229,255,0.3); }
.btn-ghost { background:none; border:1px solid var(--border); color:var(--text); }
.btn-ghost:hover { border-color:var(--accent); color:var(--accent); box-shadow:none; }
.divider { border:none; border-top:1px solid var(--border); margin:1.5rem 0; }

/* ===== CHECKLIST ===== */
.checklist { list-style:none; padding:0; }
.checklist li { display:flex; align-items:center; gap:10px; padding:6px 0; font-size:0.85rem; border-bottom:1px solid var(--border); }
.checklist li:last-child { border-bottom:none; }
.checklist input[type=checkbox] { accent-color:var(--accent); width:15px; height:15px; cursor:pointer; }
.checklist label { cursor:pointer; color:var(--muted); transition:color 0.2s; }
.checklist input:checked + label { color:var(--green); text-decoration:line-through; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:var(--bg); }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:3px; }

/* ===== RESPONSIVE ===== */
@media(max-width:768px) {
  .lesson-container { grid-template-columns:1fr; }
  .lesson-sidebar { position:static; }
  .cheat-grid, .pattern-grid { grid-template-columns:1fr; }
  .hero h1 { font-size:1.4rem; }
  main { padding:1rem; }
  .topics-grid { grid-template-columns:1fr; }
}