/* player-kit — chrome styles.
 *
 * Extracted from Haven's stylesheet: the inline player bar (.hp-bar), the
 * docked mini-player, the read-aloud bar (.tts-*), the queue panel and the
 * read-along highlight. The full-screen "Now Playing" view lives in
 * kit/ui/player-shell.css now (.ps) -- this file used to carry its own
 * (.hp-full/.tts-full, retired once the shell covered every kind these two
 * engines play).
 *
 * Theming is entirely through custom properties, so the kit inherits its host's
 * palette instead of imposing one. The values below are the defaults you get if
 * the host defines nothing — Haven's own tokens, which is also why a host
 * already carrying Haven's design system needs to change nothing at all.
 *
 * To retheme, redefine any of these on :root AFTER importing this file:
 *
 *   Surfaces      --color-bg  --color-surface  --color-surface-2
 *                 --color-surface-offset
 *   Text          --color-text  --color-text-soft  --color-text-faint
 *   Accents       --color-primary  --color-primary-highlight
 *                 --color-secondary  --color-gold
 *   Lines         --color-border  --color-divider
 *   Dark-glass    --hpf-text  --hpf-text-dim  --hpf-accent  --hpf-line
 *   surfaces      --hpf-glass  --hpf-glass-strong  --hpf-glass-dark
 *                 (the read-aloud text panel's own always-dark palette)
 *   Metrics       --radius-sm|md|lg|xl|full  --space-2..6  --transition
 *
 * The mini-player docks above whatever bottom navigation the host has; give it
 * room with --pk-dock-bottom (default 0).
 */
