/*
 * game.css
 * 『指輪の境界線』ビジュアルデザイン。
 * テーマ：結婚指輪／成人の職場／都会／責任／境界線／静かな緊張
 * 色　　：スモーキーネイビー／チャコール／アイボリー／シャンパンゴールド／控えめなモーヴ
 *
 * ハート・ピンク・キラキラ中心の典型的な萌えゲームUIにはしない。
 * 成熟・都会的・静か・上品・少し緊張感のあるトーンを一貫させる。
 */

:root {
  --c-navy-deep: #0f1620;
  --c-navy: #16202e;
  --c-navy-soft: #1e2b3c;
  --c-charcoal: #23262b;
  --c-ivory: #eee7da;
  --c-ivory-dim: #cfc7b8;
  --c-gold: #c9a86a;
  --c-gold-soft: #b99a63;
  --c-gold-bright: #e3c98f;
  --c-mauve: #9c8391;
  --c-mauve-soft: #7d6c78;
  --c-text: #ede8df;
  --c-text-dim: #a9a49b;
  --c-danger: #a2645c;

  --font-serif: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  --font-sans: "Yu Gothic", "YuGothic", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--c-navy-deep);
  color: var(--c-text);
  font-family: var(--font-sans);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--c-navy-deep);
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ============================================================
   タイトル画面
   v3.1：「1枚絵をカードとして中央に置く」構成をやめ、キービジュアルを
   画面全体へ敷いた本来のゲームタイトル画面として再構成した。
   額縁・角丸・外周の影は付けず、端まで届く全面表示にする。
   ============================================================ */
.title-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #06080c;
}

/* 背景層：同じ画像を大きくぼかし暗くして画面全体へ敷く。
   横長画面で縦長ビジュアルの左右に生じる余白を、作品の色のまま埋める。 */
.title-ambient {
  position: absolute;
  inset: -8%;
  background-size: cover;
  background-position: center;
  filter: blur(38px) saturate(0.85) brightness(0.42);
  transform: scale(1.06);
}

/* 舞台層：キービジュアルの縦横比（941:1672）に合わせた領域。
   スマホ縦画面では 100vw × 100dvh となり、そのまま全面表示になる。 */
.title-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(100vw, calc(100dvh * 941 / 1672));
  height: 100dvh;
  overflow: hidden;
  box-shadow: 0 0 90px rgba(0, 0, 0, 0.75);
  animation: title-stage-in 1.15s ease both;
}

@keyframes title-stage-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(1.03); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.title-kv {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* 画面端をわずかに落として、写真ではなく「画面」に見せる */
.title-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 78% 62% at 50% 38%, transparent 55%, rgba(4, 6, 10, 0.5) 100%);
}

/* 下部スクリム：メニューの可読性を確保しつつ、
   キービジュアルのキャッチコピー帯を潰さない高さに抑える。 */
.title-scrim {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(5, 7, 11, 0.30) 42%,
    rgba(4, 6, 9, 0.80) 78%,
    rgba(3, 5, 8, 0.94) 100%
  );
}

.title-menu {
  position: absolute;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 2;
  width: min(300px, 78%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  text-align: center;
}

/*
 * 縦の短い端末（iPhone SE系など）では、キービジュアル下部の
 * キャッチコピー帯とメニューが近づくため、メニュー側を圧縮して逃がす。
 */
@media (max-height: 700px) {
  .title-btn { padding: 0.62em 1em; font-size: 0.86rem; letter-spacing: 0.16em; }
  .title-menu { gap: 6px; bottom: max(8px, env(safe-area-inset-bottom)); }
  .title-footer { font-size: 0.56rem; margin-top: 0; }
  .title-scrim { height: 42%; }
}

.title-btn {
  position: relative;
  padding: 0.78em 1.2em;
  background: rgba(12, 18, 27, 0.62);
  border: 1px solid rgba(201, 168, 106, 0.5);
  border-radius: var(--radius-sm);
  color: var(--c-ivory);
  font-size: 0.94rem;
  letter-spacing: 0.2em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
}

/* 「はじめから」は主導線なので、わずかに金の存在感を強める */
.title-btn-primary {
  border-color: rgba(227, 201, 143, 0.75);
  background: rgba(24, 34, 48, 0.66);
  box-shadow: 0 0 22px rgba(201, 168, 106, 0.14);
}

.title-btn:hover:not(.is-disabled) {
  border-color: var(--c-gold-bright);
  background: rgba(32, 45, 62, 0.8);
  color: var(--c-gold-bright);
}

.title-btn.is-disabled {
  opacity: 0.32;
  cursor: default;
}

.title-footer {
  margin-top: 2px;
  font-size: 0.62rem;
  color: var(--c-text-dim);
  letter-spacing: 0.16em;
  opacity: 0.62;
}

/* ============================================================
   ローディング画面
   ============================================================ */
.loading-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-navy-deep);
}

