:root {
  --bg: #0f1419;
  --bg-alt: #131a21;
  --panel: #1d252e;
  --line: #26303a;
  --fg: #e8eef4;
  --muted: #8b9aa8;
  --accent: #22d3ee;      /* cyan accent */
  --accent-bg: #14303a;   /* dark cyan-tinted navy: the playing sentence */
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--line);
}

.title { font-size: 15px; font-weight: 600; }

.meta { margin-top: 2px; color: var(--muted); font-size: 12px; }

.progress {
  margin-top: 9px;
  height: 3px;
  border-radius: 2px;
  background: #222c36;
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width .2s linear;
}

/* ---------- transcript ---------- */

.transcript {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px 18px;
}

.sentence {
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .2s;
}

.sentence + .sentence { margin-top: 6px; }

.sentence-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.num {
  min-width: 1.6em;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.word { color: var(--accent); font-size: 12px; font-weight: 600; }

.cn { color: #fff; font-size: 19px; line-height: 1.45; }

.en { margin-top: 2px; color: var(--muted); font-size: 13px; }

/* not listened to yet: the text is unreadable until the sentence is tapped */
.sentence.blurred .word,
.sentence.blurred .cn,
.sentence.blurred .en {
  filter: blur(7px);
  user-select: none;
  -webkit-user-select: none;
}

/* keep blurred text from showing through as bright white */
.sentence.blurred .cn { color: #7b8b99; }

/* small press feedback, since the blur itself is the "tap to read" hint */
.sentence.blurred:active { background: rgba(34, 211, 238, .08); }

/* already played */
.sentence.done { opacity: .45; }

/* the sentence that is playing right now */
.sentence.active {
  background: var(--accent-bg);
  border-color: rgba(34, 211, 238, .45);
  opacity: 1;
}

.sentence.active .cn { color: #eafcff; font-weight: 600; }
.sentence.active .en { color: #9fc4cc; }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
  font-size: 12px;
}
.empty .btn { margin-top: 10px; }

/* ---------- warning banner ---------- */

/* Shown when latest_review.json describes an older review than the newest MP3
   on disk (see review_state.py), so the old day is never played silently. */
.warn {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(251, 191, 36, .45);
  border-radius: 12px;
  background: rgba(251, 191, 36, .1);
  color: #fde68a;
  font-size: 13px;
}

.warn strong {
  display: block;
  margin-bottom: 2px;
  color: #fcd34d;
}

.warn-hint { margin-top: 6px; color: var(--muted); }

.warn code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--panel);
  color: var(--fg);
  font-size: 12px;
}

/* ---------- player ---------- */

.player {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--bg-alt);
  border-top: 1px solid var(--line);
}

.btn {
  appearance: none;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--fg);
  font-size: 15px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(.96); }

.btn-play {
  width: 58px;
  height: 58px;
  padding: 0;
  border: none;
  background: var(--accent);
  color: #04181d;
  font-size: 20px;
  font-weight: 700;
}

.time {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.time-sep { margin: 0 4px; opacity: .5; }