:root {
  /* Surfaces and text */
  --color-bg: #f9f7f3;
  --color-surface: #ffffff;
  --color-surface-2: #f4f1ec;
  --color-surface-offset: #ede9e2;
  --color-text: #1c1810;
  --color-text-faint: #756b5e;
  --color-border: #cdc8be;
  --color-divider: #d9d4cb;

  /* Accents */
  --color-primary: #8b6914;
  /* The same accent where it is TEXT rather than a fill. Separate because an
   * accent bright enough to be a good button is not dark enough to read on
   * paper — the host's light theme sets these to different values for exactly
   * that reason. The kit's own default is already dark, so here they match. */
  --color-primary-text: #8b6914;
  --color-primary-highlight: #ede0c4;
  --color-secondary: #2c3e6b;
  --color-gold: #c9981a;
  --color-incense: #7c5c8c;
  --color-error: #9b2c2c;

  /* The read-aloud text panel (.tts-text-panel) keeps its own dark glass
   * palette regardless of the surrounding app theme, the same design
   * language the old .hp-full/.tts-full full players used before the
   * unified shell (kit/ui/player-shell.css) replaced them. */
  --hpf-text: #f5efe0;
  --hpf-text-dim: #dcd6c8;
  --hpf-accent: var(--color-gold, #c9981a);
  --hpf-line: rgba(245, 239, 224, 0.16);
  --hpf-glass: rgba(245, 239, 224, 0.08);
  --hpf-glass-strong: rgba(245, 239, 224, 0.15);
  --hpf-glass-dark: rgba(8, 9, 16, 0.68);

  /* Metrics */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  /* The shared corner for every control in this stylesheet (24 uses below).
   * It has to live here, not only in the host's app.css: an undefined custom
   * property makes `border-radius: var(--btn-radius)` an INVALID declaration,
   * which is dropped outright rather than falling back to any inherited or
   * cascaded value — so a standalone consumer of the kit got square corners on
   * every button with nothing in the CSS to point at. The host still overrides
   * it: app.css loads after this file (see the comment in app.html) and both
   * declarations sit on :root, so the later one wins. */
  --btn-radius: 10px;

  /* Stacking layers. Same reasoning as --btn-radius above, with a worse
   * failure: `z-index: var(--z-undefined)` is an invalid declaration, so it
   * doesn't fall back to a number — it falls back to `z-index: auto`, which
   * takes the element out of the stacking order entirely. Standalone, that put
   * action sheets under the player, dropdowns under the content they belong
   * to, and toasts behind everything. Every layer the kit uses is defined
   * here (player.css is the file consumers load; ambience.css and chat.css
   * reference --z-toast and --z-player-sheet from this same :root).
   * The host's app.css carries the full map and overrides these by load
   * order — keep the two in step if a layer is renumbered. */
  --z-base: 0;
  --z-content: 1;
  --z-dropdown: 10;
  --z-player-ctrl: 30;
  --z-tabs: 70;
  --z-modal: 100;
  --z-overlay-sheet: 1000;
  --z-tts-mini: 1002; /* above the mini bar's own dock layer */
  --z-player-sheet: 1100;
  --z-player-sheet-high: 1150;
  --z-toast: 1200; /* top of the stack */

  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --font-display: 'EB Garamond', Georgia, serif;

  /* How far above the viewport bottom the mini-player docks — set this to your
   * bottom nav's height so the dock does not cover it. */
  --pk-dock-bottom: 0px;
}

/* ── The queue panel (kit/stores/queue.js renders into this) ─────────────── */

#pk-queue-panel {
  position: fixed;
  inset: 0;
  /* Sheet layer, not the dock layer. This panel opens from the unified
     player shell (.ps) as well as from the mini bar, so at --z-player-bar
     it rendered *underneath* the player and looked like a dead button. Any
     panel reachable from the full player belongs at or above
     --z-player-sheet — the same fix #pk-pc-panel already carries. */
  z-index: var(--z-player-sheet);
  background: rgba(8, 9, 16, 0.55);
  display: flex;
  align-items: flex-end;
  /* Lift the sheet above whatever docks at the bottom of the host — the nav
     (--pk-dock-bottom) plus the mini-player when one is showing (--pk-player-h,
     set by the body:has(.hp-mini) rule below, only while visible) — so the list
     sits above the highest of them rather than covering it. max() keeps it clear
     of the safe area in a host with no dock at all, where both vars are 0. */
  padding-bottom: max(
    env(safe-area-inset-bottom, 0px),
    calc(var(--pk-dock-bottom, 0px) + var(--pk-player-h, 0px))
  );
}
#pk-queue-panel[hidden] {
  display: none;
}
.pk-queue-inner {
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--color-surface);
  color: var(--color-text);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  padding: var(--space-4);
  /* Bottom spacing has ONE owner: #pk-queue-panel's padding positions this
     sheet clear of the dock (and of the safe area when there is no dock), so
     adding env(safe-area-inset-bottom) here too would count it twice. */
  padding-bottom: var(--space-6);
}
.pk-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}
.pk-queue-title {
  font-weight: 600;
}
.pk-queue-close,
.pk-upnext-row button,
.pk-upnext-head button {
  background: none;
  border: 0;
  color: var(--color-text-faint);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
}
.pk-queue-close:hover,
.pk-upnext-row button:hover {
  color: var(--color-text);
}
.pk-queue-empty {
  color: var(--color-text-faint);
  font-size: 0.9rem;
  margin: 0;
}
.pk-upnext {
  margin-top: var(--space-4);
}
.pk-upnext-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-faint);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider);
}
.pk-upnext-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-divider);
}
.pk-upnext-title {
  flex: 1;
  min-width: 0;
}
.pk-upnext-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.pk-upnext-actions button:disabled {
  opacity: 0.35;
  cursor: default;
}
.pk-upnext-title > div:first-child {
  display: flex;
  align-items: center;
  gap: 0.4em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pk-queue-show,
.pk-queue-note {
  font-size: 0.8rem;
  color: var(--color-text-faint);
}
/* A video in a listening queue is worth calling out — it needs the screen. */
.pk-upnext-video {
  background: var(--color-primary-highlight);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  border-bottom: 0;
}
.pk-upnext-video button {
  color: var(--color-secondary);
  font-weight: 600;
}

.listen-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-primary-text);
  border-radius: var(--btn-radius);
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition:
    background var(--transition),
    border-color var(--transition);
}

.listen-btn:hover {
  background: var(--color-surface-offset);
}

.listen-btn.is-playing {
  background: var(--color-primary-highlight);
  border-color: var(--color-primary);
}

.listen-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary-text);
}

.listen-icon svg {
  display: block;
}

.tts-mini .hp-mini-art svg {
  color: var(--color-primary-text);
}

.no-tts .listen-btn {
  display: none;
}

/* Listen tab hero: resume the last played (or currently playing) item */
.listen-hero {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: 0 var(--space-4) var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.listen-hero:active {
  transform: scale(0.985);
}

.listen-hero:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.listen-hero-art {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--color-surface-offset);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
}

