:root {
  --bg: #0f0f12;
  --bg2: #16161c;
  --bg3: #1e1e28;
  --border: #2a2a38;
  --border2: #38384a;
  --text: #e8e8f0;
  --text2: #9090a8;
  --text3: #5a5a72;
  --accent: #7c6dfa;
  --accent2: #a594ff;
  --green: #3ddc97;
  --green-bg: #0d2b1e;
  --amber: #f5a623;
  --amber-bg: #2b1f0a;
  --red: #ff6b6b;
  --red-bg: #2b0f0f;
  --blue: #5bc4fa;
  --blue-bg: #0a1e2b;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'IBM Plex Sans', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
}

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  padding: 0 0 2rem;
  z-index: 100;
}
.main {
  margin-left: 260px;
  flex: 1;
  max-width: 860px;
  padding: 3rem 3rem 6rem;
}

/* Sidebar */
.sidebar-logo {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.sidebar-logo .course { font-size: 11px; font-family: var(--mono); color: var(--accent2); letter-spacing: 0.1em; text-transform: uppercase; }
.sidebar-logo .title { font-size: 15px; font-weight: 600; margin-top: 2px; }

.nav-section { padding: 0.75rem 1.5rem 0.25rem; font-size: 10px; font-family: var(--mono); color: var(--text3); letter-spacing: 0.12em; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 0.45rem 1.5rem;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}
.nav-item:hover { color: var(--text); background: var(--bg3); }
.nav-item.active { color: var(--accent2); border-left-color: var(--accent); background: rgba(124,109,250,0.08); }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-flervalg { background: var(--blue); }
.dot-programmering { background: var(--green); }
.dot-teori { background: var(--accent2); }
.dot-section { background: var(--text3); }

/* Progress */
.progress-bar { height: 3px; background: var(--border); margin: 0 1.5rem 0.5rem; border-radius: 2px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); border-radius: 2px; transition: width 0.5s; width: 0%; }

/* Header */
.page-header { margin-bottom: 3rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.kurs-badge { font-family: var(--mono); font-size: 11px; color: var(--accent2); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.5rem; }
.page-title { font-size: 36px; font-weight: 600; line-height: 1.2; margin-bottom: 0.75rem; }
.page-sub { color: var(--text2); font-size: 15px; max-width: 560px; line-height: 1.7; }
.stat-row { display: flex; gap: 2rem; margin-top: 1.5rem; }
.stat { }
.stat-val { font-family: var(--mono); font-size: 22px; font-weight: 600; color: var(--accent2); }
.stat-label { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* Section */
.section-block { margin-bottom: 4rem; }
.section-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 1.5rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.section-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 3px;
}
.tag-flervalg { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(91,196,250,0.2); }
.tag-programmering { background: var(--green-bg); color: var(--green); border: 1px solid rgba(61,220,151,0.2); }
.tag-teori { background: rgba(124,109,250,0.12); color: var(--accent2); border: 1px solid rgba(124,109,250,0.25); }
.section-title { font-size: 20px; font-weight: 600; }
.section-points { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--text3); }

/* Oppgave */
.oppgave {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1.25rem;
  overflow: hidden;
  transition: border-color 0.2s;
}
.oppgave:hover { border-color: var(--border2); }
.oppgave-header {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  user-select: none;
}
.oppgave-num {
  font-family: var(--mono); font-size: 11px; color: var(--text3);
  background: var(--bg3); border-radius: 4px;
  padding: 3px 8px; flex-shrink: 0; margin-top: 1px;
}
.oppgave-title-wrap { flex: 1; }
.oppgave-title { font-size: 15px; font-weight: 500; line-height: 1.4; }
.oppgave-subtitle { font-size: 12px; color: var(--text3); margin-top: 3px; font-family: var(--mono); }
.oppgave-chevron {
  color: var(--text3); flex-shrink: 0; margin-top: 2px;
  transition: transform 0.2s; font-size: 12px;
}
.oppgave.open .oppgave-chevron { transform: rotate(90deg); }

.oppgave-body { display: none; }
.oppgave.open .oppgave-body { display: block; }

.oppgave-content { padding: 0 1.5rem 1.5rem; }
.oppgave-divider { height: 1px; background: var(--border); margin-bottom: 1.25rem; }

