.historia-page {
  --story-ink: #15283c;
  --story-muted: #65778a;
  --story-blue: #438fc8;
  --story-ice: #eaf6ff;
  --story-gold: #c49c45;
  --story-violet: #7f69bd;
  background:
    radial-gradient(ellipse at 15% 14%, rgba(211, 237, 255, 0.56), transparent 34rem),
    linear-gradient(180deg, #f5faff 0%, #f7f9fc 48%, #edf5fb 100%);
  color: var(--story-ink);
}

.historia-page .historia-nav-active {
  color: var(--story-blue);
}

.historia-page .historia-nav-active::before {
  width: 80%;
}

.story-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.92fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  max-width: 1240px;
  margin: 2.4rem auto 3.6rem;
  padding: 0 1.5rem;
}

.story-hero-copy {
  position: relative;
  z-index: 1;
  padding: 2rem 0;
}

.story-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  color: var(--story-blue);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.story-eyebrow > span {
  width: 25px;
  height: 1px;
  background: var(--story-gold);
}

.story-type-label {
  margin: 0 0 0.15rem;
  color: var(--story-gold);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.story-hero h1 {
  margin: 0;
  color: #183657;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.35rem, 7.3vw, 6.25rem);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 0.98;
}

.story-hero h1 span {
  display: block;
  color: #71afd8;
}

.story-subtitle {
  margin-top: 1.1rem;
  color: #304c68;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  font-style: italic;
}

.story-description {
  max-width: 560px;
  margin-top: 1rem;
  color: #53677b;
  font-size: 1rem;
  line-height: 1.8;
}

.story-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.2rem;
  margin-top: 1.5rem;
  color: #65788b;
  font-size: 0.82rem;
}

.story-stats span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.story-stats i {
  color: var(--story-blue);
}

.story-start-button {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.7rem;
  padding: 0.92rem 1.45rem;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #4a9ee8, #337cb8);
  box-shadow: 0 9px 24px rgba(49, 119, 180, 0.24);
  color: white;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.story-start-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(49, 119, 180, 0.34);
}

.story-start-button i {
  pointer-events: none;
}

.story-hero-art {
  position: relative;
  z-index: 1;
  overflow: hidden;
  min-height: 330px;
  aspect-ratio: 1.22;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 25px 25px 25px 7px;
  background: #dcecf8;
  box-shadow: 0 25px 65px rgba(44, 77, 111, 0.2), 0 0 0 7px rgba(255, 255, 255, 0.4);
}

.story-hero-art::after {
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(transparent, rgba(12, 26, 43, 0.72));
  content: "";
}

.story-hero-art img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 330px;
  object-fit: cover;
}

.story-hero-art-caption {
  position: absolute;
  z-index: 1;
  right: 1.25rem;
  bottom: 1rem;
  left: 1.25rem;
  color: white;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  font-style: italic;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.story-hero-glow {
  position: absolute;
  z-index: -1;
  top: 13%;
  right: 2%;
  width: 44%;
  height: 75%;
  border-radius: 50%;
  background: rgba(132, 195, 232, 0.23);
  filter: blur(65px);
}

.story-layout {
  display: grid;
  grid-template-columns: minmax(230px, 285px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(1rem, 2.4vw, 2rem);
  max-width: 1240px;
  margin: 0 auto 5rem;
  padding: 0 1.5rem;
  scroll-margin-top: 105px;
}

.story-index {
  position: sticky;
  top: 101px;
  overflow: hidden;
  border: 1px solid rgba(89, 134, 173, 0.13);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.91);
  box-shadow: 0 11px 34px rgba(31, 74, 113, 0.07);
}

.story-index-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1.1rem 1.1rem 0.85rem;
}

.story-index-heading .story-eyebrow {
  margin-bottom: 0.2rem;
  font-size: 0.63rem;
}

