/* ソフィア紹介ページ
   色は設定画のカラーパレットから。見出しの「白い平行四辺形＋ピンクとシアンの二本線」は設定画の札の意匠を、黒地向けに反転したもの。 */

:root {
  --void: #000000;
  --ink: #202131;
  --paper: #f5f3fb;
  --text: #e4e0f0;
  --muted: #a39cb8;
  --arm: #25cef2;
  --pink: #ff3296;
  --lime: #c5f52b;
  --iris: #9348e8;
  --accent: #25cef2;
  --rainbow: linear-gradient(90deg, #ff3296, #f34464, #ff9845, #fff13b, #c5f52b, #25cef2, #9348e8, #8b3bd1);

  --font-jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "YuGothic", "Meiryo", "Noto Sans JP", sans-serif;
  --font-num: "DIN Condensed", "DIN Alternate", "Avenir Next Condensed", "Bahnschrift SemiCondensed", "Arial Narrow", sans-serif;

  --gutter: clamp(1rem, 6vw, 6.5rem);
  --copy: 33rem;
  --slant: 0.42em;
  /* 上下の黒帯。太い方は画面を 2.39:1 のシネスコに切る高さ（入口・空撮・登場）、細い方はスクロール中 */
  --bar-thick: clamp(3rem, calc((100vh - 100vw / 2.39) / 2), 16vh);
  --bar-thin: clamp(10px, 2.6vh, 28px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: clip; scroll-padding-top: 5.5rem; }
body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--font-jp);
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.9;
  letter-spacing: 0.02em;
  overflow-x: hidden;
}
/* 入口とイントロの間はスクロールを止める（main.js が html.is-locked を外す） */
html.is-locked, html.is-locked body { overflow: hidden; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
a { color: inherit; }
p { margin: 0; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--arm); outline-offset: 4px; }
/* 登場のあとにフォーカスを置く先頭の見出し（操作する物ではないので、枠は描かない） */
#hero-title:focus { outline: none; }

/* ------------------------------------------------------------ 3D とその上の暗幕 */

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  display: block;
  z-index: 0;
  touch-action: pan-y;
}
.scrim { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.scrim i { position: absolute; inset: 0; opacity: 0; transition: opacity .9s ease; }
.scrim-left { background: linear-gradient(90deg, rgba(0,0,0,.86) 0%, rgba(0,0,0,.6) 30%, rgba(0,0,0,0) 56%); }
.scrim-right { background: linear-gradient(270deg, rgba(0,0,0,.86) 0%, rgba(0,0,0,.6) 30%, rgba(0,0,0,0) 56%); }
.scrim-bottom { background: linear-gradient(0deg, rgba(0,0,0,.9) 0%, rgba(0,0,0,.55) 26%, rgba(0,0,0,0) 48%); }
body[data-side="left"] .scrim-left,
body[data-side="right"] .scrim-right,
body[data-side="bottom"] .scrim-bottom { opacity: 1; }

/* ------------------------------------------------------------ 札（見出し） */

.tag {
  display: inline-flex;
  align-items: stretch;
  margin: 0;
  font-weight: 900;
  font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.25rem);
  line-height: 1.25;
  letter-spacing: 0.04em;
  font-feature-settings: "palt";
  white-space: nowrap;
}
.tag-body {
  position: relative;
  display: inline-block;
  padding: 0.18em 1.05em 0.2em 0.62em;
  color: var(--void);
  background: var(--paper);
  clip-path: polygon(var(--slant) 0, 100% 0, calc(100% - var(--slant)) 100%, 0 100%);
}
/* ピンクとシアンの二本線 */
.tag::after {
  content: "";
  width: 1.05em;
  margin-left: 0.12em;
  background:
    linear-gradient(var(--pink), var(--pink)) 0 0 / 0.26em 100% no-repeat,
    linear-gradient(var(--arm), var(--arm)) 0.44em 0 / 0.26em 100% no-repeat;
  transform: skewX(-21deg);
}
.tag--small { font-size: 1.125rem; }
.tag--mini { font-size: 0.9375rem; }
.tag--hero {
  font-size: clamp(3.2rem, 1.4rem + 6vw, 7.2rem);
  letter-spacing: 0.01em;
  line-height: 1.12;
}
.tag--hero .tag-body { padding: 0.08em 0.9em 0.12em 0.5em; }
/* 登場の大見出し：札の下に英字の名前を添える（札と二本線はそのまま） */
.hero-name { margin: 0; display: grid; justify-items: start; gap: .55rem; }
.name-en {
  padding-left: .5rem;
  font-family: var(--font-num);
  font-weight: 700;
  font-size: clamp(1.15rem, .8rem + 1vw, 1.75rem);
  line-height: 1;
  letter-spacing: .34em;
  color: var(--paper);
  text-shadow: 0 0 3px rgba(0, 0, 0, .8), 0 0 18px color-mix(in srgb, var(--arm) 55%, transparent);
}

/* 見出しが画面に入ったときに一度だけ走る点灯（main.js が .is-on を付ける）。
   札はネオン管のようにちらついて点き、走査線が上から下へ抜け、文字の色が一瞬ずれる。二本線は少し遅れて点く。 */
.tag-body::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0 38%, rgba(37,206,242,.55) 46%, #fff 50%, rgba(255,50,150,.55) 54%, transparent 62% 100%);
  transform: translateY(-120%);
  opacity: 0;
  pointer-events: none;
}
/* 点く前の札は暗くしておき、「見えていた札がいったん消えて点く」ように見せない（main.js の dimHeadings） */
html.tags-dim .chapter:not(.chapter--hero) .tag:not(.is-on) .tag-body,
html.tags-dim .chapter:not(.chapter--hero) .tag:not(.is-on)::after { opacity: 0; }
.tag.is-on .tag-body { animation: tag-on .62s linear 1 both; }
.tag.is-on .tag-body::after { animation: tag-scan .42s .06s cubic-bezier(.4,0,.6,1) 1 both; }
.tag.is-on::after { animation: bars-on .62s linear 1 both; }
@keyframes tag-on {
  0% { opacity: 0; transform: translateX(-10px) skewX(-8deg); text-shadow: -6px 0 var(--pink), 6px 0 var(--arm); }
  8% { opacity: 1; transform: translateX(6px); clip-path: polygon(0 12%, 100% 12%, 100% 48%, 0 48%); }
  14% { opacity: .15; }
  22% { opacity: 1; transform: translateX(-3px); clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%); text-shadow: 4px 0 var(--pink), -4px 0 var(--arm); }
  30% { opacity: .45; clip-path: polygon(var(--slant) 0, 100% 0, calc(100% - var(--slant)) 100%, 0 100%); }
  38% { opacity: 1; transform: translateX(2px); text-shadow: -2px 0 var(--pink), 2px 0 var(--arm); }
  52% { opacity: .8; transform: none; }
  60%, 100% { opacity: 1; transform: none; text-shadow: none; clip-path: polygon(var(--slant) 0, 100% 0, calc(100% - var(--slant)) 100%, 0 100%); }
}
@keyframes tag-scan {
  0% { opacity: .9; transform: translateY(-120%); }
  100% { opacity: .9; transform: translateY(120%); }
}
@keyframes bars-on {
  0%, 30% { opacity: 0; }
  36% { opacity: 1; }
  44% { opacity: .2; }
  54%, 100% { opacity: 1; }
}

