:root {
  color-scheme: dark;
  font-family:
    "PingFang SC",
    "Microsoft YaHei",
    "Noto Sans CJK SC",
    "Heiti SC",
    Arial,
    sans-serif;
  background: #0d1015;
  color: #f5f7fb;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(31, 42, 56, 0.76), rgba(9, 11, 15, 0.98)),
    #0d1015;
}

button,
a {
  font: inherit;
}

.app-shell {
  min-height: 100dvh;
}

.boot,
.error-state {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 32px;
  text-align: center;
}

.boot p,
.error-state h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 1000;
}

.error-state {
  gap: 18px;
}

.error-state p {
  margin: 0;
  color: rgba(245, 247, 251, 0.72);
}

.error-state code {
  max-width: 100%;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffdf4d;
}

.reader-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100%;
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top)) 18px max(12px, env(safe-area-inset-bottom));
}

.topbar,
.reader-footer {
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 1080px);
  margin: 0 auto;
}

.topbar {
  height: 58px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 20px;
  font-weight: 1000;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(255, 216, 77, 0.42);
  border-radius: 9px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 240, 128, 0.34), transparent 34%),
    linear-gradient(145deg, #262019 0%, #101318 48%, #203447 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.08),
    0 10px 30px rgba(0, 0, 0, 0.28);
  color: #ffdf4d;
  font-size: 19px;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.36);
  transform: rotate(-4deg);
}

.brand-mark::after {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #26e0ff;
  box-shadow: 0 0 14px rgba(38, 224, 255, 0.8);
  content: "";
}

.edition {
  display: inline-flex;
  gap: 10px;
  color: rgba(245, 247, 251, 0.68);
  font-size: 13px;
  font-weight: 800;
}

.stage {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
}

.deck {
  display: flex;
  width: min(100%, 1180px);
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  outline: none;
}

.deck::-webkit-scrollbar {
  display: none;
}

.slide {
  position: relative;
  display: grid;
  flex: 0 0 100%;
  min-width: 100%;
  grid-template-columns: minmax(260px, 430px) minmax(260px, 420px);
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 10px 78px;
  scroll-snap-align: center;
}

.cover-wrap {
  position: relative;
  width: min(430px, calc(100dvh * 0.46));
  max-width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 42px 90px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.cover-wrap::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  content: "";
  pointer-events: none;
}

.cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-panel {
  width: min(100%, 420px);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.05)),
    rgba(13, 16, 21, 0.72);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.story-panel__meta {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 16px;
  color: color-mix(in srgb, var(--accent) 76%, white);
  font-size: 12px;
  font-weight: 900;
}

.story-panel h1 {
  margin: 0;
  color: #fff;
  font-size: 30px;
  font-weight: 1000;
  line-height: 1.14;
}

.story-panel p {
  margin: 16px 0 22px;
  color: rgba(245, 247, 251, 0.76);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.7;
}

.story-panel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 94px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--warn) 68%, white);
  border-radius: 6px;
  background: color-mix(in srgb, var(--warn) 22%, transparent);
  color: #fff;
  font-size: 14px;
  font-weight: 1000;
  text-decoration: none;
}

.reader-footer {
  height: 42px;
  justify-content: center;
}

.dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: min(100%, 520px);
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(7, 10, 14, 0.42);
  backdrop-filter: blur(18px);
}

.dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  cursor: pointer;
  transition:
    width 180ms ease,
    background-color 180ms ease,
    opacity 180ms ease;
}

.dot.is-active {
  width: 28px;
  background: #ffdf4d;
  box-shadow: 0 0 18px rgba(255, 223, 77, 0.45);
}

@media (max-width: 840px) {
  body {
    overflow: hidden;
  }

  .reader-shell {
    grid-template-rows: auto 1fr auto;
    padding-right: 0;
    padding-left: 0;
  }

  .topbar {
    height: 46px;
    padding: 0 18px;
  }

  .brand {
    font-size: 18px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 18px;
  }

  .edition {
    gap: 7px;
    font-size: 12px;
  }

  .slide {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 0;
    padding: 4px 10px 6px;
  }

  .cover-wrap {
    width: min(calc(100vw - 20px), calc((100dvh - 104px) * 9 / 16));
    max-height: calc(100dvh - 104px);
    justify-self: center;
    border-radius: 22px;
  }

  .story-panel {
    position: absolute;
    right: 18px;
    bottom: 10px;
    z-index: 7;
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .story-panel__meta {
    display: none;
  }

  .story-panel h1 {
    display: none;
  }

  .story-panel p {
    display: none;
  }

  .story-panel a {
    min-width: 56px;
    min-height: 32px;
    padding: 0 12px;
    border-color: rgba(255, 255, 255, 0.26);
    background: rgba(7, 10, 14, 0.38);
    font-size: 12px;
    backdrop-filter: blur(14px);
  }

  .reader-footer {
    height: 44px;
  }

  .dots {
    gap: 7px;
    padding: 8px 11px;
    border-color: rgba(255, 255, 255, 0.10);
    background: rgba(7, 10, 14, 0.34);
  }

  .dot {
    width: 6px;
    height: 6px;
  }

  .dot.is-active {
    width: 24px;
  }
}

@media (max-width: 390px) {
  .slide {
    padding-right: 8px;
    padding-left: 8px;
  }

  .cover-wrap {
    width: min(calc(100vw - 16px), calc((100dvh - 100px) * 9 / 16));
    max-height: calc(100dvh - 100px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .deck {
    scroll-behavior: auto;
  }

  .dot {
    transition: none;
  }
}
