/* Global progress dashboard */
.progress-dashboard {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.8em 1em;
  display: none;
}

.progress-dashboard.visible {
  display: block;
}

.progress-dashboard-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4em;
}

.progress-dashboard-label {
  font-family: monospace;
  font-size: 0.85em;
  color: var(--white-second-color);
}

.progress-dashboard-right {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.progress-dashboard-count {
  font-family: monospace;
  font-size: 0.85em;
  color: #4caf50;
  font-weight: bold;
}

.progress-dashboard-reset {
  background: none;
  border: 1px solid #555;
  border-radius: 0.4em;
  color: #888;
  cursor: pointer;
  padding: 0.15em 0.4em;
  display: flex;
  align-items: center;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.progress-dashboard-reset:hover {
  color: #f44336;
  border-color: #f44336;
}

.progress-dashboard-bar {
  height: 6px;
  background: var(--white-second-color);
  border-radius: 3px;
  overflow: hidden;
}

.progress-dashboard-fill {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, var(--yellow-color));
  border-radius: 3px;
  transition: width 0.4s ease;
}

/* ============================================================
   ROADMAP LAYOUT
   ============================================================ */
.roadmap {
  padding: 1em;
  max-width: var(--max-width);
  margin: 0 auto;
}

.roadmap-section {
  margin: 0 auto;
  max-width: var(--max-width);
  padding: 1em 0;
  scroll-margin-top: 80px;
}

.roadmap-section-title {
  font-family: monospace;
  font-size: 1.1em;
  color: var(--black-second-color);
  background: var(--yellow-color);
  display: inline-block;
  padding: 0.3em 1.2em;
  border-radius: 2em;
  margin-bottom: 0.8em;
  opacity: 0.25;
  transform: scale(0.9);
  transform-origin: left center;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.section-active > .roadmap-section-title {
  opacity: 1;
  transform: scale(1);
}

.roadmap-track {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-left: 2em;
  gap: 0;
}

/* Vertical connector line */
.roadmap-track::before {
  content: '';
  position: absolute;
  left: calc(2em + 5px);
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--white-second-color);
}

/* ============================================================
   ROADMAP NODE (pill button)
   ============================================================ */
.roadmap-node {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.55em 1.2em 0.55em 0;
  cursor: pointer;
  position: relative;
  user-select: none;
  transition: transform 0.15s ease;
}

.roadmap-node:hover {
  transform: translateX(4px);
}

.roadmap-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--white-second-color);
  border: 2px solid var(--bg-color);
  flex-shrink: 0;
  z-index: 1;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.roadmap-node:hover .roadmap-dot {
  background: var(--yellow-color);
  box-shadow: 0 0 6px rgba(255, 221, 0, 0.4);
}

/* Read / completed dot */
.roadmap-node.read .roadmap-dot {
  background: #4caf50;
  box-shadow: 0 0 4px rgba(76, 175, 80, 0.3);
}

/* Active node (drawer open for this topic) */
.roadmap-node.node-active .roadmap-dot {
  background: var(--yellow-color);
  box-shadow: 0 0 8px rgba(255, 221, 0, 0.5);
}

.roadmap-icon {
  color: var(--white-second-color);
  font-size: 20px !important;
  transition: color 0.2s ease;
}

.roadmap-node:hover .roadmap-icon {
  color: var(--yellow-color);
}

.roadmap-node.node-active .roadmap-icon {
  color: var(--yellow-color);
}

.roadmap-label {
  font-family: monospace;
  font-size: 0.95em;
  color: var(--text-color);
  transition: color 0.2s ease;
}

.roadmap-node:hover .roadmap-label {
  color: var(--yellow-color);
}

.roadmap-node.node-active .roadmap-label {
  color: var(--yellow-color);
  font-weight: bold;
}