.listen-hero-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.listen-hero-info {
  flex: 1;
  min-width: 0;
}

.listen-hero-eyebrow {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary-text);
  font-weight: 700;
  margin-bottom: 3px;
}

.listen-hero-title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.listen-hero-sub {
  font-size: 12px;
  color: var(--color-text-faint);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listen-hero-play {
  width: 44px;
  height: 44px;
  border-radius: var(--btn-radius);
  background: var(--color-primary);
  color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.author-player .hp-bar {
  margin-left: 0;
  margin-right: 0;
}

/* ── Haven podcast player (reusable, in-app) ──────────────────────── */
.hp-bar {
  position: relative;
  margin: 0 var(--space-4) var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  text-decoration: none;
  display: block;
}

.hp-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.hp-head-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.hp-expand {
  flex-shrink: 0;
  color: var(--color-text-faint);
  display: flex;
  align-items: center;
}

.hp-head-main:hover .hp-expand {
  color: var(--color-primary-text);
}

.hp-head-main:hover .hp-title {
  color: var(--color-primary-text);
}

.hp-art {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.hp-art-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--color-surface-2);
}

.hp-info {
  flex: 1;
  min-width: 0;
}

.hp-title {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

a.hp-title:hover {
  color: var(--color-primary-text);
}

.hp-sub {
  font-size: 11px;
  color: var(--color-text-faint);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hp-loading .hp-title {
  color: var(--color-text-faint);
}

/* speed badge — opens the 0.1-increment popover */
.hp-speed {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-faint);
  background: var(--color-surface-2);
  border: none;
  border-radius: var(--btn-radius);
  padding: 4px 9px;
  cursor: pointer;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  transition:
    color 0.15s,
    background 0.15s;
}

.hp-speed:hover {
  color: var(--color-primary-text);
}

.hp-speed.hp-speed-on {
  color: #fff;
  background: var(--color-primary);
}

.hp-progress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding: 0 2px;
}

.hp-seek {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-divider);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}

.hp-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-primary);
  border: none;
  cursor: pointer;
}

.hp-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-primary);
  border: none;
  cursor: pointer;
}

.hp-seek:disabled {
  opacity: 0.4;
  cursor: default;
}

.hp-time {
  font-size: 10px;
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: center;
  flex-shrink: 0;
}

/* transport row: −10s · play · +10s, centred */
.hp-transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  margin-top: var(--space-2);
  padding: 2px 0;
}

.hp-skip {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-soft, var(--color-text));
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--btn-radius);
  transition:
    color 0.15s,
    background 0.15s;
  padding: 0;
}

.hp-skip:hover {
  color: var(--color-primary-text);
  background: var(--color-surface-2);
}

.hp-skip:disabled {
  opacity: 0.28;
  cursor: default;
}

.hp-skip:disabled:hover {
  background: none;
}

.hp-skip svg {
  display: block;
}

.hp-play {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--btn-radius);
  cursor: pointer;
  background: var(--color-primary);
  /* Dark on the accent, not white: the accent is a light amber in the app
   * that mounts this kit, where white text on it is 2.12:1. Reads correctly
   * on the kit's own darker default too. */
  color: #12161f;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.15s,
    transform 0.1s;
}

.hp-play:hover {
  opacity: 0.9;
}

.hp-play:active {
  transform: scale(0.94);
}

.hp-play:disabled {
  opacity: 0.5;
  cursor: default;
}

/* speed popover */
.hp-pop {
  position: absolute;
  right: var(--space-3);
  top: calc(var(--space-3) + 30px);
  z-index: var(--z-player-ctrl);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  padding: var(--space-3);
  min-width: 178px;
}

.hp-pop[hidden] {
  display: none;
}

.hp-pop-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  margin-bottom: var(--space-2);
  text-align: center;
}

.hp-pop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.hp-pop-step {
  width: 34px;
  height: 34px;
  border: 1px solid var(--color-divider);
  background: var(--color-surface-2);
  color: var(--color-text);
  border-radius: var(--btn-radius);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hp-pop-step:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-text);
}

.hp-pop-val {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  min-width: 56px;
  text-align: center;
}

.hp-pop-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-3);
  justify-content: center;
}

