/* ===== 纠音朗读平台 · 设计系统（暖色、童趣、精致）===== */
:root {
  --bg:        #FBF7F0;   /* 暖奶油背景 */
  --bg-tint:   #F3ECE0;
  --surface:   #FFFFFF;
  --ink:       #2B2724;   /* 暖墨色 */
  --muted:     #8A817C;
  --line:      #ECE3D6;

  --primary:   #FF7A59;   /* 珊瑚 */
  --primary-d: #F4613D;
  --teal:      #2DB5A8;
  --green:     #34B27B;
  --amber:     #FFB020;
  --danger:    #E5484D;

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 10px;
  --shadow:    0 6px 22px rgba(60, 40, 20, .08);
  --shadow-lg: 0 14px 40px rgba(60, 40, 20, .14);
  --font: "Nunito", "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 90% -10%, #FFE9DF 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 0%, #DFF5F1 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 26px;
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--amber)); box-shadow: 0 0 0 4px #FFE3D8; }
.topbar nav { display: flex; gap: 8px; align-items: center; }

/* ---------- 容器 ---------- */
.wrap { max-width: 1180px; margin: 28px auto; padding: 0 22px; }
.page-title { font-size: 28px; font-weight: 800; margin: 6px 0 2px; letter-spacing: -.5px; }
.page-sub { color: var(--muted); margin: 0 0 22px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; cursor: pointer; font-family: inherit; font-weight: 700;
  font-size: 15px; padding: 11px 18px; border-radius: 999px;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
  color: #fff; background: var(--primary);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(255,122,89,.35); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }
.btn.ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn.ghost:hover { box-shadow: var(--shadow); border-color: #DCD2C4; }
.btn.teal { background: var(--teal); } .btn.teal:hover { box-shadow: 0 8px 18px rgba(45,181,168,.35); }
.btn.amber { background: var(--amber); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 8px 14px; font-size: 14px; }
.btn.rec.recording { background: var(--danger); animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(229,72,77,.5); } 50% { box-shadow: 0 0 0 10px rgba(229,72,77,0); } }

/* ---------- 表单 ---------- */
input, textarea, select {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line);
  border-radius: var(--r-sm); font-size: 15px; font-family: inherit;
  background: #fff; margin: 6px 0; color: var(--ink); transition: border .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag.new   { background: #E3F6EE; color: #1B7A53; }
.tag.review{ background: #FFF1D6; color: #9A6B00; }
.tag.ready { background: #E3F6EE; color: #1B7A53; }
.tag.generating { background: #E8F5F4; color: #177B72; }
.tag.failed { background: #FFE7E7; color: #B3262D; }

/* ---------- 统计条 ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px 18px; box-shadow: var(--shadow); }
.stat .n { font-size: 30px; font-weight: 800; line-height: 1; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 6px; }
.stat.good .n { color: var(--green); } .stat.bad .n { color: var(--danger); }
.stat.blue .n { color: var(--teal); }

/* ---------- 日期文件夹 ---------- */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 16px; }
.folder { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 20px; text-align: center; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .14s, box-shadow .2s; }
.folder:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.folder .ico { font-size: 34px; }
.folder .d { font-weight: 800; margin-top: 6px; }

/* ---------- 教师任务控制台 ---------- */
.task-list { display: grid; gap: 10px; }
.task-row {
  display: grid; grid-template-columns: 120px minmax(0, 1fr) 72px auto; gap: 16px;
  align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface);
}
.task-date { font-weight: 800; }
.task-main { min-width: 0; }
.task-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; color: var(--muted); font-size: 13px; }
.task-score { color: var(--teal); font-size: 22px; font-weight: 800; text-align: right; }
.task-actions { display: flex; gap: 8px; justify-content: flex-end; }
.task-error { color: var(--danger); font-size: 12px; margin-top: 6px; }
@media (max-width: 640px) {
  .task-row { grid-template-columns: 1fr auto; gap: 10px; }
  .task-main { grid-column: 1 / -1; grid-row: 2; }
  .task-score { grid-column: 1; grid-row: 3; text-align: left; }
  .task-actions { grid-column: 2; grid-row: 3; }
}

/* ---------- 朗读卡片网格（左右排布）---------- */
.sentence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.scard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px;
  position: relative; overflow: hidden; transition: box-shadow .2s, transform .14s; }
.scard:hover { box-shadow: var(--shadow-lg); }
.scard.allgood { border-color: #B7E6CF; background: linear-gradient(180deg, #F4FCF7, #fff); }
.scard.haserr  { border-color: #F6C9CA; }
.scard .grp { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .3px; }
.scard .badge { position: absolute; top: 14px; right: 16px; font-size: 22px; opacity: 0; transition: opacity .3s, transform .3s; transform: scale(.6); }
.scard.allgood .badge, .scard.haserr .badge { opacity: 1; transform: scale(1); }
.scard .text { font-size: 21px; line-height: 1.6; font-weight: 600; }
.scard .ctrl { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: auto; }
.scard .score { font-weight: 800; font-size: 15px; }
.scard .score.s-good { color: var(--green); } .scard .score.s-bad { color: var(--danger); }
.scard .hint { color: var(--muted); font-size: 13px; }

/* 单词标红 + 可点 */
.word { padding: 0 1px; border-radius: 5px; }
.word.wrong { color: var(--danger); font-weight: 800; cursor: pointer;
  background: #FFE7E7; text-decoration: underline wavy var(--danger); text-underline-offset: 3px; }
.word.wrong:hover { background: #FFD4D4; }

/* ---------- 错词本 ---------- */
.errlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 16px; }
.errcard { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--danger);
  border-radius: var(--r-md); padding: 18px; box-shadow: var(--shadow); }
.errcard .w { font-size: 22px; font-weight: 800; color: var(--danger); }
.errcard .cnt { float: right; font-size: 12px; color: var(--muted); }
.errcard .sent { color: var(--muted); margin: 8px 0 14px; line-height: 1.5; }
.errcard .sent b { color: var(--ink); background: #FFE7E7; padding: 0 3px; border-radius: 4px; }

.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px; }

/* ---------- 撒花 canvas ---------- */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }

/* 进入动画 */
.scard, .folder, .errcard, .stat { animation: rise .4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
