/* ===== リセット & ベース ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /*
   * concafegame Color System
   * このゲームは heihei エコシステムの一部として独自の世界観カラーを使用しています。
   * heihei ブランドカラー（Black #0D0D0D / Red #E8003D）との統合が必要になった場合は、
   * --brand-primary / --brand-accent トークンを :root に追加してください。
   */

  /* ========================================================
     コンカフェ★メンタルウォーズ Design System v3.0
     世界観: キラキラ魔法少女×コンカフェ
     プリキュア・プリパラ・アイカツ のようなパステル×輝き
     ======================================================== */

  /* --- プライマリカラー（ホットピンク：魔法少女メインカラー） --- */
  --magenta:       #f0448c;   /* ビビッドピンク：メインアクセント */
  --magenta-dim:   #d42878;   /* ホバー・プレス時 */
  --magenta-glow:  rgba(240, 68, 140, 0.45);
  --magenta-muted: rgba(240, 68, 140, 0.12);

  /* --- ゴールド（シャンパン×キラキラ） --- */
  --gold:          #f5c842;   /* キラキラゴールド */
  --gold-bright:   #ffe680;   /* パールゴールド */
  --gold-dim:      #c49a20;
  --gold-glow:     rgba(245, 200, 66, 0.55);

  /* --- 背景・サーフェス（パステル空：魔法少女ワールド） --- */
  /* 明るい昼間の魔法空間 */
  --bg-void:       #f0e8ff;   /* 最も明るい：ラベンダー霞 */
  --bg-deep:       #e8d8ff;   /* メイン背景：ラベンダーパープル */
  --bg-surface:    rgba(255, 255, 255, 0.72); /* カード：ミルクホワイト */
  --bg-raised:     rgba(255, 255, 255, 0.88); /* 浮き上がり要素 */
  --bg-overlay:    rgba(240, 220, 255, 0.92);

  /* --- テキスト（暗色パネル・カード向けライト系） --- */
  --text-primary:  #f8f4ff;   /* ソフトホワイト：メイン文字（暗背景向け。明背景では下記スコープ上書きを参照） */
  --text-secondary:#d8c8f0;   /* ライトラベンダー */
  --text-muted:    rgba(210, 185, 240, 0.75); /* コントラスト改善: 0.55→0.75 */
  --text-accent:   #ff80b4;   /* ブライトピンク：強調 */

  /* --- ボーダー・ライン --- */
  --border-subtle: rgba(240, 68, 140, 0.15);
  --border-mid:    rgba(240, 68, 140, 0.35);
  --border-strong: rgba(240, 68, 140, 0.65);
  --border-gold:   rgba(245, 200, 66, 0.55);

  /* --- ムードカラー（キャラ別） --- */
  --char-masao:   #4a9fe0;    /* スカイブルー */
  --char-takashi: #38c48a;    /* ミントグリーン */
  --char-reiji:   #b04acc;    /* ディープパープル */
  --char-hope:    #c49a4a;    /* アンバーゴールド */
  --char-nene:    #e060c0;    /* アイドルピンク */
  --char-boss:    var(--gold); /* シャンパンゴールド（= --gold と同値） */

  /* --- 魔法少女拡張カラー --- */
  --lavender-soft: #c8a0f0;   /* ソフトラベンダー */
  --blush:         #ffb0cc;   /* パステルピンク */
  --sky-blue:      #a0d8ff;   /* パステルスカイ */
  --mint:          #a0f0d0;   /* パステルミント */
  --star-yellow:   #ffe066;   /* 星の輝き */
  /* --rose-gold は --blush (#ffb0cc) に統合済み */
  --moonlight:     rgba(255, 220, 255, 0.25);

  /* --- フォント（M PLUS Rounded = 丸みのあるかわいいフォント） --- */
  --font-sans: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Rounded Mplus 1c', 'Hiragino Sans', sans-serif;
  --font-serif: 'Noto Serif JP', 'Hiragino Mincho ProN', serif;
  --font-mono: 'JetBrains Mono', 'M PLUS Rounded 1c', 'Hiragino Sans', monospace;

  /* --- タッチターゲット --- */
  --touch-target: 48px;

  /* --- z-index --- */
  --z-bg:         0;
  --z-sprite:     1;
  --z-content:    2;
  --z-hud:       20;
  --z-hud-top:   30;
  --z-game-modal:50;
  --z-callout:  150;
  --z-modal:    200;
  --z-bottle:   300;
  --z-cinematic:400;
  --z-critical: 9999;

  /* --- シャドウ（パステル×ソフト） --- */
  --shadow-1: 0 2px 8px rgba(180, 100, 220, 0.12);
  --shadow-2: 0 4px 16px rgba(180, 100, 220, 0.18);
  --shadow-3: 0 8px 28px rgba(180, 100, 220, 0.22);
  --shadow-4: 0 12px 36px rgba(180, 100, 220, 0.28), 0 4px 10px rgba(240, 68, 140, 0.1);
  --shadow-5: 0 20px 52px rgba(180, 100, 220, 0.32), 0 8px 20px rgba(240, 68, 140, 0.15);
  --shadow-6: 0 32px 72px rgba(180, 100, 220, 0.38), 0 12px 28px rgba(240, 68, 140, 0.18);
  --shadow-glow: 0 0 28px var(--magenta-glow), 0 0 10px rgba(240, 68, 140, 0.25);
  --shadow-gold: 0 0 24px var(--gold-glow);

  /* --- 後方互換エイリアス（game.jsが参照する可能性のある変数） --- */
  --rose:       var(--magenta);
  --rose-light: var(--blush);
  --gold-light: var(--gold-bright);
  --lavender:   #9060c8;
  --lav-light:  var(--lavender-soft);
  --text:       var(--text-primary);
  --text-mid:   var(--text-secondary);
  --text-light: var(--text-muted);
  --shadow:     rgba(240, 68, 140, 0.25); /* --magenta-glow の低透明度版 */
  --glow:       var(--magenta-glow);
  /* 削除済み: --rose-pale / --cream / --white / --font-sans-compat / --font-serif-compat（未使用）*/
}

html {
  overscroll-behavior: none;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.8;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "palt";
  letter-spacing: 0.04em;
}

/* Serif適用（見出し系） */
.title-text, .ending-title, .gameover-title, .cinematic-quote, .confirm-name, .card-quote {
  font-family: var(--font-serif);
}

/* スクリーンリーダー専用 */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ===== 画面制御 ===== */
.screen {
  display: none;
  width: 100vw; height: 100vh; height: 100dvh;
  position: relative;
  overflow: hidden;
}
.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* タイトル画面：コンテンツが収まる場合は中央表示、はみ出す場合はスクロール */
#screen-title.active {
  overflow-y: auto;
  flex-direction: column;  /* margin-top/bottom:auto が縦方向に機能するために必須 */
  align-items: center;
  justify-content: flex-start;
  padding: 1.5rem 1rem;
}

/* タイトルコンテンツを縦方向に中央寄り（flex + auto margin） */
#screen-title.active .title-content {
  margin-top: auto;
  margin-bottom: auto;
}

/* ===== 花びら → 光の粒子アニメーション ===== */
.petals {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* キラキラ魔法少女パーティクル：星形・ハート・花 */
.petal {
  position: absolute;
  top: -16px;
  opacity: 0;
  font-size: 0.9rem;
  /* 絵文字として表示するためfont-sizeを設定 */
  color: var(--magenta);
  animation: particleFall linear infinite;
  pointer-events: none;
  filter: drop-shadow(0 0 4px currentColor);
}

/* 奇数：ハート */
.petal:nth-child(odd) {
  font-size: 0.75rem;
  color: var(--star-yellow);
  filter: drop-shadow(0 0 5px rgba(255, 224, 102, 0.8));
}

/* 3の倍数：ラベンダー星 */
.petal:nth-child(3n) {
  font-size: 0.65rem;
  color: var(--lavender-soft);
  filter: drop-shadow(0 0 4px rgba(200, 160, 240, 0.7));
}

.petal:nth-child(1)  { left:  5%; animation-duration: 9s;  animation-delay: 0s;   }
.petal:nth-child(2)  { left: 14%; animation-duration:13s;  animation-delay: 1.8s; }
.petal:nth-child(3)  { left: 25%; animation-duration: 8s;  animation-delay: 0.5s; }
.petal:nth-child(4)  { left: 38%; animation-duration:10s;  animation-delay: 3.2s; }
.petal:nth-child(5)  { left: 52%; animation-duration: 9s;  animation-delay: 1.1s; }
.petal:nth-child(6)  { left: 63%; animation-duration:11s;  animation-delay: 2.7s; }
.petal:nth-child(7)  { left: 74%; animation-duration: 8s;  animation-delay: 0.2s; }
.petal:nth-child(8)  { left: 84%; animation-duration:10s;  animation-delay: 4.5s; }
.petal:nth-child(9)  { left: 92%; animation-duration: 9s;  animation-delay: 2.3s; }
.petal:nth-child(10) { left: 44%; animation-duration:14s;  animation-delay: 6s;   }

@keyframes particleFall {
  0%   { transform: rotate(45deg) translateY(0) translateX(0); opacity: 0; }
  8%   { opacity: 0.85; }
  50%  { transform: rotate(135deg) translateY(50vh) translateX(20px); opacity: 0.5; }
  85%  { opacity: 0.25; }
  100% { transform: rotate(225deg) translateY(110vh) translateX(40px); opacity: 0; }
}

/* 後方互換: fallアニメーション名 */
@keyframes fall {
  0%   { transform: translateY(0) rotate(0deg) translateX(0); opacity: 0; }
  10%  { opacity: 0.6; }
  80%  { opacity: 0.3; }
  100% { transform: translateY(110vh) rotate(720deg) translateX(40px); opacity: 0; }
}

/* ===== タイトル・選択・確認画面の共通背景 ===== */
#screen-title, #screen-character-select, #screen-confirm {
  /* 魔法少女パステル空：水色→ラベンダー→ピンク */
  background:
    linear-gradient(
      160deg,
      #c8eeff 0%,
      #d8d0ff 30%,
      #f0d0ff 60%,
      #ffd0ea 85%,
      #ffc8f0 100%
    );
}

/* オーロラ状の輝きオーバーレイ */
#screen-title::before,
#screen-character-select::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20%  15%, rgba(255, 255, 255, 0.55) 0%, transparent 55%),
    radial-gradient(ellipse 50% 60% at 80%  80%, rgba(255, 200, 255, 0.40) 0%, transparent 55%),
    radial-gradient(ellipse 40% 40% at 65%  20%, rgba(160, 220, 255, 0.35) 0%, transparent 50%),
    radial-gradient(ellipse 70% 30% at 35% 100%, rgba(255, 180, 220, 0.30) 0%, transparent 60%);
  pointer-events: none;
}

/* キラキラドットテクスチャ */
#screen-title::after,
#screen-character-select::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.7) 1px, transparent 1px),
    radial-gradient(rgba(255, 200, 240, 0.5) 1px, transparent 1px);
  background-size: 28px 28px, 18px 18px;
  background-position: 0 0, 9px 9px;
  pointer-events: none;
}

/* ===== deco-circle を淡い光輪として復活 ===== */
.title-bg {
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.deco-circle {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  pointer-events: none;
  animation: circleRotate linear infinite;
}

.deco-circle.c1 {
  width: 520px; height: 520px;
  top: -200px; left: 50%; transform: translateX(-50%);
  border-color: rgba(255, 200, 240, 0.30);
  border-style: dashed;
  animation-duration: 40s;
}

.deco-circle.c2 {
  width: 330px; height: 330px;
  top: -70px; left: 50%; transform: translateX(-50%);
  border-color: rgba(200, 170, 255, 0.35);
  animation-duration: 28s;
  animation-direction: reverse;
}

.deco-circle.c3 {
  width: 180px; height: 180px;
  top: 5px; left: 50%; transform: translateX(-50%);
  border-color: rgba(255, 230, 100, 0.45);
  animation-duration: 18s;
}

@keyframes circleRotate {
  from { transform: translateX(-50%) rotate(0deg); }
  to   { transform: translateX(-50%) rotate(360deg); }
}

/* ===== タイトル画面 ===== */
.title-content {
  text-align: center;
  z-index: 2;
  animation: fadeUp 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 1.5rem 1.5rem 2rem;
  width: min(480px, calc(100vw - 1rem));
  /* パステル背景に馴染む明るいフロストガラスパネル */
  background: linear-gradient(
    160deg,
    rgba(255, 245, 255, 0.72) 0%,
    rgba(240, 228, 255, 0.68) 100%
  );
  border: 1px solid rgba(212, 98, 168, 0.30);
  border-radius: 24px;
  backdrop-filter: blur(18px);
  box-shadow:
    0 8px 32px rgba(180, 100, 160, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.70),
    0 0 60px rgba(220, 140, 200, 0.10);
  position: relative;
}

/* タイトルパネル上部の装飾ライン */
.title-content::before {
  content: '';
  position: absolute;
  top: 0; left: 32px; right: 32px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 98, 158, 0.35) 50%, transparent);
}