.hp-pop-chip {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-faint);
  background: var(--color-surface-2);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: 3px 9px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.hp-pop-chip:hover {
  color: var(--color-primary-text);
}

.hp-pop-chip.hp-chip-on {
  color: #fff;
  background: var(--color-primary);
}

/* ── Persistent mini-player (docks above the bottom nav, survives nav) ─ */
.hp-mini {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  position: relative;
  z-index: var(--z-dropdown);
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  padding: var(--space-2) var(--space-3);
}

.hp-mini[hidden] {
  display: none;
}

.hp-mini-prog {
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-divider);
}

.hp-mini-prog-fill {
  height: 100%;
  width: 0;
  background: var(--color-primary);
  transition: width 0.25s linear;
}

.hp-mini-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
  font-family: inherit;
}

.hp-mini-art {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  overflow: hidden;
}

.hp-mini-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hp-mini-info {
  flex: 1;
  min-width: 0;
}

.hp-mini-queue-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--color-primary);
  border-radius: var(--btn-radius);
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.4;
}

.hp-mini-queue-badge[hidden] {
  display: none;
}

.hp-mini-queue-badge:hover {
  filter: brightness(1.08);
}

/* Title wrap is the fixed-width, clipped viewport; the title itself is an
   inline-block whose transform the marquee (Web Animations API, see
   HP._syncMiniMarquee) slides left and back within it. Only animated when the
   text actually overflows — a short title just sits still. */
.hp-mini-title-wrap {
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}

.hp-mini-title {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}

.hp-mini-sub {
  font-size: 11px;
  color: var(--color-text-faint);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hp-mini-back,
.hp-mini-fwd {
  width: 30px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hp-mini-back svg,
.hp-mini-fwd svg {
  width: 18px;
  height: 18px;
}

.hp-mini-back:hover,
.hp-mini-fwd:hover {
  color: var(--color-primary-text);
}

.hp-mini-back:disabled,
.hp-mini-fwd:disabled {
  opacity: 0.35;
  cursor: default;
}

.hp-mini-back:disabled:hover,
.hp-mini-fwd:disabled:hover {
  color: var(--color-text-faint);
}

.hp-mini-play {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--btn-radius);
  cursor: pointer;
  background: var(--color-primary);
  /* Dark on the accent, not white: the accent is a light amber in the app
   * that mounts this kit, where white text on it is 2.12:1. Reads correctly
   * on the kit's own darker default too. */
  color: #12161f;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hp-mini-close {
  width: 30px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-faint);
  font-size: 20px;
  line-height: 1;
}

.hp-mini-close:hover {
  color: var(--color-text);
}

.hp-mini-speed {
  flex-shrink: 0;
  min-width: 36px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-faint);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hp-mini-speed:hover {
  color: var(--color-primary-text);
}

.hp-mini-speed.hp-speed-on {
  color: #fff;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
}

.tts-mini .tts-speed-pop {
  bottom: calc(100% + 6px);
  top: auto;
  right: var(--space-2);
}

.hp-mini-voice {
  flex-shrink: 0;
  width: 34px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-faint);
  font-size: 15px;
  line-height: 1;
}

.hp-mini-voice[hidden] {
  display: none;
}

.hp-mini-voice:hover {
  color: var(--color-primary-text);
}

.hp-mini-skip {
  flex-shrink: 0;
  width: 34px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-faint);
  font-size: 15px;
  line-height: 1;
}

.hp-mini-skip[hidden] {
  display: none;
}

.hp-mini-skip:hover {
  color: var(--color-primary-text);
}

.hp-mini-expand {
  flex-shrink: 0;
  width: 34px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-faint);
  font-size: 14px;
  line-height: 1;
}

.hp-mini-expand:hover {
  color: var(--color-primary-text);
}

/* ── Background Sounds — persistent mini bar (mirrors .hp-mini) ──── */
.snd-mini {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  position: relative;
  z-index: var(--z-dropdown);
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  padding: var(--space-2) var(--space-3);
}

.hp-mini-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── TTS text follow-along panel ──────────────────────────────────────── */
/* Like the podcast Transcript sheet: a scrollable text overlay showing the
   article/book text with the ReadAlong highlight. Not currently wired to a
   trigger in kit/ui/player-shell.js's extras strip (its own "Read along" tab
   entry is deliberately absent from HAS there) -- kept because the panel and
   its ReadAlong integration are real, working code; only the button that used
   to open it (the retired .tts-full's Text button) is gone. */