.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(201, 168, 106, 0.25);
  border-top-color: var(--c-gold);
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  color: var(--c-text-dim);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
}

/* ============================================================
   ゲーム本編ステージ
   ============================================================ */
.vn-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

.vn-bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  will-change: opacity;
}

.vn-bg-a { z-index: 1; }
.vn-bg-b { z-index: 2; }

.vn-cg-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

/*
 * 立ち絵レイヤー（v3：さらに大型化・中央寄りへ）
 * ヒロインを画面の主役として、頭〜胸元〜腰付近を大きく見せる。
 * 「基本は中央寄りを優先」という方針に合わせ、left/rightのオフセットを
 * 画面中央から±10%まで狭め、常に強い中央寄りの印象になるよう調整した。
 * 画面下端（bottom:0）を基準に配置し、テキストウィンドウより高いzで
 * 覆われる脚部分は自然にテキストウィンドウの背後へ隠れる構図にする
 * （全身を縮小して収めるのではなく、上半身を大きく見せることを優先）。
 * object-fit:contain のため、頭頂部が不自然に切れることも引き伸ばしもない。
 */
.vn-sprite-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

/* キャラクターの存在感を高めるための、控えめなスポットライト状の光暈 */
.vn-sprite-layer::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(120vw, 900px);
  height: 72dvh;
  transform: translateX(-50%);
  background: radial-gradient(ellipse 50% 85% at 50% 100%, rgba(201, 168, 106, 0.10), transparent 72%);
  pointer-events: none;
}

.vn-sprite {
  position: absolute;
  bottom: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.vn-pos-left   { left: 40%; transform: translateX(-50%) translateY(14px) scale(0.97); }
.vn-pos-center { left: 50%; transform: translateX(-50%) translateY(14px) scale(0.97); }
.vn-pos-right  { left: 60%; transform: translateX(-50%) translateY(14px) scale(0.97); }

.vn-pos-left.is-visible,
.vn-pos-center.is-visible,
.vn-pos-right.is-visible {
  transform: translateX(-50%) translateY(0) scale(1);
}

.vn-sprite.is-visible { opacity: 1; }

.vn-sprite-img {
  display: block;
  /* dvh未対応ブラウザ向けフォールバック（vh）。dvh対応ブラウザは下の行で上書きされる */
  height: min(72vh, calc(100vh - env(safe-area-inset-top) - 52px));
  height: min(72dvh, calc(100dvh - env(safe-area-inset-top) - 52px));
  width: auto;
  max-width: 97vw;
  object-fit: contain;
  filter: drop-shadow(0 24px 36px rgba(0,0,0,0.5));
}

.vn-scene-tag {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 6;
  padding: 5px 14px;
  font-size: 0.66rem;
  letter-spacing: 0.28em;
  color: var(--c-gold-soft);
  background: rgba(15, 22, 32, 0.55);
  border: 1px solid rgba(201, 168, 106, 0.25);
  border-radius: 999px;
  pointer-events: none;
}

/* ── テキストレイヤー ── */
.vn-text-layer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 7;
  padding: 0 3vw;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.vn-nameplate {
  position: relative;
  margin-left: clamp(6px, 2vw, 24px);
  margin-bottom: -12px;
  padding: 6px 24px;
  z-index: 8;
  background: linear-gradient(180deg, #26364a, #131c28);
  border: 1px solid rgba(201, 168, 106, 0.55);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--c-gold-bright);
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  font-family: var(--font-serif);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.25);
}

