:root {
  color-scheme: dark;
  --ink: #17120f;
  --ink-soft: #241b16;
  --paper: #fff4e5;
  --paper-soft: #f2dfca;
  --paper-muted: #ceb6a0;
  --candle: #e8bc6c;
  --rose: #b96f72;
  --moss: #6f9282;
  --sky: #8298c6;
  --line: rgba(255, 244, 229, 0.12);
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.45);
  --easing: cubic-bezier(0.22, 1, 0.36, 1);
  --p-margin: 1.35rem;
  font-family:
    "Charter", "Georgia", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", serif;
}

@property --ambient-base {
  syntax: "<color>";
  inherits: true;
  initial-value: rgb(18, 13, 9);
}

@property --ambient-glow {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(221, 175, 112, 0.24);
}

@property --ambient-soft {
  syntax: "<color>";
  inherits: true;
  initial-value: rgba(122, 92, 66, 0.16);
}

@property --ambient-deep {
  syntax: "<color>";
  inherits: true;
  initial-value: rgb(6, 5, 4);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--ink);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--paper);
  background: var(--ink);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.has-intro {
  overflow: hidden;
}

body.has-lightbox {
  overflow: hidden;
}

/* 噪声质感叠层 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.04;
  pointer-events: none;
  z-index: 100;
}

body.is-bgm-playing::before {
  animation: film-grain-breathe 3.8s steps(6, end) infinite;
}

@keyframes film-grain-breathe {
  0%,
  100% {
    opacity: 0.035;
    transform: translate3d(0, 0, 0);
  }

  34% {
    opacity: 0.052;
    transform: translate3d(0.4%, -0.3%, 0);
  }

  67% {
    opacity: 0.043;
    transform: translate3d(-0.35%, 0.25%, 0);
  }
}

.reading-spotlight {
  position: fixed;
  left: 0;
  top: 0;
  width: 18rem;
  height: 18rem;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 244, 229, 0.16) 0%, rgba(232, 188, 108, 0.075) 34%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
  filter: blur(18px);
  transform: translate3d(calc(var(--spotlight-x, 50vw) - 50%), calc(var(--spotlight-y, 50vh) - 50%), 0);
  transition: opacity 260ms var(--easing);
  z-index: 99;
}

body.has-reading-spotlight .reading-spotlight {
  opacity: 1;
}

/* 氛围光晕升级为动态背景 */
.ambience {
  --ambient-base: rgb(18, 13, 9);
  --ambient-glow: rgba(221, 175, 112, 0.24);
  --ambient-soft: rgba(122, 92, 66, 0.16);
  --ambient-deep: rgb(6, 5, 4);
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 22% 18%, var(--ambient-glow), transparent 34rem),
    radial-gradient(ellipse at 78% 72%, var(--ambient-soft), transparent 38rem),
    linear-gradient(180deg, var(--ambient-base), var(--ambient-deep) 68%, #050403);
  pointer-events: none;
  z-index: -1;
  transition:
    --ambient-base 1800ms var(--easing),
    --ambient-glow 1800ms var(--easing),
    --ambient-soft 1800ms var(--easing),
    --ambient-deep 1800ms var(--easing);
}

.ambience::before,
.ambience::after {
  content: "";
  position: absolute;
  inset: -12%;
  pointer-events: none;
}

.ambience::before {
  z-index: 3;
  background:
    linear-gradient(90deg, rgba(8, 6, 4, 0.9) 0%, rgba(8, 6, 4, 0.42) 42%, rgba(8, 6, 4, 0.9) 100%),
    linear-gradient(180deg, rgba(8, 6, 4, 0.58), rgba(8, 6, 4, 0.84));
}

.ambience::after {
  z-index: 2;
  opacity: 0.52;
  background:
    radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.08), transparent 18rem),
    radial-gradient(circle at 72% 62%, rgba(255, 244, 229, 0.05), transparent 22rem);
  mix-blend-mode: screen;
}

.ambience__memory {
  position: absolute;
  inset: -18%;
  z-index: 1;
  opacity: 0;
  background-position: center;
  background-size: cover;
  filter: blur(58px) saturate(0.94) contrast(1.08);
  transform: scale(1.12) translate3d(0, 0, 0);
  transition:
    opacity 1600ms var(--easing),
    transform 6800ms linear;
  will-change: opacity, transform;
}