/* 名前の色ずれ */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  content: attr(data-text) / "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
}
.glitch::before { color: var(--pink); }
.glitch::after { color: var(--arm); }
body.is-revealed .glitch::before { animation: split-a 7.5s 1.1s infinite; }
body.is-revealed .glitch::after { animation: split-b 7.5s 1.1s infinite; }
@keyframes split-a {
  0% { opacity: 1; transform: translate(-.06em, .02em); clip-path: inset(0 0 55% 0); }
  3% { transform: translate(.05em, 0); clip-path: inset(40% 0 10% 0); }
  6% { opacity: 1; transform: translate(-.03em, 0); clip-path: inset(70% 0 0 0); }
  8%, 100% { opacity: 0; transform: none; }
}
@keyframes split-b {
  0% { opacity: 1; transform: translate(.06em, -.02em); clip-path: inset(50% 0 0 0); }
  3% { transform: translate(-.05em, 0); clip-path: inset(0 0 62% 0); }
  6% { opacity: 1; transform: translate(.03em, 0); clip-path: inset(20% 0 50% 0); }
  8%, 100% { opacity: 0; transform: none; }
}

/* ------------------------------------------------------------ ヘッダーと現在地 */

.head {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 26;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(1rem, env(safe-area-inset-top)) var(--gutter) 0;
  pointer-events: none;
}
.head > * { pointer-events: auto; }
.head::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7rem;
  background: linear-gradient(rgba(0,0,0,.9), rgba(0,0,0,.5) 50%, rgba(0,0,0,0));
  pointer-events: none;
  z-index: -1;
}
.head-tools { display: flex; align-items: center; gap: .7rem; }
.mark { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; }
.mark-en { font-family: var(--font-num); font-weight: 700; font-size: .95rem; line-height: 1; letter-spacing: .24em; color: var(--paper); text-shadow: 0 0 3px #000; }
/* 幅の狭い画面では、ヘッダーのボタンと並ばないので英字の名前を省く（大見出しとプロフィールには出す） */
@media (max-width: 520px) { .mark-en { display: none; } }
.mark .tag-body { transition: background-color .2s; }
.mark:hover .tag-body { background: var(--arm); }

.rail {
  position: fixed;
  right: clamp(.75rem, 2.4vw, 2rem);
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
}
.rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.rail a {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .6rem;
  min-height: 1.75rem;
  text-decoration: none;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--muted);
}
.rail a::after {
  content: "";
  width: 1.4rem;
  height: .3rem;
  background: rgba(255,255,255,.28);
  transform: skewX(-21deg);
  transition: width .35s ease, background-color .35s ease;
}
.rail a span {
  opacity: 0;
  transform: translateX(.4rem);
  transition: opacity .3s, transform .3s;
  /* 髪や服の明るい色の上でも読めるよう、暗い下地を敷く */
  padding: 0 .5rem 0 .45rem;
  line-height: 1.6;
  background: rgba(0, 0, 0, .62);
  clip-path: polygon(.25rem 0, 100% 0, calc(100% - .25rem) 100%, 0 100%);
  text-shadow: 0 0 6px #000;
}
.rail a:hover span, .rail a:focus-visible span, .rail a[aria-current="step"] span { opacity: 1; transform: none; }
.rail a[aria-current="step"] { color: var(--paper); }
.rail a[aria-current="step"]::after { width: 2.6rem; background: var(--accent); box-shadow: 0 0 12px var(--accent); }

/* ------------------------------------------------------------ 区画 */

main { position: relative; z-index: 2; }
.chapter {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 14vh calc(var(--gutter) + 3.5rem) 14vh var(--gutter);
}
.chapter--tall { min-height: 135vh; }
.chapter--right { justify-content: flex-end; padding-right: calc(var(--gutter) + 5rem); }
.copy { width: 100%; max-width: var(--copy); display: grid; gap: 2rem; justify-items: start; }
.copy > p:not([class]) { max-width: 30em; color: var(--text); }

