@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Noto+Serif+SC:wght@400;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: 'Noto Serif SC', Georgia, Cambria, "Times New Roman", serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Theme: Light Pastel Anime */
  --bg-primary: #fbfbfd;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f4f4f8;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --border-subtle: #e5e7eb;
  --border-accent: #fbcfe8;
  
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --accent-pink: #ec4899;
  --accent-pink-light: #fdf2f8;
  --accent-purple: #8b5cf6;
  --accent-purple-light: #f5f3ff;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-emerald-light: #ecfdf5;
  --accent-rose: #f43f5e;
  --accent-rose-light: #fff1f2;
  --accent-amber: #f59e0b;
  --accent-amber-light: #fffbeb;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(236, 72, 153, 0.2);
}

body.dark {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-glass: rgba(17, 24, 39, 0.88);
  --border-subtle: #374151;
  --border-accent: #831843;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;

  --accent-pink: #f472b6;
  --accent-pink-light: rgba(244, 114, 182, 0.12);
  --accent-purple: #a78bfa;
  --accent-purple-light: rgba(167, 139, 250, 0.12);
  --accent-emerald: #34d399;
  --accent-emerald-light: rgba(52, 211, 153, 0.12);
  --accent-rose: #fb7185;
  --accent-rose-light: rgba(251, 113, 133, 0.12);
  --accent-amber: #fbbf24;
  --accent-amber-light: rgba(251, 191, 36, 0.12);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(244, 114, 182, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}

/* Typography styles */
.font-serif {
  font-family: var(--font-serif);
}
.font-mono {
  font-family: var(--font-mono);
}

/* Glassmorphism */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
}

/* Glow effects */
.glow-pink {
  box-shadow: 0 0 18px rgba(236, 72, 153, 0.25);
}
.glow-purple {
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.25);
}

/* Clue sentence highlight */
.clue-highlight {
  background-color: rgba(251, 191, 36, 0.25);
  border-bottom: 2px dashed #f59e0b;
  border-radius: 2px;
  padding: 1px 4px;
  transition: all 0.3s ease;
}

.clue-pulse {
  animation: cluePulse 2s infinite ease-in-out;
}

@keyframes cluePulse {
  0%, 100% {
    background-color: rgba(244, 114, 182, 0.2);
    box-shadow: 0 0 0 rgba(244, 114, 182, 0);
  }
  50% {
    background-color: rgba(244, 114, 182, 0.45);
    box-shadow: 0 0 12px rgba(244, 114, 182, 0.5);
  }
}

/* Selection Popover */
#selection-popover {
  position: absolute;
  z-index: 1000;
  display: none;
  transform: translateX(-50%);
  animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popoverFadeIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

/* 3D Flip Flashcard */
.flashcard-container {
  perspective: 1000px;
}
.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}
.flashcard-inner.flipped {
  transform: rotateY(180deg);
}
.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.flashcard-back {
  transform: rotateY(180deg);
}

/* Anime cat bounce */
@keyframes catEarWiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-6deg); }
  75% { transform: rotate(6deg); }
}
.cat-wiggle:hover {
  animation: catEarWiggle 0.5s ease-in-out infinite;
}

/* Custom Radio Card */
.quiz-option {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.quiz-option:hover {
  border-color: var(--accent-pink);
  transform: translateY(-1px);
}
.quiz-option.selected {
  border-color: var(--accent-purple);
  background-color: var(--accent-purple-light);
}
.quiz-option.correct {
  border-color: var(--accent-emerald) !important;
  background-color: var(--accent-emerald-light) !important;
}
.quiz-option.wrong {
  border-color: var(--accent-rose) !important;
  background-color: var(--accent-rose-light) !important;
}

/* Cluster item list active state */
.cluster-nav-item.active {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(139, 92, 246, 0.12));
  border-color: #ec4899 !important;
  font-weight: 700;
}

/* Highlight chunk in sentences */
.highlight-term {
  background-color: rgba(236, 72, 153, 0.15);
  color: #db2777;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 4px;
  border-bottom: 1.5px solid #ec4899;
}
.dark .highlight-term {
  background-color: rgba(244, 114, 182, 0.2);
  color: #f472b6;
  border-bottom-color: #f472b6;
}

/* Toast Notification */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
#toast.show {
  transform: translateY(0);
  opacity: 1;
}