.ambience__memory.is-active {
  opacity: 0.26;
  transform: scale(1.18) translate3d(1.2%, -1.1%, 0);
  animation: ambient-drift 18s ease-in-out infinite alternate;
}

@keyframes ambient-drift {
  from {
    transform: scale(1.16) translate3d(-1.4%, -0.8%, 0);
  }

  to {
    transform: scale(1.22) translate3d(1.6%, 1.1%, 0);
  }
}

/* 对话气泡 */
.dialogue-bubble {
  --dialogue-accent: rgba(255, 255, 255, 0.72);
  --dialogue-bg: #111;
  --dialogue-border: rgba(255, 255, 255, 0.16);
  --dialogue-shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
  --dialogue-align: flex-start;
  display: flex;
  justify-content: var(--dialogue-align);
  width: 100%;
  margin: 1.15rem 0;
  position: relative;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1s var(--easing), transform 1s var(--easing);
}

.dialogue-bubble.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.dialogue-bubble[data-speaker="子遇"] {
  --dialogue-accent: #fff;
  --dialogue-bg: #f7f7f7;
  --dialogue-border: #fff;
  --dialogue-align: flex-end;
}

.dialogue-bubble[data-speaker="乔安"] {
  --dialogue-accent: rgba(255, 255, 255, 0.74);
  --dialogue-bg: #111;
  --dialogue-border: rgba(255, 255, 255, 0.18);
}

.dialogue-bubble[data-speaker="小黑"] {
  --dialogue-accent: rgba(255, 255, 255, 0.58);
  --dialogue-bg: #070707;
  --dialogue-border: rgba(255, 255, 255, 0.12);
}

.dialogue-content {
  position: relative;
  width: fit-content;
  max-width: min(76%, 34rem);
  padding-left: 44px;
}

.dialogue-content::before {
  content: var(--speaker-initial);
  position: absolute;
  left: 0;
  top: 1.45rem;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: #111;
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.26);
}

.dialogue-bubble[data-speaker="子遇"] .dialogue-content {
  padding-right: 44px;
  padding-left: 0;
}

.dialogue-bubble[data-speaker="子遇"] .dialogue-content::before {
  right: 0;
  left: auto;
}

.dialogue-who {
  display: flex;
  align-items: center;
  width: fit-content;
  margin-bottom: 6px;
  color: var(--dialogue-accent);
  font-family:
    "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.dialogue-bubble[data-speaker="子遇"] .dialogue-who {
  margin-left: auto;
}

.dialogue-text {
  position: relative;
  isolation: isolate;
  margin: 0 !important;
  padding: 12px 15px;
  background: var(--dialogue-bg);
  border: 1px solid var(--dialogue-border);
  border-radius: 14px;
  box-shadow: var(--dialogue-shadow);
  font-size: 0.96rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.82);
  overflow-wrap: anywhere;
  backdrop-filter: blur(14px);
}

.dialogue-text::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.18), transparent 9rem),
    linear-gradient(110deg, transparent 0%, rgba(255, 255, 255, 0.16) 46%, transparent 72%);
  opacity: 0;
  mix-blend-mode: screen;
  transform: translateX(-22%);
  transition:
    opacity 900ms var(--easing),
    transform 1400ms var(--easing);
  pointer-events: none;
  z-index: 0;
}

.dialogue-text > * {
  position: relative;
  z-index: 1;
}

.dialogue-bubble.is-visible .dialogue-text::before {
  opacity: 0.22;
  transform: translateX(0);
}

.dialogue-bubble[data-speaker="子遇"] .dialogue-text {
  border-radius: 14px;
  color: #080808;
}

.dialogue-bubble[data-speaker="子遇"] .dialogue-text::before {
  background:
    radial-gradient(circle at 82% 22%, rgba(8, 8, 8, 0.16), transparent 9rem),
    linear-gradient(250deg, transparent 0%, rgba(8, 8, 8, 0.11) 46%, transparent 72%);
  mix-blend-mode: multiply;
}

.dialogue-text::after {
  content: none;
}

/* 焦点透镜：优化为渐显效果 */
.chapter__header,
.chapter__body > p,
.dialogue-bubble,
blockquote,
.story-figure {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1.2s var(--easing), transform 1.2s var(--easing);
  will-change: opacity, transform;
}

