.story-page {
  background:
    radial-gradient(900px 480px at 50% -12%, rgba(185, 138, 60, 0.16), transparent 70%),
    #14120f;
}

.story-page--playing {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.story-topbar-state {
  margin: 0 0 0 auto;
  color: #cfc2ab;
  font-size: 0.78rem;
}

.story-main {
  box-sizing: border-box;
  display: grid;
  align-content: start;
  flex: 1 1 auto;
  gap: clamp(0.8rem, 2.5vw, 1.4rem);
  width: min(1180px, 100%);
  min-height: 0;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

.story-page--playing .story-main {
  display: flex;
  flex-direction: column;
  padding-block: clamp(0.6rem, 2vw, 1rem);
}

.story-select {
  display: grid;
  gap: clamp(0.6rem, 2vw, 1rem);
}

.story-select h2 {
  margin: 0;
  font-size: 1.1rem;
}

.story-note {
  margin: 0;
  color: #cfc2ab;
  font-size: 0.82rem;
  line-height: 1.6;
}

.story-factions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(0.8rem, 2vw, 1.2rem);
}

.story-faction {
  --story-accent: #f0c26b;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 0;
  overflow: hidden;
  border: 1px solid #4a4337;
  border-radius: 14px;
  background: linear-gradient(160deg, #221e18, #191612);
  color: #efe6d5;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.story-faction:hover {
  border-color: var(--story-accent);
  background: linear-gradient(160deg, #2a251d, #1d1913);
}

.story-faction:focus-visible {
  outline: 2px solid #f0c26b;
  outline-offset: 2px;
}

.story-faction__poster-wrap {
  display: block;
  height: clamp(220px, 36vh, 340px);
  overflow: hidden;
  background: #0d0c0a;
}

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

.story-faction__body {
  display: grid;
  gap: 0.3rem;
  padding: 0.8rem 0.9rem 1rem;
}

.story-faction__name {
  color: #f7e7b8;
  font-size: 1.05rem;
  font-weight: 700;
}

.story-faction__title {
  color: var(--story-accent);
  font-size: 0.8rem;
}

.story-faction__theme {
  color: #cfc2ab;
  font-size: 0.8rem;
  line-height: 1.5;
}

.story-faction__keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.1rem;
}

.story-keyword {
  padding: 0.1rem 0.5rem;
  border: 1px solid #5c5346;
  border-radius: 999px;
  color: #e7dcc7;
  font-size: 0.72rem;
}

.story-faction__state {
  margin-top: 0.25rem;
  color: #9c917e;
  font-size: 0.72rem;
}

.story-player {
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.5rem;
  min-height: 0;
}

.story-player__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.8rem;
  margin: 0;
}

.story-player__name {
  color: #f7e7b8;
  font-size: 1.05rem;
}

.story-player__theme {
  color: #cfc2ab;
  font-size: 0.78rem;
  font-weight: 400;
}

.story-player__story {
  color: #f0c26b;
  font-size: 0.8rem;
  font-weight: 400;
}

.story-stage {
  position: relative;
  justify-self: center;
  align-self: stretch;
  box-sizing: border-box;
  width: min(100%, calc((100dvh - 195px) * 9 / 16));
  max-height: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid #4a4337;
  border-radius: 16px;
  background: #0b0a08;
  cursor: pointer;
}

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

.story-skip {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 3;
  padding: 0.35rem 0.9rem;
  border: 1px solid #c9a25f;
  border-radius: 999px;
  background: rgba(20, 18, 15, 0.86);
  color: #f7e7b8;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.story-skip:hover {
  background: rgba(58, 44, 23, 0.94);
}

.story-skip:focus-visible {
  outline: 2px solid #f0c26b;
  outline-offset: 2px;
}

.story-caption {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  gap: 0.3rem;
  padding: clamp(1.6rem, 8vw, 3rem) clamp(0.9rem, 3vw, 1.4rem) clamp(0.9rem, 3vw, 1.2rem);
  background: linear-gradient(0deg, rgba(8, 7, 6, 0.96) 0%, rgba(8, 7, 6, 0.82) 58%, rgba(8, 7, 6, 0) 100%);
  pointer-events: none;
}

.story-caption__line {
  margin: 0;
  color: #f3ead9;
  font-size: clamp(0.88rem, 2.4vw, 1rem);
  line-height: 1.55;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}

.story-caption__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.25rem;
  color: #cfc2ab;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.story-dots {
  display: flex;
  gap: 0.3rem;
}

.story-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #5c5346;
}

.story-dot.is-active {
  background: #f0c26b;
}

.story-caption.is-enter {
  animation: story-fade-in 0.45s ease-out;
}

.story-help {
  margin: 0;
  color: #9c917e;
  font-size: 0.75rem;
  text-align: center;
}

@keyframes story-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-faction,
  .story-skip {
    transition: none;
  }

  .story-caption.is-enter {
    animation-duration: 0.14s;
  }
}

[data-motion="reduced"] .story-faction,
[data-motion="reduced"] .story-skip {
  transition: none;
}

[data-motion="reduced"] .story-caption.is-enter {
  animation-duration: 0.14s;
}

/* 主菜单「阵营序章」图鉴条目 */
.story-codex-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.5rem 0 0;
}

.story-codex-link {
  padding: 0.45rem 0.9rem;
  border: 1px solid #4a4337;
  border-radius: 999px;
  background: #221e18;
  color: #f0c26b;
  font-size: 0.82rem;
  text-decoration: none;
}

.story-codex-link:hover {
  border-color: #c9a25f;
  background: #2a251d;
}

.story-codex-link:focus-visible {
  outline: 2px solid #f0c26b;
  outline-offset: 2px;
}
