/* ============================================================
   Cyber IQ - Dark Theme Stylesheet
   Theme: Maroon / Black / Dark Gray
   ============================================================ */

/* ----- CSS Variables ----- */
:root {
  --primary: #800020;
  --primary-dark: #5c0017;
  --primary-light: #a0002a;
  --primary-hover: #9a0028;
  --primary-glow: rgba(128, 0, 32, 0.4);
  --bg-dark: #0a0a0a;
  --bg-surface: #111111;
  --bg-card: #1a1a1a;
  --bg-card-hover: #222222;
  --bg-elevated: #242424;
  --bg-input: #1e1e1e;
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --border-color: #2a2a2a;
  --border-light: #3a3a3a;
  --success: #00c853;
  --success-dark: #009624;
  --error: #ff1744;
  --error-dark: #c41230;
  --warning: #ffab00;
  --info: #2979ff;
  --easy: #00c853;
  --medium: #ffab00;
  --hard: #ff1744;
  --expert: #d500f9;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --transition: 0.2s ease;
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  --mono-font: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}

/* ----- Reset & Base ----- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: #c0003a; }

img { max-width: 100%; display: block; }

ul { list-style: none; }

/* ----- Scrollbar ----- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ============================================================
   NAVIGATION
   ============================================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary) !important;
}
.logo-icon { width: 32px; height: 34px; display: block; }
.logo-accent { color: var(--primary-light); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  color: var(--text-secondary) !important;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-link:hover {
  color: var(--text-primary) !important;
  background: rgba(255,255,255,0.05);
}
.nav-link.active {
  color: var(--primary-light) !important;
  background: rgba(128,0,32,0.15);
}

.lang-switch {
  display: flex;
  gap: 2px;
  margin-inline-start: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 3px;
}
.lang-switch-btn {
  padding: 4px 12px;
  border-radius: 16px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  transition: all var(--transition);
}
.lang-switch-btn.active {
  background: var(--primary);
  color: white;
}

.nav-auth { display: flex; align-items: center; gap: 8px; margin-inline-start: 16px; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.nav-user .nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}
.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 0 20px var(--primary-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.btn-outline:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.btn-success { background: var(--success-dark); color: white; }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover:not(:disabled) { background: var(--error-dark); }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-full { width: 100%; }

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color var(--transition);
  outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
}
.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-easy { background: rgba(0,200,83,0.15); color: var(--easy); }
.badge-medium { background: rgba(255,171,0,0.15); color: var(--medium); }
.badge-hard { background: rgba(255,23,68,0.15); color: var(--hard); }
.badge-expert { background: rgba(213,0,249,0.15); color: var(--expert); }

.badge-category {
  background: rgba(128,0,32,0.15);
  color: var(--primary-light);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 90%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp 0.3s ease;
}

.modal-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition);
}
.modal-close:hover { color: var(--text-primary); }

/* ----- Auth Modal ----- */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.auth-tab.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary);
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.auth-title {
  font-size: 1.4rem;
  margin-bottom: 4px;
}
.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}
.auth-error {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 12px;
  text-align: center;
}

/* ============================================================
   NOTIFICATION
   ============================================================ */
#notificationContainer {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.notification {
  padding: 14px 20px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.notification.success { border-left: 3px solid var(--success); }
.notification.error { border-left: 3px solid var(--error); }
.notification.warning { border-left: 3px solid var(--warning); }
.notification.info { border-left: 3px solid var(--info); }
.notification.removing { animation: slideOut 0.3s ease forwards; }

.notification-icon { font-size: 1.2rem; }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
#app {
  margin-top: 64px;
  min-height: calc(100vh - 64px);
}

.page {
  padding: 32px 24px;
  max-width: 1280px;
  margin: 0 auto;
}

.page-header {
  text-align: center;
  margin-bottom: 40px;
}
.page-header h1 {
  font-size: 2.2rem;
  margin-bottom: 8px;
}
.page-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

.section-title {
  font-size: 1.3rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============================================================
   HOME PAGE
   ============================================================ */
.hero {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(128,0,32,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(128,0,32,0.08) 0%, transparent 50%),
    var(--bg-dark);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(128,0,32,0.02) 2px,
    rgba(128,0,32,0.02) 4px
  );
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
}

