:root {
  --bg: #050505;
  --panel: #0d0d0d;
  --panel-2: #151515;
  --ink: #f8f2dc;
  --muted: #b9b19c;
  --soft: #756f5d;
  --line: rgba(255, 202, 31, 0.24);
  --yellow: #ffca1f;
  --yellow-2: #f2ad00;
  --danger: #f4d179;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.48);
  --display-font: "Songti SC", "STSong", "SimSun", "FangSong", "KaiTi", serif;
  --latin-font: "Baskerville", "Didot", "Times New Roman", serif;
  --body-font:
    "PingFang SC",
    "Microsoft YaHei UI Light",
    "Microsoft YaHei",
    "Noto Sans CJK SC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  clip: rect(0, 0, 0, 0);
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 202, 31, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 202, 31, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 38px 38px;
  color: var(--ink);
  font-family: var(--body-font);
}

button {
  border: 0;
  color: inherit;
  font: inherit;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 202, 31, 0.16), transparent 24%),
    linear-gradient(315deg, rgba(255, 202, 31, 0.08), transparent 30%),
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(255, 202, 31, 0.04) 26px 27px);
  opacity: 0.72;
}

.app {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  width: min(100vw, 500px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 15px max(14px, env(safe-area-inset-bottom));
  isolation: isolate;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 2px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  color: var(--yellow);
  font-family: var(--latin-font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark img {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 202, 31, 0.45);
  border-radius: 50%;
  object-fit: cover;
}

.text-button,
.menu-button,
.icon-button,
.close-button,
.jump-button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 30px;
  border: 1px solid rgba(255, 202, 31, 0.35);
  border-radius: 6px;
  background: rgba(255, 202, 31, 0.08);
  color: var(--yellow);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.progress {
  height: 3px;
  margin: 8px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--yellow), #fff2a8);
  transition: width 320ms ease;
}

.book {
  position: relative;
  min-height: 0;
  perspective: 1300px;
}

.page {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
  border: 1px solid rgba(255, 202, 31, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 202, 31, 0.08), transparent 22%),
    linear-gradient(145deg, #090909 0%, #111111 54%, #070707 100%);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateX(16px) rotateY(-14deg) scale(0.97);
  transform-origin: left center;
  transition:
    transform 520ms cubic-bezier(0.2, 0.78, 0.22, 1),
    opacity 360ms ease,
    filter 360ms ease;
  pointer-events: none;
}

.page::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px solid rgba(255, 202, 31, 0.18);
  border-radius: 6px;
  pointer-events: none;
}

.page::after {
  content: "";
  position: absolute;
  right: -54px;
  bottom: -54px;
  width: 220px;
  height: 220px;
  background: url("./assets/logo.jpg") center / cover no-repeat;
  border-radius: 50%;
  opacity: 0.08;
  filter: saturate(1.25);
  pointer-events: none;
}

.page.is-active {
  z-index: 4;
  opacity: 1;
  transform: translateX(0) rotateY(0) scale(1);
  pointer-events: auto;
}

.page.is-prev {
  z-index: 2;
  opacity: 0;
  transform: translateX(-42px) rotateY(62deg) scale(0.96);
}

.page.is-next {
  z-index: 1;
  opacity: 0.34;
  filter: blur(0.3px);
  transform: translateX(18px) rotateY(-10deg) scale(0.97);
}

.page-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  padding: 34px 30px;
}

.page-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--yellow);
  font-family: var(--latin-font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 26px;
  border: 1px solid rgba(255, 202, 31, 0.35);
  border-radius: 999px;
  color: var(--yellow);
  font-size: 11px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--display-font);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.13;
  text-wrap: balance;
}

h1 {
  max-width: 7.2em;
  font-size: 56px;
}

h2 {
  font-size: 36px;
}

.subtitle {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.copy.top {
  justify-content: flex-start;
}

.lead {
  margin: 0;
  color: #fff8df;
  font-family: var(--display-font);
  font-size: 21px;
  font-weight: 400;
  line-height: 1.72;
}

.body-copy {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.85;
}

.body-copy + .body-copy,
.lead + .body-copy,
.callout + .body-copy,
.body-copy + .callout {
  margin-top: 14px;
}

.quote {
  margin: 20px 0 0;
  padding: 16px 0 0 18px;
  border-left: 3px solid var(--yellow);
  color: #fff4c5;
  font-family: var(--display-font);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.65;
}

.bullet-list,
.number-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bullet-list li,
.number-list li {
  position: relative;
  padding-left: 20px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.6;
}

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

.number-list {
  counter-reset: step;
}

.number-list li {
  padding-left: 34px;
}

.number-list li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.12em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--yellow);
  color: #050505;
  font-size: 12px;
  font-weight: 700;
}

.callout {
  padding: 14px 16px;
  border: 1px solid rgba(255, 202, 31, 0.28);
  border-radius: 6px;
  background: rgba(255, 202, 31, 0.08);
  color: #fff2bf;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.66;
}

.qr-card {
  display: grid;
  justify-items: center;
  width: min(238px, 100%);
  margin: 18px auto 0;
  padding: 12px 12px 10px;
  border: 1px solid rgba(255, 202, 31, 0.44);
  border-radius: 8px;
  background: #f8f4eb;
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.3);
}

