:root {
  /* ゲーム画面から拾った色 */
  --c-night: #050a1f;              /* 初期の青黒 */
  --c-box: rgba(8, 12, 36, .9);    /* 台詞の帯 */
  --c-chip: #2b3ab4;               /* キャラ名チップ */
  --c-tile: #4d72c6;               /* タイル型ボタン */
  --c-tile-hi: #8fadee;
  --c-ink: #0a0f2e;                /* 線画の黒紺 */
  --c-pale: #a9bff3;
  --c-text: #eef1ff;

  --font: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --gutter: clamp(16px, 5vw, 64px);
  --header-h: 64px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--header-h); }
html, body { margin: 0; padding: 0; }

body {
  background: var(--c-night);
  color: var(--c-text);
  font-family: var(--font);
  font-weight: 500;
  letter-spacing: .14em;
  line-height: 2;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; }
ul, dl, dd, figure, blockquote, p, h1, h2 { margin: 0; padding: 0; }
ul { list-style: none; }

:focus-visible { outline: 2px solid var(--c-tile-hi); outline-offset: 3px; }

/* ===== 長体80% =====
   ブロック要素は125%幅で組んでから0.8倍に縮めるので、折り返し位置も正しくなる */
.cond {
  width: 125%;
  transform: scaleX(.8);
  transform-origin: left top;
}

span.cond,
a.cond,
button .cond {
  display: inline-block;
  width: auto;
}

/* ===== 台詞の帯（ゲーム内テキスト表示） ===== */
.line {
  background: var(--c-box);
  padding: .3em .7em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ===== キャラ名チップ ===== */
.chip {
  display: inline-block;
  background: var(--c-chip);
  color: var(--c-text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .2em;
  line-height: 1;
  padding: .6em .9em;
  transform: scaleX(.8);
  transform-origin: left center;
}

/* ===== タイル（ゲーム内のAボタン風） ===== */
.tile {
  display: inline-grid;
  place-items: center;
  min-width: 9em;
  padding: .7em 1.6em;
  background: var(--c-tile);
  color: var(--c-ink);
  font-weight: 800;
  letter-spacing: .12em;
  line-height: 1.4;
  border: 2px solid var(--c-ink);
  box-shadow:
    inset 0 0 0 2px var(--c-tile-hi),
    4px 4px 0 var(--c-ink);
  text-decoration: none;
}

.tile .cond { transform-origin: center; }

.tile--link {
  transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.tile--link:hover {
  background: var(--c-tile-hi);
  transform: translate(2px, 2px);
  box-shadow:
    inset 0 0 0 2px #c9d7fb,
    2px 2px 0 var(--c-ink);
}

/* ===== 背景（固定） ===== */
.bg {
  position: fixed;
  inset: 0;
  height: 100vh;
  height: 100lvh;   /* スマホのアドレスバー伸縮でガタつかないよう大きい方に合わせる */
  z-index: 0;
  background: var(--c-night);
  overflow: hidden;
}

.bg__jacket img,
.bg__canvas,
.bg__veil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.bg__jacket img { object-fit: cover; }

/* JSが動いている時は<picture>を隠し、canvasで描く */
.js .bg__jacket { visibility: hidden; }

/* トップビュー以外では黒を一段かけて明度を落とす */
.bg__veil {
  background: #000;
  opacity: 0;
  transition: opacity .9s ease;
}

.is-deep .bg__veil { opacity: .45; }

/* ===== ヘッダー ===== */
.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--gutter);
  pointer-events: none;
}

.header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(rgba(5, 10, 31, .85), rgba(5, 10, 31, 0));
}

/* トップビューでは出さない */
.header::before,
.header__title,
.header__menu,
.nav {
  opacity: 0;
  translate: 0 -8px;
  transition: opacity .6s ease, translate .6s ease;
}

.is-deep .header::before,
.is-deep .header__title,
.is-deep .header__menu,
.is-deep .nav {
  opacity: 1;
  translate: none;
}

.is-deep .header > * { pointer-events: auto; }

.nav { order: 1; margin-left: auto; }
.header__menu { order: 2; margin-left: auto; }

.header__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .2em;
  text-decoration: none;
  background: var(--c-box);
  padding: .2em .8em;
  white-space: nowrap;
  flex-shrink: 0;
}

.header__title img {
  width: auto;
  height: 30px;
}

.nav ul {
  display: flex;
  gap: 6px;
}

.nav a {
  display: block;
  font-size: 13px;
  letter-spacing: .18em;
  line-height: 1;
  padding: .75em .9em;
  background: var(--c-box);
  text-decoration: none;
  transition: background-color .2s ease;
}

.nav a:hover,
.nav a.is-current { background: var(--c-chip); }

