/* ============================================================
   植物大战僵尸主题 — 识字作业打卡工作台 样式表
   ============================================================ */

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --pvz-green: #7cbd6a;
  --pvz-green-dark: #5fae54;
  --pvz-green-light: #a4d98a;
  --pvz-yellow: #ffd93b;
  --pvz-orange: #ff9f1c;
  --pvz-blue: #4dabf7;
  --pvz-red: #ff6b6b;
  --pvz-purple: #9c7cc0;
  --pvz-brown: #c89b6c;
  --pvz-sun: #ffd93b;
  --text-dark: #2d4a2b;
  --text-light: #ffffff;
  --shadow: 0 4px 12px rgba(0,0,0,0.15);
  --radius: 16px;
  --font: "Comic Sans MS", "Microsoft YaHei", "PingFang SC", sans-serif;
}

html, body {
  font-family: var(--font);
  color: var(--text-dark);
  background: linear-gradient(135deg, #a8e6a1 0%, #7cbd6a 50%, #5fae54 100%);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 10px;
}

#app {
  width: 100%;
  max-width: 900px;
  min-height: 100vh;
  position: relative;
}

/* ---------- 屏幕切换 ---------- */
.screen {
  display: none;
  animation: fadeIn 0.3s ease;
}
.screen.active { display: block; }

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

/* ---------- 顶部导航栏 ---------- */
.topbar {
  background: linear-gradient(135deg, var(--pvz-orange), var(--pvz-yellow));
  border-radius: var(--radius);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  position: sticky;
  top: 10px;
  z-index: 50;
}