/* Difficulty badge (injected by JS) */
.section-topic-level {
  font-family: system-ui, sans-serif;
  font-size: 0.65em;
  font-weight: 600;
  padding: 0.1em 0.6em;
  border-radius: 1em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.section-topic-level.level-beginner {
  background: rgba(76, 175, 80, 0.15);
  color: #4caf50;
}

.section-topic-level.level-intermediate {
  background: rgba(255, 152, 0, 0.15);
  color: #ff9800;
}

.section-topic-level.level-advanced {
  background: rgba(244, 67, 54, 0.15);
  color: #f44336;
}

/* Topic count badge */
.section-title-count {
  font-family: system-ui, sans-serif;
  font-size: 0.55em;
  color: var(--white-second-color);
  font-weight: normal;
  margin-left: 0.5em;
}

/* Progress check icon (injected by JS into nodes) */
.section-topic-check {
  font-size: 18px !important;
  color: var(--white-second-color);
  cursor: pointer;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.section-topic-check:hover {
  color: var(--yellow-color);
}

.section-topic-check.checked {
  color: #4caf50;
}

/* Section progress badge */
.section-progress {
  font-family: monospace;
  font-size: 0.5em;
  color: #4caf50;
  font-weight: bold;
  margin-left: 0.5em;
  background: rgba(76, 175, 80, 0.1);
  padding: 0.1em 0.5em;
  border-radius: 0.5em;
}

/* ============================================================
   DRAWER PANEL (slides in from right)
   ============================================================ */
/* ============================================================
   QUIZ SLIDE — paper sheet, slides from behind the drawer's left edge
   ============================================================ */
.quiz-slide {
  position: fixed;
  top: 0;
  right: 50%;
  width: 46%;
  height: 100%;
  background: #3d3d3a;
  z-index: 155;
  transform: translateX(calc(100% + 50vw));
  transition: transform 0.4s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -2px 4px 30px rgba(0, 0, 0, 0.5);
  transform-origin: top right;
  border-left: 1px solid #555;
  overflow: hidden;
}

.quiz-slide.open {
  transform: translateX(0) rotate(var(--quiz-tilt, -1deg));
}

.quiz-slide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8em 1.2em;
  border-bottom: 3px solid var(--yellow-color);
  flex-shrink: 0;
}

.quiz-slide-title {
  font-family: monospace;
  font-size: 1.1em;
  color: var(--yellow-color);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.quiz-slide-close {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 0.2em;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

.quiz-slide-close:hover {
  color: #ff5555;
}

.quiz-slide-close .material-icons {
  font-size: 24px;
}

.quiz-slide-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1em 3em 1em 1.5em;
  scrollbar-color: var(--yellow-color) var(--black-second-color);
  scrollbar-width: thin;
}

/* Quiz inside slide panel — no top border needed */
.quiz-slide-body .topic-quiz {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
  white-space: normal;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 24px;
  right: 0;
  width: 50%;
  height: calc(100% - 24px);
  background: var(--black-second-color);
  z-index: 160;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
  border-radius: 4px 0 0 0;
}

/* Folder tab — trapezoid above the drawer (real element) */
.drawer-folder-tab {
  position: absolute;
  top: -24px;
  left: 20px;
  width: 120px;
  height: 24px;
  background: var(--black-second-color);
  clip-path: polygon(8% 0%, 92% 0%, 100% 100%, 0% 100%);
  border-radius: 6px 6px 0 0;
  font-family: monospace;
  font-size: 9px;
  color: var(--yellow-color);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 12px;
}

/* Remove old pseudo-element folder tab */
.drawer::before {
  display: none;
}

/* Folder corner fold — top-right dog-ear */
.drawer::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 28px;
  background: linear-gradient(225deg, var(--black-color) 50%, #4a4a47 50%);
  z-index: 2;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  padding: 0.8em 1.2em;
  border-bottom: 3px solid var(--yellow-color);
  flex-shrink: 0;
  gap: 0.6em;
}

.drawer-title {
  font-family: monospace;
  font-size: 1.1em;
  color: var(--yellow-color);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Code / Quiz tabs */
.drawer-tabs {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.drawer-tab {
  background: none;
  border: 1px solid #555;
  border-radius: 4px;
  color: #888;
  font-family: monospace;
  font-size: 0.75em;
  padding: 0.25em 0.6em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.drawer-tab .material-icons {
  font-size: 14px;
}

.drawer-tab:hover {
  color: var(--yellow-color);
  border-color: var(--yellow-color);
}

.drawer-tab.active {
  color: var(--yellow-color);
  border-color: var(--yellow-color);
  background: rgba(255, 221, 0, 0.08);
}

.drawer-tab[data-has-quiz="false"] {
  opacity: 0.3;
  pointer-events: none;
}

.quiz-tab-badge {
  margin-left: 5px;
  font-size: 0.7em;
  background: rgba(255, 221, 0, 0.12);
  color: var(--yellow-color);
  border-radius: 8px;
  padding: 1px 6px;
  font-family: monospace;
  letter-spacing: 0;
  vertical-align: middle;
}

.quiz-tab-badge-done {
  background: rgba(76, 175, 80, 0.15);
  color: #66bb6a;
}

.drawer-close {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 0.2em;
  display: flex;
  align-items: center;
  transition: color 0.2s ease;
}

.drawer-close:hover {
  color: #ff5555;
}

.drawer-close .material-icons {
  font-size: 24px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-color: var(--yellow-color) var(--black-second-color);
  scrollbar-width: thin;
  position: relative;
}

.drawer-quiz-content {
  padding: 1em 1.2em;
}

/* Scroll fade hint at the bottom of the drawer */
.drawer-body::after {
  content: '';
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  display: block;
  background: linear-gradient(transparent, var(--black-second-color));
  pointer-events: none;
}

/* Skeleton loading placeholder */
.skeleton-loading {
  padding: 1em 1.5em;
}

.skeleton-line {
  height: 14px;
  margin-bottom: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line:nth-child(2) { animation-delay: 0.1s; }
.skeleton-line:nth-child(3) { animation-delay: 0.2s; }
.skeleton-line:nth-child(4) { animation-delay: 0.15s; }
.skeleton-line:nth-child(5) { animation-delay: 0.25s; }
.skeleton-line:nth-child(6) { animation-delay: 0.1s; }
.skeleton-line:nth-child(7) { animation-delay: 0.3s; }

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Content fade-in after loading */
.section-topic-content.content-ready {
  animation: contentFadeIn 0.3s ease;
}

@keyframes contentFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Load error state */
.load-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6em;
  padding: 3em 1em;
  text-align: center;
  color: #888;
  font-family: monospace;
  font-size: 0.85em;
}

.load-error p {
  margin: 0;
  max-width: 280px;
  word-break: break-word;
}

.load-error-retry {
  background: none;
  border: 1px solid #555;
  border-radius: 4px;
  color: var(--yellow-color);
  font-family: monospace;
  font-size: 0.85em;
  padding: 0.4em 1em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.load-error-retry:hover {
  background: rgba(255, 221, 0, 0.08);
  border-color: var(--yellow-color);
}

/* Code content area — inside drawer, always visible */
.section-topic-content {
  background-color: var(--black-second-color);
  color: #ddd;
  font-family: monospace;
  font-size: 0.85em;
  line-height: 1.6;
  padding: 1em 1.5em;
  white-space: pre;
  scrollbar-color: var(--yellow-color) var(--black-second-color);
  scrollbar-width: thin;
  overflow-x: auto;
}

/* Code line numbers */
.code-block {
  counter-reset: line-number;
}

.code-line {
  display: flex !important;
  min-height: 1.2em;
}

.code-line-number {
  display: inline-block;
  min-width: 2.5em;
  padding-right: 1em;
  text-align: right;
  color: #555;
  user-select: none;
  flex-shrink: 0;
  border-right: 1px solid #333;
  margin-right: 1em;
}

/* Syntax highlighting */
.section-topic-content .code-comment {
  color: #6a9955;
}

.section-topic-content .code-keyword {
  color: #569cd6;
}

.section-topic-content .code-string {
  color: #ce9178;
}

.section-topic-content .code-number {
  color: #b5cea8;
}

.section-topic-content .code-function {
  color: #dcdcaa;
}

.section-topic-content .code-tmpl-expr {
  /* Expression inside ${...} — slightly brighter to stand out from the string */
  filter: brightness(1.25);
}

.section-topic-content .code-separator {
  color: #555;
  display: block;
  border-bottom: 1px solid #333;
  margin: 0.3em 0;
}

/* Related topics links */
.code-related {
  padding: 0.8em 0 0.3em;
  border-top: 1px solid #333;
  margin-top: 0.5em;
  white-space: normal;
  font-size: 0.95em;
}

.code-related-label {
  color: #888;
}

.code-related-link {
  color: var(--yellow-color);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.code-related-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Loading state */
.section-topic-content.loading {
  text-align: center;
  color: var(--yellow-color);
  padding: 2em 1.5em;
}

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  font-family: monospace;
  font-size: 0.85em;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--white-second-color);
  border-top-color: var(--yellow-color);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  bottom: 2em;
  left: 2em;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--black-second-color);
  border: 2px solid var(--yellow-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 100;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

.theme-toggle .material-icons {
  color: var(--yellow-color);
  font-size: 22px;
  transition: transform 0.4s ease;
}

.theme-toggle:active .material-icons {
  transform: rotate(180deg);
}

/* Cubes clickable */
.cube {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.cube:hover {
  transform: translateY(-4px);
}

/* Search results counter */
.search-results-count {
  font-family: monospace;
  font-size: 0.85em;
  color: var(--white-second-color);
  text-align: center;
  padding: 0.3em 0;
  display: none;
}

.search-results-count.visible {
  display: block;
}

/* Search highlight mark */
.roadmap-label mark {
  background: rgba(255, 221, 0, 0.35);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

[data-theme="dark"] .roadmap-label mark {
  background: rgba(255, 221, 0, 0.25);
}

/* Active search result (keyboard-navigated) */
.roadmap-node.search-active {
  background: rgba(255, 221, 0, 0.08);
  border-radius: 6px;
}

.roadmap-node.search-active .roadmap-label {
  color: var(--yellow-color);
}

/* Search filter — hidden topics / sections */
.roadmap-node.filtered-out {
  display: none;
}

.section-topic.filtered-out {
  display: none;
}

.roadmap-section.filtered-out {
  display: none;
}

.section.filtered-out {
  display: none;
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 2em;
  right: 2em;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--yellow-color);
  border: 3px solid var(--black-second-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  z-index: 100;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  filter: brightness(110%);
  transform: translateY(-2px);
}

.back-to-top .material-icons {
  color: var(--black-second-color);
  font-size: 24px;
}

/* Code toolbar (Run / Copy / Edit / Share / A-/A+) */
.code-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  padding: 0.5em 0;
  margin-bottom: 0.5em;
  border-bottom: 1px solid #333;
  white-space: normal;
}

.code-toolbar-btn {
  background: var(--black-color);
  color: var(--yellow-color);
  border: 1px solid #444;
  border-radius: 0.4em;
  padding: 0.3em 0.8em;
  cursor: pointer;
  font-family: monospace;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 0.3em;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.code-toolbar-btn:hover {
  background: #444;
  border-color: var(--yellow-color);
}

.code-toolbar-btn:active {
  transform: scale(0.95);
  background: #555;
}

.code-toolbar-separator {
  border-left: 1px solid #444;
  margin: 0 0.2em;
}

.code-toolbar-btn.size-btn {
  padding: 0.3em 0.5em;
  font-weight: bold;
  min-width: 2em;
  justify-content: center;
}

/* Code editor (editable playground) */
.code-editor {
  width: 100%;
  min-height: 300px;
  max-height: 70vh;
  background: #1a1a1a;
  color: #ddd;
  border: 1px solid #444;
  border-radius: 0.4em;
  padding: 1em;
  font-family: monospace;
  font-size: inherit;
  line-height: 1.6;
  resize: vertical;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  box-sizing: border-box;
}

.code-editor:focus {
  outline: 2px solid var(--yellow-color);
  outline-offset: -2px;
}

/* Console output panel */
#jsdojo-console {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: 120px;
  max-height: 40vh;
  background: #111;
  border-top: 3px solid var(--yellow-color);
  z-index: 200;
  display: flex;
  flex-direction: column;
  font-family: monospace;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5em 1em;
  background: #222;
  color: var(--yellow-color);
  font-weight: bold;
  font-size: 0.9em;
  border-bottom: 1px solid #333;
}

.console-actions {
  display: flex;
  gap: 2px;
}

.console-action-btn {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 2px 6px;
  display: flex;
  align-items: center;
  border-radius: 3px;
  transition: color 0.15s ease, background 0.15s ease;
}

.console-action-btn:hover {
  color: #ccc;
  background: rgba(255, 255, 255, 0.08);
}

.console-action-btn[data-action="close"]:hover {
  color: #ff5555;
}

.console-body {
  padding: 1em;
  overflow: auto;
  color: #eee;
  font-size: 0.9em;
  line-height: 1.6;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
}

.console-error { color: #f44336; }
.console-warn  { color: #ff9800; }
.console-info  { color: #64b5f6; }

/* Shortcuts overlay */
#shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.shortcuts-modal {
  background: var(--black-second-color);
  border: 2px solid var(--yellow-color);
  border-radius: 1em;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.shortcuts-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8em 1.2em;
  border-bottom: 1px solid #333;
  font-family: monospace;
  font-weight: bold;
  font-size: 1em;
  color: var(--yellow-color);
}

.shortcuts-modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 1.5em;
  cursor: pointer;
  padding: 0 0.2em;
}

.shortcuts-modal-close:hover {
  color: #ff5555;
}

.shortcuts-modal-body {
  padding: 0.8em 1.2em;
}

.shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45em 0;
  font-family: monospace;
  font-size: 0.85em;
  color: #ccc;
}

.shortcut-row kbd {
  background: #333;
  border: 1px solid #555;
  border-radius: 0.3em;
  padding: 0.15em 0.5em;
  font-family: monospace;
  font-size: 0.9em;
  color: var(--yellow-color);
  min-width: 1.5em;
  text-align: center;
}

/* Mini-quiz styles */
.topic-quiz {
  border-top: 1px solid #333;
  margin-top: 0.8em;
  padding-top: 0.8em;
  white-space: normal;
}

.topic-quiz-header {
  font-family: monospace;
  font-size: 1em;
  font-weight: bold;
  color: var(--yellow-color);
  margin-bottom: 0.4em;
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.quiz-progress-label {
  font-size: 0.75em;
  font-weight: normal;
  opacity: 0.6;
  margin-left: auto;
}

.quiz-progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-bottom: 0.8em;
  overflow: hidden;
}

.quiz-progress-bar-fill {
  height: 100%;
  background: var(--yellow-color);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.quiz-question {
  margin-bottom: 0.8em;
}

.quiz-question-text {
  color: #ddd;
  font-size: 0.95em;
  margin: 0 0 0.4em 0;
}

/* Code snippet inside quiz questions (D2: code output type) */
.quiz-code-snippet {
  background: #1a1a1a;
  border: 1px solid #333;
  border-left: 3px solid var(--yellow-color);
  border-radius: 0.4em;
  padding: 0.6em 0.8em;
  margin: 0.3em 0 0.6em 0;
  font-family: monospace;
  font-size: 0.82em;
  color: #c5c8c6;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}

[data-theme="dark"] .quiz-code-snippet {
  background: #0d0d0d;
  border-color: #222;
}

.quiz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em;
}

.quiz-option-btn {
  background: var(--black-color);
  color: #ccc;
  border: 1px solid #444;
  border-radius: 0.4em;
  padding: 0.35em 0.8em;
  cursor: pointer;
  font-family: monospace;
  font-size: 0.85em;
  transition: border-color 0.15s ease, background 0.15s ease;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
  text-align: left;
}

.quiz-option-btn:hover:not(:disabled) {
  border-color: var(--yellow-color);
  color: #fff;
}

.quiz-option-btn.quiz-correct {
  background: rgba(76, 175, 80, 0.25);
  border-color: #4caf50;
  color: #4caf50;
}

.quiz-option-btn.quiz-wrong {
  background: rgba(244, 67, 54, 0.25);
  border-color: #f44336;
  color: #f44336;
}

.quiz-option-btn.quiz-disabled {
  cursor: default;
  opacity: 0.7;
}

.quiz-explanation {
  margin-top: 0.5em;
  padding: 0.5em 0.8em;
  background: rgba(255, 221, 0, 0.08);
  border-left: 3px solid var(--yellow-color);
  border-radius: 0 4px 4px 0;
  font-size: 0.85em;
  color: #ccc;
  line-height: 1.5;
  font-family: monospace;
}

/* Hint button + hint text */
.quiz-hint-btn {
  background: none;
  border: 1px solid #555;
  border-radius: 4px;
  color: #aaa;
  font-size: 0.78em;
  padding: 0.2em 0.6em;
  cursor: pointer;
  margin-bottom: 0.4em;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.quiz-hint-btn:hover {
  color: var(--yellow-color);
  border-color: var(--yellow-color);
}

.quiz-hint {
  font-size: 0.82em;
  color: #aaa;
  font-style: italic;
  padding: 0.3em 0.6em;
  margin-bottom: 0.4em;
  border-left: 2px solid #555;
}

/* MDN link in explanation */
.quiz-mdn-link {
  display: inline-block;
  margin-left: 0.4em;
  color: var(--yellow-color);
  text-decoration: none;
  font-size: 0.9em;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.quiz-mdn-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Next topic button shown after quiz completion */
.quiz-next-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 1.2em auto 0;
  padding: 0.5em 1.2em;
  background: none;
  border: 1px solid var(--yellow-color);
  border-radius: 6px;
  color: var(--yellow-color);
  font-family: monospace;
  font-size: 0.85em;
  cursor: pointer;
  transition: background 0.2s ease;
  animation: fadeIn 0.3s ease;
}

.quiz-next-btn:hover {
  background: rgba(255, 221, 0, 0.1);
}

/* Prerequisite banner in drawer */
.prereq-banner {
  padding: 0.5em 0.8em;
  margin-bottom: 0.8em;
  background: rgba(255, 221, 0, 0.06);
  border: 1px solid rgba(255, 221, 0, 0.15);
  border-radius: 6px;
  font-size: 0.82em;
  color: #aaa;
  line-height: 1.5;
}

.prereq-link {
  color: var(--yellow-color);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
}

.prereq-link:hover {
  text-decoration-style: solid;
}

/* Spaced repetition suggestions in quiz dashboard */
.review-suggestions {
  padding: 0.3em 0.8em;
  font-size: 0.72em;
  color: #e08a3a;
  font-family: monospace;
}

/* Quiz medal badges on roadmap nodes */
.quiz-medal {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 14px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
  pointer-events: none;
  z-index: 2;
}

/* Review mode topic label */
.review-topic-label {
  display: block;
  font-size: 0.7em;
  text-transform: capitalize;
  color: var(--yellow-color);
  margin-bottom: 0.2em;
  font-weight: bold;
  letter-spacing: 0.5px;
}

/* Review button in dashboard */
.progress-dashboard-btn.review-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2em;
  padding: 0.15em 0.5em;
  font-size: 0.75em;
  font-family: monospace;
  background: #f4433620;
  color: #f44336;
  border: 1px solid #f4433640;
  border-radius: 0.3em;
  cursor: pointer;
  transition: background 0.2s;
}

.progress-dashboard-btn.review-btn:hover {
  background: #f4433640;
}

/* Footer */
.site-footer {
  max-width: var(--max-width);
  margin: 2em auto 0;
  padding: 1.5em 1em 60vh;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-family: monospace;
  font-size: 0.8em;
  color: #888;
}

.site-footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8em;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.footer-brand strong {
  color: var(--yellow-color);
  font-size: 1.1em;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: #999;
  text-decoration: none;
  font-size: 0.9em;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.footer-links a:hover {
  color: var(--yellow-color);
  border-color: var(--yellow-color);
}

.footer-links a svg {
  flex-shrink: 0;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  font-size: 0.85em;
  color: #666;
}

.footer-meta a {
  color: #999;
  text-decoration: none;
}

.footer-meta a:hover {
  color: var(--yellow-color);
}

.footer-meta kbd {
  background: #333;
  border: 1px solid #555;
  border-radius: 0.3em;
  padding: 0.1em 0.4em;
  font-family: monospace;
  font-size: 0.9em;
  color: var(--yellow-color);
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] .roadmap-section-title {
  color: var(--black-second-color);
}

[data-theme="dark"] .roadmap-track::before {
  background: #444;
}

[data-theme="dark"] .roadmap-dot {
  border-color: var(--bg-color);
}

[data-theme="dark"] .site-footer {
  border-top-color: #333;
}

[data-theme="dark"] .quiz-slide {
  background: #252525;
  box-shadow: -2px 4px 30px rgba(0, 0, 0, 0.7);
  border-left-color: #333;
}

[data-theme="dark"] .quiz-slide-header {
  border-bottom-color: var(--yellow-color);
}

[data-theme="dark"] .drawer-folder-tab {
  background: #1a1a1a;
}

[data-theme="dark"] .drawer::after {
  background: linear-gradient(225deg, #0a0a0a 50%, #2a2a2a 50%);
}

[data-theme="dark"] .drawer-tab {
  border-color: #444;
  color: #666;
}

[data-theme="dark"] .drawer-tab:hover,
[data-theme="dark"] .drawer-tab.active {
  color: var(--yellow-color);
  border-color: var(--yellow-color);
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .back-to-top,
  .code-toolbar,
  .search-results-count,
  .progress-dashboard,
  #jsdojo-console,
  .section-topic-check,
  .topic-quiz,
  .theme-toggle,
  .site-footer,
  .drawer-overlay,
  .drawer,
  .quiz-slide {
    display: none !important;
  }

  .roadmap-node {
    break-inside: avoid;
  }

  .section-topic-level {
    border: 1px solid currentColor;
  }

  body {
    font-size: 12pt;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media screen and (max-width: 860px) {
  .drawer {
    width: 100%;
    top: 0;
    height: 100%;
    border-radius: 0;
  }

  .drawer-folder-tab {
    display: none;
  }

  .drawer::before {
    display: none;
  }

  .drawer::after {
    display: none;
  }

  .quiz-slide {
    width: 100%;
    right: 0;
    z-index: 170;
    border-left: none;
    transform: translateX(100%);
  }

  .quiz-slide.open {
    transform: translateX(0) rotate(0deg);
  }
}

@media screen and (max-width: 600px) {
  .roadmap {
    padding: 0.5em;
  }

  .roadmap-track {
    padding-left: 1em;
  }

  .roadmap-track::before {
    left: calc(1em + 5px);
  }

  .roadmap-label {
    font-size: 0.85em;
  }

  .roadmap-icon {
    font-size: 18px !important;
  }

  .section-topic-content {
    font-size: 0.75em;
    line-height: 1.5;
    padding: 0.8em 1em;
  }

  .back-to-top {
    bottom: 1em;
    right: 1em;
    width: 40px;
    height: 40px;
  }

  .code-toolbar-btn {
    padding: 0.4em 0.6em;
    font-size: 0.8em;
    min-height: 36px;
  }

  .code-toolbar-separator {
    display: none;
  }

  .quiz-option-btn {
    padding: 0.5em 0.8em;
    min-height: 40px;
  }

  .quiz-hint-btn {
    min-height: 36px;
  }

  .site-footer {
    font-size: 0.75em;
  }
}
