/* ==========================================================================
   2026 ENGAGEMENT, ANIMATIONS, PROGRESS RINGS, SKELETONS & ACCESSIBILITY
   ========================================================================== */

/* 1. SKELETON SHIMMER LOADERS */
.skeleton-shimmer {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}
.skeleton-line {
  height: 1.15rem;
  border-radius: var(--radius-sm, 6px);
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmerWave 1.6s infinite;
}
.skeleton-line.long { width: 92%; }
.skeleton-line.medium { width: 68%; }
.skeleton-line.short { width: 42%; }
@keyframes shimmerWave {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 2. PRACTICE MODE ANIMATIONS (GREEN PULSE & GENTLE SHAKE) */
@keyframes greenPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); border-color: rgba(16, 185, 129, 0.8); }
  50% { transform: scale(1.015); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); border-color: #10b981; }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); border-color: #10b981; }
}

@keyframes gentleShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

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

.opt-pulse-correct {
  animation: greenPulse 0.45s ease-out forwards;
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
}

.opt-shake-wrong {
  animation: gentleShake 0.4s ease-in-out forwards;
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: #ef4444 !important;
  color: #ef4444 !important;
}

.instant-feedback-card {
  animation: slideInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 3. COURSE CARD PROGRESS RINGS */
.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.65rem;
}

/* 4. EXAM COUNTDOWN & TIMETABLE STUDY PLAN WIDGET */
.countdown-widget {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-lg, 12px);
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.countdown-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.countdown-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  flex-shrink: 0;
}

.countdown-titles h3 {
  font-size: 0.98rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main, #f8fafc);
}

.countdown-titles p {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  margin: 0.2rem 0 0 0;
}

.countdown-clock {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.clock-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  min-width: 48px;
}

.clock-val {
  font-family: var(--font-mono, monospace);
  font-size: 1.15rem;
  font-weight: 800;
  color: #38bdf8;
  line-height: 1;
}

.clock-lbl {
  font-size: 0.62rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

.btn-study-plan {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s;
}
.btn-study-plan:hover {
  background: rgba(59, 130, 246, 0.25);
  color: #ffffff;
}

/* 5. DAILY STREAK & XP BADGE IN HEADER */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

.xp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* 6. DAILY 5 QUICK CHALLENGE BANNER */
.daily5-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(6, 182, 212, 0.05) 100%);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 14px;
  padding: 0.85rem 1.25rem;
  margin-top: 1.6rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}
