:root {
  --bg: #f0f4fa;
  --card: rgba(255, 255, 255, 0.82);
  --card-solid: #ffffff;
  --text: #111827;
  --subtext: #4b5563;
  --muted: #9ca3af;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #93bbfd;
  --accent: #6366f1;
  --border: rgba(203, 213, 225, 0.6);
  --border-hover: rgba(147, 187, 253, 0.8);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 48px rgba(15, 23, 42, 0.1);
  --shadow-glow: 0 8px 32px rgba(59, 130, 246, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ===== Background effects ===== */

.bg-pattern {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.15) 1px, transparent 0);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 80%);
}

.glow {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: glowDrift 12s ease-in-out infinite alternate;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.2), transparent 70%);
  top: -10%;
  left: -5%;
}

.glow-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18), transparent 70%);
  bottom: -8%;
  right: -5%;
  animation-delay: -6s;
}

@keyframes glowDrift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, 20px) scale(1.08); }
}

/* ===== Header ===== */

.page-header {
  position: relative;
  background: linear-gradient(135deg, #0c1225 0%, #1a2652 40%, #1e3a8a 100%);
  color: #fff;
  padding: 3.5rem 1.5rem 3rem;
  text-align: center;
  overflow: hidden;
}

.header-inner {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 0 auto;
}

.header-decoration {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.deco-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(96, 165, 250, 0.12);
}

.deco-ring-1 {
  width: 400px;
  height: 400px;
  top: -180px;
  right: -120px;
  border-color: rgba(96, 165, 250, 0.15);
  animation: ringPulse 6s ease-in-out infinite;
}

.deco-ring-2 {
  width: 300px;
  height: 300px;
  bottom: -160px;
  left: -100px;
  border-color: rgba(129, 140, 248, 0.12);
  animation: ringPulse 6s ease-in-out 2s infinite;
}

.deco-ring-3 {
  width: 180px;
  height: 180px;
  top: 20%;
  left: 15%;
  border-color: rgba(96, 165, 250, 0.08);
  animation: ringPulse 6s ease-in-out 4s infinite;
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.06); opacity: 1; }
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  margin-bottom: 1.2rem;
  border: 1px solid rgba(147, 197, 253, 0.3);
  border-radius: 999px;
  background: rgba(30, 64, 175, 0.3);
  backdrop-filter: blur(8px);
  color: #bfdbfe;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.6);
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.page-header h1 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.6rem;
  background: linear-gradient(180deg, #fff 40%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-desc {
  color: #cbd5e1;
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto 1.8rem;
}

.header-stats {
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.6rem 1.4rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  backdrop-filter: blur(8px);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.stat-number {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.stat-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.12);
}

/* ===== Container ===== */

.container {
  width: min(1100px, 92%);
  margin: -1.8rem auto 2.5rem;
  position: relative;
  z-index: 3;
}

/* ===== Cards ===== */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
}

.intro-card {
  padding: 1.8rem 2rem 2rem;
}

.section-header {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}

.section-icon-wrap {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: var(--primary);
  border: 1px solid rgba(147, 197, 253, 0.4);
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.15rem;
}

.intro-text {
  color: var(--subtext);
  font-size: 0.88rem;
}

/* ===== Lab Grid ===== */

.toc-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.lab-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.2rem 1.1rem;
  background: var(--card-solid);
  transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  animation: cardReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1) backwards;
  animation-delay: calc(var(--delay) * 0.08s + 0.15s);
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lab-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.28s ease;
}

.lab-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
}

.lab-card:hover::before {
  opacity: 1;
}

.lab-icon-bg {
  position: absolute;
  bottom: -8px;
  right: -4px;
  color: rgba(59, 130, 246, 0.06);
  transform: rotate(-12deg);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.lab-icon-bg svg {
  width: 80px;
  height: 80px;
}

.lab-card:hover .lab-icon-bg {
  color: rgba(59, 130, 246, 0.1);
  transform: rotate(-6deg) scale(1.05);
}

/* ===== Lab Index Badge ===== */

.lab-index {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary-dark);
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid rgba(147, 197, 253, 0.5);
  transition: all 0.28s ease;
}

.lab-card:hover .lab-index {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

/* ===== Lab Link ===== */

.lab-link {
  display: block;
  padding-right: 2.6rem;
  text-decoration: none;
}

.lab-link:hover {
  text-decoration: none;
}

.lab-tag {
  display: inline-block;
  margin-bottom: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lab-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  transition: color 0.2s ease;
}

.lab-card:hover .lab-title {
  color: var(--primary-dark);
}

/* ===== Action Buttons ===== */

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.78rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.action-btn svg {
  flex-shrink: 0;
}

.view-btn {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
}

.view-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.download-btn {
  border: 1px solid rgba(147, 197, 253, 0.6);
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  color: #1e40af;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.download-btn:hover {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1e40af;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}

/* ===== Footer ===== */

.page-footer {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ===== Links ===== */

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
  .page-header {
    padding: 2.5rem 1.2rem 2.2rem;
  }

  .page-header h1 {
    font-size: 1.6rem;
  }

  .header-stats {
    gap: 0.8rem;
    padding: 0.5rem 1rem;
  }

  .stat-number {
    font-size: 1.1rem;
  }

  .intro-card {
    padding: 1.3rem;
  }

  .toc-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .section-header {
    align-items: center;
  }

  .lab-icon-bg svg {
    width: 60px;
    height: 60px;
  }
}

@media (max-width: 480px) {
  .container {
    width: 95%;
  }

  .header-stats {
    flex-wrap: wrap;
    justify-content: center;
  }

  .stat-divider {
    display: none;
  }
}
