/* ===== 8年级英语难点突破 - 全局样式 ===== */
:root {
  --primary: #FF6B35;
  --primary-light: #FF8C5A;
  --secondary: #004E89;
  --accent: #FFC857;
  --success: #2ECC71;
  --danger: #E74C3C;
  --bg: #F5F0E8;
  --card: #FFFFFF;
  --text: #2C3E50;
  --text-light: #7F8C8D;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 4px; }

/* ===== Header ===== */
.app-header {
  background: linear-gradient(135deg, var(--secondary), #0066AA);
  color: white;
  padding: 20px 20px 30px;
  border-radius: 0 0 24px 24px;
  position: relative;
}
.app-header h1 { font-size: 1.4rem; margin-bottom: 4px; }
.app-header .subtitle { font-size: 0.8rem; opacity: 0.85; }

/* ===== Stats Bar ===== */
.stats-bar {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  gap: 8px;
}
.stat-item {
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  flex: 1;
  text-align: center;
}
.stat-item .label { font-size: 0.65rem; opacity: 0.8; display: block; }
.stat-item .value { font-size: 1.2rem; font-weight: 700; display: block; margin-top: 2px; }

/* ===== Streak Fire ===== */
.streak-fire {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.streak-fire .fire-icon { font-size: 1.4rem; animation: firePulse 1.5s ease-in-out infinite; }
@keyframes firePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: center;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(255,107,53,0.3); }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 10px 18px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ===== Bottom Navigation ===== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: white;
  display: flex;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  z-index: 100;
  border-radius: 16px 16px 0 0;
}
.nav-item {
  flex: 1;
  padding: 10px 0;
  text-align: center;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-light);
  border: none;
  background: none;
  font-family: var(--font);
}
.nav-item .nav-icon { font-size: 1.3rem; display: block; margin-bottom: 2px; }
.nav-item.active { color: var(--primary); font-weight: 600; }
.nav-item:active { opacity: 0.7; }

/* ===== Pages (Screens) ===== */
.page {
  display: none;
  padding-bottom: 70px;
}
.page.active { display: block; }

/* ===== Quiz Screen ===== */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: white;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.quiz-header .back-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text);
}
.quiz-header .quiz-progress {
  font-size: 0.85rem;
  font-weight: 600;
}
.progress-bar {
  height: 4px;
  background: #E8E8E8;
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
  border-radius: 2px;
}