.daily5-text h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.daily5-text p {
  margin: 0.2rem 0 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.btn-daily5 {
  background: #10b981;
  color: #0b1120;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.55rem 1.15rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s, background 0.15s;
}
.btn-daily5:hover {
  background: #059669;
  transform: translateY(-1px);
}

/* 7. VISUAL MASTERY MAP */
.mastery-map-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg, 12px);
  padding: 1.25rem;
  margin-top: 1.75rem;
  margin-bottom: 1.5rem;
}
.mastery-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.mastery-map-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}
.mastery-legend {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-dot.green { background: #10b981; }
.legend-dot.amber { background: #f59e0b; }
.legend-dot.red { background: #ef4444; }
.legend-dot.gray { background: rgba(255, 255, 255, 0.2); }

.mastery-tiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.65rem;
}
.mastery-tile {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.mastery-tile:hover {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.15);
}
.mastery-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mastery-tile-title {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mastery-tile-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}
.mastery-tile-badge.green { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.mastery-tile-badge.amber { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.mastery-tile-badge.red { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.mastery-tile-badge.gray { background: rgba(255, 255, 255, 0.08); color: #94a3b8; }

.mastery-tile-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}
.mastery-tile-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}
.mastery-tile-fill.green { background: #10b981; }
.mastery-tile-fill.amber { background: #f59e0b; }
.mastery-tile-fill.red { background: #ef4444; }
.mastery-tile-fill.gray { background: transparent; }

/* 8. QUESTION NOTES & REPORT DRAWER */
.q-utility-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.btn-q-util {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.76rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s;
}
.btn-q-util:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-q-util.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #fbbf24;
}

.q-note-drawer {
  margin-top: 0.65rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.65rem;
  animation: slideInUp 0.25s ease;
}
.q-note-textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 0.8rem;
  padding: 0.5rem;
  resize: vertical;
  min-height: 50px;
  box-sizing: border-box;
}

/* 9. WHATSAPP SHARE BUTTON */
.btn-whatsapp-share {
  background: #25d366 !important;
  color: #0b1120 !important;
  font-weight: 700 !important;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.btn-whatsapp-share:hover {
  background: #20bd5a !important;
}

/* 10. CONFETTI CANVAS */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* 11. AUDIO SOUND TOGGLE */
.btn-sound-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s;
}
.btn-sound-toggle:hover {
  color: var(--text-main);
}

/* ===== Aunty mascot (js/mascot.js): scolds you on practice-mode misses ===== */
.aunty {
  position: fixed;
  right: 16px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 999; /* above the floating unlock bar (998), under the header menu and modals */
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
  opacity: 0;
  transform: translateY(24px) scale(0.92);
  transition: opacity 0.2s ease, transform 0.25s ease;
}
.aunty.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.aunty-bubble {
  position: relative;
  flex: 1;
  background: #fff8ec;
  color: #3b2412;
  border: 2px solid #e2a23b;
  border-radius: 16px 16px 4px 16px;
  padding: 10px 30px 10px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.aunty-line { margin: 0; font-weight: 700; font-size: 0.95rem; line-height: 1.35; }
.aunty-hint { margin: 4px 0 0; font-size: 0.8rem; opacity: 0.75; }
.aunty-unlock {
  margin-top: 8px;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
}
.aunty-unlock[hidden] { display: none; }
.aunty-close {
  position: absolute; top: 4px; right: 6px;
  border: 0; background: none; color: inherit;
  font-size: 1.2rem; line-height: 1; cursor: pointer; opacity: 0.6;
}
.aunty-close:hover { opacity: 1; }
.aunty-face { width: 84px; height: 84px; flex: none; cursor: pointer; }
.aunty-skin { fill: #8d5524; }
.aunty-shoulders { fill: #1f7a4d; }
.aunty-shoulders-pattern { fill: none; stroke: #f4c542; stroke-width: 3; }
.aunty-gele { fill: #d9381e; }
.aunty-gele-fold { fill: #e85d3f; stroke: #a8271a; stroke-width: 1.5; }
.aunty-gele-band { fill: none; stroke: #f4c542; stroke-width: 3; }
.aunty-earring { fill: #f4c542; }
.aunty-brows, .aunty-mouth { stroke: #2b160a; stroke-width: 3.5; stroke-linecap: round; }
.aunty-glasses { fill: rgba(255, 255, 255, 0.15); stroke: #2b160a; stroke-width: 2.5; }
.aunty-eye { fill: #2b160a; }

.aunty.is-visible[data-mood="angry"] .aunty-face,
.aunty.is-visible[data-mood="shocked"] .aunty-face { animation: aunty-shake 0.5s ease 0.15s 2; }
.aunty.is-visible[data-mood="proud"] .aunty-face { animation: aunty-bounce 0.6s ease 0.15s 2; }
@keyframes aunty-shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}
@keyframes aunty-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

[data-theme="dark"] .aunty-bubble { background: #2a1d10; color: #fdebd0; border-color: #c98a2b; }

@media (max-width: 640px) {
  /* Sit above the floating question bar on phones */
  .aunty { right: 12px; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .aunty-face { width: 68px; height: 68px; }
  .aunty-line { font-size: 0.9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .aunty { transition: opacity 0.2s ease; transform: none; }
  .aunty.is-visible .aunty-face { animation: none !important; }
}