.hero-badge {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 20px;
  background: rgba(128,0,32,0.2);
  border: 1px solid rgba(128,0,32,0.3);
  color: var(--primary-light);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 16px;
}
.hero h1 .highlight {
  background: linear-gradient(135deg, var(--primary-light), #e04040);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.15rem;
  line-height: 1.7;
  margin-bottom: 32px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Features Section */
.features {
  padding: 80px 24px;
  max-width: 1280px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-top: 40px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  transition: all var(--transition);
}
.feature-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(128,0,32,0.15);
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Stats Section */
.stats-section {
  padding: 60px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.stats-grid {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  text-align: center;
}

.stat-item h2 {
  font-size: 2.5rem;
  color: var(--primary-light);
  margin-bottom: 4px;
}

.stat-item p {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ============================================================
   CHALLENGES PAGE
   ============================================================ */
.challenge-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.challenge-type-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.challenge-type-tab:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}
.challenge-type-tab.active {
  background: rgba(128,0,32,0.2);
  border-color: var(--primary);
  color: var(--primary-light);
}
.challenge-type-tab-icon {
  font-size: 1.1rem;
}

.challenge-type-tagline {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.ctf-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.ctf-status-live { background: rgba(255,23,68,0.15); color: var(--hard); }
.ctf-status-upcoming { background: rgba(255,171,0,0.15); color: var(--medium); }
.ctf-status-ended { background: rgba(158,158,158,0.15); color: var(--text-muted); }

.challenge-card-timing {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-bottom: 12px;
}

/* ============================================================
   EVENTS
   ============================================================ */
.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--event-color, var(--primary));
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
}
.event-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.event-card-banner {
  font-size: 2.4rem;
  margin-bottom: 8px;
}

.event-banner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 4px solid var(--event-color, var(--primary));
  border-radius: var(--radius-xl);
  margin-bottom: 24px;
}
.event-banner-icon {
  font-size: 3.5rem;
  flex-shrink: 0;
}
.event-banner h1 {
  margin-bottom: 6px;
}
.event-countdown {
  margin-top: 10px;
  font-family: var(--mono-font);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--event-color, var(--primary-light));
}

.event-prize-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.event-prize-list li {
  padding: 10px 14px;
  background: rgba(255,171,0,0.08);
  border: 1px solid rgba(255,171,0,0.2);
  border-radius: var(--radius);
  font-weight: 600;
}

.event-sponsors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.event-sponsor-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--transition);
}
a.event-sponsor-chip:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}

/* ============================================================
   COURSES
   ============================================================ */
.course-progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: var(--border-color);
  overflow: hidden;
  margin-bottom: 8px;
}
.course-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width var(--transition);
}

.course-detail-body {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

.course-lessons-sidebar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px;
  position: sticky;
  top: 88px;
}

.course-lesson-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  text-align: left;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
}
.course-lesson-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}
.course-lesson-item.active {
  background: rgba(128,0,32,0.2);
  color: var(--primary-light);
}

.course-module-heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 12px 4px;
}
.course-module-heading:first-child { padding-top: 4px; }

.course-lesson-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.course-lesson-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
}

@media (max-width: 768px) {
  .course-detail-body {
    grid-template-columns: 1fr;
  }
  .course-lessons-sidebar {
    position: static;
  }
}

.challenges-header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 32px;
}

.challenges-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.filter-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  padding: 6px 16px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
}
.filter-btn.active {
  background: rgba(128,0,32,0.2);
  border-color: var(--primary);
  color: var(--primary-light);
}

.filter-difficulty {
  display: flex;
  gap: 6px;
}

.filter-diff-btn {
  padding: 6px 14px;
  border-radius: 20px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-diff-btn:hover { color: var(--text-secondary); }
.filter-diff-btn.active { border-color: currentColor; }
.filter-diff-btn[data-diff="easy"].active { color: var(--easy); }
.filter-diff-btn[data-diff="medium"].active { color: var(--medium); }
.filter-diff-btn[data-diff="hard"].active { color: var(--hard); }
.filter-diff-btn[data-diff="expert"].active { color: var(--expert); }

.challenges-search {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.challenges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.challenge-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.challenge-card::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  width: 3px;
  height: 100%;
  background: var(--primary);
  opacity: 0;
  transition: opacity var(--transition);
}
.challenge-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.challenge-card:hover::before { opacity: 1; }

.challenge-card.solved {
  border-color: rgba(0,200,83,0.3);
}
.challenge-card.solved::before {
  background: var(--success);
  opacity: 1;
}

.challenge-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.challenge-card-category {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.challenge-card-points {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-light);
}

.challenge-card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}

.challenge-card-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.challenge-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.challenge-card-solves {
  color: var(--text-muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================================
   CHALLENGE DETAIL PAGE
   ============================================================ */
.challenge-detail {
  max-width: 900px;
  margin: 0 auto;
}

.challenge-detail-header {
  margin-bottom: 24px;
}

.challenge-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
}

.challenge-detail-points {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-light);
}

.challenge-detail-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}

.challenge-description {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  line-height: 1.8;
  font-size: 0.95rem;
}

.challenge-description pre,
.challenge-description code {
  font-family: var(--mono-font);
  background: var(--bg-input);
  border-radius: 4px;
}
.challenge-description code { padding: 2px 6px; font-size: 0.9em; }
.challenge-description pre {
  padding: 16px;
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border-color);
}
.challenge-description pre code { background: none; padding: 0; }

.challenge-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.flag-submit-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.flag-submit-card h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.flag-input-group {
  display: flex;
  gap: 8px;
}
.flag-input-group .form-input {
  font-family: var(--mono-font);
  font-size: 0.85rem;
}

.challenge-status {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
}
.challenge-status.solved {
  background: rgba(0,200,83,0.1);
  color: var(--success);
  border: 1px solid rgba(0,200,83,0.2);
}
.challenge-status.unsolved {
  background: rgba(255,23,68,0.1);
  color: var(--error);
  border: 1px solid rgba(255,23,68,0.2);
}

.challenge-external-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  transition: all var(--transition);
}
.challenge-external-link:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}