/* タイトルパネルの4隅コーナー装飾 */
.title-content::after {
  content: '✦  ✦';
  position: absolute;
  bottom: 10px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.5rem;
  color: rgba(232, 120, 170, 0.3);
  letter-spacing: 1.2em;
  white-space: nowrap;
}

/* タイトル画面：メインCTAボタンの下余白（Ko-fiリンクとの間隔） */
.title-content > .btn-primary {
  display: block;
  width: fit-content;
  margin: 0 auto 0.8rem;
}

.title-logo-img-wrap {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

.title-logo-img {
  max-width: min(85vw, 380px);
  height: auto;
  filter:
    drop-shadow(0 0 32px rgba(212, 98, 138, 0.55))
    drop-shadow(0 0 8px rgba(212, 98, 138, 0.35));
  animation: titleGlow 4s ease-in-out infinite;
}

@keyframes titleGlow {
  0%, 100% {
    filter:
      drop-shadow(0 0 24px rgba(212, 98, 138, 0.45))
      drop-shadow(0 0 6px rgba(200, 180, 232, 0.25));
  }
  50% {
    filter:
      drop-shadow(0 0 44px rgba(212, 98, 138, 0.75))
      drop-shadow(0 0 18px rgba(212, 184, 150, 0.38));
  }
}

/* フォールバック時のタイトルテキスト */
.title-logo {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
  animation: titleGlow 4s ease-in-out infinite;
}

.title-text {
  font-size: clamp(1.5rem, 5vw, 2.2rem);
  font-weight: 700;
  /* 明るいパネル上では濃いピンク〜マゼンタで視認性を確保 */
  color: #b03070;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-shadow: 0 0 24px rgba(212, 98, 168, 0.35);
  margin-bottom: 0.4rem;
}

.title-sub {
  font-size: 0.82rem;
  /* 明るいパネル上でも視認できるゴールドに調整 */
  color: #a07820;
  letter-spacing: 0.25em;
  display: block;
  margin-bottom: 1.8rem;
  text-transform: uppercase;
  font-family: var(--font-sans);
  opacity: 0.9;
}

.title-desc {
  font-size: 0.85rem;
  /* 明るいパネル上では深みのあるラベンダーで */
  color: #7050a0;
  line-height: 1.8;
  margin-bottom: 1.2rem;
  letter-spacing: 0.04em;
}

/* コンテンツ警告（視覚的格下げ：枠なし、上線のみ） */
.content-warning {
  font-size: 0.64rem;
  /* 明るいパネル上では暗いラベンダーで読みやすく */
  color: rgba(100, 70, 140, 0.75);
  line-height: 1.6;
  margin-top: 0.6rem;
  margin-bottom: 1.2rem;
  padding: 0.5rem 0.5rem;
  border: none;
  border-top: 1px solid rgba(180, 100, 160, 0.15);
  border-radius: 0;
  background: transparent;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

/* 源氏名入力 */
.name-input-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

/* プレイコード入力（2つ目の入力欄）は下余白を詰める */
.name-input-wrap + .name-input-wrap {
  margin-bottom: 0.4rem;
}

.name-label {
  font-size: 0.7rem;
  /* 明るいパネル上でも読めるゴールドブラウン */
  color: #a07820;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: var(--font-sans);
}

.name-input {
  /* 明るいパネル上での入力欄：白ベースの半透明に */
  background: rgba(255, 255, 255, 0.55);
  border: none;
  border-bottom: 1.5px solid rgba(180, 80, 140, 0.45);
  border-radius: 0;
  padding: 10px 24px;
  min-height: 44px; /* タッチターゲット最低サイズ確保 */
  font-size: 1rem;
  /* 入力テキストは濃いラベンダー系で視認性を確保 */
  color: #6030a0;
  text-align: center;
  width: min(240px, 80vw);
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  letter-spacing: 0.15em;
}

.name-input:focus {
  outline: none;
  border-bottom-color: var(--magenta);
  box-shadow: 0 2px 0 0 var(--magenta);
}

.name-input::placeholder {
  color: rgba(160, 100, 180, 0.6);
  letter-spacing: 0;
}

/* ===== ボタン ===== */
.btn-primary {
  display: inline-block;
  /* 乙女ゲーム風グラデーションボタン（ローズピンク） */
  background: linear-gradient(135deg, #e07898 0%, #d4628a 45%, #b04878 80%, #8c3060 100%);
  color: #fff;
  border: none;
  padding: 0 52px;
  height: 48px;
  min-height: 48px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  border-radius: 24px;
  cursor: pointer;
  box-shadow:
    0 4px 20px var(--magenta-glow),
    0 2px 0 rgba(255,255,255,0.18) inset,
    0 -1px 0 rgba(0,0,0,0.2) inset;
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.18s;
  font-family: var(--font-serif);
  position: relative;
  overflow: hidden;
}

/* パールシマー効果 */
.btn-primary::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
  transition: left 0.5s ease;
}
.btn-primary:hover::before {
  left: 160%;
}

/* 下部ハイライトライン */
.btn-primary::after {
  content: '';
  position: absolute;
  bottom: 4px; left: 20%; right: 20%;
  height: 1px;
  background: rgba(255,255,255,0.3);
  border-radius: 1px;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    0 8px 32px var(--magenta-glow),
    0 0 20px rgba(232, 41, 106, 0.3),
    0 2px 8px rgba(0,0,0,0.4),
    0 2px 0 rgba(255,255,255,0.18) inset;
  outline: 2px solid rgba(232, 41, 106, 0.4);
  outline-offset: 3px;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 12px var(--magenta-glow), 0 1px 0 rgba(255,255,255,0.15) inset;
}

.retry-btn {
  display: block;
  margin: 8px auto 0;
  padding: 6px 18px;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(200, 120, 170, 0.2);
  border-radius: 14px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s;
}
.retry-btn:hover {
  background: rgba(232, 41, 106, 0.08);
  border-color: rgba(200, 120, 170, 0.38);
}

.btn-secondary {
  display: inline-block;
  background: transparent;
  /* --text-secondary は明るい背景上でコントラスト不足のため --lavender に変更 */
  color: var(--lavender);
  border: 1px solid var(--border-mid);
  padding: 0 28px;
  height: var(--touch-target);
  min-height: var(--touch-target);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  letter-spacing: 0.08em;
}

.btn-secondary:hover {
  border-color: var(--magenta);
  color: var(--text-accent);
  box-shadow: 0 0 12px rgba(232, 41, 106, 0.15);
  transform: translateY(-1px);
}
.btn-secondary:active { transform: translateY(0); }

/* ===== キャラ選択画面 ===== */
#screen-character-select {
  flex-direction: column;
  overflow-y: auto;
  padding: 2rem 1.2rem;
  justify-content: flex-start;
  align-items: center;
}

.select-wrap {
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1080px;
}

#screen-character-select.active .select-wrap {
  animation: fadeUp 0.4s ease;
}

.select-header {
  text-align: center;
  margin-bottom: 2.8rem;
  position: relative;
  padding: 1.6rem 2.4rem 1.4rem;
}

/* CHARACTER SELECT ラベル */
.select-header::before {
  content: '◈  C H A R A C T E R  S E L E C T  ◈';
  display: block;
  font-size: 0.52rem;
  letter-spacing: 0.32em;
  color: var(--gold-dim);
  margin-bottom: 0.9rem;
  font-family: var(--font-sans);
  opacity: 0.8;
}

/* ヘッダー下のグロウライン */
.select-header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 240px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-gold) 50%, transparent);
}

.select-header h2 {
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  /* 明るいパステル背景向けにダークパープルで可読性確保 */
  color: #2a0848;
  font-weight: 700; /* 400 → 700：見出しとしての視覚的重みを確保 */
  letter-spacing: 0.22em;
  font-family: var(--font-serif);
  position: relative;
  display: inline-block;
  padding: 0.5rem 2.5rem;
  border-top: 1px solid rgba(180, 140, 80, 0.4);
  border-bottom: 1px solid rgba(180, 140, 80, 0.4);
  text-shadow: 0 1px 4px rgba(255, 220, 240, 0.5);
}

/* 横ライン装飾（菱形端付き） */
.select-header h2::before,
.select-header h2::after {
  content: '◇';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.5rem;
  color: rgba(200, 169, 106, 0.5);
  line-height: 1;
}
.select-header h2::before { left: 4px; }
.select-header h2::after  { right: 4px; }

.select-sub {
  font-size: 0.72rem;
  /* 明るいパステル背景向け：コントラスト強化 */
  color: rgba(80, 30, 120, 0.8);
  margin-top: 0.7rem;
  letter-spacing: 0.15em;
}

/* ===== キャラカード ===== */
.character-cards {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.character-card {
  /* カード全体を暗くすることでテキスト可読性を統一 */
  background: linear-gradient(160deg, rgba(28, 14, 52, 0.92) 0%, rgba(18, 8, 36, 0.97) 100%);
  /* 乙女ゲーム風：柔らかいピンクがかった全周ボーダー */
  border: 1px solid rgba(232, 120, 170, 0.28);
  border-radius: 16px;
  padding: 0;
  width: 210px;
  min-height: 330px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition:
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.25s,
    box-shadow 0.25s;
  text-align: center;
  position: relative;
  box-shadow:
    var(--shadow-3),
    inset 0 1px 0 rgba(255,200,230,0.08);
  overflow: visible;
  animation: cardSlideIn 0.5s ease-out both;
}

/* 角飾り（乙女ゲーム風コーナーオーナメント） */
.character-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 16px;
  background: transparent;
  border: 1px solid rgba(232, 120, 170, 0.28);
  pointer-events: none;
  z-index: 0;
}

/* カード上部グラデーションライン */
.character-card::after {
  content: '';
  position: absolute;
  top: 0; left: 16px; right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,160,200,0.5) 50%, transparent);
  border-radius: 0 0 2px 2px;
  pointer-events: none;
}

.character-card:nth-child(1) { animation-delay: 0.05s; }
.character-card:nth-child(2) { animation-delay: 0.12s; }
.character-card:nth-child(3) { animation-delay: 0.19s; }
.character-card:nth-child(4) { animation-delay: 0.26s; }
.character-card:nth-child(5) { animation-delay: 0.33s; }

/* カードのコンテンツ部分（パディング） */
.character-card .card-avatar,
.character-card .card-name,
.character-card .card-type,
.character-card .card-quote,
.character-card .card-footer {
  margin-left: 1.2rem;
  margin-right: 1.2rem;
}

/* フッターをカード下端に固定（flex layout） */
.character-card .card-footer {
  margin-top: auto;
}

.character-card:hover {
  border-color: rgba(232, 100, 160, 0.6);
  transform: translateY(-6px);
  box-shadow:
    var(--shadow-4),
    0 0 30px rgba(232, 41, 106, 0.2),
    0 0 60px rgba(232, 41, 106, 0.08),
    inset 0 1px 0 rgba(255,200,230,0.15);
}

.character-card:hover::after {
  background: linear-gradient(90deg, transparent, rgba(255,160,200,0.7) 50%, transparent);
}

.character-card:active { transform: translateY(-2px); }

/* マサオ */
.character-card[data-char="masao"]::after {
  background: linear-gradient(90deg, transparent, rgba(91,155,232,0.35) 50%, transparent);
}
.character-card[data-char="masao"]:hover {
  border-color: rgba(91, 155, 232, 0.5);
  box-shadow: var(--shadow-4), 0 0 24px rgba(91, 155, 232, 0.2), inset 0 1px 0 rgba(150,200,255,0.1);
}
.character-card[data-char="masao"]:hover::after {
  background: linear-gradient(90deg, transparent, rgba(91,155,232,0.65) 50%, transparent);
}

