.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255, 107, 107, 0.2) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(255, 209, 102, 0.2) 0%, transparent 50%);
  animation: float 20s ease-in-out infinite;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.3) 0%, rgba(15, 23, 42, 0.7) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: white;
}

.article-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 2rem;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 2rem;
  animation: badgeEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  font-family: 'Montserrat', sans-serif;
  margin-bottom: 1.5rem;
  line-height: 1.1;
  background: linear-gradient(135deg, #ffffff 0%, #ffd166 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleEntrance 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.hero-subtitle {
  display: inline-block;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 500;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  margin-bottom: 2.5rem;
  animation: subtitleEntrance 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

.article-meta {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  animation: statsEntrance 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s both;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 2rem;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  transition: all 0.3s ease;
}

.meta-item:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.18);
}

.meta-item i {
  font-size: 1.75rem;
}

/* Flashcard Container */
.flashcard-container {
  max-width: 1100px;
  margin: 3rem auto 4rem;
  padding: 0 2rem;
  position: relative;
  z-index: 10;
}

/* Flashcard Header - Study Mode Banner */
.flashcard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2.5rem;
  padding: 2rem 2.5rem;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.05) 0%, rgba(255, 209, 102, 0.05) 100%);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 24px;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.8s ease;
  position: relative;
  overflow: hidden;
}

.flashcard-header::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  padding: 2px;
  background: var(--primary-gradient);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.3;
}

.study-mode-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
}

.banner-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.banner-icon i {
  font-size: 1.75rem;
  color: white;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.banner-content {
  flex: 1;
}

.banner-title {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: 'Montserrat', sans-serif;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.banner-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
  font-weight: 500;
}

.control-buttons {
  display: flex;
  gap: 1rem;
  flex-shrink: 0;
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 50px;
  background: var(--primary-gradient);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

.control-btn i {
  font-size: 1.1rem;
}

.control-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-lg);
}

.control-btn:active {
  transform: translateY(0) scale(0.95);
}

/* Card Viewport */
.card-viewport {
  perspective: 1500px;
  margin-bottom: 2.5rem;
  animation: fadeInUp 1s ease;
  position: relative;
  z-index: 1;
}

.flashcard {
  position: relative;
  width: 100%;
  min-height: 500px;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  min-height: 500px;
  backface-visibility: hidden;
  background: white;
  border-radius: 32px;
  padding: 3rem;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  border: 2px solid transparent;
  background-clip: padding-box;
}


