*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* GLOBAL SCROLLBARS (WEBKIT) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

::-webkit-scrollbar-corner {
  background: transparent;
}

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-sidebar: #16162a;
  --bg-card: #1e1e34;
  --bg-hover: #252545;
  --bg-active: #2a2a50;
  --text-primary: #e8e8f0;
  --text-secondary: #9898b8;
  --text-muted: #686888;
  --accent: #a855f7;
  --accent-hover: #9333ea;
  --accent-dim: rgba(168, 85, 247, 0.15);
  --border: #2a2a45;
  --success: #22c55e;
  --shadow: rgba(0, 0, 0, 0.4);
  --header-height: 56px;
  --sidebar-width: 340px;
  --radius: 8px;
  --radius-sm: 4px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* HEADER */
#header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

#sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.course-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}


/* HEADER QUIZ BUTTON - Button with text */
.header-quiz-btn,
#quiz-toggle {
  background: rgba(168, 85, 247, 0.12) !important;
  border: 1px solid rgba(168, 85, 247, 0.3) !important;
  border-radius: 999px !important;
  padding: 5px 12px !important;
  height: 34px !important;
  min-height: 34px !important;
  width: auto !important;
  min-width: auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  color: #c084fc !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
  text-decoration: none !important;
}

.header-quiz-btn:hover,
#quiz-toggle:hover {
  background: rgba(168, 85, 247, 0.22) !important;
  border-color: #a855f7 !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 10px rgba(168, 85, 247, 0.25) !important;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* HEADER ICON BUTTONS - Modern Transparent / Ghost Style */
.header-icon-btn,
#features-link,
#transcription-toggle,
#copilot-toggle-btn,
.theme-toggle {
  background: transparent;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  box-shadow: none;
  cursor: pointer;
  position: relative;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  text-decoration: none;
  font-size: 14px;
}

.header-icon-btn svg,
#features-link svg,
#transcription-toggle svg,
#copilot-toggle-btn svg,
#quiz-toggle svg,
.theme-toggle svg {
  flex-shrink: 0;
}

.header-icon-btn:hover,
#features-link:hover,
#transcription-toggle:hover,
#copilot-toggle-btn:hover,
#quiz-toggle:hover,
.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transform: scale(1.05);
}

.header-icon-btn:focus-visible,
#features-link:focus-visible,
#transcription-toggle:focus-visible,
#copilot-toggle-btn:focus-visible,
#quiz-toggle:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Active Copilot highlight */
#copilot-toggle-btn.active {
  color: var(--accent);
  background: rgba(168, 85, 247, 0.15);
}

/* Transcription counter badge */
#transcription-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Theme toggle icon switching */
.theme-toggle .theme-icon--sun {
  display: block;
}

.theme-toggle .theme-icon--moon {
  display: none;
}

/* Progress indicator chip */
#progress-indicator {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  letter-spacing: 0.2px;
  white-space: nowrap;
  user-select: none;
  margin: 0 2px;
}

/* USER AVATAR & MATERIAL MENU (MAT-MENU) */
.user-menu-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
}

.user-avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  user-select: none;
}

.user-avatar-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
  border-color: rgba(255, 255, 255, 0.4);
}

.user-avatar-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.user-avatar-role-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #1e1e32;
}

.user-mat-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 230px;
  background: #1e1e32;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(20px);
  padding: 8px 0;
  z-index: 1000;
  animation: matMenuFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top right;
}

@keyframes matMenuFadeIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(-6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.mat-menu-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 12px;
}

.mat-menu-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.mat-menu-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.mat-menu-email {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mat-menu-role {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 1px;
}

.mat-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 6px 0;
}

.mat-menu-body {
  display: flex;
  flex-direction: column;
  padding: 2px 6px;
}

.mat-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: none;
  width: 100%;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
  box-sizing: border-box;
}

.mat-menu-item svg {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.mat-menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
}

.mat-menu-item:hover svg {
  color: var(--text-primary);
}

.mat-menu-item.mat-menu-logout {
  color: #f87171;
}

.mat-menu-item.mat-menu-logout svg {
  color: #f87171;
}

.mat-menu-item.mat-menu-logout:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.mat-menu-item.mat-menu-logout:hover svg {
  color: #ef4444;
}

.mat-menu-badge {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
}

/* LAYOUT */
#layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* SIDEBAR */
#sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: margin-left 0.3s ease;
}

#sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

#sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  text-align: left;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.14), rgba(124, 58, 237, 0.035), rgba(0, 0, 0, 0.14));
}

.sidebar-footer-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  border: 1px solid rgba(168, 85, 247, 0.24);
  border-radius: 8px;
  color: #c084fc;
  background: rgba(147, 51, 234, 0.08);
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-footer-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.sidebar-footer-copy strong {
  color: #d8d3e2;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
}

.sidebar-footer-copy small {
  color: #8d849d;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.3;
  text-transform: uppercase;
}

.week-group {
  border-bottom: 1px solid var(--border);
}

.week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.week-header:hover {
  background: var(--bg-hover);
}

.week-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.week-number {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.week-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.week-chevron {
  color: var(--text-muted);
  transition: transform 0.2s;
  display: flex;
}

.week-chevron.open {
  transform: rotate(180deg);
}

.week-lectures {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.week-lectures.open {
  max-height: 2000px;
}

.lecture-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 28px;
  cursor: pointer;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.lecture-item:hover {
  background: var(--bg-hover);
}

.lecture-item:focus-visible {
  outline: 2px solid rgba(192, 132, 252, 0.85);
  outline-offset: -2px;
  background: var(--bg-hover);
}

.lecture-item.active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.lecture-status {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.lecture-status.watched {
  color: var(--success);
}

.lecture-status.current {
  color: var(--accent);
}

.lecture-num {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 24px;
  flex-shrink: 0;
}

.lecture-item.active .lecture-num {
  color: var(--accent);
}

.lecture-title-sidebar {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.lecture-item.active .lecture-title-sidebar {
  color: var(--text-primary);
}

.sidebar-new-tab-btn {
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  margin-left: auto;
  flex-shrink: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  text-decoration: none;
}

.lecture-item:hover .sidebar-new-tab-btn {
  opacity: 1;
}

.sidebar-new-tab-btn:hover {
  color: var(--accent);
  background: rgba(168, 85, 247, 0.2);
}

.lecture-tooltip {
  position: fixed;
  z-index: 12000;
  width: max-content;
  max-width: min(300px, calc(100vw - 16px));
  padding: 8px 10px;
  color: #eeeaf8;
  border: 1px solid rgba(192, 132, 252, 0.3);
  border-radius: 8px;
  background: rgba(20, 20, 38, 0.98);
  box-shadow: 0 12px 32px rgba(3, 3, 12, 0.62);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0s linear 0.14s;
}

.lecture-tooltip::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -5px;
  width: 9px;
  height: 9px;
  border-left: 1px solid rgba(192, 132, 252, 0.3);
  border-bottom: 1px solid rgba(192, 132, 252, 0.3);
  background: #141426;
  transform: translateY(-50%) rotate(45deg);
}

.lecture-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  transition-delay: 0s;
}

.lecture-tooltip.mobile-placement::before {
  display: none;
}

.open-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 8px;
  background: rgba(168, 85, 247, 0.1);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.open-tab-btn:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.3);
}

/* MAIN */
#main {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-primary);
}

#lecture-view {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

/* VIDEO CONTAINER */
#video-container {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 16 / 9;
  max-height: 540px;
}

#video-player {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

#video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  transition: opacity 0.3s;
  z-index: 5;
}

#video-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#big-play-btn {
  background: var(--accent);
  border: none;
  color: #fff;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.4);
}

#big-play-btn:hover {
  transform: scale(1.08);
  background: var(--accent-hover);
}

/* CUSTOM CONTROLS */
#custom-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  padding: 32px 12px 8px;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s;
}

#video-container:hover #custom-controls,
#video-container.show-controls #custom-controls {
  opacity: 1;
}

#progress-bar {
  position: relative;
  height: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
}

#progress-bar:hover {
  height: 8px;
  border-radius: 4px;
}

#progress-buffer {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  border-radius: inherit;
}

#progress-current {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  z-index: 1;
}

#progress-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  display: none;
}

#progress-bar:hover #progress-thumb {
  display: block;
}

#progress-slider {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 3;
  width: 100%;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.control-btn:hover {
  color: var(--accent);
}

#speed-btn {
  font-size: 12px;
  font-weight: 600;
  min-width: 32px;
}

#volume-slider {
  width: 70px;
  height: 4px;
  accent-color: var(--accent);
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  cursor: pointer;
}

#time-display {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  font-variant-numeric: tabular-nums;
  margin-left: 6px;
}

/* LECTURE INFO */
#lecture-info {
  margin-top: 20px;
}

#lecture-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.3;
}

#lecture-description {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

#lecture-description h1,
#lecture-description h2,
#lecture-description h3 {
  color: var(--text-primary);
  margin: 20px 0 10px;
}

#lecture-description h1 { font-size: 22px; }
#lecture-description h2 { font-size: 18px; }
#lecture-description h3 { font-size: 16px; }

#lecture-description p {
  margin-bottom: 12px;
}

#lecture-description ul, #lecture-description ol {
  margin: 8px 0 12px 24px;
}

#lecture-description li {
  margin-bottom: 4px;
}

#lecture-description a {
  color: var(--accent);
  text-decoration: none;
}

#lecture-description a:hover {
  text-decoration: underline;
}

#lecture-description code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 14px;
  color: var(--accent);
}

#lecture-description pre {
  background: var(--bg-card);
  padding: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 12px 0;
  border: 1px solid var(--border);
}

#lecture-description img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 12px 0;
}

/* NAV */
#lecture-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}

.nav-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--accent);
}

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

#nav-position {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* WELCOME VIEW */
#welcome-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 40px;
}

#welcome-view.hidden {
  display: none;
}

.welcome-content {
  text-align: center;
  max-width: 500px;
}

.welcome-icon {
  color: var(--accent);
  margin-bottom: 24px;
  opacity: 0.8;
}

.welcome-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.welcome-content p {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 24px;
}

.welcome-stats {
  display: flex;
  gap: 24px;
  justify-content: center;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  text-align: center;
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* SCROLLBAR */
#sidebar::-webkit-scrollbar,
#main::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-track,
#main::-webkit-scrollbar-track {
  background: transparent;
}

#sidebar::-webkit-scrollbar-thumb,
#main::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

#sidebar::-webkit-scrollbar-thumb:hover,
#main::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* LOADING */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 12px;
}

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

/* TRANSCRIPTION PANEL */
#transcription-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  position: relative;
}

#transcription-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

#transcription-badge {
  position: absolute;
  top: 0;
  right: -2px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
}

#transcription-panel {
  position: fixed;
  top: var(--header-height);
  right: 8px;
  width: 365px;
  max-height: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px var(--shadow);
  z-index: 200;
  display: flex;
  flex-direction: column;
}

#transcription-panel.hidden {
  display: none;
}

.transcription-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sidebar);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  flex-shrink: 0;
}

.transcription-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  border-bottom: 2px solid transparent;
}

.transcription-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.transcription-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--bg-card);
}

#transcription-list {
  flex: 1;
  overflow-y: auto;
}

