:root {
  --bg: #fbf4e8;
  --surface: rgba(255, 250, 243, 0.92);
  --surface-strong: #fffdf8;
  --text: #332118;
  --muted: #725a49;
  --line: rgba(126, 93, 70, 0.18);
  --accent: #d47842;
  --accent-dark: #b95d29;
  --shadow: 0 22px 60px rgba(92, 61, 42, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(248, 205, 121, 0.32), transparent 26%),
    radial-gradient(circle at 86% 10%, rgba(212, 120, 66, 0.14), transparent 22%),
    linear-gradient(180deg, #fffaf2 0%, var(--bg) 100%);
}

.book-app {
  width: min(100% - 32px, 1180px);
  margin: 0 auto;
  padding: 42px 0 48px;
}

.book-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.book-intro {
  max-width: 780px;
}

.eyebrow,
.reader-panel__label {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  line-height: 0.98;
}

h1 {
  font-size: clamp(3.2rem, 8vw, 6rem);
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.book-intro p:last-child,
.reader-panel__text {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
}

.book-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button,
.text-button,
.icon-button {
  border: 1px solid rgba(185, 93, 41, 0.18);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  text-decoration: none;
}

.button--primary {
  color: #fffaf3;
  background: linear-gradient(180deg, #df844d 0%, var(--accent) 100%);
  box-shadow: 0 16px 34px rgba(200, 107, 57, 0.24);
}

.button--secondary,
.text-button,
.icon-button {
  color: var(--text);
  background: rgba(255, 253, 249, 0.82);
}

.button:hover,
.text-button:hover,
.icon-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(80, 53, 38, 0.12);
  border-color: rgba(185, 93, 41, 0.32);
}

.button:disabled,
.text-button:disabled,
.icon-button:disabled {
  cursor: wait;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}

.reader {
  display: grid;
  grid-template-columns: minmax(260px, 0.34fr) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
}

.reader-panel,
.reader-stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.reader-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
}

.reader-progress {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #51382a;
  font-weight: 800;
}

.reader-progress span:last-child {
  color: var(--muted);
  font-weight: 700;
}

.reader-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.reader-controls--zoom {
  grid-template-columns: 52px 1fr 52px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 1.3rem;
}

.icon-button--wide {
  width: 100%;
  border-radius: 999px;
}

.zoom-label {
  align-self: center;
  justify-self: center;
  color: #51382a;
  font-weight: 800;
}

.reader-stage {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 720px;
  overflow: hidden;
}

.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}

.text-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
}

.page-shell {
  display: grid;
  place-items: start center;
  min-height: 660px;
  padding: 28px;
  overflow: auto;
  background: rgba(112, 82, 61, 0.08);
}

#book-canvas {
  display: block;
  height: auto;
  background: var(--surface-strong);
  border-radius: 10px;
  box-shadow: 0 24px 50px rgba(57, 38, 28, 0.18);
}

.pdf-fallback {
  display: none;
  width: 100%;
  min-height: 660px;
  border: 0;
  border-radius: 14px;
  background: var(--surface-strong);
}

.reader.is-fallback #book-canvas {
  display: none;
}

.reader.is-fallback .pdf-fallback {
  display: block;
}

.reader:fullscreen {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 14px;
  background: #f5ead9;
  overflow: auto;
}

.reader:fullscreen .reader-panel {
  display: none;
}

.reader:fullscreen .reader-stage {
  min-height: calc(100vh - 112px);
  border-radius: 18px;
}

.reader:fullscreen .page-shell {
  height: calc(100vh - 184px);
  min-height: 0;
}

.mobile-reader-dock {
  display: none;
}

.dock-button {
  display: inline-grid;
  place-items: center;
  min-width: 0;
  height: 48px;
  border: 1px solid rgba(185, 93, 41, 0.18);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 253, 249, 0.9);
  font: inherit;
  font-size: 1.18rem;
  font-weight: 900;
  cursor: pointer;
}

.dock-button:disabled {
  cursor: wait;
  opacity: 0.45;
}

.dock-page {
  color: #51382a;
  font-size: 0.86rem;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.reader:fullscreen .mobile-reader-dock {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr 48px minmax(62px, auto) 48px 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px;
  background: rgba(255, 250, 243, 0.94);
  border: 1px solid rgba(126, 93, 70, 0.22);
  border-radius: 999px;
  box-shadow: 0 18px 44px rgba(57, 38, 28, 0.22);
  backdrop-filter: blur(14px);
}

.buy-book {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.buy-book h2 {
  font-size: clamp(2rem, 4vw, 3.1rem);
}

.buy-book p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

@media (max-width: 900px) {
  body {
    padding-bottom: 84px;
  }

  .book-hero,
  .reader,
  .buy-book {
    grid-template-columns: 1fr;
  }

  .buy-book {
    align-items: flex-start;
    flex-direction: column;
  }

  .book-actions {
    justify-content: flex-start;
  }

  .reader-stage {
    order: -1;
    min-height: 560px;
  }

  .mobile-reader-dock {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 50;
    display: grid;
    grid-template-columns: 1fr 48px minmax(62px, auto) 48px 1fr;
    gap: 8px;
    align-items: center;
    padding: 10px;
    background: rgba(255, 250, 243, 0.94);
    border: 1px solid rgba(126, 93, 70, 0.22);
    border-radius: 999px;
    box-shadow: 0 18px 44px rgba(57, 38, 28, 0.22);
    backdrop-filter: blur(14px);
  }

}

@media (max-width: 620px) {
  .book-app {
    width: min(100% - 24px, 1180px);
    padding-top: 28px;
  }

  h1 {
    font-size: clamp(3rem, 14vw, 4.4rem);
  }

  .book-actions,
  .reader-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .reader-panel,
  .reader-stage,
  .buy-book {
    border-radius: 22px;
  }

  .reader-panel {
    padding: 22px;
  }

  .page-shell,
  .pdf-fallback {
    min-height: 500px;
  }

  .page-shell {
    padding: 16px;
  }
}
