/* ===== 熊稳稳 - Custom Styles ===== */

:root {
  --bear-primary: #D97706;
  --bear-primary-light: #F59E0B;
  --bear-primary-dark: #92400E;
  --bear-secondary: #1E3A5F;
  --bear-accent: #10B981;
  --bear-warm: #FFFBEB;
  --bear-cream: #FEF3C7;
  --bear-text: #292524;
  --bear-text-light: #78716C;
  --bear-border: #E7D4B5;
  --bear-card: #FFFFFF;
  --bear-shadow: 0 4px 24px rgba(217, 119, 6, 0.08);
  --bear-shadow-hover: 0 8px 40px rgba(217, 119, 6, 0.15);
}

[data-theme="dark"] {
  --bear-primary: #F59E0B;
  --bear-primary-light: #FBBF24;
  --bear-primary-dark: #D97706;
  --bear-secondary: #60A5FA;
  --bear-accent: #34D399;
  --bear-warm: #1A1A2E;
  --bear-cream: #16213E;
  --bear-text: #F3F4F6;
  --bear-text-light: #9CA3AF;
  --bear-border: #374151;
  --bear-card: #1E293B;
  --bear-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --bear-shadow-hover: 0 8px 40px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
  background-color: var(--bear-warm);
  color: var(--bear-text);
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* ===== Animations ===== */

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

@keyframes floatBear {
  0%, 100% {
    transform: translateY(0) rotate(-2deg);
  }
  50% {
    transform: translateY(-12px) rotate(2deg);
  }
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.4);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 16px rgba(217, 119, 6, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(217, 119, 6, 0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ===== Utility Classes ===== */

.animate-fade-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-float {
  animation: floatBear 4s ease-in-out infinite;
}

.animate-bounce-in {
  animation: bounceIn 0.5s ease-out forwards;
}

.animate-slide-right {
  animation: slideInRight 0.5s ease-out forwards;
}

/* ===== Bear Logo ===== */

.bear-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
}

.bear-logo-svg {
  width: 40px;
  height: 40px;
  transition: transform 0.3s ease;
}

.bear-logo:hover .bear-logo-svg {
  transform: rotate(-10deg) scale(1.1);
}

.bear-logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--bear-primary), var(--bear-primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Hero Section ===== */

.hero-bg {
  position: relative;
  overflow: hidden;
}

.hero-bg::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.12), transparent 70%);
  border-radius: 50%;
  z-index: 0;
}

.hero-bg::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08), transparent 70%);
  border-radius: 50%;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero-title-gradient {
  background: linear-gradient(135deg, var(--bear-primary) 0%, var(--bear-primary-light) 50%, var(--bear-accent) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear infinite;
}

/* ===== Card Styles ===== */

.feature-card {
  background: var(--bear-card);
  border: 1px solid var(--bear-border);
  border-radius: 1.25rem;
  padding: 2rem;
  box-shadow: var(--bear-shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--bear-primary), var(--bear-primary-light));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--bear-shadow-hover);
  border-color: var(--bear-primary-light);
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.1), rgba(245, 158, 11, 0.15));
  margin-bottom: 1.25rem;
  transition: transform 0.3s ease;
}

.feature-card:hover .feature-icon-wrapper {
  transform: scale(1.1) rotate(-5deg);
}

/* ===== Flashcard ===== */

.flashcard-container {
  perspective: 1200px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.flashcard {
  position: relative;
  width: 100%;
  height: 320px;
  cursor: pointer;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  box-shadow: var(--bear-shadow-hover);
}

.flashcard-front {
  background: linear-gradient(135deg, var(--bear-card) 0%, var(--bear-cream) 100%);
  border: 2px solid var(--bear-border);
}

.flashcard-back {
  background: linear-gradient(135deg, var(--bear-primary) 0%, var(--bear-primary-dark) 100%);
  color: white;
  transform: rotateY(180deg);
}

[data-theme="dark"] .flashcard-back {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}

/* ===== Buttons ===== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: linear-gradient(135deg, var(--bear-primary), var(--bear-primary-light));
  color: white;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(217, 119, 6, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: transparent;
  color: var(--bear-primary);
  font-weight: 700;
  font-size: 1rem;
  border-radius: 0.75rem;
  border: 2px solid var(--bear-primary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background: var(--bear-primary);
  color: white;
  transform: translateY(-2px);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: transparent;
  color: var(--bear-text-light);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-ghost:hover {
  background: rgba(217, 119, 6, 0.08);
  color: var(--bear-primary);
}

.btn-ghost.active {
  background: var(--bear-primary);
  color: white;
}

/* ===== Quiz ===== */

.quiz-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--bear-card);
  border: 2px solid var(--bear-border);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
  color: var(--bear-text);
  text-align: left;
  width: 100%;
}