.chapter--hero { min-height: 100vh; min-height: 100svh; }
.chapter--hero .copy { gap: 1.8rem; max-width: 46rem; }
.lede { font-size: 1.1875rem; font-weight: 500; line-height: 1.85; color: var(--paper); }
.cue {
  position: absolute;
  left: var(--gutter);
  bottom: max(calc(var(--bar-thin) + 1.2rem), env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: .8rem;
  font-size: .8125rem;
  color: var(--muted);
}
.cue::before {
  content: "";
  width: 1px;
  height: 2.6rem;
  background: linear-gradient(var(--arm), transparent);
  animation: cue 2.2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

.chapter--end { min-height: 120vh; }
/* 段の幅を大きな台詞に合わせ、ボタンはその幅で折り返す（ソフィアに重ならないように） */
.chapter--end .copy { width: min-content; max-width: 100%; gap: 2rem; }
.foot { font-size: .8125rem; color: var(--muted); }

/* ------------------------------------------------------------ 台詞ボタン */

.line {
  display: inline-flex;
  align-items: flex-start;
  gap: .9rem;
  margin: 0;
  padding: .35rem .2rem .35rem 0;
  border: 0;
  background: none;
  text-align: left;
  font-size: clamp(1.35rem, 1rem + 1.15vw, 1.9rem);
  font-weight: 700;
  line-height: 1.55;
  color: var(--paper);
  cursor: pointer;
  font-feature-settings: "palt";
}
.line-text { position: relative; text-shadow: 0 0 3px rgba(0, 0, 0, .85), 0 2px 18px rgba(0, 0, 0, .8); }
/* 開きかぎかっこは文字の段の頭に置き、2 行目以降は 1 文字目にそろえる（声のアイコンとは .line の gap で離す） */
.line-text { padding-left: .62em; }
.line-text::before { content: "「"; position: absolute; left: 0; top: 0; }
.line-text::after { content: "」"; }
/* 台詞は文節の切れ目（<wbr>）でだけ改行し、語の途中や 1 文字だけの行で切らない。
   word-break: auto-phrase が使えるブラウザ（Chrome 119 以降）では、それに任せる。 */
.line-text, .caption { word-break: keep-all; overflow-wrap: anywhere; text-wrap: pretty; }
@supports (word-break: auto-phrase) {
  .line-text, .caption { word-break: auto-phrase; }
}
/* text-wrap は white-space の折り返しの指定も上書きするので、締めの 1 行の台詞は改めて折り返さない指定にする */
.line--end .line-text { text-wrap: nowrap; }
.line:hover .line-text, .line.is-playing .line-text { color: #fff; text-shadow: 0 0 3px rgba(0, 0, 0, .85), 0 0 18px color-mix(in srgb, var(--arm) 70%, transparent); }
.line--hero { font-size: clamp(1.35rem, 1rem + 1.3vw, 2rem); }
.line--end {
  font-size: clamp(2.2rem, 1rem + 3vw, 3.6rem);
  white-space: nowrap;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0;
  align-items: center;
}
.line--end .meter { height: .62em; padding: 0 .3em; gap: .08em; }
.line--end .meter i { width: .07em; }
/* 締めの台詞の下に、ネオンの下線を一本引く */
.line--end .line-text {
  padding-bottom: .12em;
  background: linear-gradient(90deg, var(--pink), var(--arm)) 0 100% / 100% .07em no-repeat;
}

/* 音量メーター：止まっているときは「押すと鳴る」印、鳴っているときは実際の音量 */
.meter {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 1.55em;
  padding: 0 .55rem;
  border: 1.5px solid var(--arm);
  transform: skewX(-12deg);
  --lv: 0;
}
.meter i {
  display: block;
  width: 3px;
  height: 30%;
  background: var(--arm);
  transition: height .06s linear;
}
.meter i:nth-child(2) { height: 55%; }
.meter i:nth-child(3) { height: 80%; }
.meter i:nth-child(4) { height: 45%; }
.line:hover .meter { background: color-mix(in srgb, var(--arm) 18%, transparent); }
.line.is-playing .meter { background: var(--arm); }
.line.is-playing .meter i { background: var(--void); }
.line.is-playing .meter i:nth-child(1) { height: calc(18% + var(--lv) * 50%); }
.line.is-playing .meter i:nth-child(2) { height: calc(22% + var(--lv) * 78%); }
.line.is-playing .meter i:nth-child(3) { height: calc(20% + var(--lv) * 64%); }
.line.is-playing .meter i:nth-child(4) { height: calc(16% + var(--lv) * 40%); }

/* ------------------------------------------------------------ ボタン */

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.2rem; }
.hint {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .75rem;
  line-height: 1.6;
  color: var(--muted);
  opacity: .8;
}
/* 補足は 2 行目に置き、案内の幅を広げない（文字の段の幅が広がると 3D のソフィアが小さくなるため） */
.hint-note { display: block; }
/* 台詞ボタンの印（四角の中の縦線）を小さく描いて、何を押せばよいかを示す */
.hint-mark {
  width: .9rem;
  height: .75rem;
  border: 1px solid var(--arm);
  transform: skewX(-12deg);
  background: linear-gradient(var(--arm), var(--arm)) 50% 50% / 1.5px 55% no-repeat;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding: .5rem 1.4rem .5rem 1.1rem;
  border: 0;
  background: var(--arm);
  color: var(--void);
  font-size: .9375rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-decoration: none;
  cursor: pointer;
  clip-path: polygon(.6rem 0, 100% 0, calc(100% - .6rem) 100%, 0 100%);
  transition: background-color .2s, color .2s;
}
.btn:hover { background: var(--paper); }
/* clip-path で外側の枠が切れるので、フォーカスは内側に描く */
.btn:focus-visible { outline: none; background: var(--paper); box-shadow: inset 0 0 0 3px var(--arm); }
.btn--ghost:focus-visible { box-shadow: inset 0 0 0 3px var(--arm); color: var(--void); }
.btn:disabled { background: #3a3a48; color: #8d8a9c; cursor: default; }
.btn--ghost { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1.5px var(--paper); clip-path: none; }
.btn--ghost:hover { background: var(--paper); color: var(--void); }
.icon { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon .fill { fill: currentColor; stroke: none; }
/* YouTube（外部へのリンク）はピンクで、ページ内の操作（シアン）と分ける */
.btn--yt { background: var(--pink); color: var(--void); }
.btn--yt:hover { background: var(--paper); }
.btn--yt:focus-visible { box-shadow: inset 0 0 0 3px var(--pink); }
.btn--head { min-height: 2.5rem; font-size: .875rem; }

/* ------------------------------------------------------------ プロフィール */

.profile { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.6rem; margin: 0; width: 100%; }
.profile > div { display: grid; gap: .35rem; justify-items: start; }
.profile-wide { grid-column: 1 / -1; }
.profile dt {
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--paper);
  background: var(--ink);
  padding: .05rem .9rem .05rem .55rem;
  clip-path: polygon(.35rem 0, 100% 0, calc(100% - .35rem) 100%, 0 100%);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.profile dd { margin: 0; font-size: 1.5rem; font-weight: 700; line-height: 1.5; color: var(--paper); font-feature-settings: "palt"; }
.profile dd [lang="en"] { font-family: var(--font-num); font-size: 1.2em; letter-spacing: .08em; }
.name-sep { margin: 0 .1em; color: var(--muted); font-weight: 400; }

/* 年齢の伏せ字：粗いピクセルのモザイク（main.js の setupRedact がブロックを作り、ときどきグリッチさせる） */
.redact {
  position: relative;
  display: inline-block;
  width: 1.75em;
  height: 1.2em;
  margin-right: .14em;
  vertical-align: -.2em;
}
.redact-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(3, 1fr);
  overflow: hidden;
  background: var(--ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .16), 0 0 16px rgba(147, 72, 232, .35);
}
.redact-grid i { display: block; background: var(--ink); }
/* プロフィールでは、隣の「160cm」の数字と同じくらいの大きさにする */
.age .redact { width: 2.15em; height: 1.4em; margin-right: .16em; vertical-align: -.14em; }
/* 走査線を薄く重ねて、画面の検閲表示らしくする */
.redact-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px);
  pointer-events: none;
}
.redact-glyph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-num);
  font-weight: 700;
  font-size: .9em;
  line-height: 1;
  letter-spacing: .08em;
  color: #fff;
  text-shadow: -2px 0 var(--pink), 2px 0 var(--arm);
  opacity: 0;
}
.redact.is-glyph .redact-glyph { opacity: 1; }
.redact[data-glitch~="shift"] .redact-grid { transform: translateX(.14em) skewX(-8deg); }
.redact[data-glitch~="split"] .redact-grid { filter: drop-shadow(-3px 0 rgba(255, 50, 150, .9)) drop-shadow(3px 0 rgba(37, 206, 242, .9)); }
.redact[data-glitch~="slice"] .redact-grid { clip-path: polygon(0 0, 100% 0, 100% 38%, 0 38%, 0 52%, 100% 52%, 100% 100%, 0 100%); transform: translateX(-.1em); }
.redact[data-glitch~="slice"] .redact-glyph { transform: translateX(.12em); }
.num { font-family: var(--font-num); font-weight: 700; font-size: 2.1em; line-height: .9; letter-spacing: .01em; margin-right: .08em; vertical-align: -.08em; }

