/* ========================================================================
 * 奇妙萌可自主学习工作台 —— 全局样式
 * 淡蓝色背景 / 萌可主题 / 大字体 / 手机端适配
 * ====================================================================== */

:root {
  --bg-main: #E6F2FF;          /* 柔和淡蓝底 */
  --bg-soft: #F0F7FF;          /* 更浅的蓝 */
  --bg-card: #FFFFFF;
  --primary: #4A9DFF;          /* 主蓝 */
  --primary-dark: #2E7FE0;
  --primary-light: #A8D0FF;
  --accent-pink: #FF9EC4;      /* 萌可粉 */
  --accent-yellow: #FFD93D;    /* 光之积分黄 */
  --accent-green: #7DD87D;     /* 完成绿 */
  --accent-purple: #C8A8FF;
  --text-main: #2C3E50;
  --text-soft: #6B7C93;
  --text-light: #9AAFC4;
  --shadow: 0 4px 12px rgba(74, 157, 255, 0.12);
  --shadow-hover: 0 6px 20px rgba(74, 157, 255, 0.2);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-width: 230px;
}

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

html, body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 18px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

/* ===== 左侧固定导航栏 ===== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--nav-width);
  height: 100vh;
  background: linear-gradient(180deg, #B8DCFF 0%, #D6EBFF 100%);
  border-right: 2px solid var(--primary-light);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-header {
  text-align: center;
  padding: 20px 12px 16px;
  border-bottom: 2px dashed var(--primary-light);
}

.sidebar-logo {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 4px;
}

.sidebar-logo .emoji {
  font-size: 30px;
}

.sidebar-subtitle {
  font-size: 13px;
  color: var(--text-soft);
}

.nav-menu {
  flex: 1;
  padding: 12px 10px;
  list-style: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.2s;
  border: 2px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.6);
}

.nav-item.active {
  background: #fff;
  border-color: var(--primary);
  color: var(--primary-dark);
  box-shadow: var(--shadow);
}

.nav-item .nav-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent-pink);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
}

.nav-item.completed .nav-badge {
  background: var(--accent-green);
}

.sidebar-footer {
  padding: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--text-soft);
  border-top: 2px dashed var(--primary-light);
}

/* ===== 主内容区 ===== */
.main-content {
  margin-left: var(--nav-width);
  padding: 20px 28px 40px;
  min-height: 100vh;
}

/* 顶部状态栏 */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 2px solid var(--primary-light);
  color: var(--primary-dark);
  font-size: 16px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-back:hover {
  background: var(--primary);
  color: #fff;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
}