.lab-launch-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 700;
  justify-content: center;
  margin-bottom: 4px;
}
.lab-launch-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: white;
}

.lab-badge {
  font-size: 0.75em;
  vertical-align: middle;
}

/* ============================================================
   LEADERBOARD
   ============================================================ */
.leaderboard-toggle {
  display: flex;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
  margin-bottom: 24px;
}

.lb-toggle-btn {
  padding: 10px 24px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.lb-toggle-btn.active {
  background: var(--primary);
  color: white;
}
.lb-toggle-btn:not(.active):hover {
  color: var(--text-primary);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.leaderboard-table th {
  background: var(--bg-surface);
  padding: 14px 16px;
  text-align: left;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.leaderboard-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.leaderboard-table tr:last-child td { border-bottom: none; }
.leaderboard-table tr:hover { background: rgba(255,255,255,0.02); }

.lb-rank {
  font-weight: 700;
  font-size: 1.1rem;
  width: 48px;
  text-align: center;
}
.lb-rank.gold { color: #ffd700; }
.lb-rank.silver { color: #c0c0c0; }
.lb-rank.bronze { color: #cd7f32; }

.lb-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.lb-points {
  font-weight: 700;
  color: var(--primary-light);
}

.lb-solved {
  color: var(--success);
}

.lb-time {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  margin-bottom: 32px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-info h2 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}
.profile-info .profile-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.profile-stat {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.profile-stat .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-light);
}
.profile-stat .stat-label {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 4px;
}

.profile-solved h3 {
  margin-bottom: 16px;
}

/* ============================================================
   GAMIFICATION (ranks + badges)
   ============================================================ */
.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(128,0,32,0.15);
  color: var(--primary-light);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
}

.badge-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 10px;
  text-align: center;
  transition: all var(--transition);
}
.badge-card.earned {
  border-color: rgba(255,171,0,0.4);
  background: rgba(255,171,0,0.06);
}
.badge-card.locked {
  opacity: 0.45;
}
.badge-card-icon {
  font-size: 1.8rem;
  margin-bottom: 6px;
}
.badge-card-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ============================================================
   ADMIN PAGE
   ============================================================ */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  min-height: calc(100vh - 64px - 64px);
}

.admin-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: sticky;
  top: 80px;
  height: fit-content;
}

.admin-nav-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all var(--transition);
}
.admin-nav-item:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}
.admin-nav-item.active {
  color: var(--primary-light);
  background: rgba(128,0,32,0.15);
}

.admin-content {
  min-height: 400px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.admin-table th {
  background: var(--bg-surface);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover { background: rgba(255,255,255,0.02); }

/* ============================================================
   LOADING
   ============================================================ */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-light);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { color: var(--text-secondary); margin-bottom: 8px; }

/* ============================================================
   UTILITY
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100px); }
}

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

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

/* ============================================================
   RESPONSIVE DESIGN
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
  .challenge-detail-body {
    grid-template-columns: 1fr;
  }
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .admin-nav-item {
    width: auto;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(10,10,10,0.98);
    flex-direction: column;
    padding: 16px 24px;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-auth { margin-left: 0; width: 100%; }
  .nav-auth .btn { flex: 1; }
  .nav-user { width: 100%; justify-content: space-between; }

  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }

  .page { padding: 24px 16px; }

  .page-header h1 { font-size: 1.6rem; }

  .challenges-grid {
    grid-template-columns: 1fr;
  }

  .challenges-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .challenges-search { max-width: none; }

  .form-row { grid-template-columns: 1fr; }

  .profile-header {
    flex-direction: column;
    text-align: center;
  }

  .leaderboard-table { font-size: 0.85rem; }
  .leaderboard-table th, .leaderboard-table td { padding: 10px 12px; }
  .lb-time { display: none; }

  .modal-content { padding: 24px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .features-grid { grid-template-columns: 1fr; }
}

/* Small Mobile */
@media (max-width: 480px) {
  .hero h1 { font-size: 1.6rem; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; }

  .challenge-detail-meta { gap: 8px; }
  .flag-input-group { flex-direction: column; }

  .leaderboard-table th:nth-child(4),
  .leaderboard-table td:nth-child(4) { display: none; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .stat-item h2 { font-size: 1.8rem; }
}

/* ============================================================
   REVIEWS
   ============================================================ */
.review-star-input { display: flex; gap: 4px; font-size: 1.5rem; }
.review-star {
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition);
}
.review-star.filled { color: #f5c518; }
.review-stars-display {
  color: #f5c518;
  font-size: 0.85rem;
  margin-inline-start: 8px;
}

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
.notif-bell-wrap { position: relative; }
.notif-bell-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  position: relative;
  padding: 4px 6px;
}
.notif-badge {
  position: absolute;
  top: -2px;
  inset-inline-end: -4px;
  background: var(--primary-light);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
}
.notif-dropdown {
  position: absolute;
  top: 36px;
  inset-inline-end: 0;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 1200;
}
.notif-loading, .notif-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.notif-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: rgba(255,255,255,0.04); }
.notif-item-unread { background: rgba(128,0,32,0.08); }
.notif-item-title { font-size: 0.85rem; font-weight: 600; }
.notif-item-body { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.notif-item-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   QUIZ
   ============================================================ */
.quiz-answer-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}
.quiz-answer-option:hover {
  background: rgba(255,255,255,0.04);
  border-color: var(--primary-light);
}
.quiz-answer-option input[type="radio"] { accent-color: var(--primary-light); }

