.reader-text {
  width: 100%; background: var(--well-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 0.95rem; line-height: 1.6; resize: vertical;
}
.reader-text:focus { outline: none; border-color: var(--accent); }
.reader-compose-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.reader-compose-actions button { font-size: 0.85rem; font-weight: 600; min-height: 0; padding: 8px 14px; }
.reader-hint { font-size: 0.75rem; color: var(--muted); }
.reader-warn { font-size: 0.78rem; color: var(--warn); margin: 8px 0 0; line-height: 1.45; }
#reader-input:has(.reader-play) {
  position: sticky; top: calc(env(safe-area-inset-top) + var(--head-h)); z-index: 5;
  background: var(--bg); padding: 20px 0 8px; margin-top: -12px;
}
@media (min-width: 1440px) { #reader-input:has(.reader-play) { top: 0; } }
.reader-summary {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px;
  background: var(--well); border-radius: 14px;
  padding: 14px;
  font-size: 0.8rem; color: var(--muted);
}
.reader-coverage { flex: 1; min-width: 0; }
.reader-coverage .warn { color: var(--warn); }
.reader-transport { display: flex; align-items: center; flex: none; gap: 2px; }
.reader-play {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
  width: 46px; height: 46px; min-width: 46px; min-height: 46px;
  padding: 0; border-radius: 50%;
}
.reader-play svg { width: 24px; height: 24px; display: block; }
.reader-skip {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
  width: 34px; height: 34px; min-width: 34px; min-height: 34px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted);
}
.reader-skip svg { width: 20px; height: 20px; display: block; }
.reader-skip:hover:not(:disabled) { background: var(--well-2); color: var(--text); }
.reader-skip:active:not(:disabled) { background: var(--well-2); color: var(--accent); }
.reader-skip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.reader-prefs { display: flex; align-items: center; flex: none; gap: 8px; margin-left: auto; }
.reader-speech { display: flex; align-items: center; gap: 8px; }
.reader-prefs select {
  width: auto; max-width: 200px; padding: 6px 8px; border-radius: 8px; font-size: 0.78rem;
}
.speech-rate { display: flex; align-items: center; gap: 6px; }
.speech-rate input[type="range"] {
  width: 90px; background: none; border: 0; border-radius: 0; padding: 0;
  height: 24px; accent-color: var(--accent);
}
.speech-rate input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.speech-rate-value {
  flex: none;
  color: var(--text); font-variant-numeric: tabular-nums; font-size: 0.75rem;
  min-width: 4ch; text-align: right;
}
@media (max-width: 620px) {
  .reader-prefs { flex: 1 0 100%; margin-left: 0; min-width: 0; }
  .reader-prefs select { flex: 0 1 auto; min-width: 0; }
  .reader-speech { flex: 1; min-width: 0; }
  .speech-rate { flex: 1; min-width: 0; }
  .speech-rate input[type="range"] { width: auto; flex: 1; min-width: 0; }
}
.reader-passage { margin-top: 28px; }
.reader-line { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
.reader-line-controls {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  flex: none; margin-top: 4px; margin-left: 8px;
}
.reader-line-speak { flex: none; }
.reader-line-controls > button { color: var(--border); }
.reader-line.playing .reader-line-speak {
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent);
}
.reader-line.cued .reader-line-speak {
  background: color-mix(in srgb, var(--accent) 9%, transparent); color: var(--accent);
}
.reader-line-copy {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
  width: 30px; height: 30px; min-width: 30px; min-height: 30px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--muted);
}
.reader-line-copy svg { width: 18px; height: 18px; display: block; }
.reader-line-copy:hover { background: var(--well-2); color: var(--text); }
.reader-line-copy:active { background: var(--well-2); color: var(--accent); }
.reader-line-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) {
  .reader-line-copy { opacity: 0; transition: opacity 120ms ease; }
  .reader-line-copy:hover,
  .reader-line-copy:focus-visible { opacity: 1; }
}
.reader-line.playing,
.reader-line:has(.reader-line-speak.speaking) {
  border-radius: 8px;
  background: var(--well);
  box-shadow: 0 0 0 6px var(--well);
}
.reader-words { display: flex; flex: 1; flex-wrap: wrap; align-items: flex-end; gap: 2px 4px; min-width: 0; }
.reader-break { height: 0; margin: 0 0 18px; border: 0; border-top: 1px solid var(--border); }
.reader-seg {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 0; min-height: 0; padding: 4px 6px;
  --token-ground: transparent; background-color: var(--token-ground);
  border: 1px solid transparent; border-radius: 8px;
  color: inherit; font: inherit; text-align: center; cursor: pointer;
}
.reader-seg.selected { --token-ground: var(--token-open); }
.reader-seg.expanded { --token-ground: var(--token-expanded); }
.reader-seg:hover { background-color: color-mix(in srgb, #000 var(--token-hover), var(--token-ground)); }
.reader-seg:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.reader-seg .hanzi { font-size: 1.35rem; font-weight: 600; line-height: 1.2; color: color-mix(in srgb, var(--text) 85%, transparent); }
.reader-seg .pinyin { color: var(--pinyin-blue); font-family: var(--mono); font-size: 0.72rem; line-height: 1.2; }
.reader-seg .gloss-slot {
  display: block; min-height: 1em; font-size: 0.72rem; line-height: 1.2;
  max-width: 24ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reader-seg .gloss { color: var(--gloss-purple); }
.reader-seg.gloss-unjustified:hover .gloss, .reader-seg.gloss-unjustified.selected .gloss { --gloss-ink: 34%; }
.reader-seg.row-excluded { background-image: linear-gradient(color-mix(in srgb, var(--err) 15%, transparent), color-mix(in srgb, var(--err) 15%, transparent)); }
.reader-seg.row-pending { background-image: linear-gradient(color-mix(in srgb, var(--warn) 15%, transparent), color-mix(in srgb, var(--warn) 15%, transparent)); }
.reader-plain { align-self: flex-start; padding: 4px 0; font-size: 1.35rem; line-height: 1.2; color: var(--muted); }