#transcription-list::-webkit-scrollbar {
  width: 6px;
}

#transcription-list::-webkit-scrollbar-track {
  background: transparent;
}

#transcription-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

#transcription-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.transcription-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.transcription-item:last-child {
  border-bottom: none;
}

.transcription-item-title {
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transcription-item-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.transcription-item .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.transcription-item .status-dot.queued {
  background: var(--text-muted);
}

.transcription-item .status-dot.transcribing {
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

.transcription-item .status-dot.completed {
  background: var(--success);
}

.transcription-item .status-dot.failed {
  background: #ef4444;
}

.transcription-item .status-label {
  color: var(--text-secondary);
}

.transcription-view-link {
  margin-left: auto;
  color: var(--accent);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 6px;
  border-radius: 3px;
  transition: background 0.15s;
}

.transcription-view-link:hover {
  background: var(--accent-dim);
}

.transcription-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* CC BUTTON */
#cc-btn {
  position: relative;
}

#cc-btn.cc-off {
  opacity: 0.5;
}

#cc-btn.cc-on {
  color: var(--accent);
  opacity: 1;
}

/* CAPTIONS SECTION */
#captions-section {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

#captions-status {
  font-size: 13px;
  color: var(--text-muted);
}

#gen-captions-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}

#gen-captions-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--accent);
}

#gen-captions-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#gen-captions-btn .spinner-small {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* SUBTITLE DISPLAY */
#subtitle-display {
  position: absolute;
  bottom: 60px;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 8;
  padding: 0 48px;
  opacity: 0;
  transition: opacity 0.15s;
}

#subtitle-display.active {
  opacity: 1;
}

#subtitle-display > span {
  display: inline-block;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  padding: 4px 12px;
  border-radius: 4px;
  max-width: 80%;
}

/* VIDEO LOADER / BUFFERING SPINNER */
#video-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  z-index: 6;
  transition: opacity 0.2s;
  pointer-events: none;
}

#video-loader.hidden {
  opacity: 0;
}

.video-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* FEATURES LINK */
#features-link {
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

#features-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* GITHUB COPILOT ASSISTANT SIDEBAR & FLOATING MODES */
#copilot-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

#copilot-toggle-btn:hover, #copilot-toggle-btn.active {
  background: rgba(168, 85, 247, 0.15);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.25);
}

.floating-copilot-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #7e22ce 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.floating-copilot-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.6);
}

.floating-copilot-btn.hidden {
  display: none !important;
}

/* Copilot Sidebar Panel */
.copilot-sidebar {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  height: 100%;
  position: relative;
  z-index: 50;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

.copilot-sidebar.hidden {
  display: none !important;
}

/* Floating Overlay Window Mode */
.copilot-sidebar.floating {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 400px;
  height: 600px;
  max-height: calc(100vh - 48px);
  z-index: 1000;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.copilot-drag-handle {
  display: none;
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 8px auto 0;
}

/* Copilot Header Controls */
.copilot-header {
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.copilot-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
}

.copilot-icon {
  color: var(--accent);
}

.copilot-header-model {
  flex: 1;
  min-width: 0;
}

.copilot-model-dropdown {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: border-color 0.15s;
}

.copilot-model-dropdown:hover, .copilot-model-dropdown:focus {
  border-color: var(--accent);
}

.copilot-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.copilot-action-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.copilot-action-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

/* Copilot Suggestion Pills */
.copilot-pills-container {
  display: flex;
  gap: 6px;
  padding: 10px 14px 6px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.copilot-pills-container::-webkit-scrollbar {
  display: none;
}

.copilot-pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 16px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copilot-pill-btn:hover {
  background: rgba(168, 85, 247, 0.15);
  border-color: var(--accent);
  color: #fff;
}

/* Messages Stream */
.copilot-messages {
  flex: 1;
  min-height: 0;
  padding: 14px 14px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.copilot-messages::-webkit-scrollbar {
  width: 5px;
}

.copilot-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Input Area */
.copilot-input-area {
  padding: 12px 14px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.copilot-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.copilot-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.15);
}

.copilot-input-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  outline: none;
  resize: none;
  height: 24px;
  max-height: 120px;
  overflow-y: hidden;
  padding: 3px 2px;
}

.copilot-input-wrapper textarea::-webkit-scrollbar {
  display: none;
}

.copilot-input-wrapper textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.75;
}

.copilot-input-wrapper button {
  background: linear-gradient(135deg, var(--accent) 0%, #7e22ce 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}

.copilot-input-wrapper button:hover {
  opacity: 0.95;
  transform: scale(1.04);
}

.copilot-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 2px;
}

.copilot-status-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-dot-active {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.copilot-shortcut-hint {
  font-size: 10.5px;
  opacity: 0.7;
}

/* Chat Markdown Formatting */
.chat-message {
  display: flex;
  max-width: 88%;
  width: fit-content;
}

.chat-message.bot {
  align-self: flex-start;
}

.chat-message.user {
  align-self: flex-end;
  margin-left: auto;
}

.chat-message-bubble {
  padding: 9px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: break-word;
}

.chat-message.bot .chat-message-bubble {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 16px 16px 16px 4px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.chat-message.user .chat-message-bubble {
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.3);
  font-weight: 500;
}

.chat-link {
  color: var(--accent);
  text-decoration: underline;
}

.chat-link:hover {
  color: var(--text-primary);
}

/* Markdown Render Styles in Chat */
.chat-message-bubble table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12.5px;
}

.chat-message-bubble th, .chat-message-bubble td {
  border: 1px solid var(--border);
  padding: 6px 12px;
  text-align: left;
  min-width: 110px;
}

.chat-message-bubble th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}

.chat-message-bubble h1, .chat-message-bubble h2, .chat-message-bubble h3 {
  margin: 12px 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-message-bubble ul, .chat-message-bubble ol {
  margin-left: 20px;
  margin-bottom: 8px;
}

.chat-message-bubble li {
  margin-bottom: 4px;
  font-size: 13px;
}

.chat-message-bubble p {
  margin-bottom: 8px;
}

.chat-message-bubble p:last-child {
  margin-bottom: 0;
}

.chat-message-bubble code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 4px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 12px;
}

.chat-message-bubble pre {
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 10px 0;
  border: 1px solid var(--border);
}

.chat-message-bubble pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

#chat-input-container {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  background: var(--bg-sidebar);
}

#chat-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

#chat-input:focus {
  border-color: var(--accent);
}

#chat-send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#chat-send:hover {
  background: #9333ea;
}

/* Thinking Indicator */
.chat-thinking {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 8px;
}

.chat-thinking span {
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: chatPulse 1.2s infinite;
}

.chat-thinking span:nth-child(2) { animation-delay: 0.2s; }
.chat-thinking span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatPulse {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-4px); opacity: 1; }
}

/* --- QUIZ FEATURES SYSTEM STYLE --- */
#quiz-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(147, 51, 234, 0.15);
  border: 1px solid rgba(147, 51, 234, 0.3);
  color: #c084fc;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s ease;
}

#quiz-toggle:hover {
  background: rgba(147, 51, 234, 0.3);
  border-color: #a855f7;
  color: #fff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.2);
}

#quiz-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

#quiz-modal-content {
  background: rgba(18, 12, 28, 0.95);
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: 16px;
  width: 90%;
  /* Wide enough to fit all three quiz-type buttons on one row without their
     labels wrapping; also gives quiz questions a more comfortable measure. */
  max-width: 860px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(168, 85, 247, 0.1);
  display: flex;
  flex-direction: column;
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScaleUp {
  0% { transform: scale(0.9) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

#quiz-modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}

#quiz-modal-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.quiz-modal-heading {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quiz-modal-eyebrow {
  color: #8b83a2;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

#quiz-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
  position: relative;
  z-index: 10;
}

#quiz-modal-close:hover {
  color: #ef4444;
}

/* VIEW 1: MENU STYLE */
#quiz-menu-view {
  padding: 22px 24px 24px;
}

.quiz-welcome-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.quiz-menu-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.quiz-format-count {
  padding: 4px 8px;
  border: 1px solid rgba(192, 132, 252, 0.2);
  border-radius: 999px;
  color: #b6adc8;
  background: rgba(168, 85, 247, 0.07);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}

.quiz-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}

.quiz-menu-course2 .quiz-mode-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quiz-mode-card {
  --mode-accent: #a78bfa;
  position: relative;
  min-width: 0;
  min-height: 154px;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--mode-accent) 28%, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  color: #fff;
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--mode-accent) 13%, transparent), transparent 40%),
    linear-gradient(145deg, rgba(27, 22, 39, 0.9), rgba(15, 13, 24, 0.94));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  font: inherit;
  text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

button.quiz-mode-card,
.quiz-mode-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  grid-template-areas: "icon copy" "meta meta";
  gap: 10px;
  width: 100%;
  padding: 14px;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

button.quiz-mode-card {
  min-height: 154px;
}

.quiz-mode-card[data-tone="lecture"] { --mode-accent: #38bdf8; }
.quiz-mode-card[data-tone="week"] { --mode-accent: #a78bfa; }
.quiz-mode-card[data-tone="course"] { --mode-accent: #f59e0b; }

.quiz-mode-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 16px;
  right: 16px;
  height: 1px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, transparent, var(--mode-accent), transparent);
  opacity: 0.66;
}

.quiz-mode-card:hover,
.quiz-mode-card:focus-within,
.quiz-mode-card.picker-open {
  z-index: 4;
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--mode-accent) 62%, white);
  box-shadow: 0 12px 28px rgba(2, 2, 10, 0.3), 0 0 18px color-mix(in srgb, var(--mode-accent) 8%, transparent);
}

.quiz-mode-card:focus-visible,
.quiz-mode-main:focus-visible,
.week-quiz-picker-trigger:focus-visible,
.week-quiz-picker-option:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--mode-accent, #a78bfa) 72%, white);
  outline-offset: 3px;
}

.quiz-mode-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid color-mix(in srgb, var(--mode-accent) 36%, transparent);
  border-radius: 9px;
  color: color-mix(in srgb, var(--mode-accent) 82%, white);
  background: color-mix(in srgb, var(--mode-accent) 12%, rgba(255, 255, 255, 0.025));
}