.top-bar-right {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 16px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.stat-pill .stat-icon { font-size: 20px; }
.stat-pill.points { color: #E6A700; }
.stat-pill.progress { color: var(--primary-dark); }
.stat-pill.streak { color: #E8555A; }

/* ===== 卡片通用 ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== 鼓励话术条 ===== */
.encourage-banner {
  background: linear-gradient(135deg, #FFF9E0 0%, #FFE8B0 100%);
  border: 2px solid var(--accent-yellow);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: #8B6914;
}

/* ===== 任务卡片 ===== */
.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.task-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 3px solid transparent;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.task-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.task-card.done {
  border-color: var(--accent-green);
  background: linear-gradient(135deg, #F0FFF0 0%, #E0FFE0 100%);
}

.task-card.done::after {
  content: '✓ 已完成';
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent-green);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 10px;
}

.task-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.task-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.task-desc {
  font-size: 15px;
  color: var(--text-soft);
  margin-bottom: 12px;
}

.task-points {
  display: inline-block;
  background: #FFF4D0;
  color: #B8860B;
  font-size: 14px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 700;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-pink {
  background: var(--accent-pink);
  color: #fff;
}

.btn-green {
  background: var(--accent-green);
  color: #fff;
}

.btn-yellow {
  background: var(--accent-yellow);
  color: #6B4500;
}

.btn:disabled {
  background: #CCC !important;
  color: #888 !important;
  cursor: not-allowed;
}

.btn-small {
  font-size: 14px;
  padding: 6px 14px;
}

/* ===== 进度条 ===== */
.progress-bar-wrap {
  background: #E0E8F0;
  border-radius: 20px;
  height: 24px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), #5CB85C);
  border-radius: 20px;
  transition: width 0.5s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  min-width: 30px;
}

/* ===== 古诗/课文展示 ===== */
.poem-block {
  background: linear-gradient(135deg, #FFFEF8 0%, #FFF8E0 100%);
  border: 2px solid var(--accent-yellow);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
  text-align: center;
}

.poem-title {
  font-size: 24px;
  font-weight: 800;
  color: #8B6914;
  margin-bottom: 4px;
}

.poem-author {
  font-size: 15px;
  color: #B8860B;
  margin-bottom: 16px;
}

.poem-content {
  font-size: 24px;
  line-height: 2.2;
  color: var(--text-main);
  font-weight: 600;
  white-space: pre-line;
  letter-spacing: 2px;
}

.word-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}

.word-tag {
  background: #fff;
  border: 1px solid var(--primary-light);
  color: var(--primary-dark);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
}

/* ===== 生字字帖 ===== */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.char-card {
  background: #fff;
  border: 2px solid var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.char-card:hover {
  border-color: var(--primary);
  transform: scale(1.03);
}

.char-big {
  font-size: 56px;
  font-weight: 800;
  color: var(--text-main);
  font-family: "KaiTi", "STKaiti", serif;
  line-height: 1.2;
}

.char-pinyin {
  font-size: 18px;
  color: var(--primary-dark);
  font-weight: 600;
  margin-bottom: 8px;
}

.char-strokes {
  font-size: 14px;
  color: var(--text-soft);
  margin: 8px 0;
}

.tianzige {
  display: inline-grid;
  grid-template-columns: repeat(4, 60px);
  gap: 4px;
  margin-top: 12px;
  justify-content: center;
}

.tianzige-cell {
  width: 60px;
  height: 60px;
  border: 1px dashed #BBB;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 36px;
  color: #DDD;
  background: #FAFAFA;
}

/* ===== 听写模块 ===== */
.dictation-area {
  text-align: center;
  padding: 20px 0;
}

.dictation-status {
  font-size: 20px;
  color: var(--primary-dark);
  font-weight: 700;
  margin: 16px 0;
}

.dictation-current {
  font-size: 80px;
  font-weight: 800;
  color: var(--accent-pink);
  margin: 20px 0;
  font-family: "KaiTi", "STKaiti", serif;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dictation-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 20px 0;
}

.dictation-answer {
  background: #FFF9E0;
  border: 2px solid var(--accent-yellow);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
}

.dictation-answer-title {
  font-size: 18px;
  font-weight: 700;
  color: #8B6914;
  margin-bottom: 10px;
}

.dictation-answer-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  font-size: 28px;
  font-family: "KaiTi", "STKaiti", serif;
}

/* ===== 背诵闯关 ===== */
.recite-segment {
  background: #F0F7FF;
  border-left: 4px solid var(--primary);
  padding: 16px 20px;
  margin-bottom: 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 22px;
  font-weight: 600;
}

.recite-segment.done {
  background: #F0FFF0;
  border-left-color: var(--accent-green);
}

/* ===== 选择题通用 ===== */
.quiz-question {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.quiz-option {
  background: #F5F9FF;
  border: 2px solid var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.quiz-option:hover {
  border-color: var(--primary);
  background: #E6F2FF;
}

.quiz-option.correct {
  background: #D4EDDA;
  border-color: var(--accent-green);
  color: #155724;
}

.quiz-option.wrong {
  background: #F8D7DA;
  border-color: #DC3545;
  color: #721C24;
}

.quiz-explain {
  background: #FFF9E0;
  border: 2px solid var(--accent-yellow);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-top: 12px;
  font-size: 16px;
  color: #8B6914;
}

/* ===== 英语单词卡片 ===== */
.en-word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.en-word-card {
  background: linear-gradient(135deg, #E6F2FF 0%, #F0E6FF 100%);
  border: 2px solid var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.en-word-card:hover {
  transform: scale(1.05);
}

.en-emoji { font-size: 36px; }
.en-word { font-size: 20px; font-weight: 700; color: var(--primary-dark); }
.en-cn { font-size: 15px; color: var(--text-soft); }

/* ===== 商店 ===== */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.shop-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 3px solid var(--primary-light);
  transition: all 0.2s;
}

.shop-card:hover {
  border-color: var(--accent-pink);
  transform: translateY(-3px);
}

.shop-icon { font-size: 48px; margin-bottom: 8px; }
.shop-name { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.shop-cost {
  display: inline-block;
  background: #FFF4D0;
  color: #B8860B;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
}

/* ===== 弹窗 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 32px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  animation: modalPop 0.3s;
}

@keyframes modalPop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-pink);
  margin-bottom: 12px;
}

.modal-text {
  font-size: 18px;
  color: var(--text-main);
  margin-bottom: 20px;
}

/* ===== 移动端汉堡按钮 ===== */
.menu-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 101;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.overlay-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

.overlay-mask.show {
  display: block;
}

/* ===== 响应式：手机端适配 ===== */
@media (max-width: 768px) {
  :root { --nav-width: 250px; }

  .sidebar {
    transform: translateX(-100%);
    width: 250px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-content {
    margin-left: 0;
    padding: 70px 16px 40px;
  }

  .top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .top-bar-right {
    justify-content: space-around;
  }

  .stat-pill {
    font-size: 14px;
    padding: 6px 10px;
    flex: 1;
    justify-content: center;
  }

  .page-title {
    font-size: 22px;
  }

  .poem-content {
    font-size: 20px;
  }

  .char-big {
    font-size: 44px;
  }

  .dictation-current {
    font-size: 60px;
  }

  .card {
    padding: 16px;
  }

  .task-grid {
    grid-template-columns: 1fr;
  }

  .quiz-options {
    grid-template-columns: 1fr;
  }

  .tianzige {
    grid-template-columns: repeat(3, 50px);
  }
  .tianzige-cell {
    width: 50px;
    height: 50px;
    font-size: 30px;
  }
}