/* 表情 */
.moods { display: grid; gap: .65rem; width: 100%; }
.moods-label, .palette-label { font-size: .875rem; font-weight: 700; color: var(--paper); }
.moods-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .5rem; }
.moods-grid button {
  display: grid;
  gap: .3rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--muted);
}
.moods-grid span { white-space: nowrap; }
.moods-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  filter: saturate(.55) brightness(.72);
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.18);
  transition: filter .2s, box-shadow .2s;
}
.moods-grid button:hover img { filter: none; }
.moods-grid button[aria-pressed="true"] { color: var(--paper); }
.moods-grid button[aria-pressed="true"] img { filter: none; box-shadow: 0 0 0 2px var(--accent), 0 0 18px color-mix(in srgb, var(--accent) 60%, transparent); }
.moods-note { font-size: .8125rem; color: var(--muted); }

/* 設定画 */
.sheet { margin: 0; display: grid; gap: .5rem; max-width: 19rem; }
.sheet img { box-shadow: 0 0 0 1.5px rgba(255,255,255,.16); }
.sheet figcaption { font-size: .8125rem; color: var(--muted); }

/* パレット */
.palette { display: grid; gap: .7rem; width: 100%; }
.palette ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(9, 1fr); gap: .3rem; }
.palette li { display: grid; gap: .45rem; }
.palette li::before {
  content: "";
  height: 3.4rem;
  background: var(--c);
  transform: skewX(-12deg);
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 45%, transparent);
}
.palette li:last-child::before { box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
.palette span { font-family: var(--font-num); font-size: .8125rem; letter-spacing: .03em; color: var(--muted); text-align: center; }

/* ------------------------------------------------------------ ミュージックビデオ */

.chapter--video .copy { max-width: min(40rem, 50vw); }
.mv-list { display: grid; gap: 2.4rem; width: 100%; }
.mv { display: grid; gap: 1rem; }
.mv-title {
  margin: 0;
  font-size: clamp(2.2rem, 1.3rem + 2.6vw, 3.6rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: .02em;
  color: var(--paper);
  font-feature-settings: "palt";
  text-shadow: 0 0 28px color-mix(in srgb, var(--iris) 75%, transparent);
}
/* 画面：ピンクとシアンの角の印（札の二本線と同じ 2 色）と、薄い走査線 */
.mv-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.16), 0 0 48px color-mix(in srgb, var(--iris) 35%, transparent);
}
.mv-screen::before {
  content: "";
  position: absolute;
  inset: -8px;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(var(--pink), var(--pink)) 0 0 / 24px 2px no-repeat,
    linear-gradient(var(--pink), var(--pink)) 0 0 / 2px 24px no-repeat,
    linear-gradient(var(--arm), var(--arm)) 100% 100% / 24px 2px no-repeat,
    linear-gradient(var(--arm), var(--arm)) 100% 100% / 2px 24px no-repeat;
}
.mv-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px),
    linear-gradient(0deg, rgba(0,0,0,.55), rgba(0,0,0,0) 42%);
}
.mv-screen.is-embedded::after { display: none; }
.mv-poster, .mv-teaser, .mv-screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
}
.mv-teaser { opacity: 0; transition: opacity .5s ease; }
.mv-screen.is-teasing .mv-teaser { opacity: 1; }
.mv-play {
  position: absolute;
  left: 1.1rem;
  bottom: 1.1rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 3rem;
  padding: .55rem 1.6rem .55rem 1.2rem;
  border: 0;
  background: var(--arm);
  color: var(--void);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .04em;
  cursor: pointer;
  clip-path: polygon(.7rem 0, 100% 0, calc(100% - .7rem) 100%, 0 100%);
  transition: background-color .2s;
}
.mv-play svg { width: 1.35rem; height: 1.35rem; fill: currentColor; }
.mv-play:hover { background: var(--paper); }
.mv-play:focus-visible { outline: none; background: var(--paper); box-shadow: inset 0 0 0 3px var(--arm); }
.mv-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1.2rem; }
.mv-meta a {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--paper);
  text-decoration: underline;
  text-decoration-color: var(--pink);
  text-decoration-thickness: 2px;
  text-underline-offset: .35em;
}
.mv-meta a:hover { color: #fff; text-decoration-color: var(--arm); }
.mv-note { font-size: .75rem; color: var(--muted); }

/* ------------------------------------------------------------ 読み込み */

.loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  padding: calc(var(--bar-thick) + 1rem) var(--gutter) calc(var(--bar-thick) + clamp(1.2rem, 4vh, 3rem));
  background: var(--void);
  color: var(--paper);
  transition: background-color 1.6s ease;
}
/* 入口では後ろの暗いステージ（setDormant）が透けて見える */
.loader.is-see-through { background: rgba(0, 0, 0, .55); }
/* 濡れた路面に映るネオンのにじみ（飾り） */
.loader::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background:
    radial-gradient(40% 60% at 22% 100%, rgba(255, 50, 150, .14), transparent 70%),
    radial-gradient(36% 55% at 78% 100%, rgba(37, 206, 242, .12), transparent 70%);
  pointer-events: none;
}
.rain { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.loader::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.028) 0 1px, transparent 1px 4px);
  pointer-events: none;
}
.loader-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "tag tag" "count sheet" "line line" "foot foot" "error error";
  align-items: end;
  gap: 1rem 3rem;
}
.loader-tag { grid-area: tag; justify-self: start; }
.loader-count {
  grid-area: count;
  display: flex;
  align-items: flex-start;
  font-family: var(--font-num);
  font-weight: 700;
  font-size: clamp(7rem, 28vw, 19rem);
  line-height: .8;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  margin-top: 1.4rem;
}
.loader-pct { font-size: .3em; color: var(--arm); margin: .06em 0 0 .1em; }