.story-index-heading h2 {
  margin: 0;
  color: var(--story-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
}

.story-index-count {
  padding: 0.3rem 0.5rem;
  border-radius: 999px;
  background: #eef6fc;
  color: #5b7a97;
  font-size: 0.65rem;
  white-space: nowrap;
}

.chapter-index-list {
  display: grid;
  gap: 0.25rem;
  max-height: min(49vh, 450px);
  overflow-y: auto;
  padding: 0 0.55rem 0.6rem;
  scrollbar-color: #b9d8eb transparent;
  scrollbar-width: thin;
}

.chapter-index-button {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.62rem 0.55rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #53697e;
  text-align: left;
  transition: background 160ms ease, color 160ms ease;
}

.chapter-index-button:hover {
  background: #f1f8fd;
  color: #28577f;
}

.chapter-index-button[aria-current="step"] {
  background: linear-gradient(110deg, #e7f4fd, #f6fbff);
  color: #235a87;
}

.chapter-index-number {
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  border: 1px solid #dfebf3;
  border-radius: 50%;
  background: white;
  color: #7b94a9;
  font-size: 0.64rem;
  font-weight: 700;
}

.chapter-index-button[aria-current="step"] .chapter-index-number {
  border-color: #81b4d7;
  background: #4a9ee8;
  color: white;
}

.chapter-index-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.77rem;
  font-weight: 600;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.story-index-note {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0 0.7rem;
  padding: 0.85rem 0.35rem 0.95rem;
  border-top: 1px solid #edf2f6;
  color: #8493a2;
  font-size: 0.68rem;
  line-height: 1.55;
}

.story-index-note i {
  margin-top: 0.15rem;
  color: var(--story-gold);
}

.chapter-card {
  min-width: 0;
  padding: clamp(1.1rem, 3.4vw, 2.5rem);
  border: 1px solid rgba(87, 135, 175, 0.15);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 48px rgba(31, 74, 113, 0.075);
}

.story-status {
  display: grid;
  min-height: 240px;
  place-items: center;
  color: #5c748b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  text-align: center;
}

.story-status[hidden],
#chapter-content[hidden] {
  display: none;
}

.story-status.is-error {
  color: #943f4a;
}

.chapter-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.chapter-kicker,
.chapter-reading-time {
  color: #718598;
  font-size: 0.73rem;
  font-weight: 600;
}

.chapter-kicker {
  color: var(--story-blue);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chapter-reading-time {
  white-space: nowrap;
}

.chapter-progress {
  overflow: hidden;
  height: 4px;
  margin-bottom: 1.55rem;
  border-radius: 99px;
  background: #eaf1f6;
}

.chapter-progress > span {
  display: block;
  width: 8.333%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #74b8e2, #c4a15b);
  transition: width 300ms ease;
}

.chapter-art {
  position: relative;
  overflow: hidden;
  margin: 0;
  aspect-ratio: 16 / 7.4;
  border-radius: 13px;
  background: linear-gradient(135deg, #c7e4f5, #242a42);
}

.chapter-art::after {
  position: absolute;
  inset: 55% 0 0;
  background: linear-gradient(transparent, rgba(9, 20, 35, 0.52));
  content: "";
  pointer-events: none;
}

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

.chapter-art figcaption {
  position: absolute;
  z-index: 1;
  right: 1rem;
  bottom: 0.75rem;
  left: 1rem;
  color: rgba(255, 255, 255, 0.92);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.8rem;
  font-style: italic;
  text-align: right;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.chapter-heading {
  padding: 1.7rem 0 1.4rem;
  text-align: center;
}

.chapter-story-label {
  margin-bottom: 0.45rem;
  color: #8a9aaa;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.chapter-title {
  max-width: 760px;
  margin: 0 auto;
  color: #1a3856;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 2.85rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.18;
}

.chapter-heading-flourish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1rem;
  color: #b69a61;
  font-size: 0.78rem;
}

.chapter-heading-flourish span {
  width: 34px;
  height: 1px;
  background: #e4d7bb;
}

.chapter-prose {
  max-width: 760px;
  margin: 0 auto;
  color: #34485b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.03rem, 1.5vw, 1.12rem);
  line-height: 1.92;
}

.chapter-prose p {
  margin: 0 0 1.15em;
}

.chapter-prose p:last-child {
  margin-bottom: 0;
}

.chapter-navigation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #edf2f6;
}

.chapter-nav-button {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  padding: 0.65rem 0.8rem;
  border: 1px solid #e4edf4;
  border-radius: 12px;
  background: #fbfdff;
  color: #315979;
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.chapter-nav-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #afcfe5;
  background: #f2f9fe;
}

.chapter-nav-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.chapter-nav-button > i {
  color: var(--story-blue);
}

.chapter-nav-button span {
  display: grid;
  min-width: 0;
  gap: 0.1rem;
}

.chapter-nav-button small {
  color: #8797a7;
  font-size: 0.66rem;
}

.chapter-nav-button strong {
  overflow: hidden;
  color: #36536d;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-nav-next {
  justify-content: flex-end;
  text-align: right;
}

.historia-footer {
  border-top: 1px solid rgba(89, 134, 173, 0.13);
}

.historia-footer .footer-text {
  color: #66819a;
}

.story-world-guide {
  margin: 0 auto 4rem;
  padding: 0 1.5rem;
}

.story-world-inner {
  max-width: 1192px;
  margin: 0 auto;
  padding: clamp(1.35rem, 4vw, 2.6rem);
  border: 1px solid rgba(89, 134, 173, 0.15);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.83);
  box-shadow: 0 12px 36px rgba(31, 74, 113, 0.055);
}

.story-world-inner > .story-eyebrow {
  margin-bottom: 0.55rem;
}

.story-world-inner > h2 {
  margin: 0;
  color: #1a3856;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 3.5vw, 2.35rem);
  line-height: 1.2;
}

.story-world-intro {
  max-width: 900px;
  margin: 0.9rem 0 1.45rem;
  color: #53677b;
  font-size: 0.95rem;
  line-height: 1.8;
}

.story-world-grid,
.story-question-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.story-world-card,
.story-question-grid article {
  padding: 1.05rem;
  border: 1px solid #e5edf4;
  border-radius: 13px;
  background: linear-gradient(145deg, #fbfdff, #f5f9fc);
}

.story-world-icon {
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  margin-bottom: 0.65rem;
  place-items: center;
  border-radius: 10px;
  background: #e5f4eb;
  color: #508b69;
}

.story-world-icon-nether {
  background: #fff0e9;
  color: #c16e43;
}

.story-world-icon-end {
  background: #f0eafa;
  color: #7966b4;
}

.story-world-card h3,
.story-question-grid h4 {
  margin: 0 0 0.38rem;
  color: #2a4660;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
}

.story-world-card p,
.story-question-grid p {
  margin: 0;
  color: #697b8d;
  font-size: 0.82rem;
  line-height: 1.65;
}

.story-questions {
  margin-top: 1.7rem;
  padding-top: 1.4rem;
  border-top: 1px solid #e8eef3;
}

.story-questions > h3 {
  margin: 0 0 0.8rem;
  color: #405b73;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
}

.story-question-grid h4 {
  font-size: 0.95rem;
  line-height: 1.4;
}

@media (max-width: 850px) {
  .story-world-grid,
  .story-question-grid {
    grid-template-columns: 1fr;
  }

  .story-hero {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.8fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
  }

  .story-hero-art,
  .story-hero-art img {
    min-height: 270px;
  }

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

  .story-index {
    position: static;
  }

  .chapter-index-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 250px;
  }

  .story-index-note {
    margin-top: 0;
  }
}

@media (max-width: 600px) {
  .story-hero {
    grid-template-columns: 1fr;
    gap: 1.15rem;
    margin: 0.8rem auto 2rem;
    padding: 0 1rem;
  }

  .story-hero-copy {
    padding: 1.2rem 0 0;
  }

  .story-eyebrow {
    font-size: 0.66rem;
  }

  .story-hero h1 {
    font-size: clamp(3.2rem, 15vw, 4.8rem);
  }

  .story-subtitle {
    margin-top: 0.8rem;
  }

  .story-description {
    font-size: 0.92rem;
  }

  .story-start-button {
    margin-top: 1.15rem;
  }

  .story-hero-art,
  .story-hero-art img {
    min-height: 0;
  }

  .story-hero-art {
    aspect-ratio: 1.48;
    border-radius: 18px 18px 18px 5px;
  }

  .story-layout {
    gap: 0.9rem;
    margin-bottom: 3rem;
    padding: 0 0.75rem;
  }

  .story-index {
    border-radius: 13px;
  }

  .story-index-heading {
    padding: 0.85rem 0.85rem 0.65rem;
  }

  .chapter-index-list {
    grid-template-columns: 1fr 1fr;
    max-height: 206px;
    padding: 0 0.4rem 0.4rem;
  }

  .chapter-index-button {
    grid-template-columns: 1.65rem minmax(0, 1fr);
    gap: 0.38rem;
    padding: 0.48rem 0.35rem;
  }

  .chapter-index-number {
    width: 1.55rem;
    height: 1.55rem;
    font-size: 0.58rem;
  }

  .chapter-index-title {
    font-size: 0.68rem;
  }

  .story-index-note {
    padding: 0.65rem 0.25rem 0.75rem;
  }

  .chapter-card {
    padding: 0.85rem 0.85rem 1rem;
    border-radius: 14px;
  }

  .chapter-art {
    aspect-ratio: 1.48;
    border-radius: 10px;
  }

  .chapter-art figcaption {
    font-size: 0.67rem;
  }

  .chapter-heading {
    padding: 1.35rem 0 1rem;
  }

  .chapter-title {
    font-size: clamp(1.65rem, 8vw, 2.3rem);
  }

  .chapter-prose {
    font-size: 1rem;
    line-height: 1.82;
  }

  .chapter-prose p {
    margin-bottom: 1em;
  }

  .chapter-navigation {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .chapter-nav-button {
    padding: 0.58rem 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-start-button,
  .chapter-index-button,
  .chapter-progress > span,
  .chapter-nav-button {
    scroll-behavior: auto;
    transition: none;
  }
}
