/* The listening player (reader/_listen_player, listen_player_controller):
   a dark bar docked at the bottom of the reading column on desktop and
   floating at the bottom on phone, a ▶ for every sentence, and the sentence
   being read tinted, outlined and labelled in words ("▶ Reading now"). */
.reader__listen[aria-pressed="true"] { background: var(--clay); color: var(--text-on-accent); border-color: var(--clay); }

/* The offer to add vowels first, and the quiet notes */
.listen__offer { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; padding: 16px 18px; border: 1.5px solid var(--peach); border-radius: 16px; background: var(--card); }
.listen__offer[hidden], .listen__note[hidden] { display: none; }
.listen__offer-title { font-size: 16px; font-weight: 700; }
.listen__offer-text { font-size: 14px; line-height: 1.5; color: var(--ink-line); }
.listen__offer-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.listen__offer-go { min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--radius-pill); background: var(--ink); color: var(--paper); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.listen__offer-left { font-size: 13px; color: var(--text-body); }
.listen__offer-left strong { color: var(--ink); }
.listen__offer-later { margin-left: auto; min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--text-muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.listen__note { margin: 4px 0 12px; padding: 12px 16px; border-radius: 14px; background: var(--sand); font-size: 14px; line-height: 1.55; }
.listen__note a { font-weight: 600; }

/* Room under the text, so the bar never covers the sentence being read */
.reader.is-listening .reader__main { padding-bottom: 120px; }

/* The bar */
.listen__dock { position: sticky; bottom: 18px; z-index: 30; display: flex; flex-direction: column; gap: 6px; margin-top: 12px; container-type: inline-size; }
.listen__dock[hidden] { display: none; }
.listen__bar { display: flex; align-items: center; gap: 18px; padding: 10px 12px 10px 20px; border-radius: 20px; background: var(--ink); color: var(--paper);
               box-shadow: 0 18px 40px -16px rgba(28, 35, 33, .6); }
.listen__state { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.listen__state-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.listen__status { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.listen__ticks { display: grid; grid-template-columns: repeat(var(--count, 5), 1fr); gap: var(--gap, 3px); max-width: 240px; }
.listen__tick { height: 4px; border-radius: 4px; background: var(--ink-line-strong); }
.listen__tick.is-done { background: var(--peach); }
.listen__tick.is-current { background: var(--paper); }
.listen__sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-on-dark-muted); }
.listen__sub[hidden] { display: none; }
.listen__stay { min-height: 28px; padding: 0 4px; border: 0; background: none; color: var(--peach); font: inherit; font-size: 12px; font-weight: 700; text-decoration: underline; cursor: pointer; }
.listen__stay[hidden] { display: none; }
.listen__controls { display: flex; align-items: center; justify-content: center; gap: 6px; }
.listen__step, .listen__close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--paper); font-size: 18px; cursor: pointer; }
.listen__close { color: var(--text-on-dark-muted); font-size: 20px; }
.listen__play { position: relative; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 50%;
                background: var(--peach); color: var(--ink); font-size: 20px; cursor: pointer; }
.listen__spinner { display: none; width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(28, 35, 33, .25); border-top-color: var(--ink); animation: listen-spin .8s linear infinite; }
.listen__play.is-loading .listen__spinner { display: block; }
.listen__play.is-loading .listen__play-icon { display: none; }
@keyframes listen-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .listen__spinner { animation-duration: 2.4s; } }
.listen__extras { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.listen__pill, .listen__speed, .listen__round { height: 44px; border: 1px solid var(--ink-line-strong); border-radius: var(--radius-pill); background: transparent; color: var(--paper);
                                                 font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.listen__pill { display: flex; align-items: center; gap: 6px; padding: 0 14px; }
.listen__speed { min-width: 58px; padding: 0 12px; font-size: 14px; font-weight: 700; }
.listen__speed[aria-expanded="true"] { border-color: var(--paper); }
.listen__round { width: 44px; border-radius: 50%; font-size: 18px; }
.listen__cont { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--paper); font: inherit; font-size: 13px; cursor: pointer; }
.listen__switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; border-radius: var(--radius-pill); background: var(--ink-line-strong); }
.listen__switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #FFFFFF; transition: left .15s; }
[aria-checked="true"] > .listen__switch { background: var(--green); }
[aria-checked="true"] > .listen__switch::after { left: 19px; }
.listen__bar button:focus-visible { outline: 3px solid var(--peach); outline-offset: 2px; }
.listen__keys { align-self: center; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--paper); text-align: center; font-size: 12px; color: var(--text-body); }
.listen__close--phone, .listen__repeat--phone, .listen__speed--phone { display: none; }