.question-container {
  padding: 20px 16px;
}
.question-module {
  display: inline-block;
  background: var(--secondary);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  margin-bottom: 12px;
}
.question-difficulty {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
}
.star { color: var(--accent); font-size: 0.8rem; }
.question-text {
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ===== Options ===== */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid #E8E8E8;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}
.option-item:hover { border-color: var(--primary-light); background: #FFF5F0; }
.option-item.selected { border-color: var(--primary); background: #FFF0E8; }
.option-item.correct { border-color: var(--success); background: #E8F8F0; }
.option-item.wrong { border-color: var(--danger); background: #FDE8E8; }
.option-item input[type="radio"] { display: none; }
.option-label {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #F0F0F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.option-item.selected .option-label { background: var(--primary); color: white; }
.option-item.correct .option-label { background: var(--success); color: white; }
.option-item.wrong .option-label { background: var(--danger); color: white; }
.option-text { flex: 1; }

/* ===== Feedback ===== */
.feedback-box {
  margin: 16px;
  padding: 16px;
  border-radius: var(--radius-sm);
  display: none;
}
.feedback-box.show { display: block; }
.feedback-correct { background: #E8F8F0; border-left: 4px solid var(--success); }
.feedback-wrong { background: #FDE8E8; border-left: 4px solid var(--danger); }
.feedback-icon { font-size: 1.5rem; margin-bottom: 6px; }
.feedback-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.feedback-explanation { font-size: 0.85rem; color: var(--text-light); line-height: 1.5; }
.feedback-extra { margin-top: 8px; }

/* ===== XP Toast ===== */
.xp-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 20px 30px;
  border-radius: var(--radius);
  text-align: center;
  z-index: 200;
  display: none;
  animation: xpPopIn 0.4s ease-out;
}
.xp-toast.show { display: block; }
.xp-toast .xp-amount { font-size: 2rem; font-weight: 800; color: var(--accent); }
.xp-toast .xp-label { font-size: 0.85rem; opacity: 0.85; }
@keyframes xpPopIn {
  0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* ===== Badge Grid ===== */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.badge-item {
  text-align: center;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  background: #F9F9F9;
  transition: all 0.2s;
}
.badge-item.earned { background: #FFF5E6; }
.badge-item.locked { opacity: 0.4; }
.badge-icon { font-size: 2rem; display: block; margin-bottom: 4px; }
.badge-name { font-size: 0.75rem; font-weight: 600; }
.badge-desc { font-size: 0.65rem; color: var(--text-light); }

/* ===== Error Book ===== */
.error-item {
  border: 1px solid #E8E8E8;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}
.error-item .error-q { font-size: 0.9rem; margin-bottom: 6px; }
.error-item .error-stats { font-size: 0.75rem; color: var(--text-light); }
.error-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 12px;
}
.error-filter .filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: #F0F0F0;
  border: none;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
}
.error-filter .filter-chip.active { background: var(--primary); color: white; }

/* ===== Parent Dashboard ===== */
.parent-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.parent-stat {
  background: #F9F9F9;
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.parent-stat .label { font-size: 0.7rem; color: var(--text-light); display: block; }
.parent-stat .value { font-size: 1.3rem; font-weight: 700; color: var(--secondary); display: block; }

.weakness-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #F0F0F0;
  font-size: 0.85rem;
}
.weakness-item:last-child { border-bottom: none; }
.weakness-bar {
  height: 6px;
  background: #F0F0F0;
  border-radius: 3px;
  overflow: hidden;
  flex: 1;
  margin: 0 10px;
  max-width: 120px;
}
.weakness-fill {
  height: 100%;
  background: var(--danger);
  border-radius: 3px;
  transition: width 0.5s;
}

/* ===== Activation ===== */
.activation-input {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 16px 0;
}
.activation-input .code-box {
  width: 36px;
  height: 48px;
  border: 2px solid #DDD;
  border-radius: 8px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  font-family: monospace;
  outline: none;
  transition: border-color 0.2s;
}
.activation-input .code-box:focus { border-color: var(--primary); }
.activation-input .code-dash {
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--text-light);
}

/* ===== Progress Rings ===== */
.progress-ring {
  width: 80px;
  height: 80px;
  position: relative;
}
.progress-ring svg {
  transform: rotate(-90deg);
}
.progress-ring .ring-bg { fill: none; stroke: #E8E8E8; stroke-width: 6; }
.progress-ring .ring-fg { fill: none; stroke: var(--primary); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 0.5s; }
.progress-ring .ring-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.progress-ring .ring-center .pct { font-size: 1.1rem; font-weight: 700; }
.progress-ring .ring-center .pct-label { font-size: 0.55rem; color: var(--text-light); }

/* ===== Trend Chart (mini) ===== */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 80px;
  padding: 10px 0;
}
.trend-bar {
  flex: 1;
  background: var(--secondary);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.5s;
  opacity: 0.7;
}
.trend-bar.today { opacity: 1; background: var(--primary); }

/* ===== Radar Chart (CSS) ===== */
.radar-container {
  width: 160px;
  height: 160px;
  margin: 0 auto;
  position: relative;
}
.radar-svg { width: 100%; height: 100%; }
.radar-grid { fill: none; stroke: #DDD; stroke-width: 1; }
.radar-area { fill: var(--primary); fill-opacity: 0.2; stroke: var(--primary); stroke-width: 2; }
.radar-label { font-size: 8px; fill: var(--text); text-anchor: middle; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 360px;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease-out;
}
@keyframes modalIn {
  0% { transform: translateY(30px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
.modal-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 12px; text-align: center; }

/* ===== Password Input ===== */
.password-input {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 0;
}
.password-input .pwd-box {
  width: 42px;
  height: 52px;
  border: 2px solid #DDD;
  border-radius: 10px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  outline: none;
  transition: all 0.2s;
}
.password-input .pwd-box:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,107,53,0.15); }

/* ===== Review Badge ===== */
.review-badge {
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  position: absolute;
  top: -6px;
  right: -6px;
  font-weight: 700;
}

/* ===== Keyboard Chip ===== */
.chip-input {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.chip-key {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid #DDD;
  background: white;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
}
.chip-key:active { background: var(--primary); color: white; border-color: var(--primary); }
.chip-key.back { width: 80px; font-size: 0.85rem; background: #F0F0F0; }

/* ===== Combo Display ===== */
.combo-display {
  position: fixed;
  top: 20%;
  right: 16px;
  z-index: 50;
  animation: comboFly 0.6s ease-out;
  pointer-events: none;
}
.combo-display .combo-text {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  padding: 8px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(255,107,53,0.3);
}
@keyframes comboFly {
  0% { transform: translateY(20px) scale(0.5); opacity: 0; }
  50% { transform: translateY(-10px) scale(1.1); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* ===== Lockscreen ===== */
.lockscreen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, var(--secondary), #003366);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
  color: white;
  padding: 40px;
}
.lockscreen .lock-icon { font-size: 4rem; margin-bottom: 20px; }
.lockscreen .lock-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.lockscreen .lock-desc { font-size: 0.85rem; opacity: 0.8; margin-bottom: 24px; text-align: center; }

/* ===== Responsive ===== */
@media (min-width: 481px) {
  body { border: 1px solid #E0E0E0; box-shadow: 0 0 30px rgba(0,0,0,0.05); }
}

/* ===== Utility ===== */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.hidden { display: none !important; }