/* ============================================================
   TERMINAL SIMULATOR
   ============================================================ */
.terminal-widget {
  background: #0d1117;
  border: 1px solid var(--border-color, #2a2a35);
  border-radius: 10px;
  overflow: hidden;
  font-family: var(--mono-font, 'Fira Code', monospace);
  margin: 20px 0;
}
.terminal-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #161b22;
  border-bottom: 1px solid #2a2a35;
}
.terminal-dot { width: 11px; height: 11px; border-radius: 50%; }
.terminal-title {
  margin-inline-start: 10px;
  color: #8b949e;
  font-size: 0.78rem;
}
.terminal-body {
  padding: 14px;
  max-height: 280px;
  overflow-y: auto;
  font-size: 0.85rem;
  color: #c9d1d9;
}
.terminal-line { white-space: pre-wrap; word-break: break-word; margin-bottom: 4px; }
.terminal-line-cmd { color: #58a6ff; }
.terminal-line-error { color: #f85149; }
.terminal-line-success { color: #3fb950; font-weight: 600; }
.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid #2a2a35;
}
.terminal-prompt { color: #3fb950; font-weight: 700; }
.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #c9d1d9;
  font-family: inherit;
  font-size: 0.85rem;
}

/* ============================================================
   CERTIFICATE
   ============================================================ */
.certificate-card {
  max-width: 800px;
  margin: 0 auto;
  padding: 56px 40px;
  text-align: center;
  background: linear-gradient(160deg, #1a1a24, #12121a);
  border: 3px solid var(--primary, #a0002a);
  border-radius: 12px;
  position: relative;
}
.certificate-card::before {
  content: '';
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(160, 0, 42, 0.35);
  border-radius: 6px;
  pointer-events: none;
}
.certificate-icon { width: 72px; height: 76px; margin: 0 auto 8px; }
.certificate-kicker {
  color: var(--primary-light, #d4324c);
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.certificate-title {
  font-size: 2.4rem;
  margin-bottom: 24px;
}
.certificate-awarded-to {
  color: var(--text-muted, #9a9aab);
  font-size: 1rem;
  margin-bottom: 8px;
}
.certificate-name {
  font-size: 2rem;
  font-family: serif;
  font-weight: 700;
  margin-bottom: 20px;
}
.certificate-completed {
  font-size: 1.1rem;
  margin-bottom: 12px;
}
.certificate-date {
  color: var(--text-muted, #9a9aab);
  font-size: 0.9rem;
  margin-bottom: 24px;
}
.certificate-seal {
  display: inline-block;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--primary-light, #d4324c);
  border: 2px solid var(--primary, #a0002a);
  border-radius: 50%;
  padding: 14px 18px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border-color, rgba(255,255,255,0.08));
  padding: 24px 20px;
  margin-top: 48px;
}
.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer-discord {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-light);
  text-decoration: none;
  font-weight: 600;
}
.site-footer-discord:hover { text-decoration: underline; }

/* ============================================================
   RTL SUPPORT (Arabic)
   ============================================================ */
html[dir="rtl"] body {
  font-family: 'Tahoma', 'Segoe UI', system-ui, sans-serif;
}

/* Flexbox row order flips automatically with dir=rtl; only fixed
   left/right text-align and absolute positioning need explicit overrides. */
html[dir="rtl"] [style*="text-align:left"],
html[dir="rtl"] [style*="text-align: left"] {
  text-align: right !important;
}
html[dir="rtl"] [style*="text-align:right"],
html[dir="rtl"] [style*="text-align: right"] {
  text-align: left !important;
}

/* ============================================================
   AUTH WALL — full-page gate, boot splash, form UX
   ============================================================ */

/* Hide the app shell entirely until the visitor is authenticated. */
body.auth-locked .navbar,
body.auth-locked .site-footer { display: none !important; }

/* Boot splash (shown until the session check resolves) */
.boot-splash {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.boot-splash-logo {
  width: 72px; height: 72px;
  filter: drop-shadow(0 0 16px var(--primary-glow));
  animation: pulseGlow 2s ease-in-out infinite;
}
@keyframes pulseGlow {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

/* ---- The gate layout ---- */
.auth-gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background:
    radial-gradient(1200px 600px at 0% 0%, rgba(128,0,32,0.22), transparent 60%),
    radial-gradient(900px 500px at 100% 100%, rgba(128,0,32,0.16), transparent 55%),
    var(--bg-dark);
}

.auth-gate-aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px;
  gap: 18px;
  border-inline-end: 1px solid var(--border-color);
  background: linear-gradient(160deg, rgba(128,0,32,0.10), transparent);
}
.auth-gate-logo {
  width: 88px; height: 88px;
  filter: drop-shadow(0 0 18px var(--primary-glow));
}
.auth-gate-brand {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin: 0;
}
.auth-gate-brand span { color: var(--primary-light); }
.auth-gate-tagline {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 420px;
  line-height: 1.6;
}
.auth-gate-points {
  list-style: none;
  padding: 0; margin: 8px 0 0;
  display: flex; flex-direction: column; gap: 12px;
}
.auth-gate-points li {
  color: var(--text-primary);
  font-size: 0.98rem;
}

.auth-gate-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  position: relative;
}
.auth-gate-topbar {
  position: absolute;
  top: 24px; inset-inline-end: 32px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.35s ease;
}

/* ---- OAuth buttons ---- */
.oauth-group { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.btn-oauth {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  font-weight: 600;
  padding: 11px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-oauth:hover { background: var(--bg-card-hover); border-color: var(--primary); }
.oauth-icon {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-weight: 800; font-size: 0.85rem;
}
.oauth-icon-google { background: #fff; color: #4285F4; }
.oauth-icon-github { background: #24292e; color: #fff; }
.auth-divider {
  display: flex; align-items: center; text-align: center;
  color: var(--text-muted); font-size: 0.8rem;
  margin: 4px 0 18px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-color);
}
.auth-divider span { padding: 0 12px; }

/* ---- Password field with show/hide toggle ---- */
.pw-wrap { position: relative; }
.pw-wrap .form-input { padding-inline-end: 44px; }
.pw-toggle {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.7;
  padding: 4px;
  line-height: 1;
}
.pw-toggle:hover, .pw-toggle.active { opacity: 1; }

/* ---- Password strength meter ---- */
.pw-strength { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.pw-strength-bar {
  flex: 1; height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px; overflow: hidden;
}
.pw-strength-bar span {
  display: block; height: 100%; width: 0;
  transition: width 0.25s ease, background 0.25s ease;
}
.pw-str-weak   { background: var(--error); }
.pw-str-fair   { background: var(--warning); }
.pw-str-good   { background: #7cb342; }
.pw-str-strong { background: var(--success); }
.pw-strength-label { font-size: 0.78rem; font-weight: 600; min-width: 52px; }
.pw-str-text-weak { color: var(--error); }
.pw-str-text-fair { color: var(--warning); }
.pw-str-text-good { color: #7cb342; }
.pw-str-text-strong { color: var(--success); }

/* ---- Inline field hints (availability, match) ---- */
.field-hint { display: block; font-size: 0.78rem; margin-top: 6px; min-height: 1em; }
.field-ok { color: var(--success); }
.field-bad { color: var(--error); }
.field-muted { color: var(--text-muted); }

/* ---- Login row: remember me + forgot ---- */
.auth-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: -4px 0 18px; font-size: 0.85rem;
}
.auth-checkbox { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); cursor: pointer; }
.auth-checkbox input { accent-color: var(--primary); width: 15px; height: 15px; }
.auth-link { color: var(--primary-light); text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

/* Success state for the reset message */
.auth-error.is-success { color: var(--success); }

/* ---- Spinner inside buttons ---- */
.btn-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-inline-end: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Responsive: stack the gate on small screens ---- */
@media (max-width: 860px) {
  .auth-gate { grid-template-columns: 1fr; }
  .auth-gate-aside {
    padding: 40px 32px 8px;
    border-inline-end: none;
    align-items: center; text-align: center;
  }
  .auth-gate-points { display: none; }
  .auth-gate-tagline { font-size: 0.95rem; }
  .auth-gate-main { padding: 24px 16px 48px; }
  .auth-gate-topbar { position: static; margin-bottom: 16px; align-self: flex-end; }
}

/* ============================================================
   ONBOARDING / SKILL ASSESSMENT
   ============================================================ */
.onboarding { display: flex; justify-content: center; }
.onboarding-card {
  width: 100%; max-width: 720px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.onboarding-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.onboarding-logo { width: 48px; height: 48px; filter: drop-shadow(0 0 10px var(--primary-glow)); }
.onboarding-title { font-size: 1.5rem; margin: 0; }
.onboarding-sub { color: var(--text-muted); font-size: 0.9rem; margin: 2px 0 0; }
.onboarding-progress { height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.onboarding-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); transition: width 0.3s ease; }
.onboarding-stepnum { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 20px; }
.onboarding-q { font-size: 1.15rem; margin: 8px 0 18px; }

.onboarding-choices { display: flex; flex-direction: column; gap: 12px; }
.onboarding-choices-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.choice-tile {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; text-align: start;
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--radius); color: var(--text-primary);
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: all var(--transition);
}
.choice-tile:hover { border-color: var(--primary); background: var(--bg-card-hover); }
.choice-tile.selected { border-color: var(--primary); background: rgba(128,0,32,0.15); box-shadow: 0 0 0 1px var(--primary) inset; }
.choice-icon { font-size: 1.4rem; }

.assessment-list { display: flex; flex-direction: column; gap: 20px; margin-bottom: 8px; }
.assessment-item { border: 1px solid var(--border-color); border-radius: var(--radius); padding: 16px; background: var(--bg-card); }
.assessment-qtext { font-weight: 600; margin-bottom: 12px; line-height: 1.5; }
.assessment-cat { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.assessment-num { color: var(--primary-light); }
.assessment-options { display: flex; flex-direction: column; gap: 8px; }
.assessment-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border-light);
  border-radius: var(--radius); cursor: pointer; transition: all var(--transition);
  font-size: 0.9rem;
}
.assessment-option:hover { border-color: var(--primary); }
.assessment-option.selected { border-color: var(--primary); background: rgba(128,0,32,0.12); }
.assessment-option input { accent-color: var(--primary); }

.onboarding-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }
.onboarding-actions-center { justify-content: center; flex-wrap: wrap; }

.onboarding-result { text-align: center; padding: 8px 0; }
.result-badge { font-size: 3.2rem; margin-bottom: 8px; }
.result-level { margin: 12px 0 20px; font-size: 1rem; color: var(--text-secondary); }
.result-level strong { color: var(--primary-light); }
.result-path { text-align: start; cursor: pointer; border-inline-start: 4px solid var(--primary-light); transition: all var(--transition); }
.result-path:hover { background: var(--bg-card-hover); }

/* Dashboard nudge banner */
.onboarding-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 20px; margin: 16px 0 8px;
  background: linear-gradient(120deg, rgba(128,0,32,0.18), rgba(128,0,32,0.05));
  border: 1px solid var(--primary); border-radius: var(--radius-lg);
}
.onboarding-banner-text { display: flex; flex-direction: column; gap: 2px; }
.onboarding-banner-text strong { font-size: 1rem; }
.onboarding-banner-text span { color: var(--text-secondary); font-size: 0.85rem; }

@media (max-width: 600px) {
  .onboarding-card { padding: 20px; }
  .onboarding-actions { flex-direction: column-reverse; align-items: stretch; }
  .onboarding-actions .btn, .onboarding-actions .flex { width: 100%; justify-content: center; }
  .onboarding-banner { flex-direction: column; align-items: stretch; text-align: center; }
}

/* ============================================================
   COMMAND PALETTE (Ctrl/Cmd + K)
   ============================================================ */
body.cmdk-lock { overflow: hidden; }
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh; animation: fadeIn 0.12s ease;
}
.cmdk-panel {
  width: 92%; max-width: 620px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden; animation: slideUp 0.16s ease;
}
.cmdk-input-wrap { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-color); }
.cmdk-input-icon { font-size: 1rem; opacity: 0.7; }
.cmdk-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text-primary); font-size: 1.05rem; font-family: var(--font);
}
.cmdk-input::placeholder { color: var(--text-muted); }
.cmdk-esc, .cmdk-foot kbd, .nav-kbd {
  font-family: var(--mono-font); font-size: 0.68rem;
  background: var(--bg-elevated); border: 1px solid var(--border-light);
  border-radius: 4px; padding: 2px 6px; color: var(--text-secondary);
}
.cmdk-results { max-height: 52vh; overflow-y: auto; padding: 6px; }
.cmdk-group {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); padding: 10px 12px 4px;
}
.cmdk-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius); cursor: pointer;
}
.cmdk-item.active { background: var(--bg-card-hover); box-shadow: 0 0 0 1px var(--primary) inset; }
.cmdk-item-icon { width: 22px; text-align: center; font-size: 1.05rem; flex-shrink: 0; }
.cmdk-item-label { flex: 1; color: var(--text-primary); font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item-sub { color: var(--text-muted); font-size: 0.78rem; flex-shrink: 0; }
.cmdk-hint { padding: 24px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }
.cmdk-foot {
  display: flex; gap: 18px; padding: 10px 16px;
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem; color: var(--text-muted);
}
.cmdk-foot kbd { margin-inline-end: 2px; }
.nav-kbd { margin-inline-start: 4px; }
@media (max-width: 600px) {
  .cmdk-overlay { padding-top: 8vh; }
  .cmdk-foot { display: none; }
  .nav-kbd { display: none; }
}

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-page { max-width: 720px; margin: 0 auto; }
.settings-card { margin-bottom: 20px; }
.settings-h { font-size: 1.05rem; margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.settings-readonly { display: flex; flex-direction: column; gap: 12px; }
.settings-readonly > div { display: flex; justify-content: space-between; gap: 16px; font-size: 0.92rem; }
.settings-label { color: var(--text-muted); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.settings-msg { display: inline-block; margin-inline-start: 12px; font-size: 0.85rem; }
.settings-msg.is-ok { color: var(--success); }
.settings-msg.is-error { color: var(--error); }
@media (max-width: 600px) {
  .settings-readonly > div { flex-direction: column; gap: 2px; }
  .settings-msg { display: block; margin: 8px 0 0; }
}

/* ============================================================
   DASHBOARD COMMAND-CENTER WIDGETS
   ============================================================ */
.cc-grid {
  display: grid; gap: 16px; margin-top: 24px;
  grid-template-columns: 1fr 1fr 1.4fr;
}
.cc-widget {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column;
}
.cc-widget-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cc-widget-title { font-size: 0.9rem; font-weight: 700; }
.cc-widget-meta { font-size: 0.85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cc-progress { height: 8px; background: var(--bg-elevated); border-radius: 4px; overflow: hidden; }
.cc-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); transition: width 0.4s ease; }
.cc-widget-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 0.78rem; }
.cc-goal-done { color: var(--success); font-weight: 600; }

.cc-widget-streak { align-items: center; text-align: center; justify-content: center; }
.cc-streak-big { font-size: 2.6rem; font-weight: 800; color: var(--primary-light); line-height: 1; display: flex; align-items: baseline; gap: 6px; justify-content: center; }
.cc-streak-unit { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }

.cc-widget-activity { grid-row: span 1; }
.cc-activity-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.cc-activity-list li {
  display: flex; align-items: center; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--border-color); cursor: pointer; font-size: 0.86rem;
}
.cc-activity-list li:last-child { border-bottom: none; }
.cc-activity-list li:hover .cc-activity-title { color: var(--primary-light); }
.cc-activity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cc-activity-dot.badge-easy { background: var(--easy); }
.cc-activity-dot.badge-medium { background: var(--medium); }
.cc-activity-dot.badge-hard { background: var(--hard); }
.cc-activity-dot.badge-expert { background: var(--expert); }
.cc-activity-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-activity-pts { color: var(--success); font-weight: 600; font-size: 0.8rem; }
.cc-activity-time { color: var(--text-muted); font-size: 0.74rem; min-width: 58px; text-align: end; }
.cc-empty { color: var(--text-muted); font-size: 0.88rem; padding: 8px 0; }

