/* 湘少版三上英语学习网站 - 全局样式 */
:root {
  --primary: #4A90D9;
  --accent: #FFB800;
  --success: #52C41A;
  --error: #FF4D4F;
  --bg: #F5F7FA;
  --text: #2C3E50;
  --text-light: #7F8C9B;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.en {
  font-family: "Comic Sans MS", "Chalkboard SE", "Marker Felt", cursive;
}

/* ===== 顶部栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  gap: 8px;
}
.topbar h1 { font-size: 18px; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.coin-chip {
  background: #FFF7E0;
  border: 1px solid #FFE396;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 15px;
  color: #B8860B;
  white-space: nowrap;
}

.lottery-btn {
  position: relative;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
}
.lottery-btn .badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--error);
  color: #fff;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  border-radius: 999px;
  text-align: center;
  display: none;
}
.lottery-btn.has-ticket { animation: blink 1s infinite; }
@keyframes blink { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 184, 0, 0.6); } 50% { box-shadow: 0 0 0 8px rgba(255, 184, 0, 0); } }

/* ===== 主容器 ===== */
.container { max-width: 960px; margin: 0 auto; padding: 16px; }

/* ===== 首页单元卡片 ===== */
.unit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.unit-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 16px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid transparent;
  display: block;
  text-decoration: none;
  color: inherit;
}
.unit-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(74, 144, 217, 0.18); border-color: var(--primary); }
.unit-card .unit-no {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  margin-bottom: 6px;
}
.unit-card h3 { font-size: 16px; margin-bottom: 8px; color: var(--text); }
.unit-card .progress-bar { height: 8px; background: #EDF1F5; border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.unit-card .progress-fill { height: 100%; background: linear-gradient(90deg, var(--success), #7ED957); border-radius: 4px; transition: width 0.4s; }
.unit-card .progress-text { font-size: 12px; color: var(--text-light); }
.unit-card .status-icons { font-size: 14px; margin-top: 6px; letter-spacing: 2px; }

/* ===== 统计区 ===== */
.stats-bar {
  margin-top: 20px;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  display: flex;
  justify-content: space-around;
  padding: 14px 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.stats-bar .stat { text-align: center; min-width: 90px; }
.stats-bar .stat .num { font-size: 20px; font-weight: 800; color: var(--primary); }
.stats-bar .stat .label { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ===== 单元页 Tabs ===== */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-btn {
  flex: 1;
  min-height: 44px;
  border: 2px solid #E3EAF2;
  background: #fff;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== 单词卡片（预习） ===== */
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.word-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s;
  border: 2px solid transparent;
  min-height: 44px;
}
.word-card:hover { transform: translateY(-2px); }
.word-card.visited { border-color: #B8E6A0; background: #F6FCF2; }
.word-card .w-en { font-size: 18px; font-weight: 700; color: var(--primary); }
.word-card .w-zh { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.word-card .w-icon { font-size: 16px; margin-top: 4px; opacity: 0.7; }

.letter-group-title {
  margin: 18px 0 8px;
  font-size: 14px;
  color: var(--text-light);
  font-weight: 700;
}
.letter-group-title .ltr {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 1px 8px;
  margin-right: 6px;
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  animation: pop 0.2s ease-out;
}
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal .m-en { font-size: 30px; font-weight: 800; color: var(--primary); }
.modal .m-phonetic { color: var(--text-light); font-size: 15px; margin: 4px 0 10px; }
.modal .m-zh { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.modal .m-sentence { font-size: 14px; color: var(--text-light); background: var(--bg); border-radius: 10px; padding: 10px; margin-bottom: 14px; }
.modal .speak-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 22px;
  font-size: 16px;
  cursor: pointer;
  min-height: 44px;
}
.modal .close-btn { display: block; margin: 12px auto 0; background: none; border: none; color: var(--text-light); cursor: pointer; font-size: 14px; min-height: 44px; }

/* ===== 复习模块 ===== */
.section-title { font-size: 15px; font-weight: 700; margin: 18px 0 10px; color: var(--text); }
.section-title:first-child { margin-top: 0; }

.wrong-list { display: flex; flex-direction: column; gap: 8px; }
.wrong-item {
  background: #fff;
  border-left: 4px solid var(--error);
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.wrong-item .wi-en { font-weight: 700; color: var(--text); flex: 1; }
.wrong-item .wi-date { font-size: 11px; color: var(--text-light); }
.icon-btn {
  background: #EDF4FB;
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.empty-tip { color: var(--text-light); font-size: 13px; padding: 12px; text-align: center; background: #fff; border-radius: 10px; }

.overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.state-chip {
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.state-chip .s-zh { font-size: 10px; font-weight: 400; margin-top: 2px; opacity: 0.8; }
.state-mastered { background: #E8F7DF; color: #2E7D0F; border: 1.5px solid var(--success); }
.state-wrong { background: #FFF4E5; color: #B26A00; border: 1.5px solid var(--accent); }
.state-new { background: #EDF1F5; color: var(--text-light); border: 1.5px solid #D8E0E8; }

.listen-practice {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 20px;
  text-align: center;
}
.listen-practice .big-speaker {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 30px;
  border: none;
  cursor: pointer;
  margin: 10px auto;
  display: block;
}
.option-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.option-btn {
  min-height: 52px;
  border: 2px solid #E3EAF2;
  background: #FAFCFE;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.option-btn:hover { border-color: var(--primary); }
.option-btn.correct { background: #E8F7DF; border-color: var(--success); color: var(--success); }
.option-btn.wrong { background: #FFEDED; border-color: var(--error); color: var(--error); animation: shake 0.4s; }
.option-btn:disabled { cursor: default; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ===== 闯关页 ===== */
.quiz-box {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: 24px 18px;
  text-align: center;
}
.quiz-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.quiz-progress .p-bar { flex: 1; height: 10px; background: #EDF1F5; border-radius: 5px; overflow: hidden; }
.quiz-progress .p-fill { height: 100%; background: var(--primary); border-radius: 5px; transition: width 0.3s; }
.quiz-progress .p-text { font-size: 13px; color: var(--text-light); white-space: nowrap; }

.q-type-tag {
  display: inline-block;
  background: #EDF4FB;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  padding: 3px 10px;
  margin-bottom: 10px;
}
.q-prompt { font-size: 34px; font-weight: 800; color: var(--text); margin: 10px 0 4px; }
.q-sub { font-size: 13px; color: var(--text-light); margin-bottom: 14px; }

.feedback { min-height: 30px; margin-top: 12px; font-size: 15px; font-weight: 700; }
.feedback.ok { color: var(--success); }
.feedback.no { color: var(--error); }

.streak-fire { position: fixed; pointer-events: none; font-size: 28px; z-index: 90; animation: fireUp 1s ease-out forwards; }
@keyframes fireUp {
  0% { transform: translateY(0) scale(0.8); opacity: 1; }
  100% { transform: translateY(-120px) scale(1.4); opacity: 0; }
}

.flash-ok { animation: flashOk 0.5s; }
@keyframes flashOk { 0% { background: #E8F7DF; } 100% { background: #fff; } }

/* 结果页 */
.result-score { font-size: 56px; font-weight: 800; color: var(--primary); }
.result-coins { font-size: 22px; font-weight: 800; color: #B8860B; margin: 10px 0; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 26px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  margin: 6px;
  text-decoration: none;
  display: inline-block;
}
.btn-secondary {
  background: #fff;
  color: var(--primary);
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 10px 24px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  margin: 6px;
  text-decoration: none;
  display: inline-block;
}
.btn-warn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-height: 44px;
  margin: 6px;
}

/* ===== 抽奖页 ===== */
.wheel-wrap { position: relative; width: 300px; height: 300px; margin: 20px auto; }
.wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 8px solid var(--accent);
  box-shadow: 0 4px 20px rgba(255, 184, 0, 0.35), inset 0 0 0 4px #fff;
  position: relative;
  transition: transform 4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.wheel-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: 0 0;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
.wheel-pointer {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 36px;
  z-index: 10;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}
.spin-btn {
  display: block;
  margin: 0 auto;
  background: var(--error);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px 40px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 77, 79, 0.4);
}
.spin-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ticket-info { text-align: center; font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }

.history-list { margin-top: 20px; }
.history-item {
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 10px 14px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.history-item .h-prize { font-weight: 700; color: var(--primary); }

.badge-wall { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.badge-chip {
  background: #F6F0FF;
  border: 1.5px solid #D5C4F5;
  color: #6B3FA0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
}

/* ===== 飘字与金币动画 ===== */
.coin-fly {
  position: fixed;
  z-index: 200;
  font-size: 26px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.reward-toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translate(-50%, -20px);
  background: rgba(44, 62, 80, 0.9);
  color: #FFD700;
  font-size: 15px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 999px;
  z-index: 210;
  opacity: 0;
  transition: all 0.4s;
  pointer-events: none;
}
.reward-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ===== 页脚 ===== */
.footer { text-align: center; font-size: 12px; color: var(--text-light); padding: 24px 0 16px; }

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  .unit-grid { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 15px; }
  .q-prompt { font-size: 28px; }
  .wheel-wrap { width: 260px; height: 260px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