.quiz-mode-copy {
  grid-area: copy;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.quiz-mode-kicker {
  margin-bottom: 3px;
  color: var(--mode-accent);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.quiz-mode-copy strong {
  overflow: hidden;
  color: #f7f5fb;
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quiz-mode-copy small {
  margin-top: 5px;
  color: #938da3;
  font-size: 11px;
  line-height: 1.45;
}

.quiz-mode-meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  align-self: end;
  padding-top: 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.quiz-mode-count {
  color: color-mix(in srgb, var(--mode-accent) 70%, white);
  font-size: 10.5px;
  font-weight: 750;
}

.quiz-mode-arrow {
  color: #7b748a;
  transition: color 0.15s ease, transform 0.15s ease;
}

.quiz-mode-card:hover .quiz-mode-arrow,
.quiz-mode-main:hover .quiz-mode-arrow {
  color: var(--mode-accent);
  transform: translateX(2px);
}

button.quiz-mode-card:disabled,
.quiz-mode-main:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.quiz-mode-card:disabled:hover {
  transform: none;
  box-shadow: none;
}

.quiz-week-card {
  display: flex;
  flex-direction: column;
}

.quiz-mode-main {
  flex: 1;
  padding-bottom: 10px;
}

.quiz-mode-main .quiz-mode-meta {
  border-top: 0;
  padding-top: 4px;
}

.week-quiz-picker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 12px 12px;
  padding: 8px 9px;
  border: 1px solid rgba(167, 139, 250, 0.18);
  border-radius: 8px;
  background: rgba(167, 139, 250, 0.065);
}

.week-quiz-picker-caption {
  color: #81798e;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.week-quiz-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 3px 5px;
  border: 0;
  color: #e5dcff;
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.week-quiz-picker-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-quiz-picker-trigger svg {
  flex-shrink: 0;
  color: #a78bfa;
  transition: transform 0.15s ease;
}

.week-quiz-picker-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.week-quiz-picker-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 7px);
  left: -1px;
  right: -1px;
  display: grid;
  gap: 3px;
  padding: 5px;
  border: 1px solid rgba(167, 139, 250, 0.34);
  border-radius: 9px;
  background: rgba(17, 14, 27, 0.985);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(18px);
}

.week-quiz-picker-menu.hidden {
  display: none;
}

.week-quiz-picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #c9c4d3;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.week-quiz-picker-option > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.week-quiz-picker-option strong {
  color: inherit;
  font-size: 11.5px;
}

.week-quiz-picker-option small {
  color: #756d82;
  font-size: 9.5px;
}

.week-quiz-picker-option:hover,
.week-quiz-picker-option:focus-visible {
  border-color: rgba(167, 139, 250, 0.16);
  color: #fff;
  background: rgba(167, 139, 250, 0.09);
}

.week-quiz-picker-option[aria-selected="true"] {
  color: #eee9ff;
  background: rgba(167, 139, 250, 0.14);
}

.week-quiz-picker-check {
  flex-shrink: 0;
  color: #a78bfa;
  opacity: 0;
}

.week-quiz-picker-option[aria-selected="true"] .week-quiz-picker-check {
  opacity: 1;
}

.quiz-history-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.quiz-history-heading > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quiz-history-heading span {
  color: #8e849d;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.quiz-history-heading h4 {
  margin: 0;
  color: #f1edf7;
  font-size: 14px;
}

.quiz-history-heading > small {
  color: #756e83;
  font-size: 10.5px;
}

.quiz-action-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #fff;
  padding: 14px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.quiz-action-btn svg {
  flex-shrink: 0;
}

.quiz-action-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
  border-color: #a855f7;
}

.quiz-action-btn:active:not(:disabled) {
  transform: translateY(0);
}

.quiz-action-btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text-primary);
}

.quiz-action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-secondary);
  box-shadow: none;
}

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

.quiz-history-section > h4 {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

#quiz-history-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.no-history-text {
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.quiz-history-item {
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.012));
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 11px 13px;
  border-radius: 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.quiz-history-item:hover {
  transform: translateX(2px);
  background: linear-gradient(110deg, rgba(167, 139, 250, 0.085), rgba(255, 255, 255, 0.018));
  border-color: rgba(167, 139, 250, 0.28);
}

.history-item-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-item-title {
  font-size: 13px;
  font-weight: 650;
  color: var(--text-primary);
}

.history-item-meta {
  font-size: 11px;
  color: var(--text-secondary);
}

.history-item-score {
  font-size: 13px;
  font-weight: 750;
  padding: 4px 8px;
  border-radius: 6px;
}

.history-item-score.pass {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.history-item-score.fail {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* VIEW 2: QUESTION PANEL STYLE */
#quiz-question-view {
  padding: 24px;
}

.quiz-progress-container {
  margin-bottom: 20px;
}

.quiz-progress-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

#quiz-progress-text {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.quiz-timer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.quiz-timer-badge.low {
  border-color: rgba(74, 222, 128, 0.35);
  color: #4ade80;
}

.quiz-timer-badge.mid {
  border-color: rgba(250, 204, 21, 0.35);
  color: #facc15;
}

.quiz-timer-badge.high {
  border-color: rgba(248, 113, 113, 0.35);
  color: #f87171;
}

.quiz-timer-badge.urgent {
  background: rgba(248, 113, 113, 0.12);
  border-color: #f87171;
  color: #f87171;
  animation: quiz-timer-pulse 1s ease-in-out infinite;
}

@keyframes quiz-timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.quiz-difficulty-label {
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.quiz-progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
  overflow: hidden;
}

#quiz-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #a855f7, #ec4899);
  width: 0%;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#quiz-question-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 20px;
}

#quiz-options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.quiz-option-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  padding: 14px 18px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
  font-size: 13.5px;
  color: var(--text-primary);
  position: relative;
}

.quiz-option-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.2);
}

.quiz-option-card.selected {
  background: rgba(147, 51, 234, 0.08);
  border-color: #a855f7;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.1);
}

.quiz-option-card input[type="checkbox"],
.quiz-option-card input[type="radio"] {
  accent-color: #a855f7;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.quiz-true-false-container {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
}

.quiz-tf-btn {
  flex: 1 1 0;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  padding: 22px 18px;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.2s;
}

.quiz-tf-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.2);
}

.quiz-tf-btn.selected {
  background: rgba(147, 51, 234, 0.08);
  border-color: #a855f7;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.1);
}

.quiz-footer-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

/* VIEW 3: RESULTS PANEL STYLE */
#quiz-results-view {
  padding: 24px;
}

.quiz-score-ring-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 26px;
}

.quiz-score-ring {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: conic-gradient(#a855f7 0%, #ec4899 var(--score-percent, 0%), rgba(255, 255, 255, 0.05) var(--score-percent, 0%) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.15);
  margin-bottom: 12px;
  position: relative;
}

.quiz-score-ring::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(18, 12, 28, 0.95);
  z-index: 1;
}

.quiz-score-ring span {
  position: relative;
  z-index: 2;
}

#quiz-score-fraction {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.quiz-score-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

#quiz-grade-text {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

#quiz-review-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 26px;
  padding-right: 4px;
}

.quiz-review-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.quiz-review-q-header {
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.quiz-review-q-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.quiz-review-q-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-review-chevron {
  display: flex;
  align-items: center;
  transition: transform 0.2s;
  color: var(--text-muted);
}

.quiz-review-item.collapsed .quiz-review-chevron {
  transform: rotate(-90deg);
}

.quiz-review-item.collapsed .quiz-review-q-body {
  display: none !important;
}

.quiz-review-item.correct {
  border-color: rgba(34, 197, 94, 0.3);
}

.quiz-review-item.correct .quiz-review-q-header {
  background: rgba(34, 197, 94, 0.05);
  color: #4ade80;
}

.quiz-review-item.incorrect {
  border-color: rgba(239, 68, 68, 0.3);
}

.quiz-review-item.incorrect .quiz-review-q-header {
  background: rgba(239, 68, 68, 0.05);
  color: #f87171;
}

.quiz-review-q-body {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.01);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-review-choice {
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-review-choice.user-selected {
  font-weight: 600;
}

.quiz-review-choice.user-selected.correct {
  color: #4ade80;
}

.quiz-review-choice.user-selected.incorrect {
  color: #f87171;
}

.quiz-review-choice.correct-answer {
  color: #4ade80;
  font-weight: 600;
}

.quiz-review-explanation {
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.2);
  padding: 10px 12px;
  border-radius: 6px;
  line-height: 1.45;
  border-left: 3px solid #a855f7;
  margin-top: 6px;
}

.quiz-results-footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 18px;
}

/* LOADING SPINNER FOR QUIZ */
.quiz-loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 0;
  gap: 16px;
}

.quiz-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(168, 85, 247, 0.1);
  border-radius: 50%;
  border-top-color: #a855f7;
  animation: quizSpin 1s linear infinite;
}

@keyframes quizSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Global hidden class helper */
.hidden {
  display: none !important;
}

/* MCQ Options Review styling */
.quiz-review-options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  margin-top: 6px;
}

.quiz-review-option-item {
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(255, 255, 255, 0.01);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.quiz-review-option-item.correct-choice {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
  color: #4ade80;
  font-weight: 500;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.08);
}

.quiz-review-option-item.incorrect-choice {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
  color: #f87171;
  font-weight: 500;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.08);
}

.option-icon {
  font-weight: bold;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* --- AUTH SYSTEM STYLE --- */
#auth-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(147, 51, 234, 0.15);
  border: 1px solid rgba(147, 51, 234, 0.3);
  color: #c084fc;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s ease;
}

#auth-toggle:hover {
  background: rgba(147, 51, 234, 0.3);
  border-color: #a855f7;
  color: #fff;
}

#user-badge {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
}

#auth-modal-content {
  background: rgba(18, 12, 28, 0.95);
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: 16px;
  width: 90%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(168, 85, 247, 0.1);
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#auth-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}

#auth-modal-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#auth-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#login-form, #request-access-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#request-access-pending {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

#request-access-pending .quiz-action-btn {
  margin: 16px auto 0;
  display: inline-flex;
  width: auto;
  padding: 8px 18px;
}

.auth-input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.auth-input:focus {
  border-color: #a855f7;
}

#auth-error-text {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}

#auth-switch-text {
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

#auth-switch-text a {
  color: #c084fc;
  cursor: pointer;
  text-decoration: none;
}

#auth-switch-text a:hover {
  text-decoration: underline;
}

#admin-dashboard-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s ease;
}

#admin-dashboard-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-secondary);
}

#admin-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#admin-modal-content {
  background: rgba(18, 12, 28, 0.95);
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: 16px;
  width: 90%;
  max-width: 720px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(168, 85, 247, 0.1);
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#admin-modal-header {
  flex-shrink: 0;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}

.admin-tabs {
  flex-shrink: 0;
  display: flex;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  padding: 0 16px;
}

.admin-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  border-bottom: 2px solid transparent;
}

.admin-tab:hover {
  color: var(--text-primary);
}

.admin-tab.active {
  color: #c084fc;
  border-bottom-color: #a855f7;
}

#admin-modal-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

#admin-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}

#admin-modal-close:hover {
  color: #ef4444;
}

#admin-modal-body {
  padding: 16px 24px 24px;
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-users-table th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-users-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  white-space: nowrap;
}

.admin-email-cell {
  display: inline-block;
  vertical-align: middle;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: default;
}

.admin-users-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-badge.pending {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
}

.status-badge.approved {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.status-badge.rejected {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.admin-actions-cell {
  vertical-align: middle;
}

.admin-request-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-request-actions .quiz-action-btn {
  padding: 6px 14px;
  font-size: 13px;
  white-space: nowrap;
}

.admin-no-action {
  color: var(--text-muted, rgba(255, 255, 255, 0.4));
  font-size: 14px;
  display: inline-block;
}

#admin-dashboard-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible !important;
}

.admin-pending-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: linear-gradient(160deg, #fb7185 0%, #dc2626 100%);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  border: 2px solid var(--bg-secondary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  z-index: 10;
}

.admin-pending-badge::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 1px solid #f43f5e;
  animation: admin-badge-ring 2.6s cubic-bezier(0.2, 0.6, 0.4, 1) infinite;
}

.admin-pending-badge.hidden {
  display: none !important;
}

