@import url('https://fonts.googleapis.com/css2?family=Zen+Maru+Gothic:wght@400;500;700&display=swap');

/* ==========================================
   1. 共通ベーススタイル（html, body, ラッパー）
   ========================================== */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* 全画面共通の土台（背景やフォント、基本のパディング） */
.game-wrap {
  height: 100%;
  box-sizing: border-box;
  font-family: 'Zen Maru Gothic', var(--font-sans);
  min-height: 520px;
  background: linear-gradient(160deg, #fde8f0 0%, #fdf0f8 40%, #f5e8fc 100%);
  border-radius: var(--border-radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px 28px;
  position: relative;
}
.grecaptcha-badge {
    visibility: hidden;
}
/* ==========================================
   2. ページごとの固有レイアウト（クラス分け）
   ========================================== */

/* 【トップページ（タイトル画面）専用】 */
.top-page {
  justify-content: center; /* 縦方向の中央揃え */
  overflow: hidden;        /* はみ出し防止 */
}

/* 【女の子選択画面 専用】 */
.select-page {
  justify-content: flex-start; /* 縦方向の上揃え */
  overflow-x: hidden;
  overflow-y: auto;            /* 縦方向のみスクロールを許可 */
}

/* 選択画面のコンテンツを包むコンテナ */
.select-container {
  width: 100%;
  max-width: 900px; /* 6人並んだ時に綺麗に見える幅 */
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* 選択画面専用のスクロールバーカスタム */
.select-page::-webkit-scrollbar {
  width: 8px;
}
.select-page::-webkit-scrollbar-track {
  background: transparent;
}
.select-page::-webkit-scrollbar-thumb {
  background: #f4b0cc;
  border-radius: 10px;
}


/* ==========================================
   3. 背景のハートアニメーション
   ========================================== */
.bg-hearts {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg-heart {
  position: absolute;
  opacity: 0;
  animation: driftHeart linear infinite;
}

@keyframes driftHeart {
  0%   { opacity: 0; transform: translateY(0) rotate(var(--r)) scale(var(--s)); }
  10%  { opacity: var(--op); }
  85%  { opacity: var(--op); }
  100% { opacity: 0; transform: translateY(-560px) rotate(calc(var(--r) + 20deg)) scale(var(--s)); }
}



/* ==========================================
   5. 女の子選択画面の各パーツ
   ========================================== */
.select-title {
  font-size: 24px;
  font-weight: 700;
  color: #e040a0;
  margin-top: 8px;
  margin-bottom: 24px;
  text-shadow: 0 2px 4px rgba(240, 80, 144, 0.15);
  position: relative;
  z-index: 1;
}

.girl-list {
  list-style: none;
  padding: 0;
  margin: 0 auto 40px; /* 左右をautoにして中央揃えに */
  display: grid;
  /* スマホ対応：最小120px〜画面幅に合わせて自動折り返し */
  grid-template-columns: repeat(auto-fill, minmax(min(120px, 100%), 1fr));
  gap: 16px;
  width: 100%;
  max-width: 860px; /* ★ここがポイント：6人並んだときの最大幅に制限して7人目を防ぐ */
}

/* 項目全体のリンク（カード型） */
.girl-item-link {
  text-decoration: none;
  color: inherit;
  display: block;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(4px);
  border: 2px solid #f4b0cc;
  border-radius: 16px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(244, 176, 204, 0.2);
  transition: transform 0.15s, border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.girl-item-link:hover {
  transform: translateY(-4px);
  background: #fff;
  border-color: #f06090;
  box-shadow: 0 6px 16px rgba(240, 96, 144, 0.3);
}

.girl-item-link:active {
  transform: translateY(-1px);
}

.girl-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1; /* 正方形に統一 */
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
  background-color: #fce8f4; /* 画像読み込み前のダミー色 */
}

.girl-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.girl-name {
  font-size: 14px;
  font-weight: 700;
  color: #b0608a;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* 名前が長すぎる場合に自動で「...」にする */
}


/* ==========================================
   6. バッジ・共通フッターメニュー
   ========================================== */
.footer-menu {
  position: absolute;
  bottom: 24px;
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: #c888a8;
  z-index: 1;
}
/* ★追加：コンテンツの下に配置するためのクラス */
.footer-menu.contentBottom {
  position: relative; /* 絶対配置を解除 */
  bottom: auto;       /* 下からの固定位置をリセット */
  margin-top: auto;   /* コンテンツが少ないときは最下部に押し、多いときは下に押し出す */
  padding-top: 24px;  /* リストとの間に適度な余白を作る */
}

.footer-menu span {
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 20px;
  transition: background 0.1s;
}
.footer-menu span:hover { background: #fce8f4; color: #b0608a; }

.version-badge {
  position: absolute;
  top: 14px; right: 16px;
  font-size: 10px;
  color: #d898b8;
  letter-spacing: 0.08em;
  z-index: 1;
}

.notice-badge {
  position: absolute;
  top: 14px; left: 16px;
  font-size: 10px;
  background: #fce8f4;
  color: #c06090;
  border: 1px solid #f4c0d8;
  border-radius: 20px;
  padding: 2px 10px;
  letter-spacing: 0.05em;
  z-index: 1;
}


/* ==========================================
   8. 会話（ノベル）画面専用レイアウト
   ========================================== */

/* 会話画面全体の共通設定 */
.talk-page {
  justify-content: flex-end; /* コンテンツ（主にウィンドウ）を下に寄せる */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  padding: 0 !important; /* 全画面を有効活用するためラッパーのパディングをリセット */
}

/* キャラクター配置コンテナ */
.char-container {
  position: absolute;
  bottom: 140px; /* メッセージウィンドウの高さに合わせて少し上に浮かす（被り調整用） */
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 540px; /* キャラ画像の最大横幅 */
  height: 60vh;     /* 画面の高さに対して最大60%のサイズにする */
  display: flex;
  justify-content: center;
  align-items: flex-end;
  z-index: 2;
  pointer-events: none; /* キャラクター背面をクリック可能にする場合 */
}

/* キャラクター画像本体（胸から上を綺麗に写す設定） */
.char-img {
  height: 100%;
  width: auto;
  object-fit: contain;
  object-position: bottom center; /* 画像の下側をベースに配置 */
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

/* メッセージウィンドウ（テロップ表示枠） */
.msg-window {
  position: relative;
  z-index: 3;
  width: calc(100% - 32px); /* 左右に16pxずつの余白 */
  max-width: 800px;
  height: 160px; /* ウィンドウの高さ固定 */
  margin-bottom: 20px; /* 画面最下部との隙間 */
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  box-sizing: border-box;
  padding: 24px 28px;
  cursor: pointer; /* 画面を進めるクリックができる目印 */
  transition: border-color 0.2s;
}
/* 女性用の枠色 */
.msg-window.is-woman{
  border: 3px #ff0090 solid;
  box-shadow: 0 8px 24px rgba(255, 0, 144, 0.2);
}
.msg-window.is-woman .msg-name-box{
	background:#ff0090;
}
.msg-window.is-woman:hover {
  border-color: #d00075; /* ホバー時は少し暗めのピンク */
}
.msg-window.is-woman:hover .msg-name-box{
	background:#d00075;
}

/* 男性用の枠色 */
.msg-window.is-man {
  border: 3px #0078ff solid;
  box-shadow: 0 8px 24px rgba(0, 120, 255, 0.2);
}
.msg-window.is-man .msg-name-box{
	background:#0078ff;
}
.msg-window.is-man:hover {
  border-color: #0056b3; /* ホバー時は少し暗めのブルー */
}
.msg-window.is-man:hover .msg-name-box{
	background:#0056b3;
}

/* 名前枠 */
.msg-name-box {
  position: absolute;
  top: -18px;
  left: 24px;
  background: linear-gradient(135deg, #f06090 0%, #e040a0 100%);
  color: #fff;
  padding: 4px 20px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 4px 10px rgba(240, 80, 144, 0.3);
  letter-spacing: 0.05em;
}

/* テキスト表示エリア */
.msg-text-area {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.msg-text {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: #4a303a;
  line-height: 1.6;
  letter-spacing: 0.05em;
  white-space: nowrap; /* 好みに応じて、自動改行させる場合は通常のままで */
  white-space: normal;
}

/* 送りマーク（点滅矢印） */
.msg-next-arrow {
  position: absolute;
  bottom: 12px;
  right: 20px;
  font-size: 12px;
  color: #e040a0;
  animation: blinkArrow 0.8s ease-in-out infinite alternate;
}

@keyframes blinkArrow {
  0%   { opacity: 0.3; transform: translateY(0); }
  100% { opacity: 1; transform: translateY(3px); }
}

/* スマホ等、画面が小さいときの調整 */
@media (max-width: 600px) {
  .char-container {
    height: 50vh; /* スマホではキャラを少し小ぶりに */
    bottom: 130px;
  }
  .msg-window {
    height: 130px;
    padding: 18px 20px;
    margin-bottom: 12px;
    width: calc(100% - 16px); /* 左右の余白を狭める */
  }
  .msg-text {
    font-size: 14px;
    line-height: 1.5;
  }
  .msg-name-box {
    font-size: 13px;
    padding: 2px 16px;
  }
}