/* style.css - Cheeya Studio Soft Pastel Blue Dream Theme 🌸💙✨ */

@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@600;700&family=Playfair+Display:ital,wght@0,600;0,700;1,600&family=Quicksand:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --sky-primary: #38bdf8;
  --sky-hover: #0284c7;
  --sky-light: #f0f9ff;
  --sky-card: rgba(255, 255, 255, 0.94);
  --sky-border: rgba(186, 230, 253, 0.85);
  --sky-glow: rgba(56, 189, 248, 0.3);
  --text-dark: #0c4a6e;
  --text-muted: #0369a1;
  --app-font-scale: 1.10; /* Comfortably larger default base font */
}

/* Scalable Font via Root HTML: Affects all rem-based Tailwind sizes instantly! */
html {
  font-size: calc(16px * var(--app-font-scale, 1.10));
  transition: font-size 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body {
  font-family: 'Quicksand', 'Plus Jakarta Sans', sans-serif;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 50%, #bae6fd 100%);
  color: #0c4a6e;
  line-height: 1.6;
  overflow: hidden;
  position: relative;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

input, textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

/* Girly & Aesthetic Brand Title for Cheeya Studio */
.brand-title {
  font-family: 'Dancing Script', cursive;
  font-size: 1.95rem;
  font-weight: 700;
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 30%, #ec4899 75%, #f472b6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.5px;
  line-height: 1.1;
  display: inline-block;
  filter: drop-shadow(0 2px 6px rgba(244, 114, 182, 0.3));
  transition: transform 0.25s ease;
}
.brand-title:hover {
  transform: scale(1.04) rotate(-1deg);
}

/* Floating Ambient Canvas Overlay (Dreamy Glass Bubbles & Stardust) */
#sparkleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 10; /* Visible above backgrounds and cards */
}

/* Cursor Click Animation Overlay Layer */
#cursorClickLayer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 99999;
  overflow: hidden;
}

/* GENTLE, SUBTLE Ripple shockwave on click (Reduced from 80px to 22px) */
.cursor-ripple {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 189, 248, 0.6);
  background: radial-gradient(circle, rgba(186, 230, 253, 0.3) 0%, transparent 80%);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.3);
  animation: ripple-expand 0.42s cubic-bezier(0.1, 0.85, 0.25, 1) forwards;
  will-change: transform, opacity;
}

@keyframes ripple-expand {
  0% {
    width: 0px;
    height: 0px;
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(0.2);
  }
  60% {
    opacity: 0.6;
  }
  100% {
    width: 22px;
    height: 22px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

/* Delicate tiny sparkle on click */
.cursor-sparkle {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  width: 3px;
  height: 3px;
  animation: sparkle-burst 0.5s cubic-bezier(0.15, 0.85, 0.35, 1) forwards;
  will-change: transform, opacity;
}

@keyframes sparkle-burst {
  0% {
    opacity: 0.9;
    transform: translate(-50%, -50%) translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) scale(0.2);
  }
}

/* Soft Pastel Blue Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(224, 242, 254, 0.7);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #7dd3fc, #38bdf8);
  border-radius: 9999px;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.4);
}
::-webkit-scrollbar-thumb:hover {
  background: #0284c7;
}

/* Cute Floating Animation */
@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(1deg); }
}
.floating-anim {
  animation: float 4s ease-in-out infinite;
}

