body.niw-ebook-page {
  --ebook-ink: #17211f;
  --ebook-muted: #596461;
  --ebook-brand: #0f6c5a;
  --ebook-brand-dark: #174f43;
  --ebook-line: rgba(174, 199, 186, 0.84);
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 3%, rgba(255, 255, 255, 0.82), transparent 32rem),
    linear-gradient(180deg, #e8f0eb 0%, #eef5f1 48%, #e7f0eb 100%);
  color: var(--ebook-ink);
}

.niw-ebook-page .site-header {
  background: rgba(244, 249, 246, 0.91);
  border-bottom-color: rgba(173, 196, 184, 0.72);
  box-shadow: 0 1px 0 rgba(23, 60, 51, 0.03);
}

.niw-ebook-page .ebook-main {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(48px, 5.2vw, 76px) 0 clamp(44px, 4.8vw, 68px);
}

.ebook-product {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.85fr);
  gap: clamp(48px, 6vw, 84px);
  align-items: center;
}

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

.ebook-eyebrow {
  margin: 0 0 14px;
  color: var(--ebook-brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.ebook-copy h1 {
  max-width: 720px;
  margin: 0 0 18px;
  font-size: clamp(38px, 4.4vw, 58px);
  font-weight: 770;
  line-height: 1.22;
  letter-spacing: -0.025em;
}

.ebook-title-line {
  display: block;
  white-space: nowrap;
}

.ebook-lead {
  max-width: 700px;
  margin: 0 0 24px;
  color: var(--ebook-muted);
  font-size: clamp(18px, 1.7vw, 21px);
  line-height: 1.75;
}

.ebook-questions {
  display: grid;
  gap: 9px;
  max-width: 720px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.ebook-questions li {
  position: relative;
  padding-left: 21px;
  color: #34443f;
  font-size: 16px;
  line-height: 1.65;
}

.ebook-questions li::before {
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ebook-brand);
  content: "";
}

.ebook-positioning {
  max-width: 720px;
  margin: 0 0 14px;
  padding: 14px 17px;
  border-left: 3px solid rgba(15, 108, 90, 0.58);
  background: rgba(247, 251, 248, 0.72);
  color: #263834;
  font-weight: 760;
  line-height: 1.7;
}

.ebook-audience {
  max-width: 720px;
  margin: 0 0 22px;
  color: var(--ebook-muted);
  font-size: 15px;
  line-height: 1.75;
}

.ebook-purchase-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 24px;
}

.ebook-price {
  display: grid;
  gap: 2px;
}

.ebook-price span {
  color: var(--ebook-muted);
  font-size: 13px;
  font-weight: 700;
}

.ebook-price strong {
  color: var(--ebook-ink);
  font-size: 30px;
  line-height: 1;
}

.ebook-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ebook-actions .button {
  min-height: 50px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(15, 108, 90, 0.12);
}

.ebook-actions .button.secondary {
  border-color: var(--ebook-line);
  background: rgba(250, 253, 251, 0.72);
  color: var(--ebook-brand-dark);
}

.ebook-actions button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.ebook-status {
  max-width: 720px;
  margin: 18px 0 0;
  padding: 13px 15px;
  border: 1px solid var(--ebook-line);
  border-radius: 12px;
  background: rgba(250, 253, 251, 0.82);
  color: #34443f;
  line-height: 1.65;
}

.ebook-status[data-state="success"] {
  border-color: rgba(15, 108, 90, 0.42);
  background: rgba(224, 241, 232, 0.9);
  color: #174f43;
}

.ebook-status[data-state="error"] {
  border-color: rgba(153, 65, 65, 0.3);
  background: rgba(252, 241, 239, 0.88);
  color: #713f3c;
}

.ebook-cover-panel {
  margin: 0;
  text-align: center;
}

.ebook-cover-frame {
  width: min(100%, 360px);
  margin: 0 auto;
  padding: 12px;
  border: 1px solid rgba(163, 188, 175, 0.82);
  border-radius: 22px;
  background: rgba(250, 253, 251, 0.72);
  box-shadow: 0 24px 56px rgba(23, 60, 51, 0.13);
}

.ebook-cover-frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1654 / 2339;
  border-radius: 12px;
  object-fit: contain;
}

.ebook-cover-panel figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 15px;
  margin-top: 18px;
  color: var(--ebook-muted);
  font-size: 14px;
  font-weight: 750;
}

.ebook-cover-panel figcaption span + span::before {
  margin-right: 15px;
  color: rgba(15, 108, 90, 0.52);
  content: "·";
}

.ebook-cover-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 22px;
  margin-top: 16px;
}

.ebook-toc-trigger,
.ebook-preview-trigger {
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--ebook-brand-dark);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.ebook-preview-trigger {
  color: var(--ebook-brand);
}

.ebook-dialog {
  width: min(900px, calc(100% - 32px));
  max-height: min(82vh, 780px);
  padding: 0;
  border: 1px solid var(--ebook-line);
  border-radius: 20px;
  background: #f9fcfa;
  color: var(--ebook-ink);
  box-shadow: 0 28px 80px rgba(15, 42, 35, 0.24);
}