.card-badge-top {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  background: var(--primary-gradient);
  color: white;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  align-self: flex-start;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.answer-badge {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.card-number {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 2rem;
  font-family: 'Montserrat', sans-serif;
}

.card-content {
  flex: 1;
  font-size: 1.5rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 2rem;
  font-weight: 500;
}

.answer-section,
.explanation-section {
  margin-bottom: 2rem;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-pink);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
}

.section-label i {
  font-size: 1.25rem;
}

.explanation-text {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.flip-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(255, 107, 107, 0.1);
  border-radius: 16px;
  color: var(--primary-pink);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: auto;
}

.flip-indicator i {
  animation: rotate 2s linear infinite;
}

/* Navigation Controls - Fixed positioning with dynamic spacing */
.navigation-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  margin-bottom: 3rem;
  animation: fadeInUp 1.2s ease;
  position: relative;
  z-index: 2;
  margin-top: 2rem;
  transition: margin-top 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.navigation-controls.pushed-down {
  margin-top: 11rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 2.5rem;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1.125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  font-family: 'Poppins', sans-serif;
}

.nav-btn:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.nav-btn:active {
  transform: translateY(0);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.keyboard-hints {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

kbd {
  padding: 0.25rem 0.75rem;
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-family: 'Montserrat', monospace;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Floating Draggable Progress Button - FIXED */
.floating-progress {
  position: fixed;
  bottom: 100px;
  right: 2rem;
  z-index: 998;
  cursor: grab;
  animation: floatIn 0.8s ease;
  user-select: none;
  transition: all 0.3s ease;
  touch-action: none;
}

.floating-progress.dragging {
  cursor: grabbing;
  opacity: 0.9;
  scale: 1.05;
}

.progress-ring {
  position: relative;
  width: 90px;
  height: 90px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.floating-progress:hover .progress-ring {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.progress-ring svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  width: 90px;
  height: 90px;
}

.progress-ring-bg {
  cx: 45;
  cy: 45;
  r: 40;
  stroke: #e2e8f0;
  stroke-width: 6;
  fill: none;
}

.progress-ring-fill {
  cx: 45;
  cy: 45;
  r: 40;
  stroke: url(#progressGradient);
  stroke-width: 6;
  stroke-linecap: round;
  fill: none;
  transition: stroke-dashoffset 0.5s ease;
}

.progress-ring-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Montserrat', sans-serif;
  position: relative;
  z-index: 1;
}

.progress-number {
  font-size: 1.75rem;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
}

.progress-total {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.progress-tooltip {
  position: absolute;
  bottom: -45px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 41, 59, 0.95);
  color: white;
  padding: 0.625rem 1.25rem;
  border-radius: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.floating-progress:hover .progress-tooltip {
  opacity: 1;
}

/* Confetti Canvas */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  display: none;
}

#confettiCanvas.active {
  display: block;
}

/* Animations */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

@keyframes badgeEntrance {
  0% { opacity: 0; transform: translateY(-20px) scale(0.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes titleEntrance {
  0% { opacity: 0; transform: translateY(30px); filter: blur(10px); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes subtitleEntrance {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes statsEntrance {
  0% { opacity: 0; transform: translateY(30px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  0% { opacity: 0; transform: translateY(-30px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  0% { opacity: 0; transform: translateY(40px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes floatIn {
  0% { opacity: 0; transform: translateY(40px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Article Navigation */
.article-navigation {
  margin: 4rem 0 3rem;
  display: flex;
  justify-content: center;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 3rem;
  background: var(--primary-gradient);
  color: white;
  text-decoration: none;
  border-radius: 50px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
}

.nav-button:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* Footer */
.page-footer {
  background: var(--dark-bg);
  color: white;
  padding: 3rem 2rem;
  text-align: center;
  margin-top: 4rem;
}

.footer-links {
  margin-bottom: 1.5rem;
}

.footer-links a {
  color: white;
  text-decoration: none;
  margin: 0 1rem;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: var(--primary-orange);
}

/* Back to Top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  background: var(--primary-gradient);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-lg);
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-5px);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  background: var(--primary-gradient);
}
.desktop-nav-toggle {
  background: var(--primary-gradient);
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-section {
    min-height: 400px;
    padding: 4rem 1.5rem 3rem;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
  }
  
  .article-meta {
    flex-direction: column;
    gap: 1rem;
  }
  
  .meta-item {
    width: 100%;
    justify-content: center;
  }
  
  .flashcard-container {
    margin-top: 2rem;
    padding: 0 1rem;
  }
  
  .flashcard-header {
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
  }
  
  .study-mode-banner {
    flex-direction: column;
    text-align: center;
  }
  
  .banner-icon {
    width: 50px;
    height: 50px;
  }
  
  .banner-icon i {
    font-size: 1.5rem;
  }
  
  .banner-title {
    font-size: 1.25rem;
  }
  
  .banner-subtitle {
    font-size: 0.875rem;
  }
  
  .control-buttons {
    width: 100%;
    justify-content: center;
  }
  
  .btn-label {
    display: none;
  }
  
  .control-btn {
    width: 50px;
    height: 50px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
  }
  
  .card-face {
    min-height: 450px;
    padding: 2rem;
  }
  
  .card-content {
    font-size: 1.25rem;
  }
  
  .navigation-controls {
    flex-direction: column;
    gap: 1.5rem;
  }
  
  .nav-btn {
    width: 100%;
    justify-content: center;
  }
  
  .keyboard-hints {
    display: none;
  }
  
  /* Fixed mobile progress ring */
  .floating-progress {
    bottom: 100px;
    right: 1rem;
  }
  
  .progress-ring {
    width: 70px;
    height: 70px;
  }
  
  .progress-ring svg {
    width: 70px;
    height: 70px;
  }
  
  .progress-ring-bg,
  .progress-ring-fill {
    cx: 35;
    cy: 35;
    r: 31;
    stroke-width: 5;
  }
  
  .progress-number {
    font-size: 1.5rem;
  }
  
  .progress-total {
    font-size: 0.75rem;
  }
  
  .progress-tooltip {
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
    bottom: -40px;
  }
  
  .navigation-controls.pushed-down {
    margin-top: 16rem;
  }
}

@media (max-width: 480px) {
  .card-face {
    min-height: 400px;
    padding: 1.5rem;
  }
  
  .card-content {
    font-size: 1.125rem;
  }
  
  /* Fixed small mobile progress ring */
  .floating-progress {
    bottom: 100px;
    right: 0.75rem;
  }
  
  .progress-ring {
    width: 60px;
    height: 60px;
  }
  
  .progress-ring svg {
    width: 60px;
    height: 60px;
  }
  
  .progress-ring-bg,
  .progress-ring-fill {
    cx: 30;
    cy: 30;
    r: 26;
    stroke-width: 4;
  }
  
  .progress-number {
    font-size: 1.25rem;
  }
  
  .progress-total {
    font-size: 0.7rem;
  }
  
  .progress-tooltip {
    font-size: 0.7rem;
    padding: 0.375rem 0.875rem;
    bottom: -38px;
  }
}