/* 設定画のデータ。まだ届いていない行は暗い帯、届いた行は文字化けから正しい文字へ落ち着く */
.loader-sheet {
  grid-area: sheet;
  display: grid;
  gap: .35rem;
  margin: 0 0 .4rem;
  min-width: 19rem;
  font-size: .875rem;
  line-height: 1.6;
}
.loader-sheet div { display: grid; grid-template-columns: 3.2rem 1fr; gap: .8rem; align-items: center; }
.loader-sheet dt { color: var(--muted); font-weight: 600; }
.loader-sheet dd {
  margin: 0;
  min-height: 1.6em;
  font-weight: 700;
  color: var(--paper);
  white-space: nowrap;
  font-feature-settings: "palt";
  background: linear-gradient(rgba(255,255,255,.08), rgba(255,255,255,.08)) 0 50% / 70% .55em no-repeat;
}
.loader-sheet dd.is-on { background: none; }

/* パレットの 9 色で埋まる進み具合 */
.loader-line { grid-area: line; display: grid; grid-template-columns: repeat(9, 1fr); gap: .4rem; height: .55rem; }
.loader-line i {
  position: relative;
  display: block;
  background: rgba(255,255,255,.1);
  transform: skewX(-21deg);
  overflow: hidden;
  --f: 0;
}
.loader-line i::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--c);
  transform: scaleX(var(--f));
  transform-origin: left;
}
.loader-line i.is-full { box-shadow: 0 0 14px color-mix(in srgb, var(--c) 70%, transparent); }
.loader-foot { grid-area: foot; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .4rem 2rem; }
.loader-status { font-size: 1rem; font-weight: 600; }
.loader-bytes { display: flex; gap: 1.4rem; font-family: var(--font-num); font-size: 1.05rem; letter-spacing: .04em; color: var(--muted); min-height: 1.4em; font-variant-numeric: tabular-nums; }
#load-eta { font-family: var(--font-jp); font-size: .875rem; letter-spacing: .02em; }
/* 入口。受け取り終わったら、大きな数字の場所に ENTER を出す */
.loader.is-ready .loader-count, .loader.is-ready .loader-line, .loader.is-ready .loader-bytes { display: none; }
.loader.is-ready .loader-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.entry { grid-area: count; display: grid; gap: 1.6rem; justify-items: start; margin-top: clamp(1.4rem, 4.5vh, 2.8rem); animation: entry-in 1.4s cubic-bezier(.2,.7,.2,1) both; }
.entry-word {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: clamp(5rem, 17vw, 13rem);
  line-height: .78;
  letter-spacing: .06em;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(245, 243, 251, .9);
  text-shadow: 0 0 40px rgba(37, 206, 242, .25);
  margin-top: .3rem;
}
.entry-actions { display: flex; flex-wrap: wrap; gap: .8rem 1rem; }
.btn--enter { min-height: 3.1rem; padding-inline: 1.3rem 1.7rem; font-size: 1rem; }
.entry .btn--ghost { min-height: 3.1rem; font-size: 1rem; }
.entry-note { font-size: .8125rem; color: var(--muted); max-width: 34em; }
@keyframes entry-in { from { opacity: 0; transform: translateY(10px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.loader-error { grid-area: error; display: grid; gap: 1rem; justify-items: start; max-width: 36rem; }
.loader-error p { color: var(--paper); }
.loader.is-error .loader-line i::before { background: var(--pink); }
.loader.is-error .loader-sheet { display: none; }
.loader.is-lost .loader-count, .loader.is-lost .loader-line, .loader.is-lost .loader-status, .loader.is-lost .loader-sheet { display: none; }
.loader.is-done { animation: loader-out .75s steps(1, end) forwards; pointer-events: none; }
@keyframes loader-out {
  0% { clip-path: inset(0 0 0 0); transform: none; }
  12% { clip-path: inset(0 0 38% 0); transform: translateX(-10px); filter: drop-shadow(6px 0 var(--pink)); }
  24% { clip-path: inset(46% 0 0 0); transform: translateX(-4px); filter: drop-shadow(-6px 0 var(--arm)); }
  36% { clip-path: inset(10% 0 62% 0); transform: none; filter: none; }
  48% { clip-path: inset(72% 0 6% 0); }
  60% { clip-path: inset(30% 0 64% 0); }
  72%, 100% { clip-path: inset(50% 0 50% 0); visibility: hidden; }
}

/* 読み込み中は本文を隠しておき、終わったら一度だけ出す */
/* 入口・空撮・登場（is-intro）の間は本文を隠しておき、登場の構図に着いたら一度だけ出す */
body.is-loading .head, body.is-loading .rail, body.is-loading main, body.is-loading .credits,
body.is-intro .head, body.is-intro .rail, body.is-intro main, body.is-intro .credits { visibility: hidden; }
body.is-revealed .chapter--hero .copy > * { animation: hero-in .9s cubic-bezier(.2,.7,.2,1) both; }
body.is-revealed .chapter--hero .copy > :nth-child(2) { animation-delay: .2s; }
body.is-revealed .chapter--hero .copy > :nth-child(3) { animation-delay: .5s; }
body.is-revealed .chapter--hero .copy > :nth-child(4) { animation-delay: .7s; }
body.is-revealed .chapter--hero .copy > :nth-child(5) { animation-delay: .85s; }
body.is-revealed .head, body.is-revealed .rail { animation: fade-in 1.2s .4s ease both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes hero-in { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

.noscript { position: relative; z-index: 30; padding: 2rem var(--gutter); background: var(--void); }

/* ------------------------------------------------------------ 上下の黒帯（レターボックス） */

.letterbox { position: fixed; inset: 0; z-index: 25; pointer-events: none; --bar: var(--bar-thick); }
body.is-revealed .letterbox { --bar: var(--bar-thin); }
.letterbox i {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--bar);
  background: #000;
  transition: height 1.6s cubic-bezier(.65, 0, .35, 1);
}
.letterbox-top { top: 0; }
.letterbox-bottom { bottom: 0; }

/* ------------------------------------------------------------ 音のボタン（ヘッダー） */

.sound {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.5rem;
  padding: .4rem 1.1rem .4rem .95rem;
  border: 0;
  background: rgba(0, 0, 0, .55);
  color: var(--muted);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .28);
  clip-path: polygon(.5rem 0, 100% 0, calc(100% - .5rem) 100%, 0 100%);
  font-size: .875rem;
  font-weight: 700;
  letter-spacing: .04em;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s, box-shadow .2s;
}
.sound:hover { color: var(--paper); box-shadow: inset 0 0 0 1.5px var(--paper); }
.sound:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--arm); color: var(--paper); }
.sound-bars { display: inline-flex; align-items: center; gap: 2px; width: 1.05rem; height: 1rem; }
.sound-bars i { display: block; width: 2px; height: 2px; background: currentColor; transition: height .12s linear; }
.sound-label::after { content: " オフ"; }
.sound.is-on { color: var(--paper); box-shadow: inset 0 0 0 1.5px var(--arm); }
.sound.is-on .sound-label::after { content: " オン"; }
.sound.is-on .sound-bars i { background: var(--arm); height: calc(25% + var(--beat, 0) * 75%); }
.sound.is-on .sound-bars i:nth-child(2) { height: calc(45% + var(--beat, 0) * 55%); }
.sound.is-on .sound-bars i:nth-child(3) { height: calc(30% + var(--beat, 0) * 60%); }
.sound.is-on .sound-bars i:nth-child(4) { height: calc(20% + var(--beat, 0) * 40%); }

/* ------------------------------------------------------------ 空撮映像（入口のあと） */

.flyby { position: fixed; inset: 0; z-index: 22; background: #000; cursor: pointer; }
.flyby-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* 終わりに走る光の筋。映像は白く飛んでから暗転し、その暗闇から 3D の登場が始まる */
.flyby-streak {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: linear-gradient(90deg, transparent, var(--arm) 18%, #fff 50%, var(--pink) 82%, transparent);
  box-shadow: 0 0 22px 5px rgba(37, 206, 242, .55), 0 0 60px 10px rgba(255, 50, 150, .25);
  transform: scaleX(0);
  opacity: 0;
}
.flyby.is-cut { background: transparent; transition: background-color .35s .4s; }
.flyby.is-cut .flyby-video { animation: flyby-out .5s ease-in forwards; }
.flyby.is-cut .flyby-streak { animation: streak .85s cubic-bezier(.2, .7, .2, 1) forwards; }
@keyframes flyby-out {
  0% { opacity: 1; filter: none; }
  35% { opacity: 1; filter: brightness(1.9) saturate(1.3); }
  100% { opacity: 0; filter: brightness(.2); }
}
@keyframes streak {
  0% { opacity: 1; transform: scaleX(0); }
  40% { opacity: 1; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(1) scaleY(.3); }
}
.flyby-skip {
  position: fixed;
  right: var(--gutter);
  bottom: calc(var(--bar-thick) / 2 - 1.3rem);
  z-index: 27;
  display: grid;
  gap: .35rem;
  min-height: 2.6rem;
  padding: .45rem .2rem .3rem;
  border: 0;
  background: none;
  color: var(--paper);
  font-family: var(--font-num);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .32em;
  cursor: pointer;
  opacity: .8;
  transition: opacity .2s, color .2s;
}
.flyby-skip:hover, .flyby-skip:focus-visible { opacity: 1; color: var(--arm); }
.flyby-skip:focus-visible { outline: 2px solid var(--arm); outline-offset: 4px; }
/* 映像の残り時間を細い線で見せる */
.flyby-progress { display: block; height: 1px; background: rgba(255, 255, 255, .25); position: relative; overflow: hidden; }
.flyby-progress::before { content: ""; position: absolute; inset: 0; background: var(--arm); transform: scaleX(0); transform-origin: left; }
.flyby-skip.is-running .flyby-progress::before { animation: progress var(--length, 10s) linear forwards; }
@keyframes progress { to { transform: scaleX(1); } }

/* ------------------------------------------------------------ 字幕（ソフィアに触れたときの一言・操作の案内） */

.caption, .coach {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar-thin) + 14vh);
  z-index: 26;
  width: max-content;
  max-width: min(90vw, 40rem);
  margin: 0;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .45s ease, transform .45s ease;
}
/* PC では、字幕は文字の段の側（左か右）の下に寄せ、ソフィアの反応と重ならないようにする */
body[data-side="left"] .caption, body[data-side="right"] .caption {
  bottom: calc(var(--bar-thin) + 4.4rem);
  max-width: min(42vw, 34rem);
  padding: .35rem 1.2rem .4rem;
  transform: none;
}
body[data-side="left"] .caption {
  left: calc(var(--gutter) - 1.2rem);
  text-align: left;
  background: linear-gradient(90deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .35) 70%, transparent);
}
body[data-side="right"] .caption {
  left: auto;
  right: calc(var(--gutter) + 3.5rem - 1.2rem);
  text-align: right;
  background: linear-gradient(270deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .35) 70%, transparent);
}
/* 高さの低い横長の画面では、下に置くとボタンにかかるので、ヘッダーのすぐ下に出す（縦長のスマホの配置は除く） */
@media (max-height: 700px) and (min-aspect-ratio: 17/20) and (min-width: 761px), (max-height: 520px) and (min-aspect-ratio: 17/20) {
  body[data-side="left"] .caption, body[data-side="right"] .caption { bottom: auto; top: calc(var(--bar-thin) + 2.9rem); padding-block: .15rem .2rem; }
}
.caption {
  font-size: clamp(1.1rem, .9rem + .8vw, 1.6rem);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: .06em;
  color: var(--paper);
  font-feature-settings: "palt";
  text-shadow: 0 0 3px #000, 0 2px 16px rgba(0, 0, 0, .9);
}
.caption.is-quote { font-weight: 700; color: #fff; letter-spacing: .02em; }
.caption.is-on { opacity: 1; }
/* 操作の案内は、文字の段の側の下（左なら「スクロールで近づく」の右隣）に、縦に並べて小さく出す（ソフィアに重ねない） */
.coach {
  left: calc(var(--gutter) + 10.5rem);
  right: auto;
  bottom: max(calc(var(--bar-thin) + 1.2rem), env(safe-area-inset-bottom));
  max-width: min(40vw, 22rem);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .3rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--paper);
  text-align: left;
  text-shadow: 0 0 3px #000, 0 1px 10px #000;
  transform: translateY(6px);
}
/* 文字の段が右の区画（ページ内リンクで開いたときなど）では、右下に寄せる */
body[data-side="right"] .coach { left: auto; right: calc(var(--gutter) + 3.5rem); align-items: flex-end; text-align: right; }
.coach.is-on { opacity: .85; transform: none; }
.coach span { display: inline-flex; align-items: center; gap: .55rem; }
.coach span::before { content: ""; width: .9rem; height: 1px; background: var(--arm); box-shadow: 0 0 8px var(--arm); }