.is-visible {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

.narrative-text__unit {
  position: relative;
  z-index: 1;
  display: inline-block;
  opacity: 0;
  filter: blur(5px);
  transform: translateY(0.45em) scale(0.985);
}

.is-visible .narrative-text__unit,
.hero__content .narrative-text__unit {
  animation: narrative-ink 760ms var(--easing) forwards;
  animation-delay: var(--unit-delay);
}

.hero__content .narrative-text__unit {
  animation-delay: var(--hero-unit-delay);
}

@keyframes narrative-ink {
  58% {
    opacity: 0.72;
    filter: blur(1.2px);
  }

  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0) scale(1);
  }
}

/* 响应式调整 */
@media (max-width: 600px) {
  .intro-gate {
    padding: 24px 22px;
  }

  .intro-gate__host-wrap {
    margin-bottom: 20px;
  }

  .intro-gate__text {
    margin-top: 24px;
    line-height: 1.92;
  }

  .intro-gate__hint {
    margin-top: 18px;
  }

  .intro-gate__button {
    margin-top: 26px;
  }

  .dialogue-bubble {
    margin: 1rem 0;
  }

  .dialogue-content {
    max-width: 90%;
    padding-left: 38px;
  }

  .dialogue-content::before {
    top: 1.42rem;
    width: 27px;
    height: 27px;
    font-size: 0.7rem;
  }

  .dialogue-bubble[data-speaker="子遇"] .dialogue-content {
    padding-right: 38px;
  }

  .dialogue-text {
    padding: 10px 12px;
    font-size: 0.94rem;
    line-height: 1.62;
  }

  .bgm-toggle {
    top: calc(12px + env(safe-area-inset-top));
    right: calc(12px + env(safe-area-inset-right));
    width: 34px;
    height: 34px;
  }

  .time-marker {
    align-items: flex-start;
    gap: 10px;
  }

  .time-marker__text {
    padding-top: 2px;
  }
}

img {
  display: block;
  max-width: 100%;
}

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

.intro-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 28px;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(255, 244, 229, 0.06), transparent 24rem),
    linear-gradient(180deg, rgba(8, 6, 4, 0.82), #080604 58%),
    url("bg.png") center / cover no-repeat;
  color: #fff;
  transition:
    opacity 700ms var(--easing),
    visibility 700ms var(--easing);
}

.intro-gate.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-gate__inner {
  width: min(100%, 600px);
  text-align: center;
}

.intro-gate__host-wrap {
  position: relative;
  width: clamp(76px, 15vw, 108px);
  aspect-ratio: 1;
  margin: 0 auto 24px;
}

.intro-gate__host-wrap::before,
.intro-gate__host-wrap::after {
  content: "";
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  opacity: 0.38;
  pointer-events: none;
}

.intro-gate__host-wrap::before {
  background: radial-gradient(circle, rgba(255, 244, 229, 0.12), transparent 62%);
  filter: blur(14px);
}

.intro-gate__host-wrap::after {
  inset: -6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.intro-gate__ripple {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(circle, transparent 58%, rgba(255, 244, 229, 0.18) 59%, rgba(255, 244, 229, 0.07) 63%, transparent 68%),
    radial-gradient(circle, rgba(255, 244, 229, 0.065), transparent 66%);
  filter: blur(0.2px);
  transform: scale(0.92);
}

.intro-gate__ripple--two {
  inset: -12px;
}

.intro-gate__ripple--three {
  inset: -16px;
}

@media (max-width: 600px) {
  .intro-gate__ripple {
    background:
      radial-gradient(circle, transparent 56%, rgba(255, 244, 229, 0.24) 58%, rgba(255, 244, 229, 0.09) 64%, transparent 70%),
      radial-gradient(circle, rgba(255, 244, 229, 0.08), transparent 66%);
  }
}

.intro-gate__host-wrap::before {
  animation: host-glow 3.6s ease-in-out infinite;
}

.intro-gate__host-wrap::after {
  animation: host-core-ring 3.6s ease-in-out infinite;
}

.intro-gate__ripple {
  animation: host-ripple 4.4s ease-out infinite;
}

.intro-gate__ripple--two {
  animation-delay: 960ms;
  animation-duration: 4.65s;
}

.intro-gate__ripple--three {
  animation-delay: 1920ms;
  animation-duration: 4.9s;
}

.intro-gate__host-wrap.is-playing::before {
  animation-duration: 2.8s;
}

.intro-gate__host-wrap.is-playing::after {
  animation-duration: 2.8s;
}

.intro-gate__host-wrap.is-playing .intro-gate__ripple {
  animation-duration: 3.2s;
}

.intro-gate__host-wrap.is-playing .intro-gate__ripple--two {
  animation-delay: 720ms;
  animation-duration: 3.45s;
}

.intro-gate__host-wrap.is-playing .intro-gate__ripple--three {
  animation-delay: 1440ms;
  animation-duration: 3.75s;
}

.intro-gate__host {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(255, 244, 229, 0.28);
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.04),
    0 20px 52px rgba(0, 0, 0, 0.42);
}