/* Soft Pastel Blue Glass Card */
.blue-glass-card {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  border: 1.5px solid rgba(186, 230, 253, 0.9);
  box-shadow: 0 10px 30px -5px rgba(56, 189, 248, 0.16), 0 4px 6px -2px rgba(56, 189, 248, 0.08);
  border-radius: 1.25rem;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.blue-glass-card:hover {
  border-color: rgba(56, 189, 248, 0.8);
  box-shadow: 0 14px 35px -5px rgba(56, 189, 248, 0.26);
}

/* Soft Pastel Blue Buttons */
.btn-pastel-blue {
  background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 50%, #0284c7 100%);
  color: white;
  font-weight: 700;
  box-shadow: 0 6px 18px -3px rgba(14, 165, 233, 0.38);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-pastel-blue:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 24px -3px rgba(14, 165, 233, 0.5);
}
.btn-pastel-blue:active {
  transform: translateY(1px) scale(0.98);
}

/* Girly Pink Accent Button */
.btn-girly-accent {
  background: linear-gradient(135deg, #f472b6 0%, #ec4899 50%, #db2777 100%);
  color: white;
  font-weight: 700;
  box-shadow: 0 6px 18px -3px rgba(236, 72, 153, 0.35);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-girly-accent:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 24px -3px rgba(236, 72, 153, 0.5);
}

/* App View Containers (Full Width, No 50/50 split!) */
.app-view {
  display: none;
  width: 100%;
  height: 100%;
}
.app-view.active {
  display: flex;
}
#view-dashboard > * {
  flex-shrink: 0;
}

/* Navigation Tab Active Indicator */
.nav-tab-btn {
  position: relative;
  transition: all 0.2s ease;
}
.nav-tab-btn.active {
  color: #0284c7 !important;
  background-color: #e0f2fe !important;
  border-color: #38bdf8 !important;
  font-weight: 800 !important;
}

/* PDF Top Annotation Toolbar */
.pdf-tool-btn {
  padding: 0.35rem 0.65rem;
  border-radius: 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border: 1.5px solid #bae6fd;
  background: white;
  color: #0369a1;
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}
.pdf-tool-btn:hover {
  background: #f0f9ff;
  border-color: #38bdf8;
  color: #0284c7;
}
.pdf-tool-btn.active {
  background: #0284c7 !important;
  color: white !important;
  border-color: #0284c7 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}

/* Color swatch circles */
.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 0 0 1px #cbd5e1;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.color-swatch:hover {
  transform: scale(1.2);
}
.color-swatch.active {
  box-shadow: 0 0 0 2.5px #0284c7;
  transform: scale(1.15);
}

/* PDF Annotation Canvas Overlay */
#pdfAnnotationCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#pdfAnnotationCanvas.mode-hand {
  pointer-events: none;
  cursor: default;
}
#pdfAnnotationCanvas.mode-pen {
  pointer-events: auto;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M18.3 3.7a2.1 2.1 0 0 1 3 3L7.8 20.2 2 22l1.8-5.8L17.3 3.7a2.1 2.1 0 0 1 1-.7z' fill='%230284c7' stroke='%23ffffff' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M15 6l3 3' stroke='%23ffffff' stroke-width='1.5'/%3E%3Cpath d='M2 22l4-1.2-2.8-2.8L2 22z' fill='%230f172a'/%3E%3Ccircle cx='2' cy='22' r='1.5' fill='%230284c7' stroke='%23ffffff' stroke-width='0.5'/%3E%3C/svg%3E") 2 22, default;
}
#pdfAnnotationCanvas.mode-highlighter {
  pointer-events: auto;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M17.5 3.5a2 2 0 0 1 2.8 2.8L8.8 17.8 3 21l2.2-6.8L17.5 3.5z' fill='%23facc15' stroke='%23ca8a04' stroke-width='1.5' stroke-linejoin='round'/%3E%3Cpath d='M3 21l3.5-1.2-2.3-2.3L3 21z' fill='%23eab308'/%3E%3Ccircle cx='3' cy='21' r='1.5' fill='%23facc15' stroke='%23ca8a04' stroke-width='0.5'/%3E%3C/svg%3E") 3 21, default;
}
#pdfAnnotationCanvas.mode-eraser {
  pointer-events: auto;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Crect x='3' y='7' width='16' height='10' rx='2.5' transform='rotate(-25 11 12)' fill='%23fda4af' stroke='%23e11d48' stroke-width='1.5'/%3E%3Crect x='3' y='12' width='16' height='5' rx='1' transform='rotate(-25 11 12)' fill='%23cbd5e1' stroke='%2364748b' stroke-width='1'/%3E%3C/svg%3E") 4 18, default;
}