@keyframes admin-badge-ring {
  0% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  70%, 100% {
    transform: scale(1.7);
    opacity: 0;
  }
}

#admin-reports-btn {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25) 0%, rgba(139, 92, 246, 0.25) 100%);
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #e9d5ff;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius, 8px);
  cursor: pointer !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(168, 85, 247, 0.15);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#admin-reports-btn:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.45) 0%, rgba(139, 92, 246, 0.45) 100%);
  border-color: #a855f7;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.35);
  transform: translateY(-1px);
  cursor: pointer !important;
}

#admin-reports-link {
  text-decoration: none;
  cursor: pointer;
}

#admin-quiz-banks-btn {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25) 0%, rgba(14, 165, 233, 0.25) 100%);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #bae6fd;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius, 8px);
  cursor: pointer !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.15);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#admin-quiz-banks-btn:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.45) 0%, rgba(14, 165, 233, 0.45) 100%);
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.35);
  transform: translateY(-1px);
  cursor: pointer !important;
}

#admin-quiz-banks-link {
  text-decoration: none;
  cursor: pointer;
}

/* Student-facing counterpart to the admin Reports button (emerald, so the two
   are never confused at a glance). Shown to app-users only. */
#my-report-btn {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(5, 150, 105, 0.25) 100%);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #a7f3d0;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius, 8px);
  cursor: pointer !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.15);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#my-report-btn:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.45) 0%, rgba(5, 150, 105, 0.45) 100%);
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
  cursor: pointer !important;
}

#my-report-link {
  text-decoration: none;
  cursor: pointer;
}

/* ADMIN QUIZ REPORTS MODAL & ANALYTICS */
#admin-reports-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

#admin-reports-modal-content {
  background: var(--bg-card, #14151f);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 16px;
  width: 100%;
  max-width: 800px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

#admin-reports-modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#admin-reports-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary, #f3f4f6);
}

#admin-reports-modal-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 22px;
  cursor: pointer;
}

#admin-reports-modal-close:hover {
  color: #fff;
}

#admin-reports-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-quiz-filter-bar input {
  width: 100%;
  box-sizing: border-box;
}

.admin-quiz-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #8b5cf6;
  margin-bottom: 4px;
}

.stat-title {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* TOAST / SNACKBAR NOTIFICATION CONTAINER */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 420px;
  width: calc(100vw - 48px);
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(20, 21, 31, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  padding: 12px 16px;
  border-radius: 12px;
  color: #f3f4f6;
  font-size: 14px;
  line-height: 1.4;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-item.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.toast-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
}

.toast-item.success .toast-icon {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.toast-item.error .toast-icon {
  background: rgba(244, 63, 94, 0.2);
  color: #f43f5e;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.toast-item.info .toast-icon {
  background: rgba(139, 92, 246, 0.2);
  color: #8b5cf6;
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.toast-item.warning .toast-icon {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.toast-content {
  flex: 1;
  word-break: break-word;
}

.toast-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.toast-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

/* --- INTERACTIVE LECTURE DESCRIPTION (compact, tabbed) --- */
.idesc-container {
  display: flex;
  flex-direction: column;
  background: rgba(18, 19, 31, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  margin-top: 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
}

/* Tab bar */
.idesc-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.idesc-tab {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease;
}

.idesc-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.idesc-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.idesc-tab-count {
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(139, 92, 246, 0.18);
  color: #d8b4fe;
  padding: 1px 6px;
  border-radius: 10px;
}

/* Panels */
.idesc-panels {
  position: relative;
  overflow: hidden;
  transition: height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.idesc-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px 16px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.idesc-panel[hidden] {
  display: none;
}

.idesc-panel.idesc-fade {
  opacity: 0;
  transform: translateY(6px);
}

.idesc-overview-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.idesc-overview-points {
  margin-top: 12px;
}

.idesc-overview-points li {
  font-size: 13px;
}

/* KEY CONCEPTS: jump pills + accordion */
.concept-badges-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.concept-tag-badge {
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #d8b4fe;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.concept-tag-badge:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: #a855f7;
  color: #fff;
}

.topics-linear-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topic-detail-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

.topic-detail-card[open] {
  border-color: rgba(168, 85, 247, 0.35);
}

.topic-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}

.topic-summary::-webkit-details-marker {
  display: none;
}

.topic-summary-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.topic-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
}

.topic-simple-def {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.topic-chevron {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.topic-detail-card[open] .topic-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.topic-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
}

.topic-breakdown {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

.topic-analogy {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 8px 12px;
  border-radius: 8px;
  color: #fef08a;
  font-size: 12px;
  line-height: 1.45;
}

/* Scannable bullet points inside a concept card */
.topic-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.topic-points li {
  position: relative;
  padding-left: 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.topic-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.topic-example {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 8px 12px;
  border-radius: 8px;
  color: #bae6fd;
  font-size: 12px;
  line-height: 1.45;
background: rgba(139, 92, 246, 0.18);
  color: #d8b4fe;
  padding: 1px 6px;
  border-radius: 10px;
}

/* Panels */
.idesc-panels {
  position: relative;
  overflow: hidden;
  transition: height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.idesc-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px 16px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.idesc-panel[hidden] {
  display: none;
}

.idesc-panel.idesc-fade {
  opacity: 0;
  transform: translateY(6px);
}

.idesc-overview-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.idesc-overview-points {
  margin-top: 12px;
}

.idesc-overview-points li {
  font-size: 13px;
}

/* KEY CONCEPTS: jump pills + accordion */
.concept-badges-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.concept-tag-badge {
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #d8b4fe;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.concept-tag-badge:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: #a855f7;
  color: #fff;
}

.topics-linear-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.topic-detail-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

.topic-detail-card[open] {
  border-color: rgba(168, 85, 247, 0.35);
}

.topic-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}

.topic-summary::-webkit-details-marker {
  display: none;
}

.topic-summary-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.topic-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
}

.topic-simple-def {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.topic-chevron {
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.topic-detail-card[open] .topic-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.topic-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
}

.topic-breakdown {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

.topic-analogy {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 8px 12px;
  border-radius: 8px;
  color: #fef08a;
  font-size: 12px;
  line-height: 1.45;
}

/* Scannable bullet points inside a concept card */
.topic-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.topic-points li {
  position: relative;
  padding-left: 16px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.topic-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.topic-example {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 8px 12px;
  border-radius: 8px;
  color: #bae6fd;
  font-size: 12px;
  line-height: 1.45;
}

.topic-breakdown code,
.topic-points code,
.topic-example code,
#lecture-description .topic-breakdown code,
#lecture-description .topic-points code,
#lecture-description .topic-example code {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'Fira Code', monospace, Consolas;
  font-size: 0.95em;
  color: #38bdf8;
}

.topic-example code,
#lecture-description .topic-example code {
  color: #7dd3fc;
  background: rgba(255, 255, 255, 0.1);
}

/* 8-stages / N-stages breakdown */
.topic-stages-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stage-step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 8px 10px;
}

.stage-step-item.sweet-spot {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.35);
}

.stage-step-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: #c084fc;
  background: rgba(192, 132, 252, 0.15);
  border: 1px solid rgba(192, 132, 252, 0.3);
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.stage-step-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
}

.stage-step-title {
  color: #ffffff;
  font-weight: 600;
}

.stage-step-desc {
  color: var(--text-secondary);
  font-size: 12px;
}

/* PRACTICAL OUTCOME */
.achievement-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(139, 92, 246, 0.12) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 12px 14px;
}

.achievement-icon {
  font-size: 19px;
  line-height: 1;
}

.achievement-content h4 {
  font-size: 12.5px;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 4px;
}

.achievement-content p {
  font-size: 12.5px;
  line-height: 1.5;
  color: #e5e7eb;
}

.section-sub-header h4 {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  margin: 4px 0 0;
}

/* PROMPTS */
.prompts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-block-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.prompt-block-card pre,
#lecture-description .prompt-block-card pre {
  margin: 0 !important;
  padding: 0 !important;
  min-width: 0;
  max-height: none !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  font-family: inherit !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
  color: var(--text-primary) !important;
  flex: 1 1 auto;
}

.prompt-block-card code,
#lecture-description .prompt-block-card code {
  display: inline !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: inherit !important;
  font-family: inherit !important;
  font-size: inherit !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
}

.prompt-block-card .copy-cmd-btn {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 1px;
}

/* COMMANDS */
.commands-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.command-block-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.command-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.command-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(15, 16, 26, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 7px 10px;
  border-radius: 7px;
  overflow-x: auto;
}

.command-code-row code,
#lecture-description .command-code-row code {
  font-family: 'Fira Code', monospace, Consolas;
  font-size: 12.5px;
  color: #38bdf8;
  background: transparent;
  padding: 0;
  border: 0;
  border-radius: 0;
  white-space: nowrap;
}

.copy-cmd-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  flex-shrink: 0;
  align-self: flex-start;
}

.copy-cmd-btn:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: var(--accent);
}

.copy-cmd-btn.copied {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #10b981;
}

/* RESOURCES */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.resource-link-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.15s ease;
}

.resource-link-card:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.4);
  transform: translateY(-1px);
}

.resource-title {
  font-size: 12.5px;
  font-weight: 600;
  flex: 1;
  padding-right: 8px;
}

/* =====================================================================
   RESPONSIVE — kept last on purpose: these overrides target rules defined
   throughout the file, and at equal specificity the later rule wins.
   Adding new responsive rules anywhere above this point will silently
   lose to the base rules that follow them.

   Breakpoints: 1600px (small/medium laptop)
             -> 1024px (narrow desktop / tablet landscape)
             -> 768px  (tablet portrait; sidebar becomes an overlay)
             -> 600px  (phone; modals go edge-to-edge)
             -> 400px  (small phone).

   The header is a single fixed-height row that other elements anchor to
   (--header-height positions the sidebar and transcription panel), so
   rather than letting it wrap it progressively drops its lowest-value
   items, with horizontal scroll as a last-resort safety net.
/* Drag & Drop Model Flow Designer Styles */
.llm-flow-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 4px 0;
}

.llm-flow-card {
  background: linear-gradient(145deg, rgba(30, 30, 52, 0.7) 0%, rgba(22, 22, 42, 0.9) 100%);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 16px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.llm-flow-card:hover {
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: 0 12px 36px rgba(168, 85, 247, 0.12);
}

.llm-flow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.llm-flow-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.llm-flow-icon {
  font-size: 20px;
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2) 0%, rgba(147, 51, 234, 0.1) 100%);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.15);
}

.llm-flow-title h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  letter-spacing: -0.2px;
}

.llm-flow-title p {
  font-size: 12px;
  color: var(--text-secondary);
}

.llm-flow-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.1);
}

.drag-flow-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.drag-flow-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(22, 22, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: grab;
  user-select: none;
  transition: all 0.2s ease;
  flex-wrap: nowrap;
}