/* タカシ */
.character-card[data-char="takashi"]::after {
  background: linear-gradient(90deg, transparent, rgba(76,175,128,0.35) 50%, transparent);
}
.character-card[data-char="takashi"]:hover {
  border-color: rgba(76, 175, 128, 0.5);
  box-shadow: var(--shadow-4), 0 0 24px rgba(76, 175, 128, 0.2), inset 0 1px 0 rgba(100,200,150,0.1);
}
.character-card[data-char="takashi"]:hover::after {
  background: linear-gradient(90deg, transparent, rgba(76,175,128,0.65) 50%, transparent);
}

/* レイジ */
.character-card[data-char="reiji"]::after {
  background: linear-gradient(90deg, transparent, rgba(196,96,160,0.4) 50%, transparent);
}
.character-card[data-char="reiji"]:hover {
  border-color: rgba(196, 96, 160, 0.5);
  box-shadow: var(--shadow-4), 0 0 24px rgba(196, 96, 160, 0.25), inset 0 1px 0 rgba(200,120,180,0.1);
}
.character-card[data-char="reiji"]:hover::after {
  background: linear-gradient(90deg, transparent, rgba(196,96,160,0.7) 50%, transparent);
}

/* 攻略バッジ */
.clear-badge {
  position: absolute;
  top: 3px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 12px;
  letter-spacing: 0.12em;
  z-index: 2;
  white-space: nowrap;
}

.badge-uncleared {
  background: transparent;
  /* 暗背景上で読めるよう opacity を上げる */
  color: rgba(210, 185, 240, 0.55);
  opacity: 1;
}

.badge-cleared {
  background: var(--gold);
  color: var(--bg-void);
  box-shadow: 0 0 12px var(--gold-glow);
  letter-spacing: 0.15em;
}

/* リボン（難易度） */
.card-ribbon {
  position: absolute;
  top: 8px; right: 10px;
  background: rgba(30, 18, 50, 0.9);
  color: var(--gold);
  border: 1px solid rgba(200, 169, 106, 0.35);
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 10px;
  letter-spacing: 0.12em;
  font-family: var(--font-serif);
  backdrop-filter: blur(4px);
}

