/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }

/* ===== App Container ===== */
#app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  background: #FAFBFC;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0,0,0,0.08);
}

/* ===== Screens ===== */
.screen {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.3s ease;
}
.screen.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Status Bar ===== */
.status-bar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  background: inherit;
}
.status-bar .status-icons { display: flex; gap: 6px; align-items: center; }

/* ===== Home Screen ===== */
.home-header {
  background: linear-gradient(135deg, #FF8C42 0%, #FF6B35 100%);
  padding: 0 16px 20px;
  border-radius: 0 0 28px 28px;
  position: relative;
}
.home-header .status-bar { color: #fff; }
.grade-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.grade-badge {
  background: rgba(255,255,255,0.25);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.grade-badge:hover { background: rgba(255,255,255,0.35); }
.grade-badge .arrow { font-size: 10px; }

.mascot-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  background: rgba(255,255,255,0.2);
  border-radius: 16px;
  padding: 12px 16px;
  backdrop-filter: blur(10px);
}
.mascot-banner .fox { flex-shrink: 0; }
.mascot-banner .banner-text { color: #fff; }
.mascot-banner .banner-title { font-size: 17px; font-weight: 700; }
.mascot-banner .banner-sub { font-size: 12px; opacity: 0.85; margin-top: 2px; }

.home-body {
  padding: 16px;
  padding-bottom: 80px;
}
.section-title {
  font-size: 15px;
  font-weight: 700;
  color: #6B7280;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Unit Cards */
.unit-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.unit-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.unit-card:active { transform: scale(0.98); box-shadow: 0 1px 6px rgba(0,0,0,0.08); }
.unit-card .unit-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.unit-card .unit-info { flex: 1; min-width: 0; }
.unit-card .unit-name { font-size: 15px; font-weight: 700; color: #1a1a2e; margin-bottom: 2px; }
.unit-card .unit-en { font-size: 12px; color: #9CA3AF; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-card .unit-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.unit-card .progress-bar {
  flex: 1;
  height: 6px;
  background: #F3F4F6;
  border-radius: 3px;
  overflow: hidden;
}
.unit-card .progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.unit-card .progress-text { font-size: 11px; color: #9CA3AF; font-weight: 600; white-space: nowrap; }
.unit-card .unit-arrow { color: #D1D5DB; font-size: 18px; flex-shrink: 0; }

/* ===== Practice Screen ===== */
#screen-practice { background: #FAFBFC; }
.practice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 44px 16px 12px;
}
.back-btn {
  width: 36px; height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F3F4F6;
  color: #6B7280;
  font-size: 18px;
}
.practice-progress {
  font-size: 13px;
  font-weight: 600;
  color: #9CA3AF;
}
.practice-close {
  width: 36px; height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F3F4F6;
  color: #6B7280;
  font-size: 16px;
}

.fox-mascot {
  display: block;
  margin: 8px auto 0;
}

.word-card {
  margin: 20px 16px;
  background: #fff;
  border-radius: 24px;
  padding: 40px 24px 32px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  position: relative;
}
.word-card .word-illustration {
  font-size: 56px;
  margin-bottom: 16px;
}
.word-card .word-text {
  font-size: 36px;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}
.word-card .phonetic {
  font-size: 16px;
  color: #6B7280;
  margin-bottom: 20px;
  font-style: italic;
}
.word-card .pronounce-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: #F3F4F6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: background 0.2s, transform 0.2s;
}
.word-card .pronounce-btn:active { transform: scale(0.9); }
.word-card .pronounce-btn:hover { background: #E5E7EB; }

.hint-text {
  text-align: center;
  font-size: 13px;
  color: #9CA3AF;
  margin: 0 0 16px;
}

.speak-btn {
  display: block;
  width: calc(100% - 32px);
  max-width: 340px;
  margin: 0 auto 12px;
  padding: 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, #FF8C42 0%, #FF6B35 100%);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 6px 20px rgba(255,107,53,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.speak-btn:active, .speaking.speak-btn {
  transform: scale(0.96);
  box-shadow: 0 2px 10px rgba(255,107,53,0.3);
}
.speak-btn .mic-icon { font-size: 22px; vertical-align: middle; margin-right: 6px; }
.speak-btn.speaking {
  background: linear-gradient(135deg, #FF6B6B 0%, #EE5A5A 100%);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(255,107,53,0.35); }
  50% { box-shadow: 0 6px 30px rgba(255,107,53,0.55); }
}

.fallback-row {
  display: flex;
  gap: 12px;
  padding: 0 16px;
  margin-bottom: 20px;
}
.fallback-btn {
  flex: 1;
  padding: 14px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.15s;
}
.fallback-btn:active { transform: scale(0.96); }
.fallback-btn.correct {
  background: #E0F5EC;
  color: #3D9970;
}
.fallback-btn.wrong {
  background: #FFF0E8;
  color: #FF6B35;
}

/* ===== Feedback Screens ===== */
.feedback-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}
#screen-correct { background: linear-gradient(180deg, #F0FBF4 0%, #E0F5EC 100%); }
#screen-wrong { background: linear-gradient(180deg, #FFF5F3 0%, #FFE8E5 100%); }

.feedback-icon {
  font-size: 72px;
  margin-bottom: 20px;
  animation: bounceIn 0.5s ease;
}
@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.feedback-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}
#screen-correct .feedback-title { color: #10B981; }
#screen-wrong .feedback-title { color: #FF6B35; }
.feedback-subtitle {
  font-size: 14px;
  color: #6B7280;
  margin-bottom: 28px;
}

.feedback-word-card {
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
  margin-bottom: 24px;
}
.feedback-word-card .word-en {
  font-size: 28px;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 4px;
}
.feedback-word-card .word-phonetic {
  font-size: 14px;
  color: #9CA3AF;
  font-style: italic;
  margin-bottom: 12px;
}
.feedback-word-card .word-cn {
  font-size: 20px;
  font-weight: 600;
  color: #FF6B35;
}

.sound-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.6);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  color: #6B7280;
  margin-bottom: 24px;
}

.next-btn {
  padding: 16px 48px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  transition: transform 0.15s;
}
.next-btn:active { transform: scale(0.96); }
#screen-correct .next-btn { background: #10B981; }
#screen-wrong .next-btn { background: #FF6B35; }

/* ===== Stats Screen ===== */
#screen-stats { background: #FAFBFC; }
.stats-header {
  padding: 44px 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stats-header h2 { font-size: 20px; font-weight: 800; }

.stats-body { padding: 16px; padding-bottom: 80px; }

.stats-overview {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  flex: 1;
  background: #fff;
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.stat-card .stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #1a1a2e;
}
.stat-card .stat-label {
  font-size: 11px;
  color: #9CA3AF;
  margin-top: 4px;
}
.stat-card.accent .stat-value { color: #FF6B35; }

.stats-units { display: flex; flex-direction: column; gap: 10px; }
.stats-unit-row {
  background: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.03);
}
.stats-unit-row .unit-num {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.stats-unit-row .unit-detail { flex: 1; min-width: 0; }
.stats-unit-row .unit-label { font-size: 13px; font-weight: 600; color: #1a1a2e; }
.stats-unit-row .unit-bar {
  height: 5px;
  background: #F3F4F6;
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}
.stats-unit-row .unit-bar-fill { height: 100%; border-radius: 3px; }
.stats-unit-row .unit-count { font-size: 12px; color: #9CA3AF; font-weight: 600; white-space: nowrap; }

.fox-encourage {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #FFF0E8 0%, #FFE8E5 100%);
  border-radius: 16px;
  padding: 16px;
  margin-top: 20px;
}
.fox-encourage .encourage-text {
  font-size: 14px;
  color: #FF6B35;
  font-weight: 600;
  line-height: 1.5;
}

/* ===== Mistakes Screen ===== */
#screen-mistakes { background: #FAFBFC; }
.mistakes-header {
  padding: 44px 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mistakes-header h2 { font-size: 20px; font-weight: 800; }

.mistakes-body { padding: 16px; padding-bottom: 80px; }

.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}
.filter-tab {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  background: #F3F4F6;
  color: #6B7280;
  white-space: nowrap;
  transition: all 0.2s;
}
.filter-tab.active { background: #1a1a2e; color: #fff; }

.mistake-card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.mistake-card .mistake-info { flex: 1; min-width: 0; }
.mistake-card .mistake-word { font-size: 16px; font-weight: 700; color: #1a1a2e; }
.mistake-card .mistake-phonetic { font-size: 12px; color: #9CA3AF; font-style: italic; }
.mistake-card .mistake-cn { font-size: 13px; color: #FF6B35; margin-top: 2px; }
.mistake-card .mistake-count {
  background: #FFE8E5;
  color: #FF6B35;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.mistake-unit-tag {
  font-size: 10px;
  color: #9CA3AF;
  background: #F3F4F6;
  padding: 2px 8px;
  border-radius: 8px;
  margin-top: 4px;
  display: inline-block;
}
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #9CA3AF;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .empty-text { font-size: 15px; }

/* ===== Bottom Tab Bar ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: #fff;
  display: flex;
  border-top: 1px solid #F3F4F6;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab-item {
  flex: 1;
  padding: 8px 0 10px;
  text-align: center;
  color: #9CA3AF;
  transition: color 0.2s;
}
.tab-item.active { color: #FF6B35; }
.tab-item .tab-icon { font-size: 22px; display: block; }
.tab-item .tab-label { font-size: 10px; font-weight: 600; margin-top: 2px; display: block; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ===== Speech Not Supported ===== */
.speech-unsupported {
  text-align: center;
  padding: 12px 16px;
  margin: 0 16px 16px;
  background: #FFF8E0;
  border-radius: 12px;
  font-size: 12px;
  color: #E8A317;
}

/* ===== VIP Entry Banner (Home) ===== */
.vip-entry-web {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 16px 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  box-shadow: 0 4px 16px rgba(255,165,0,0.25);
  cursor: pointer;
}
.vip-entry-icon { font-size: 28px; }
.vip-entry-text { flex: 1; }
.vip-entry-title {
  font-size: 15px;
  font-weight: 700;
  color: #5D4037;
}
.vip-entry-sub {
  font-size: 12px;
  color: rgba(93,64,55,0.7);
  margin-top: 2px;
}
.vip-entry-arrow {
  font-size: 22px;
  color: #5D4037;
  font-weight: 700;
}

/* ===== VIP Screen ===== */
.vip-header-web {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #2D1B69 0%, #6B3FBA 100%);
  color: #fff;
}
.vip-back-btn {
  font-size: 22px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255,255,255,0.2);
}
.vip-header-web h2 {
  font-size: 18px;
  font-weight: 700;
}
.vip-body {
  padding: 20px 16px 100px;
}

/* VIP Price Card */
.vip-price-card {
  background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
  border-radius: 20px;
  padding: 28px 20px;
  text-align: center;
  border: 2px solid #FFD700;
  box-shadow: 0 6px 24px rgba(255,215,0,0.15);
}
.vip-price-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.vip-price-title {
  font-size: 16px;
  font-weight: 700;
  color: #5D4037;
}
.vip-price-tag {
  font-size: 10px;
  color: #fff;
  background: #FF6B35;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.vip-price-body {
  margin: 12px 0 4px;
  display: flex;
  align-items: baseline;
  justify-content: center;
}
.vip-price-symbol {
  font-size: 18px;
  color: #E65100;
  font-weight: 700;
}
.vip-price-amount {
  font-size: 44px;
  color: #E65100;
  font-weight: 800;
  line-height: 1;
}
.vip-price-unit {
  font-size: 15px;
  color: #E65100;
  font-weight: 600;
}
.vip-price-desc {
  font-size: 12px;
  color: #8D6E63;
}
.vip-pay-btn {
  margin-top: 18px;
  width: 100%;
  height: 48px;
  border-radius: 24px;
  background: linear-gradient(135deg, #1677FF 0%, #0958D9 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(22,119,255,0.3);
  transition: opacity 0.2s;
}
.vip-pay-btn:disabled {
  opacity: 0.6;
}

/* VIP Benefits */
.vip-benefits {
  margin-top: 24px;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}
.vip-benefits-title {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #333;
  padding: 16px 0 8px;
}
.vip-benefit-row {
  display: flex;
  padding: 8px 16px;
  border-bottom: 1px solid #f0f0f0;
}
.vip-benefit-label {
  flex: 1;
  text-align: center;
  font-size: 13px;
  color: #999;
  font-weight: 600;
}
.vip-benefit-label.vip-label { color: #FF6B35; }
.vip-benefit-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f5f5f5;
}
.vip-benefit-item:last-child { border-bottom: none; }
.vip-benefit-name {
  flex: 1;
  font-size: 13px;
  color: #555;
}
.vip-benefit-free, .vip-benefit-vip {
  width: 60px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}
.vip-benefit-free { color: #C0C4CC; }
.vip-benefit-vip { color: #FF6B35; }
.vip-benefit-free.green { color: #67C23A; }
.vip-benefit-vip.green { color: #67C23A; }
.vip-benefit-free.red { color: #F56C6C; }

/* VIP Pay Status */
.vip-pay-status {
  margin-top: 24px;
  text-align: center;
  background: #fff;
  border-radius: 16px;
  padding: 32px 20px;
}
.vip-pay-loading p {
  margin: 8px 0;
  font-size: 14px;
  color: #666;
}
.vip-pay-hint {
  font-size: 12px !important;
  color: #999 !important;
}
.vip-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #f0f0f0;
  border-top-color: #1677FF;
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: vip-spin 0.8s linear infinite;
}
@keyframes vip-spin {
  to { transform: rotate(360deg); }
}
.vip-pay-link {
  display: inline-block;
  margin-top: 8px;
  color: #1677FF;
  font-size: 14px;
  text-decoration: underline;
}

/* VIP Code Result */
.vip-code-result {
  margin-top: 24px;
  background: #fff;
  border-radius: 16px;
  padding: 32px 20px;
  text-align: center;
  border: 2px solid #67C23A;
}
.vip-code-icon {
  font-size: 48px;
}
.vip-code-title {
  font-size: 20px;
  font-weight: 700;
  color: #333;
  margin-top: 12px;
}
.vip-code-desc {
  font-size: 13px;
  color: #888;
  margin-top: 8px;
  line-height: 1.6;
}
.vip-code-box {
  margin: 20px auto;
  max-width: 280px;
  padding: 16px 24px;
  background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
  border: 2px dashed #1677FF;
  border-radius: 12px;
  font-size: 22px;
  font-weight: 800;
  color: #0958D9;
  letter-spacing: 3px;
  font-family: 'Courier New', monospace;
}
.vip-copy-btn {
  width: 100%;
  height: 44px;
  border-radius: 22px;
  background: #1677FF;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

/* VIP Footer */
.vip-footer-notice {
  margin-top: 24px;
  padding: 16px;
}
.vip-footer-notice p {
  font-size: 11px;
  color: #C0C4CC;
  line-height: 2;
}