.vn-textwindow {
  position: relative;
  width: 100%;
  min-height: clamp(96px, 15dvh, 165px);
  padding: clamp(16px, 2.6dvh, 26px) clamp(18px, 4vw, 36px) clamp(12px, 1.6dvh, 18px);
  background:
    linear-gradient(180deg, rgba(18, 27, 39, 0.92), rgba(9, 13, 20, 0.96));
  border: 1px solid rgba(201, 168, 106, 0.35);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.03);
  backdrop-filter: blur(2px);
}

.vn-textwindow::before,
.vn-textwindow::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--c-gold-soft);
  opacity: 0.7;
  pointer-events: none;
}
.vn-textwindow::before {
  top: 8px; left: 8px;
  border-top: 1px solid var(--c-gold-soft);
  border-left: 1px solid var(--c-gold-soft);
}
.vn-textwindow::after {
  bottom: 8px; right: 8px;
  border-bottom: 1px solid var(--c-gold-soft);
  border-right: 1px solid var(--c-gold-soft);
}

.vn-textbody {
  font-size: clamp(0.95rem, 2.1vw, 1.16rem);
  line-height: 1.8;
  color: var(--c-text);
  letter-spacing: 0.02em;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 3.2em;
}

.vn-textbody-quote {
  padding: 12px 18px;
  background: rgba(201, 168, 106, 0.06);
  border-left: 2px solid var(--c-gold-soft);
  border-radius: 4px;
  font-style: normal;
  color: var(--c-ivory);
}

.vn-quote-notification {
  border-left-color: var(--c-mauve);
  font-size: 0.92em;
  color: var(--c-ivory-dim);
}

.vn-quote-signage {
  border-left-color: var(--c-text-dim);
  color: var(--c-text-dim);
  font-family: var(--font-serif);
}

.vn-advance-hint {
  position: absolute;
  right: 22px;
  bottom: 14px;
  font-size: 0.8rem;
  color: var(--c-gold-soft);
  opacity: 0;
  animation: none;
}

.vn-advance-hint.is-ready {
  opacity: 0.85;
  animation: bob 1.4s ease-in-out infinite;
}

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

/* ── 選択肢 ── */
.vn-choice-layer {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8vh 6vw;
  background: radial-gradient(ellipse at 50% 50%, rgba(10, 14, 20, 0.55), rgba(6, 9, 13, 0.82));
}

.vn-choice-layer.is-visible { display: flex; }