/* ------------------------------------------------------------ 映画のクレジット風の区画番号と、字幕風の本文 */

.credit {
  display: flex;
  align-items: baseline;
  gap: .35rem;
  margin: 0 0 -.6rem;
  font-family: var(--font-num);
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
}
.credit-no { font-size: 1.75rem; color: var(--paper); letter-spacing: .02em; }
.credit-of { font-size: .875rem; letter-spacing: .06em; opacity: .7; }
.credit-en {
  margin-left: .7rem;
  padding-left: .8rem;
  border-left: 1px solid var(--accent);
  font-size: 1rem;
  letter-spacing: .2em;
  transition: border-color .6s;
}
.caption-line {
  max-width: 24em;
  font-size: clamp(1.15rem, 1rem + .45vw, 1.4rem);
  font-weight: 500;
  line-height: 1.75;
  letter-spacing: .04em;
  color: var(--paper);
  font-feature-settings: "palt";
  text-shadow: 0 0 3px rgba(0, 0, 0, .8), 0 2px 16px rgba(0, 0, 0, .7);
}
.caption-line--big { font-size: clamp(1.35rem, 1rem + 1vw, 1.9rem); font-weight: 700; line-height: 1.6; }

/* 補足はたたんでおき、「くわしく」で開く */
.more { width: 100%; max-width: 30em; }
.more summary {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.2rem;
  list-style: none;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--muted);
  cursor: pointer;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::before {
  content: "";
  width: .7rem;
  height: .7rem;
  background:
    linear-gradient(var(--accent), var(--accent)) 50% 50% / 100% 1.5px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 50% 50% / 1.5px 100% no-repeat;
  transition: transform .3s ease;
}
.more[open] summary::before { transform: rotate(45deg); }
.more summary:hover { color: var(--paper); }
.more p { margin-top: .5rem; font-size: .9375rem; line-height: 1.85; color: var(--text); }