/* Ambient Music Sound Pulsing */
@keyframes pulse-wave {
  0% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.85; }
}
.ambient-playing {
  animation: pulse-wave 2.2s infinite ease-in-out;
  background-color: #e0f2fe !important;
  border-color: #38bdf8 !important;
  color: #0284c7 !important;
}

/* Pastel Blue Audio Wave Animation */
.audio-bar-wave {
  display: flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 18px;
}
.audio-bar-wave span {
  width: 3.5px;
  background: linear-gradient(to top, #0ea5e9, #38bdf8);
  border-radius: 9999px;
  animation: wave 1.1s ease-in-out infinite alternate;
}
.audio-bar-wave span:nth-child(1) { height: 35%; animation-delay: 0.1s; }
.audio-bar-wave span:nth-child(2) { height: 90%; animation-delay: 0.3s; }
.audio-bar-wave span:nth-child(3) { height: 60%; animation-delay: 0.2s; }
.audio-bar-wave span:nth-child(4) { height: 100%; animation-delay: 0.4s; }
.audio-bar-wave span:nth-child(5) { height: 45%; animation-delay: 0.15s; }

@keyframes wave {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

.audio-bar-wave.paused span {
  animation: none;
  height: 25% !important;
}

/* German Gender Color Badges */
.badge-der {
  background-color: #e0f2fe;
  color: #0284c7;
  border: 1px solid #7dd3fc;
}
.badge-die {
  background-color: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
}
.badge-das {
  background-color: #dcfce7;
  color: #16a34a;
  border: 1px solid #86efac;
}
.badge-phrase {
  background-color: #fef3c7;
  color: #d97706;
  border: 1px solid #fcd34d;
}
.badge-verb {
  background-color: #ede9fe;
  color: #7c3aed;
  border: 1px solid #c4b5fd;
}

/* Soft Cyan-Blue Shimmer Glow */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer-text {
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 25%, #60a5fa 50%, #0284c7 75%, #38bdf8 100%);
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shimmer 4s linear infinite;
}

/* Modal Backdrop with Soft Blue Blur */
.modal-backdrop {
  backdrop-filter: blur(10px);
  background-color: rgba(12, 74, 110, 0.45);
}

/* 3D Interactive Flashcard System */
.flashcard-scene {
  perspective: 1200px;
}
.flashcard-card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
  cursor: pointer;
}
.flashcard-card.is-flipped {
  transform: rotateY(180deg);
}
.flashcard-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-shadow: 0 15px 35px -5px rgba(12, 74, 110, 0.15), 0 0 0 2px rgba(186, 230, 253, 0.9);
}
.flashcard-front {
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
}
.flashcard-back {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  transform: rotateY(180deg);
}

/* Article Game (Der, Die, Das) */
.btn-article-der {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border: 2px solid #38bdf8;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transition: all 0.15s ease;
}
.btn-article-der:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 20px rgba(2, 132, 199, 0.45);
}
.btn-article-der:active {
  transform: translateY(1px) scale(0.98);
}

.btn-article-die {
  background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
  color: #ffffff;
  border: 2px solid #f472b6;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.35);
  transition: all 0.15s ease;
}
.btn-article-die:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 20px rgba(236, 72, 153, 0.45);
}
.btn-article-die:active {
  transform: translateY(1px) scale(0.98);
}

.btn-article-das {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  color: #ffffff;
  border: 2px solid #34d399;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
  transition: all 0.15s ease;
}
.btn-article-das:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.45);
}
.btn-article-das:active {
  transform: translateY(1px) scale(0.98);
}

/* Success and Shake Animations */
@keyframes shake-wrong {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}
.shake-anim {
  animation: shake-wrong 0.45s ease-in-out;
}

