@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  --primary: #4d96ff;
  --secondary: #6bcb77;
  --accent-coral: #ff6b6b;
  --accent-gold: #ffd93d;
  --accent-mint: #6bcb77;
  --accent-blue: #4d96ff;
  --accent-purple: #c77dff;
  --bg-dark: #0f0c29;
  --bg-mid: #302b63;
  --bg-light: #24243e;
  --card-bg: rgba(255, 255, 255, 0.1);
  --card-border: rgba(255, 255, 255, 0.2);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 20px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.3);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Nunito', 'Microsoft YaHei', sans-serif;
}

body {
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-mid) 50%, var(--bg-light) 100%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Star Background */
.stars-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

.page-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Glass Card */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  transition: var(--transition);
}

/* Navigation */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  margin-bottom: 30px;
}

.back-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateX(-5px);
}

.nav-title {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  flex-grow: 1;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Typography */
.section-title {
  font-size: 2.2rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 10px;
  background: linear-gradient(to right, #ffd93d, #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(255, 217, 61, 0.2);
}

.subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.2rem;
  margin-bottom: 40px;
}

/* Buttons */
.btn {
  border: none;
  padding: 14px 28px;
  border-radius: 50px;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: white;
  text-decoration: none;
}

.btn:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: linear-gradient(135deg, #4d96ff, #6bcb77);
  box-shadow: 0 4px 15px rgba(77, 150, 255, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, #c77dff, #ff6b6b);
  box-shadow: 0 4px 15px rgba(199, 125, 255, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b6b, #ff4757);
}

/* Module Cards (Home Page) */
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.module-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: white;
  position: relative;
  overflow: hidden;
}

.module-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255,255,255,0.4);
}

.module-icon {
  font-size: 4rem;
  margin-bottom: 15px;
  filter: drop-shadow(0 10px 10px rgba(0,0,0,0.3));
}

.module-name {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 5px;
}

.module-desc {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.locked-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.module-card.locked .locked-overlay {
  opacity: 1;
  pointer-events: all;
}

.lock-icon {
  font-size: 3rem;
  margin-bottom: 10px;
}

/* Progress Bar */
.progress-container {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-coral));
  border-radius: 10px;
  width: 0%;
  transition: width 1s ease-out;
}

.star-rating {
  font-size: 1.2rem;
  letter-spacing: 2px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  padding: 15px 25px;
  border-radius: 12px;
  color: white;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  animation: slideInRight 0.3s forwards;
  backdrop-filter: blur(10px);
}

.toast.removing {
  animation: fadeOutRight 0.3s forwards;
}

.toast.success { background: rgba(107, 203, 119, 0.9); }
.toast.error { background: rgba(255, 107, 107, 0.9); }
.toast.info { background: rgba(77, 150, 255, 0.9); }

/* Celebration Overlay */
.celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
}

.celebration-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.celeb-emoji {
  font-size: 8rem;
  animation: bounceIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.celeb-text {
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent-gold);
  text-shadow: 0 5px 15px rgba(255, 217, 61, 0.5);
  margin-top: 20px;
  animation: popIn 0.8s 0.2s both;
}

.falling-emoji {
  position: absolute;
  top: -50px;
  font-size: 2rem;
  animation: fallDown linear forwards;
}

/* Inputs */
.input-answer {
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.3);
  color: white;
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  padding: 10px;
  border-radius: 12px;
  width: 80px;
  outline: none;
  transition: var(--transition);
}

.input-answer:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 15px rgba(255, 217, 61, 0.5);
}

/* Utility Animations */
.correct-flash {
  animation: correctPulse 0.5s;
}

.wrong-shake {
  animation: wrongShake 0.5s;
}

/* Parent Link */
.parent-link {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(255,255,255,0.1);
  padding: 8px 15px;
  border-radius: 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: var(--transition);
}

.parent-link:hover {
  background: rgba(255,255,255,0.2);
  color: white;
}

/* Animations */
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

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

@keyframes popIn {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes fallDown {
  to { transform: translateY(110vh) rotate(360deg); }
}

@keyframes correctPulse {
  0% { box-shadow: 0 0 0 0 rgba(107, 203, 119, 0.7); }
  50% { box-shadow: 0 0 0 15px rgba(107, 203, 119, 0); }
  100% { box-shadow: 0 0 0 0 rgba(107, 203, 119, 0); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Staggered entrance */
.stagger-1 { animation: slideUpFade 0.6s 0.1s both; }
.stagger-2 { animation: slideUpFade 0.6s 0.2s both; }
.stagger-3 { animation: slideUpFade 0.6s 0.3s both; }
.stagger-4 { animation: slideUpFade 0.6s 0.4s both; }

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

/* Responsive */
@media (max-width: 768px) {
  .section-title { font-size: 1.8rem; }
  .module-icon { font-size: 3rem; }
  .module-name { font-size: 1.5rem; }
}