.drag-flow-item:hover {
  border-color: rgba(168, 85, 247, 0.5);
  background: rgba(30, 30, 52, 0.95);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.drag-flow-item.dragging {
  opacity: 0.45;
  border-style: dashed;
  border-color: var(--accent);
  background: rgba(168, 85, 247, 0.05);
}

.drag-handle {
  color: var(--text-secondary);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.drag-handle:hover,
.drag-flow-item:hover .drag-handle {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.flow-step-badge {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 5px 10px;
  border-radius: 8px;
  text-align: center;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 105px;
}

.flow-step-badge.step-0 {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.flow-step-badge.step-1 {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.flow-step-badge.step-2 {
  background: rgba(168, 85, 247, 0.12);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.flow-step-badge.step-3 {
  background: rgba(251, 146, 60, 0.12);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.35);
}

.provider-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.provider-icon-wrapper {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.provider-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.provider-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
}

.reorder-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.reorder-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.reorder-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}

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

.flow-pipeline-bar {
  background: rgba(15, 15, 26, 0.7);
  border: 1px dashed rgba(168, 85, 247, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
}

.pipeline-label-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 1.8s infinite;
  display: inline-block;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; box-shadow: 0 0 12px #10b981; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.pipeline-node-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(30, 30, 52, 0.8);
  border: 1px solid var(--border);
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.pipeline-node-item.primary {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.15);
}

.pipeline-arrow {
  color: rgba(168, 85, 247, 0.6);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.save-llm-flow-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

@media (max-width: 1600px) {
  :root {
    --sidebar-width: clamp(250px, 19vw, 300px);
  }

  .week-header {
    padding-left: 12px;
    padding-right: 12px;
  }

  .lecture-item {
    gap: 8px;
    padding-left: 20px;
    padding-right: 12px;
  }

  .lecture-num {
    min-width: 22px;
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }

  #lecture-view {
    padding: 18px;
  }
}

@media (max-width: 768px) {
  :root {
    /* Cap the overlay so the underlying video stays partly visible on narrow phones.
       Both the width and the .collapsed offset read this, so they stay in sync. */
    --sidebar-width: clamp(244px, 72vw, 280px);
  }

  #sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    z-index: 50;
    box-shadow: 2px 0 20px var(--shadow);
  }

  #sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
  }

  .lecture-item {
    gap: 7px;
    padding-left: 16px;
    padding-right: 10px;
  }

  .lecture-num {
    min-width: 21px;
  }

  .lecture-tooltip {
    max-width: calc(100vw - 16px);
  }

  #lecture-view {
    padding: 12px;
  }

  #lecture-title {
    font-size: 17px;
  }

  /* Header: tighten spacing and drop the two purely informational items. */
  #header {
    padding: 0 10px;
  }

  .header-right {
    gap: 6px;
    overflow: visible !important;
  }

  .header-right::-webkit-scrollbar {
    display: none;
  }

  .header-right > * {
    flex-shrink: 0;
  }

  #progress-indicator,
  #user-badge {
    display: none;
  }

  /* Video: drop the volume slider (touch devices use hardware volume) and
     let the frame use the full width. */
  #volume-slider {
    display: none;
  }

  #video-container {
    max-height: none;
  }

  #time-display {
    font-size: 11px;
  }

  .controls-left,
  .controls-right {
    gap: 2px;
  }

  /* Floating panels: never wider than the viewport. */
  #transcription-panel {
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 60vh;
  }

  #copilot-sidebar:not(.floating) {
    position: fixed;
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100% !important;
    height: 88vh;
    max-height: 88vh;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-top: 1px solid var(--border);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.7);
    z-index: 9999;
  }

  .copilot-drag-handle {
    display: block !important;
  }
}

@media (max-width: 600px) {
  .course-title {
    font-size: 14px;
    max-width: 38vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-left {
    gap: 6px;
    min-width: 0;
  }

  /* Admin shortcuts collapse to their icons so the primary controls
     (Quiz, Admin, Log Out) still fit without scrolling the header. */
  .btn-label {
    display: none;
  }

  /* The features page is reachable from the sidebar footer area and is the
     least-used header item — drop it before anything functional. */
  #features-link {
    display: none;
  }

  .header-right {
    gap: 5px;
  }

  #admin-dashboard-btn,
  #auth-toggle,
  #admin-reports-btn,
  #admin-quiz-banks-btn,
  #my-report-btn {
    font-size: 12px;
    padding: 6px 8px;
  }

  /* Modals go edge-to-edge — at this width, insets waste room the content needs. */
  #quiz-modal-content,
  #admin-modal-content {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  #quiz-modal-content {
    overflow-y: auto;
  }

  #admin-modal-content {
    /* Keeps the sticky header/tabs pinned while only the body scrolls. */
    overflow: hidden;
  }

  #quiz-modal-header,
  #admin-modal-header {
    padding: 14px 16px;
  }

  #quiz-modal-title,
  #admin-modal-title {
    font-size: 16px;
  }

  #quiz-menu-view,
  #admin-modal-body {
    padding: 16px;
  }

  .quiz-menu-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
  }

  .quiz-mode-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 22px;
  }

  .quiz-menu-course2 .quiz-mode-grid {
    grid-template-columns: 1fr;
  }

  .quiz-mode-card,
  button.quiz-mode-card {
    min-height: 0;
  }

  button.quiz-mode-card,
  .quiz-mode-main {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto;
    grid-template-areas: "icon copy meta";
    align-items: center;
    padding: 13px;
  }

  .quiz-mode-meta {
    align-self: center;
    flex-direction: column;
    align-items: flex-end;
    padding: 0;
    border-top: 0;
  }

  .quiz-mode-copy small {
    margin-top: 3px;
  }

  .quiz-mode-main {
    padding-bottom: 9px;
  }

  .week-quiz-picker {
    margin: 0 10px 10px;
  }

  .quiz-history-heading > small {
    display: none;
  }

  #quiz-question-text {
    font-size: 15px;
  }

  .quiz-option-card {
    padding: 12px 14px;
    font-size: 13px;
  }

  .quiz-history-item {
    flex-wrap: wrap;
    gap: 6px;
  }

  #auth-modal-content {
    width: calc(100% - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .quiz-mode-card,
  .quiz-mode-arrow,
  .week-quiz-picker-trigger svg,
  .quiz-history-item {
    transition: none;
  }

  .quiz-mode-card:hover,
  .quiz-mode-card:focus-within,
  .quiz-mode-card.picker-open,
  .quiz-history-item:hover {
    transform: none;
  }
}

@media (max-width: 400px) {
  .course-title {
    display: none;
  }

  #quiz-toggle {
    font-size: 12px;
    padding: 6px 9px;
  }

  .quiz-score-ring {
    width: 96px;
    height: 96px;
  }
}

/* =====================================================================
   COURSE COPILOT — learning-focused interface refresh
   Kept at the end so these intentional component and responsive overrides
   win over the legacy chat rules above without affecting the course player.
   ===================================================================== */
.copilot-sidebar {
  width: clamp(370px, 27vw, 440px);
  background:
    radial-gradient(circle at 80% -10%, rgba(56, 189, 248, 0.09), transparent 28%),
    radial-gradient(circle at 12% 8%, rgba(168, 85, 247, 0.12), transparent 30%),
    #121222;
  border-left-color: rgba(168, 85, 247, 0.24);
  box-shadow: -16px 0 50px rgba(4, 4, 14, 0.2);
}

.copilot-sidebar.floating {
  width: min(430px, calc(100vw - 32px));
  height: min(720px, calc(100dvh - 48px));
  max-height: calc(100dvh - 48px);
  border-radius: 20px;
  border-color: rgba(168, 85, 247, 0.34);
  box-shadow: 0 24px 80px rgba(4, 4, 14, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.025) inset;
}

.copilot-header {
  min-height: 68px;
  padding: 12px 14px;
  background: rgba(15, 15, 29, 0.86);
  border-bottom-color: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
}

.copilot-header-title {
  min-width: 0;
  gap: 10px;
}

.copilot-brand-mark {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  color: #fff;
  border: 1px solid rgba(192, 132, 252, 0.42);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(168, 85, 247, 0.34), rgba(56, 189, 248, 0.12));
  box-shadow: 0 8px 22px rgba(126, 34, 206, 0.22);
}

.copilot-brand-mark::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.8);
}

.copilot-title-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.copilot-title-copy strong {
  color: #f5f3ff;
  font-size: 14px;
  letter-spacing: -0.15px;
}

.copilot-title-copy small {
  overflow: hidden;
  color: #8585a6;
  font-size: 10.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copilot-header-actions {
  gap: 3px;
}

.copilot-action-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
}

.copilot-action-btn:hover {
  border-color: rgba(168, 85, 247, 0.22);
  background: rgba(168, 85, 247, 0.12);
}

.copilot-action-btn:focus-visible,
.copilot-pill-btn:focus-visible,
#chat-send:focus-visible,
.chat-copy-btn:focus-visible,
.copilot-model-dropdown:focus-visible {
  outline: 2px solid #c084fc;
  outline-offset: 2px;
}

.copilot-model-bar {
  min-height: 45px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 18, 34, 0.76);
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}

.copilot-model-bar label {
  color: #727290;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.copilot-model-dropdown {
  min-width: 0;
  flex: 1;
  width: auto;
  padding: 6px 27px 6px 9px;
  color: #d9d5e8;
  border-color: rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background-color: rgba(255, 255, 255, 0.035);
  font-size: 11px;
  font-weight: 650;
}

.copilot-grounding-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #8fe5ca;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.copilot-grounding-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.65);
}

.copilot-context-card {
  margin: 10px 14px 4px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.075), rgba(168, 85, 247, 0.055));
}

.copilot-context-icon {
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  display: grid;
  place-items: center;
  color: #7dd3fc;
  border-radius: 9px;
  background: rgba(56, 189, 248, 0.09);
}

.copilot-context-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.copilot-context-copy small {
  color: #767696;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.copilot-context-copy strong {
  overflow: hidden;
  color: #d9e9f5;
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copilot-pills-container {
  gap: 7px;
  padding: 8px 14px 10px;
  background: transparent;
  border-bottom-color: rgba(255, 255, 255, 0.045);
}

.copilot-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 31px;
  padding: 6px 10px;
  color: #aaa6c5;
  border-color: rgba(255, 255, 255, 0.075);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 10.5px;
  font-weight: 650;
}

.copilot-pill-btn span {
  color: #c084fc;
  font-size: 12px;
}

.copilot-pill-btn:hover {
  color: #f5f3ff;
  border-color: rgba(168, 85, 247, 0.38);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.14), rgba(56, 189, 248, 0.07));
  transform: translateY(-1px);
}

.copilot-messages {
  gap: 16px;
  padding: 18px 14px 26px;
  scroll-behavior: smooth;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.013) 1px, transparent 1px);
  background-size: 30px 30px;
}

.copilot-welcome-card {
  position: relative;
  overflow: hidden;
  padding: 17px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 13px;
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(168, 85, 247, 0.11), rgba(23, 23, 42, 0.84) 56%, rgba(56, 189, 248, 0.07));
  box-shadow: 0 16px 38px rgba(3, 3, 12, 0.22);
}

.copilot-welcome-card::after {
  content: '';
  position: absolute;
  width: 110px;
  height: 110px;
  top: -72px;
  right: -42px;
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: 50%;
}

.copilot-welcome-orbit {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(192, 132, 252, 0.3);
  border-radius: 50%;
  background: rgba(168, 85, 247, 0.1);
}

.copilot-welcome-orbit::before,
.copilot-welcome-orbit::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}