@media (max-width: 820px) {
  .cc-grid { grid-template-columns: 1fr 1fr; }
  .cc-widget-activity { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .cc-grid { grid-template-columns: 1fr; }
}


/* ============================================================
   MEDIA / ATTACHMENTS (viewer + admin manager)
   ============================================================ */
.media-block { margin-top: 24px; }
.media-block-title { font-size: 1.05rem; margin: 0 0 14px; }
.media-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.media-item { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); overflow: hidden; }
.media-item figcaption { padding: 8px 10px; font-size: 0.82rem; color: var(--text-secondary); }
.media-image img { width: 100%; height: 160px; object-fit: cover; display: block; background: var(--bg-elevated); }
.media-video video { width: 100%; max-height: 260px; display: block; background: #000; }
.media-audio { grid-column: 1 / -1; padding: 12px 14px; }
.media-audio-label { font-size: 0.88rem; margin-bottom: 8px; }
.media-audio audio { width: 100%; }
.media-file { display: flex; align-items: center; gap: 10px; padding: 14px; text-decoration: none; color: var(--text-primary); transition: all var(--transition); }
.media-file:hover { background: var(--bg-card-hover); border-color: var(--primary); }
.media-file-icon { font-size: 1.3rem; }
.media-file-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.9rem; }
.media-file-size { color: var(--text-muted); font-size: 0.78rem; }

