@font-face {
  font-family: "Astral Serif";
  src: url("../assets/AstralSerif-Subset.otf") format("opentype");
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #03070d;
  --paper: #edf6f8;
  --muted: #a9bec7;
  --cyan: #8ed9ef;
  --cyan-hot: #d7f7ff;
  --amber: #e47b3a;
  --line: rgba(142, 217, 239, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--ink);
}

@media (min-width: 761px) {
  html {
    scroll-snap-type: y mandatory;
  }
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: Inter, "Helvetica Neue", Arial, "Yu Gothic", sans-serif;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  background: var(--cyan-hot);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.prologue-header {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(20px, 4vw, 68px);
  border-bottom: 1px solid rgba(142, 217, 239, 0.15);
  background: linear-gradient(180deg, rgba(2, 6, 11, 0.88), rgba(2, 6, 11, 0.12));
  backdrop-filter: blur(4px);
}

.prologue-header a {
  color: var(--paper);
  text-decoration: none;
}

.prologue-header__brand span,
.prologue-header__brand b {
  display: block;
}

.prologue-header__brand span {
  color: var(--cyan);
  font-size: 0.6rem;
  letter-spacing: 0.24em;
}

.prologue-header__brand b {
  margin-top: 4px;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 0.87rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.prologue-header__brand i {
  color: var(--amber);
  font-style: normal;
}

.prologue-header__skip {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border: 1px solid rgba(142, 217, 239, 0.32);
  background: rgba(3, 9, 15, 0.38);
  transition: border-color 180ms ease, background-color 180ms ease;
}

.prologue-header__skip small {
  color: var(--amber);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.prologue-header__skip span {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.prologue-header__skip i {
  color: var(--cyan);
  font-style: normal;
}

.prologue-header__skip:hover,
.prologue-header__skip:focus-visible {
  border-color: var(--cyan-hot);
  background-color: rgba(142, 217, 239, 0.1);
}

.prologue-header a:focus-visible,
.prologue-progress a:focus-visible,
.scene__next:focus-visible,
.scene__actions a:focus-visible {
  outline: 2px solid var(--cyan-hot);
  outline-offset: 4px;
}

.scene {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  align-items: end;
  padding: clamp(128px, 18vh, 190px) clamp(42px, 9vw, 160px) clamp(72px, 10vh, 112px);
  overflow: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.scene::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  opacity: 0.11;
  background-image: repeating-linear-gradient(180deg, transparent 0, transparent 3px, rgba(181, 231, 244, 0.17) 4px);
  mix-blend-mode: soft-light;
  content: "";
}

.scene::after {
  position: absolute;
  z-index: 3;
  top: 47%;
  right: 0;
  left: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(142, 217, 239, 0.25) 32%, rgba(215, 247, 255, 0.62) 50%, rgba(142, 217, 239, 0.2) 72%, transparent);
  box-shadow: 0 0 13px rgba(84, 193, 226, 0.32);
  content: "";
}

.scene__image,
.scene__shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scene__image {
  z-index: -3;
  object-fit: cover;
  filter: saturate(0.83) contrast(1.08) brightness(0.78);
  transform: scale(1.035);
  transition: transform 1800ms cubic-bezier(0.2, 0.7, 0.2, 1), filter 1200ms ease;
}

.scene.is-active .scene__image {
  filter: saturate(0.92) contrast(1.06) brightness(0.84);
  transform: scale(1);
}

.scene__shade {
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(1, 4, 8, 0.66), rgba(1, 4, 8, 0.02) 34%, rgba(1, 4, 8, 0.16) 58%, rgba(1, 4, 8, 0.9) 100%),
    linear-gradient(90deg, rgba(1, 4, 8, 0.83), transparent 69%);
}

.scene--arrival .scene__shade,
.scene--borrowed .scene__shade {
  background:
    linear-gradient(180deg, rgba(1, 4, 8, 0.58), rgba(1, 4, 8, 0.02) 34%, rgba(1, 4, 8, 0.2) 60%, rgba(1, 4, 8, 0.9) 100%),
    linear-gradient(270deg, rgba(1, 4, 8, 0.84), transparent 72%);
}

.scene--arrival .scene__image {
  object-position: 50% 50%;
}

.scene--city .scene__image {
  object-position: 44% 50%;
}

.scene--borrowed .scene__image {
  object-position: 82% 20%;
  transform: scale(1.16);
}

.scene--borrowed.is-active .scene__image {
  transform: scale(1.1);
}

.scene--arena .scene__image {
  object-position: 50% 52%;
}

.scene__copy {
  position: relative;
  z-index: 5;
  width: min(680px, 64vw);
  padding: 24px 28px 27px;
  border-left: 1px solid rgba(142, 217, 239, 0.86);
  background: linear-gradient(90deg, rgba(2, 7, 12, 0.86), rgba(2, 7, 12, 0.38) 80%, transparent);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.92);
}

.scene__copy--right {
  justify-self: end;
  border-right: 1px solid rgba(142, 217, 239, 0.86);
  border-left: 0;
  background: linear-gradient(270deg, rgba(2, 7, 12, 0.86), rgba(2, 7, 12, 0.38) 80%, transparent);
  text-align: right;
}

.scene__copy--final {
  width: min(790px, 74vw);
}

.scene__code {
  margin: 0;
  color: var(--cyan);
  font-size: 0.66rem;
  letter-spacing: 0.27em;
}

.scene h1,
.scene h2 {
  margin: 13px 0 19px;
  font-family: "Astral Serif", "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(2.9rem, 5.3vw, 6.2rem);
  font-weight: 900;
  line-height: 1.01;
  letter-spacing: -0.065em;
}

.scene h2 {
  font-size: clamp(2.45rem, 4.6vw, 5.4rem);
}

.scene__body {
  max-width: 42em;
  color: rgba(230, 240, 243, 0.88);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(1rem, 1.18vw, 1.16rem);
  line-height: 1.95;
  letter-spacing: 0.065em;
}

.scene__copy--right .scene__body {
  margin-left: auto;
}

.scene__body p {
  margin: 0 0 0.72em;
}

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

.quoted,
.seed-word {
  color: #fff;
  text-shadow: 0 0 16px rgba(142, 217, 239, 0.72);
}

.scene__whisper {
  color: rgba(173, 210, 220, 0.72);
  font-size: 0.89em;
}

.scene__declaration,
.scene__final-line {
  margin-top: 1.15em !important;
  color: #fff;
  font-size: 1.24em;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.scene__final-line {
  color: var(--cyan-hot);
  font-size: 1.35em;
}

.ship-roles {
  display: grid;
  gap: 5px;
  margin: 13px 0 15px;
  padding: 0;
  list-style: none;
}

.ship-roles li {
  display: flex;
  justify-content: flex-end;
  gap: 11px;
}

.ship-roles span {
  color: var(--amber);
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.66em;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.scene__next {
  position: absolute;
  z-index: 8;
  right: clamp(28px, 4vw, 72px);
  bottom: 30px;
  display: grid;
  justify-items: center;
  gap: 5px;
  color: rgba(226, 241, 245, 0.72);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.scene__next i {
  color: var(--amber);
  font-size: 1rem;
  font-style: normal;
  animation: drift-down 2.2s ease-in-out infinite;
}

.scene__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.scene__actions a {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 0 17px;
  color: var(--paper);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.scene__primary {
  border: 1px solid rgba(142, 217, 239, 0.64);
  background: rgba(142, 217, 239, 0.11);
}

.scene__primary i {
  color: var(--amber);
  font-size: 1.1rem;
  font-style: normal;
}

.scene__secondary {
  border-bottom: 1px solid rgba(142, 217, 239, 0.36);
}

.scene__actions a:hover,
.scene__actions a:focus-visible {
  border-color: var(--cyan-hot);
  background-color: rgba(142, 217, 239, 0.15);
  transform: translateX(3px);
}

.scene__tagline {
  margin: 24px 0 0;
  color: rgba(142, 217, 239, 0.64);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
}

.prologue-progress {
  position: fixed;
  z-index: 30;
  top: 50%;
  right: clamp(10px, 1.7vw, 28px);
  display: grid;
  gap: 8px;
  transform: translateY(-50%);
}

.prologue-progress a {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(142, 217, 239, 0.2);
  background: rgba(3, 9, 15, 0.5);
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 800;
  text-decoration: none;
  transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease;
}

.prologue-progress a::before {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: -1px;
  width: 2px;
  background: transparent;
  content: "";
}

.prologue-progress a.is-active {
  border-color: rgba(142, 217, 239, 0.72);
  background: rgba(142, 217, 239, 0.1);
  color: #fff;
}

.prologue-progress a.is-active::before {
  background: var(--amber);
  box-shadow: 0 0 10px rgba(228, 123, 58, 0.75);
}

@keyframes drift-down {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

@media (max-width: 760px) {
  .prologue-header {
    min-height: 62px;
    padding: 10px 14px;
    background: linear-gradient(180deg, rgba(2, 6, 11, 0.94), rgba(2, 6, 11, 0.22));
  }

  .prologue-header__brand span {
    font-size: 0.52rem;
    letter-spacing: 0.17em;
  }

  .prologue-header__brand b {
    max-width: 180px;
    overflow: hidden;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .prologue-header__skip {
    min-height: 39px;
    gap: 7px;
    padding: 0 9px;
  }

  .prologue-header__skip small {
    display: none;
  }

  .prologue-header__skip span {
    font-size: 0.7rem;
  }

  .scene {
    min-height: max(700px, 100svh);
    align-items: end;
    padding: 110px 18px 106px;
  }

  .scene::after {
    top: 42%;
  }

  .scene__image {
    object-position: 50% 50%;
  }

  .scene--closed-sky .scene__image {
    object-position: 46% 50%;
  }

  .scene--arrival .scene__image {
    object-position: 55% 50%;
  }

  .scene--city .scene__image {
    object-position: 45% 50%;
  }

  .scene--borrowed .scene__image {
    object-position: 75% 25%;
  }

  .scene__shade,
  .scene--arrival .scene__shade,
  .scene--borrowed .scene__shade {
    background:
      linear-gradient(180deg, rgba(1, 4, 8, 0.64), rgba(1, 4, 8, 0.05) 30%, rgba(1, 4, 8, 0.2) 47%, rgba(1, 4, 8, 0.96) 73%, rgba(1, 4, 8, 0.99) 100%);
  }

  .scene__copy,
  .scene__copy--right,
  .scene__copy--final {
    width: 100%;
    padding: 18px 17px 20px;
    border-right: 0;
    border-left: 1px solid rgba(142, 217, 239, 0.82);
    background: linear-gradient(90deg, rgba(2, 7, 12, 0.88), rgba(2, 7, 12, 0.38));
    text-align: left;
  }

  .scene__code {
    font-size: 0.56rem;
    letter-spacing: 0.18em;
  }

  .scene h1,
  .scene h2 {
    margin: 10px 0 13px;
    font-size: clamp(2.25rem, 11.3vw, 3.55rem);
    line-height: 1.02;
  }

  .scene__body {
    font-size: 1rem;
    line-height: 1.78;
    letter-spacing: 0.035em;
  }

  .scene__copy--right .scene__body {
    margin-left: 0;
  }

  .ship-roles li {
    justify-content: flex-start;
  }

  .scene__next {
    display: none;
  }

  .scene__actions {
    display: grid;
  }

  .scene__actions a {
    min-height: 48px;
  }

  .scene__tagline {
    font-size: 0.56rem;
    letter-spacing: 0.12em;
  }

  .prologue-progress {
    top: auto;
    right: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(142, 217, 239, 0.24);
    background: rgba(3, 9, 15, 0.88);
    backdrop-filter: blur(12px);
    transform: translateX(50%);
  }

  .prologue-progress a {
    width: 38px;
    height: 36px;
  }
}

@media (max-width: 390px) {
  .scene {
    padding-right: 14px;
    padding-left: 14px;
  }

  .scene h1,
  .scene h2 {
    font-size: 2.18rem;
  }

  .scene__body {
    font-size: 0.94rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .scene__image,
  .scene.is-active .scene__image,
  .scene--borrowed .scene__image,
  .scene--borrowed.is-active .scene__image {
    transform: none;
  }
}