.copilot-welcome-orbit::before {
  inset: 8px;
  border: 1px solid rgba(125, 211, 252, 0.4);
}

.copilot-welcome-orbit::after,
.copilot-welcome-orbit span {
  width: 7px;
  height: 7px;
  background: #c084fc;
  box-shadow: 0 0 12px rgba(192, 132, 252, 0.7);
}

.copilot-welcome-eyebrow {
  color: #b98bf2;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.copilot-welcome-card h3 {
  margin: 4px 0 6px;
  color: #f4f1fb;
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: -0.2px;
}

.copilot-welcome-card p {
  margin: 0;
  color: #9895b3;
  font-size: 11.5px;
  line-height: 1.55;
}

.chat-message {
  max-width: 94%;
  align-items: flex-start;
  gap: 8px;
}

.chat-message.user {
  max-width: 86%;
}

.chat-message-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chat-message.user .chat-message-content {
  align-items: flex-end;
}

.chat-message-avatar {
  position: relative;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(168, 85, 247, 0.22), rgba(56, 189, 248, 0.08));
}

.chat-message-avatar span {
  width: 8px;
  height: 8px;
  border: 2px solid #c084fc;
  border-radius: 3px;
  transform: rotate(45deg);
}

.chat-message-avatar.thinking span {
  animation: copilotAvatarThink 1.6s ease-in-out infinite;
}

.chat-message-meta {
  margin: 0 0 5px 2px;
  color: #747390;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.chat-message-bubble {
  padding: 11px 13px;
  font-size: 12.5px;
  line-height: 1.6;
}

.chat-message.bot .chat-message-bubble {
  background: rgba(25, 25, 45, 0.94);
  border-color: rgba(255, 255, 255, 0.08);
  border-radius: 5px 15px 15px 15px;
  box-shadow: 0 10px 28px rgba(3, 3, 12, 0.18);
}

.chat-message.user .chat-message-bubble {
  border: 1px solid rgba(192, 132, 252, 0.38);
  border-radius: 15px 5px 15px 15px;
  background: linear-gradient(135deg, #9333ea, #6d28d9);
  box-shadow: 0 10px 24px rgba(88, 28, 135, 0.27);
}

.chat-message-actions {
  min-height: 23px;
  padding: 4px 0 0 2px;
  display: flex;
  align-items: center;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.chat-message.bot:hover .chat-message-actions,
.chat-message.bot:focus-within .chat-message-actions {
  opacity: 1;
  transform: translateY(0);
}

.chat-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  color: #777692;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: 9.5px;
  cursor: pointer;
}

.chat-copy-btn:hover,
.chat-copy-btn.copied {
  color: #c4b5fd;
  background: rgba(168, 85, 247, 0.1);
}

.chat-thinking-bubble {
  min-width: 190px;
}

.chat-thinking {
  padding: 1px 2px;
  gap: 4px;
}

.chat-thinking .chat-thinking-label {
  width: auto;
  height: auto;
  margin-right: 6px;
  color: #9a97b3;
  border-radius: 0;
  background: transparent;
  font-size: 10.5px;
  animation: none;
}

.chat-thinking i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c084fc;
  animation: chatPulse 1.2s infinite;
}

.chat-thinking i:nth-of-type(2) { animation-delay: 0.15s; }
.chat-thinking i:nth-of-type(3) { animation-delay: 0.3s; }

.copilot-input-area {
  padding: 12px 14px 10px;
  gap: 7px;
  background: rgba(15, 15, 29, 0.94);
  border-top-color: rgba(255, 255, 255, 0.065);
  backdrop-filter: blur(18px);
}

.copilot-input-wrapper {
  min-height: 50px;
  padding: 7px 8px 7px 12px;
  align-items: flex-end;
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.copilot-input-wrapper:focus-within {
  border-color: rgba(192, 132, 252, 0.58);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.11), 0 10px 28px rgba(3, 3, 12, 0.18);
}

.copilot-input-wrapper textarea,
#chat-input {
  min-width: 0;
  height: 30px;
  padding: 5px 2px;
  border: 0;
  background: transparent;
  font-size: 12.5px;
  line-height: 1.5;
}

.copilot-input-wrapper button,
#chat-send {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  background: linear-gradient(145deg, #b15cff, #7c3aed);
  box-shadow: 0 7px 18px rgba(126, 34, 206, 0.34);
}

.copilot-input-wrapper button:disabled,
#chat-send:disabled {
  color: #66637b;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
  transform: none;
}

.copilot-status-indicator[data-state="thinking"] .status-dot-active {
  background: #c084fc;
  box-shadow: 0 0 8px rgba(192, 132, 252, 0.75);
  animation: copilotStatusPulse 1.2s ease-in-out infinite;
}

.copilot-status-indicator[data-state="error"] {
  color: #fca5a5;
}

.copilot-status-indicator[data-state="error"] .status-dot-active {
  background: #ef4444;
}

.copilot-shortcut-hint kbd {
  padding: 1px 4px;
  color: #8e8ba6;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom-color: rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.035);
  font-family: inherit;
  font-size: 9px;
}

@keyframes copilotAvatarThink {
  0%, 100% { transform: rotate(45deg) scale(0.9); opacity: 0.65; }
  50% { transform: rotate(225deg) scale(1.05); opacity: 1; }
}

@keyframes copilotStatusPulse {
  0%, 100% { opacity: 0.45; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

@media (max-width: 1100px) and (min-width: 769px) {
  .copilot-sidebar {
    width: 360px;
  }
}

@media (max-width: 768px) {
  #copilot-sidebar,
  #copilot-sidebar.floating,
  #copilot-sidebar:not(.floating) {
    position: fixed;
    inset: auto 0 0 0;
    width: 100% !important;
    height: min(88dvh, 760px);
    max-height: 88dvh;
    border: 1px solid rgba(168, 85, 247, 0.28);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -24px 70px rgba(4, 4, 14, 0.78);
    z-index: 9999;
  }

  .copilot-drag-handle {
    display: block !important;
    flex: 0 0 4px;
    background: rgba(255, 255, 255, 0.17);
  }

  .copilot-header {
    min-height: 62px;
    padding-top: 8px;
  }

  .chat-message-actions {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 520px) {
  #copilot-sidebar,
  #copilot-sidebar.floating,
  #copilot-sidebar:not(.floating) {
    height: 92dvh;
    max-height: 92dvh;
  }

  .copilot-title-copy small,
  .copilot-grounding-badge,
  .copilot-shortcut-hint {
    display: none;
  }

  .copilot-header {
    min-height: 56px;
    padding: 8px 10px;
  }

  .copilot-brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 10px;
  }

  .copilot-model-bar,
  .copilot-pills-container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .copilot-context-card {
    margin-left: 10px;
    margin-right: 10px;
  }

  .copilot-messages {
    padding: 14px 10px 20px;
  }

  .copilot-welcome-card {
    grid-template-columns: 36px 1fr;
    padding: 14px;
  }

  .copilot-welcome-orbit {
    width: 36px;
    height: 36px;
  }

  .chat-message,
  .chat-message.user {
    max-width: 96%;
  }

  .copilot-input-area {
    padding: 10px max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }
}

@media (prefers-reduced-motion: reduce) {
  .copilot-sidebar *,
  .floating-copilot-btn {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- COURSE 2 VISUAL LEARNING RAIL --- */
.course-visual-card {
  --visual-accent: #a855f7;
  margin: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--visual-accent) 30%, rgba(255, 255, 255, 0.08));
  border-radius: 12px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--visual-accent) 8%, rgba(10, 12, 23, 0.96)), rgba(9, 10, 19, 0.96));
  box-shadow: 0 18px 44px rgba(3, 4, 12, 0.2);
}

.course-visual-expand {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2752 / 1536;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #f3f0e8;
  cursor: zoom-in;
}

.course-visual-expand img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.32s cubic-bezier(0.2, 0.75, 0.25, 1), filter 0.25s ease;
}

.course-visual-expand:hover img,
.course-visual-expand:focus-visible img {
  transform: scale(1.018);
  filter: saturate(1.04) contrast(1.02);
}

.course-visual-expand:focus-visible,
.course-visual-watch:focus-visible,
.concept-phase-link:focus-visible,
.lecture-visual-lightbox-close:focus-visible,
.lecture-visual-lightbox-zoom:focus-visible {
  outline: 2px solid #f5f3ff;
  outline-offset: 3px;
}

.course-visual-expand-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 7px;
  color: #fff;
  background: rgba(8, 10, 18, 0.78);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  font-size: 11px;
  font-weight: 700;
}

.course-visual-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 14px;
}

.course-visual-eyebrow {
  color: var(--visual-accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.course-visual-copy > strong {
  color: #fff;
  font-size: 14px;
  line-height: 1.3;
}

.course-visual-copy > p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.55;
}

.course-visual-anchors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.course-visual-watch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--visual-accent) 36%, rgba(255, 255, 255, 0.1));
  border-radius: 7px;
  color: #eeeaff;
  background: color-mix(in srgb, var(--visual-accent) 12%, rgba(255, 255, 255, 0.035));
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.course-visual-watch svg {
  color: var(--visual-accent);
}

.course-visual-watch time {
  padding-left: 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  color: color-mix(in srgb, var(--visual-accent) 75%, white);
  font-family: 'Fira Code', monospace, Consolas;
  font-size: 10px;
}

.course-visual-watch:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--visual-accent) 68%, white);
  background: color-mix(in srgb, var(--visual-accent) 20%, rgba(255, 255, 255, 0.05));
}

.concept-phase-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.concept-phase-link {
  --phase-accent: #a855f7;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid color-mix(in srgb, var(--phase-accent) 28%, rgba(255, 255, 255, 0.08));
  border-radius: 8px;
  color: #d8d5e5;
  background: color-mix(in srgb, var(--phase-accent) 7%, rgba(255, 255, 255, 0.025));
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.concept-phase-link > span {
  color: var(--phase-accent);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.concept-phase-link:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--phase-accent) 60%, white);
  background: color-mix(in srgb, var(--phase-accent) 13%, rgba(255, 255, 255, 0.035));
}

