.chapter-story {
  --story-accent: var(--cyan, #52d6df);
  --story-accent-2: var(--lime, #d9f257);
  position: relative;
  overflow: hidden;
  padding: clamp(26px, 5vw, 54px);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: clamp(22px, 4vw, 34px);
  background:
    radial-gradient(circle at 92% 8%, color-mix(in srgb, var(--story-accent) 25%, transparent), transparent 25%),
    linear-gradient(145deg, #172126, #0e1113 58%);
  color: #f8f5ec;
  box-shadow: 0 30px 76px rgba(16, 19, 22, .2);
}

.chapter-story[data-story-tone="valley"] {
  --story-accent: var(--orange, #ff6b42);
  --story-accent-2: var(--cyan, #52d6df);
}

.chapter-story[data-story-tone="sigma"] {
  --story-accent: var(--lime, #d9f257);
  --story-accent-2: var(--cyan, #52d6df);
}

.chapter-story::after {
  content: "STORY";
  position: absolute;
  top: -42px;
  right: -14px;
  color: rgba(255, 255, 255, .035);
  font: 900 clamp(6rem, 16vw, 13rem)/1 Georgia, serif;
  letter-spacing: -.08em;
  pointer-events: none;
}

.chapter-story .section-kicker {
  position: relative;
  z-index: 1;
  color: var(--story-accent);
}

.chapter-story .story-opening {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, .16);
}

.chapter-story .story-opening h2 {
  max-width: 780px;
  margin-bottom: 12px;
  color: #fff;
}

.chapter-story .story-opening p {
  max-width: 720px;
  margin: 0;
  color: #cfd7d7;
  font-size: 1rem;
}

.story-seal {
  width: 104px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--story-accent) 62%, transparent);
  border-radius: 50%;
  color: var(--story-accent);
  background: rgba(255, 255, 255, .045);
  box-shadow: inset 0 0 0 8px rgba(255, 255, 255, .025);
  font: 900 2rem/1 Georgia, serif;
}

.story-cast {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 4px;
}

.story-cast span {
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  color: #dce4e4;
  background: rgba(255, 255, 255, .05);
  font-size: .74rem;
  font-weight: 800;
}

.story-comic {
  position: relative;
  z-index: 1;
  overflow: hidden;
  margin: 28px 0 36px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-top: 7px solid var(--story-accent);
  border-radius: 22px;
  background: #f7f2e7;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .24);
}

.story-comic-frame {
  padding: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .08), transparent 40%),
    #151b20;
}

.story-comic-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
}

.story-comic figcaption {
  padding: 22px;
  color: #101316;
}

.story-comic-caption {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding-bottom: 16px;
  border-bottom: 1px solid #d9d2c5;
}

.story-comic-caption small {
  color: #397077;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .13em;
}

.story-comic-caption strong {
  max-width: 520px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 1.08rem;
  text-align: right;
}

.story-comic-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding-top: 16px;
}

.story-comic-note {
  padding: 12px;
  border: 1px solid #ded7ca;
  border-radius: 13px;
  background: #fffdf8;
}

.story-comic-note b {
  display: block;
  line-height: 1.35;
}

.story-comic-note b span {
  display: block;
  margin-bottom: 6px;
  color: #d95c38;
  font: 900 1.2rem/1 Georgia, serif;
}

.story-comic-note p {
  margin: 7px 0 0;
  color: #596165;
  font-size: .76rem;
  line-height: 1.65;
}

.story-comic-portrait {
  max-width: 760px;
  margin-right: auto;
  margin-left: auto;
}

.story-comic-portrait .story-comic-caption {
  display: grid;
  align-items: start;
}

.story-comic-portrait .story-comic-caption strong {
  max-width: none;
  text-align: left;
}

.story-comic-portrait .story-comic-notes {
  grid-template-columns: 1fr;
}

.story-comic-portrait .story-comic-note {
  display: grid;
  grid-template-columns: minmax(180px, .7fr) 1.3fr;
  gap: 16px;
  align-items: start;
}

.story-comic-portrait .story-comic-note p {
  margin: 0;
}

.story-scenes {
  position: relative;
  z-index: 1;
}

.story-scene {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: clamp(18px, 4vw, 34px);
  padding: clamp(26px, 5vw, 46px) 0;
  border-bottom: 1px solid rgba(255, 255, 255, .13);
}

.story-scene:last-child {
  border-bottom: 0;
}

.story-scene-marker {
  align-self: start;
  position: sticky;
  top: 92px;
  color: var(--story-accent);
  font: 900 .72rem/1.25 Georgia, serif;
  letter-spacing: .13em;
}

