:root {
  --red: #E53935;
  --red-dark: #C62828;
  --red-light: #FFEBEE;
  --bg: #FFFFFF;
  --bg-soft: #FAFAFA;
  --text: #1F1F1F;
  --muted: #888888;
  --line: #EEEEEE;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
.audio-hidden { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.view { max-width: 720px; margin: 0 auto; min-height: 100vh; }
.view.practice { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.view.home { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; height: 100dvh; gap: 48px; padding: 24px; }
.home-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.home-title { font-size: 30px; font-weight: 700; color: var(--red); letter-spacing: 2px; }
.home-subtitle { font-size: 18px; font-weight: 600; color: #1E88E5; letter-spacing: 1px; }
.home-btns { display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 260px; }
.home-btn { height: 62px; border: none; border-radius: 31px; background: var(--red); color: #fff; font-size: 20px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 14px rgba(229,57,53,0.32); }
.home-btn:active { transform: scale(0.97); }

/* 顶部栏 */
.topbar {
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  flex-shrink: 0;
}
.topbar-title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 16px;
  padding: 6px 10px;
  cursor: pointer;
  min-width: 44px;
  min-height: 36px;
  border-radius: 8px;
}
.icon-btn:active { background: rgba(255,255,255,0.2); }
.icon-btn.spacer { cursor: default; }

/* 主体 */
.content {
  flex: 1;
  min-height: 0;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
}

/* 语速 */
.speed-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-shrink: 0; }
.speed-label { font-size: 14px; color: var(--muted); }
.speed-row input[type=range] { flex: 1; accent-color: var(--red); }
.speed-value { font-size: 14px; font-weight: 600; min-width: 42px; text-align: right; }

/* 正文（连续段落） */
.text-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 2px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 18px;
  line-height: 1.9;
  color: #333;
  word-break: break-word;
  -webkit-overflow-scrolling: touch;
}
.text-title {
  font-weight: 700;
  font-size: 19px;
  color: var(--text);
  margin-bottom: 12px;
}
/* 播放行 */
.play-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 12px 0 4px;
  flex-shrink: 0;
}
.play-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--red);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(229,57,53,0.4);
}
.play-btn:active { transform: scale(0.95); }
.icon-play {
  width: 0; height: 0;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  border-left: 22px solid #fff;
  margin-left: 5px;
}
.icon-pause {
  width: 18px; height: 24px;
  border-left: 7px solid #fff;
  border-right: 7px solid #fff;
}
.icon-loading {
  width: 26px; height: 26px;
  border: 3px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loop-btn {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  min-height: 38px;
}
.loop-btn.on { background: var(--red); color: #fff; }

/* 录音面板 */
.record-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  flex-shrink: 0;
}
.record-status { font-size: 14px; color: var(--muted); min-height: 20px; }
.record-status.recording { color: var(--red); font-weight: 600; }

.vu-meter { display: flex; align-items: flex-end; gap: 3px; height: 52px; }
.vu-meter .bar {
  width: 6px;
  background: var(--red);
  border-radius: 2px;
  height: 5px;
  transition: height .08s linear;
}

.record-btn {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--red);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 6px rgba(229,57,53,0.16);
}
.record-btn:active { transform: scale(0.95); }
.record-dot { width: 32px; height: 32px; border-radius: 50%; background: #fff; }
.record-btn.recording .record-dot { border-radius: 6px; width: 28px; height: 28px; }

/* 上传文本按钮 */
.upload-text-btn {
  margin: 4px auto 6px;
  padding: 8px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.upload-text-btn:active { background: var(--red-light); color: var(--red); }
.upload-text-btn:disabled { opacity: .5; }

/* 文章列表 */
.article-list, .records-list { list-style: none; padding: 16px; }
.theory-text { padding: 16px; font-size: 16px; line-height: 1.9; color: #333; word-break: break-word; }
.article-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 14px;
  margin-bottom: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s;
}
.article-item:active { background: var(--red-light); }
.article-title { font-size: 17px; font-weight: 600; }
.article-meta { font-size: 13px; color: var(--muted); }

/* 录音列表 */
.record-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.record-info { display: flex; flex-direction: column; gap: 4px; }
.record-info strong { font-size: 16px; }
.record-info span { font-size: 13px; color: var(--muted); }
.record-actions { display: flex; gap: 8px; }
.mini {
  flex: 1;
  min-height: 40px;
  border: none;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.mini.danger { background: #fff; color: var(--red-dark); border: 1px solid var(--red-dark); }
.empty { text-align: center; color: var(--muted); padding: 30px 0; list-style: none; }

#audio-player { width: 100%; margin-top: 12px; }