.concept-phase-link[data-accent="cyan"] { --phase-accent: #38bdf8; }
.concept-phase-link[data-accent="violet"] { --phase-accent: #a78bfa; }
.concept-phase-link[data-accent="amber"] { --phase-accent: #f59e0b; }
.concept-phase-link[data-accent="emerald"] { --phase-accent: #34d399; }

.course-concept-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.course-concept-group {
  --phase-accent: #a78bfa;
  scroll-margin-top: 76px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--phase-accent) 24%, rgba(255, 255, 255, 0.07));
  border-left-width: 3px;
  border-radius: 10px;
  background: linear-gradient(125deg, color-mix(in srgb, var(--phase-accent) 6%, rgba(255, 255, 255, 0.025)), rgba(255, 255, 255, 0.012) 50%);
}

.course-concept-group[data-accent="cyan"] { --phase-accent: #38bdf8; }
.course-concept-group[data-accent="violet"] { --phase-accent: #a78bfa; }
.course-concept-group[data-accent="amber"] { --phase-accent: #f59e0b; }
.course-concept-group[data-accent="emerald"] { --phase-accent: #34d399; }
.course-concept-group .course-visual-card { --visual-accent: var(--phase-accent); }

.course-concept-group-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.course-concept-phase {
  margin-top: 2px;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--phase-accent) 34%, transparent);
  border-radius: 5px;
  color: var(--phase-accent);
  background: color-mix(in srgb, var(--phase-accent) 11%, transparent);
  font-family: 'Fira Code', monospace, Consolas;
  font-size: 9.5px;
  font-weight: 800;
  white-space: nowrap;
}

.course-concept-group-header h3 {
  margin: 0;
  color: #fff;
  font-size: 15px;
  line-height: 1.3;
}

.course-concept-group-header p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.course-concept-check {
  padding: 10px 12px;
  border: 1px solid rgba(52, 211, 153, 0.24);
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.075);
}

.course-concept-check > span {
  color: #6ee7b7;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.course-concept-check ol {
  margin: 7px 0 0;
  padding-left: 20px;
  color: #d6efe6;
  font-size: 12px;
  line-height: 1.55;
}

.visual-lightbox-open {
  overflow: hidden;
}

.lecture-visual-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(3, 4, 10, 0.9);
  backdrop-filter: blur(16px);
}

.lecture-visual-lightbox.hidden {
  display: none;
}

.lecture-visual-lightbox-shell {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: min(96vw, 1760px);
  height: min(92vh, 1050px);
  overflow: hidden;
  border: 1px solid rgba(192, 132, 252, 0.3);
  border-radius: 14px;
  background: #0c0d16;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}

.lecture-visual-lightbox-canvas {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: auto;
  background: #ece9e0;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y pinch-zoom;
}

.lecture-visual-lightbox-canvas img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lecture-visual-lightbox-canvas img.is-zoomed {
  max-width: none;
  max-height: none;
  width: 2752px;
  height: auto;
}

.lecture-visual-lightbox-close,
.lecture-visual-lightbox-zoom {
  position: absolute;
  z-index: 2;
  top: 10px;
  display: grid;
  place-items: center;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #fff;
  background: rgba(9, 10, 18, 0.82);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.lecture-visual-lightbox-close {
  right: 10px;
  width: 34px;
  font-size: 24px;
  line-height: 1;
}

.lecture-visual-lightbox-zoom {
  right: 52px;
  width: auto;
  padding: 0 10px;
  font-family: 'Fira Code', monospace, Consolas;
  font-size: 10px;
  font-weight: 800;
}

.lecture-visual-lightbox-caption {
  margin: 0;
  padding: 11px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #c9c6d6;
  background: rgba(15, 16, 27, 0.98);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .course-visual-expand-hint {
    right: 7px;
    bottom: 7px;
    padding: 5px 7px;
    font-size: 10px;
  }

  .course-visual-copy {
    padding: 10px 11px 12px;
  }

  .course-visual-watch {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .course-visual-watch time {
    margin-left: auto;
  }

  .concept-phase-nav {
    grid-template-columns: 1fr;
  }

  .course-concept-group {
    padding: 9px;
  }

  .course-concept-group-header {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .course-concept-phase {
    justify-self: start;
  }

  .lecture-visual-lightbox {
    padding: 0;
  }

  .lecture-visual-lightbox-shell {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .lecture-visual-lightbox-canvas img.is-zoomed {
    width: 2200px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .course-visual-expand img,
  .course-visual-watch,
  .concept-phase-link {
    transition: none;
  }

  .course-visual-expand:hover img,
  .course-visual-expand:focus-visible img,
  .course-visual-watch:hover,
  .concept-phase-link:hover {
    transform: none;
  }
}

/* Compact Copilot density pass — prioritizes conversation height. */
.copilot-header {
  min-height: 50px;
  padding: 7px 10px;
}

.copilot-brand-mark {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  border-radius: 9px;
}

.copilot-brand-mark::after {
  top: 3px;
  right: 3px;
  width: 4px;
  height: 4px;
}

.copilot-title-copy strong {
  font-size: 13px;
}

.copilot-title-copy small {
  display: none;
}

.copilot-action-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.copilot-model-bar {
  min-height: 36px;
  padding: 4px 10px;
  gap: 7px;
}

.copilot-model-bar label {
  display: none;
}

.copilot-model-dropdown {
  height: 28px;
  padding: 3px 24px 3px 8px;
  color-scheme: dark;
  border-radius: 7px;
  font-size: 10.5px;
}

.copilot-model-dropdown option {
  color: #e5e1ee;
  background: #17172b;
}

.copilot-grounding-badge {
  font-size: 9.5px;
}

.copilot-context-card {
  min-height: 31px;
  margin: 5px 10px 3px;
  padding: 4px 8px;
  gap: 7px;
  border-radius: 8px;
}

.copilot-context-icon {
  width: 21px;
  height: 21px;
  flex-basis: 21px;
  border-radius: 6px;
}

.copilot-context-icon svg {
  width: 12px;
  height: 12px;
}

.copilot-context-label {
  color: #6f6f8d;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

#copilot-context-title {
  min-width: 0;
  overflow: hidden;
  flex: 1;
  color: #cac7da;
  font-size: 10.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copilot-pills-container {
  min-height: 38px;
  padding: 4px 10px 6px;
  gap: 5px;
}

.copilot-pill-btn {
  min-height: 27px;
  padding: 4px 8px;
  gap: 4px;
  border-radius: 8px;
  font-size: 9.5px;
}

.copilot-pill-btn span {
  font-size: 10px;
}

.copilot-messages {
  gap: 10px;
  padding: 10px 10px 14px;
}

.copilot-welcome-card {
  min-height: 56px;
  padding: 9px 11px;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 9px;
  border-radius: 11px;
}

.copilot-welcome-card::after {
  display: none;
}

.copilot-welcome-orbit {
  width: 30px;
  height: 30px;
}

.copilot-welcome-orbit::before {
  inset: 6px;
}

.copilot-welcome-orbit::after,
.copilot-welcome-orbit span {
  width: 5px;
  height: 5px;
}

.copilot-welcome-card > div > strong {
  display: block;
  margin-bottom: 2px;
  color: #eeeaf7;
  font-size: 11.5px;
  line-height: 1.25;
}

.copilot-welcome-context {
  color: #c9c4d8;
  font-weight: 700;
}

.copilot-welcome-card p {
  overflow: hidden;
  display: -webkit-box;
  color: #8e8ba5;
  font-size: 10px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.chat-message {
  gap: 6px;
}

.chat-message-avatar {
  width: 23px;
  height: 23px;
  flex-basis: 23px;
  border-radius: 7px;
}

.chat-message-avatar span {
  width: 6px;
  height: 6px;
}

.chat-message-meta {
  margin-bottom: 3px;
  font-size: 8.5px;
}

.chat-message-bubble {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.48;
}

.chat-message-bubble p {
  margin-bottom: 5px;
}

.chat-message-bubble ul,
.chat-message-bubble ol {
  margin: 4px 0 5px 17px;
}

.chat-message-bubble li {
  margin-bottom: 2px;
  font-size: 11.75px;
}

.chat-message-bubble h1,
.chat-message-bubble h2,
.chat-message-bubble h3 {
  margin: 8px 0 4px;
  font-size: 12.5px;
}

.chat-message-actions {
  min-height: 18px;
  padding-top: 2px;
}

.chat-copy-btn {
  padding: 2px 5px;
  font-size: 8.5px;
}

.chat-thinking-bubble {
  min-width: 170px;
}

.copilot-input-area {
  padding: 8px 10px 7px;
  gap: 5px;
}

.copilot-input-wrapper {
  min-height: 42px;
  padding: 4px 5px 4px 9px;
  border-radius: 11px;
}

.copilot-input-wrapper textarea,
#chat-input {
  height: 27px;
  padding: 4px 1px;
  font-size: 11.5px;
}

.copilot-input-wrapper button,
#chat-send {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.copilot-input-footer {
  min-height: 14px;
  font-size: 9.5px;
}

.copilot-shortcut-hint {
  font-size: 9px;
}

@media (max-width: 520px) {
  .copilot-header {
    min-height: 46px;
    padding: 6px 8px;
  }

  .copilot-model-bar {
    padding-left: 8px;
    padding-right: 8px;
  }

  .copilot-context-card {
    margin-left: 8px;
    margin-right: 8px;
  }

  .copilot-pills-container {
    padding-left: 8px;
    padding-right: 8px;
  }

  .copilot-pill-btn {
    flex: 0 0 auto;
  }

  .copilot-messages {
    padding: 8px 8px 12px;
  }

  .copilot-input-area {
    padding-top: 7px;
  }
}

/* Custom model picker: avoids the bright operating-system select menu. */
.copilot-model-caption,
.copilot-native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.copilot-model-picker {
  position: relative;
  min-width: 0;
  flex: 1;
  z-index: 140;
}

.copilot-model-trigger {
  width: 100%;
  height: 28px;
  min-width: 0;
  padding: 3px 7px 3px 5px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #ddd9ea;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: none;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.copilot-model-trigger:hover,
.copilot-model-trigger.is-open {
  border-color: rgba(192, 132, 252, 0.48);
  background: rgba(168, 85, 247, 0.09);
}

.copilot-model-trigger.is-open {
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.1);
}

.copilot-model-trigger:focus-visible,
.copilot-model-option:focus-visible {
  outline: 2px solid #c084fc;
  outline-offset: 2px;
}

.copilot-provider-mark {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-size: 8px;
  font-weight: 850;
  line-height: 1;
}

.copilot-provider-groq {
  color: #fef3c7;
  background: linear-gradient(145deg, rgba(245, 158, 11, 0.38), rgba(234, 88, 12, 0.2));
}

.copilot-provider-gemini {
  color: #dbeafe;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.4), rgba(168, 85, 247, 0.22));
}

.copilot-provider-openai {
  color: #d1fae5;
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.36), rgba(5, 150, 105, 0.16));
}

.copilot-provider-flow {
  color: #c084fc;
  background: linear-gradient(145deg, rgba(168, 85, 247, 0.4), rgba(56, 189, 248, 0.22));
}

.copilot-provider-ollama {
  color: #93c5fd;
  background: linear-gradient(145deg, rgba(99, 102, 241, 0.38), rgba(59, 130, 246, 0.2));
}

.copilot-model-label {
  min-width: 0;
  overflow: hidden;
  flex: 1;
  font-size: 10.5px;
  font-weight: 650;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copilot-model-chevron {
  flex: 0 0 12px;
  color: #8f8ba5;
  transition: transform 0.18s ease, color 0.18s ease;
}

.copilot-model-trigger.is-open .copilot-model-chevron {
  color: #d8b4fe;
  transform: rotate(180deg);
}

.copilot-model-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  min-width: 238px;
  padding: 4px;
  display: grid;
  gap: 2px;
  border: 1px solid rgba(192, 132, 252, 0.25);
  border-radius: 10px;
  background: rgba(20, 20, 38, 0.985);
  box-shadow: 0 18px 42px rgba(2, 2, 10, 0.68), 0 0 0 1px rgba(255, 255, 255, 0.025) inset;
  backdrop-filter: blur(18px);
  transform-origin: top center;
}

.copilot-model-menu.is-open {
  animation: copilotModelMenuIn 0.17s cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.copilot-model-option {
  width: 100%;
  min-height: 36px;
  padding: 4px 7px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 8px;
  color: #b8b4ca;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transform: none;
  transition: color 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.copilot-model-option:hover,
.copilot-model-option:focus-visible {
  color: #f5f3ff;
  border-color: rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.055);
  transform: none;
}

.copilot-model-option.selected {
  color: #f2eaff;
  border-color: rgba(168, 85, 247, 0.22);
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.15), rgba(56, 189, 248, 0.05));
}

.copilot-model-option-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.copilot-model-option-copy strong {
  color: inherit;
  font-size: 10.5px;
  font-weight: 750;
  white-space: nowrap;
}

.copilot-model-option-copy small {
  overflow: hidden;
  color: #74718a;
  font-size: 9px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copilot-model-option.selected .copilot-model-option-copy small {
  color: #a39db6;
}

.copilot-model-check {
  color: #c084fc;
  font-size: 11px;
  font-weight: 850;
  opacity: 0;
}

.copilot-model-option.selected .copilot-model-check {
  opacity: 1;
}

@keyframes copilotModelMenuIn {
  from { opacity: 0; transform: translateY(-5px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Persistent collapsed state lets both directions animate before hiding interaction. */
#copilot-sidebar {
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  transition:
    width 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.36s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.36s ease,
    visibility 0s linear 0s;
  will-change: width, opacity, transform;
}

#copilot-sidebar.is-collapsed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(18px);
  transition:
    width 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.36s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.36s ease,
    visibility 0s linear 0.42s;
}

@media (min-width: 769px) {
  #copilot-sidebar:not(.floating).is-collapsed {
    width: 0;
    border-left-color: transparent;
  }

  #copilot-sidebar.floating.is-collapsed {
    transform: translateY(10px) scale(0.985);
  }
}

@media (max-width: 768px) {
  #copilot-sidebar.is-collapsed,
  #copilot-sidebar.floating.is-collapsed {
    width: 100% !important;
    opacity: 0;
    transform: translateY(24px);
  }

  .copilot-model-menu {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .copilot-model-menu,
  .copilot-model-chevron {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  #copilot-sidebar {
    transform: none;
    transition:
      width 0.24s ease-out,
      opacity 0.2s ease-out,
      border-color 0.2s ease-out,
      visibility 0s linear 0s !important;
  }

  #copilot-sidebar.is-collapsed {
    transform: none;
    transition:
      width 0.24s ease-out,
      opacity 0.2s ease-out,
      border-color 0.2s ease-out,
      visibility 0s linear 0.24s !important;
  }
}

/* ===== SINGLE-COLOR FOCUS STAR & CURRICULUM STYLES ===== */

.focus-star-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fbbf24;
  margin-left: auto;
  margin-right: 4px;
  flex-shrink: 0;
  line-height: 1;
  cursor: help;
  filter: drop-shadow(0 0 3px rgba(245, 158, 11, 0.45));
  transition: transform 0.15s ease;
}

.focus-star-icon:hover {
  transform: scale(1.25);
}

.focus-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.45);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1.5px 5.5px;
  border-radius: 4px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-left: auto;
  margin-right: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.lecture-item.is-focus-lecture {
  border-left: 2px solid rgba(245, 158, 11, 0.6);
}

.hidden-by-filter {
  display: none !important;
}

.sidebar-filter-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-filter-pill {
  flex: 1;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.sidebar-filter-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-filter-pill.active {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.45);
}

.week-focus-pill {
  font-size: 10.5px;
  font-weight: 600;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 6px;
}

/* Curriculum Planner Modal */
#curriculum-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#curriculum-modal.hidden {
  display: none;
}

.curriculum-modal-dialog {
  background: #13121a;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 16px;
  width: 92%;
  max-width: 980px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(245, 158, 11, 0.08);
  overflow: hidden;
  animation: modalScaleUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.curriculum-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}

.curriculum-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.curriculum-brand-icon {
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.curriculum-header-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.curriculum-header-title p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.curriculum-modal-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  padding: 14px 24px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
}

.curr-stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  text-align: center;
  transition: transform 0.15s;
}