.ebook-dialog::backdrop {
  background: rgba(15, 34, 29, 0.52);
  backdrop-filter: blur(3px);
}

.ebook-dialog-inner {
  padding: clamp(24px, 4vw, 38px);
}

.ebook-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.ebook-dialog h2 {
  margin: 0;
  font-size: 28px;
}

.ebook-dialog-close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--ebook-line);
  border-radius: 50%;
  background: #fff;
  color: var(--ebook-ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.ebook-toc {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 30px;
  max-height: calc(82vh - 132px);
  margin: 0;
  padding: 0 6px 0 24px;
  overflow-y: auto;
}

.ebook-toc li {
  padding-left: 2px;
  color: #3e4e49;
  line-height: 1.65;
}

.ebook-toc-number {
  display: none;
}

.ebook-toc .ebook-toc-appendix {
  grid-column: 1 / -1;
  list-style: none;
  color: var(--ebook-brand-dark);
  font-weight: 800;
}

.ebook-preview-dialog {
  width: min(1040px, calc(100% - 24px));
  height: min(94dvh, 1000px);
  max-height: 94dvh;
  overflow: hidden;
}

.ebook-preview-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
}

.ebook-preview-header {
  margin: 0;
  padding: 18px 22px;
  border-bottom: 1px solid var(--ebook-line);
  background: #f9fcfa;
}

.ebook-preview-header h2 {
  font-size: 24px;
}

.ebook-preview-viewport {
  min-height: 0;
  padding: 24px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #e1ebe5;
  scrollbar-gutter: stable both-edges;
  touch-action: pan-x pan-y pinch-zoom;
}

.ebook-preview-image {
  display: block;
  width: min(100%, 820px);
  height: auto;
  margin: 0 auto;
  aspect-ratio: 1654 / 2339;
  background: #fff;
  box-shadow: 0 14px 38px rgba(18, 51, 43, 0.18);
  user-select: none;
}

.ebook-preview-controls {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) auto minmax(88px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 14px 22px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--ebook-line);
  background: #f9fcfa;
}

.ebook-preview-controls button {
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--ebook-line);
  border-radius: 10px;
  background: #fff;
  color: var(--ebook-brand-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.ebook-preview-controls button:first-child {
  justify-self: start;
}

.ebook-preview-controls button:last-child {
  justify-self: end;
}

.ebook-preview-controls button:disabled {
  cursor: default;
  opacity: 0.42;
}

#ebookPreviewCounter {
  min-width: 62px;
  color: var(--ebook-muted);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

body.ebook-preview-open {
  overflow: hidden;
}

body.ebook-preview-open .niw-ai-launcher {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.niw-ebook-page .footer {
  border-top-color: rgba(173, 196, 184, 0.78);
  background: rgba(225, 237, 230, 0.62);
}

@media (max-width: 820px) {
  .niw-ebook-page .ebook-main {
    width: min(100% - 36px, 720px);
    padding-top: 42px;
  }

  .ebook-product {
    grid-template-columns: 1fr;
    gap: 42px;
  }

  .ebook-cover-frame {
    width: min(78vw, 350px);
  }
}

@media (max-width: 520px) {
  .niw-ebook-page .ebook-main {
    width: calc(100% - 30px);
    padding: 34px 0 52px;
  }

  .ebook-copy h1 {
    font-size: clamp(32px, 9.3vw, 40px);
    line-height: 1.28;
  }

  .ebook-lead {
    font-size: 18px;
  }

  .ebook-questions li {
    font-size: 15px;
  }

  .ebook-purchase-row {
    display: grid;
    gap: 17px;
  }

  .ebook-actions {
    display: grid;
    gap: 10px;
    padding-right: 64px;
  }

  .ebook-actions .button {
    width: 100%;
  }

  .ebook-cover-frame {
    width: min(86vw, 340px);
  }

  .ebook-toc {
    grid-template-columns: 1fr;
    max-height: calc(82vh - 124px);
    padding-inline: 6px;
  }

  .ebook-toc li:not(.ebook-toc-appendix) {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    column-gap: 8px;
    padding-inline-start: 0;
    list-style: none;
  }

  .ebook-toc-number {
    display: block;
    font-variant-numeric: tabular-nums;
    text-align: end;
  }

  .ebook-toc-title {
    min-width: 0;
  }

  .ebook-toc .ebook-toc-appendix {
    padding-inline-start: 42px;
  }

  .ebook-preview-dialog {
    width: calc(100% - 12px);
    height: calc(100dvh - 12px);
    max-height: calc(100dvh - 12px);
    border-radius: 14px;
  }

  .ebook-preview-header {
    padding: 12px 14px;
  }

  .ebook-preview-header h2 {
    font-size: 21px;
  }

  .ebook-preview-viewport {
    padding: 10px;
    scrollbar-gutter: auto;
  }

  .ebook-preview-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
  }

  .ebook-preview-controls {
    grid-template-columns: minmax(82px, 1fr) auto minmax(82px, 1fr);
    gap: 8px;
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  }

  .ebook-preview-controls button {
    min-height: 44px;
    padding: 7px 12px;
  }
}
