/* 新画皮志 — 翻页书样式 */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #2a2826;
  font-family: "Noto Serif SC", "Songti SC", "STSong", "宋体", serif;
  color: #2a2826;
  overflow: hidden;
}

/* ===== Top bar ===== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.5), rgba(0,0,0,0));
  z-index: 10;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.title-mini {
  font-family: "Noto Serif SC", serif;
  color: #d6c8a8;
  font-size: 14px;
  letter-spacing: 0.15em;
  opacity: 0.7;
}
.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Noto Sans SC", sans-serif;
  color: #d6c8a8;
  font-size: 13px;
}
.controls button {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(214,200,168,0.3);
  color: #d6c8a8;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.controls button:hover {
  background: rgba(255,255,255,0.16);
}
#page-info {
  min-width: 72px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ===== Hint ===== */
.hint {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: #d6c8a8;
  opacity: 0.45;
  font-family: "Noto Sans SC", sans-serif;
  font-size: 11px;
  letter-spacing: 0.1em;
  z-index: 10;
  pointer-events: none;
  transition: opacity 1s;
}
.hint.fade { opacity: 0; }
.hint-desktop { display: inline; }
.hint-mobile { display: none; }
@media (max-width: 720px) {
  .hint-desktop { display: none; }
  .hint-mobile { display: inline; }
}

/* ===== Book wrap ===== */
#book-wrap {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 12px 36px;
}

#book {
  /* StPageFlip will set width/height via inline styles; we provide max constraints */
  max-width: 1200px;
  max-height: calc(100vh - 80px);
}

/* ===== Page ===== */
.page {
  background: #f5ecd7; /* warm cream paper */
  background-image:
    radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.04) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.13 0 0 0 0 0.12 0 0 0 0 0.10 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  color: #2a2826;
  overflow: hidden;
  position: relative;
}

.page-inner {
  height: 100%;
  width: 100%;
  padding: 9% 10%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* page edge shadow accents (subtle) */
.page::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 12px;
  pointer-events: none;
}
.page.--right::after {
  left: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.18), transparent);
}
.page.--left::after {
  right: 0;
  background: linear-gradient(to left, rgba(0,0,0,0.18), transparent);
}

/* ===== Cover ===== */
.page-cover {
  background: #1a1916;
  color: #f5ecd7;
}
.cover-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cover-back {
  flex-direction: column;
  color: #d6c8a8;
  background: #1a1916;
  letter-spacing: 0.25em;
}
.back-text {
  font-family: "Noto Serif SC", serif;
  font-size: 34px;
  margin-bottom: 12px;
  letter-spacing: 0.35em;
}
.back-text-small {
  font-family: "Noto Sans SC", sans-serif;
  font-size: 13px;
  opacity: 0.6;
  letter-spacing: 0.5em;
}

/* ===== Image page ===== */
.page-image .page-inner {
  padding: 0;
  align-items: center;
  justify-content: center;
}
.full-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.image-caption {
  position: absolute;
  bottom: 6%;
  left: 0; right: 0;
  text-align: center;
  font-family: "Noto Serif SC", serif;
  font-size: 16px;
  color: #2a2826;
  letter-spacing: 0.3em;
}

/* ===== Title page ===== */
.page-title .page-inner {
  align-items: center;
  justify-content: center;
}
.title-ornament {
  width: 90px;
  height: 90px;
  object-fit: contain;
  margin-bottom: 30px;
  opacity: 0.92;
}
.story-title {
  font-family: "Noto Serif SC", serif;
  font-size: 38px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-align: center;
  margin-bottom: 22px;
  color: #2a2826;
}
.story-source {
  font-family: "Noto Sans SC", sans-serif;
  font-size: 12px;
  letter-spacing: 0.25em;
  color: #6b5d44;
  text-align: center;
}

/* ===== Text page ===== */
.page-text .page-inner {
  font-family: "Noto Serif SC", serif;
  font-size: 15.5px;
  line-height: 2.0;
  letter-spacing: 0.04em;
  color: #2a2826;
}
.page-text p {
  text-indent: 2em;
  margin-bottom: 0.5em;
  text-align: justify;
}
.page-text blockquote {
  margin: 1em 0;
  padding-left: 1em;
  border-left: 2px solid #6b5d44;
  font-style: italic;
  color: #5a4f3a;
}
.asterism {
  text-align: center;
  margin: 1em 0;
  letter-spacing: 1em;
  color: #6b5d44;
  font-size: 11px;
}
.scene-title {
  font-family: "Noto Serif SC", serif;
  font-size: 16px;
  font-weight: 500;
  margin: 1.2em 0 0.8em;
  letter-spacing: 0.15em;
  text-align: center;
  color: #2a2826;
}

/* ===== Preface / Afterword ===== */
.page-preface .section-title,
.page-toc .section-title {
  text-align: center;
  font-family: "Noto Serif SC", serif;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: 0.4em;
  margin-bottom: 2em;
  color: #2a2826;
}

.page-toc .toc-list {
  list-style: none;
  padding-left: 0;
  font-family: "Noto Serif SC", serif;
  font-size: 14px;
  line-height: 2.8;
}
.page-toc .toc-list li {
  display: grid;
  grid-template-columns: 1.8em 1fr;
  column-gap: 0.6em;
  align-items: baseline;
  margin-bottom: 0.3em;
}
.toc-num {
  font-variant-numeric: tabular-nums;
  color: #6b5d44;
}
.toc-title-block {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6em 1em;
}
.toc-title {
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.toc-source {
  font-family: "Noto Sans SC", sans-serif;
  font-size: 11px;
  color: #6b5d44;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* ===== Blank page ===== */
.page-blank {
  /* same paper texture, no content */
}

/* ===== Mobile ===== */
@media (max-width: 720px) {
  #book-wrap { padding: 50px 4px 30px; }
  .page-inner { padding: 8% 7%; }
  .page-text .page-inner { font-size: 14.5px; line-height: 1.9; }
  .story-title { font-size: 28px; }
  .page-preface .section-title { font-size: 20px; }
  .hint { font-size: 10px; }
  /* TOC: stack title above source on mobile */
  .page-toc .toc-title-block {
    flex-direction: column;
    gap: 0.1em;
  }
  .toc-source { font-size: 10px; }
  /* topbar title hidden on mobile to free room */
  .title-mini { display: none; }
}