/* Konsept-boks */
.konsept-boks {
  background: rgba(124,109,250,0.07);
  border: 1px solid rgba(124,109,250,0.2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.konsept-label { font-family: var(--mono); font-size: 10px; color: var(--accent2); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.4rem; }
.konsept-text { font-size: 14px; color: var(--text); line-height: 1.7; }

/* Kode */
pre {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1rem 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}
.kw { color: #c792ea; }
.ty { color: #82aaff; }
.str { color: #c3e88d; }
.cm { color: #546e7a; font-style: italic; }
.num { color: var(--amber); }
.fn { color: #82aaff; }
.pu { color: var(--text2); }

/* Alternativer */
.alt-list { list-style: none; margin: 0.75rem 0; }
.alt-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 0.6rem 0.75rem;
  border-radius: 5px;
  margin-bottom: 4px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg3);
  font-size: 14px;
  transition: all 0.15s;
}
.alt-item:hover { border-color: var(--border2); background: var(--bg2); }
.alt-item.correct { background: var(--green-bg); border-color: rgba(61,220,151,0.3); color: var(--green); }
.alt-item.wrong { background: var(--red-bg); border-color: rgba(255,107,107,0.3); color: var(--red); }
.alt-box { width: 16px; height: 16px; border: 1px solid var(--border2); border-radius: 3px; flex-shrink: 0; margin-top: 2px; display: flex; align-items: center; justify-content: center; font-size: 10px; }
.radio-box { border-radius: 50%; }

/* Fasit */
.fasit-btn {
  background: transparent; border: 1px solid var(--border2);
  color: var(--text2); font-family: var(--sans); font-size: 13px;
  padding: 6px 16px; border-radius: 5px; cursor: pointer;
  margin-top: 0.75rem; transition: all 0.15s;
}
.fasit-btn:hover { border-color: var(--accent); color: var(--accent2); }
.fasit-panel {
  display: none;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; padding: 1rem 1.25rem;
  margin-top: 0.75rem; font-size: 14px; line-height: 1.7;
}
.fasit-panel.show { display: block; }
.fasit-heading { font-family: var(--mono); font-size: 10px; color: var(--green); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 0.5rem; }

/* Oppgave-tekst */
.oppg-text { font-size: 14px; line-height: 1.8; color: var(--text2); margin-bottom: 1rem; }
.oppg-text strong { color: var(--text); font-weight: 500; }

/* Deloppgave */
.deloppgave { margin-bottom: 1rem; }
.del-label { font-family: var(--mono); font-size: 11px; color: var(--amber); margin-bottom: 0.4rem; }
.textarea-mock {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 5px; padding: 0.75rem 1rem;
  font-size: 13px; color: var(--text3);
  font-style: italic; min-height: 60px;
}

/* Sant/usant */
.su-table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 13px; }
.su-table th { text-align: left; padding: 0.4rem 0.75rem; font-family: var(--mono); font-size: 10px; color: var(--text3); letter-spacing: 0.08em; text-transform: uppercase; background: var(--bg3); }
.su-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }
.su-table tr:last-child td { border-bottom: none; }
.su-table .stmt { color: var(--text); }
.su-radio { display: flex; gap: 8px; align-items: center; }
.su-opt {
  padding: 3px 12px; border-radius: 3px; border: 1px solid var(--border);
  cursor: pointer; font-size: 12px; transition: all 0.15s; color: var(--text2);
}
.su-opt:hover { border-color: var(--border2); color: var(--text); }
.su-opt.s-correct { background: var(--green-bg); border-color: rgba(61,220,151,0.4); color: var(--green); }
.su-opt.s-wrong { background: var(--red-bg); border-color: rgba(255,107,107,0.4); color: var(--red); }

/* Varsel */
.hint-box {
  background: var(--amber-bg); border: 1px solid rgba(245,166,35,0.25);
  border-radius: 6px; padding: 0.75rem 1rem;
  font-size: 13px; color: var(--amber); margin: 0.75rem 0;
}

/* Poeng-indikator */
.points-badge {
  font-family: var(--mono); font-size: 11px;
  padding: 2px 8px; border-radius: 3px;
  background: var(--bg3); color: var(--text3);
  border: 1px solid var(--border); margin-left: 8px;
}

/* Scroll-topp */
.to-top {
  position: fixed; bottom: 2rem; right: 2rem;
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text2); width: 36px; height: 36px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; transition: all 0.15s; text-decoration: none;
}
.to-top:hover { border-color: var(--accent); color: var(--accent2); }

@media (max-width: 800px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 2rem 1.25rem 4rem; }
}