:root {
  color-scheme: light;
  --ink: #24312c;
  --muted: #69756f;
  --paper: #f8f5ee;
  --panel: #fffdf8;
  --line: #ded8cc;
  --sage: #6f8374;
  --sage-dark: #415d50;
  --rose: #b87368;
  --amber: #c38a3e;
  --mani-gold: #ddb96e;
  --mani-gold-soft: #f5e5c4;
  --shadow: 0 16px 38px rgba(55, 48, 38, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 92% 4%, rgba(221, 185, 110, 0.13), transparent 25rem),
    linear-gradient(120deg, rgba(250, 248, 243, 0.96), rgba(242, 244, 239, 0.92)),
    var(--paper);
  color: var(--ink);
  padding-bottom: 32px;
}

body.has-player {
  padding-bottom: 112px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1160px, calc(100% - 36px));
  margin: 0 auto;
}

.site-header {
  min-height: 94px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.brand-name,
.brand-subtitle,
.panel-label,
.player-info span,
.time-row,
.chapter-meta {
  display: block;
}

.brand-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-subtitle,
.section-heading p,
.book-card p,
.book-description,
.chapter-meta,
.player-info span,
.time-row,
.resume-panel span {
  color: var(--muted);
}

.brand-subtitle,
.panel-label,
.eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand-subtitle {
  margin-top: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.counseling-link {
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-decoration-color: rgba(221, 185, 110, 0.85);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  text-transform: uppercase;
}

.counseling-link:hover,
.counseling-link:focus-visible {
  color: var(--sage-dark);
}

.library-hero {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  align-items: center;
  gap: 24px;
  padding: 52px clamp(24px, 5vw, 68px);
  border: 1px solid rgba(221, 185, 110, 0.38);
  border-radius: 3px;
  background:
    linear-gradient(90deg, rgba(255, 253, 248, 0.97) 0%, rgba(255, 253, 248, 0.9) 56%, rgba(250, 240, 218, 0.64) 100%);
}

.library-hero::after {
  position: absolute;
  right: -38px;
  top: 50%;
  width: 310px;
  height: 310px;
  content: "";
  background: url("./assets/branding/mani-counseling-logo.png") center / contain no-repeat;
  opacity: 0.13;
  transform: translateY(-50%);
  pointer-events: none;
}

.eyebrow {
  color: #8a6a2f;
  font-weight: 800;
  margin: 0 0 15px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.05rem, 4.8vw, 4.25rem);
  line-height: 1.03;
  font-weight: 600;
  letter-spacing: 0;
}

.library-hero h1 {
  max-width: 720px;
  font-size: clamp(2.8rem, 5.5vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.library-hero h1 em {
  color: var(--sage-dark);
  font-weight: 400;
}

.hero-copy p:last-child {
  max-width: 580px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.hero-copy,
.resume-panel {
  position: relative;
  z-index: 1;
}

h2 {
  font-size: 1.45rem;
  margin-bottom: 0;
}

.resume-panel {
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.resume-panel strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 1.15rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 20px 0 16px;
}

.library-tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 320px));
  gap: 18px;
  justify-content: start;
  align-items: stretch;
}

.book-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 13px;
  width: 100%;
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.76);
  color: inherit;
  text-align: left;
  padding: 10px 10px 12px;
  box-shadow: 0 10px 30px rgba(68, 56, 42, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.book-card:hover,
.book-card:focus-within {
  transform: translateY(-3px);
  border-color: rgba(111, 131, 116, 0.7);
  box-shadow: var(--shadow);
  outline: none;
}

.book-open {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: transparent;
  color: inherit;
}

.book-open:focus-visible,
.small-button:focus-visible,
.hide-book-button:focus-visible {
  outline: 3px solid rgba(111, 131, 116, 0.35);
  outline-offset: 3px;
}

.book-card img,
.book-cover-large,
#playerCover {
  object-fit: cover;
  background: #ebe3d4;
}

.book-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
}

.book-card h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  line-height: 1.25;
}

.book-card p {
  margin-bottom: 8px;
  line-height: 1.45;
}

.book-byline {
  margin: 8px 0 0;
  color: var(--sage-dark);
  font-size: 0.88rem;
  font-weight: 760;
  line-height: 1.35;
}

.detail-byline {
  margin-top: 12px;
  font-size: 0.98rem;
}

.book-more {
  margin-top: 8px;
  color: var(--muted);
}