.intro-gate__host-wrap.is-playing .intro-gate__host {
  animation: host-breathe 2.8s ease-in-out infinite;
}

@keyframes host-glow {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.96);
  }

  50% {
    opacity: 0.5;
    transform: scale(1.06);
  }
}

@keyframes host-core-ring {
  0%,
  100% {
    opacity: 0.2;
    transform: scale(1);
  }

  50% {
    opacity: 0.38;
    transform: scale(1.05);
  }
}

@keyframes host-ripple {
  0% {
    opacity: 0;
    transform: scale(0.88);
  }

  16% {
    opacity: 0.42;
  }

  48% {
    opacity: 0.22;
  }

  100% {
    opacity: 0;
    transform: scale(1.72);
  }
}

@keyframes host-breathe {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.018);
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro-gate__host-wrap.is-playing::before,
  .intro-gate__host-wrap.is-playing::after,
  .intro-gate__host-wrap.is-playing .intro-gate__host,
  .intro-gate__host-wrap.is-playing .intro-gate__ripple,
  .ambience__memory.is-active,
  .hero__image,
  .intro-gate h1,
  .hero h1,
  .chapter__header.is-visible h2,
  .chapter__header.is-visible .chapter__subtitle,
  .is-visible .narrative-text__unit,
  .hero__content .narrative-text__unit,
  body.is-bgm-playing::before,
  .bgm-toggle.is-playing .bgm-toggle__note {
    animation: none;
  }

  .intro-gate__host-wrap::before {
    opacity: 0.34;
  }

  .narrative-text__unit {
    opacity: 1;
    filter: none;
    transform: none;
  }

  .dialogue-text::before {
    opacity: 0;
    transform: none;
    transition: none;
  }

  .story-figure img {
    transform: none;
    will-change: auto;
  }

  .reading-spotlight {
    display: none;
  }
}

.intro-gate__kicker {
  margin: 0 0 16px;
  color: rgba(255, 244, 229, 0.54);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.intro-gate h1 {
  margin: 0;
  color: rgba(255, 255, 255, 0.96);
  font-size: clamp(2.8rem, 9vw, 5.4rem);
  line-height: 1;
  letter-spacing: 0;
  font-weight: 700;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12),
    0 18px 54px rgba(0, 0, 0, 0.5);
  animation: title-letter-breathe 1400ms 180ms var(--easing) both;
}

.intro-gate__text {
  max-width: 32rem;
  margin: 30px auto 0;
  color: rgba(255, 244, 229, 0.76);
  font-size: clamp(0.98rem, 2.6vw, 1.08rem);
  line-height: 2.05;
  text-wrap: pretty;
  text-shadow: 0 10px 32px rgba(0, 0, 0, 0.42);
}

.intro-gate__hint {
  margin: 22px 0 0;
  color: rgba(255, 244, 229, 0.42);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.intro-gate__button {
  min-height: 44px;
  margin-top: 30px;
  padding: 12px 24px;
  border: 1px solid rgba(255, 244, 229, 0.72);
  border-radius: 999px;
  background: rgba(255, 244, 229, 0.94);
  color: #080604;
  font: 800 0.86rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.32);
  transition:
    background 180ms var(--easing),
    transform 180ms var(--easing),
    box-shadow 180ms var(--easing);
}

.intro-gate__button:hover {
  background: #fff7ea;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.38);
}

.intro-gate__button:active {
  transform: scale(0.98);
}

.intro-gate__button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.bgm-player {
  position: fixed;
  z-index: 1001;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 9px;
}

