:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --accent: #0071e3;
  --accent-dark: #005bb5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

body.has-player {
  padding-bottom: 136px;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  font-weight: 700;
}

nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
}

.hero {
  display: grid;
  align-items: center;
  min-height: 420px;
  padding: clamp(40px, 8vw, 96px) clamp(20px, 6vw, 80px);
  background: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: 2.625rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.hero p {
  max-width: 680px;
  color: var(--muted);
  font-size: 18px;
}

.brand,
.hero h1,
.hero p,
.section h1,
.section h2,
.section p,
.book-card,
.book-hero,
.cover-placeholder,
.chapter-row,
.player-title,
.readable {
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-weight: 700;
}

.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 20px;
}

.book-grid,
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-dark);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.category-picks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.category-pick,
.mini-book-card,
.continue-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.category-pick {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.mini-book-card,
.continue-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.continue-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.continue-card.with-cover {
  grid-template-columns: 86px minmax(0, 1fr) auto;
}

.continue-copy {
  min-width: 0;
}

.book-card,
.chapter-row {
  display: block;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.book-card span,
.book-card p,
.chapter-row p,
.subtitle {
  color: var(--muted);
}

.book-detail {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 20px 120px;
}

.book-hero {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 36px;
  align-items: start;
}

.book-hero > div {
  min-width: 0;
}

.cover-frame,
.cover-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  background: #e8e8ed;
  overflow: hidden;
}

.cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-placeholder {
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  font-weight: 700;
}

.text-cover {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 3 / 4;
  width: 100%;
  min-height: 160px;
  padding: 16px;
  border-radius: 8px;
  background: #173f35;
  color: #ffffff;
  overflow: hidden;
}

.text-cover span,
.text-cover small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.text-cover strong {
  font-size: clamp(1.25rem, 3vw, 2rem);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.text-cover-compact {
  width: 86px;
  min-width: 86px;
  min-height: 114px;
  padding: 10px;
}

.text-cover-compact strong {
  font-size: 1rem;
}

.text-cover-large {
  min-height: 300px;
}

.tone-single_purchase {
  background: #2b2d42;
}

.tone-member {
  background: #57412f;
}

.tone-free {
  background: #23593f;
}

.tone-login_required {
  background: #314866;
}

.recent-listening-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.recent-listening-row p {
  margin: 4px 0 10px;
}

.chapter-list {
  display: grid;
  gap: 12px;
}

.chapter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chapter-row > div {
  min-width: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
}

.button:hover {
  background: var(--accent-dark);
}

.button.secondary {
  background: #e8e8ed;
  color: var(--text);
}

.floating-player,
.bottom-player {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(260px, 1.2fr);
  gap: 16px;
  align-items: center;
  width: 100%;
  min-height: 96px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(20px);
}

.floating-player[hidden],
.bottom-player[hidden] {
  display: none;
}

.player-meta {
  min-width: 0;
}

.player-book {
  display: block;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-title {
  margin-top: 2px;
  font-weight: 700;
  line-height: 1.3;
}

.player-controls,
.player-timeline,
.player-rate {
  display: flex;
  align-items: center;
}

.player-controls {
  justify-content: center;
  gap: 8px;
}

.player-icon-button,
.player-play-button,
.player-rate select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.player-icon-button,
.player-play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.player-icon-button {
  width: 40px;
  padding: 0;
  font-size: 26px;
  line-height: 1;
}

.player-play-button {
  min-width: 72px;
  padding: 0 16px;
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.player-play-button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.player-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.player-rate {
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.player-rate select {
  min-width: 78px;
  padding: 0 8px;
}

.player-timeline {
  min-width: 0;
  gap: 10px;
}

.player-timeline span {
  width: 44px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
}

.player-timeline input[type="range"] {
  width: 100%;
  min-width: 120px;
  accent-color: var(--accent);
}

.player-message {
  grid-column: 1 / -1;
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
}

.floating-player audio,
.bottom-player audio {
  display: none;
}

.readable {
  max-width: 780px;
}

.home-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 72px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 20px;
  align-items: stretch;
  padding: clamp(28px, 5vw, 56px);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.home-hero-copy {
  min-width: 0;
}

.home-hero-copy h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.25rem, 5vw, 4.75rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.home-hero-copy p {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.hero-actions form {
  display: inline-flex;
  margin: 0;
}

.hero-panel {
  display: grid;
  gap: 12px;
  align-content: center;
  min-width: 0;
}

.hero-panel div {
  padding: 16px;
  background: #f7f7f2;
  border: 1px solid #e0ded4;
  border-radius: 8px;
}

.hero-panel strong,
.hero-panel span,
.product-card strong,
.product-card span,
.product-card p,
.mini-book-card span,
.continue-card strong,
.continue-card p,
.membership-band h2,
.membership-band p,
.empty-state {
  overflow-wrap: anywhere;
}

.hero-panel strong,
.product-card strong {
  display: block;
}

.hero-panel span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.section-tight {
  padding-top: 36px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.5rem;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}

.product-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  min-height: 190px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-card:hover {
  border-color: #8a8a8f;
}

.product-card > span:not(.book-chip),
.product-card p {
  color: var(--muted);
}

.product-card p {
  margin: 0;
}

.book-chip {
  justify-self: start;
  max-width: 100%;
  padding: 3px 8px;
  background: #e9f2ee;
  border: 1px solid #c9ded3;
  border-radius: 8px;
  color: #1f6b4f;
  font-size: 12px;
  font-weight: 700;
}

.membership-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 36px;
  padding: 24px;
  background: #202124;
  border-radius: 8px;
  color: #ffffff;
}

.membership-band h2 {
  margin: 0;
}

.membership-band p {
  max-width: 760px;
  margin: 8px 0 0;
  color: #d8d9dc;
}

.membership-band .eyebrow {
  margin: 0 0 6px;
  color: #8fd2b4;
}

.membership-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) 20px 120px;
}

.membership-hero {
  padding: clamp(30px, 6vw, 72px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  color: white;
}

.membership-hero p {
  color: rgba(255, 255, 255, 0.72);
}

.membership-hero .eyebrow {
  color: #8fd2b4;
}

.membership-hero h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 5rem);
  line-height: 1.04;
}

.membership-hero form,
.membership-hero .button {
  margin-top: 24px;
}

.membership-hero form .button {
  margin-top: 0;
}

.entitlement-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0 12px;
}

.dashboard-page h1 {
  margin-top: 0;
  font-size: clamp(2.2rem, 5vw, 4rem);
}

@media (min-width: 721px) {
  .hero h1 {
    font-size: 4rem;
  }
}

@media (min-width: 1024px) {
  .hero h1 {
    font-size: 5.375rem;
  }
}

@media (max-width: 720px) {
  body.has-player {
    padding-bottom: 220px;
  }

  .home-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 16px;
  }

  .home-hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .home-hero-copy h1 {
    font-size: 2.25rem;
  }

  .home-hero-copy p {
    font-size: 16px;
  }

  .hero-actions,
  .membership-band {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions .button,
  .membership-band .button {
    width: 100%;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .continue-card,
  .continue-card.with-cover {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    flex-wrap: wrap;
  }

  .book-hero {
    grid-template-columns: 1fr;
  }

  .cover-frame {
    max-width: 220px;
  }

  .chapter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .floating-player,
  .bottom-player {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 176px;
    padding: 12px;
  }

  .player-controls {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .player-play-button {
    flex: 1 1 96px;
  }

  .player-rate {
    flex: 1 1 128px;
    justify-content: flex-end;
  }

  .player-timeline {
    width: 100%;
  }

  .entitlement-grid {
    grid-template-columns: 1fr;
  }
}

.product-detail {
  display: grid;
  gap: 32px;
}

.product-book-hero {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.product-cover {
  background: #f0f0f2;
  box-shadow: 0 14px 32px rgba(29, 29, 31, 0.08);
}

.book-hero-copy {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.book-hero-copy h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.book-hero-copy p {
  margin: 0;
}

.book-meta,
.muted {
  color: var(--muted);
}

.access-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.access-strip span {
  padding: 6px 10px;
  background: #eef7f3;
  border: 1px solid #cfe4da;
  border-radius: 8px;
  color: #1f6b4f;
  font-size: 14px;
  font-weight: 700;
}

.book-learning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.guided-reading {
  display: grid;
  gap: 16px;
}

.reading-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 16px;
}

.learning-panel {
  min-width: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.learning-panel p {
  margin: 0;
}

.learning-panel p + p {
  margin-top: 8px;
}

.chapter-section {
  width: 100%;
  padding: 0;
}

.rich-chapter-row {
  align-items: stretch;
  padding: 0;
  overflow: hidden;
}

.chapter-copy {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.chapter-kicker {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.chapter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 18px;
  border-left: 1px solid var(--line);
}

.transcript-panel {
  margin-top: 6px;
  border-top: 1px solid var(--line);
}

.transcript-panel summary {
  padding-top: 12px;
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 700;
}

.transcript-body {
  max-width: 760px;
  padding-top: 10px;
  color: var(--muted);
}

.transcript-body p {
  margin: 0 0 10px;
}

.chapter-row.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 113, 227, 0.18);
}

.chapter-row.is-locked {
  background: #fafafa;
}

.locked-guidance {
  display: grid;
  gap: 10px;
}

.locked-guidance p {
  max-width: 260px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 720px) {
  .product-detail {
    gap: 20px;
    padding: 20px 12px 120px;
  }

  .product-book-hero {
    padding: 18px;
  }

  .book-learning-grid {
    grid-template-columns: 1fr;
  }

  .reading-grid {
    grid-template-columns: 1fr;
  }

  .chapter-actions {
    justify-content: stretch;
    padding-top: 0;
    border-left: 0;
  }

  .chapter-actions .button {
    width: 100%;
  }
}