.tts-text-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* Stop short of the mini bar's own strip. The mini bar docks above
     --pk-dock-bottom (host bottom nav, e.g. the tabbar), so the panel
     must clear dock + player height + safe-area. z-index alone doesn't
     uncover the mini bar: this panel sits above it (1002 vs 70) regardless,
     so unless the panel's box itself ends before that strip, it still
     paints over the mini bar's own controls. */
  bottom: calc(
    var(--pk-dock-bottom, 0px) + var(--pk-player-h, 58px) + env(safe-area-inset-bottom, 0px)
  );
  z-index: var(--z-tts-mini);
  background: rgba(8, 9, 16, 0.96);
  display: flex;
  flex-direction: column;
  animation: tts-text-panel-in 0.2s ease-out;
}

[data-theme='light'] .tts-text-panel {
  background: rgba(240, 235, 224, 0.97);
}

@keyframes tts-text-panel-in {
  from {
    transform: translateY(30%);
    opacity: 0.5;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tts-text-panel {
    animation: none;
  }
}

.tts-text-panel[hidden] {
  display: none;
}

.tts-text-panel-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.tts-text-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  flex-shrink: 0;
}

.tts-text-panel-close {
  width: 44px;
  height: 44px;
  border: 1px solid var(--hpf-line);
  background: var(--hpf-glass);
  border-radius: var(--btn-radius);
  color: var(--hpf-text);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tts-text-panel-close:hover {
  background: var(--hpf-glass-strong);
}

.tts-text-panel-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hpf-text-dim);
}

.tts-text-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 40px;
  font-size: 16px;
  line-height: 1.7;
  color: var(--hpf-text);
  -webkit-overflow-scrolling: touch;
}

.tts-text-panel-body .reader-para {
  margin: 0 0 1em;
  cursor: text;
}

.tts-text-panel:focus-visible,
.tts-text-panel-close:focus-visible {
  outline: 2px solid var(--hpf-accent);
  outline-offset: 2px;
}