.bgm-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background: rgba(8, 6, 4, 0.72);
  color: rgba(255, 255, 255, 0.76);
  font: 700 1rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  transition:
    color 180ms var(--easing),
    border-color 180ms var(--easing),
    background 180ms var(--easing),
    transform 180ms var(--easing);
}

.bgm-toggle:hover {
  border-color: rgba(255, 255, 255, 0.34);
  color: #fff;
}

.bgm-toggle:active {
  transform: scale(0.97);
}

.bgm-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.72);
  outline-offset: 3px;
}

.bgm-toggle.is-playing {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.92);
  color: #080604;
}

.bgm-toggle__note {
  display: block;
  transform: translateY(-1px);
  transform-origin: 50% 68%;
  filter: grayscale(1);
}

.bgm-toggle.is-playing .bgm-toggle__note {
  animation: bgm-note-pulse 1400ms ease-in-out infinite;
  filter: grayscale(0);
}

@keyframes bgm-note-pulse {
  0%,
  100% {
    transform: translateY(-1px) scale(1) rotate(0deg);
  }

  22% {
    transform: translateY(-3px) scale(1.08) rotate(-5deg);
  }

  48% {
    transform: translateY(-1px) scale(0.99) rotate(3deg);
  }

  72% {
    transform: translateY(-2px) scale(1.04) rotate(-2deg);
  }
}

.bgm-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 0;
  max-width: 0;
  min-height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 244, 229, 0);
  border-radius: 999px;
  background: rgba(8, 6, 4, 0.72);
  color: rgba(255, 244, 229, 0.7);
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
  transform: translateX(8px);
  transition:
    width 260ms var(--easing),
    max-width 260ms var(--easing),
    padding 260ms var(--easing),
    opacity 180ms var(--easing),
    border-color 180ms var(--easing),
    transform 260ms var(--easing);
}

.bgm-player.is-expanded .bgm-progress {
  width: 136px;
  max-width: 136px;
  padding: 0 10px;
  border-color: rgba(255, 244, 229, 0.14);
  opacity: 1;
  transform: translateX(0);
}

@media (hover: hover) and (pointer: fine) {
  .bgm-toggle:hover + .bgm-progress,
  .bgm-toggle:focus-visible + .bgm-progress {
    width: 136px;
    max-width: 136px;
    padding: 0 10px;
    border-color: rgba(255, 244, 229, 0.14);
    opacity: 1;
    transform: translateX(0);
  }
}

.bgm-progress__bar {
  position: relative;
  display: block;
  width: 78px;
  height: 3px;
  flex: 0 0 78px;
  border-radius: 999px;
  background: rgba(255, 244, 229, 0.18);
  overflow: hidden;
}

.bgm-progress__bar span {
  --bgm-progress: 0;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 244, 229, 0.88);
  transform: scaleX(var(--bgm-progress));
  transform-origin: left;
  transition: transform 160ms linear;
}

.bgm-progress__time {
  min-width: 2.4em;
  font: 700 0.68rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.02em;
  text-align: right;
  white-space: nowrap;
}

.read-progress {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: rgba(255, 244, 229, 0.05);
}

.read-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 150ms var(--easing);
}

.hero {
  position: relative;
  display: grid;
  height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.hero__image {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 22% 24%, rgba(255, 244, 229, 0.12), transparent 30rem),
    linear-gradient(180deg, rgba(8, 6, 4, 0.18) 0%, rgba(8, 6, 4, 0.54) 54%, rgba(8, 6, 4, 0.96) 100%),
    url("bg.png") center / cover no-repeat;
  filter: saturate(0.72) contrast(1.04);
  transform: scale(1.1);
  animation: hero-zoom 20s infinite alternate var(--easing);
  z-index: -2;
}

@keyframes hero-zoom {
  from { transform: scale(1.05); }
  to { transform: scale(1.15); }
}

.hero__content {
  align-self: end;
  width: min(100%, 1080px);
  margin: 0 auto;
  padding: 0 24px 10svh;
  opacity: 0;
  transform: translateY(30px);
  animation: fade-in-up 1.2s forwards 0.5s var(--easing);
}

@keyframes fade-in-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero__kicker {
  margin: 0 0 18px;
  color: rgba(255, 244, 229, 0.68);
  font-family: system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
}

