/* 儿童向：大按钮（最小 64px）、高对比、少文字。移动端优先。 */

:root {
  --blue: #2563eb;
  --orange: #ea580c;
  --green: #16a34a;
  --a: #f59e0b;
  --b: #8b5cf6;
  --ink: #1e293b;
  --dim: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
}

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

body {
  margin: 0;
  padding: 0 16px calc(32px + env(safe-area-inset-bottom));
  font: 16px/1.5 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }

/* --- 顶栏 --- */

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(16px + env(safe-area-inset-top)) 0 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
.bar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-tx { min-width: 0; }
.bar-tx p {
  margin: 1px 0 0;
  font-size: 13px;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.back {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-left: -8px;
  font-size: 28px;
  border-radius: 50%;
  color: inherit;
  text-decoration: none;
}
.back:active { background: var(--line); }

/* --- ① 单元网格 --- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.unit {
  height: 76px;
  border-radius: 16px;
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.12);
  transition: transform .1s;
}
.unit.review { background: var(--orange); }
.unit.revision { background: var(--green); }
.unit:active { transform: scale(.96); }

/* --- ② 音频列表 --- */

.list { display: flex; flex-direction: column; gap: 10px; }
.track {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 0 18px;
  text-align: left;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 16px;
}
.track:active { border-color: var(--blue); background: #eff6ff; }
.track .ic { font-size: 32px; }
.track .tx { display: flex; flex-direction: column; }
.track .tx b { font-size: 18px; }
.track .tx i { font-style: normal; font-size: 14px; color: var(--dim); }

/* --- ③ 播放 --- */

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 0 16px;
}
.big-icon { font-size: 80px; line-height: 1; }
.loop-count {
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
  background: #dbeafe;
  padding: 4px 14px;
  border-radius: 999px;
}

.progress-wrap { margin-bottom: 20px; }
.progress {
  position: relative;
  height: 40px;              /* 触摸热区够大 */
  display: flex;
  align-items: center;
  touch-action: none;
}
.progress::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  height: 10px;
  border-radius: 5px;
  background: var(--line);
}
.loop-band {
  position: absolute;
  height: 10px;
  border-radius: 5px;
  background: #fde68a;
}
.played {
  position: absolute;
  height: 10px;
  border-radius: 5px;
  background: var(--blue);
  opacity: .85;
}
.knob {
  position: absolute;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--blue);
  box-shadow: 0 1px 4px rgb(0 0 0 / .2);
}
.times {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.play-btn {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 24px;
  border-radius: 50%;
  font-size: 34px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 4px 14px rgb(37 99 235 / .4);
  transition: transform .1s;
}
.play-btn:active { transform: scale(.94); }

.ab-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 72px;
  border-radius: 16px;
  border: 3px solid var(--line);
  background: #fff;
  font-variant-numeric: tabular-nums;
}
.ab b { font-size: 24px; line-height: 1; }
.ab span { font-size: 14px; color: var(--dim); }
.ab:active { transform: scale(.96); }

#btn-a.set { border-color: var(--a); background: #fffbeb; }
#btn-a.set b, #btn-a.set span { color: #b45309; }
#btn-b.set { border-color: var(--b); background: #f5f3ff; }
#btn-b.set b, #btn-b.set span { color: #6d28d9; }

@keyframes shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
.flash { animation: shake .3s; border-color: #ef4444 !important; }

.clear {
  display: block;
  width: 100%;
  height: 56px;
  margin-top: 12px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--dim);
  background: #fff;
  border: 2px solid var(--line);
}
.clear:active { background: var(--line); }

/* --- 句子列表：点一句循环一句 --- */

.sent-list { display: flex; flex-direction: column; gap: 8px; }
.sent {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 14px;
  text-align: left;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--line);
}
.sent i {
  flex: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: 14px;
  font-weight: 700;
  color: var(--dim);
  background: var(--bg);
  border-radius: 50%;
}
.sent span {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sent:active { transform: scale(.98); }
.sent.on {
  border-color: var(--blue);
  background: #eff6ff;
}
.sent.on i { background: var(--blue); color: #fff; }
.sent.on span { color: var(--blue); font-weight: 600; }

/* --- 速度 / 停顿 --- */

.opt { margin-top: 22px; }
.opt-label { font-size: 14px; color: var(--dim); margin-bottom: 8px; }
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.seg button {
  height: 64px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  background: #fff;
  border: 2px solid var(--line);
  color: var(--dim);
}
.seg button.on {
  border-color: var(--blue);
  background: #eff6ff;
  color: var(--blue);
}
.seg button:active { transform: scale(.96); }

@media (min-width: 560px) {
  body { max-width: 560px; margin: 0 auto; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}
