/* ============================================================
   Lernportal Programmübertragungstechnik
   Corporate Design: Hochschule Mittweida
   Primärfarbe: #2A6BB7  |  Dunkel: #1a2638
   ============================================================ */

:root {
  /* HSMW Brand Colors */
  --hsmw-blue: #2A6BB7;
  --hsmw-blue-dark: #1d4f8a;
  --hsmw-blue-light: #4a8dd4;
  --hsmw-blue-xlight: #dce8f7;
  --hsmw-dark: #1a2638;
  --hsmw-dark2: #243044;
  --hsmw-mid: #3b5070;

  /* Semantic */
  --primary: var(--hsmw-blue);
  --primary-dark: var(--hsmw-blue-dark);
  --primary-light: var(--hsmw-blue-light);
  --primary-xlight: var(--hsmw-blue-xlight);

  /* Backgrounds */
  --bg: #f0f4f8;
  --bg-card: #ffffff;
  --bg-header: var(--hsmw-dark);
  --bg-nav: var(--hsmw-dark);

  /* Text */
  --text: #1a2638;
  --text-muted: #5a6a7e;
  --text-light: #8da0b3;
  --text-white: #f8fafc;

  /* Status */
  --success: #1a8a4a;
  --success-bg: #d6f0e1;
  --error: #c0392b;
  --error-bg: #fde8e6;
  --warning: #c77700;
  --warning-bg: #fef6e4;
  --info-bg: var(--hsmw-blue-xlight);

  /* UI */
  --border: #d4dce7;
  --border-dark: #b0bfd0;
  --shadow: 0 1px 4px rgba(26,38,56,0.08), 0 1px 2px rgba(26,38,56,0.05);
  --shadow-md: 0 4px 12px rgba(26,38,56,0.1), 0 2px 4px rgba(26,38,56,0.07);
  --shadow-lg: 0 12px 24px rgba(26,38,56,0.12), 0 4px 8px rgba(26,38,56,0.08);
  --radius: 6px;
  --radius-lg: 10px;
  --nav-width: 270px;
  --header-height: 58px;
  --transition: 0.18s ease;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}
a { color: var(--hsmw-blue); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--hsmw-blue-dark); }
img { max-width: 100%; }
ul, ol { padding-left: 1.4rem; }
li { margin-bottom: 0.25rem; }

/* ── Layout ──────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--nav-width);
  background: var(--hsmw-dark);
  color: var(--text-white);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.05);
}

/* HSMW Sidebar Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0 1.25rem;
  height: 72px;
  background: linear-gradient(135deg, #0f1a28 0%, var(--hsmw-dark) 100%);
  text-decoration: none;
  border-bottom: 2px solid var(--hsmw-blue);
  flex-shrink: 0;
}

.sidebar-logo:hover { text-decoration: none; }

.sidebar-logo-badge {
  width: 38px;
  height: 38px;
  background: var(--hsmw-blue);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(42,107,183,0.4);
}

.sidebar-logo-text {
  color: var(--text-white);
  line-height: 1.25;
}

.sidebar-logo-text .uni {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hsmw-blue-light);
}

.sidebar-logo-text .module {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}

/* Nav Sections */
.nav-section { padding: 0.75rem 0; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #5a7090;
  padding: 0.5rem 1.25rem 0.3rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1.25rem;
  color: #8da0b3;
  font-size: 0.84rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  border-right: 0;
}

.nav-link:hover {
  background: rgba(42,107,183,0.1);
  color: #c8daec;
  text-decoration: none;
  border-left-color: rgba(42,107,183,0.4);
}

.nav-link.active {
  background: rgba(42,107,183,0.15);
  color: #90c0f0;
  border-left-color: var(--hsmw-blue);
  font-weight: 600;
}

.nav-icon { width: 16px; text-align: center; font-size: 0.85rem; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  font-size: 0.63rem;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  background: rgba(42,107,183,0.2);
  color: var(--hsmw-blue-light);
  font-weight: 600;
}