.book-more summary {
  width: max-content;
  cursor: pointer;
  color: var(--sage-dark);
  font-size: 0.86rem;
  font-weight: 780;
  list-style: none;
}

.book-more summary::-webkit-details-marker {
  display: none;
}

.book-more summary::after {
  content: " +";
}

.book-more[open] summary::after {
  content: " -";
}

.book-more .book-meta-list {
  margin-top: 8px;
}

.book-more .book-meta-list span:first-child {
  max-width: 100%;
}

.card-meta {
  display: block;
  color: var(--sage-dark);
  font-size: 0.88rem;
  font-weight: 700;
}

.book-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.book-meta-list span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(111, 131, 116, 0.22);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.58);
  color: var(--sage-dark);
  font-size: 0.78rem;
  font-weight: 760;
}

.detail-meta {
  margin: 12px 0 0;
}

.detail-more {
  margin-top: 12px;
}

.detail-more .compact-action {
  margin-top: 10px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.small-button {
  min-height: 36px;
  padding: 0 16px;
  font-size: 0.88rem;
  margin-top: 0;
}

.small-text-button {
  min-height: 32px;
  padding: 0;
  color: var(--sage-dark);
  font-size: 0.86rem;
}

.hide-book-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  min-height: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(222, 216, 204, 0.74);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.82);
  color: var(--sage-dark);
  opacity: 0;
  transition: opacity 140ms ease, background 140ms ease, border-color 140ms ease;
}

.hide-book-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.book-card:hover .hide-book-button,
.book-card:focus-within .hide-book-button {
  opacity: 1;
}

.hide-book-button:hover {
  border-color: rgba(184, 115, 104, 0.46);
  background: rgba(255, 253, 248, 0.96);
}

.hidden-books {
  display: grid;
  gap: 8px;
  max-width: 420px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(222, 216, 204, 0.7);
}

.hidden-book-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.hidden-book-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-view {
  padding-top: 22px;
}

.text-button,
.ghost-button,
.primary-button,
.round-button {
  border: 0;
  border-radius: 999px;
  min-height: 42px;
  padding: 0 17px;
  font-weight: 760;
}

.text-button {
  background: transparent;
  color: var(--sage-dark);
  padding-left: 0;
}

.ghost-button {
  background: rgba(255, 253, 248, 0.76);
  color: var(--sage-dark);
  border: 1px solid var(--line);
}

.primary-button,
.round-button {
  background: var(--sage-dark);
  color: #fffdf8;
}

.primary-button {
  margin-top: 16px;
}

.book-detail {
  display: grid;
  gap: 24px;
  max-width: 860px;
  padding-bottom: 34px;
}

.book-heading {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.book-detail h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 3.4vw, 3.4rem);
}

.book-detail h2 {
  max-width: 760px;
  margin: 0;
  color: var(--sage-dark);
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  line-height: 1.35;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 760;
}

.book-cover-small {
  width: 86px;
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(55, 48, 38, 0.12);
}

.book-description {
  max-width: 680px;
  line-height: 1.65;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 0;
}

.compact-action {
  min-height: 36px;
  padding: 0 15px;
  font-size: 0.86rem;
}

.chapter-list {
  display: grid;
  gap: 10px;
  max-width: 860px;
}

.chapter-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px;
  background: rgba(255, 253, 248, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.chapter-row:hover,
.chapter-row:focus-visible {
  border-color: rgba(111, 131, 116, 0.72);
  background: rgba(255, 253, 248, 0.95);
  outline: none;
  transform: translateY(-1px);
}

.chapter-number {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ece5d9;
  color: var(--sage-dark);
  font-weight: 800;
}

.chapter-row h3 {
  margin: 0 0 3px;
  font-size: 1rem;
}

.share-landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 28px;
  text-align: center;
}

.share-landing img {
  width: min(260px, 70vw);
  aspect-ratio: 3 / 4;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 22px 70px rgba(39, 35, 29, 0.18);
}

.share-landing h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(2rem, 8vw, 4rem);
}

.share-landing p {
  margin: 0;
  color: var(--muted);
}

.player-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(1120px, calc(100% - 32px));
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.5fr);
  gap: 20px;
  align-items: center;
  padding: 12px;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 70px rgba(39, 35, 29, 0.22);
  backdrop-filter: blur(16px);
  z-index: 10;
}