.vn-choice-btn {
  width: min(560px, 92vw);
  padding: 16px 26px;
  background: linear-gradient(180deg, rgba(30, 43, 60, 0.92), rgba(16, 23, 33, 0.94));
  border: 1px solid rgba(201, 168, 106, 0.4);
  border-radius: var(--radius-sm);
  color: var(--c-ivory);
  font-size: clamp(0.92rem, 2vw, 1.05rem);
  letter-spacing: 0.04em;
  line-height: 1.6;
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.vn-choice-btn:hover {
  border-color: var(--c-gold-bright);
  background: linear-gradient(180deg, rgba(42, 58, 78, 0.95), rgba(22, 31, 44, 0.96));
  transform: translateY(-1px);
}

.vn-choice-btn:active { transform: translateY(0); }

/*
 * システムUI（v2：1つのMENUボタンへ集約）
 * 常時横並びだった5ボタンを廃止し、背景・立ち絵の表示面積を優先する。
 */
.vn-sys-layer {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 20;
}

.vn-menu-btn {
  padding: 7px 16px;
  background: rgba(15, 22, 32, 0.62);
  border: 1px solid rgba(201, 168, 106, 0.32);
  border-radius: 999px;
  color: var(--c-text-dim);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.vn-menu-btn:hover,
.vn-menu-btn.is-active {
  color: var(--c-gold-bright);
  border-color: var(--c-gold-bright);
  background: rgba(20, 29, 42, 0.78);
}

.vn-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px;
  background: linear-gradient(180deg, #1c2836, #0f1620);
  border: 1px solid rgba(201, 168, 106, 0.32);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.vn-menu-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.vn-menu-item {
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--c-text);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.vn-menu-item:hover { background: rgba(201, 168, 106, 0.12); color: var(--c-gold-bright); }
.vn-menu-item.is-active { color: var(--c-gold-bright); }

/* ============================================================
   モーダル（履歴・設定）
   ============================================================ */
.vn-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(6, 9, 13, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
}

.vn-modal {
  width: min(640px, 100%);
  max-height: 84vh; /* dvh未対応ブラウザ向けフォールバック */
  max-height: 84dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1b2634, #0e1420);
  border: 1px solid rgba(201, 168, 106, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
}

.vn-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(201, 168, 106, 0.2);
}

.vn-modal-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  color: var(--c-gold-bright);
  font-weight: 400;
}

.vn-modal-close {
  background: none;
  border: none;
  color: var(--c-text-dim);
  font-size: 1rem;
  padding: 4px 8px;
}
.vn-modal-close:hover { color: var(--c-gold-bright); }

.vn-backlog-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* iOS Safariでのモメンタムスクロールを確実にする */
  overscroll-behavior: contain;
  padding: 16px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.vn-backlog-hint {
  margin: 0 0 4px;
  font-size: 0.7rem;
  line-height: 1.6;
  color: var(--c-text-dim);
  opacity: 0.8;
}

.vn-backlog-item {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* 選択の記録は、通常の本文と区別できるよう左に金の罫を入れる */
.vn-backlog-item.is-choice {
  padding-left: 10px;
  border-left: 2px solid rgba(201, 168, 106, 0.55);
}

.vn-backlog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
  min-height: 22px;
}

.vn-backlog-speaker {
  font-size: 0.75rem;
  color: var(--c-gold-soft);
  letter-spacing: 0.08em;
}

.vn-backlog-jump {
  flex: 0 0 auto;
  padding: 4px 11px;
  background: rgba(201, 168, 106, 0.10);
  border: 1px solid rgba(201, 168, 106, 0.42);
  border-radius: 999px;
  color: var(--c-gold-soft);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.vn-backlog-jump:hover {
  background: rgba(201, 168, 106, 0.2);
  border-color: var(--c-gold-bright);
  color: var(--c-gold-bright);
}

.vn-backlog-text {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--c-text);
  white-space: pre-wrap;
}

.vn-backlog-empty {
  color: var(--c-text-dim);
  font-size: 0.85rem;
  text-align: center;
  padding: 30px 0;
}

/* ── セーブ／ロード スロット一覧 ── */
.vn-slot-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vn-slot-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(201, 168, 106, 0.25);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.vn-slot-item:not(:disabled):hover {
  border-color: var(--c-gold-bright);
  background: rgba(201, 168, 106, 0.08);
}

.vn-slot-item.is-empty {
  color: var(--c-text-dim);
}

.vn-slot-item:disabled {
  cursor: default;
  opacity: 0.5;
}

.vn-slot-num {
  flex: 0 0 auto;
  min-width: 68px;
  font-size: 0.78rem;
  color: var(--c-gold-soft);
  letter-spacing: 0.05em;
}

.vn-slot-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vn-slot-scene {
  font-size: 0.85rem;
  color: var(--c-gold-bright);
  font-family: var(--font-serif);
}

.vn-slot-preview {
  font-size: 0.78rem;
  color: var(--c-text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vn-slot-time {
  font-size: 0.68rem;
  color: var(--c-text-dim);
  opacity: 0.7;
}

.vn-slot-empty-label {
  font-size: 0.82rem;
  letter-spacing: 0.05em;
}

/* ── debug mode パネル（?debug=1のときのみDOMに生成される） ── */
.vn-debug-panel {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 30;
  margin: 0;
  padding: 8px 10px;
  max-width: 46vw;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(201, 168, 106, 0.3);
  border-radius: 4px;
  color: #9be29b;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 0.62rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  pointer-events: none;
}

.vn-settings-body {
  padding: 20px 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.vn-settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.vn-settings-label {
  font-size: 0.88rem;
  color: var(--c-text);
  letter-spacing: 0.03em;
}

.vn-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(201, 168, 106, 0.35);
  color: var(--c-ivory);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.vn-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--c-gold);
}

.vn-range {
  width: min(160px, 46vw);
  accent-color: var(--c-gold);
}

.vn-settings-divider {
  height: 1px;
  background: rgba(201, 168, 106, 0.18);
  margin: 2px 0;
}

.vn-settings-note {
  margin: 4px 0 0;
  font-size: 0.76rem;
  line-height: 1.7;
  color: var(--c-text-dim);
}

/* ============================================================
   エンドカード
   ============================================================ */
.end-card-screen {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--c-navy) 0%, var(--c-navy-deep) 60%, #090c10 100%);
  overflow: hidden;
}

.end-card-veil {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(201, 168, 106, 0.07), transparent 60%);
}

.end-card-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
  padding: 6vh 6vw;
}