/* Admin manager */
.attach-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border-color); }
.attach-label { display: block; font-weight: 600; margin-bottom: 10px; font-size: 0.9rem; }
.attach-hint { margin-top: 16px; color: var(--text-muted); font-size: 0.85rem; }
.media-mgr-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.media-mgr-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); }
.media-mgr-kind { font-size: 1.1rem; }
.media-mgr-name { flex: 1; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-mgr-size { color: var(--text-muted); font-size: 0.78rem; }
.media-mgr-empty { color: var(--text-muted); font-size: 0.85rem; padding: 4px 0; }
.media-mgr-upload { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.media-mgr-upload .form-input { flex: 1; min-width: 140px; }
.media-mgr-msg { font-size: 0.82rem; width: 100%; }
.media-mgr-msg.is-error { color: var(--error); }
.btn-xs { padding: 3px 9px; font-size: 0.75rem; }

/* ============================================================
   ACHIEVEMENTS PAGE
   ============================================================ */
.achievements-page { max-width: 900px; margin: 0 auto; }
.ach-summary { display: grid; gap: 10px; margin-bottom: 24px; }
.ach-summary-main { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ach-rank { font-size: 1.15rem; font-weight: 700; }
.ach-rank span { color: var(--primary-light); }
.ach-count { color: var(--text-secondary); font-size: 0.9rem; }
.ach-progress { height: 10px; background: var(--bg-elevated); border-radius: 5px; overflow: hidden; }
.ach-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); transition: width 0.4s ease; }
.ach-progress-label { text-align: end; font-size: 0.78rem; color: var(--text-muted); }

.ach-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.ach-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 18px 14px; text-align: center;
  transition: transform var(--transition), border-color var(--transition);
}
.ach-card.earned { border-color: var(--primary); }
.ach-card.earned:hover { transform: translateY(-3px); }
.ach-card.locked { opacity: 0.55; }
.ach-icon { font-size: 2.4rem; margin-bottom: 8px; }
.ach-card.locked .ach-icon { filter: grayscale(1); opacity: 0.7; }
.ach-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.ach-desc { font-size: 0.78rem; color: var(--text-muted); min-height: 2.2em; line-height: 1.4; }
.ach-when { margin-top: 8px; font-size: 0.74rem; color: var(--success); font-weight: 600; }
.ach-locked-tag { margin-top: 8px; font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
@media (max-width: 480px) { .ach-grid { grid-template-columns: 1fr 1fr; } }

/* ============================================================
   BOOKMARKS
   ============================================================ */
.detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-title-row h1 { margin: 0; }
.bookmark-btn {
  background: none; border: 1px solid var(--border-light); border-radius: var(--radius);
  color: var(--text-muted); cursor: pointer; padding: 6px 10px; line-height: 1;
  transition: all var(--transition); flex-shrink: 0;
}
.bookmark-btn:hover { border-color: var(--primary); color: var(--warning); }
.bookmark-btn.active { color: var(--warning); border-color: var(--warning); }
.bookmark-star { font-size: 1.1rem; }
.bookmark-btn-lg { padding: 8px 12px; }
.bookmark-btn-lg .bookmark-star { font-size: 1.4rem; }
.bookmark-card .challenge-card-top { align-items: center; }

/* ============================================================
   IMAGE LIGHTBOX
   ============================================================ */
body.lb-lock { overflow: hidden; }
.lb-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(0,0,0,0.9); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease; padding: 40px 16px;
}
.lb-figure { margin: 0; max-width: 92vw; max-height: 86vh; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lb-figure img { max-width: 92vw; max-height: 76vh; object-fit: contain; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.lb-figure figcaption { color: var(--text-secondary); font-size: 0.88rem; text-align: center; }
.lb-close {
  position: absolute; top: 16px; inset-inline-end: 20px;
  background: rgba(255,255,255,0.08); border: 1px solid var(--border-light);
  color: var(--text-primary); font-size: 1.2rem; line-height: 1;
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  transition: all var(--transition);
}
.lb-close:hover { background: var(--primary); border-color: var(--primary); }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.08); border: 1px solid var(--border-light);
  color: var(--text-primary); font-size: 2rem; line-height: 1;
  width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.lb-nav:hover { background: var(--primary); border-color: var(--primary); }
.lb-prev { inset-inline-start: 16px; }
.lb-next { inset-inline-end: 16px; }

/* Clickable image tile */
.media-image-btn {
  position: relative; display: block; width: 100%;
  background: none; border: none; padding: 0; cursor: zoom-in;
}
.media-zoom {
  position: absolute; inset-block-end: 8px; inset-inline-end: 8px;
  background: rgba(0,0,0,0.65); border-radius: var(--radius);
  padding: 3px 7px; font-size: 0.8rem; opacity: 0; transition: opacity var(--transition);
}
.media-image-btn:hover .media-zoom { opacity: 1; }

/* ============================================================
   SKELETON LOADERS
   ============================================================ */
@keyframes skelPulse { 0%,100% { opacity: 0.45; } 50% { opacity: 0.8; } }
.skel-line, .skel-pill, .skel-avatar, .skel-stat, .skel-widget, .skel-card {
  background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-elevated) 50%, var(--bg-card) 100%);
  border-radius: var(--radius);
  animation: skelPulse 1.4s ease-in-out infinite;
}
.skel-card { border: 1px solid var(--border-color); padding: 18px; display: flex; flex-direction: column; gap: 10px; min-height: 150px; }
.skel-line { height: 10px; }
.skel-sm { height: 9px; }
.skel-md { height: 12px; }
.skel-lg { height: 16px; }
.skel-xl { height: 24px; }
.skel-foot { display: flex; gap: 8px; margin-top: auto; }
.skel-pill { height: 20px; width: 64px; border-radius: 999px; }
.skel-rows { display: flex; flex-direction: column; gap: 10px; }
.skel-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border-color); border-radius: var(--radius); }
.skel-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.skel-header { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.skel-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 16px; margin-bottom: 24px; }
.skel-stat { height: 84px; }
.skel-widget { height: 150px; }