@keyframes pop-correct {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.pop-correct-anim {
  animation: pop-correct 0.4s ease;
}

/* Audio Playing Indicator Pulse */
@keyframes sound-pulse {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}
.audio-playing-pulse {
  animation: sound-pulse 1s infinite;
}

/* Floating Toast Notification */
.floating-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  background: rgba(12, 74, 110, 0.95);
  color: white;
  padding: 12px 20px;
  border-radius: 1rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 189, 248, 0.5);
  animation: toast-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* PRINT STYLING FOR LESSON OVERVIEW PDF EXPORT */
@media print {
  body {
    overflow: visible !important;
    background: white !important;
    color: black !important;
    font-size: 12pt !important;
  }
  header, #sparkleCanvas, #cursorClickLayer, .print-hide, .app-view:not(#view-lesson), .pdf-tool-btn, #audioDockLesson {
    display: none !important;
  }
  #view-lesson {
    display: block !important;
    overflow: visible !important;
    width: 100% !important;
    height: auto !important;
    padding: 0 !important;
  }
  .blue-glass-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    background: white !important;
    break-inside: avoid;
    margin-bottom: 20px !important;
  }
  table {
    border-collapse: collapse !important;
    width: 100% !important;
  }
  th, td {
    border: 1px solid #bbb !important;
    color: black !important;
    padding: 6px !important;
  }
  thead {
    background-color: #f1f5f9 !important;
  }
}

