/* MHP Player — inline episode player, sticky bar, phone mini bar and expanded sheet.
   Colours follow the site's Blocksy palette, like the atlas. */
.mhp-pl, .mhp-bar, .mhp-sheet, .mhp-bonus {
  --pl-bg: var(--theme-palette-color-8, #F9F7F2);
  --pl-surface: #fffdf8;
  --pl-ink: var(--theme-palette-color-5, #0F172A);
  --pl-muted: #566071;
  --pl-line: #e1dccd;
  --pl-grid: #eeeadf;
  --pl-accent: var(--theme-palette-color-1, #0F172A);
  --pl-accent-ink: var(--theme-palette-color-8, #F9F7F2);
  --pl-gold: #9a7535;
  --pl-shadow: 0 1px 2px rgba(15,23,42,.06), 0 10px 30px rgba(15,23,42,.06);
  /* the phone mini bar and the sheet are always dark */
  --pl-night: #0F172A;
  --pl-night-2: #1E293B;
  --pl-night-line: #334155;
  --pl-night-ink: #F9F7F2;
  --pl-night-muted: #a9b3c4;
  --pl-brass: #c5a059;
  font-family: inherit;
  line-height: 1.4;
  color: var(--pl-ink);
  box-sizing: border-box;
}
:root[data-color-mode="dark"] .mhp-pl, :root[data-color-mode="dark"] .mhp-bar,
:root[data-color-mode="dark"] .mhp-sheet, :root[data-color-mode="dark"] .mhp-bonus {
  --pl-bg: var(--theme-palette-color-8, #0F172A);
  --pl-surface: var(--theme-palette-color-7, #1E293B);
  --pl-ink: var(--theme-palette-color-5, #F9F7F2);
  --pl-muted: #a9b3c4;
  --pl-line: #334155;
  --pl-grid: #26334a;
  --pl-accent: var(--theme-palette-color-1, #c5a059);
  --pl-accent-ink: #0F172A;
  --pl-gold: #c5a059;
  --pl-shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 30px rgba(0,0,0,.3);
  --pl-night: #1E293B;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-color-mode="light"]):not([data-color-mode="dark"]) .mhp-pl,
  :root:not([data-color-mode="light"]):not([data-color-mode="dark"]) .mhp-bar,
  :root:not([data-color-mode="light"]):not([data-color-mode="dark"]) .mhp-sheet,
  :root:not([data-color-mode="light"]):not([data-color-mode="dark"]) .mhp-bonus {
    --pl-bg: var(--theme-palette-color-8, #0F172A);
    --pl-surface: var(--theme-palette-color-7, #1E293B);
    --pl-ink: var(--theme-palette-color-5, #F9F7F2);
    --pl-muted: #a9b3c4;
    --pl-line: #334155;
    --pl-grid: #26334a;
    --pl-accent: var(--theme-palette-color-1, #c5a059);
    --pl-accent-ink: #0F172A;
    --pl-gold: #c5a059;
    --pl-shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 30px rgba(0,0,0,.3);
    --pl-night: #1E293B;
  }
}
.mhp-pl *, .mhp-bar *, .mhp-sheet *, .mhp-bonus * { box-sizing: border-box; }
.mhp-pl button, .mhp-bar button, .mhp-sheet button {
  font: inherit; color: inherit; cursor: pointer; margin: 0; -webkit-tap-highlight-color: transparent;
}
.mhp-pl a, .mhp-bar a, .mhp-sheet a, .mhp-bonus a { text-decoration: none; }
.mhp-pl svg, .mhp-bar svg, .mhp-sheet svg, .mhp-bonus svg { display: block; flex: none; }
.mhp-pl :focus-visible, .mhp-bar :focus-visible, .mhp-sheet :focus-visible, .mhp-bonus:focus-visible {
  outline: 2px solid var(--pl-gold); outline-offset: 2px;
}

/* ---------- inline player ---------- */
.mhp-pl { container-type: inline-size; margin: 1.5em 0; }
.mhp-pl .pl-in {
  display: grid; align-items: center; gap: 16px 14px;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
  grid-template-areas:
    "cover play meta back fwd rate"
    "scrub scrub scrub scrub scrub scrub"
    "times times times times times times"
    "foot foot foot foot foot foot";
  background: var(--pl-surface); border: 1px solid var(--pl-line); border-radius: 14px;
  padding: 20px 22px; box-shadow: var(--pl-shadow);
}
.mhp-pl .pl-cover { grid-area: cover; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--pl-night); }
.mhp-pl .pl-cover img, .mhp-bar .pl-cover img, .mhp-sheet .pl-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-mono { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--pl-brass); font-size: 13px; letter-spacing: .12em; }
.mhp-pl .pl-play {
  grid-area: play; width: 60px; height: 60px; border-radius: 50%; border: 0; padding: 0;
  background: var(--pl-accent); color: var(--pl-accent-ink); display: flex; align-items: center; justify-content: center;
}
.mhp-pl .pl-meta { grid-area: meta; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.mhp-pl .pl-title { font-size: 18px; font-weight: 600; line-height: 1.3; }
.mhp-pl .pl-sub { font-size: 14px; color: var(--pl-muted); font-variant-numeric: tabular-nums; }
.mhp-pl .pl-btn {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--pl-line); padding: 0;
  background: var(--pl-bg); display: flex; align-items: center; justify-content: center;
}
.mhp-pl .pl-back { grid-area: back; } .mhp-pl .pl-fwd { grid-area: fwd; }
.mhp-pl .pl-rate { grid-area: rate; width: auto; min-width: 56px; padding: 0 12px; font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.mhp-pl .pl-more { grid-area: more; display: none; }
.mhp-pl .pl-btn:hover, .mhp-pl .pl-rate:hover { border-color: var(--pl-accent); }
.mhp-pl .pl-scrub { grid-area: scrub; }
.mhp-pl .pl-times { grid-area: times; margin-top: -10px; }
.mhp-pl .pl-foot {
  grid-area: foot; display: flex; justify-content: space-between; align-items: center; gap: 10px 20px; flex-wrap: wrap;
  padding-top: 12px; border-top: 1px solid var(--pl-grid); font-size: 14px;
}
.mhp-pl .pl-links { display: flex; gap: 8px 20px; flex-wrap: wrap; align-items: center; }
.mhp-pl .pl-links a, .mhp-pl .pl-links button { color: var(--pl-muted); background: none; border: 0; padding: 0; font-size: 14px; }
.mhp-pl .pl-links a:hover, .mhp-pl .pl-links button:hover { color: var(--pl-ink); }
.mhp-pl .pl-apps { color: var(--pl-muted); }
.mhp-pl .pl-apps a { color: var(--pl-muted); }
.mhp-pl .pl-tl { color: var(--pl-ink); font-weight: 600; }
.mhp-pl .pl-tl:hover { color: var(--pl-gold); }

/* scrubber (shared) */
.pl-scrub { position: relative; height: 22px; }
.pl-track { position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 2px; background: var(--pl-grid); }
.pl-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 2px; background: var(--pl-gold); }
.pl-tick { position: absolute; top: -3px; width: 2px; height: 10px; margin-left: -1px; background: var(--pl-muted); opacity: .5; }
.pl-knob {
  position: absolute; top: 50%; left: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  background: var(--pl-gold); border: 3px solid var(--pl-surface); box-shadow: 0 0 0 1px var(--pl-gold);
}
.pl-range {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; touch-action: none;
}
.pl-range:focus-visible + .pl-focus { position: absolute; inset: 2px -4px; border-radius: 8px; outline: 2px solid var(--pl-gold); }
.pl-times { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--pl-muted); font-variant-numeric: tabular-nums; }
.pl-chap { flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* phone-width inline player */
@container (max-width: 599px) {
  .mhp-pl .pl-in {
    padding: 16px; gap: 14px 8px;
    grid-template-columns: 56px minmax(0, 1fr) auto minmax(0, 1fr) 56px;
    grid-template-areas:
      "cover meta meta meta meta"
      "scrub scrub scrub scrub scrub"
      "times times times times times"
      "rate back play fwd more"
      "foot foot foot foot foot";
  }
  .mhp-pl .pl-cover { width: 56px; height: 56px; border-radius: 8px; }
  .mhp-pl .pl-cover .pl-mono { font-size: 9px; }
  .mhp-pl .pl-title { font-size: 16px; }
  .mhp-pl .pl-sub { font-size: 13px; }
  .mhp-pl .pl-play { width: 64px; height: 64px; }
  .mhp-pl .pl-back, .mhp-pl .pl-fwd { border: 0; background: none; }
  .mhp-pl .pl-back { justify-self: end; } .mhp-pl .pl-fwd { justify-self: start; }
  .mhp-pl .pl-rate { width: 56px; min-width: 0; padding: 0; }
  .mhp-pl .pl-more { display: flex; width: 56px; }
  .mhp-pl .pl-times { margin-top: -10px; font-size: 12px; }
  .mhp-pl .pl-links { display: none; width: 100%; }
  .mhp-pl.is-more .pl-links { display: flex; padding-bottom: 4px; }
  .mhp-pl .pl-foot { flex-direction: column; align-items: flex-start; }
}

/* ---------- bonus card ---------- */
.mhp-bonus {
  display: flex; gap: 14px; align-items: center; margin: 1em 0; padding: 12px 14px;
  border: 1px solid var(--pl-line); border-radius: 12px; background: var(--pl-bg); color: var(--pl-ink);
}
.mhp-bonus:hover { border-color: var(--pl-gold); color: var(--pl-ink); }
.mhp-bonus .pl-lock { width: 44px; height: 44px; border-radius: 8px; background: var(--pl-grid); display: flex; align-items: center; justify-content: center; flex: none; color: var(--pl-gold); }
.mhp-bonus .pl-bmeta { flex: 1; min-width: 0; }
.mhp-bonus small { display: block; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--pl-gold); font-weight: 600; }
.mhp-bonus .pl-btitle { font-size: 16px; }
.mhp-bonus .pl-cta { font-size: 14px; font-weight: 600; white-space: nowrap; }
@media (max-width: 599px) { .mhp-bonus .pl-cta-text { display: none; } }

/* ---------- sticky bar: desktop ---------- */
.mhp-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9990; height: 76px;
  display: flex; align-items: center; gap: 20px; padding: 0 28px;
  background: var(--pl-surface); border-top: 1px solid var(--pl-line); box-shadow: 0 -8px 24px rgba(15,23,42,.08);
  transform: translateY(110%); transition: transform .25s ease; visibility: hidden;
}
.mhp-bar.is-on { transform: none; visibility: visible; }
.mhp-bar .pl-prog { position: absolute; left: 0; right: 0; top: -1px; height: 3px; background: var(--pl-grid); }
.mhp-bar .pl-prog i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--pl-gold); }
.mhp-bar .pl-cover { width: 48px; height: 48px; border-radius: 8px; overflow: hidden; background: var(--pl-night); flex: none; }
.mhp-bar .pl-cover .pl-mono { font-size: 9px; }
.mhp-bar .pl-info {
  width: 300px; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left;
  border: 0; background: none; padding: 0; color: var(--pl-ink);
}
.mhp-bar .pl-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mhp-bar .pl-sub { font-size: 13px; color: var(--pl-muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mhp-bar .pl-mid { flex: 1; display: flex; justify-content: center; align-items: center; gap: 10px; }
.mhp-bar .pl-ic { width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; background: transparent; display: flex; align-items: center; justify-content: center; color: var(--pl-ink); }
.mhp-bar .pl-play { width: 48px; height: 48px; border-radius: 50%; border: 0; padding: 0; background: var(--pl-accent); color: var(--pl-accent-ink); display: flex; align-items: center; justify-content: center; }
.mhp-bar .pl-end { width: 300px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.mhp-bar .pl-chip {
  display: flex; align-items: center; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--pl-line);
  background: var(--pl-bg); color: var(--pl-ink); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.mhp-bar .pl-chip:hover { border-color: var(--pl-accent); }
.mhp-bar .pl-close { width: 36px; height: 36px; border-radius: 8px; border: 0; padding: 0; background: transparent; color: var(--pl-muted); display: flex; align-items: center; justify-content: center; }
.mhp-bar .pl-close:hover { color: var(--pl-ink); }
.mhp-bar .pl-ph { display: none; }

/* ---------- sticky bar: phone mini bar ---------- */
@media (max-width: 640px) {
  .mhp-bar {
    left: 8px; right: 8px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); height: 64px;
    gap: 10px; padding: 0 8px 0 10px; border: 0; border-radius: 14px; overflow: hidden;
    background: var(--pl-night); color: var(--pl-night-ink); box-shadow: 0 10px 30px rgba(15,23,42,.3);
    transform: translateY(140%);
  }
  .mhp-bar .pl-prog { top: auto; bottom: 0; background: rgba(249,247,242,.15); }
  .mhp-bar .pl-prog i { background: var(--pl-brass); }
  .mhp-bar .pl-cover { width: 44px; height: 44px; background: var(--pl-night-2); }
  .mhp-bar .pl-info { flex: 1; width: auto; color: var(--pl-night-ink); }
  .mhp-bar .pl-title { font-size: 14px; }
  .mhp-bar .pl-sub { font-size: 12px; color: var(--pl-night-muted); }
  .mhp-bar .pl-mid { flex: none; gap: 4px; }
  .mhp-bar .pl-ic { color: var(--pl-night-ink); }
  .mhp-bar .pl-fwd { display: none; }
  .mhp-bar .pl-play { width: 44px; height: 44px; background: var(--pl-brass); color: #0F172A; }
  .mhp-bar .pl-end { display: none; }
  .mhp-bar .pl-dk { display: none; }
  .mhp-bar .pl-ph { display: inline; }
}

/* ---------- expanded sheet (phone) ---------- */
.mhp-sheet {
  position: fixed; inset: 0; z-index: 9995; display: flex; flex-direction: column; justify-content: flex-end;
  background: rgba(11,19,36,.55); visibility: hidden; opacity: 0; transition: opacity .2s ease, visibility 0s linear .2s;
}
.mhp-sheet.is-on { visibility: visible; opacity: 1; transition: opacity .2s ease; }
.mhp-sheet .pl-panel {
  max-height: calc(100% - 40px); overflow: auto; background: var(--pl-night-2); color: var(--pl-night-ink);
  border-radius: 22px 22px 0 0; padding: 10px 22px calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 22px; transform: translateY(30px); transition: transform .25s ease;
  --pl-grid: #334155; --pl-gold: #c5a059; --pl-surface: #1E293B; --pl-muted: #a9b3c4;
}
.mhp-sheet.is-on .pl-panel { transform: none; }
.mhp-sheet .pl-grab { align-self: center; width: 64px; height: 28px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; padding: 0; }
.mhp-sheet .pl-grab span { display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--pl-night-line); }
.mhp-sheet .pl-cover {
  align-self: center; width: min(250px, 62vw); aspect-ratio: 1; border-radius: 16px; overflow: hidden;
  background: var(--pl-night); border: 1px solid var(--pl-night-line); box-shadow: 0 20px 40px rgba(0,0,0,.35);
}
.mhp-sheet .pl-cover .pl-mono { font-size: 18px; letter-spacing: .14em; }
.mhp-sheet .pl-head { text-align: center; display: flex; flex-direction: column; gap: 4px; }
.mhp-sheet .pl-kick { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--pl-brass); font-weight: 600; }
.mhp-sheet .pl-title { font-size: 26px; line-height: 1.2; }
.mhp-sheet .pl-chap2 { font-size: 14px; color: var(--pl-night-muted); min-height: 1.4em; }
.mhp-sheet .pl-times { color: var(--pl-night-muted); margin-top: -16px; }
.mhp-sheet .pl-knob { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.mhp-sheet .pl-ctl { display: flex; justify-content: center; align-items: center; gap: 26px; }
.mhp-sheet .pl-ic { width: 52px; height: 52px; border: 0; padding: 0; background: transparent; color: var(--pl-night-ink); display: flex; align-items: center; justify-content: center; }
.mhp-sheet .pl-play { width: 76px; height: 76px; border-radius: 50%; border: 0; padding: 0; background: var(--pl-brass); color: #0F172A; display: flex; align-items: center; justify-content: center; }
.mhp-sheet .pl-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mhp-sheet .pl-rate { height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--pl-night-line); background: transparent; color: var(--pl-night-ink); font-weight: 600; font-size: 14px; }
.mhp-sheet .pl-row a { color: var(--pl-brass); font-size: 14px; font-weight: 600; }
.mhp-sheet .pl-stop { border: 0; background: none; padding: 0; color: var(--pl-night-muted); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .mhp-bar, .mhp-sheet, .mhp-sheet .pl-panel { transition: none; }
}
body.mhp-has-bar { padding-bottom: var(--mhp-bar-pad, 0px); }

/* icon sizes */
.pl-i { width: 22px; height: 22px; }
.mhp-pl .pl-more .pl-i { width: 20px; height: 20px; }
.mhp-bar .pl-play .pl-i { width: 18px; height: 18px; }
.mhp-bar .pl-close .pl-i { width: 18px; height: 18px; }
.mhp-sheet .pl-ic .pl-i { width: 32px; height: 32px; }
.mhp-sheet .pl-play .pl-i { width: 26px; height: 26px; }
.mhp-bonus .pl-i { width: 20px; height: 20px; }
@container (max-width: 599px) {
  .mhp-pl .pl-back .pl-i, .mhp-pl .pl-fwd .pl-i { width: 26px; height: 26px; }
  .mhp-pl .pl-play .pl-i { width: 24px; height: 24px; }
}
.mhp-pl [hidden], .mhp-bar [hidden], .mhp-sheet [hidden] { display: none !important; }

/* cover placeholder stays visible on dark surfaces; bonus card is a plain link */
.mhp-pl .pl-cover, .mhp-bar .pl-cover { background: #0F172A; }
:root[data-color-mode="dark"] .mhp-pl .pl-cover { background: #0b1324; box-shadow: inset 0 0 0 1px var(--pl-line); }
:root[data-color-mode="dark"] .mhp-bar .pl-cover { background: #0b1324; }
@media (prefers-color-scheme: dark) {
  :root:not([data-color-mode="light"]):not([data-color-mode="dark"]) .mhp-pl .pl-cover { background: #0b1324; box-shadow: inset 0 0 0 1px var(--pl-line); }
}
@media (max-width: 640px) {
  :root[data-color-mode="dark"] .mhp-bar { box-shadow: 0 0 0 1px #334155, 0 10px 30px rgba(0,0,0,.4); }
}
a.mhp-bonus, a.mhp-bonus:hover, a.mhp-bonus * { text-decoration: none; }