/* Chapter-list sheet rows: number + title. */
.tts-chap-list .voice-pick-name {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.tts-chap-n {
  flex-shrink: 0;
  min-width: 1.6em;
  text-align: right;
  color: var(--color-text-faint);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

/* ── Read-aloud voice picker (bottom sheet) ────────────────────── */
#voice-picker,
.tts-sheet {
  position: fixed;
  inset: 0;
  z-index: var(--z-player-sheet);
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

#voice-picker[hidden],
.tts-sheet[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  /* Suppress the redesigned podcast/player hover & press feedback for users
     who asked for reduced motion (transform:scale presses, color/shadow fades). */
  .pod-primary,
  .pod-secondary,
  .pod-sub-btn,
  .seg,
  .ep-row {
    transition: none;
  }
  .pod-primary:active {
    transform: none;
  }
}

/* Read-along: soft tint on the sentence currently being spoken (CSS Custom
   Highlight API — see ReadAlong). Static per-theme colors: var()/color-mix
   inside ::highlight() isn't
  reliably
  supported
  across
  engines
  yet,
and
  a
  failed
  var()
  would
  kill
  the
  highlight
  outright
  rather
  than
  fall
  back.
  */
::highlight(pk-read) {
  background-color: rgba(139, 105, 20, 0.13);
}

[data-theme='dark'] *::highlight(pk-read) {
  background-color: rgba(200, 168, 74, 0.18);
}

[data-theme='dark'][data-scheme='warm'] *::highlight(pk-read) {
  background-color: rgba(232, 200, 88, 0.18);
}

[data-theme='dark'][data-scheme='slate'] *::highlight(pk-read) {
  background-color: rgba(121, 192, 255, 0.15);
}

[data-theme='dark'][data-season='advent'] *::highlight(pk-read),
[data-theme='dark'][data-season='lent'] *::highlight(pk-read) {
  background-color: rgba(176, 128, 232, 0.17);
}

[data-theme='dark'][data-season='easter'] *::highlight(pk-read),
[data-theme='dark'][data-season='christmas'] *::highlight(pk-read) {
  background-color: rgba(232, 200, 88, 0.18);
}

.no-tts .cf-playbar {
  display: none;
}

.ep-star svg,
.ep-mark svg,
.ep-addpl svg,
.ep-ai svg,
.swipe-more svg,
.vault-star svg,
.prayer-item-icon svg,
.starred-ep-play svg,
.starred-ep-unstar svg,
.pl-ep-move svg,
.hp-mini-art svg,
.show-art-ph svg,
.hp-expand svg,
.starred-empty-icon svg {
  display: block;
  margin: auto;
}

/* ── "Up Next" manual queue strip (Play Next / Play Last) ────────────── */
.hp-upnext {
  margin: var(--space-2) 0 var(--space-3);
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.hp-upnext-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hp-upnext-head button {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-primary-text);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.hp-upnext-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-3);
  border-top: 1px solid var(--color-divider);
}

.hp-upnext-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hp-upnext-row button {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-faint);
  font-size: 13px;
  padding: 0;
}

.hp-upnext-row button:hover {
  color: var(--color-error, #e04545);
}

/* ── Docking ──────────────────────────────────────────────────────────────
 *
 * The extracted rules leave the mini-players `position: relative`, because in
 * Haven they are flex children of a fixed-height app shell and dock above its
 * bottom nav by virtue of that layout. A host without such a shell gets them
 * appended to <body> instead — which in a long document (a book chapter is very
 * long) puts the playback controls thousands of pixels below the fold: audible,
 * but unreachable.
 *
 * So the kit docks itself by default. A host whose own layout already places
 * them sets --pk-dock-position to `relative` to opt out; Haven is such a host.
 * --pk-dock-bottom is how much room to leave underneath — set it to the height
 * of your bottom navigation. --pk-dock-left is the same thing for a host whose
 * navigation is a side rail rather than a bottom bar: without it the bar runs
 * underneath the sidebar and its first control is unclickable.
 */
:root {
  --pk-dock-position: fixed;
}

.hp-mini,
.tts-mini,
.snd-mini {
  position: var(--pk-dock-position);
  left: var(--pk-dock-left, 0px);
  right: 0;
  bottom: calc(var(--pk-dock-bottom, 0px) + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-tabs);
}

/* Ambience and a player bar can be docked at once — that is the point of
 * ambience — so the ambience bar sits ABOVE whichever player bar is showing
 * rather than on top of it. --pk-player-h is set only while one is visible, so
 * with nothing playing the ambience bar sits flush at the bottom. */
body:has(.tts-mini:not([hidden])),
body:has(.hp-mini:not([hidden])) {
  --pk-player-h: var(--mini-h, 58px);
}

.snd-mini {
  bottom: calc(
    var(--pk-dock-bottom, 0px) + var(--pk-player-h, 0px) + env(safe-area-inset-bottom, 0px)
  );
  z-index: var(--z-tabs);
}

/* ── Chapters and transcript (kit/ui/podcast-panel.js) ────────────────────
   Same sheet shape as the queue panel, because it is the same gesture: a thing
   that slides up over what you are listening to and goes away again. */

#pk-pc-panel {
  position: fixed;
  inset: 0;
  /* Above the unified player shell (.ps, 1005) — this panel opens from it
     too, and must sit over it rather than under it. */
  z-index: var(--z-player-sheet);
  background: rgba(8, 9, 16, 0.55);
  display: flex;
  align-items: flex-end;
}
#pk-pc-panel[hidden] {
  display: none;
}
.pk-pc-inner {
  width: 100%;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  color: var(--color-text);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  padding: var(--space-4);
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  transition: max-height 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}
/* Opened from the full-screen player: a true half-screen list, so the art
   above it stays visible instead of being buried under a near-full sheet. */
#pk-pc-panel.pk-pc-compact .pk-pc-inner {
  max-height: 50vh;
}
.pk-pc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  /* The drag handle for _wireSwipeExpand — without this, a vertical drag here
   * also tries to scroll/refresh the page underneath on touch devices. */
  touch-action: none;
}
/* Swiped up (_wireSwipeExpand). The compact rule above carries an ID selector
 * (#pk-pc-panel.pk-pc-compact .pk-pc-inner), so a plain .pk-pc-full class
 * alone can never outrank it on specificity regardless of source order — this
 * has to repeat the ID to actually win when both compact and full apply. */