/* ================= THEME MODES: DARK & SEPIA ================= */
[data-theme="dark"] {
  --sky-primary: #38bdf8;
  --sky-hover: #7dd3fc;
  --sky-light: #0f172a;
  --sky-card: rgba(30, 41, 59, 0.95);
  --sky-border: rgba(51, 65, 85, 0.9);
  --sky-glow: rgba(56, 189, 248, 0.2);
  --text-dark: #f1f5f9;
  --text-muted: #94a3b8;
}
[data-theme="dark"] body {
  background: linear-gradient(135deg, #090d16 0%, #0f172a 50%, #1e293b 100%) !important;
  color: #f1f5f9 !important;
}
[data-theme="dark"] header {
  background: rgba(15, 23, 42, 0.94) !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .blue-glass-card,
[data-theme="dark"] .bg-white\/95,
[data-theme="dark"] .bg-white\/90,
[data-theme="dark"] .bg-white\/80,
[data-theme="dark"] .bg-white {
  background-color: rgba(30, 41, 59, 0.92) !important;
  border-color: #334155 !important;
  color: #f1f5f9 !important;
}
[data-theme="dark"] .text-sky-950,
[data-theme="dark"] .text-sky-900,
[data-theme="dark"] .text-sky-800,
[data-theme="dark"] .text-blue-950,
[data-theme="dark"] .text-blue-900 {
  color: #f8fafc !important;
}
[data-theme="dark"] .text-sky-700,
[data-theme="dark"] .text-sky-600,
[data-theme="dark"] .text-blue-700 {
  color: #93c5fd !important;
}
[data-theme="dark"] .bg-sky-50,
[data-theme="dark"] .bg-sky-100,
[data-theme="dark"] .bg-blue-50 {
  background-color: rgba(30, 41, 59, 0.65) !important;
}
[data-theme="dark"] .border-sky-200,
[data-theme="dark"] .border-sky-300,
[data-theme="dark"] .border-blue-200 {
  border-color: #334155 !important;
}
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}

/* SEPIA MODE */
[data-theme="sepia"] {
  --sky-primary: #d97706;
  --sky-hover: #b45309;
  --sky-light: #fef3c7;
  --sky-card: rgba(254, 252, 246, 0.96);
  --sky-border: rgba(217, 180, 130, 0.7);
  --sky-glow: rgba(217, 119, 6, 0.2);
  --text-dark: #451a03;
  --text-muted: #78350f;
}
[data-theme="sepia"] body {
  background: linear-gradient(135deg, #fbf7ee 0%, #f5eedb 50%, #eee4c9 100%) !important;
  color: #451a03 !important;
}
[data-theme="sepia"] header {
  background: rgba(254, 252, 246, 0.94) !important;
  border-color: #d9b482 !important;
}
[data-theme="sepia"] .blue-glass-card,
[data-theme="sepia"] .bg-white\/95,
[data-theme="sepia"] .bg-white {
  background-color: #fdfbf7 !important;
  border-color: #e5d3b3 !important;
  color: #451a03 !important;
}
[data-theme="sepia"] .text-sky-950,
[data-theme="sepia"] .text-sky-900,
[data-theme="sepia"] .text-sky-800 {
  color: #451a03 !important;
}
[data-theme="sepia"] .text-sky-700,
[data-theme="sepia"] .text-sky-600 {
  color: #92400e !important;
}
[data-theme="sepia"] .bg-sky-50,
[data-theme="sepia"] .bg-sky-100 {
  background-color: #f9f2e3 !important;
}
[data-theme="sepia"] .border-sky-200,
[data-theme="sepia"] .border-sky-300 {
  border-color: #dfcdb0 !important;
}

/* Microphone Pulse & Speaking Animations */
@keyframes mic-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 12px rgba(244, 63, 94, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}
.mic-recording-active {
  animation: mic-pulse 1.3s infinite ease-in-out !important;
  background-color: #f43f5e !important;
  color: white !important;
  border-color: #e11d48 !important;
}

/* Floating XP Toast Animation */
@keyframes xp-float {
  0% { opacity: 0; transform: translateY(12px) scale(0.85); }
  25% { opacity: 1; transform: translateY(0px) scale(1.08); }
  75% { opacity: 1; transform: translateY(-15px) scale(1); }
  100% { opacity: 0; transform: translateY(-30px) scale(0.9); }
}
.xp-toast-anim {
  animation: xp-float 1.9s forwards cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 3D Flip Card Effect for Smart SRS Flashcards */
.perspective-1000 {
  perspective: 1000px;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}
.flashcard-inner.flipped,
.flashcard-flipped .flashcard-inner {
  transform: rotateY(180deg);
}
.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 1.25rem;
}
.flashcard-back {
  transform: rotateY(180deg);
}

/* Audio Dock Speed & A-B Looper Styles */
.ab-loop-active {
  background-color: #8b5cf6 !important;
  color: white !important;
  border-color: #7c3aed !important;
  animation: pulse 1.5s infinite;
}

/* Roleplay Chat Styling */
.roleplay-chat-scroll::-webkit-scrollbar {
  width: 5px;
}
.roleplay-chat-scroll::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
}

/* ================= PRINT OPTIMIZATION FOR MASTER GRAMMAR & PDF ================= */
@media print {
  /* Hide all top-level UI and modals except the dedicated print container */
  body > *:not(#directPrintRoot) {
    display: none !important;
  }

  /* Reset html and body so browsers can paginate across multiple A4 sheets naturally */
  html, body {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    background: #ffffff !important;
    color: #0f172a !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  }

  #directPrintRoot {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: #ffffff !important;
    color: #0f172a !important;
  }

  @page {
    size: A4 portrait;
    margin: 12mm 10mm 14mm 10mm;
  }

  .print-page-break {
    page-break-after: always !important;
    break-after: page !important;
  }

  .print-section {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-bottom: 1.25rem !important;
  }

  table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 0.4rem !important;
    margin-bottom: 0.6rem !important;
    page-break-inside: auto !important;
  }

  tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  thead {
    display: table-header-group !important;
  }

  th, td {
    border: 1px solid #94a3b8 !important;
    padding: 5px 8px !important;
    font-size: 9pt !important;
    color: #0f172a !important;
    line-height: 1.35 !important;
  }

  th {
    background-color: #f1f5f9 !important;
    font-weight: 800 !important;
    color: #0f172a !important;
  }

  .no-print {
    display: none !important;
  }
}