.qr-card img {
  display: block;
  width: 100%;
  aspect-ratio: 517 / 612;
  object-fit: cover;
  border-radius: 4px;
}

.qr-card p {
  margin: 8px 0 0;
  color: #121212;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(380px, 100%);
  margin: 18px auto 0;
}

.qr-grid .qr-card {
  width: 100%;
  margin: 0;
  padding: 8px;
}

.qr-grid .qr-card p {
  margin-top: 6px;
  font-size: 12px;
}

.qr-grid .qr-card img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #fff;
}

.split-grid {
  display: grid;
  gap: 12px;
  margin: 0;
}

.split-grid.tail-rows {
  margin-top: 14px;
}

.info-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.info-row:first-child {
  border-top: 0;
}

.info-row strong {
  color: var(--yellow);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.info-row span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.6;
}

.cover {
  background:
    linear-gradient(180deg, rgba(255, 202, 31, 0.14), transparent 38%),
    repeating-linear-gradient(90deg, transparent 0 34px, rgba(255, 202, 31, 0.04) 34px 35px),
    #050505;
}

.cover .page-inner {
  justify-content: space-between;
}

.cover-logo {
  width: 104px;
  height: 104px;
  margin-bottom: 22px;
  border: 2px solid rgba(255, 202, 31, 0.56);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 8px rgba(255, 202, 31, 0.08);
}

.cover-kicker {
  margin: 0 0 14px;
  color: var(--yellow);
  font-family: var(--latin-font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

.cover h1 span {
  display: inline-block;
  color: var(--yellow);
  font-family: var(--latin-font);
  font-size: 0.92em;
  font-style: italic;
  line-height: 0.88;
}

.cover-foot {
  display: grid;
  gap: 10px;
}

.cover-line {
  width: 88px;
  height: 4px;
  border-radius: 99px;
  background: var(--yellow);
}

.cover-note {
  max-width: 21em;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.section-page {
  background:
    linear-gradient(135deg, rgba(255, 202, 31, 0.18), transparent 36%),
    linear-gradient(145deg, #0b0b0b, #050505);
}

.section-label {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 18px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--yellow);
  color: #080808;
  font-size: 12px;
  font-weight: 700;
}

.closing-logo {
  width: 90px;
  height: 90px;
  margin: 0 auto 20px;
  border-radius: 50%;
  object-fit: cover;
}

.controls {
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  gap: 12px;
  align-items: center;
  padding-top: 12px;
}

.icon-button,
.menu-button {
  height: 48px;
  border: 1px solid rgba(255, 202, 31, 0.34);
  border-radius: 8px;
  background: rgba(10, 10, 10, 0.84);
  color: var(--yellow);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.icon-button span {
  display: block;
  translate: 0 -2px;
  font-size: 34px;
  font-weight: 700;
}

.icon-button.primary {
  background: var(--yellow);
  color: #050505;
}

.menu-button {
  color: var(--ink);
  background: rgba(255, 202, 31, 0.13);
  font-size: 14px;
  font-weight: 500;
}

.icon-button:disabled {
  cursor: default;
  opacity: 0.34;
}

.toc-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: end;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.toc-panel.is-open {
  opacity: 1;
  pointer-events: auto;
}

.toc-card {
  width: min(100%, 500px);
  max-height: min(76vh, 700px);
  overflow: hidden;
  border: 1px solid rgba(255, 202, 31, 0.34);
  border-radius: 8px;
  background: #0a0a0a;
  box-shadow: var(--shadow);
}

.toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
  border-bottom: 1px solid rgba(255, 202, 31, 0.18);
}

.toc-head p {
  margin: 0;
  color: var(--yellow);
  font-family: var(--latin-font);
  font-size: 12px;
  font-weight: 700;
}

.close-button {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--yellow);
  font-size: 24px;
}

.toc-list {
  display: grid;
  max-height: calc(min(76vh, 700px) - 62px);
  overflow: auto;
  padding: 8px;
}

.jump-button {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 6px;
  background: transparent;
  text-align: left;
}

.jump-button:hover,
.jump-button.is-current {
  background: rgba(255, 202, 31, 0.12);
}

.jump-button b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 202, 31, 0.15);
  color: var(--yellow);
  font-size: 12px;
}

.jump-button span {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

@media (max-height: 720px) {
  .page-inner {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  h2 {
    font-size: 26px;
  }

  .lead {
    font-size: 18px;
  }

  .body-copy,
  .bullet-list li,
  .number-list li,
  .info-row span {
    font-size: 14px;
  }
}

@media (min-width: 760px) {
  .app {
    width: min(100vw, 460px);
  }
}

@media print {
  body {
    overflow: visible;
    background: #050505;
  }

  .ambient,
  .topbar,
  .progress,
  .controls,
  .toc-panel {
    display: none !important;
  }

  .app {
    display: block;
    width: 1080px;
    height: auto;
    padding: 0;
  }

  .book {
    perspective: none;
  }

  .page {
    position: relative;
    inset: auto;
    display: flex !important;
    width: 1080px;
    height: 1920px;
    page-break-after: always;
    border-radius: 0;
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
}