.end-card-label {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4.4vw, 2.2rem);
  letter-spacing: 0.3em;
  color: var(--c-ivory);
}

.end-card-rule {
  width: 90px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-gold-soft), transparent);
}

.end-card-sub {
  margin: 0;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: var(--c-text-dim);
}

.end-card-menu { margin-top: 16px; }

/* ============================================================
   レスポンシブ微調整
   iPhone想定幅：320 / 375 / 390 / 393 / 402 / 430px 前後を優先確認
   ============================================================ */

/* 極小幅（iPhone SE等 / 320〜360px）：立ち絵をやや控えめにし、文字を確保 */
@media (max-width: 360px) {
  .vn-sprite-img { height: min(64dvh, calc(100dvh - env(safe-area-inset-top) - 52px)); }
  .vn-textbody { font-size: 0.92rem; }
  .vn-nameplate { font-size: 0.82rem; padding: 6px 18px; }
  .title-menu { width: min(280px, 84%); }
  .title-btn { font-size: 0.88rem; padding: 0.7em 1em; letter-spacing: 0.16em; }
}

/* 標準的なiPhone縦画面（375〜430px） */
@media (min-width: 361px) and (max-width: 480px) {
  .vn-textbody { font-size: 0.98rem; line-height: 1.8; }
}

@media (min-width: 900px) {
  .vn-text-layer { padding: 0 8vw; }
  .vn-textwindow { padding: 30px 44px 20px; }
  .vn-sprite-img { height: min(76dvh, calc(100dvh - env(safe-area-inset-top) - 64px)); }
}

/* iPhone横向き（landscape）：高さが乏しいため大幅に圧縮 */
@media (orientation: landscape) and (max-height: 480px) {
  .vn-textwindow { min-height: 84px; padding: 10px 22px; }
  .vn-textbody { font-size: 0.88rem; min-height: 2em; line-height: 1.6; }
  .vn-sprite-img { height: min(84dvh, calc(100dvh - env(safe-area-inset-top) - 40px)); }
  .vn-nameplate { padding: 4px 16px; margin-bottom: -8px; }

  /*
   * タイトル画面（横向き）：縦長ビジュアルをそのまま中央に置くと
   * 極端に細い帯になるため、舞台を画面いっぱいへ広げて上部を見せ、
   * メニューは右側へ寄せる（キービジュアルの人物を隠さないため）。
   */
  .title-stage {
    width: 100vw;
    height: 100dvh;
  }
  .title-kv { object-position: center 22%; }
  .title-scrim {
    top: 0;
    height: 100%;
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(4, 6, 9, 0.15) 45%,
      rgba(4, 6, 9, 0.82) 78%,
      rgba(3, 5, 8, 0.94) 100%
    );
  }
  .title-menu {
    left: auto;
    right: max(4vw, env(safe-area-inset-right));
    bottom: 50%;
    transform: translateY(50%);
    width: min(260px, 34vw);
  }
}


/* v3-2: iOS初回音声アンロック用。タイトル画面を邪魔しない小型ボタン */
.title-audio-btn {
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid rgba(220, 190, 130, 0.42);
  border-radius: 999px;
  color: rgba(247, 240, 224, 0.88);
  background: rgba(7, 14, 28, 0.56);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font: inherit;
  font-size: clamp(11px, 2.8vw, 13px);
  letter-spacing: .04em;
  cursor: pointer;
  touch-action: manipulation;
}
.title-audio-btn:focus-visible {
  outline: 2px solid rgba(225, 195, 130, 0.9);
  outline-offset: 2px;
}
.title-audio-btn.is-active,
.title-audio-btn:disabled {
  opacity: .62;
  cursor: default;
}
