:root {
  --bg-a: #f8f7ff;
  --bg-b: #f5f7e8;
  --ink: #1f2d3f;
  --muted: #5c6a7b;
  --brand: #ff7c4a;
  --brand-strong: #ff5a2a;
  --accent: #4ba3ff;
  --card: rgba(255, 255, 255, 0.84);
  --line: rgba(31, 45, 63, 0.16);
  --shadow: 0 18px 40px rgba(43, 62, 83, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "华文细黑", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(70% 45% at 10% 5%, #ffe3d6 0%, transparent 55%),
    radial-gradient(65% 40% at 95% 95%, #dff3ff 0%, transparent 52%),
    linear-gradient(165deg, var(--bg-a), var(--bg-b));
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

.home-shell,
.series-shell,
.story-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 36px;
}

body:has(.story) {
  overflow: hidden;
}

.story-shell {
  max-width: none;
}

body:has(.story) .story-shell {
  width: 100vw;
  height: 100svh;
  padding: 0;
}

.hero {
  border-radius: 18px;
  padding: 28px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(250, 247, 245, 0.74));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
}

.title {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  letter-spacing: 0.02em;
}

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

.series-list,
.story-list {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.series-card,
.story-card,
.story-nav {
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.series-card:hover,
.story-card:hover,
.story-nav:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 35px rgba(43, 62, 83, 0.19);
}

.series-card,
.story-card {
  display: block;
  padding: 16px;
}

.series-card h2,
.story-card h2,
.story-card h3 {
  margin: 0 0 10px;
}

.series-card p,
.story-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.story-card {
  padding-bottom: 10px;
}

.story-number {
  display: inline-block;
  margin: 0 0 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(75, 163, 255, 0.14);
  color: #236da8;
  font-size: 0.82rem;
  font-weight: 700;
}

.cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  margin: 0 0 12px;
}

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

.tag {
  display: inline-block;
  margin-top: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 124, 74, 0.14);
  color: var(--brand-strong);
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.story {
  position: relative;
  width: 100vw;
  height: 100svh;
  min-height: 100svh;
  margin: 0 auto;
  display: block;
  touch-action: pan-y;
  user-select: none;
}

.story .slide {
  width: 100%;
  margin: 0;
  height: 100svh;
  min-height: 100svh;
  padding: clamp(24px, 5vw, 56px);
  border-radius: 0;
  background: #fff;
  border: none;
  box-shadow: none;
  position: relative;
  opacity: 1;
  pointer-events: auto;
  overflow: hidden;
}

.story.interactive .slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.story .slide.active {
  opacity: 1;
  pointer-events: auto;
}

.story.interactive .slide.active {
  opacity: 1;
  pointer-events: auto;
}

.story .slide p {
  margin: 0;
  font-size: clamp(1.55rem, 3.2vw, 2.8rem);
  line-height: 1.65;
  letter-spacing: 0;
  max-width: 22em;
}

.story .slide img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  max-height: 74svh;
  object-fit: contain;
  border-radius: 18px;
  border: none;
  box-shadow: 0 20px 48px rgba(31, 45, 63, 0.2);
}

.text-slide,
.image-slide {
  display: grid;
  place-items: center;
  gap: 22px;
  text-align: center;
}

.portrait-slide {
  display: grid;
  grid-template-rows: minmax(0, 34%) minmax(0, 66%);
  gap: clamp(14px, 2.4vw, 28px);
  align-items: stretch;
}

.slide-text {
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 8px;
}

.slide-text h2 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.15;
}

.slide-image {
  display: grid;
  place-items: center;
  min-height: 0;
}

.slide-image img {
  width: min(100%, 1120px);
  height: auto;
  max-height: 100%;
}

.mixed-slide {
  display: grid;
  align-items: center;
  gap: clamp(24px, 4vw, 48px);
  grid-template-columns: 1fr 1fr;
}

.story-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.story .slide figure {
  margin: 0;
}

.story-controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  justify-content: center;
  pointer-events: none;
  z-index: 20;
}

.story-back,
.page-back {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 30;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(21, 31, 45, 0.32);
  color: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.96rem;
  backdrop-filter: blur(12px);
}

.page-back {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(21, 31, 45, 0.42);
  box-shadow: 0 10px 24px rgba(31, 45, 63, 0.16);
}

.control-bar {
  width: min(260px, calc(100vw - 220px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(21, 31, 45, 0.3);
  color: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  gap: 6px;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

.progress {
  min-width: 78px;
  text-align: center;
  font-size: 0.98rem;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.24);
}

.story-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  width: 48px;
  min-width: 48px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.86);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.32);
  transition: color 0.16s ease, transform 0.16s ease;
}

.story-nav:hover {
  color: #fff;
  transform: scale(1.08);
}

.story-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.full-toggle {
  display: none;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  height: 46px;
  cursor: pointer;
}

.story-click-zones {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  z-index: 10;
}

.story-click-zones button {
  flex: 1;
  border: none;
  background: transparent;
  pointer-events: auto;
  opacity: 0;
}

@media (max-width: 760px) {
  .story .slide {
    padding: 22px;
    min-height: 100svh;
  }

  .mixed-slide {
    grid-template-columns: 1fr;
  }

  .portrait-slide {
    grid-template-rows: minmax(0, 38%) minmax(0, 62%);
  }

  .story .slide p {
    font-size: clamp(1.25rem, 6vw, 1.65rem);
    line-height: 1.72;
  }

  .control-bar {
    width: min(230px, calc(100vw - 126px));
  }

  .story-nav {
    width: 42px;
    min-width: 42px;
    height: 40px;
    padding: 0;
    font-size: 1.7rem;
  }

  .story-back,
  .page-back {
    min-width: 92px;
    height: 40px;
    padding: 0 12px;
    font-size: 0.88rem;
  }
}

@media (orientation: landscape) and (max-height: 820px) {
  .story .slide img {
    max-height: 78svh;
  }

  .story .slide p {
    font-size: clamp(1.35rem, 2.6vw, 2.2rem);
  }
}