.hero h1 {
  max-width: 12em;
  margin: 0;
  color: rgba(255, 255, 255, 0.96);
  font-size: clamp(4.2rem, 10vw, 6.8rem);
  line-height: 0.98;
  letter-spacing: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14),
    0 20px 60px rgba(0, 0, 0, 0.48),
    0 0 34px rgba(255, 244, 229, 0.12);
  animation: title-letter-breathe 1500ms 680ms var(--easing) both;
}

@keyframes title-letter-breathe {
  from {
    opacity: 0;
    letter-spacing: 0.32em;
    filter: blur(7px);
    transform: translateY(0.12em);
  }

  62% {
    opacity: 0.88;
    filter: blur(1px);
  }

  to {
    opacity: 1;
    letter-spacing: 0;
    filter: blur(0);
    transform: translateY(0);
  }
}

.hero__quote {
  max-width: 620px;
  margin: 34px 0 0;
  padding-left: 22px;
  border-left: 1px solid rgba(255, 244, 229, 0.34);
  color: rgba(255, 244, 229, 0.78);
  font-size: clamp(1rem, 2.1vw, 1.16rem);
  line-height: 2.05;
  font-style: normal;
  font-weight: 400;
  text-wrap: pretty;
  text-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}

.hero__quote p {
  margin: 0;
}

.hero__quote p + p {
  margin-top: 0.38rem;
  color: rgba(255, 244, 229, 0.66);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 48px;
}

.hero__meta span {
  padding: 8px 16px;
  border: 1px solid rgba(255, 244, 229, 0.15);
  border-radius: 4px;
  background: rgba(255, 244, 229, 0.03);
  color: rgba(255, 244, 229, 0.7);
  font-size: 0.8rem;
  backdrop-filter: blur(5px);
  transition: all 0.3s var(--easing);
}

.hero__meta span:hover {
  background: rgba(255, 244, 229, 0.08);
  border-color: rgba(255, 244, 229, 0.3);
}

.story-shell {
  position: relative;
  isolation: isolate;
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 76px 24px 64px;
  color: #fff;
}

.story-shell::before,
.story-shell::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: -1;
}

.story-shell::before {
  top: 0;
  bottom: -3rem;
  background:
    linear-gradient(180deg, rgba(8, 6, 4, 0.82) 0%, rgba(8, 6, 4, 0.52) 48%, rgba(8, 6, 4, 0.84) 100%);
}

.story-shell::after {
  top: 0;
  bottom: 0;
  opacity: 1;
  background:
    linear-gradient(90deg, transparent calc(50% - 27rem), rgba(255, 255, 255, 0.06) calc(50% - 27rem), transparent calc(50% - 26.95rem)),
    linear-gradient(90deg, transparent calc(50% + 26.95rem), rgba(255, 255, 255, 0.06) calc(50% + 26.95rem), transparent calc(50% + 27rem));
}

.story-content {
  min-width: 0;
}

.chapter {
  scroll-margin-top: 24px;
  padding: 0 0 42px;
}

.chapter + .chapter {
  padding-top: 34px;
}

.chapter__header {
  margin-bottom: 30px;
}

.chapter__header.is-visible h2 {
  animation: chapter-title-spacing 1100ms 80ms var(--easing) both;
}

.chapter__header.is-visible .chapter__subtitle {
  animation: chapter-subtitle-settle 980ms 180ms var(--easing) both;
}

.chapter__number {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
}

.chapter h2 {
  margin: 0;
  color: #fff;
  font-size: 2.9rem;
  line-height: 1.08;
  letter-spacing: 0;
}

@keyframes chapter-title-spacing {
  from {
    letter-spacing: 0.22em;
    filter: blur(3px);
  }

  to {
    letter-spacing: 0;
    filter: blur(0);
  }
}

.chapter__subtitle {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.56);
  font-size: 1.1rem;
  line-height: 1.55;
}

@keyframes chapter-subtitle-settle {
  from {
    letter-spacing: 0.12em;
    filter: blur(2px);
  }

  to {
    letter-spacing: 0;
    filter: blur(0);
  }
}

.chapter__body {
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.04rem;
}

.chapter__body p {
  margin: 0 0 var(--p-margin);
  line-height: 1.9;
  color: rgba(255, 255, 255, 0.78);
}