.topbar .title {
  font-size: 22px;
  font-weight: bold;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar .sun-counter {
  background: rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.sun-icon { font-size: 22px; animation: spin 4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.back-btn {
  background: rgba(255,255,255,0.3);
  border: none;
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 20px;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.back-btn:hover { transform: scale(1.1); }
.back-btn:active { transform: scale(0.9); }

/* ---------- 通用卡片/按钮 ---------- */
.card {
  background: rgba(255,255,255,0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 17px;
  font-weight: bold;
  font-family: var(--font);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 3px 0 rgba(0,0,0,0.2);
}
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 rgba(0,0,0,0.2); }
.btn-primary { background: linear-gradient(135deg, #66d365, #4caf50); color: #fff; }
.btn-orange { background: linear-gradient(135deg, #ffb347, #ff8c00); color: #fff; }
.btn-blue { background: linear-gradient(135deg, #74c0fc, #4dabf7); color: #fff; }
.btn-purple { background: linear-gradient(135deg, #b197fc, #845ef7); color: #fff; }
.btn-grey { background: #adb5bd; color: #fff; }
.btn-block { width: 100%; display: block; }

/* ---------- 首页 ---------- */
.hero {
  background: linear-gradient(135deg, #ffeaa7, #fdcb6e);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.hero h1 {
  font-size: 28px;
  color: #e17055;
  text-shadow: 2px 2px 0 #fff;
  margin-bottom: 6px;
}
.hero .date { font-size: 15px; color: #6b5536; }
.hero .zombie-deco {
  position: absolute;
  right: -10px; bottom: -10px;
  font-size: 60px;
  opacity: 0.3;
  transform: rotate(15deg);
}

/* 进度条 */
.progress-section { text-align: center; }
.progress-label {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
  color: var(--text-dark);
}
.progress-bar {
  background: #e9ecef;
  border-radius: 20px;
  height: 24px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  background: linear-gradient(90deg, #66d365, #ffd93b);
  height: 100%;
  border-radius: 20px;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  color: #2d4a2b;
}

/* 作业清单 */
.section-title {
  font-size: 19px;
  font-weight: bold;
  margin: 6px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dark);
}

.homework-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: #f8f9fa;
  margin-bottom: 10px;
  border: 3px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
}
.homework-item:hover { border-color: var(--pvz-green-light); background: #fff; }
.homework-item .hw-icon {
  font-size: 36px;
  width: 50px; text-align: center;
  margin-right: 12px;
}
.homework-item .hw-info { flex: 1; }
.homework-item .hw-name { font-size: 17px; font-weight: bold; }
.homework-item .hw-desc { font-size: 13px; color: #6c757d; margin-top: 2px; }
.homework-item .hw-status {
  font-size: 26px;
  width: 40px; text-align: center;
}
.homework-item.done { background: #e8f5e9; border-color: #66d365; }
.homework-item.done .hw-name { color: #2e7d32; text-decoration: line-through; }

/* 当前课本提示 */
.current-book {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--text-dark);
}
.current-book .book-badge {
  background: var(--pvz-green);
  color: #fff;
  border-radius: 10px;
  padding: 4px 10px;
  font-weight: bold;
}

/* ---------- 课本选择 ---------- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.book-card {
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  color: #fff;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
  position: relative;
  overflow: hidden;
}
.book-card:hover { transform: translateY(-5px); }
.book-card .book-icon {
  font-size: 48px;
  font-weight: bold;
  margin-bottom: 8px;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}
.book-card .book-name { font-size: 20px; font-weight: bold; }
.book-card .book-sub { font-size: 13px; opacity: 0.9; margin-top: 4px; }
.book-card .book-progress {
  margin-top: 10px;
  font-size: 12px;
  background: rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 3px 8px;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.lesson-card {
  background: rgba(255,255,255,0.95);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s, border 0.2s;
  border: 3px solid transparent;
}
.lesson-card:hover { transform: translateY(-3px); border-color: var(--pvz-yellow); }
.lesson-card.active { border-color: var(--pvz-orange); background: #fff8e1; }
.lesson-card .lesson-title { font-size: 15px; font-weight: bold; color: var(--text-dark); }
.lesson-card .lesson-chars {
  margin-top: 8px;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--pvz-green-dark);
}
.lesson-card .lesson-done {
  margin-top: 6px;
  font-size: 12px;
  color: #2e7d32;
  font-weight: bold;
}
.lesson-card .lesson-done.none { color: #adb5bd; }

/* ---------- 学习模块通用 ---------- */
.module-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.module-icon { font-size: 40px; }
.module-title { font-size: 22px; font-weight: bold; color: var(--text-dark); }
.module-sub { font-size: 14px; color: #6c757d; }

/* 指读识字 */
.char-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.char-card {
  background: linear-gradient(135deg, #fff, #f1f8e9);
  border-radius: 14px;
  padding: 16px 8px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s, border 0.15s;
  position: relative;
}
.char-card:active { transform: scale(0.92); }
.char-card.learned { border-color: #66d365; background: #e8f5e9; }
.char-card .char {
  font-size: 52px;
  font-weight: bold;
  color: var(--text-dark);
  line-height: 1.1;
}
.char-card .pinyin { font-size: 16px; color: #e17055; font-weight: bold; margin-top: 4px; }
.char-card .play-hint {
  position: absolute;
  top: 6px; right: 6px;
  font-size: 18px;
  opacity: 0.6;
}
.char-card .check {
  position: absolute;
  top: 6px; left: 8px;
  font-size: 18px;
  color: #2e7d32;
}

.char-play-all {
  margin-top: 14px;
  text-align: center;
}

/* 听音选字 / 找字闯关 共用选项 */
.quiz-area {
  background: rgba(255,255,255,0.95);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.quiz-prompt { font-size: 16px; color: #6c757d; margin-bottom: 10px; }
.quiz-speaker {
  font-size: 60px;
  cursor: pointer;
  display: inline-block;
  margin: 10px;
  transition: transform 0.15s;
}
.quiz-speaker:hover { transform: scale(1.1); }
.quiz-speaker:active { transform: scale(0.9); }
.quiz-target {
  font-size: 80px;
  font-weight: bold;
  color: var(--pvz-orange);
  margin: 10px;
  text-shadow: 2px 2px 0 #fff;
}
.quiz-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.quiz-option {
  background: linear-gradient(135deg, #fff, #e3f2fd);
  border: 3px solid transparent;
  border-radius: 14px;
  padding: 18px;
  font-size: 44px;
  font-weight: bold;
  color: var(--text-dark);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border 0.15s, background 0.2s;
}
.quiz-option:hover { border-color: var(--pvz-blue); }
.quiz-option:active { transform: scale(0.93); }
.quiz-option.correct {
  background: #c8e6c9;
  border-color: #4caf50;
  animation: pop 0.4s;
}
.quiz-option.wrong {
  background: #ffcdd2;
  border-color: #f44336;
  animation: shake 0.4s;
}
@keyframes pop { 0%{transform:scale(1)} 50%{transform:scale(1.15)} 100%{transform:scale(1)} }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }

.quiz-progress { margin-top: 14px; font-size: 15px; color: #495057; font-weight: bold; }
.round-dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.round-dot { width: 14px; height: 14px; border-radius: 50%; background: #dee2e6; }
.round-dot.done { background: #66d365; }
.round-dot.current { background: var(--pvz-orange); box-shadow: 0 0 0 3px rgba(255,159,28,0.3); }

/* 指读词语 */
.word-card {
  background: linear-gradient(135deg, #fff, #f3e5f5);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s, border 0.15s;
}
.word-card:active { transform: scale(0.97); }
.word-card.read { border-color: var(--pvz-purple); background: #f3e5f5; }
.word-card .word { font-size: 38px; font-weight: bold; color: var(--text-dark); }
.word-card .word-py { font-size: 15px; color: #9c7cc0; }
.word-card .word-play { font-size: 30px; margin-left: auto; }
.word-card .word-check { font-size: 24px; color: #9c7cc0; }

/* 笔画练习 */
.stroke-area {
  background: rgba(255,255,255,0.95);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stroke-demo {
  font-size: 120px;
  font-weight: bold;
  color: var(--pvz-blue);
  margin: 10px;
  user-select: none;
}
.stroke-demo.animating {
  background: linear-gradient(120deg, var(--pvz-blue) 0%, var(--pvz-blue) 50%, #e3f2fd 50%, #e3f2fd 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: strokeReveal 2s ease forwards;
}
@keyframes strokeReveal {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
.canvas-wrap {
  position: relative;
  display: inline-block;
  margin: 10px auto;
}
#traceCanvas {
  border: 3px dashed var(--pvz-green-light);
  border-radius: 12px;
  background: #fafafa;
  touch-action: none;
  cursor: crosshair;
}
.trace-guide {
  position: absolute;
  top: 0; left: 0;
  font-size: 200px;
  font-weight: bold;
  color: rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  pointer-events: none;
  user-select: none;
}
.stroke-controls { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.stroke-char-label { font-size: 18px; font-weight: bold; color: #495057; margin: 8px 0; }

/* ---------- 花园 ---------- */
.garden-wrap {
  background: linear-gradient(180deg, #87ceeb 0%, #87ceeb 20%, #7cbd6a 20%);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.garden-sky {
  text-align: center;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
  margin-bottom: 10px;
}
.garden-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(5, 36px);
  gap: 4px;
  background: #5fae54;
  padding: 6px;
  border-radius: 10px;
  position: relative;
}
.garden-cell {
  min-height: 36px;
  background: var(--pvz-green);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.1);
  font-size: 30px;
  transition: background 0.3s;
}
.garden-cell:nth-child(even) { background: var(--pvz-green-dark); }
.garden-cell.occupied { animation: plantPop 0.5s; }
#zombieLayer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 40;
}
@keyframes plantPop {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.plant-svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}

/* 僵尸 */
.zombie {
  position: absolute;
  top: 0;
  font-size: 32px;
  z-index: 30;
  transition: left 0.4s linear;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.3));
}
.zombie-walking { animation: zombieWalk 0.6s infinite; }
@keyframes zombieWalk {
  0%,100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-3px) rotate(3deg); }
}

/* 花园信息条 */
.garden-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0;
  flex-wrap: wrap;
  gap: 8px;
}
.garden-stat {
  background: rgba(255,255,255,0.95);
  border-radius: 12px;
  padding: 8px 14px;
  font-weight: bold;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 6px;
}
.zombie-warning {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #856404;
  display: flex;
  align-items: center;
  gap: 8px;
}
.plant-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  background: rgba(255,255,255,0.9);
  border-radius: 8px;
  padding: 3px 8px;
}

/* ---------- 完成弹窗 ---------- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.3s; }
.modal-box {
  background: #fff;
  border-radius: 20px;
  padding: 30px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  animation: modalPop 0.4s;
}
@keyframes modalPop {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.modal-box .modal-plant { font-size: 80px; margin-bottom: 10px; }
.modal-box h2 { font-size: 24px; color: var(--text-dark); margin-bottom: 8px; }
.modal-box p { font-size: 16px; color: #6c757d; margin-bottom: 20px; }
.modal-sun {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff9db;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 20px;
  font-weight: bold;
  color: #f59f00;
  margin-bottom: 20px;
}

/* 阳光飘字 */
.sun-float {
  position: fixed;
  font-size: 28px;
  font-weight: bold;
  color: #f59f00;
  pointer-events: none;
  z-index: 300;
  animation: floatUp 1.2s ease-out forwards;
  text-shadow: 0 0 8px rgba(255,217,59,0.8);
}
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(0.5); }
  20% { opacity: 1; transform: translateY(-10px) scale(1.2); }
  100% { opacity: 0; transform: translateY(-80px) scale(1); }
}

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 900px;
  display: flex;
  background: rgba(255,255,255,0.97);
  box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
  z-index: 100;
  border-radius: 20px 20px 0 0;
}
.bottom-nav .nav-item {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  cursor: pointer;
  font-size: 12px;
  color: #6c757d;
  transition: color 0.2s;
  position: relative;
}
.bottom-nav .nav-item.active { color: var(--pvz-green-dark); font-weight: bold; }
.bottom-nav .nav-item .nav-icon { font-size: 24px; display: block; margin-bottom: 2px; }
.bottom-nav .nav-item .nav-badge {
  position: absolute;
  top: 4px; right: 50%;
  transform: translateX(18px);
  background: var(--pvz-red);
  color: #fff;
  font-size: 10px;
  border-radius: 10px;
  padding: 1px 5px;
  font-weight: bold;
}

/* 内容区底部留白（给导航栏） */
.content-spacer { height: 70px; }

/* 提示文字 */
.hint { font-size: 13px; color: #868e96; text-align: center; margin-top: 8px; }

/* 弹窗顶部关闭 */
.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  font-size: 24px;
  cursor: pointer;
  color: #adb5bd;
}

/* 响应式 */
@media (max-width: 480px) {
  .char-grid { grid-template-columns: repeat(2, 1fr); }
  .quiz-grid { grid-template-columns: repeat(2, 1fr); }
  .book-grid { grid-template-columns: repeat(2, 1fr); }
  .garden-cell { font-size: 22px; }
  .stroke-demo { font-size: 90px; }
  .topbar .title { font-size: 18px; }
}

/* 飘落的植物小动画（空花园装饰） */
.empty-garden-hint {
  text-align: center;
  font-size: 15px;
  color: #fff;
  background: rgba(0,0,0,0.15);
  border-radius: 12px;
  padding: 14px;
  margin-top: 12px;
}