.card-ribbon.hard { color: #88d8a0; border-color: rgba(76, 175, 128, 0.4); }
.card-ribbon.hell { color: var(--text-accent); border-color: var(--border-mid); }
.card-ribbon.new  { color: #b090e8; border-color: rgba(176, 144, 232, 0.4); }
.card-ribbon.boss { color: var(--gold-bright); border-color: var(--border-gold); background: rgba(200, 169, 106, 0.12); }

/* コウタロウ */
.character-card[data-char="kotaro"]::after {
  background: linear-gradient(90deg, transparent, rgba(120,120,220,0.38) 50%, transparent);
}
.character-card[data-char="kotaro"]:hover {
  border-color: rgba(120,120,220,0.5);
  box-shadow: var(--shadow-4), 0 0 24px rgba(120,120,220,0.2), inset 0 1px 0 rgba(160,160,255,0.1);
}
.character-card[data-char="kotaro"]:hover::after {
  background: linear-gradient(90deg, transparent, rgba(120,120,220,0.65) 50%, transparent);
}

/* めるたそ */
.character-card[data-char="merutaso"]::after {
  background: linear-gradient(90deg, transparent, rgba(180,140,240,0.38) 50%, transparent);
}
.character-card[data-char="merutaso"]:hover {
  border-color: rgba(180,140,240,0.5);
  box-shadow: var(--shadow-4), 0 0 24px rgba(180,140,240,0.2), inset 0 1px 0 rgba(200,160,255,0.1);
}
.character-card[data-char="merutaso"]:hover::after {
  background: linear-gradient(90deg, transparent, rgba(180,140,240,0.65) 50%, transparent);
}

/* ボスカード */
.boss-card {
  border: 1px solid rgba(200, 169, 106, 0.42) !important;
  box-shadow: 0 8px 32px rgba(200, 169, 106, 0.12), inset 0 1px 0 rgba(255,230,160,0.08) !important;
}
.boss-card:hover {
  border-color: rgba(200, 169, 106, 0.65) !important;
  box-shadow: var(--shadow-4), 0 0 40px rgba(200, 169, 106, 0.25), inset 0 1px 0 rgba(255,230,160,0.12) !important;
}
.boss-card:hover::after {
  background: linear-gradient(90deg, transparent, rgba(200, 169, 106, 0.6) 50%, transparent) !important;
}
.boss-bg { background: linear-gradient(160deg, rgba(200, 169, 106, 0.2), rgba(180, 140, 60, 0.1)) !important; }

@keyframes bossUnlock {
  0%   { opacity: 0; transform: scale(0.85); }
  60%  { transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}
.boss-unlocked-anim { animation: bossUnlock 0.7s ease; }

/* アバター */
.card-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  margin: 1.4rem auto 1rem;
  /* 暗い背景に対して繊細なリングを見せる */
  border: 2px solid rgba(232, 120, 170, 0.22);
  box-shadow: 0 4px 20px rgba(0,0,0,0.55), 0 0 12px rgba(180, 80, 140, 0.08);
  transition: transform 0.25s, box-shadow 0.25s;
}

.character-card:hover .card-avatar {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0,0,0,0.6), 0 0 20px rgba(232, 100, 160, 0.2);
}

.masao-bg    { background: linear-gradient(160deg, color-mix(in srgb, var(--char-masao) 30%, #0a0818), color-mix(in srgb, var(--char-masao) 20%, #0a0818)); }
.takashi-bg  { background: linear-gradient(160deg, color-mix(in srgb, var(--char-takashi) 30%, #0a0818), color-mix(in srgb, var(--char-takashi) 20%, #0a0818)); }
.reiji-bg    { background: linear-gradient(160deg, color-mix(in srgb, var(--char-reiji) 30%, #0a0818), color-mix(in srgb, var(--char-reiji) 20%, #0a0818)); }
.merutaso-bg { background: linear-gradient(160deg, #1a0a28, #280d38); border-color: rgba(180,140,240,0.3); }
.kotaro-bg   { background: linear-gradient(160deg, #1a1a2e, #2d2050); border-color: rgba(120,120,220,0.3); }
.hope-bg     { background: linear-gradient(160deg, color-mix(in srgb, var(--char-hope) 30%, #0a0818), color-mix(in srgb, var(--char-hope) 20%, #0a0818)); border-color: rgba(196,154,74,0.3); }
.nene-bg     { background: linear-gradient(160deg, color-mix(in srgb, var(--char-nene) 25%, #1a0818), color-mix(in srgb, var(--char-nene) 15%, #0a0818)); border-color: rgba(224,96,192,0.3); }
.boss-bg     { background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 20%, #0a0818), color-mix(in srgb, var(--gold) 12%, #0a0818)); border-color: rgba(212,184,150,0.4); }

/* アイコン画像スタイル（カード・確認画面共通） */
.card-avatar img,
.confirm-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  border-radius: 50%;
  display: block;
}

/* カード名前 */
.card-name {
  font-size: 1.1rem;
  font-weight: 700;
  /* 暗背景上で確実に読めるよう明度を上げる */
  color: #f0e8ff;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.card-age {
  font-size: 0.8rem;
  /* 十分なコントラスト確保 */
  color: rgba(210, 185, 240, 0.85);
  font-weight: 400;
  letter-spacing: 0;
}

.card-type {
  font-size: 0.8rem;
  color: var(--text-accent);
  margin: 0.2rem 0 0.8rem;
  letter-spacing: 0.1em;
  font-family: var(--font-sans);
}

.card-quote {
  font-size: 0.75rem;
  /* 暗背景に対して十分なコントラストを確保（WCAG AA相当） */
  color: rgba(225, 205, 248, 0.92);
  font-style: italic;
  line-height: 1.75;
  margin-bottom: 1rem;
  /* 乙女ゲーム風：上下の細いラインで囲む引用スタイル */
  border-top: 1px solid rgba(200, 120, 170, 0.22);
  border-bottom: 1px solid rgba(200, 120, 170, 0.22);
  padding: 0.5rem 0.7rem;
  text-align: center;
  position: relative;
}

/* 引用符の代わりに小さい菱形装飾 */
.card-quote::before,
.card-quote::after {
  content: '◆';
  font-size: 0.45rem;
  color: rgba(232, 120, 170, 0.45);
  font-style: normal;
  display: block;
  text-align: center;
  line-height: 0.5;
  letter-spacing: 0;
}
.card-quote::before { margin-bottom: 0.3rem; }
.card-quote::after  { margin-top: 0.3rem; }

.card-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.2rem;
  /* 暗背景に合わせてボーダーを明示的に */
  border-top: 1px solid rgba(232, 120, 170, 0.15);
  margin: 0 0 0;
}

.tag-money {
  font-size: 0.72rem;
  background: rgba(200, 169, 106, 0.08);
  border: 1px solid var(--border-gold);
  border-radius: 2px;
  padding: 1px 8px;
  color: var(--gold);
  letter-spacing: 0.05em;
}

.tag-warn {
  font-size: 0.65rem;
  /* 暗背景で読みやすいよう明度を上げる */
  color: rgba(210, 185, 240, 0.85);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(232, 120, 170, 0.18);
  border-radius: 2px;
  padding: 1px 7px;
}

/* ===== 明背景コンテキスト用テキスト上書き ===== */
/* タイトル・キャラ選択・確認はパステル明背景なので濃い紫系に上書き */
#screen-title,
#screen-character-select,
.confirm-card {
  --text-primary:   #5a2080;
  --text-secondary: #7040a0;
  --text-muted:     rgba(90, 32, 128, 0.6);
}

/* エンディングカードは下半分が暗い背景になるため、明るめの色を維持する */
/* --text-primary / --text-secondary はルートの明るい値（#f8f4ff / #d8c8f0）をそのまま使用 */

/* ===== 確認画面 ===== */
#screen-confirm {
  background: var(--bg-void);
}
#screen-confirm, #screen-ending, #screen-gameover {
  overflow-y: auto;
  align-items: flex-start;
}

.confirm-wrap {
  padding: 2rem;
  z-index: 2;
  width: 100%;
  display: flex;
  justify-content: center;
}

.confirm-card {
  background: linear-gradient(160deg, rgba(255,245,255,0.92) 0%, rgba(240,225,255,0.88) 100%);
  /* 乙女ゲーム風：ロマンティックな全周ボーダー */
  border: 1px solid rgba(232, 100, 160, 0.35);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 420px;
  width: 100%;
  box-shadow:
    var(--shadow-5),
    0 0 40px rgba(232, 41, 106, 0.08),
    inset 0 1px 0 rgba(255,200,230,0.1);
  animation: scaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

/* 上部グラデーションライン */
.confirm-card::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 120, 180, 0.7) 50%, transparent);
}

/* 4隅コーナーオーナメント（CSS疑似要素で上下） */
.confirm-card::after {
  content: '✦';
  position: absolute;
  bottom: 12px; right: 16px;
  font-size: 0.7rem;
  color: rgba(232, 120, 170, 0.25);
  pointer-events: none;
  line-height: 1;
}

.confirm-avatar {
  font-size: 3.5rem;
  width: 88px; height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.2rem;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

.confirm-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: #b03070;
  letter-spacing: 0.1em;
}

.confirm-type {
  font-size: 0.78rem;
  color: #c040a0;
  letter-spacing: 0.15em;
  margin: 0.4rem 0 1.2rem;
  font-family: var(--font-sans);
}

.confirm-detail {
  background: rgba(255,240,250,0.6);
  border: 1px solid rgba(232, 120, 170, 0.3);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  font-size: 0.82rem;
  color: #6030a0;
  line-height: 2;
  text-align: left;
  margin-bottom: 1.6rem;
  white-space: pre-line;
}

.confirm-buttons {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== VNスタイル ゲーム画面 ===== */
#screen-game { display: none; align-items: stretch; }
#screen-game.active { display: flex; }

.vn-layout {
  width: 100%; height: 100vh; height: 100dvh;
  position: relative;
  overflow: hidden;
}

/* 全画面背景 */
.vn-bg {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #0a0614 0%, #110818 35%, #160c20 70%, #0a0614 100%);
  z-index: 0;
}

.vn-bg::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 15% 100%, rgba(232, 41, 106, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 50% 70% at 85%  10%, rgba(120, 60, 180, 0.06) 0%, transparent 55%);
  pointer-events: none;
}

/* キャラスプライト */
.vn-sprite-area {
  position: absolute;
  top: 0; left: 0; right: 0;
  bottom: 30%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
}

.vn-sprite {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 10rem;
  filter: drop-shadow(0 12px 40px rgba(0,0,0,0.6));
  animation: floatAnim 3s ease-in-out infinite;
  transition: all 0.4s ease;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.vn-sprite-inner {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  max-height: 100%;
}

.vn-sprite-inner img {
  max-width: 100%;
  max-height: 65vh;
  width: auto; height: auto;
  object-fit: contain;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 上部オーバーレイUI */
.vn-overlay-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem 0.4rem;
  padding-top: max(0.5rem, calc(0.5rem + env(safe-area-inset-top, 0px)));
  padding-right: max(0.6rem, calc(0.6rem + env(safe-area-inset-right, 0px)));
  background: linear-gradient(180deg, rgba(8,5,16,0.7) 0%, transparent 100%);
  z-index: 20;
}

/* メニューボタン */
.vn-btn-menu {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(200, 120, 170, 0.2);
  border-radius: 10px;
  padding: 6px 10px;
  min-height: var(--touch-target);
  min-width: var(--touch-target);
  font-size: 0.95rem;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
}

.vn-btn-menu:hover {
  background: rgba(232, 41, 106, 0.1);
  color: rgba(255,255,255,0.95);
  border-color: rgba(200, 120, 170, 0.4);
}

/* 時間表示 */
.vn-time {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.1em;
  white-space: nowrap;
  margin-left: auto;
  font-family: var(--font-mono);
}

.vn-time.time-danger {
  color: #ff4060;
  font-weight: 700;
  animation: pulse 1s infinite;
}

/* ゲージ */
.vn-gauges {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-basis: 100%;
  justify-content: flex-end;
  order: 10;
  padding-bottom: 0.2rem;
}

.vn-gauge-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.vn-gauge-label {
  /* fluid: モバイル0.7rem → PC0.84rem（上限を引き上げ視認性向上） */
  font-size: clamp(0.7rem, 1.8vw, 0.84rem);
  color: rgba(255,200,220,0.9); /* 不透明度を0.85→0.9に改善 */
  white-space: nowrap;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.vn-gauge-bar {
  width: 70px; height: 6px;
  background: rgba(255,255,255,0.12);
  border-radius: 3px;
  overflow: hidden;
}

.vn-gauge-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.vn-gauge-fill::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: gaugeShimmer 2.5s ease-in-out infinite;
}

@keyframes gaugeShimmer {
  0%   { left: -40%; }
  100% { left: 140%; }
}

.aff-fill {
  background: linear-gradient(90deg, #c82050, var(--magenta));
  box-shadow: 0 0 8px rgba(232, 41, 106, 0.7);
}

.mp-fill {
  background: linear-gradient(90deg, #2060b0, #4090e0);
  box-shadow: 0 0 8px rgba(64, 144, 224, 0.6);
}

.vn-gauge-num {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.9);
  min-width: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
}

/* シチュエーションタグ */
.vn-situation {
  position: absolute;
  top: 52px; left: 50%;
  transform: translateX(-50%);
  font-size: 0.68rem;
  color: rgba(255,220,240,0.8);
  background: rgba(8, 4, 18, 0.72);
  border: 1px solid rgba(232, 100, 160, 0.25);
  border-radius: 10px;
  padding: 3px 18px;
  letter-spacing: 0.12em;
  backdrop-filter: blur(8px);
  z-index: 10;
  white-space: nowrap;
  font-family: var(--font-serif);
  box-shadow: inset 0 1px 0 rgba(255,200,230,0.06);
}

/* テキストボックス */
.vn-textbox-area {
  position: absolute;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 0; right: 0;
  padding: 0 0.8rem;
  z-index: 23;
}

.vn-name-tag {
  display: inline-block;
  /* 乙女ゲーム風名前タグ：グラデーション＋丸みのある上タブ */
  background: linear-gradient(135deg, #f06090 0%, var(--magenta) 60%, #c0186a 100%);
  color: white;
  font-size: clamp(0.7rem, 0.55rem + 0.4vw, 0.88rem); /* fluid: 0.7→0.88rem */
  font-weight: 700;
  font-family: var(--font-serif);
  padding: 4px 20px;
  border-radius: 8px 8px 0 0;
  letter-spacing: 0.12em;
  margin-left: 12px;
  position: relative;
  box-shadow: 0 -2px 8px rgba(232, 41, 106, 0.3), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* 名前タグの三角形 */
.vn-name-tag::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 18px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--magenta);
}

.vn-textbox {
  /* ADVゲーム風テキストボックス：フロストガラス＋装飾ボーダー */
  background: rgba(6, 3, 16, 0.88);
  border: 1px solid rgba(232, 100, 160, 0.35);
  border-top: 1px solid rgba(232, 100, 160, 0.5);
  border-radius: 0 12px 12px 12px;
  padding: 1rem 1.6rem;
  min-height: 80px;
  /* PCでは高さを広げてテキストが窮屈にならないようにする */
  max-height: clamp(120px, 15vh, 200px);
  overflow-y: auto;
  backdrop-filter: blur(24px);
  box-shadow:
    0 -8px 40px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,200,230,0.08),
    inset 0 0 32px rgba(232, 41, 106, 0.03);
  position: relative;
}

/* ADVテキストボックス：左右コーナーオーナメント */
.vn-textbox::before,
.vn-textbox::after {
  content: '◇';
  position: absolute;
  bottom: 6px;
  font-size: 0.55rem;
  color: rgba(232, 120, 170, 0.3);
  line-height: 1;
  pointer-events: none;
}
.vn-textbox::before { left:  8px; }
.vn-textbox::after  { right: 8px; }

/* セリフシェアボタン */
.btn-share-quote {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.2s;
  padding: 2px 4px;
  line-height: 1;
  z-index: 2;
}
.btn-share-quote:hover { opacity: 0.9; }
.btn-share-quote.has-text { opacity: 0.55; }

.vn-text {
  /* fluid typography: モバイル0.92rem → PC1.15rem */
  font-size: clamp(0.92rem, 0.7rem + 0.6vw, 1.15rem);
  color: var(--text-primary);
  line-height: 1.9;
  min-height: 2.5em;
  letter-spacing: 0.06em;
}

/* アイテムバー */
.vn-item-bar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0.3rem;
  max-width: calc(100vw - 1rem);
  overflow-x: auto;
  z-index: 18;
  margin-bottom: calc(0.6rem + 80px + 24px + env(safe-area-inset-bottom, 0px));
  background: rgba(8, 5, 16, 0.72);
  border: 1px solid rgba(200, 120, 170, 0.18);
  border-radius: 12px;
  padding: 0.3rem 0.5rem;
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255,200,230,0.06);
}

/* 選択肢エリア */
.vn-choice-container {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  /* PCでも選択肢テキストが読みやすい幅に広げる */
  max-width: clamp(400px, 50vw, 640px);
  max-height: 80vh;
  overflow-y: auto;
  z-index: 25;
  animation: fadeUp 0.25s ease;
}
.vn-choice-container.hidden { display: none; }

.vn-choice-narration {
  font-size: 0.78rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.vn-choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.vn-choice-list .choice-btn {
  /* 乙女ゲーム風選択肢ボタン：全周ボーダー＋フロストガラス */
  background: rgba(10, 6, 22, 0.88);
  border: 1px solid rgba(232, 100, 160, 0.28);
  color: var(--text-primary);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255,200,230,0.06);
  font-size: clamp(0.92rem, 0.7rem + 0.6vw, 1.1rem); /* fluid: 0.92→1.1rem */
  font-family: var(--font-serif);
  padding: 0.7rem 1.4rem;
  min-height: 44px;
  text-align: center;
  border-radius: 24px;
  transition: all 0.18s;
  position: relative;
  overflow: hidden;
}

/* 左側の小さいダイヤ装飾 */
.vn-choice-list .choice-btn::before {
  content: '◆';
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-size: 0.4rem;
  color: rgba(232, 120, 170, 0.4);
  line-height: 1;
}

.vn-choice-list .choice-btn:hover {
  background: rgba(232, 41, 106, 0.12);
  border-color: rgba(232, 100, 160, 0.55);
  transform: translateY(-1px);
  color: var(--text-accent);
  box-shadow: var(--shadow-3), 0 0 16px rgba(232, 41, 106, 0.12), inset 0 1px 0 rgba(255,200,230,0.1);
}

/* 入力エリア */
.vn-input-area {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  padding-bottom: max(0.4rem, calc(0.4rem + env(safe-area-inset-bottom, 0px)));
  background: rgba(8, 5, 16, 0.95);
  border-top: 1px solid var(--border-subtle);
  z-index: 22;
}

.vn-textarea {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(200, 120, 170, 0.22);
  border-radius: 12px;
  padding: 0.6rem 1rem;
  /* fluid: モバイル1rem → PC1.05rem（入力欄はやや控えめに拡大） */
  font-size: clamp(1rem, 0.9rem + 0.3vw, 1.05rem);
  color: var(--text-primary);
  resize: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  line-height: 1.5;
}

.vn-textarea::placeholder { color: var(--text-muted); }
.vn-textarea:disabled { opacity: 0.3; cursor: not-allowed; }

.vn-textarea:focus {
  outline: none;
  border-color: rgba(232, 41, 106, 0.5);
  box-shadow: 0 0 0 2px rgba(232, 41, 106, 0.08);
}

.vn-btn-send {
  background: linear-gradient(135deg, #f06090 0%, var(--magenta) 60%, #c0186a 100%);
  color: white;
  border: none;
  padding: 0 1rem;
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  transition: all 0.18s;
  text-align: center;
  min-width: 54px;
  min-height: 44px;
  font-family: var(--font-serif);
  box-shadow: 0 4px 16px var(--magenta-glow), inset 0 1px 0 rgba(255,255,255,0.15);
  line-height: 1.4;
}

.vn-btn-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--magenta-glow);
}

.vn-btn-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  animation: sendingPulse 1s ease-in-out infinite;
}

.vn-btn-mic {
  background: linear-gradient(135deg, #7b61ff 0%, #5b3fd4 100%);
  color: white;
  border: none;
  padding: 0 0.8rem;
  border-radius: 14px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.18s;
  min-width: 48px;
  min-height: 44px;
  box-shadow: 0 4px 16px rgba(123, 97, 255, 0.35);
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
}

.vn-btn-mic:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(123, 97, 255, 0.5);
}

.vn-btn-mic:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.vn-btn-mic.recording {
  background: linear-gradient(135deg, #ff4466 0%, #cc1144 100%);
  box-shadow: 0 4px 16px rgba(255, 68, 102, 0.5);
  animation: micPulse 0.8s ease-in-out infinite;
}

.vn-btn-mic.toggle-recording {
  background: linear-gradient(135deg, #ff7700 0%, #cc4400 100%);
  box-shadow: 0 4px 16px rgba(255, 119, 0, 0.5);
  animation: micPulse 1.2s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(255, 68, 102, 0.5); }
  50%       { box-shadow: 0 4px 28px rgba(255, 68, 102, 0.9); }
}

@keyframes sendingPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.65; }
}

/* ===== エンディング ===== */
#screen-ending {
  background: var(--bg-void);
}
#screen-ending::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(232, 41, 106, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 50% 100%, rgba(200, 169, 106, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

.ending-wrap {
  z-index: 2;
  padding: 2rem;
  width: 100%;
  display: flex;
  justify-content: center;
}

.ending-card {
  background: linear-gradient(160deg, var(--bg-surface) 0%, rgba(20, 12, 36, 0.98) 100%);
  /* 乙女ゲーム風エンディングカード：ゴールドの装飾ボーダー */
  border: 1px solid rgba(200, 160, 100, 0.35);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
  color: var(--text-primary);
  box-shadow:
    var(--shadow-5),
    0 0 50px rgba(200, 169, 106, 0.08),
    inset 0 1px 0 rgba(255,230,180,0.1);
  animation: fadeUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* 上部ゴールドグラデーションライン */
.ending-card::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 169, 106, 0.8) 50%, transparent);
}

/* 右下コーナー装飾 */
.ending-card::after {
  content: '✦';
  position: absolute;
  bottom: 12px; right: 16px;
  font-size: 0.7rem;
  color: rgba(200, 169, 106, 0.2);
  pointer-events: none;
  line-height: 1;
}

.ending-fireworks {
  font-size: 2.5rem;
  margin-bottom: 0.8rem;
  animation: fireworksPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes fireworksPop {
  from { opacity: 0; transform: scale(0.4) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.ending-icon { font-size: 2.8rem; margin-bottom: 0.5rem; }

.ending-title {
  font-size: clamp(1.2rem, 5vw, 1.6rem);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.06em;
  margin-bottom: 0.8rem;
  text-shadow: 0 2px 16px rgba(232, 41, 106, 0.4);
}

.ending-bottle-display {
  font-size: clamp(0.82rem, 3vw, 1.1rem);
  background: rgba(200, 169, 106, 0.06);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 0.75rem 1.2rem;
  margin: 0.8rem 0;
  color: var(--gold-bright);
  text-shadow: 0 0 16px var(--gold-glow);
  box-shadow: inset 0 0 16px rgba(200, 169, 106, 0.05);
  animation: fadeUp 0.5s ease-out 0.05s both;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.ending-char-quote {
  font-size: 0.95rem;
  /* カード背景は上白→下暗のグラデーション。var(--text-secondary) では上部で薄くなるため直接指定 */
  color: #e8d4ff;
  line-height: 1.85;
  margin: 0.6rem 0 0.4rem;
  font-style: italic;
  white-space: pre-line;
}

.ending-message {
  font-size: 0.88rem;
  /* 同上：ラベンダー白に近い明度を確保しつつゲームのトーンを維持 */
  color: #e8d4ff;
  line-height: 1.95;
  margin: 0.8rem 0 1rem;
  white-space: pre-line;
}

.ending-score {
  font-size: 1.2rem;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 1.5rem;
  letter-spacing: 0.12em;
  animation: scoreShine 2s ease-in-out infinite;
}

/* ===== スコア内訳 ===== */
.btn-score-detail {
  background: none;
  border: 1px solid rgba(200, 169, 106, 0.4);
  color: var(--gold);
  font-size: 0.78rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  margin-bottom: 0.6rem;
  opacity: 0.8;
}
.btn-score-detail:hover { opacity: 1; }
.score-detail-panel {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(200,169,106,0.2);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
}
.score-detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.score-detail-table td { padding: 0.2rem 0.4rem; }
.score-detail-table td:last-child { text-align: right; color: #e0d0f0; }
.score-detail-total td { border-top: 1px solid rgba(200,169,106,0.3); color: var(--gold) !important; font-weight: 700; padding-top: 0.4rem; }

/* ===== ゲームオーバー ===== */
#screen-gameover {
  background: var(--bg-void);
}

.gameover-wrap {
  z-index: 2;
  padding: 2rem;
  width: 100%;
  display: flex;
  justify-content: center;
}

.gameover-card {
  background: linear-gradient(160deg, var(--bg-surface) 0%, rgba(22, 6, 16, 0.98) 100%);
  border: 1px solid rgba(255, 60, 80, 0.25);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
  color: var(--text-primary);
  box-shadow:
    var(--shadow-4),
    0 0 40px rgba(255, 40, 60, 0.08),
    inset 0 1px 0 rgba(255, 160, 180, 0.08);
  animation: shakeIn 0.5s ease;
  position: relative;
}

.gameover-card::before {
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 60, 80, 0.7) 50%, transparent);
}

.gameover-icon { font-size: 3rem; margin-bottom: 0.8rem; }

.gameover-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.18em;
  margin-bottom: 0.8rem;
  text-shadow: 0 0 30px rgba(255, 40, 60, 0.4);
}

.gameover-reason {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.95;
  max-width: 320px;
  margin: 0 auto 0.5rem;
  background: rgba(255, 40, 60, 0.04);
  border: 1px solid rgba(255, 80, 100, 0.18);
  border-radius: 10px;
  padding: 0.8rem 1rem;
}

.gameover-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1.8rem;
  letter-spacing: 0.1em;
}

/* ===== アイテムバー ===== */
.item-bar {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.3rem 1rem;
  flex-shrink: 0;
}

.item-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(200, 169, 106, 0.28);
  border-radius: 10px;
  padding: 0.3rem 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.18s;
  font-family: inherit;
  position: relative;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-btn:hover:not(:disabled) {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 0 12px var(--gold-glow);
}

.item-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.item-count {
  position: absolute;
  bottom: 1px; right: 2px;
  font-size: 0.58rem;
  color: var(--gold);
  font-weight: 700;
  font-family: var(--font-mono);
}

.item-empty { opacity: 0.25; }
.item-premium { border-color: rgba(176, 144, 232, 0.4); }
.item-premium:hover:not(:disabled) { border-color: #b090e8; }

/* ===== 時間表示（互換） ===== */
.time-display {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  white-space: nowrap;
  font-family: var(--font-mono);
}
.time-danger { color: #ff4060; font-weight: 700; animation: pulse 1s infinite; }

/* ===== エンディング報酬・店長フィードバック ===== */
.ending-reward {
  font-size: 0.82rem;
  color: var(--gold);
  background: rgba(200, 169, 106, 0.06);
  border: 1px solid rgba(200, 169, 106, 0.3);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  letter-spacing: 0.08em;
  box-shadow: inset 0 1px 0 rgba(255, 230, 160, 0.08);
}

.ending-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 0.4rem 0 0.8rem;
  min-height: 0;
}
.ending-badge {
  background: rgba(255,180,210,0.12);
  border: 1px solid rgba(255,180,210,0.35);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 0.78rem;
  color: #f2b8cb;
  letter-spacing: 0.04em;
}

/* ===== ANGELランキング ===== */
.ending-angel-ranking {
  margin: 1rem 0;
  text-align: center;
}
.ranking-section-title {
  font-size: 0.9rem;
  color: #c4aaff;
  margin-bottom: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  table-layout: fixed;
}
.ranking-table th {
  background: rgba(123,97,255,0.2);
  color: #c4aaff;
  padding: 5px 8px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
.ranking-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: var(--text-primary);
  overflow: hidden;
}
/* 列幅を固定して名前が長くてもはみ出さない */
.ranking-pos  { color: var(--text-muted); width: 28px; text-align: center; }
.ranking-turns { color: #7b61ff; font-weight: 700; width: 32px; white-space: nowrap; text-align: center; }
.ranking-badges { color: #f2b8cb; font-size: 0.72rem; width: 80px; white-space: nowrap; }
.ranking-name {
  max-width: 0; /* table-layout:fixed 内でellipsisを効かせるハック */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ranking-me td { background: rgba(123,97,255,0.18); }
.ranking-me .ranking-name { font-weight: 700; color: #c4aaff; }
.ranking-loading, .ranking-empty { color: var(--text-muted); font-size: 0.85rem; padding: 1rem 0; }
.ranking-my-rank { color: #c4aaff; font-size: 0.9rem; margin-bottom: 0.5rem; }
.ranking-my-rank strong { color: #7b61ff; font-size: 1.1rem; }

.angel-ranking-modal-inner {
  /* モバイルでモーダルが画面をはみ出さないよう上書き */
  max-height: min(80vh, calc(100dvh - 2rem));
  overflow-y: auto;
  padding: clamp(1rem, 4vw, 1.6rem);
  width: min(92vw, 520px);
  max-width: min(92vw, 520px);
}
.angel-ranking-select {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(200,120,170,0.3);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 0.5rem;
  font-size: clamp(0.8rem, 3.5vw, 0.9rem);
  margin-bottom: 0.8rem;
  /* iOSでフォントが拡大されないようにする */
  -webkit-text-size-adjust: 100%;
}
.angel-ranking-list {
  max-height: min(50vh, calc(100dvh - 220px));
  overflow-y: auto;
  /* iOS スクロールを慣性スクロールに */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.manager-section {
  text-align: left;
  margin-bottom: 1.2rem;
  /* border-left廃止：柔らかい全周ボーダーに */
  border: 1px solid rgba(200, 120, 170, 0.18);
  border-radius: 14px;
  padding: 1rem 1rem 0.8rem;
  background: rgba(232, 41, 106, 0.025);
}

.manager-label {
  font-size: 0.75rem;
  color: rgba(200, 169, 106, 1);
  font-weight: 700;
  margin-bottom: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-family: var(--font-serif);
  text-align: center;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000;
}

.manager-feedback {
  font-size: 0.85rem;
  /* #f0e8ff（薄いラベンダー白）→ ソフトホワイトに変更：暗背景・明背景どちらでも読める */
  color: #f2eeff;
  line-height: 1.9;
  background: rgba(232, 41, 106, 0.04);
  /* border-left廃止：上下の細いラインで囲む柔らかいスタイル */
  border-top: 1px solid rgba(232, 120, 170, 0.15);
  border-bottom: none;
  border-left: none;
  border-right: none;
  border-radius: 0;
  padding: 0.7rem 0.2rem 0;
  min-height: 3em;
  transition: background 0.4s ease;
}

.ending-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
  width: 100%;
}

.ending-replay-btn {
  width: 100%;
  font-size: 1rem;
  padding: 0 44px;
  height: 52px;
  letter-spacing: 0.2em;
  animation: fadeUp 0.4s ease-out 0.1s both;
}

.ending-sub-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
  animation: fadeUp 0.4s ease-out 0.2s both;
}

.ending-sub-actions .btn-secondary {
  padding: 0 12px;
  height: 44px;
  min-height: 44px; /* タッチターゲット最低サイズ確保（修正：40px→44px） */
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.ending-actions > .btn-secondary { animation: fadeUp 0.4s ease-out 0.3s both; }
.ending-actions > .btn-kofi      { animation: fadeUp 0.4s ease-out 0.4s both; }

/* ===== 難易度選択 ===== */
.difficulty-select {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.diff-label {
  font-size: 0.8rem;
  color: #9060c0;
  text-align: center;
  margin-bottom: 0.3rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.diff-btn {
  background: rgba(255,255,255,0.65);
  border: 1.5px solid rgba(180, 80, 140, 0.45);
  color: #5a2090;
  padding: 0.75rem 1rem; /* 0.8rem → 0.75rem（12px）スペーシングスケール準拠 */
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font-serif);
  font-size: 0.82rem;
  transition: all 0.18s;
  letter-spacing: 0.06em;
  text-align: left;
}

.diff-btn:hover {
  border-color: rgba(232, 41, 106, 0.55);
  color: #e8297a;
  background: rgba(255, 220, 240, 0.6);
}

.diff-active {
  background: rgba(232, 41, 106, 0.1);
  border-color: rgba(232, 100, 160, 0.5);
  color: var(--text-primary);
  /* border-left廃止：グロー効果で選択を表現 */
  box-shadow: 0 0 12px rgba(232, 41, 106, 0.15), inset 0 1px 0 rgba(255,200,230,0.08);
}

.diff-btn-monster {
  border-color: rgba(200, 30, 30, 0.45);
  color: #c02020;
}
.diff-btn-monster:hover { border-color: rgba(200, 30, 30, 0.7); color: #a01010; }
.diff-btn-monster.diff-active {
  background: rgba(200, 0, 0, 0.1);
  color: #c01010;
  border-color: rgba(255, 50, 50, 0.5);
  box-shadow: 0 0 12px rgba(255, 0, 0, 0.18);
  animation: monster-pulse 1s ease-in-out infinite alternate;
}

@keyframes monster-pulse {
  from { box-shadow: 0 0 8px rgba(200, 0, 0, 0.2); }
  to   { box-shadow: 0 0 20px rgba(255, 0, 0, 0.3); }
}

.diff-btn-angel {
  border-color: rgba(120, 90, 200, 0.45);
  color: #5040a0;
  font-size: 0.72rem;
}
.diff-btn-angel:hover { border-color: rgba(120, 90, 200, 0.7); color: #3020a0; }
.diff-btn-angel.diff-active {
  background: rgba(120, 90, 180, 0.12);
  border-color: rgba(120, 90, 200, 0.6);
  color: #d8c8ff;
  box-shadow: 0 0 16px rgba(180, 140, 255, 0.18);
  animation: angel-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes angel-pulse {
  from { box-shadow: 0 0 8px rgba(130, 90, 200, 0.2); }
  to   { box-shadow: 0 0 20px rgba(180, 140, 255, 0.3); }
}

/* ===== 固有メカニクス表示 ===== */
.mechanic-display {
  position: absolute;
  top: 40px; right: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(8, 4, 18, 0.68);
  border: 1px solid rgba(200, 120, 170, 0.2);
  border-radius: 10px;
  padding: 3px 10px;
  z-index: 21;
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255,200,230,0.05);
}

.mech-label {
  font-size: clamp(0.7rem, 1.8vw, 0.78rem);
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
  letter-spacing: 0.06em;
}

.mech-bar {
  width: 50px; height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.mech-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s ease;
}

.mech-value {
  font-size: clamp(0.65rem, 1.8vw, 0.72rem);
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* ===== ローディング ===== */
.loading-indicator {
  position: absolute;
  bottom: calc(140px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-dots {
  display: flex;
  gap: 0.35rem;
}

.loading-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--magenta);
  display: block;
  font-size: 0;
  animation: loadBounce 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadBounce {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40%            { opacity: 1;    transform: translateY(-5px); }
}

/* ===== シャンパンコール ===== */
.champagne-call {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: var(--z-callout);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: callFlash 0.5s ease;
}
.champagne-call.hidden { display: none; }

.call-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold-bright);
  text-shadow: 0 0 30px var(--gold-glow), 0 0 60px rgba(200,169,106,0.4);
  text-align: center;
  animation: callPulse 0.8s ease-in-out infinite;
  letter-spacing: 0.2em;
}

.chance-call {
  color: var(--text-accent);
  text-shadow:
    0 0 30px rgba(232, 41, 106, 0.8),
    0 0 60px rgba(232, 41, 106, 0.4),
    0 0 100px rgba(232, 41, 106, 0.2);
  font-size: 1.8rem;
  letter-spacing: 0.25em;
}

@keyframes callFlash {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes callPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.08); }
}

/* ===== バックログ ===== */
.backlog-list {
  max-height: 50vh;
  overflow-y: auto;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.backlog-entry {
  /* fluid: モバイル0.8rem → PC0.92rem */
  font-size: clamp(0.8rem, 0.65rem + 0.4vw, 0.92rem);
  line-height: 1.7;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
}

.backlog-user {
  background: rgba(232, 41, 106, 0.07);
  color: var(--text-secondary);
  /* border-left廃止：柔らかい全周ボーダーに */
  border: 1px solid rgba(232, 41, 106, 0.2);
  border-radius: 6px;
}

.backlog-char {
  background: rgba(120, 80, 160, 0.07);
  color: var(--text-secondary);
  /* border-left廃止：柔らかい全周ボーダーに */
  border: 1px solid rgba(180, 140, 220, 0.2);
  border-radius: 6px;
}

.backlog-name {
  font-weight: 700;
  margin-right: 0.4rem;
  font-size: 0.68rem;
  color: var(--text-accent);
  letter-spacing: 0.08em;
}

/* ===== チュートリアル ===== */
.tutorial-content {
  text-align: left;
  margin-bottom: 1rem;
}

.tutorial-content p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.85;
  margin-bottom: 0.35rem;
}

.tutorial-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.15);
  margin: 12px 0;
}

/* インラインスタイル代替ユーティリティ */
.center-mt    { text-align: center; margin-top: 8px; }
.center-align { text-align: center; }

/* ===== ショップ ===== */
.shop-overlay {
  position: fixed; inset: 0;
  background: rgba(6, 3, 12, 0.88);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
}
.shop-overlay.hidden { display: none; }

.shop-card {
  position: relative;
  background: linear-gradient(160deg, var(--bg-surface) 0%, rgba(22, 12, 40, 0.98) 100%);
  border: 1px solid rgba(232, 100, 160, 0.28);
  border-radius: 20px;
  padding: 1.6rem;
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow:
    var(--shadow-6),
    inset 0 1px 0 rgba(255,200,230,0.08);
  animation: modalSlideUp 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

/* トップアクセントライン */
.shop-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--magenta) 50%, transparent);
}

@keyframes modalSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.shop-header { text-align: center; margin-bottom: 1.2rem; }

.shop-title {
  font-size: 1.05rem;
  color: var(--text-primary);
  letter-spacing: 0.18em;
  margin-bottom: 0.4rem;
  font-family: var(--font-sans);
  font-weight: 700;
}

.shop-points {
  font-size: 0.88rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-family: var(--font-mono);
}

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.shop-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(200, 120, 170, 0.16);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  transition: border-color 0.18s, background 0.18s;
}

.shop-row:hover {
  border-color: rgba(200, 120, 170, 0.32);
  background: rgba(232, 41, 106, 0.04);
}

.shop-item-info {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.shop-item-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.shop-item-stock {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: var(--font-mono);
}

.shop-buy-btn {
  background: transparent;
  color: var(--gold);
  border: 1px solid rgba(200, 169, 106, 0.35);
  border-radius: 12px;
  padding: 0.4rem 0.9rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-serif);
  white-space: nowrap;
  transition: all 0.18s;
  min-width: 60px;
  letter-spacing: 0.08em;
}

.shop-buy-btn:hover {
  background: rgba(200, 169, 106, 0.1);
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.shop-buy-disabled { opacity: 0.3; cursor: not-allowed; }

/* ===== イベントフラッシュ ===== */
.event-flash {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 200;
  pointer-events: none;
}
.event-flash.hidden { display: none; }

.event-flash-reason {
  text-align: center;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: rgba(200, 169, 230, 0.85);
  font-family: var(--font-sans);
  font-weight: 400;
  letter-spacing: 0.04em;
}

.event-flash-text {
  background: rgba(12, 5, 24, 0.97);
  border: 1.5px solid rgba(232, 100, 160, 0.6);
  border-radius: 14px;
  padding: 0.8rem 2rem;
  font-size: 0.95rem;
  color: #fff;
  font-weight: 700;
  font-family: var(--font-serif);
  box-shadow: var(--shadow-3), 0 0 28px var(--magenta-glow), inset 0 1px 0 rgba(255,200,230,0.1);
  animation: flashIn 0.25s ease;
  text-align: center;
  letter-spacing: 0.1em;
  text-shadow: 0 0 12px var(--magenta), 0 1px 4px rgba(0,0,0,0.8);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

/* ===== アニメーション（共通） ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== MP酔いエフェクト ===== */
/* 3秒で揺れ＆霞が消えて色だけ残る演出 */
@keyframes drunkIntroMild {
  0%   { filter: blur(0.3px) hue-rotate(8deg);              transform: rotate(-0.4deg) translateX(-1px); }
  40%  { filter: blur(0.3px) hue-rotate(8deg);              transform: rotate( 0.4deg) translateX( 1px); }
  80%  { filter: blur(0.1px) hue-rotate(8deg);              transform: rotate(-0.1deg) translateX(-0.5px); }
  100% { filter:             hue-rotate(8deg);              transform: none; }
}

@keyframes drunkIntroModerate {
  0%   { filter: blur(0.8px) hue-rotate(18deg) saturate(1.3); transform: rotate(-0.4deg) translateX(-1px); }
  33%  { filter: blur(0.8px) hue-rotate(18deg) saturate(1.3); transform: rotate( 0.4deg) translateX( 1px); }
  66%  { filter: blur(0.3px) hue-rotate(18deg) saturate(1.3); transform: rotate(-0.15deg); }
  100% { filter:             hue-rotate(18deg) saturate(1.3); transform: none; }
}

@keyframes drunkIntroHeavy {
  0%   { filter: blur(1.5px) hue-rotate(28deg) saturate(1.6) brightness(0.85); transform: rotate(-1deg)   translateX(-3px) translateY(1px); }
  25%  { filter: blur(1.5px) hue-rotate(28deg) saturate(1.6) brightness(0.85); transform: rotate( 0.8deg) translateX(2px)  translateY(-1px); }
  55%  { filter: blur(0.8px) hue-rotate(28deg) saturate(1.6) brightness(0.85); transform: rotate(-0.4deg) translateX(-1px); }
  80%  { filter: blur(0.2px) hue-rotate(28deg) saturate(1.6) brightness(0.85); transform: rotate( 0.1deg); }
  100% { filter:             hue-rotate(28deg) saturate(1.6) brightness(0.85); transform: none; }
}

@keyframes drunkOverlayIntro {
  0%   { opacity: 1; transform: rotate(-0.4deg) translateX(-1px); }
  50%  { opacity: 1; transform: rotate( 0.4deg) translateX( 1px); }
  90%  { opacity: 1; transform: rotate(-0.1deg); }
  100% { opacity: 1; transform: none; }
}

#screen-game.drunk-mild .vn-layout {
  animation: drunkIntroMild 3s ease-in-out 1 forwards;
}

#screen-game.drunk-moderate .vn-layout {
  animation: drunkIntroModerate 3s ease-in-out 1 forwards;
}

#screen-game.drunk-moderate .vn-textbox {
  background: rgba(14, 6, 22, 0.96);
}

#screen-game.drunk-heavy .vn-layout {
  animation: drunkIntroHeavy 3s ease-in-out 1 forwards;
}

#screen-game.drunk-heavy::after {
  content: '';
  position: fixed; inset: 0;
  background: rgba(200, 20, 40, 0.1);
  pointer-events: none;
  z-index: 5;
  animation: drunkOverlayIntro 3s ease-in-out 1 forwards;
}

/* ===== スコアシャイン ===== */
@keyframes scoreShine {
  0%, 100% { text-shadow: 0 0 8px var(--gold-glow); }
  50%       { text-shadow: 0 0 24px var(--gold-glow), 0 0 6px rgba(255,220,140,0.5); }
}

/* エンディングフラッシュ */
.ending-flash-overlay {
  position: fixed; inset: 0;
  background: #fff;
  z-index: 9999;
  pointer-events: none;
  animation: endingFlash 0.7s ease-out forwards;
}

@keyframes endingFlash {
  0%   { opacity: 0.7; }
  100% { opacity: 0; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.07); }
}

@keyframes floatAnim {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-6px); }
}

@keyframes haloRotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes flashIn {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes shakeIn {
  0%   { transform: scale(0.94); opacity: 0; }
  60%  { transform: scale(1.02); }
  100% { transform: scale(1);    opacity: 1; }
}

@keyframes gaugeFlash {
  0%, 100% { opacity: 1; }
  40%       { opacity: 0.2; }
}
.gauge-flash { animation: gaugeFlash 0.4s ease 3; }

/* ===== アイテム確認ポップアップ ===== */
.item-confirm {
  position: absolute;
  bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: min(280px, 85vw);
  animation: fadeUp 0.2s ease;
}

.item-confirm.hidden { display: none; }

.item-confirm-inner {
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  text-align: center;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-4);
  /* bg-raised は明るい半透明白背景なので、濃い紫テキストに上書きして視認性を確保 */
  --text-primary:   #3a1060;
  --text-secondary: #5a2888;
}

.item-confirm-emoji { font-size: 2rem; margin-bottom: 0.3rem; }

.item-confirm-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
  letter-spacing: 0.06em;
}

.item-confirm-desc {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 0.8rem;
  line-height: 1.55;
}

.item-confirm-buttons {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
}

.item-confirm-btn-use {
  padding: 0.45rem 1.2rem;
  background: linear-gradient(135deg, #f06090 0%, var(--magenta) 60%, #c0186a 100%);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-serif);
  cursor: pointer;
  letter-spacing: 0.08em;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px var(--magenta-glow);
}
.item-confirm-btn-use:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--magenta-glow);
}

.item-confirm-btn-cancel {
  padding: 0.45rem 1rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid rgba(200, 120, 170, 0.22);
  border-radius: 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.item-confirm-btn-cancel:hover { border-color: rgba(200, 120, 170, 0.4); }

/* ===== ハート演出 ===== */
.floating-heart {
  position: fixed;
  font-size: 1.4rem;
  pointer-events: none;
  z-index: 20;
  animation: floatHeart var(--dur, 1.5s) ease-out forwards;
}

@keyframes floatHeart {
  0%   { transform: translateY(0) scale(0.8); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translateY(-130px) scale(1.1); opacity: 0; }
}

/* ===== シネマティック演出 ===== */
.cinematic-overlay {
  position: fixed; inset: 0;
  z-index: var(--z-cinematic);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0);
  pointer-events: none;
}
.cinematic-overlay.hidden { display: none; }
.cinematic-overlay.active { pointer-events: auto; }

.cinematic-bar {
  position: absolute;
  left: 0; right: 0;
  background: #000;
  height: 0;
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.cinematic-bar-top    { top: 0; }
.cinematic-bar-bottom { bottom: 0; }
.cinematic-overlay.active .cinematic-bar { height: 18vh; }

.cinematic-quote {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.0);
  font-size: clamp(1rem, 4vw, 1.35rem);
  font-family: var(--font-serif);
  font-weight: 700;
  text-align: center;
  line-height: 1.95;
  padding: 0 1.5rem;
  white-space: nowrap;
  text-shadow:
    -1px -1px 0 #000,
     1px -1px 0 #000,
    -1px  1px 0 #000,
     1px  1px 0 #000,
    -2px  0   0 rgba(0,0,0,0.6),
     2px  0   0 rgba(0,0,0,0.6),
     0   -2px 0 rgba(0,0,0,0.6),
     0    2px 0 rgba(0,0,0,0.6);
  transition: color 0.5s ease 0.5s;
  letter-spacing: 0.08em;
}

.cinematic-overlay.active .cinematic-quote {
  color: rgba(255, 255, 255, 1);
}

@keyframes cinematicFadeOut {
  0%   { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

.cinematic-overlay.fadeout {
  animation: cinematicFadeOut 0.8s ease forwards;
}

/* ===== ボトル提案モーダル ===== */
.bottle-offer {
  position: absolute; inset: 0;
  background: rgba(6, 3, 14, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fadeUp 0.3s ease;
}
.bottle-offer.hidden { display: none; }

.bottle-offer-inner {
  background: linear-gradient(160deg, var(--bg-surface) 0%, rgba(20, 12, 30, 0.98) 100%);
  border: 1px solid rgba(200, 169, 106, 0.38);
  border-radius: 20px;
  padding: 1.6rem 1.8rem;
  width: min(300px, 88vw);
  text-align: center;
  box-shadow:
    var(--shadow-5),
    0 0 40px rgba(200, 169, 106, 0.12),
    inset 0 1px 0 rgba(255,230,160,0.1);
  position: relative;
}

.bottle-offer-inner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold) 50%, transparent);
}

.bottle-offer-rank-label {
  font-size: 0.65rem;
  color: var(--gold);
  letter-spacing: 0.25em;
  margin-bottom: 0.7rem;
  text-transform: uppercase;
  font-family: var(--font-sans);
}

.bottle-offer-text {
  font-size: clamp(0.72rem, 3.5vw, 0.9rem);
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 1.2rem;
  white-space: pre-line;
  word-break: break-word;
}

.bottle-offer-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.bottle-offer-buttons .btn-primary,
.bottle-offer-buttons .btn-secondary {
  min-height: 44px;
}

/* ===== ボトル開封演出 ===== */
.bottle-opening {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: var(--z-bottle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.bottle-opening.hidden { display: none; }

.bottle-opening-inner {
  text-align: center;
  animation: bottleReveal 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes bottleReveal {
  0%   { transform: scale(0.2) rotate(-15deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.bottle-open-emoji {
  display: block;
  font-size: 5.5rem;
  animation: bottleBounce 0.5s ease-in-out 0.7s both, bottleShake 0.25s ease-in-out 1.3s 3;
}

@keyframes bottleBounce {
  0%   { transform: translateY(-30px); }
  60%  { transform: translateY(12px); }
  100% { transform: translateY(0); }
}

@keyframes bottleShake {
  0%, 100% { transform: rotate(0deg); }
  30%       { transform: rotate(-10deg); }
  70%       { transform: rotate(10deg); }
}

.bottle-open-rank {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: 700;
  color: var(--gold-bright);
  margin-top: 14px;
  animation: goldGlow 0.8s ease-in-out infinite alternate;
  letter-spacing: 0.10em;
  white-space: nowrap;
}

@keyframes goldGlow {
  from { text-shadow: 0 2px 6px rgba(0,0,0,0.9), 0 0 8px rgba(200,169,106,0.4); }
  to   { text-shadow: 0 2px 6px rgba(0,0,0,0.9), 0 0 28px var(--gold-glow), 0 0 56px rgba(200,169,106,0.4); }
}

.bottle-open-name {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-top: 8px;
  opacity: 0.9;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 6px rgba(0,0,0,0.95), 0 1px 3px rgba(0,0,0,1), 0 4px 12px rgba(0,0,0,0.8);
}

.bottle-sparkle {
  position: absolute;
  top: -40px;
  font-size: 1.6rem;
  pointer-events: none;
  animation: sparkleFall linear forwards;
}

@keyframes sparkleFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  80%  { opacity: 0.7; }
  100% { transform: translateY(110vh) rotate(540deg); opacity: 0; }
}

/* ===== 支援者コードボタン（タイトル画面） ===== */
.btn-supporter-code {
  display: block;
  margin: 8px auto 0;
  padding: 6px 18px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  letter-spacing: 0.08em;
  text-decoration: none; /* <a>タグとして使われる場合 */
  text-align: center;
}
.btn-supporter-code:hover { border-color: var(--border-mid); color: var(--text-secondary); }

/* 開発モードボタン（#btn-supporter-code）はさらに存在感を抑える */
#btn-supporter-code.btn-supporter-code {
  font-size: 0.72rem;
  opacity: 0.7;
  border-color: transparent;
}
#btn-supporter-code.btn-supporter-code:hover {
  opacity: 1;
  border-color: var(--border-subtle);
}

/* ===== バージョン表示 ===== */
.version-display {
  margin-top: 1rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
}

/* ===== シリアルコードエラー ===== */
#serial-code-error {
  color: #E8003D;
}

/* ===== モーダル閉じるボタン ===== */
.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.7;
  color: inherit;
  line-height: 1;
  padding: 4px 8px;
  min-height: 44px;
  min-width: 44px;
}
.modal-close-btn:hover { opacity: 1; }

/* ===== ボイストグル ===== */
.sound-toggle-wrap {
  display: flex;
  justify-content: center;
  margin: 0.4rem 0;
}
.btn-sound-toggle {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 999px;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 1.1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  letter-spacing: 0.05em;
}
.btn-sound-toggle:hover { background: rgba(255,255,255,0.14); }
.btn-sound-toggle.sound-off {
  background: rgba(255,80,80,0.08);
  border-color: rgba(255,80,80,0.25);
  color: rgba(255,180,180,0.85);
}

/* ===== Xログインエリア ===== */
.x-login-area {
  margin: 12px auto 4px;
  text-align: center;
}
.btn-x-login {
  display: inline-block;
  padding: 7px 20px;
  background: #000;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: bold;
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}
.btn-x-login:hover {
  background: #1a1a1a;
  border-color: rgba(255,255,255,0.5);
}
.x-user-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.8);
}
#x-username-text { color: #ff6b6b; font-weight: bold; }
#x-username-text::before { content: ''; }
.btn-x-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  color: rgba(255,255,255,0.5);
  font-size: 0.6rem;
  padding: 2px 8px;
  cursor: pointer;
}
.btn-x-logout:hover { color: rgba(255,100,100,0.8); border-color: rgba(255,100,100,0.3); }

/* ===== 実績ボタン ===== */
.btn-achievements {
  display: block;
  margin: 8px auto 0;
  padding: 4px 14px;
  background: transparent;
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 20px;
  color: rgba(255, 215, 0, 0.7);
  font-size: 0.65rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.06em;
}
.btn-achievements:hover {
  border-color: rgba(255, 215, 0, 0.5);
  color: rgba(255, 215, 0, 0.9);
}

/* ===== 実績リスト ===== */
.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 0;
}
.achievement-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}
.achievement-item.unlocked {
  background: rgba(255, 215, 0, 0.08);
  border-color: rgba(255, 215, 0, 0.3);
}
.achievement-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
}
.achievement-text {
  flex: 1;
}
.achievement-label {
  font-size: 0.85rem;
  font-weight: bold;
  color: rgba(255,255,255,0.9);
}
.achievement-item:not(.unlocked) .achievement-label {
  color: rgba(255,255,255,0.3);
}
.achievement-desc {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
}
.achievement-item.unlocked .achievement-desc {
  color: rgba(255, 215, 0, 0.6);
}