.quiz-option:hover:not(.disabled) {
  border-color: var(--bear-primary-light);
  background: rgba(245, 158, 11, 0.05);
  transform: translateX(4px);
}

.quiz-option.correct {
  border-color: var(--bear-accent);
  background: rgba(16, 185, 129, 0.1);
  color: var(--bear-accent);
}

.quiz-option.wrong {
  border-color: #EF4444;
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
}

.quiz-option.disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.quiz-option-letter {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  background: rgba(217, 119, 6, 0.1);
  color: var(--bear-primary);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.quiz-option.correct .quiz-option-letter {
  background: var(--bear-accent);
  color: white;
}

.quiz-option.wrong .quiz-option-letter {
  background: #EF4444;
  color: white;
}

/* ===== Progress Stats ===== */

.stat-card {
  background: var(--bear-card);
  border: 1px solid var(--bear-border);
  border-radius: 1rem;
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--bear-shadow);
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--bear-primary), var(--bear-primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--bear-text-light);
  margin-top: 0.5rem;
  font-weight: 500;
}

/* ===== Daily Sentence ===== */

.daily-sentence-card {
  background: linear-gradient(135deg, var(--bear-secondary) 0%, #2D4A6F 100%);
  border-radius: 1.5rem;
  padding: 2.5rem;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(30, 58, 95, 0.3);
}

[data-theme="dark"] .daily-sentence-card {
  background: linear-gradient(135deg, #1E3A5F 0%, #0F2942 100%);
}

.daily-sentence-card::before {
  content: '"';
  position: absolute;
  top: -20px;
  left: 20px;
  font-size: 8rem;
  font-family: Georgia, serif;
  color: rgba(255, 255, 255, 0.1);
  line-height: 1;
}

/* ===== Theme Toggle ===== */

.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bear-card);
  border: 1px solid var(--bear-border);
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--bear-text);
}

.theme-toggle:hover {
  transform: rotate(360deg);
  border-color: var(--bear-primary);
  color: var(--bear-primary);
}

/* ===== Navigation ===== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 251, 235, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bear-border);
  transition: background-color 0.3s ease;
}

[data-theme="dark"] .navbar {
  background: rgba(26, 26, 46, 0.85);
}

/* ===== Page Transitions ===== */

.page {
  display: none;
  animation: fadeInUp 0.5s ease-out forwards;
}

.page.active {
  display: block;
}

/* ===== Scroll Reveal ===== */

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Confetti ===== */

.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  z-index: 9999;
  pointer-events: none;
  animation: confettiFall 3s ease-in forwards;
}

/* ===== Category Badge ===== */

.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(217, 119, 6, 0.1);
  color: var(--bear-primary);
}

/* ===== Speaker Button ===== */

.speaker-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  color: white;
}

.speaker-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

.speaker-btn.speaking {
  animation: pulse-ring 1.5s infinite;
}

/* ===== Scrollbar ===== */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bear-warm);
}

::-webkit-scrollbar-thumb {
  background: var(--bear-primary-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bear-primary);
}

/* ===== Footer ===== */

.footer-link {
  color: var(--bear-text-light);
  text-decoration: none;
  transition: color 0.2s ease;
  font-size: 0.9rem;
}

.footer-link:hover {
  color: var(--bear-primary);
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
  .flashcard {
    height: 260px;
  }

  .daily-sentence-card {
    padding: 1.5rem;
  }

  .hero-title {
    font-size: 2.5rem;
  }
}
