/* styles.css - 拼音乐园（儿童友好风格：明亮渐变、大圆角、大按钮） */
:root {
  --c-pink: #FF6B9D;
  --c-blue: #4FACFE;
  --c-green: #43E97B;
  --c-yellow: #FFD93D;
  --c-purple: #A18CD1;
  --bg: #FFF9F0;
  --text: #4A4A68;
  --radius: 20px;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

/* Header */
.header {
  text-align: center;
  padding: 28px 16px 16px;
  background: linear-gradient(135deg, #FFE5EC 0%, #E0F4FF 100%);
  border-radius: 0 0 32px 32px;
}
.header h1 {
  font-size: 30px;
  background: linear-gradient(135deg, #FF6B9D, #4FACFE);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle { font-size: 14px; color: #9B9BB5; margin-top: 6px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  padding: 16px;
  justify-content: center;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 249, 240, 0.95);
  backdrop-filter: blur(8px);
}
.tab {
  padding: 10px 22px;
  border: none;
  border-radius: 22px;
  font-size: 16px;
  font-weight: 600;
  background: #fff;
  color: #9B9BB5;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.tab:active { transform: scale(0.94); }
.tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--c-pink), #FF8FB3);
}
.tab[data-tab="yun"].active { background: linear-gradient(135deg, var(--c-blue), #6BC5FF); }
.tab[data-tab="zhengti"].active { background: linear-gradient(135deg, var(--c-green), #6BF5A0); }
.tab[data-tab="tones"].active { background: linear-gradient(135deg, var(--c-purple), #C0A8F0); }

/* Card grid */
.content { max-width: 900px; margin: 0 auto; padding: 8px 16px; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.pcard {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  border: 3px solid transparent;
  transition: all 0.2s;
  user-select: none;
}
.pcard:active { transform: scale(0.95); }
.pcard.playing { border-color: var(--c-yellow); background: #FFFBEA; }
.pcard img {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  background: #F5F5FA;
}
.pcard .py { font-size: 30px; font-weight: 700; margin: 6px 0 2px; color: var(--text); }
.pcard .mn { font-size: 13px; color: #9B9BB5; }
.pcard .practice-link {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 14px;
  font-size: 13px;
  border-radius: 14px;
  background: #FFF0F5;
  color: var(--c-pink);
  font-weight: 600;
}

/* 四声练习 */
.tones-panel { padding-top: 4px; }
.search-row { margin-bottom: 14px; text-align: center; }
#tone-search {
  width: 100%;
  max-width: 380px;
  padding: 12px 20px;
  border: 3px solid #EFE4FF;
  border-radius: 24px;
  font-size: 16px;
  outline: none;
  background: #fff;
}
#tone-search:focus { border-color: var(--c-purple); }
.syllable-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}
.syl-card {
  background: #fff;
  border-radius: 16px;
  padding: 12px 6px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-size: 20px;
  font-weight: 700;
  user-select: none;
  transition: transform 0.15s;
}
.syl-card:active { transform: scale(0.94); }
.syl-card .tone-row {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 8px;
}
.tone-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  transition: transform 0.15s;
}
.tone-btn:active { transform: scale(0.85); }
.tone-btn[data-tone="1"] { background: #FF6B9D; }
.tone-btn[data-tone="2"] { background: #4FACFE; }
.tone-btn[data-tone="3"] { background: #43B97B; }
.tone-btn[data-tone="4"] { background: #A18CD1; }
.tone-btn.playing { box-shadow: 0 0 0 4px rgba(255, 217, 61, 0.6); }

/* 跟读评测浮层 */
.practice-sheet {
  position: fixed;
  inset: 0;
  background: rgba(74, 74, 104, 0.45);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-inner {
  background: #fff;
  border-radius: 28px 28px 0 0;
  width: 100%;
  max-width: 560px;
  padding: 28px 24px 40px;
  text-align: center;
  position: relative;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { transform: translateY(60px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: #F5F5FA;
  color: #9B9BB5;
  font-size: 16px;
  cursor: pointer;
}
.sheet-pinyin { font-size: 64px; font-weight: 800; color: var(--text); }
.sheet-word { font-size: 16px; color: #9B9BB5; margin: 4px 0 20px; }
.sheet-actions { display: flex; gap: 14px; justify-content: center; }
.btn {
  padding: 14px 30px;
  border: none;
  border-radius: 26px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s;
}
.btn:active { transform: scale(0.94); }
.btn-listen { background: linear-gradient(135deg, var(--c-blue), #6BC5FF); }
.btn-record { background: linear-gradient(135deg, var(--c-pink), #FF8FB3); }
.btn-record.recording {
  background: linear-gradient(135deg, #FF4757, #FF6B81);
  animation: pulse 1s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(255, 71, 87, 0); }
}
.record-hint { margin-top: 14px; font-size: 14px; color: #9B9BB5; min-height: 20px; }

/* 评分 */
.score-panel { margin-top: 18px; }
.score-big {
  font-size: 56px;
  font-weight: 800;
  background: linear-gradient(135deg, #FFB800, #FF8A00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.score-stars { font-size: 28px; letter-spacing: 4px; margin: 4px 0 10px; }
.score-detail { font-size: 14px; color: #9B9BB5; line-height: 1.8; }

.footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 12px;
  color: #C5C5D5;
}

/* ==================== 多页应用新增组件 ==================== */

/* 返回首页链接 */
.back-link {
  position: absolute;
  left: 16px;
  top: 16px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: #9B9BB5;
  background: rgba(255,255,255,0.8);
  padding: 6px 14px;
  border-radius: 16px;
}
.header { position: relative; }

/* 通用小按钮 */
.mini-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 600;
  background: #F0F0F8;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s;
}
.mini-btn:active { transform: scale(0.94); }
.mini-btn.primary {
  background: linear-gradient(135deg, var(--c-pink), #FF8FB3);
  color: #fff;
}

/* 今日计划（SRS） */
.plan-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.stat-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px 6px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card .num { font-size: 22px; font-weight: 800; color: var(--c-pink); }
.stat-card .lbl { font-size: 12px; color: #9B9BB5; margin-top: 4px; }
.plan-start { width: 100%; margin-bottom: 16px; }
.plan-list { display: flex; flex-wrap: wrap; gap: 8px; }
.plan-chip {
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
}
.chip-new { background: #FFE5EC; color: var(--c-pink); }
.chip-review { background: #E0F4FF; color: #2A7FC9; }
.plan-empty {
  text-align: center;
  padding: 40px 16px;
  color: #9B9BB5;
  font-size: 16px;
}

/* 描红画板 */
.btn-write { background: linear-gradient(135deg, #43E97B, #6BF5A0); }
.write-panel { margin-top: 16px; }
#trace-canvas {
  border-radius: 16px;
  background: #FFFDF8;
  box-shadow: inset 0 0 0 2px #F0E0E8;
  touch-action: none;
  max-width: 100%;
}
.write-actions { display: flex; gap: 10px; justify-content: center; margin-top: 10px; }
.write-score { margin-top: 8px; font-size: 14px; color: #FF8A00; font-weight: 600; min-height: 20px; }

/* SRS 操作区 */
.srs-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 2px dashed #F0F0F5;
}

/* 课程列表 */
.course-list { display: flex; flex-direction: column; gap: 12px; }
.course-card {
  background: #fff;
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.15s;
}
.course-card:active { transform: scale(0.98); }
.course-info h3 { font-size: 17px; margin-bottom: 4px; }
.course-info p { font-size: 13px; color: #9B9BB5; }
.course-meta { text-align: right; flex-shrink: 0; }
.course-avg { font-size: 22px; font-weight: 800; color: #FF8A00; }
.course-done { font-size: 12px; color: #9B9BB5; margin-top: 2px; }

/* 句子练习 */
.course-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.course-title-label { font-size: 15px; font-weight: 600; color: #9B9BB5; }
.sentence-card {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.sentence-progress { font-size: 13px; color: #C5C5D5; margin-bottom: 12px; }
.sentence-en { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1.4; }
.sentence-cn { font-size: 15px; color: #9B9BB5; margin: 8px 0 18px; }
.sentence-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 2px dashed #F0F0F5;
}

/* 逐词打分 */
.word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 12px;
}
.word-chip {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
}
.word-good { background: #D9F7E8; color: #1B9E5A; }
.word-mid { background: #FFF4D4; color: #C08A00; }
.word-bad { background: #FFE0E0; color: #E04848; }

/* 翻译输入 */
.translate-input {
  width: 100%;
  padding: 14px 16px;
  border: 3px solid #E0F0E8;
  border-radius: 16px;
  font-size: 16px;
  outline: none;
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
  box-sizing: border-box;
}
.translate-input:focus { border-color: var(--c-green); }
.answer-row {
  margin-top: 14px;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* 区块标题 */
.section-title { font-size: 18px; margin: 22px 0 12px; color: var(--text); }

@media (max-width: 480px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .pcard .py { font-size: 24px; }
  .sheet-pinyin { font-size: 48px; }
  .plan-stats { grid-template-columns: repeat(2, 1fr); }
  .sentence-en { font-size: 21px; }
}