.header__menu {
  display: none;
  font: inherit;
  font-size: 13px;
  letter-spacing: .2em;
  color: var(--c-text);
  background: var(--c-chip);
  border: 0;
  padding: .7em 1em;
  cursor: pointer;
}

/* ===== TOP ===== */
.top {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100svh;
}

.top__logo {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.top__logo img {
  width: min(64vw, 820px);
  height: auto;
  opacity: 0;
  filter: blur(14px);
  transform: scale(1.03);
}

.top.is-logo .top__logo img {
  animation: logoIn 2.4s cubic-bezier(.25, .1, .25, 1) forwards;
}

@keyframes logoIn {
  0%   { opacity: 0; filter: blur(14px); transform: scale(1.03); }
  60%  { opacity: .85; filter: blur(3px); }
  100% { opacity: 1; filter: blur(0);   transform: scale(1); }
}

.top__scroll {
  position: absolute;
  left: 50%;
  bottom: 28px;
  translate: -50% 0;
  display: grid;
  justify-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: .3em;
  text-decoration: none;
  opacity: 0;
  transition: opacity 1.2s ease 1.6s;
}

/* 長体は中心基準で縮め、末尾の字間ぶんを先頭にも足して視覚的に中央へ */
.top__scroll .cond {
  transform-origin: center;
  text-indent: .3em;
}

.top__scroll::after {
  content: "";
  width: 1px;
  height: 44px;
  background: linear-gradient(var(--c-text), transparent);
  animation: scrollLine 2.4s ease-in-out infinite;
  transform-origin: top;
}

.top.is-logo .top__scroll { opacity: .8; }

@keyframes scrollLine {
  0%   { transform: scaleY(0); opacity: 1; }
  60%  { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

/* ===== セクション共通 ===== */
main,
.footer {
  position: relative;
  z-index: 1;
}

.sec {
  padding: clamp(96px, 16vh, 180px) var(--gutter);
}

.sec--short { padding-block: 40px; }

.sec--page {
  min-height: 80vh;
  padding-top: calc(var(--header-h) + clamp(64px, 12vh, 140px));
}

.sec__inner {
  max-width: 880px;
  margin: 0 auto;
}

.sec__head {
  display: grid;
  justify-items: start;
  gap: 14px;
  margin-bottom: 48px;
  font-weight: inherit;
}

.sec__title {
  font-size: clamp(44px, 8vw, 84px);
  font-weight: 800;
  letter-spacing: .14em;
  line-height: 1;
  text-shadow: 0 0 24px rgba(5, 10, 31, .8);
  filter: url(#wobble);
}

/* 歪みフィルタ定義用。レイアウトに影響させない */
.fx {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* 本文：帯つきテキスト */
.story__lead,
.story__body,
.system__text,
.news__text {
  font-size: clamp(15px, 1.7vw, 17px);
  line-height: 2.5;
}

/* ===== NEWS ===== */
.news {
  display: grid;
  gap: 18px;
}

.news__item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 4px 20px;
}

.news__date {
  font-size: 13px;
  letter-spacing: .16em;
  color: var(--c-pale);
  background: var(--c-box);
  padding: .3em .7em;
}

.news__text a {
  text-decoration: none;
}

.news__text a:hover .line,
.news__text a:focus-visible .line { color: var(--c-tile-hi); }

/* ===== 記事ページ ===== */
.article__head {
  display: grid;
  justify-items: start;
  gap: 14px;
  margin-bottom: 32px;
}

.article__title {
  font-size: clamp(22px, 3.6vw, 32px);
  font-weight: 700;
  line-height: 1.9;
}

.article__body {
  padding: clamp(24px, 4vw, 44px);
  background: var(--c-box);
  border: 2px solid var(--c-ink);
  box-shadow:
    inset 0 0 0 1px rgba(143, 173, 238, .35),
    6px 6px 0 var(--c-ink);
}

.article__content {
  font-size: clamp(15px, 1.7vw, 17px);
  line-height: 2.2;
}

.article__content > * + * { margin-top: 1.4em; }

.article__content h2,
.article__content h3 {
  font-weight: 700;
  line-height: 1.6;
}

.article__content h2 {
  margin-top: 2.2em;
  padding-bottom: .3em;
  border-bottom: 1px solid rgba(143, 173, 238, .35);
  font-size: 1.35em;
}

.article__content h3 { margin-top: 1.8em; font-size: 1.15em; }
.article__content > :first-child { margin-top: 0; }

.article__content ul,
.article__content ol { padding-left: 1.6em; }
.article__content ul { list-style: disc; }

.article__content a { color: var(--c-tile-hi); }

.article__content blockquote {
  padding-left: 1.2em;
  border-left: 3px solid var(--c-chip);
  color: var(--c-pale);
}

/* 長体の親の中でも画像は潰さない */
.article__content img {
  max-width: 80%;
  transform: scaleX(1.25);
  transform-origin: left top;
}

.article__back { margin-top: 40px; }

/* 文字だけのリンク。背景の絵に負けないよう影で浮かせる */
.text-link {
  color: var(--c-text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .2em;
  text-decoration: none;
  text-shadow: 0 0 6px var(--c-night), 0 0 14px var(--c-night);
  transition: color .2s ease;
}

/* .cond はinline-blockで親の下線が届かないので、文字側に引く */
.text-link .cond {
  text-decoration: underline;
  text-decoration-thickness: .5px;
  text-decoration-color: color-mix(in srgb, currentColor 65%, transparent);
  text-underline-offset: .5em;
}

.text-link:hover { color: var(--c-tile-hi); }

/* ===== PV ===== */
.pv {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background: var(--c-box);
  border: 2px solid var(--c-ink);
  box-shadow:
    inset 0 0 0 1px rgba(143, 173, 238, .35),
    6px 6px 0 var(--c-ink);
}

.pv__soon {
  width: auto;
  transform-origin: center;
  font-size: clamp(26px, 4.4vw, 44px);
  font-weight: 700;
  letter-spacing: .24em;
  color: var(--c-pale);
}

/* ===== STORY ===== */
.story__lead { margin-bottom: 72px; }

/* 台詞：ゲーム内のように行ごとにずらして置く */
.talk {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 0 auto 80px;
}

.talk .chip { transform-origin: center; }

.talk__lines {
  display: grid;
  justify-items: end;
  gap: 12px;
  width: auto;
  transform-origin: center top;
  font-size: clamp(20px, 3vw, 30px);
  letter-spacing: .24em;
  line-height: 1.5;
}

.talk__lines .line {
  padding: .2em .55em;
}

.talk__lines .line:nth-child(1) { margin-right: 3.2em; }
.talk__lines .line:nth-child(2) { margin-right: 0; }
.talk__lines .line:nth-child(3) { margin-right: 1.4em; }

.story__body {
  display: grid;
  gap: 1.6em;
}

/* ===== ゲーム画面 ===== */
.shot {
  background: var(--c-night);
  border: 2px solid var(--c-ink);
  box-shadow:
    inset 0 0 0 1px rgba(143, 173, 238, .35),
    6px 6px 0 var(--c-ink);
}

.shot img {
  width: 100%;
  height: auto;
}

.shot--wide { margin-bottom: 72px; }

.shots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  margin-top: 72px;
}

.shots--system { margin-top: 56px; }

@media (max-width: 600px) {
  .shots { grid-template-columns: 1fr; gap: 20px; }
  .shots--system { margin-top: 40px; }
}

/* ===== STAFF ===== */
.staff {
  display: grid;
  gap: 28px;
}

.staff__row {
  display: grid;
  gap: 4px;
}

.staff dt {
  font-size: 13px;
  color: var(--c-pale);
  line-height: 2.2;
}

.staff dt .line { padding-block: .2em; }

.staff dd {
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 600;
  line-height: 1.9;
}

.staff__x {
  font-size: .6em;
  font-weight: 500;
  color: var(--c-pale);
  text-decoration: none;
}

.staff__x:hover { text-decoration: underline; }

/* ===== STORE ===== */
.store {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 28px;
  font-size: clamp(18px, 2.2vw, 22px);
}

.store .tile { min-width: 10em; padding-block: .9em; }

/* ストアロゴ：公式の色のまま読めるよう、タイル面を淡くする */
.tile--logo {
  width: 240px;
  height: 92px;
  padding: 0;
  background: #e6ecfb;
  box-shadow:
    inset 0 0 0 2px #ffffff,
    4px 4px 0 var(--c-ink);
}

.tile--logo img {
  width: auto;
  height: 40px;
}

.tile--logo.tile--link:hover {
  background: #ffffff;
  box-shadow:
    inset 0 0 0 2px var(--c-tile-hi),
    2px 2px 0 var(--c-ink);
}

/* 準備中のストア：ロゴをグレーにして押せないことを示す */
.tile--soon {
  gap: 6px;
  place-content: center;
  background: #b4b9c6;
  box-shadow:
    inset 0 0 0 2px #cdd1da,
    4px 4px 0 var(--c-ink);
}

.tile--soon img {
  height: 30px;
  filter: grayscale(1);
  opacity: .6;
}

.tile__note {
  color: #3c4152;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  line-height: 1.2;
}

@media (max-width: 600px) {
  .store { gap: 16px; }
  .store li { flex: 1 1 0; }
  .tile--logo { width: 100%; height: 76px; }
  .tile--logo img { height: 32px; }
  .tile--soon img { height: 24px; }
  .tile__note { font-size: 12px; }
}

/* ===== INSPIRED（別ページへの導線） ===== */
.inspired-link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 28px 32px;
  background: var(--c-box);
  border: 2px solid var(--c-ink);
  box-shadow: inset 0 0 0 1px rgba(143, 173, 238, .3);
  text-decoration: none;
  transition: background-color .3s ease;
}

.inspired-link .sec__title { font-size: clamp(28px, 4.4vw, 44px); text-shadow: none; }

.inspired-link__arrow {
  font-size: 28px;
  transition: transform .3s ease;
}

.inspired-link:hover { background: rgba(43, 58, 180, .55); }
.inspired-link:hover .inspired-link__arrow { transform: scaleX(.8) translateX(8px); }

/* ===== SPEC ===== */
.spec {
  display: grid;
  border-top: 1px solid rgba(169, 191, 243, .3);
}

.spec__row {
  display: grid;
  grid-template-columns: 9em 1fr;
  gap: 12px 24px;
  padding: 18px 20px;
  background: var(--c-box);
  border-bottom: 1px solid rgba(169, 191, 243, .3);
}

.spec dt {
  font-size: 13px;
  color: var(--c-pale);
  line-height: 2.2;
}

.spec dd {
  font-size: clamp(15px, 1.8vw, 18px);
  font-weight: 600;
  line-height: 1.8;
}

/* ===== フッター ===== */
.footer {
  display: grid;
  justify-items: center;
  gap: 24px;
  padding: 80px var(--gutter) 48px;
  text-align: center;
}

.footer__top {
  font-size: 12px;
  letter-spacing: .3em;
  text-decoration: none;
  background: var(--c-chip);
  padding: .7em 1.2em;
  transform-origin: center;
}

.footer__title {
  width: auto;
  font-size: 12px;
  color: var(--c-pale);
  transform-origin: center;
}

/* ===== 表示演出：にじむように出る ===== */
.js .reveal {
  opacity: 0;
  filter: blur(8px);
  translate: 0 16px;
  transition: opacity 1.2s ease, filter 1.2s ease, translate 1.2s ease;
}

.js .reveal.is-in {
  opacity: 1;
  filter: blur(0);
  translate: 0 0;
}

/* ===== スマホ ===== */
@media (max-width: 860px) {
  :root { --header-h: 56px; }

  .header__menu { display: block; }
  .header__title { font-size: 14px; padding-inline: .6em; }
  .header__title img { height: 26px; }
  .header { gap: 8px; }

  /* メニュー：全画面に重ね、背後をぼかす */
  .nav {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: grid;
    place-items: center;
    padding: var(--header-h) var(--gutter);
    overflow-y: auto;
    background: rgba(5, 10, 31, .55);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    transition: opacity .4s ease, visibility .4s;
  }

  /* タイトルと閉じるボタンはメニューの上に残す */
  .header__title,
  .header__menu {
    position: relative;
    z-index: 1;
  }

  .nav,
  .is-deep .nav { opacity: 0; visibility: hidden; translate: none; }
  .is-deep.is-menu-open .nav { opacity: 1; visibility: visible; }

  .nav ul {
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }

  .nav a {
    font-size: clamp(22px, 6vw, 28px);
    padding: .4em 1em;
  }

  .nav a .cond {
    transform-origin: center;
    text-indent: .18em;
  }

  .is-menu-open { overflow: hidden; }

  /* WebGLが使える時は、ぼかしの代わりに背景をドット化する。本文はいったん消す */
  .is-mosaic .nav {
    background: rgba(5, 10, 31, .2);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  main,
  .footer { transition: opacity .3s ease; }

  .is-mosaic.is-menu-open main,
  .is-mosaic.is-menu-open .footer { opacity: 0; }
}

@media (orientation: portrait) {
  .top__logo img { width: 86vw; }
}

@media (max-width: 600px) {
  .news__item { grid-template-columns: 1fr; }
  .news__date { justify-self: start; }

  .spec__row { grid-template-columns: 1fr; gap: 0; }

  .inspired-link { grid-template-columns: 1fr auto; padding: 22px; }
  .inspired-link .chip { grid-column: 1 / -1; justify-self: start; }

  .talk__lines .line:nth-child(1) { margin-right: 1.6em; }
  .talk__lines .line:nth-child(3) { margin-right: .8em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .top.is-logo .top__logo img { animation-duration: .6s; }
  .js .reveal { filter: none; translate: none; transition-duration: .4s; }
  .sec__title { filter: url(#wobble-still); }
}