.time-marker {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 1.65rem !important;
  padding: 6px 0;
  color: rgba(255, 255, 255, 0.54);
  font-size: 0.94rem;
  line-height: 1.5;
}

.time-marker::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 50%;
  background: #000;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.08);
}

.time-marker__date {
  flex: 0 0 auto;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-family:
    "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.time-marker__text {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
}

blockquote {
  margin: 2.4rem 0;
  padding: 22px 24px;
  border-left: 2px solid #fff;
  background: #0b0b0b;
  color: #fff;
}

.chapter__body blockquote p {
  margin: 0.15em 0;
  line-height: 1.7;
  color: #fff;
}

.story-figure {
  --figure-shift: 0px;
  margin: 2.8rem 0;
}

.story-figure img {
  display: block;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
  cursor: zoom-in;
  transform: translate3d(0, var(--figure-shift), 0) scale(1.012);
  will-change: transform;
  transition:
    border-color 180ms var(--easing),
    filter 180ms var(--easing);
}

.story-figure img:hover {
  border-color: rgba(255, 255, 255, 0.32);
  filter: brightness(1.04);
}

.story-figure img:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.72);
  outline-offset: 4px;
}

.story-figure.is-portrait {
  width: min(100%, 430px);
}

.story-figure.is-portrait img {
  margin-inline: auto;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.86);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  backdrop-filter: blur(18px);
  transition:
    opacity 220ms var(--easing),
    visibility 220ms var(--easing);
}

.image-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.image-lightbox__image {
  display: block;
  max-width: min(100%, 1200px);
  max-height: calc(100svh - 72px);
  border-radius: 8px;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.64);
  object-fit: contain;
  transform: scale(0.98);
  transition: transform 220ms var(--easing);
}

.image-lightbox.is-open .image-lightbox__image {
  transform: scale(1);
}

.image-lightbox__close {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  background: rgba(8, 6, 4, 0.72);
  color: #fff;
  font: 300 1.65rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  backdrop-filter: blur(14px);
  transition:
    background 180ms var(--easing),
    border-color 180ms var(--easing),
    transform 180ms var(--easing);
}

.image-lightbox__close:hover {
  border-color: rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.16);
}

.image-lightbox__close:active {
  transform: scale(0.96);
}

.image-lightbox__close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.72);
  outline-offset: 3px;
}

.loading,
.error {
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.8;
}

@media (max-width: 1024px) {
  .story-shell {
    width: min(100%, 820px);
  }
}

@media (max-width: 820px) {
  .hero__image {
    background:
      linear-gradient(180deg, rgba(8, 6, 4, 0.16) 0%, rgba(8, 6, 4, 0.52) 54%, rgba(8, 6, 4, 0.96) 100%),
      url("bg.png") no-repeat;
    background-position: center, calc(50% + 50px) center;
    background-size: auto, cover;
  }

  .hero__content {
    padding-bottom: 8svh;
  }

  .hero h1 {
    font-size: clamp(3.6rem, 18vw, 5.2rem);
  }

  .story-shell {
    padding-top: 48px;
  }

  .chapter {
    padding-bottom: 38px;
  }

  .chapter__header {
    margin-bottom: 26px;
  }

  .chapter h2 {
    font-size: 2.2rem;
  }

  .chapter__body {
    font-size: 1.04rem;
  }

  blockquote {
    margin: 2.1rem 0;
    padding: 20px;
  }

  .story-figure {
    margin: 2.4rem 0;
    width: 100%;
    margin-inline: auto;
    border-radius: 0;
  }

  .story-figure img {
    margin-inline: auto;
  }

}

@media (max-width: 480px) {
  :root {
    --p-margin: 1.15rem;
  }

  .hero__content {
    padding: 0 20px 7svh;
  }

  .hero h1 {
    font-size: clamp(3.2rem, 26vw, 4.2rem);
  }

  .hero__quote {
    margin-top: 28px;
    font-size: 0.98rem;
    padding-left: 16px;
    line-height: 1.9;
  }

  .story-shell {
    padding-inline: 20px;
  }

  .chapter {
    padding-bottom: 32px;
  }

  .chapter + .chapter {
    padding-top: 28px;
  }

  .chapter__body p {
    line-height: 1.82;
  }

  blockquote {
    padding: 18px 16px;
    font-size: 1rem;
  }
}