/* ── Main Content ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--nav-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(26,38,56,0.06);
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: 1.5px solid var(--border);
  cursor: pointer;
  padding: 0.35rem 0.6rem;
  color: var(--text-muted);
  font-size: 1rem;
  border-radius: var(--radius);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }
.breadcrumb span { color: var(--text); font-weight: 600; }
.breadcrumb::before { content: ''; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 0.875rem; }

.progress-pill {
  background: var(--hsmw-blue);
  color: white;
  font-size: 0.73rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

/* ── Page Content ─────────────────────────────────────────── */
.page-content { padding: 2rem 2.5rem; max-width: 1080px; width: 100%; }

/* ── Typography ──────────────────────────────────────────── */
.page-title { font-size: 1.875rem; font-weight: 800; color: var(--text); margin-bottom: 0.4rem; }
.page-subtitle { font-size: 1rem; color: var(--text-muted); margin-bottom: 2rem; }

/* HSMW-style headings: uppercase with bottom border */
h2 {
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hsmw-dark);
  margin: 2.25rem 0 0.875rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--hsmw-blue);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--hsmw-blue-dark);
  margin: 1.5rem 0 0.5rem;
}

h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin: 1rem 0 0.35rem;
}

p { margin-bottom: 0.75rem; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.card-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.card-title { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0; }
.card-meta { font-size: 0.78rem; color: var(--text-muted); }

/* ── Chapter Cards (Index) ───────────────────────────────── */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.125rem;
  margin-bottom: 2rem;
}

.chapter-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.375rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.chapter-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--chapter-color, var(--hsmw-blue));
}

.chapter-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: var(--chapter-color, var(--hsmw-blue));
  opacity: 0;
  transition: opacity 0.2s;
}

.chapter-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-dark);
  text-decoration: none;
  color: var(--text);
}

.chapter-card:hover::after { opacity: 1; }

.chapter-card-icon { font-size: 1.75rem; margin-bottom: 0.625rem; }
.chapter-card-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.03em; }
.chapter-card-desc { font-size: 0.835rem; color: var(--text-muted); flex: 1; margin-bottom: 1rem; line-height: 1.5; }
.chapter-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: var(--text-light); }
.chapter-card-tag {
  background: var(--hsmw-blue-xlight);
  color: var(--hsmw-blue-dark);
  border: 1px solid #bdd0ea;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.72rem;
}

/* ── Info Boxes ──────────────────────────────────────────── */
.info-box {
  border-radius: var(--radius);
  padding: 0.875rem 1.125rem;
  margin: 1rem 0;
  border-left: 4px solid;
  display: flex;
  gap: 0.75rem;
}

.info-box-icon { font-size: 1rem; flex-shrink: 0; margin-top: 0.1rem; }
.info-box-content { flex: 1; }
.info-box-title { font-weight: 700; margin-bottom: 0.2rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; }
.info-box p { margin: 0; font-size: 0.875rem; line-height: 1.55; }
.info-box p + p { margin-top: 0.4rem; }

