:root {
  --bg: #f6f1e7;
  --panel: #fffdf8;
  --ink: #2c2620;
  --muted: #8a7f70;
  --accent: #b0432f;
  --accent-soft: #f7e6e0;
  --line: #e8dfcf;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(90, 65, 30, 0.12);
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 8%, #fbf7ee 0%, transparent 45%),
    radial-gradient(circle at 88% 92%, #efe5d0 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.page { width: 100%; max-width: 760px; }

.header { text-align: center; margin-bottom: 22px; }
.title { font-size: 2.1rem; letter-spacing: 0.4em; text-indent: 0.4em; font-weight: 700; }
.subtitle { margin-top: 6px; color: var(--muted); font-size: 0.92rem; }

.screen { display: none; }
.screen.active { display: block; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 16px;
}

/* ---------- 首页 ---------- */
.dropzone {
  text-align: center;
  cursor: pointer;
  padding: 44px 22px;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover,
.dropzone.dragover { border-color: var(--accent); background: #fffaf2; }
.dz-icon { font-size: 2.6rem; }
.dz-main { margin-top: 10px; font-size: 1.05rem; font-weight: 600; }
.dz-sub { margin-top: 6px; color: var(--muted); font-size: 0.85rem; }

.saved {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.saved-title { font-size: 1.05rem; font-weight: 600; }
.saved-meta { margin-top: 4px; color: var(--muted); font-size: 0.85rem; }
.saved-actions { display: flex; gap: 10px; }

.hint { color: var(--muted); font-size: 0.82rem; text-align: center; min-height: 1.2em; }

/* ---------- 播放器 ---------- */
.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.book-title { font-size: 1.25rem; font-weight: 700; }
.book-sub { margin-top: 4px; color: var(--muted); font-size: 0.85rem; }

.reading {
  margin: 18px 0 14px;
  padding: 16px 18px;
  border-left: 3px solid var(--accent);
  background: #faf5ea;
  border-radius: 10px;
}
.reading-chapter {
  font-size: 0.85rem;
  color: var(--muted);
  font-family: Georgia, "Songti SC", "SimSun", serif;
}
.reading-sentence {
  margin-top: 10px;
  font-family: Georgia, "Songti SC", "STSong", "SimSun", serif;
  font-size: 1.35rem;
  line-height: 1.2;
  height: 1.2em;          /* 固定一行高：句子长短不撑高布局 */
  overflow: hidden;       /* 只露出一行，长句在内部逐行上滚 */
  position: relative;
}
.reading-line {
  display: block;
  line-height: 1.2;       /* 与容器高度(1.2em)保持一致，便于按行计算 */
  white-space: normal;    /* 长句自动折行为多行 */
  will-change: transform; /* 用 transform 滚动，避免整页重排 */
}

.progress { display: flex; align-items: center; gap: 10px; }
.progress-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.3s; }
.progress-text { font-size: 0.8rem; color: var(--muted); min-width: 38px; text-align: right; }

.controls { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 18px 0; }

.settings { display: flex; gap: 18px; flex-wrap: wrap; }
.setting { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }
.setting-label { font-size: 0.82rem; color: var(--muted); }

select {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input[type="range"] { width: 100%; accent-color: var(--accent); }

.chapters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}
.chapters-title { font-size: 0.95rem; font-weight: 700; }
.chapter-select { max-height: 180px; margin-bottom: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  font: inherit;
  padding: 9px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #9a3826; border-color: #9a3826; color: #fff; }
.btn.big { padding: 12px 30px; font-size: 1.05rem; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--accent); border-color: var(--accent-soft); }
.btn.danger:hover { background: var(--accent-soft); }

.hidden { display: none !important; }

.footer { margin-top: 8px; text-align: center; color: var(--muted); font-size: 0.78rem; }

@media (max-width: 560px) {
  .controls { flex-wrap: wrap; }
  .reading-sentence { font-size: 1.15rem; }
}