/* ============================================================
   PROFILE PAGE (tabbed command-center layout)
   ============================================================ */
.profile-page { max-width: 980px; margin: 0 auto; }
.profile-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.profile-info { flex: 1; min-width: 0; }
.profile-fullname { color: var(--text-secondary); font-size: 0.92rem; margin: 0 0 4px; }
.profile-submeta {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px;
  color: var(--text-muted); font-size: 0.8rem;
}
.profile-edit-btn { flex-shrink: 0; align-self: flex-start; }

.profile-tabs {
  display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color); padding-bottom: 0;
}
.profile-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 0.88rem; font-weight: 600;
  padding: 10px 14px; cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.profile-tab:hover { color: var(--text-primary); }
.profile-tab.active { color: var(--primary-light); border-bottom-color: var(--primary); }

.profile-panel { animation: fadeIn 0.15s ease; }
.cat-bars { display: flex; flex-direction: column; gap: 12px; }
.cat-bar-row { display: grid; grid-template-columns: 160px 1fr 50px; align-items: center; gap: 10px; }
.cat-bar-label { font-size: 0.85rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-bar { height: 8px; background: var(--bg-elevated); border-radius: 4px; overflow: hidden; }
.cat-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.cat-bar-value { font-size: 0.78rem; color: var(--text-muted); text-align: end; }
.profile-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: rgba(128,0,32,0.1); border: 1px solid var(--primary);
  border-radius: var(--radius-lg); flex-wrap: wrap;
}
.badge-card-when { font-size: 0.68rem; color: var(--success); margin-top: 4px; }
.table-scroll { overflow-x: auto; }

@media (max-width: 640px) {
  .profile-header { flex-wrap: wrap; }
  .profile-edit-btn { width: 100%; }
  .cat-bar-row { grid-template-columns: 100px 1fr 40px; }
  .cat-bar-label { font-size: 0.78rem; }
}