.curr-stat-card.highlight {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
}

.curr-stat-num {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: #fbbf24;
}

.curr-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.curriculum-modal-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.01);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.curriculum-presets {
  display: flex;
  align-items: center;
  gap: 8px;
}

.curr-preset-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.curr-preset-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.curr-preset-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.curr-preset-btn.active {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.5);
}

.curriculum-search-box input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  width: 220px;
}

.curriculum-search-box input:focus {
  outline: none;
  border-color: #fbbf24;
}

.curriculum-modal-body {
  flex: 1;
  overflow-y: auto;
  min-height: 240px;
  padding: 0;
}

.curriculum-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.curriculum-table th {
  position: sticky;
  top: 0;
  background: #181622;
  padding: 10px 14px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  z-index: 2;
}

.curriculum-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.curr-week-divider td {
  background: rgba(255, 255, 255, 0.03);
  color: #e2e8f0;
  font-weight: 700;
  font-size: 12.5px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.curr-row:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.curr-row.focus-row td {
  background: rgba(245, 158, 11, 0.02);
}

.curr-lecture-cell {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.curr-lecture-id {
  font-size: 11px;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
}

.curr-lecture-title {
  color: var(--text-primary);
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.curr-topic-tag {
  display: inline-block;
  font-size: 11px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 4px;
}

.curr-focus-toggle {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.curr-focus-toggle.active {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.5);
}

.curr-checkbox-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.curr-check {
  width: 16px;
  height: 16px;
  accent-color: #f59e0b;
  cursor: pointer;
}

.curriculum-modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.curr-status-text {
  font-size: 12px;
  color: #10b981;
  opacity: 0;
  transition: opacity 0.2s;
}

.curr-status-text.visible {
  opacity: 1;
}


/* ==========================================================================
   INSTRUCTOR EXAM QUESTIONS STYLES
   ========================================================================== */
.header-exam-btn, #exam-toggle { display: none !important; }

.header-exam-btn:hover {
  background: rgba(14, 165, 233, 0.22) !important;
  border-color: #38bdf8 !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.25) !important;
}

#exam-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 12, 0.8);
  backdrop-filter: blur(8px);
}

#exam-modal.hidden {
  display: none !important;
}

.exam-modal-dialog {
  width: min(940px, 95vw);
  max-width: 940px;
  max-height: min(880px, 90vh);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: #131221;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.exam-modal-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(22, 22, 40, 0.95);
}

.exam-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.exam-brand-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.12);
}

.exam-header-title {
  min-width: 0;
}

.exam-header-eyebrow {
  color: #38bdf8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.exam-header-title h3 {
  margin: 0 0 2px;
  color: #f8fafc;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.2px;
}

.exam-header-title p {
  margin: 0;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.35;
}

.exam-modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
  color: #94a3b8;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.exam-modal-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.exam-tabs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: rgba(14, 14, 26, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
}

.exam-tab-btn {
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #94a3b8;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.exam-tab-btn:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
}

.exam-tab-btn.active {
  color: #ffffff;
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(56, 189, 248, 0.5);
  font-weight: 700;
}

.exam-tab-pill {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.exam-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: rgba(14, 14, 26, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  gap: 12px;
}

.exam-controls-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.exam-ctrl-btn {
  padding: 5px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.exam-ctrl-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.exam-progress-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 600;
}

.exam-badge-tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
}

.exam-badge-tag.good { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.4); }
.exam-badge-tag.mid { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.4); }
.exam-badge-tag.low { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.4); }

.exam-modal-body {
  flex: 1;
  min-height: 0;
  padding: 20px 24px;
  overflow-y: auto;
  background: #0c0c17;
}

.exam-questions-container,
.exam-questions-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.exam-question-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(22, 22, 38, 0.85);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.18s ease;
}

.exam-question-card.is-correct {
  border-color: rgba(52, 211, 153, 0.45);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.08);
}

.exam-question-card.is-incorrect {
  border-color: rgba(248, 113, 113, 0.45);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.08);
}

.exam-q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.exam-q-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.exam-q-num {
  font-size: 11px;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 6px;
  border-radius: 5px;
}

.exam-q-section {
  font-size: 11px;
  font-weight: 700;
  color: #c084fc;
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  padding: 2px 8px;
  border-radius: 5px;
}

.exam-q-type {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.05);
}

.exam-result-badge {
  font-size: 11px;
  font-weight: 750;
  padding: 2px 8px;
  border-radius: 6px;
}

.exam-result-badge.pass {
  color: #34d399;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.exam-result-badge.fail {
  color: #f87171;
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.exam-q-text {
  font-size: 14.5px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.45;
}

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

.exam-option-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 14, 26, 0.6);
  color: #d4d4d8;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.exam-option-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.exam-option-item.selected {
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-weight: 600;
}

.exam-option-marker {
  font-size: 14px;
  color: #94a3b8;
  flex: 0 0 16px;
  text-align: center;
}

.exam-option-item.selected .exam-option-marker {
  color: #38bdf8;
}

.exam-option-text {
  flex: 1;
}

.exam-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.exam-check-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.exam-check-btn:hover {
  background: rgba(14, 165, 233, 0.28);
  color: #ffffff;
}

.exam-toggle-answer-btn {
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.exam-toggle-answer-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.exam-toggle-answer-btn.active {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.4);
  color: #c084fc;
}

.exam-explanation-box {
  margin-top: 6px;
  padding: 14px;
  border-radius: 10px;
  background: rgba(14, 14, 26, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exam-explanation-box.hidden {
  display: none !important;
}

.exam-correct-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  gap: 10px;
}

.exam-correct-text {
  font-size: 12.5px;
  color: #f1f5f9;
}

.exam-correct-label {
  color: #34d399;
  font-weight: 750;
  margin-right: 6px;
}

.exam-concept-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 750;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.exam-exp-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.exam-exp-heading {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.exam-exp-body {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #cbd5e1;
}

.exam-example-section {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.exam-example-heading {
  font-size: 11.5px;
  font-weight: 750;
  color: #38bdf8;
}

.exam-example-body {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #bae6fd;
}

.exam-modal-footer {
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(20, 20, 38, 0.95);
}

.exam-footer-note {
  font-size: 11.5px;
  color: #94a3b8;
}

.exam-close-footer-btn {
  height: 34px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.15s ease;
}

.exam-close-footer-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Lecture description exam section */
.exam-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.exam-section-eyebrow {
  color: #38bdf8;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 3px;
}

.exam-section-title h4 {
  margin: 0 0 3px;
  font-size: 16px;
  font-weight: 750;
  color: var(--text-primary);
}

.exam-section-title p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}


/* ==========================================================================
   MOBILE USER MAT-MENU FIXES
   ========================================================================== */
@media (max-width: 768px) {
  .header-right {
    overflow: visible !important;
  }

  .user-mat-menu {
    position: fixed !important;
    top: 54px !important;
    right: 10px !important;
    left: auto !important;
    width: min(280px, calc(100vw - 20px)) !important;
    min-width: 240px !important;
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100vh - 70px) !important;
    overflow-y: auto !important;
    z-index: 100000 !important;
    border-radius: 14px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75) !important;
    transform-origin: top right;
  }
}

@media (max-width: 480px) {
  .user-mat-menu {
    top: 52px !important;
    right: 6px !important;
    width: calc(100vw - 12px) !important;
    min-width: auto !important;
  }
}