body.mini-player .player-bar {
  width: min(520px, calc(100% - 22px));
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px;
  bottom: 10px;
}

body.mini-player .timeline {
  display: none;
}

body.mini-player #playerCover {
  width: 42px;
  height: 42px;
}

body.mini-player .round-button {
  width: 52px;
  min-height: 52px;
}

.player-info,
.player-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#playerCover {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  flex: 0 0 auto;
}

.player-info div,
.timeline {
  min-width: 0;
  width: 100%;
}

.player-info strong,
.player-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.round-button {
  width: 58px;
  padding: 0;
}

#seekBar {
  width: 100%;
  accent-color: var(--sage-dark);
}

.time-row {
  margin-top: 2px;
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
}

.empty-state {
  padding: 36px 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  body.has-player {
    padding-bottom: 150px;
  }

  .app-shell,
  .player-bar {
    width: min(100% - 22px, 1120px);
  }

  .site-header {
    min-height: 78px;
  }

  .brand-subtitle {
    display: none;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .brand-name {
    font-size: 1rem;
  }

  .counseling-link {
    font-size: 0.68rem;
  }

  .library-hero,
  .player-bar {
    grid-template-columns: 1fr;
  }

  .library-hero {
    min-height: 0;
    padding: 38px 24px 42px;
  }

  .library-hero::after {
    right: -70px;
    width: 230px;
    height: 230px;
    opacity: 0.1;
  }

  .library-hero h1 {
    font-size: clamp(2.5rem, 12vw, 3.7rem);
  }

  .hero-copy p:last-child {
    margin-top: 18px;
    font-size: 0.98rem;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .library-tools {
    width: 100%;
    justify-content: space-between;
  }

  .book-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .book-card {
    grid-template-columns: clamp(118px, 36vw, 148px) minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: start;
    gap: 14px;
    border-color: rgba(222, 216, 204, 0.78);
    padding: 10px 12px 12px 10px;
    box-shadow: 0 8px 20px rgba(68, 56, 42, 0.07);
  }

  .book-card > div {
    min-width: 0;
    padding-right: 30px;
  }

  .hide-book-button {
    top: 10px;
    right: 10px;
    width: 25px;
    height: 25px;
    border-color: rgba(222, 216, 204, 0.58);
    background: rgba(255, 253, 248, 0.64);
    opacity: 0.82;
  }

  .hide-book-button svg {
    width: 14px;
    height: 14px;
    stroke-width: 1.65;
  }

  .book-card:hover,
  .book-card:focus-within {
    transform: none;
  }

  .book-card img {
    aspect-ratio: 3 / 4;
    min-height: 0;
    border-radius: 5px;
  }

  .book-card h3 {
    display: -webkit-box;
    margin: 1px 0 7px;
    overflow: hidden;
    font-size: clamp(1rem, 4.15vw, 1.32rem);
    line-height: 1.14;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .book-byline {
    margin-top: 6px;
    font-size: 0.78rem;
  }

  .book-more {
    margin-top: 7px;
  }

  .book-more summary {
    font-size: 0.78rem;
  }

  .book-meta-list {
    gap: 5px;
    margin-top: 0;
  }

  .book-meta-list span {
    min-height: 21px;
    padding: 0 7px;
    font-size: 0.66rem;
    line-height: 1;
  }

  .book-more .book-meta-list span:first-child {
    width: 100%;
    justify-content: flex-start;
    white-space: normal;
    line-height: 1.25;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .card-actions {
    margin-top: 12px;
  }

  .small-button {
    min-height: 31px;
    padding: 0 14px;
    font-size: 0.78rem;
  }

  .small-text-button {
    min-height: 32px;
    font-size: 0.82rem;
  }

  .chapter-row {
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: 86px;
  }

  .book-detail h1 {
    margin-bottom: 6px;
    font-size: clamp(1.35rem, 5.2vw, 1.72rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
  }

  .book-detail h2 {
    font-size: 1rem;
    line-height: 1.34;
  }

  .book-heading {
    grid-template-columns: clamp(88px, 28vw, 112px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
  }

  .book-cover-small {
    width: 100%;
    border-radius: 7px;
  }

  .player-bar {
    bottom: 10px;
    gap: 10px;
    padding: 10px;
  }

  body.mini-player .player-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 8px;
  }

  .player-controls {
    gap: 10px;
  }

  .round-button {
    width: 54px;
    min-height: 54px;
    flex: 0 0 54px;
  }
}