.story-scene-marker b {
  display: block;
  margin-top: 7px;
  color: #fff;
  font-size: 2.3rem;
  letter-spacing: -.04em;
}

.story-scene-copy {
  max-width: 800px;
}

.story-scene-picturebook .story-scene-copy {
  max-width: 860px;
}

.story-page-figure {
  overflow: hidden;
  margin: 0 0 26px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 22px;
  background: #f7f2e7;
  box-shadow: 0 22px 52px rgba(0, 0, 0, .26);
}

.story-page-figure img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: #d8e8e7;
}

.story-page-figure figcaption {
  padding: 16px 18px 18px;
  border-top: 5px solid var(--story-accent);
  background: #fffdf8;
  color: #394247;
  font-size: .86rem;
  line-height: 1.72;
}

.story-page-figure figcaption span {
  display: block;
  margin-bottom: 4px;
  color: #397077;
  font-size: .68rem;
  font-weight: 900;
  letter-spacing: .13em;
}

.story-page-figure + h3 {
  margin-top: 0;
}

.story-scene-copy h3 {
  margin: 0 0 14px;
  color: var(--story-accent-2);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(1.28rem, 2.5vw, 1.75rem);
}

.story-scene-copy p {
  margin: 0 0 14px;
  color: #e0e5e4;
}

.story-dialogue {
  margin: 18px 0;
  padding: 16px 18px;
  border-left: 4px solid var(--story-accent);
  border-radius: 0 14px 14px 0;
  background: rgba(255, 255, 255, .075);
  color: #fff;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 1.02rem;
}

.story-dialogue b {
  color: var(--story-accent);
}

.story-math {
  display: block;
  max-width: 690px;
  margin: 18px 0;
  padding: 15px 18px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 14px;
  background: #f8f4e9;
  color: #101316;
  text-align: center;
  font: 800 clamp(1.08rem, 3vw, 1.45rem)/1.55 Georgia, "Times New Roman", serif;
}

.story-mini-rule {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 18px;
}

.story-mini-rule span {
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
  color: #dce4e4;
  font-size: .82rem;
}

.story-mini-rule b {
  display: block;
  color: var(--story-accent);
}

.story-memory {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  padding: clamp(22px, 4vw, 32px);
  border-radius: 20px;
  background: var(--story-accent-2);
  color: #101316;
}

.story-memory small {
  display: block;
  margin-bottom: 8px;
  font-weight: 900;
  letter-spacing: .14em;
}

.story-memory blockquote {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(1.2rem, 3.1vw, 1.75rem);
  font-weight: 900;
  line-height: 1.55;
}

.story-knowledge-route {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  color: #cbd3d3;
  font-size: .78rem;
}

.story-knowledge-route span {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
}

.story-knowledge-route i {
  color: var(--story-accent);
  font-style: normal;
  font-weight: 900;
}

.story-question {
  border-left-color: var(--story-accent-2);
  background: color-mix(in srgb, var(--story-accent-2) 11%, rgba(255, 255, 255, .05));
}

.story-question b {
  display: block;
  margin-bottom: 6px;
  color: var(--story-accent-2);
}

.story-action {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  padding: 20px 22px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 18px;
  background: rgba(255, 255, 255, .065);
}

.story-action h3 {
  margin: 0 0 12px;
  color: #fff;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 1.15rem;
}

.story-action ul {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.story-action li {
  padding: 12px 13px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
  color: #dfe6e5;
  font-size: .82rem;
}

.story-action li::before {
  content: "✓";
  margin-right: 7px;
  color: var(--story-accent);
  font-weight: 900;
}

@media (max-width: 680px) {
  .chapter-story {
    margin-left: -2px;
    margin-right: -2px;
    padding: 24px 18px;
  }

  .chapter-story .story-opening {
    grid-template-columns: 1fr;
  }

  .story-seal {
    width: 76px;
    font-size: 1.45rem;
  }

  .story-scene {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .story-scene-marker {
    position: static;
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  .story-scene-marker b {
    display: inline;
    font-size: 1.65rem;
  }

  .story-page-figure {
    margin-right: -4px;
    margin-left: -4px;
    border-radius: 16px;
  }

  .story-page-figure figcaption {
    padding: 13px 14px 15px;
  }

  .story-mini-rule {
    grid-template-columns: 1fr;
  }

  .story-comic-caption {
    display: grid;
    align-items: start;
  }

  .story-comic-caption strong {
    text-align: left;
  }

  .story-comic-notes {
    grid-template-columns: 1fr;
  }

  .story-comic-portrait .story-comic-note {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .story-action ul {
    grid-template-columns: 1fr;
  }
}

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