.pk-pc-inner.pk-pc-full,
#pk-pc-panel.pk-pc-compact .pk-pc-inner.pk-pc-full {
  max-height: 94vh;
}
.pk-pc-tabs {
  display: flex;
  gap: var(--space-2);
}
.pk-pc-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  padding: 0.4em 0.8em;
  border-radius: var(--btn-radius);
  border: 1px solid var(--color-border);
  background: none;
  color: var(--color-text-faint);
}
.pk-pc-tabs button[aria-selected='true'] {
  background: var(--color-surface-2);
  border-color: var(--color-primary);
  color: var(--color-text);
}
.pk-pc-tabs svg {
  display: block;
}
.pk-pc-close {
  background: none;
  border: 0;
  color: var(--color-text-faint);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
}
.pk-pc-close:hover {
  color: var(--color-text);
}
.pk-pc-tools {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.pk-pc-tools[hidden] {
  display: none;
}
.pk-pc-find {
  flex: 1;
  font: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.45em 0.7em;
}
.pk-pc-follow {
  /* A sibling of .pk-pc-tools, not a child — .pk-pc-tools is transcript-only
   * (the find box), but follow mode applies to both tabs (see tick() in
   * podcast-panel.js), so it must not be hidden by the tab-scoped toggle.
   * align-self here is what keeps it a small pill in the top-right of its own
   * row rather than a full-width button, now that it's not riding alongside
   * .pk-pc-find's flex:1 to get pushed there. */
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  padding: 0.45em 0.75em;
  margin-bottom: var(--space-2);
  border-radius: var(--btn-radius);
  border: 1px solid var(--color-primary);
  background: none;
  color: var(--color-primary-text);
}
.pk-pc-follow[hidden] {
  display: none;
}
.pk-pc-body {
  overflow-y: auto;
  /* Momentum scrolling here matters more than usual: a transcript is the one
     list in this app that can be thousands of rows long. */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
/* A transcript cue and its share button — two sibling buttons, since a row
 * that seeks on tap can't itself also contain a nested share button. */
.pk-pc-cue-row {
  display: flex;
  align-items: flex-start;
}
.pk-pc-cue-row .pk-pc-row {
  flex: 1;
  min-width: 0;
}
.pk-pc-share {
  flex: none;
  align-self: center;
  background: none;
  border: 0;
  color: var(--color-text-faint);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
}
.pk-pc-share:hover {
  color: var(--color-text);
}
.pk-pc-bookmark {
  flex: none;
  align-self: center;
  background: none;
  border: 0;
  color: var(--color-text-faint);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
}
.pk-pc-bookmark:hover {
  color: var(--color-text);
}
.pk-pc-row {
  display: flex;
  gap: var(--space-3);
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  padding: 0.55em 0.5em;
  line-height: 1.5;
}
.pk-pc-row:hover {
  background: var(--color-surface-2);
}
.pk-pc-row.is-now {
  background: var(--color-primary-highlight);
}
.pk-pc-row.is-now .pk-pc-time {
  color: var(--color-primary-text);
}
.pk-pc-time {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
  color: var(--color-text-faint);
  padding-top: 0.15em;
  min-width: 3.4em;
}
.pk-pc-art {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  cursor: zoom-in;
}
.pk-pc-art-broken {
  display: none;
}

/* Full-size chapter art preview — tapped from .pk-pc-art above. */
#pk-pc-art-preview {
  position: fixed;
  inset: 0;
  /* Above #pk-pc-panel (1100) — this opens FROM that panel and must sit
   * over it, not under it (same reasoning as that panel's own comment about
   * sitting above the unified player shell). */
  z-index: var(--z-player-sheet-high);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  background: rgba(0, 0, 0, 0.82);
}
#pk-pc-art-preview[hidden] {
  display: none;
}
#pk-pc-art-preview img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.pk-pc-art-preview-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: rgba(0, 0, 0, 0.5);
  border: 0;
  color: #fff;
  border-radius: var(--btn-radius);
  padding: var(--space-2);
  cursor: pointer;
}
.pk-pc-text {
  min-width: 0;
}
.pk-pc-cue .pk-pc-text {
  font-size: 0.94rem;
}
.pk-pc-who {
  color: var(--color-secondary);
  font-weight: 600;
}
.pk-pc-note {
  color: var(--color-text-faint);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: var(--space-2) 0;
}
.pk-pc-src {
  border-left: 2px solid var(--color-border);
  padding-left: var(--space-3);
}
