* { margin:0; padding:0; box-sizing:border-box; }

:root {
  --bg: #0f0f13;
  --surface: #1a1a23;
  --surface2: #22222e;
  --border: #2e2e3e;
  --text: #f0f0f5;
  --text2: #9090a8;
  --accent: #7c6af7;
  --accent2: #5b4fd4;
  --green: #4ade80;
  --red: #f87171;
  --yellow: #fbbf24;
  --blue: #60a5fa;
  --radius: 14px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── HEADER ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top:0; z-index:100;
}
header h1 { font-size:1.1rem; font-weight:700; color:var(--accent); }
header span { font-size:0.8rem; color:var(--text2); }

/* ── SCORE BAR ── */
#scorebar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 32px;
  display: flex; gap: 24px; align-items:center;
  font-size: 0.82rem; color: var(--text2);
  position: sticky; top:57px; z-index:99;
}
#scorebar b { color: var(--text); }
#progress-fill {
  flex:1; height:6px; background:var(--border); border-radius:3px; overflow:hidden;
}
#progress-bar { height:100%; background:var(--accent); transition:width .4s; border-radius:3px; }

/* ── TABS ── */
.tabs {
  display:flex; gap:4px; padding:20px 32px 0;
  overflow-x:auto; scrollbar-width:none;
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  white-space:nowrap; padding:10px 16px;
  background:transparent; border:none; cursor:pointer;
  font-size:0.82rem; font-weight:600; color:var(--text2);
  border-bottom:2px solid transparent; transition:all .2s;
  font-family:inherit;
}
.tab-btn:hover { color:var(--text); }
.tab-btn.active { color:var(--accent); border-bottom-color:var(--accent); }

/* ── CHAPTER ── */
.chapter { display:none; padding: 28px 32px 60px; max-width:900px; margin:0 auto; }
.chapter.active { display:block; }

/* ── THEORY BOX ── */
.theory {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px 28px; margin-bottom: 32px;
}
.theory h2 { font-size:1rem; color:var(--accent); margin-bottom:12px; }
.theory p  { font-size:0.88rem; color:var(--text2); line-height:1.7; margin-bottom:8px; }
.theory p:last-child { margin-bottom:0; }
.theory code {
  background:var(--surface2); padding:1px 6px; border-radius:4px;
  font-family:'SF Mono',Consolas,monospace; font-size:0.82rem; color:var(--blue);
}
.theory ul { padding-left:16px; margin:8px 0; }
.theory li { font-size:0.86rem; color:var(--text2); line-height:1.6; margin-bottom:4px; }
.theory li::marker { color:var(--accent); }
.theory strong { color:var(--text); }

/* ── SECTION LABEL ── */
.section-label {
  display:inline-block; font-size:0.72rem; font-weight:700;
  text-transform:uppercase; letter-spacing:1px;
  padding:4px 10px; border-radius:20px; margin-bottom:16px;
}
.label-theory { background:rgba(124,106,247,0.15); color:var(--accent); }
.label-debug  { background:rgba(251,191,36,0.15); color:var(--yellow); }
.label-project{ background:rgba(74,222,128,0.15); color:var(--green); }

/* ── FLASHCARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px; margin-bottom: 16px;
  transition: border-color .2s;
}
.card:hover { border-color: var(--accent); }
.card.answered { border-color: var(--border); }

.card .q {
  font-size:0.92rem; line-height:1.6; margin-bottom:16px; color:var(--text);
  font-weight:500;
}
.card .q code {
  display:block; background:var(--surface2); padding:12px 16px;
  border-radius:8px; margin:10px 0; font-family:'SF Mono',Consolas,monospace;
  font-size:0.82rem; color:var(--blue); white-space:pre; overflow-x:auto;
  border-left:2px solid var(--accent);
}

.options { display:flex; flex-direction:column; gap:8px; }

.option {
  padding:12px 16px; border-radius:10px;
  border:1px solid var(--border); background:var(--surface2);
  cursor:pointer; font-size:0.86rem; color:var(--text2);
  transition:all .15s; display:flex; align-items:center; gap:10px;
  text-align:left;
}
.option:hover:not(.disabled) {
  border-color:var(--accent); color:var(--text); background:rgba(124,106,247,0.08);
}
.option .letter {
  min-width:24px; height:24px; border-radius:6px; background:var(--border);
  display:flex; align-items:center; justify-content:center;
  font-size:0.75rem; font-weight:700; color:var(--text2);
}
.option.correct  { border-color:var(--green)!important; background:rgba(74,222,128,0.1)!important; color:var(--green)!important; }
.option.correct .letter { background:var(--green); color:#000; }
.option.wrong    { border-color:var(--red)!important; background:rgba(248,113,113,0.1)!important; color:var(--red)!important; }
.option.wrong .letter { background:var(--red); color:#fff; }
.option.disabled { cursor:default; }

.explanation {
  margin-top:14px; padding:14px 16px;
  background:rgba(124,106,247,0.08); border-radius:10px;
  border-left:3px solid var(--accent);
  font-size:0.84rem; color:var(--text2); line-height:1.6; display:none;
}
.explanation.show { display:block; }
.explanation strong { color:var(--accent); }
.explanation code {
  background:var(--surface2); padding:1px 6px; border-radius:4px;
  font-size:0.8rem; color:var(--blue); font-family:'SF Mono',Consolas,monospace;
}

/* ── CHAPTER SCORE ── */
.chapter-score {
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:20px 24px; margin-top:24px; text-align:center;
  font-size:0.88rem; color:var(--text2);
}
.chapter-score span { font-size:1.4rem; font-weight:700; color:var(--accent); }

/* ── RESET BTN ── */
.reset-btn {
  margin-top:12px; padding:10px 22px; background:var(--accent);
  border:none; border-radius:8px; color:#fff; font-size:0.84rem;
  font-weight:600; cursor:pointer; font-family:inherit;
}
.reset-btn:hover { background:var(--accent2); }
