/* Player, 2026-10-18 design review (book.html + js/player.js).
   New rules only; loaded after style.css so they win ties. */

/* ── Locked chapter: compact header so the gate's button is on screen ── */
.book-hero-lockline { display: none; }
body.chapter-locked .book-hero {
  grid-template-columns: 44px minmax(0, 1fr); gap: 14px; align-items: center;
  justify-items: stretch; text-align: left;
  padding-top: 18px; padding-bottom: 16px;
}
body.chapter-locked .book-hero:has(.book-hero-cover.no-cover) { grid-template-columns: minmax(0, 1fr); }
body.chapter-locked .book-hero-cover:not(.no-cover) { display: block; }
body.chapter-locked .book-hero-cover img {
  width: 44px; border-radius: 3px;
  box-shadow: 0 4px 12px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.04);
}
body.chapter-locked .book-hero-eyebrow,
body.chapter-locked .book-hero-author,
body.chapter-locked .book-hero-meta,
body.chapter-locked .book-hero .book-about,
body.chapter-locked .book-hero-actions,
body.chapter-locked .book-hero .voice-picker { display: none; }
body.chapter-locked .book-hero-title { font-size: 1.12rem; line-height: 1.25; margin: 0 0 3px; letter-spacing: 0; }
body.chapter-locked .book-hero-lockline { display: block; font-size: .8rem; color: var(--text-3); }
/* The strip already says "Chapter 5 of 15". */
body.chapter-locked .chapter-kicker { display: none; }
body.chapter-locked .chapter-head { margin-top: 22px; }
body.chapter-locked .reader-chapter-title { padding-bottom: 12px; margin-bottom: 0; }
body.chapter-locked .chapter-meta:empty { display: none; }
body.chapter-locked .reading-progress { display: none !important; }
body.chapter-locked .chapter-text .sub-pw,
body.chapter-locked .chapter-text .acct-gate { margin-top: 18px; }
@media (max-width: 768px) {
  body.chapter-locked .book-hero { padding-top: 14px; padding-bottom: 12px; }
  body.chapter-locked .chapter-head { margin-top: 16px; }
  body.chapter-locked .reader-chapter-title { font-size: 1.3rem; }
  body.chapter-locked .chapter-text .sub-pw,
  body.chapter-locked .chapter-text .acct-gate { margin-top: 14px; }
}

/* ── "You're in" note after a sign-up from a gate ── */
.chapter-text .ch-joined {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 0 0 26px; padding: 13px 16px;
  border: 1px solid rgba(124, 180, 130, .32); background: rgba(124, 180, 130, .07);
  border-radius: 12px;
  font-family: var(--font-body, inherit); font-size: .95rem; line-height: 1.5; color: var(--text-2);
}
.chapter-text .ch-joined p { margin: 0; text-indent: 0; font-size: inherit; line-height: inherit; }
.chapter-text .ch-joined strong { color: var(--success, #7cb482); font-weight: 600; }
.ch-joined-icon {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  color: var(--success, #7cb482); background: rgba(124, 180, 130, .14);
}

/* ── Premium paywall additions (js/subscribe-flow.js paywallHTML) ── */
.sub-pw .sub-pw-login { font-size: .78rem; color: var(--text-3); margin-top: 8px; }
.sub-pw .sub-pw-note { font-size: .86rem; margin-top: 12px; }
.sub-pw-keep {
  margin: 18px 0 0; padding: 16px 18px;
  border: 1px dashed rgba(201, 162, 106, .38); border-radius: 12px;
}
.sub-pw .sub-pw-keep-h { font-family: var(--font-display); font-size: 1.08rem; line-height: 1.3; color: var(--text); }
.sub-pw .sub-pw-keep-sub { font-size: .86rem; color: var(--text-2); margin-top: 4px; }
.sub-pw-keep-btn { margin-top: 12px; border-radius: 999px; }

/* ── Chapter list: badge key, titles that wrap ── */
.ch-key {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px;
  padding: 10px 18px; border-bottom: 1px solid var(--border);
  font-size: .74rem; color: var(--text-3);
}
.ch-key[hidden] { display: none; }
.ch-key-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.ch-key-free b { color: var(--accent); font-weight: 600; font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; }
.ch-key-account svg { color: var(--accent); }
.ch-key svg { flex-shrink: 0; }
.ch-sheet-head { display: none; }

@media (min-width: 769px) {
  /* Two clamped lines instead of "The Adventure of the Blu…". */
  .chapter-item { align-items: flex-start; }
  .chapter-item .ch-title {
    white-space: normal; line-height: 1.32;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
  }
  .chapter-item .ch-num { line-height: 1.32rem; }
  .chapter-item .ch-badge, .chapter-item .ch-prog, .chapter-item .ch-status { margin-top: 2px; }
}

/* ── Phones and small tablets: the chapter list is a bottom sheet ── */
@media (max-width: 768px) {
  .sidebar,
  body.player-active .sidebar {
    position: fixed; left: 0; right: 0; top: auto; bottom: 0;
    width: auto; height: 78vh; height: 78dvh; max-height: calc(100% - 24px);
    border-right: 0; border-top: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
    z-index: 170;
    transform: translateY(100%); visibility: hidden;
    transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s .28s;
    box-shadow: 0 -14px 44px rgba(0, 0, 0, .55);
  }
  .sidebar.open,
  body.player-active .sidebar.open {
    left: 0; transform: none; visibility: visible;
    transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s;
  }
  .sidebar-overlay { top: 0; z-index: 165; background: rgba(0, 0, 0, .55); }
  html.ch-sheet-open, html.ch-sheet-open body { overflow: hidden; }
  html.ch-sheet-open .reader { overflow: hidden; overscroll-behavior: contain; }

  .ch-sheet-head {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    position: relative; padding: 22px 16px 6px 22px; flex-shrink: 0;
  }
  .ch-sheet-grabber {
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 40px; height: 4px; border-radius: 2px; background: var(--border-hi, rgba(255,255,255,.18));
  }
  .ch-sheet-title { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; margin: 0; color: var(--text); }
  .ch-sheet-close {
    width: 40px; height: 40px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); color: var(--text-2); background: transparent; cursor: pointer;
  }
  .ch-sheet-close:hover { color: var(--text); background: var(--surface-hi); }
  .ch-sheet-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  /* Count/length label repeats the hero; admin controls stay reachable. */
  .sidebar-header { padding: 0 22px; border-bottom: 0; }
  .sidebar-header .sidebar-label { display: none; }
  .ch-key { padding: 4px 22px 12px; font-size: .82rem; }
  .ch-key-free b { font-size: .76rem; }
  .chapter-list { padding: 8px 10px calc(16px + env(safe-area-inset-bottom)); }
  .chapter-item { padding: 12px 12px; font-size: 1rem; align-items: flex-start; }
  .chapter-item .ch-title { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }
  .chapter-item .ch-num { font-size: .85rem; line-height: 1.35rem; }
  .chapter-item .ch-badge, .chapter-item .ch-prog { margin-top: 3px; }
  /* The sheet holds the chapters only; related books stay off it. */
  .sidebar .related-block { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar.open { transition: none; }
}

/* ── Phone player bar: one "0:03 / 1:30" label; thumb fully on screen ── */
@media (max-width: 768px) {
  .audio-player {
    grid-template-areas:
      "cover meta   tcur   tcur"
      "cover ctrl   extras extras";
  }
  #duration { display: none; }
  #current-time { justify-self: end; white-space: nowrap; }
  #current-time::after { content: " / " attr(data-dur); }
  input[type="range"].seek-bar { left: 7px; right: 7px; width: calc(100% - 14px); }
}