/* ===== リセットボタン ===== */
.btn-reset-all {
  display: block;
  margin: 8px auto 0;
  padding: 4px 14px;
  background: transparent;
  border: 1px solid rgba(255, 80, 80, 0.15);
  border-radius: 2px;
  color: rgba(255, 100, 100, 0.35);
  font-family: inherit;
  font-size: 0.65rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.06em;
}
.btn-reset-all:hover {
  border-color: rgba(255, 80, 80, 0.4);
  color: rgba(255, 100, 100, 0.7);
}

/* ===== 支援者モーダル ===== */
.supporter-modal-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.65;
}

.supporter-input-wrap { margin-bottom: 8px; }

.supporter-code-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-mid);
  border-radius: 2px;
  font-size: 1rem;
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
  letter-spacing: 0.08em;
}
.supporter-code-input:focus { border-color: var(--magenta); }

.supporter-code-result {
  min-height: 20px;
  font-size: 0.82rem;
  margin-bottom: 10px;
}

.result-success { color: #40b870; font-weight: 700; }
.result-error   { color: #ff5050; }

.supporter-modal-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.supporter-modal-kofi {
  text-align: center;
  font-size: 0.78rem;
}

.kofi-link {
  color: var(--text-accent);
  text-decoration: none;
  letter-spacing: 0.04em;
}
.kofi-link:hover { text-decoration: underline; }

/* ===== Ko-fiボタン（エンディング） ===== */
.btn-kofi {
  display: block;
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #ff7060 0%, #ff5e5b 50%, #e84040 100%);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: var(--font-serif);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.18s, box-shadow 0.18s;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 16px rgba(255, 80, 80, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-kofi:hover { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(255, 80, 80, 0.4); }

/* ===== レスポンシブ ===== */
@media (max-width: 1024px) {
  .character-card { width: 200px; }
}

@media (max-width: 900px) {
  .character-card { width: 190px; }
}

@media (max-width: 768px) {
  .character-card { width: 180px; }
  .vn-gauge-bar { width: 60px; }
}

@media (max-width: 640px) {
  .character-cards { flex-direction: column; align-items: center; }
  .character-card  { width: 88vw; max-width: 320px; }
  .vn-gauge-bar    { width: 50px; }
  .confirm-buttons { flex-direction: column; align-items: center; }
  .name-label      { font-size: 0.65rem; }
  .select-sub      { font-size: 0.72rem; }
  .name-input      { width: min(240px, 82vw); }

  /* タイトル画面：小画面でパディングを縮小しロゴを小さく */
  .title-content {
    padding: 1.2rem 1.2rem 1.8rem;
    max-width: calc(100vw - 2rem);
    border-radius: 20px;
  }
  .title-logo-img {
    max-width: min(78vw, 300px);
  }
  .title-logo-img-wrap {
    margin-top: 1rem;
    margin-bottom: 0.75rem;
  }
  .title-desc {
    font-size: 0.8rem;
    margin-bottom: 1rem;
  }
  .name-input-wrap {
    margin-bottom: 1rem;
  }

  /* ランキングモーダル：小画面対応 */
  .shop-card.angel-ranking-modal-inner {
    width: 96vw;
    max-width: 96vw;
    padding: 1rem;
  }
  .ranking-table {
    font-size: 0.75rem;
  }
  .ranking-table th,
  .ranking-table td {
    padding: 4px 6px;
  }
  .ranking-badges {
    width: 76px;
    font-size: 0.7rem;
    white-space: nowrap;
  }
  .ranking-turns {
    width: 28px;
    font-size: 0.75rem;
  }
}

/* ===== 縦長画面（スマホ）特化 ===== */
@media (orientation: portrait) {
  .vn-sprite-area {
    top: 0;
    bottom: 32%;
  }

  .vn-sprite-inner img {
    max-height: 60vh;
  }

  .vn-textbox-area {
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    padding: 0 0.5rem;
  }

  .vn-textbox {
    padding: 0.65rem 1rem;
    min-height: 65px;
  }

  .vn-text {
    font-size: 0.86rem;
    line-height: 1.8;
  }

  .vn-input-area {
    padding: 0.3rem 0.5rem;
  }

  .vn-textarea {
    padding: 0.45rem 0.8rem;
    font-size: 1rem;
  }

  .vn-item-bar {
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    margin-bottom: calc(0.5rem + 65px + 22px + env(safe-area-inset-bottom, 0px));
  }

  .vn-overlay-top {
    padding: 0.3rem 0.4rem;
  }

  .vn-btn-menu {
    padding: 4px 8px;
    min-height: 44px; min-width: 44px;
    font-size: 0.88rem;
  }

  .vn-gauge-bar   { width: clamp(44px, 8vw, 64px); height: 6px; }
  .vn-gauge-num   { font-size: 0.78rem; }
  .vn-gauge-item  { gap: 0.2rem; }

  .vn-situation     { top: 36px; font-size: 0.72rem; padding: 2px 10px; }
  .mechanic-display { top: 36px; right: 0.4rem; padding: 2px 8px; }
  .mech-label       { font-size: 0.7rem; }
  .mech-bar         { width: 35px; height: 4px; }
  .mech-value       { font-size: 0.7rem; }
}

/* 非常に縦長（iPhone等） */
@media (max-width: 430px) and (orientation: portrait) {
  .vn-sprite-area { bottom: 34%; }
  .vn-sprite-inner img { max-height: 55vh; }
  .vn-textbox-area { bottom: calc(65px + env(safe-area-inset-bottom, 0px)); }
  .vn-textbox { min-height: 58px; padding: 0.5rem 0.8rem; }
  .vn-text { font-size: 0.82rem; }
  .vn-name-tag { font-size: 0.65rem; padding: 2px 12px; }
  .vn-item-bar { bottom: calc(65px + env(safe-area-inset-bottom, 0px)); margin-bottom: calc(0.4rem + 58px + 20px + env(safe-area-inset-bottom, 0px)); }
  .vn-gauge-bar { width: clamp(40px, 7vw, 56px); height: 6px; }
  .vn-gauge-num { font-size: 0.75rem; }
}

/* ===== prefers-reduced-motion 対応 ===== */
@media (prefers-reduced-motion: reduce) {
  .petal { animation: none; opacity: 0.5; }
  .title-logo-img { animation: none; }
  .vn-sprite { animation: none; }
  .loading-dots span { animation: none; opacity: 1; }
  .champagne-call .call-text { animation: none; }
  .gauge-flash { animation: none; }
  .boss-unlocked-anim { animation: none; }
  .diff-btn-monster.diff-active { animation: none; }
  .diff-btn-angel.diff-active { animation: none; }
  .floating-heart { animation: none; display: none; }
  .bottle-opening-inner { animation: none; }
  .bottle-open-emoji { animation: none; }
  .bottle-open-rank { animation: none; text-shadow: none; }
  .bottle-sparkle { animation: none; display: none; }
  .character-card { animation: none; }
  #screen-game.drunk-mild .vn-layout,
  #screen-game.drunk-moderate .vn-layout,
  #screen-game.drunk-heavy .vn-layout { animation: none; filter: none; }
  .ending-fireworks { animation: none; }
  .ending-actions > * { animation: none; }
  .ending-replay-btn { animation: none; }
  .ending-sub-actions { animation: none; }
  .ending-bottle-display { animation: none; }
  .vn-gauge-fill::after { animation: none; }
  .ending-flash-overlay { display: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ===== 店長相談カード ===== */
.consult-card { border-color: rgba(232,180,232,0.35); }
.consult-card:hover { border-color: rgba(232,180,232,0.7); }
.card-ribbon.consult { background: linear-gradient(135deg, #c87cce, #9b59b6); }
.card-avatar.consult-bg { background: radial-gradient(circle at 60% 40%, #3a1a4a, #1a0a2a); }
.card-avatar.consult-bg img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: center 15%; }

/* 復旧中オーバーレイ */
.consult-card--maintenance {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(40%);
}
.consult-card--maintenance:hover {
  transform: none !important;
  border-color: rgba(232,180,232,0.35) !important;
  box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255,200,230,0.08) !important;
}
.consult-maintenance-overlay {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}
.consult-maintenance-label {
  background: rgba(10, 6, 24, 0.82);
  border: 1px solid rgba(200, 148, 138, 0.5);
  color: var(--blush);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
  font-family: var(--font-sans);
  backdrop-filter: blur(4px);
}

/* ===== 相談モーダル（Discord風） ===== */
.consult-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 900;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 520px) {
  .consult-modal {
    align-items: center;
    padding: 1rem;
  }
}

/* モーダル本体：Discord DMウィンドウ風 */
.consult-inner {
  position: relative;
  background: var(--bg-deep); /* #313338 → ゲームのメイン背景カラーに統一 */
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 520px) {
  .consult-inner { border-radius: 16px; }
}

/* ヘッダー */
.consult-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-overlay); /* #2b2d31 → ゲームのオーバーレイ背景カラーに統一 */
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.consult-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.consult-header-text { flex: 1; min-width: 0; }
.consult-title { font-size: 1rem; font-weight: 700; color: #fff; line-height: 1.2; }
.consult-sub { font-size: 0.75rem; color: #949ba4; margin-top: 0.1rem; }

/* 「仕事に戻る」ボタン */
.consult-close {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  color: #949ba4;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.consult-close:hover { background: rgba(255,255,255,0.06); color: #dbdee1; }

/* チャットエリア */
.consult-chat {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 200px;
  max-height: 48vh;
  scrollbar-width: thin;
  scrollbar-color: #1e1f22 transparent;
}

/* Discord メッセージ行（アバター＋右側） */
.consult-msg {
  display: flex;
  gap: 0.75rem;
  padding: 0.18rem 0 0.18rem 0;
  max-width: 100%;
}

/* アバター列 */
.consult-msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.consult-msg-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--lavender-soft); /* #5865f2（Discord青）→ ゲームのラベンダー系に統一 */
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  margin-top: 0.15rem;
}

/* 右側：名前＋テキスト */
.consult-msg-body { flex: 1; min-width: 0; }

.consult-msg-name {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.1rem;
}

.consult-msg.assistant .consult-msg-name { color: #e8b4e8; }
.consult-msg.user .consult-msg-name { color: #7289da; }

.consult-bubble {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #dcddde;
  white-space: pre-wrap;
  word-break: break-word;
}

/* サマリーボックス */
.consult-summary {
  margin: 0.5rem 1rem;
  background: rgba(232,180,232,0.08);
  border-left: 3px solid #c87cce;
  border-radius: 0 6px 6px 0;
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  color: #dcddde;
  flex-shrink: 0;
}
.consult-summary strong { color: #e8b4e8; display: block; margin-bottom: 0.25rem; font-size: 0.78rem; }

/* 入力エリア */
.consult-input-area {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--bg-deep); /* #313338 → ゲームのメイン背景カラーに統一 */
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.consult-textarea {
  flex: 1;
  padding: 0.65rem 0.9rem;
  background: var(--bg-surface); /* #383a40 → ゲームのサーフェスカラーに統一 */
  border: none;
  border-radius: 8px;
  color: #dcddde;
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.5;
}
.consult-textarea::placeholder { color: #6d6f78; }
.consult-textarea:focus { outline: none; background: var(--bg-raised); /* #40444b → ゲームの浮き上がりカラーに統一 */ }

.consult-send {
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  background: linear-gradient(135deg, #c87cce, #9b59b6);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  align-self: flex-end;
}
.consult-send:disabled { opacity: 0.4; cursor: not-allowed; }
.consult-send:not(:disabled):hover { opacity: 0.85; }

.consult-new {
  display: block;
  width: calc(100% - 2rem);
  margin: 0.5rem 1rem;
  padding: 0.6rem;
  text-align: center;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: 8px;
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
}
.consult-new:hover { background: rgba(255,255,255,0.1); }

/* ===== PCワイド向けレスポンシブ（トークパート強化） ===== */

/* 900px以上：テキストボックス・入力エリアを広げ始める */
@media (min-width: 900px) {
  /* テキストボックスエリアを画面中央寄りに */
  .vn-textbox-area {
    left: 50%;
    transform: translateX(-50%);
    width: min(860px, 92vw);
    padding: 0 0;
  }

  .vn-textbox {
    padding: 1.1rem 2rem;
    min-height: 90px;
  }

  /* 入力エリアも中央揃え */
  .vn-input-area {
    justify-content: center;
  }
  .vn-input-area > .vn-textarea {
    max-width: 700px;
  }

  /* ゲージバーを広げる */
  .vn-gauge-bar { width: 90px; }

  /* アイテムバー最大幅制限 */
  .vn-item-bar { max-width: 860px; }
}

/* 1280px以上：さらに余裕のあるレイアウトへ */
@media (min-width: 1280px) {
  .vn-textbox-area {
    width: min(960px, 80vw);
    /* テキストボックスをわずかに上に寄せ、スプライトとの余白を確保 */
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  }

  .vn-textbox {
    padding: 1.2rem 2.4rem;
    min-height: 100px;
  }

  .vn-input-area > .vn-textarea {
    max-width: 820px;
  }

  /* ゲージをさらに広げ視認性向上 */
  .vn-gauge-bar { width: 110px; height: 7px; }
  .vn-gauge-label { font-size: 0.82rem; }
  .vn-gauge-num { font-size: 0.86rem; }

  /* アイテムバーも合わせる */
  .vn-item-bar {
    max-width: 960px;
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
    margin-bottom: calc(0.6rem + 100px + 24px + env(safe-area-inset-bottom, 0px));
  }
}

/* ===== SNS対応ミニゲーム ===== */
.btn-yamai-dm {
  display: block;
  margin: 0.8rem auto 0;
  background: linear-gradient(135deg, var(--magenta-dim), var(--magenta));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.06em;
  box-shadow: 0 2px 8px var(--magenta-glow);
}
.btn-yamai-dm:hover { filter: brightness(1.15); }

/* ミニゲーム全体ラップ */
.yamai-dm-wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 1rem env(safe-area-inset-bottom, 0.5rem);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background: var(--bg-deep);
  overflow-y: auto;
  /* 明るい背景向けにテキスト色をスコープ上書き */
  --text-primary:   #3d1860;
  --text-secondary: #6040a0;
}

/* ヘッダー */
.yamai-dm-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(100,50,160,0.15);
}
.yamai-back-btn {
  background: none;
  border: 1px solid rgba(100,50,160,0.3);
  color: var(--text-secondary);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}
.yamai-char-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
}
.yamai-char-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  overflow: hidden;
}
.yamai-char-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.yamai-char-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}
.yamai-progress {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* キャラ選択 */
.yamai-char-select-title {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 1rem 0 0.6rem;
}
.yamai-char-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.yamai-char-btn {
  background: rgba(100,50,160,0.08);
  border: 1px solid rgba(100,50,160,0.2);
  border-radius: 10px;
  padding: 0.7rem 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 0.15s;
}
.yamai-char-btn:hover { background: rgba(100,50,160,0.16); }
.yamai-char-btn-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  overflow: hidden;
}
.yamai-char-btn-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.yamai-char-btn { position: relative; }
.yamai-cleared-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #4caf50;
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  line-height: 1.4;
  pointer-events: none;
}

/* プラットフォームバッジ */
.yamai-platform-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}
.yamai-platform-badge.platform-line      { background: rgba(0,185,0,0.15); color: #00b900; }
.yamai-platform-badge.platform-twitter   { background: rgba(100,180,255,0.15); color: #64b4ff; }
.yamai-platform-badge.platform-instagram { background: rgba(200,60,120,0.15); color: #e06090; }

/* DMメッセージ */
.yamai-dm-content {
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(100,50,160,0.15);
  border-radius: 12px;
  padding: 1rem;
}
.yamai-message {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.7;
  white-space: pre-line;
}

/* 選択肢 */
.yamai-choices-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  margin: 0.2rem 0;
}
.yamai-choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.yamai-choice-btn {
  border: 1px solid rgba(100,50,160,0.2);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-family: inherit;
  font-size: 0.85rem;
  color: #1a1a2e;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1.5;
  background: rgba(255,255,255,0.82);
}
.yamai-choice-btn:hover { background: rgba(255,255,255,0.95); }
.yamai-choice-btn.yamai-correct {
  background: rgba(76,175,80,0.18);
  border-color: #4caf50;
  color: #1a3a1a;
}
.yamai-choice-btn.yamai-miss {
  background: rgba(244,67,54,0.12);
  border-color: #f44336;
  color: #3a1a1a;
}

/* フィードバック */
.yamai-feedback {
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(100,50,160,0.15);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
}
.yamai-feedback.hidden { display: none; }
.yamai-feedback-tag {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.05em;
}
.yamai-feedback-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.yamai-next-btn { align-self: flex-end; margin-top: 0.3rem; }

/* リザルト */
.yamai-result-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem 1rem;
  background: var(--bg-deep);
  /* 明るい背景向けにテキスト色をスコープ上書き */
  --text-primary:   #3d1860;
  --text-secondary: #6040a0;
}
.yamai-result-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  text-align: center;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.yamai-result-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.yamai-result-stars {
  font-size: 2rem;
  letter-spacing: 0.1em;
}
.yamai-result-title {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-primary);
}
.yamai-result-score {
  font-size: 1rem;
  color: var(--gold-dim);
  font-weight: 700;
}
.yamai-result-reward {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.yamai-result-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
}
