:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2733;
  --muted: #7b8494;
  --line: #e7ebf2;
  --brand: #3b6ef5;
  --brand-soft: #eaf0ff;
  --ok: #17a673;
  --ok-soft: #e4f7ef;
  --warn: #f5a623;
  --warn-soft: #fff4e0;
  --rec: #e5484d;
  --rec-soft: #fdeaea;
  --play: #7048e8;
  --play-soft: #f0ebfd;
}

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

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

body { padding-bottom: 90px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(135deg, #3b6ef5, #5a8bff);
  color: #fff;
  box-shadow: 0 2px 12px rgba(59, 110, 245, .25);
}
.topbar-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 18px 16px 14px;
}
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.topbar .sub { font-size: 13px; opacity: .92; margin-top: 4px; line-height: 1.5; }
.voice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.voice-row label { font-size: 13px; opacity: .95; white-space: nowrap; }
.voice-row select {
  flex: 1;
  padding: 7px 10px;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,.22);
  color: #fff;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.voice-row select option { color: #1f2733; }

/* ---------- 句子列表 ---------- */
.sentence-list {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(20, 30, 55, .06);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 0;
}
.idx-badge {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.src-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.src-tag.Conversation { background: #eef6ff; color: #2a7de1; }
.src-tag.News { background: #fff1e6; color: #e07b2a; }
.src-tag.Passage { background: #eefaf3; color: #17a673; }

.en-text {
  font-size: 19px;
  line-height: 1.55;
  font-weight: 600;
  color: #17202e;
  padding: 10px 16px 4px;
  font-family: "Georgia", "Times New Roman", serif;
  letter-spacing: .2px;
}
.zh-text {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  padding: 0 16px 12px;
}

/* ---------- 按钮区 ---------- */
.btn-row {
  display: flex;
  gap: 8px;
  padding: 0 16px 14px;
}
.btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 6px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fafbfd;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  transition: all .15s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn .ic { font-size: 18px; }
.btn.listen { color: var(--play); border-color: #d8cbfa; background: var(--play-soft); }
.btn.record { color: var(--rec); border-color: #f4c2c4; background: var(--rec-soft); }
.btn.replay { color: var(--ok); border-color: #bfe6d6; background: var(--ok-soft); }
.btn.replay:disabled { opacity: .45; cursor: not-allowed; }
.btn.recording {
  color: #fff;
  background: var(--rec);
  border-color: var(--rec);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, .45); }
  50% { box-shadow: 0 0 0 9px rgba(229, 72, 77, 0); }
}
.btn.speaking { color: #fff; background: var(--play); border-color: var(--play); }

.rec-timer {
  text-align: center;
  font-size: 12px;
  color: var(--rec);
  font-weight: 600;
  min-height: 16px;
  padding-bottom: 10px;
}

/* ---------- 纠音结果区（词级对比） ---------- */
.result-area {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}
.result-area.hidden { display: none; }

.result-live {
  font-size: 13px;
  color: var(--brand);
  font-weight: 600;
  min-height: 20px;
}

.result-summary {
  font-size: 14px;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 10px;
}
.result-summary.good { background: var(--ok-soft); color: var(--ok); }
.result-summary.mid { background: var(--warn-soft); color: #b37412; }
.result-summary.bad { background: var(--rec-soft); color: var(--rec); }

.sentence-compare {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.8;
  margin-bottom: 8px;
}
.sentence-compare .w {
  font-family: "Georgia", serif;
  font-size: 17px;
  padding: 1px 5px;
  border-radius: 6px;
}
.sentence-compare .w.ok { color: #1f8a5f; background: #eafaf2; }
.sentence-compare .w.miss {
  color: #d13438;
  background: #fdeaea;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: #e5484d;
}

.extra-words {
  font-size: 13px;
  color: var(--warn);
  margin-bottom: 8px;
}
.extra-words b { font-weight: 700; }

.error-corrections {
  margin-top: 6px;
}
.err-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--rec);
  margin-bottom: 6px;
}
.err-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 7px 10px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid #f4d6d7;
  margin-bottom: 6px;
}
.err-word {
  font-weight: 700;
  color: #d13438;
  font-family: "Georgia", serif;
  font-size: 15px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.err-tip {
  font-size: 13px;
  color: #5a6474;
  line-height: 1.5;
}

.result-perfect {
  font-size: 15px;
  font-weight: 700;
  color: var(--ok);
  padding: 10px;
  text-align: center;
}

.hyp-text {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.hyp-text i { font-style: italic; }

.result-warn {
  font-size: 13px;
  color: #b37412;
  line-height: 1.5;
  padding: 8px 10px;
  background: var(--warn-soft);
  border-radius: 9px;
}

/* ---------- 纠音讲解 ---------- */
.correction-toggle {
  width: 100%;
  border: none;
  border-top: 1px solid var(--line);
  background: #fafbfd;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.correction-toggle .arrow { transition: transform .2s; }
.correction-toggle.open .arrow { transform: rotate(180deg); }

.correction-body { display: none; padding: 4px 16px 16px; }
.correction-body.show { display: block; }

.cor-block { margin-top: 12px; }
.cor-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}
.cor-title .dot {
  width: 9px; height: 9px; border-radius: 50%;
}
.cor-title.c-words .dot { background: var(--brand); }
.cor-title.c-linking .dot { background: var(--play); }
.cor-title.c-stress .dot { background: var(--ok); }
.cor-title.c-weak .dot { background: var(--warn); }

.cor-item {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f7f9fc;
  margin-bottom: 6px;
  align-items: flex-start;
}
.cor-item .ph {
  font-weight: 700;
  color: #2c3a4f;
  font-family: "Georgia", serif;
  font-size: 15px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.cor-item .ipa { color: var(--brand); font-weight: 600; font-size: 13px; flex: 0 0 auto; }
.cor-item .note { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* ---------- 回到顶部 ---------- */
.fab {
  position: fixed;
  right: 18px;
  bottom: 22px;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(59, 110, 245, .4);
  opacity: 0;
  pointer-events: none;
  transition: all .2s;
}
.fab.show { opacity: 1; pointer-events: auto; }

@media (min-width: 600px) {
  .en-text { font-size: 21px; }
}