/* 出典（ページの最後） */
.credits {
  position: relative;
  z-index: 2;
  display: grid;
  gap: .25rem;
  padding: 3rem calc(var(--gutter) + 3.5rem) calc(var(--bar-thin) + 2.2rem) var(--gutter);
  background: linear-gradient(rgba(0, 0, 0, 0), #000 3rem);
  font-size: .75rem;
  line-height: 1.7;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* カーソルの光の軌跡 */
.trail { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
/* ドラッグで回り込める空いたところ */
body.has-orbit.is-revealed .chapter { cursor: grab; }
body.has-orbit.is-revealed .copy > * { cursor: auto; }
body.is-orbiting, body.is-orbiting .chapter { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }

/* ------------------------------------------------------------ 小さめの画面（ノート PC の小さいウィンドウ、分割表示） */

@media (min-width: 761px) and (max-width: 1100px) {
  :root { --copy: 26rem; --gutter: 2.5rem; }
  .chapter { padding-right: calc(var(--gutter) + 3rem); }
  .chapter--right { padding-right: calc(var(--gutter) + 3.5rem); }
  .copy { gap: 1.25rem; }
  .sheet { max-width: 14rem; }
  /* 現在地の名前は文字の段に重なるので、ポインターやキーボードで触れたときだけ出す */
  .rail a[aria-current="step"] span { opacity: 0; transform: translateX(.4rem); }
  .rail a:hover span, .rail a:focus-visible span { opacity: 1; transform: none; }
}

/* 1440px 未満の横長画面では、文字の段の下に半透明の暗い板を敷く（モデルと近づいても読めるように） */
@media (min-width: 761px) and (max-width: 1399px) and (min-aspect-ratio: 17/20) {
  .chapter:not(.chapter--end):not(.chapter--hero) .copy {
    padding: 1.2rem 1.4rem 1.4rem;
    margin-inline: -1.4rem;
    background: rgba(0, 0, 0, .52);
    box-shadow: 0 0 2.5rem 1.2rem rgba(0, 0, 0, .52);
  }
}

/* ------------------------------------------------------------ スマホ縦 */

/* 縦長の画面か、幅 760px 以下でも高さのある画面。高さの低い横長は下の別の指定で組む（js/stage.js の PHONE_QUERY と同じ条件） */
@media (max-aspect-ratio: 17/20), (max-width: 760px) and (min-height: 521px) {
  /* 縦長の画面では黒帯を控えめにする（スクロール中は出さない） */
  :root { --bar-thick: 7svh; --bar-thin: 0px; }
  .caption, .coach { bottom: auto; top: calc(max(.8rem, env(safe-area-inset-top)) + 3.6rem); }
  body[data-side] .caption { left: 50%; right: auto; max-width: 90vw; padding: 0; transform: translateX(-50%); text-align: center; background: none; }
  .coach, body[data-side="right"] .coach { left: 50%; right: auto; max-width: 90vw; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; text-align: center; transform: translate(-50%, 6px); }
  .coach.is-on, body[data-side="right"] .coach.is-on { transform: translateX(-50%); }
  .credits { padding: 2.4rem 1rem max(1.6rem, env(safe-area-inset-bottom)); }
  /* 区画番号の行は、縦長の画面では出さない（3D の顔に文字の段がかからないように） */
  .credit { display: none; }
  .caption-line { font-size: 1.0625rem; }
  .caption-line--big { font-size: 1.25rem; }
  .entry { gap: 1.2rem; }
  .entry-note { font-size: .75rem; }
  .head-tools { gap: .45rem; }
  .sound { padding: .4rem .8rem .4rem .7rem; }
  body { font-size: 1rem; line-height: 1.85; }
  .head { padding-top: max(.8rem, env(safe-area-inset-top)); }
  .btn--head { padding: .4rem .9rem .4rem .75rem; min-height: 2.5rem; }
  .rail { right: .35rem; top: 5rem; bottom: auto; transform: none; }
  .rail a { min-height: 1.5rem; }
  .rail a { position: relative; }
  .rail a span {
    position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .rail a::after { width: .9rem; height: .22rem; }
  .rail a[aria-current="step"]::after { width: 1.5rem; }

  .chapter, .chapter--right {
    min-height: 130svh;
    align-items: flex-end;
    justify-content: flex-start;
    /* 下に余白を取り、読み終わるまで次の構図へ動かないようにする */
    padding: 0 1rem 42svh 1rem;
  }
  /* 右端の現在地表示に重ならないよう、右に余白を取る */
  .chapter:not(.chapter--hero):not(.chapter--end) .copy {
    margin: 0 -1rem;
    padding: 2rem 2.4rem 1.5rem 1rem;
    width: calc(100% + 2rem);
    background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.72) 2rem, rgba(0,0,0,.72) calc(100% - 2rem), rgba(0,0,0,0));
  }
  .chapter--hero { min-height: 100svh; padding-bottom: max(4.2rem, env(safe-area-inset-bottom)); }
  .chapter--end { min-height: 120svh; padding-bottom: max(2.4rem, env(safe-area-inset-bottom)); }
  .chapter--end .copy { width: 100%; gap: 1.4rem; }
  .copy { gap: 1.1rem; max-width: none; }
  .tag--hero { font-size: clamp(2.6rem, 13.5vw, 4.4rem); }
  .chapter--hero .copy { padding-right: 2.2rem; }
  .lede { font-size: 1.0625rem; }
  .line--end { font-size: min(7.4vw, 2.6rem); gap: .7rem; }
  /* 狭い画面では、声のアイコンとかぎかっこの間を少し詰める（重ならない範囲で） */
  .line { gap: .6rem; }
  .line .meter { padding: 0 .45rem; }
  .line-text { padding-left: .58em; }
  .btn-long { display: none; }
  .chapter--video .copy { max-width: none; }
  .mv-title { font-size: clamp(1.8rem, 9vw, 2.6rem); }
  .mv-play { left: .7rem; bottom: .7rem; min-height: 2.6rem; padding: .4rem 1.2rem .4rem .95rem; font-size: .9375rem; }
  .loader-inner { grid-template-columns: minmax(0, 1fr); grid-template-areas: "tag" "sheet" "count" "line" "foot" "error"; gap: 1rem; }
  .loader-sheet { min-width: 0; font-size: .8125rem; margin: .6rem 0 0; }
  .loader-line { gap: .25rem; }
  .cue { left: 1rem; bottom: 1rem; }
  .cue::before { height: 1.8rem; }
  .profile { grid-template-columns: repeat(3, auto); gap: .7rem 1.2rem; }
  .profile dd { font-size: 1.125rem; }
  .moods-grid { gap: .35rem; }
  .moods-note { display: none; }
  .sheet { max-width: 11rem; }
  .palette ul { gap: .2rem; }
  .palette li::before { height: 2.2rem; }
  .palette span { font-size: .6875rem; letter-spacing: 0; }
  body[data-side="left"] .scrim-left, body[data-side="right"] .scrim-right { opacity: 0; }
  body .scrim-bottom { opacity: 1; }
}

/* スマホの顔の区画：表情の欄を見ているあいだ、上に寄せた 3D の顔に暗い板がかからないよう、板の上端を見出しの近くまで下げる */
@media (max-aspect-ratio: 17/20), (max-width: 760px) and (min-height: 521px) {
  #face .copy {
    padding-top: 1.6rem;
    background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.72) 1.6rem, rgba(0,0,0,.72) calc(100% - 2rem), rgba(0,0,0,0));
  }
}
/* 高さの低いスマホ（375×667 など）では、顔の区画の文字の段を詰めて、顔が見える高さを残す */
@media (max-aspect-ratio: 17/20) and (max-height: 700px), (max-width: 760px) and (min-height: 521px) and (max-height: 700px) {
  #face .copy { gap: .7rem; padding-bottom: 1rem; }
  #face .tag { font-size: 1.35rem; }
  #face .profile { gap: .35rem 1rem; }
  #face .profile dd { font-size: 1rem; }
  #face .num { font-size: 1.8em; }
  #face .line { font-size: 1.05rem; line-height: 1.45; }
  #face .moods { gap: .4rem; }
}