.info-box.tip { background: var(--hsmw-blue-xlight); border-color: var(--hsmw-blue); }
.info-box.tip .info-box-title { color: var(--hsmw-blue-dark); }
.info-box.warning { background: var(--warning-bg); border-color: var(--warning); }
.info-box.warning .info-box-title { color: var(--warning); }
.info-box.success { background: var(--success-bg); border-color: var(--success); }
.info-box.success .info-box-title { color: var(--success); }
.info-box.exam { background: #faf5ff; border-color: #7c3aed; }
.info-box.exam .info-box-title { color: #5b21b6; }

/* ── Definition List ─────────────────────────────────────── */
.def-list { list-style: none; padding: 0; margin: 0.75rem 0; }

.def-list li {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  align-items: start;
}

.def-list li:last-child { border-bottom: none; }

.def-term {
  font-weight: 700;
  color: var(--hsmw-blue-dark);
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 0.82rem;
  background: var(--hsmw-blue-xlight);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  display: inline-block;
  border: 1px solid #bdd0ea;
}

/* ── Tables ──────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.855rem;
  margin: 1rem 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.data-table th {
  background: var(--hsmw-dark);
  color: var(--text-white);
  padding: 0.625rem 0.875rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 0.6rem 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:nth-child(even) td { background: #f8fafc; }
.data-table tr:hover td { background: var(--hsmw-blue-xlight); }

/* ── Code ────────────────────────────────────────────────── */
code {
  background: #edf2f7;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15em 0.45em;
  font-family: "SF Mono", "Cascadia Code", Consolas, monospace;
  font-size: 0.84em;
  color: #1d4f8a;
}

pre {
  background: #0d1b2a;
  color: #c9d8e8;
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.7;
  margin: 1rem 0;
  border: 1px solid #1d2d40;
}

pre code { background: none; border: none; color: inherit; padding: 0; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  gap: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-blue { background: var(--hsmw-blue-xlight); color: var(--hsmw-blue-dark); border: 1px solid #bdd0ea; }
.badge-green { background: #d6f0e1; color: #166534; border: 1px solid #86efac; }
.badge-yellow { background: #fef6e4; color: #92400e; border: 1px solid #fcd34d; }
.badge-red { background: var(--error-bg); color: var(--error); border: 1px solid #fca5a5; }
.badge-purple { background: #f3e8ff; color: #6d28d9; border: 1px solid #d8b4fe; }
.badge-gray { background: #f1f5f9; color: #475569; border: 1px solid var(--border); }

/* ── Key Concept Box ─────────────────────────────────────── */
.key-concept {
  background: linear-gradient(135deg, var(--hsmw-blue-xlight) 0%, #edf4fd 100%);
  border: 1px solid #bdd0ea;
  border-left: 4px solid var(--hsmw-blue);
  border-radius: var(--radius);
  padding: 1.125rem 1.25rem;
  margin: 1rem 0;
}

.key-concept-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hsmw-blue-dark);
  margin-bottom: 0.5rem;
}

/* ── Packet Diagram ──────────────────────────────────────── */
.packet-diagram {
  display: flex;
  margin: 1rem 0;
  font-size: 0.78rem;
  overflow-x: auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.packet-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.75rem;
  min-width: 65px;
  border-right: 1px solid rgba(255,255,255,0.18);
  text-align: center;
}
.packet-field:last-child { border-right: none; }
.packet-field-name { font-weight: 700; color: white; font-size: 0.72rem; }
.packet-field-size { font-size: 0.63rem; color: rgba(255,255,255,0.65); margin-top: 0.2rem; }

/* ── Signal Flow Diagram (SNG) ───────────────────────────── */
.signal-flow {
  background: var(--hsmw-dark);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 1rem 0;
  overflow-x: auto;
}

.signal-flow-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hsmw-blue-light);
  margin-bottom: 1rem;
  text-align: center;
}

.signal-row {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 0.5rem;
  min-width: max-content;
}

.signal-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  min-width: 90px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.3;
}

.signal-block.source { background: #1a4a1a; color: #6ee06e; border: 1px solid #2d7a2d; }
.signal-block.process { background: #1a2d4a; color: #7ab8f0; border: 1px solid #2a4d7a; }
.signal-block.amplify { background: #4a1a1a; color: #f07a7a; border: 1px solid #7a2a2a; }
.signal-block.antenna { background: #2a2a1a; color: #f0d870; border: 1px solid #5a5a1a; }
.signal-block.satellite { background: #1a1a4a; color: #a08af0; border: 1px solid #3030aa; }
.signal-block.receive { background: #1a3a3a; color: #70d8d8; border: 1px solid #2a6060; }

.signal-arrow {
  color: #4a6a8a;
  font-size: 1rem;
  padding: 0 0.25rem;
  flex-shrink: 0;
}
.signal-arrow.up { color: #f0d870; transform: rotate(-90deg); display: inline-block; }
.signal-arrow.down { color: #70d8d8; transform: rotate(90deg); display: inline-block; }

.signal-label {
  font-size: 0.65rem;
  color: #4a6a8a;
  text-align: center;
  margin-top: 0.2rem;
}

/* ── Sections ────────────────────────────────────────────── */
.section-divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ── Lernziele ───────────────────────────────────────────── */
.lernziele { list-style: none; padding: 0; margin: 0.5rem 0; }
.lernziele li { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.3rem 0; font-size: 0.875rem; }
.lernziele li::before { content: '✓'; color: var(--success); font-weight: 800; flex-shrink: 0; margin-top: 0.05rem; }

/* ── Layout Columns ──────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin: 1rem 0; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; margin: 1rem 0; }

/* ── Hero (Index) ────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0a1628 0%, var(--hsmw-dark) 40%, var(--hsmw-dark2) 70%, #1d3a6a 100%);
  color: white;
  padding: 3rem 2.5rem;
  margin: -2rem -2.5rem 2rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50px; right: -50px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(42,107,183,0.2) 0%, transparent 70%);
  border-radius: 50%;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--hsmw-blue), var(--hsmw-blue-light), var(--hsmw-blue));
}

.hero-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--hsmw-blue-light);
  margin-bottom: 0.625rem;
}

.hero-title {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.875rem;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.hero-title span { color: var(--hsmw-blue-light); }

.hero-subtitle {
  font-size: 1rem;
  color: #7a9ab5;
  max-width: 580px;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.hero-stats { display: flex; gap: 2.5rem; flex-wrap: wrap; }
.hero-stat { display: flex; flex-direction: column; }
.hero-stat-value { font-size: 2rem; font-weight: 900; color: var(--hsmw-blue-light); line-height: 1; }
.hero-stat-label { font-size: 0.75rem; color: #5a7a90; margin-top: 0.2rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Chapter Hero ────────────────────────────────────────── */
.chapter-hero {
  padding: 1.75rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  position: relative;
}

.chapter-hero::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0;
  width: 60px; height: 3px;
  background: var(--hsmw-blue);
}

.chapter-hero-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--hsmw-blue);
  margin-bottom: 0.4rem;
}

.chapter-hero-title {
  font-size: 1.875rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.chapter-hero-desc { font-size: 0.95rem; color: var(--text-muted); max-width: 680px; line-height: 1.6; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.855rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn:hover { text-decoration: none; }

.btn-primary { background: var(--hsmw-blue); color: white; }
.btn-primary:hover { background: var(--hsmw-blue-dark); color: white; box-shadow: 0 4px 12px rgba(42,107,183,0.35); }

.btn-secondary { background: var(--bg-card); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--bg); border-color: var(--hsmw-blue); color: var(--hsmw-blue); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #166534; color: white; }

.btn-lg { padding: 0.75rem 1.75rem; font-size: 0.9rem; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.77rem; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Quiz Styles ─────────────────────────────────────────── */
.quiz-container { max-width: 760px; }

.quiz-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }

.quiz-progress-bar {
  background: var(--border);
  border-radius: 10px;
  height: 6px;
  margin-bottom: 1.75rem;
  overflow: hidden;
}

.quiz-progress-fill {
  background: linear-gradient(90deg, var(--hsmw-blue-dark), var(--hsmw-blue-light));
  height: 100%;
  border-radius: 10px;
  transition: width 0.4s ease;
}

.quiz-question-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  border-top: 3px solid var(--hsmw-blue);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.quiz-question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.125rem;
}

.quiz-question-number {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.quiz-question-category {
  font-size: 0.72rem;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  background: var(--hsmw-blue-xlight);
  color: var(--hsmw-blue-dark);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid #bdd0ea;
}

.quiz-question-text {
  font-size: 1.025rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.375rem;
  line-height: 1.55;
}

.quiz-options { display: flex; flex-direction: column; gap: 0.625rem; }

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--bg);
  font-size: 0.875rem;
  text-align: left;
  width: 100%;
  color: var(--text);
}

.quiz-option:hover:not(:disabled) { border-color: var(--hsmw-blue); background: var(--hsmw-blue-xlight); }
.quiz-option.selected { border-color: var(--hsmw-blue); background: var(--hsmw-blue-xlight); }
.quiz-option.correct { border-color: var(--success); background: var(--success-bg); color: #14532d; }
.quiz-option.wrong { border-color: var(--error); background: var(--error-bg); color: var(--error); }

.quiz-option-letter {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: all 0.15s;
}

.quiz-option.selected .quiz-option-letter { background: var(--hsmw-blue); color: white; }
.quiz-option.correct .quiz-option-letter { background: var(--success); color: white; }
.quiz-option.wrong .quiz-option-letter { background: var(--error); color: white; }
.quiz-option-text { flex: 1; line-height: 1.45; padding-top: 0.05rem; }

.quiz-explanation {
  margin-top: 1rem;
  padding: 0.875rem 1rem;
  background: var(--hsmw-blue-xlight);
  border: 1px solid #bdd0ea;
  border-left: 3px solid var(--hsmw-blue);
  border-radius: var(--radius);
  font-size: 0.855rem;
  color: var(--text);
  display: none;
  line-height: 1.6;
}

.quiz-explanation.visible { display: block; }
.quiz-explanation strong { color: var(--hsmw-blue-dark); }

.quiz-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.375rem;
  gap: 1rem;
}

/* Quiz Result */
.quiz-result {
  text-align: center;
  padding: 3rem 2rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border-top: 4px solid var(--hsmw-blue);
}

.quiz-result-score { font-size: 5rem; font-weight: 900; line-height: 1; margin-bottom: 0.5rem; }
.quiz-result-label { font-size: 1.2rem; font-weight: 600; color: var(--text-muted); margin-bottom: 1.25rem; }
.quiz-result-grade { font-size: 1.05rem; margin-bottom: 2rem; }

/* Filter Bar */
.filter-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }

.filter-btn {
  padding: 0.35rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.77rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text-muted);
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-btn:hover { border-color: var(--hsmw-blue); color: var(--hsmw-blue); }
.filter-btn.active { background: var(--hsmw-blue); color: white; border-color: var(--hsmw-blue); }

/* Timer */
.quiz-timer {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.9rem; font-weight: 700; color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
}
.quiz-timer.warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning); }
.quiz-timer.danger { color: var(--error); background: var(--error-bg); border-color: var(--error); }

/* ── Chapter Color Themes ─────────────────────────────────── */
.theme-mpegts  { --chapter-color: #7c3aed; }
.theme-cdn     { --chapter-color: #0ea5e9; }
.theme-http    { --chapter-color: #16a34a; }
.theme-srt     { --chapter-color: #ea580c; }
.theme-smpte   { --chapter-color: #db2777; }
.theme-sng     { --chapter-color: #0891b2; }
.theme-komp    { --chapter-color: #92400e; }
.theme-glas    { --chapter-color: #4f46e5; }

/* ── Mobile Overlay ──────────────────────────────────────── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 99; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .two-col { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --nav-width: 0px; }
  .sidebar { transform: translateX(-270px); width: 270px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.visible { display: block; }
  .topbar-menu-btn { display: flex; }
  .main-content { margin-left: 0; }
  .page-content { padding: 1.25rem 1.25rem; }
  .hero { padding: 2rem 1.25rem; margin: -1.25rem -1.25rem 1.5rem; }
  .hero-title { font-size: 1.6rem; }
  .chapter-grid { grid-template-columns: 1fr; }
  .three-col { grid-template-columns: 1fr; }
  .quiz-controls { flex-direction: column; }
  .def-list li { grid-template-columns: 1fr; gap: 0.25rem; }
  .signal-flow { font-size: 0.75rem; }
}

@media print {
  .sidebar, .topbar { display: none; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
