/* ===== VISUAL EFFECTS & UX POLISH ===== */

/* ── Hero Particles Canvas ── */
#hero-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* ── Confetti Overlay ── */
#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99999;
  display: none;
}
#confetti-canvas.active {
  display: block;
}

/* ── Enhanced Card Hover Glow ── */
.subject-card {
  transition: transform 0.35s cubic-bezier(.22,.68,0,1.2), box-shadow 0.35s ease, border-color 0.35s ease;
}
.physics-card:hover, .physics-card:focus {
  box-shadow: 0 0 0 3px rgba(79,110,247,0.18), 0 14px 44px rgba(79,110,247,0.18);
}
.biology-card:hover, .biology-card:focus {
  box-shadow: 0 0 0 3px rgba(34,197,94,0.18), 0 14px 44px rgba(34,197,94,0.18);
}
.chemistry-card:hover, .chemistry-card:focus {
  box-shadow: 0 0 0 3px rgba(249,115,22,0.18), 0 14px 44px rgba(249,115,22,0.18);
}
.mathematics-card:hover, .mathematics-card:focus {
  box-shadow: 0 0 0 3px rgba(224,64,251,0.18), 0 14px 44px rgba(224,64,251,0.18);
}

/* Card icon bounce on hover */
.subject-card:hover .card-icon {
  animation: iconBounce 0.5s ease;
}
@keyframes iconBounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25) rotate(-5deg); }
  70%  { transform: scale(0.95) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* ── Enhanced Tab Transitions ── */
.tab-panel {
  animation: tabSlideIn 0.35s cubic-bezier(.25,.46,.45,.94) both;
}
@keyframes tabSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Page Transitions ── */
.page.active {
  animation: pageEnter 0.4s cubic-bezier(.25,.46,.45,.94) both;
}
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Stats Bar Enhancements ── */
.stat strong {
  transition: color 0.3s ease;
}
.stats-bar {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stats-bar:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ── Stat counter glow pulse on update ── */
@keyframes statPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.stat-pulse {
  animation: statPulse 0.4s ease;
}

/* ── Dashboard progress ring entrance ── */
@keyframes ringFadeIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
#progress-ring {
  animation: ringFadeIn 0.6s ease both;
}

/* ── Module tab hover micro-interaction ── */
.tab {
  transition: all 0.25s cubic-bezier(.25,.46,.45,.94);
}
.tab:hover {
  transform: translateY(-1px);
}
.tab.active {
  transition: all 0.25s cubic-bezier(.25,.46,.45,.94);
}

/* ── Experiment info expand/collapse transition ── */
.experiment-info .info-body {
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

/* ── Quiz result celebration ── */
.quiz-result {
  animation: resultPop 0.5s cubic-bezier(.22,.68,0,1.2) both;
}
@keyframes resultPop {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Bookmark button pulse ── */
.btn-bookmark.bookmarked {
  animation: bookmarkPop 0.4s ease;
}
@keyframes bookmarkPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ── Smooth scroll behavior ── */
html {
  scroll-behavior: smooth;
}

/* ══════════════════════════════════════════
   MYTH vs REALITY SECTION
   ══════════════════════════════════════════ */

/* Section wrapper — full-width below the simulation */
.myth-section {
  margin: 1.5rem 0 0.5rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(79,110,247,0.05), rgba(224,64,251,0.05));
  border: 1.5px solid var(--border);
  overflow: hidden;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
[data-theme="dark"] .myth-section {
  background: linear-gradient(135deg, rgba(79,110,247,0.08), rgba(224,64,251,0.08));
}
.myth-section:hover {
  box-shadow: 0 4px 20px rgba(79,110,247,0.1);
  border-color: var(--accent-primary);
}

/* Toggle button (the section header) */
.myth-section-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.8rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font: 400 0.9rem/1.4 var(--font-main, system-ui, sans-serif);
  cursor: pointer;
  transition: background 0.2s ease;
  text-align: left;
}
.myth-section-toggle:hover {
  background: rgba(79,110,247,0.06);
}
.myth-section-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
}
.myth-section-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.myth-section-text strong {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}
.myth-section-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
  opacity: 0.8;
}
.myth-chevron {
  margin-left: auto;
  font-size: 0.65rem;
  transition: transform 0.3s ease;
  opacity: 0.45;
}
.myth-section--open .myth-chevron {
  transform: rotate(180deg);
}

/* Collapsible body */
.myth-section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(.25,.46,.45,.94), padding 0.3s ease;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.6rem;
}
.myth-section--open .myth-section-body {
  max-height: 800px;
  padding: 0 1rem 1rem;
}

/* Individual myth card */
.myth-card {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  margin-bottom: 0;
  cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.myth-card:last-child {
  margin-bottom: 0;
}
.myth-card:hover {
  border-color: #ef4444;
  box-shadow: 0 2px 10px rgba(239,68,68,0.12);
  transform: translateY(-1px);
}
.myth-card--revealed:hover {
  border-color: #22c55e;
  box-shadow: 0 2px 10px rgba(34,197,94,0.12);
}
.myth-card:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Myth row (always visible) */
.myth-card-myth {
  padding: 0.7rem 0.9rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.myth-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #fee2e2;
  color: #dc2626;
  font-size: 0.65rem;
  font-weight: 700;
}
[data-theme="dark"] .myth-icon {
  background: rgba(220,38,38,0.2);
  color: #fca5a5;
}
.myth-label {
  font-weight: 700;
  color: #dc2626;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
[data-theme="dark"] .myth-label {
  color: #fca5a5;
}

/* Reality row (hidden until revealed) */
.myth-card-reality {
  max-height: 0;
  overflow: hidden;
  padding: 0 0.9rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
  border-top: 0px solid transparent;
  background: rgba(34,197,94,0.05);
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  transition: max-height 0.35s cubic-bezier(.25,.46,.45,.94), padding 0.3s ease, border-top 0.2s ease;
}
.myth-card--revealed .myth-card-reality {
  max-height: 140px;
  padding: 0.6rem 0.9rem;
  border-top: 1px solid var(--border);
}
[data-theme="dark"] .myth-card-reality {
  background: rgba(34,197,94,0.07);
}
.reality-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  font-size: 0.7rem;
  font-weight: 700;
}
[data-theme="dark"] .reality-icon {
  background: rgba(22,163,74,0.2);
  color: #86efac;
}
.reality-label {
  font-weight: 700;
  color: #16a34a;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
[data-theme="dark"] .reality-label {
  color: #86efac;
}

/* Dim myth text once revealed */
.myth-card--revealed .myth-card-myth {
  opacity: 0.55;
  text-decoration: line-through;
  text-decoration-color: rgba(220,38,38,0.3);
}

/* ── Hero shimmer effect on highlight text ── */
.hero .highlight {
  background-size: 200% auto;
  animation: shimmer 3s linear infinite;
}
@keyframes shimmer {
  0%   { background-position: 0% center; }
  100% { background-position: 200% center; }
}
