/* The audiobook player (#/listen/<id>): the whole screen, the cover big, the chapter and its scrub bar,
   the round play button between the skips, and speed / chapters / sleep underneath. When you leave it,
   a small bar sits at the bottom of the app (above the tabs on a phone, bottom right on a computer).
   Colours follow the app's light/dark tokens. */
body.listening { overflow: hidden; overscroll-behavior: none; }
body.listening .side, body.listening .dtop, body.listening .tabs { display: none !important; }
.ls { position: fixed; inset: 0; z-index: 40; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--bg); color: var(--ink);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.ls-top { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 6px 10px; min-width: 0; }
.ls-head { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; line-height: 1.25; }
.ls-head small { color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.ls-head b { font-weight: 600; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-icon { flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; display: grid; place-items: center; color: var(--ink); cursor: pointer; }
.ls-icon:hover { background: var(--line-soft); }
.ls-main { overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; align-items: center; gap: 14px;
  width: 100%; max-width: 480px; margin: 0 auto; padding: 4px 20px 28px; min-width: 0; }
.ls-art { position: relative; flex: none; width: min(72vw, 38vh, 340px); aspect-ratio: 1; border-radius: 16px; overflow: hidden; margin: 6px 0 4px;
  background: var(--hero); color: var(--hero-ink); box-shadow: 0 14px 34px rgba(27,26,23,.22), 0 2px 6px rgba(27,26,23,.1); }
.ls-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ls-art-ph { position: absolute; inset: 0; padding: 12%; font-weight: 650; font-size: 22px; line-height: 1.15; letter-spacing: -.01em; overflow: hidden; }
.ls-titles { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; max-width: 100%; }
.ls-titles h1 { margin: 0; font-size: 24px; line-height: 1.15; letter-spacing: -.02em; font-weight: 650; overflow-wrap: anywhere; }
.ls-by { color: var(--muted); font-size: 14.5px; overflow-wrap: anywhere; }
.ls-chap { border: 0; background: var(--accent-soft); color: var(--ink); font: inherit; border-radius: 14px; padding: 9px 16px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  max-width: 100%; min-width: 0; cursor: pointer; text-align: center; }
.ls-cname { font-weight: 600; font-size: 15px; color: var(--accent); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-chap small { color: var(--muted); font-size: 12.5px; }
.ls-scrub { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 2px 0 -8px; background: transparent; cursor: pointer; --p: 0%; }
.ls-scrub::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) var(--p), var(--line) var(--p)); }
.ls-scrub::-moz-range-track { height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--accent) var(--p), var(--line) var(--p)); }
.ls-scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.ls-scrub::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.ls-scrub:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.ls-times { width: 100%; display: flex; justify-content: space-between; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ls-ctrls { display: flex; align-items: center; justify-content: center; gap: clamp(4px, 3vw, 18px); width: 100%; margin-top: 2px; }
.ls-ctrls button { border: 0; background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.ls-ch { width: 44px; height: 44px; border-radius: 12px; }
.ls-ch:disabled { opacity: .35; cursor: default; }
.ls-skip { position: relative; width: 56px; height: 56px; border-radius: 50%; }
.ls-skip span { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); font-size: 10px; font-weight: 700; text-align: center; line-height: 1; letter-spacing: -.02em; }
.ls-ch:hover:not(:disabled), .ls-skip:hover { background: var(--line-soft); }
.ls-ctrls .ls-play { width: 76px; height: 76px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 35%, transparent); }
.ls-play:hover { filter: brightness(1.06); }
.ls-play.busy { animation: ls-pulse 1.2s ease-in-out infinite; }
@keyframes ls-pulse { 50% { opacity: .7; } }
.ls-opts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; width: 100%; }
.ls-opt { border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; border-radius: 999px; min-height: 40px; padding: 0 14px;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-variant-numeric: tabular-nums; }
.ls-opt:hover { background: var(--line-soft); }
.ls-opt.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.ls-left { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.ls-msg { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.ls-msg p { margin: 0; color: var(--ink); }
.ls-pill { border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; padding: 10px 18px; cursor: pointer; }
:where(.ls, .ls-mini) button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* chapters, speed and sleep come up from the bottom of the player */
.ls-sheetwrap { position: absolute; inset: 0; z-index: 2; }
.ls-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.ls-sheet { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px; max-height: 76%; display: flex; flex-direction: column; background: var(--surface); color: var(--ink);
  border-radius: 20px 20px 0 0; box-shadow: 0 -12px 40px rgba(0,0,0,.2); padding-bottom: env(safe-area-inset-bottom, 0px); animation: ls-up .18s ease-out; }
@keyframes ls-up { from { transform: translateY(30px); opacity: 0; } }
.ls-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 20px; border-bottom: 1px solid var(--line-soft); }
.ls-sheet-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.ls-sheet-list { overflow-y: auto; overscroll-behavior: contain; padding: 6px 8px 12px; }
.ls-row { width: 100%; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.ls-row:hover { background: var(--line-soft); }
.ls-row-t { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ls-row-r { flex: none; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.ls-row[aria-current="true"] { background: var(--accent-soft); }
.ls-row[aria-current="true"] .ls-row-t { color: var(--accent); font-weight: 600; }

/* the little bar while you look around the app */
.ls-mini { position: fixed; z-index: 21; left: max(10px, env(safe-area-inset-left, 0px)); right: max(10px, env(safe-area-inset-right, 0px)); bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  max-width: 540px; margin: 0 auto; display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 6px; border-radius: 16px; overflow: hidden;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(27,26,23,.16); }
.ls-mini[hidden] { display: none; }
.ls-mini-line { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--line-soft); }
.ls-mini-line i { display: block; height: 100%; width: 0; background: var(--accent); }
.ls-mini-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; padding: 0; cursor: pointer; border-radius: 10px; }
.ls-mini-open img { flex: none; width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--hero); }
.ls-mini-txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ls-mini-txt b, .ls-mini-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-mini-txt b { font-weight: 600; font-size: 14px; }
.ls-mini-txt small { color: var(--muted); font-size: 12.5px; }
.ls-mini-btn { flex: none; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.ls-mini-btn:hover { background: var(--line-soft); }
body.ls-has-mini .app { padding-bottom: calc(170px + env(safe-area-inset-bottom, 0px)); }
body.desk .ls-mini { left: auto; right: 24px; bottom: 20px; width: 380px; margin: 0; }
body.desk.ls-has-mini .app { padding-bottom: 120px; }
body.reading .ls-mini, body.listening .ls-mini, body.signedout .ls-mini { display: none; }

/* on a wide screen, the cover beside the controls */
@media (min-width: 900px) and (min-height: 560px) {
  .ls-main { max-width: 920px; display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 420px); justify-content: center; align-content: center; column-gap: 56px; row-gap: 14px; min-height: 100%; }
  .ls-art { grid-column: 1; grid-row: 1 / span 8; width: min(400px, 60vh); align-self: center; }
  .ls-main > :not(.ls-art) { grid-column: 2; justify-self: center; }
  .ls-main > .ls-scrub, .ls-main > .ls-times, .ls-main > .ls-ctrls, .ls-main > .ls-opts { justify-self: stretch; }
}
@media (prefers-reduced-motion: reduce) { .ls-sheet, .ls-play.busy { animation: none; } }

/* Home: Continue listening, a row of cards that open the player where you left off */
.cl-row { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }
.cl-row::-webkit-scrollbar { display: none; }
.cl-item { flex: none; width: min(320px, calc(100vw - 64px)); display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; color: var(--ink); }
.cl-txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cl-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-p { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.cl-go { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.cl-go svg { margin-left: 2px; }
.cover img.sq { object-fit: contain; background: var(--cb, #3D3A35); }
body.desk .cl-item { width: 340px; }
.ls:focus { outline: none; }

/* bookmarks */
.ls-mrow { display: flex; align-items: center; gap: 2px; }
.ls-mrow .ls-row { flex: 1; min-width: 0; }
.ls-mx { color: var(--muted); }
.ls-addmark { color: var(--accent); font-weight: 600; }
.ls-status { margin: 8px 12px; color: var(--muted); font-size: 14px; }
.ls-toast { position: absolute; z-index: 3; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 8px); max-width: calc(100% - 32px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; text-align: center; }
.ls-toast.on { opacity: 1; transform: translate(-50%, 0); }
/* with a sheet open, messages show at the top so they never cover the list */
.ls-sheetwrap:not([hidden]) ~ .ls-toast { bottom: auto; top: calc(16px + env(safe-area-inset-top, 0px)); }