/* ------------------------------------------------------------ 高さの低い横長画面（スマホ横向きなど） */

@media (max-height: 520px) and (min-aspect-ratio: 17/20) {
  :root { --gutter: clamp(1rem, 4vw, 2.5rem); --copy: min(24rem, 46vw); }
  html { scroll-padding-top: 3.5rem; }
  .rail a span, .rail a[aria-current="step"] span { opacity: 0; }
  .rail a:hover span, .rail a:focus-visible span { opacity: 1; }
  /* 文字の段の下に暗い板を敷き、モデルはその外側に置く（main.js の measureLayout） */
  .chapter:not(.chapter--end):not(.chapter--hero) .copy {
    padding: .9rem 1.1rem 1.1rem;
    margin-inline: -1.1rem;
    background: rgba(0, 0, 0, .52);
    box-shadow: 0 0 2rem 1rem rgba(0, 0, 0, .52);
  }
  body { font-size: .9375rem; line-height: 1.7; }
  .head {
    padding: max(.45rem, env(safe-area-inset-top)) calc(var(--gutter) + env(safe-area-inset-right)) 0 calc(var(--gutter) + env(safe-area-inset-left));
  }
  .head::before { height: 4rem; }
  .btn--head { min-height: 2.2rem; padding: .3rem .9rem .3rem .75rem; }
  .rail { right: calc(.5rem + env(safe-area-inset-right)); }
  .rail ol { gap: .1rem; }
  .rail a { min-height: 1.5rem; }
  .chapter, .chapter--tall { min-height: 100vh; }
  .chapter {
    padding: 3.6rem calc(var(--gutter) + 3rem + env(safe-area-inset-right)) 2.4rem calc(var(--gutter) + env(safe-area-inset-left));
  }
  .chapter--right { padding-right: calc(var(--gutter) + 4.5rem + env(safe-area-inset-right)); }
  .chapter--end { min-height: 110vh; padding-bottom: 1.5rem; }
  .chapter--hero .copy { max-width: min(30rem, 56vw); }
  .tag--hero .tag-body { padding-right: .7em; }
  .copy { gap: .8rem; }
  .tag { font-size: 1.35rem; }
  .tag--hero { font-size: 3rem; }
  .line, .line--hero { font-size: 1.1rem; }
  .line--end { font-size: 2rem; }
  .lede { font-size: 1rem; }
  .profile { gap: .6rem 1.2rem; }
  .profile dd { font-size: 1.05rem; }
  .moods-grid { max-width: 22rem; }
  .moods-grid button { font-size: .6875rem; letter-spacing: 0; }
  .moods-note, .hint, .cue { display: none; }
  .chapter--video .copy { max-width: min(26rem, 48vw); }
  .mv-title { font-size: 1.6rem; }
  .mv-play { left: .6rem; bottom: .6rem; min-height: 2.3rem; padding: .3rem 1.1rem .3rem .85rem; font-size: .875rem; }
  .loader-sheet { display: none; }
  .entry { gap: .8rem; }
  .entry-word { font-size: 4.2rem; }
  .entry-note { display: none; }
  .credit { display: none; }
  .caption-line { font-size: 1rem; }
  .sheet { max-width: 9rem; }
  .palette li::before { height: 1.8rem; }
}

/* ------------------------------------------------------------ 動きを減らす設定 */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  body.is-revealed .glitch::before, body.is-revealed .glitch::after { animation: none; }
  .tag.is-on .tag-body, .tag.is-on .tag-body::after, .tag.is-on::after { animation: none; }
  .loader.is-done { animation: none; visibility: hidden; }
  .entry { animation: none; }
  .cue::before { animation: none; }
}