/* Speed and options */
.listen__menu { align-self: flex-end; width: 220px; display: flex; flex-direction: column; gap: 2px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 16px;
                background: var(--card); color: var(--ink); box-shadow: 0 20px 40px -18px rgba(28, 35, 33, .5); }
.listen__menu[hidden] { display: none; }
.listen__menu-label { padding: 6px 10px 2px; font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.listen__menu-item { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent;
                     color: var(--ink); font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.listen__menu-item[aria-checked="true"]:not(.listen__menu-cont) { background: var(--sand); font-weight: 700; }
.listen__menu-mark { visibility: hidden; }
.listen__menu-item[aria-checked="true"] .listen__menu-mark { visibility: visible; }
.listen__menu-cont { display: none; min-height: 48px; margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0; font-size: 14px; }
.listen__menu-cont .listen__switch { background: var(--line-dashed); }
.listen__menu-sub { display: block; font-size: 12px; color: var(--text-muted); }
.listen__menu-item:focus-visible { outline: 3px solid var(--green); outline-offset: -3px; }

/* A ▶ for every sentence, and the one being read */
.listen__handle { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1.5px solid var(--line-strong); border-radius: 50%;
                  background: transparent; color: var(--clay); font-size: 13px; cursor: pointer; }
.listen__handle.is-current { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.listen__handle:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.reader.is-listening .reader__sentence { position: relative; padding: 4px 58px 4px 8px; border: 1.5px solid transparent; border-radius: 14px; }
.listen__handle--graded { position: absolute; top: 12px; right: 6px; width: 44px; height: 44px; }
.reader__sentence.listen-current { background: var(--mark); border-color: var(--peach); }
.reader__sentence.listen-loading { border-style: dashed; border-color: var(--clay); }
.listen__label { display: table; margin: 6px 0 0 auto; padding: 1px 10px; border-radius: var(--radius-pill); background: var(--ink); color: var(--paper);
                 font-family: var(--font-sans); font-size: 12px; font-weight: 700; }
.listen__label.is-loading { background: var(--sand); color: var(--ink); }
.listen__handle--library { width: 34px; height: 34px; margin-inline-end: 6px; vertical-align: middle; font-size: 11px; }
.reader__w.listen-current { background: var(--mark); box-shadow: 0 0 0 2px var(--mark); border-radius: 4px; }
.reader__w.listen-loading { text-decoration: underline dashed var(--clay); }

/* A narrow reading column (the library reader beside its panel): two rows. */
@container (max-width: 700px) {
  .listen__bar { flex-wrap: wrap; row-gap: 6px; }
  .listen__state { flex-basis: 100%; }
  .listen__controls { flex: 0 0 auto; }
  .listen__extras { flex: 1; }
}

@media (max-width: 760px) {
  .reader.is-listening .reader__main { padding-bottom: 170px; }
  .listen__dock { position: fixed; left: 12px; right: 12px; bottom: 14px; margin: 0; }
  .listen__bar { flex-direction: column; align-items: stretch; gap: 6px; padding: 10px 12px; border-radius: 22px; }
  .listen__controls { justify-content: space-between; }
  .listen__extras, .listen__keys { display: none; }
  .listen__close--phone, .listen__repeat--phone, .listen__speed--phone { display: inline-flex; align-items: center; justify-content: center; }
  .listen__speed--phone { min-width: 52px; }
  .listen__menu { width: 250px; }
  .listen__menu-cont { display: flex; }
  .reader.is-listening .reader__sentence { padding-right: 52px; }
  .listen__handle--graded { right: 4px; top: 6px; }
}

/* "Practice with this text" under a graded text */
.reader__practice { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-mid); }
.reader__practice-label { margin-right: 4px; font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.reader__practice-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
                        color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; }
.reader__practice-btn:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }
.reader__practice-note { font-size: 13px; color: var(--text-muted); }
