
/* ==============================
   game layout
============================== */

/* ヘッダーの下からスタートさせる用の余白 */


.main--game .game {
  padding: 64px 0 24px;
}

/* 本体（オレンジのゲーム機）を中央に配置 */
.game-device {
  position: relative;          /* 重ね合わせの親 */
  width: min(95vw, 500px, 54vh);
  margin: 1svh auto 4vw;
}

/* オレンジ本体画像 */
.game-device__frame {
  position: relative;          /* ← position 付けないと z-index が効かない */
  display: block;
  width: 100%;
  height: auto;
  z-index: 3;                  /* 一番上 */
  pointer-events: none;        /* クリック判定は液晶側に渡したいなら */
}

/* ////////////////////////////
    pc 769px～
//////////////////////////// */

@media screen and (min-width: 769px) {

  .main--game .game {
    padding: 120px 0 0;
    transform: translateX(0vw);
  }

  .game {
    display: flex;
    flex-direction: row-reverse;
    justify-content: center;
    align-items: flex-start;
    gap: 4%;
  }

  .game-device {
    flex: 0 0 auto;
    height: auto;              /* ★ これも 100% はやめて自然な高さに */
    width: auto;
    margin: 0;
  }

  .game-device__frame {
    height: auto;              /* ★ 画像比率で決めてもらう */
    width: 100%;
    display: block;
    margin: 0 auto;
    max-height: 82vh;          /* はみ出し防止用。邪魔なら外してOK */
  }
}

/* ▼ PC（1025px〜）：少し左寄せして画面バランスを取る */
@media screen and (min-width: 1025px) {
  .main--game .game {
    transform: translateX(-2vw); /* ← これが今の設定 */
  }
}


/* ==============================
   ゲームボーイのボタン（前／次）
============================== */


.game-device__pager {
  position: absolute;
  width: 46px;        /* ここは端末のボタンサイズに合わせて微調整 */
  height: 46px;
  border-radius: 50%; /* 丸ボタン想定 */
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 4;         /* フレームより前 */

  /* デフォルトでは何も見えない & アニメーション用 */
  outline: none;
}

/* 左ボタン（前へ）位置 */
.game-device__pager--prev {
  left: 9%;
  bottom: 18.5%;
}

/* 右ボタン（次へ）位置 */
.game-device__pager--next {
  right: 60%;
  bottom: 18.5%;
}

/* ▼擬似要素で“押してる見た目”を作る */
.game-device__pager::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* 最初はほぼ見えない薄いハイライト */
  background: rgba(255, 255, 255, 0);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0); /* 影も最初はゼロ */

  transform: translateY(0) scale(1);
  opacity: 0;  /* 画像を邪魔しないように透明スタート */

  transition:
    opacity 0.08s ease,
    transform 0.08s ease,
    box-shadow 0.08s ease,
    background 0.08s ease;
}

/* ホバー時：ちょっとだけ「ここ押せそう」感 */
@media (hover: hover) {
  .game-device__pager:hover::before {
    opacity: 0.25;
    background: rgba(255, 255, 255, 0.15);
  }
}

/* クリック中：ぐっと沈んで暗くなる */
.game-device__pager:active::before {
  opacity: 0.4;
  background: rgba(0, 0, 0, 0.2);
  transform: translateY(2px) scale(0.94);
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.5),
    inset 0 2px 3px rgba(0, 0, 0, 0.5);
}


/* ==============================
   液晶エリア
============================== */

/*
  game-t.webp の中の「液晶」の位置に合わせて、
  絶対配置で液晶エリアを乗せる
  ※top / left / right / bottom は実際の絵を見ながら微調整してね
*/
/* 液晶部分 */
.game-device__screen {
  position: absolute;
  top: 5%;
  left: 7%;
  right: 7.5%;
  bottom: 39%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  background:
    linear-gradient(
     rgba(255, 255, 255, 0.8),
     rgba(255, 255, 255, 0.8)),
     url("../images/game/banner-000.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 2;
}

/* 液晶内のコンテンツ */
.game-info {
  position: relative;
  font-size: 1.4rem;
  line-height: 1.8;
  padding: 20px 16px;
  z-index: 3;  /* 背景＆白レイヤーより前に */
}

/* アイコン＋タイトルを横並び中央揃え */
.game-info__header {
  display: flex;
  align-items: center; /* ←縦中央揃え */
  gap: 8px; /* アイコンとタイトルの隙間 */
  margin-bottom: 8px;
}

.game-info__thumb {
  width: 64px;
  border: 1px solid var(--black);
  border-radius: 16px;
  flex-shrink: 0; /* アイコンが縮まないように固定 */
}

.game-info__thumb-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
}

.game-info__title {
  font-size: 1.6rem;
  line-height: 1.6;
}

/* 説明文 */
.game-info__text {
  margin: 12px 0;
}

/* Download ラベル */
.game-info__download-label {
  text-align: center;
  font-size: 1.4rem;
  margin: 0 0 8px;

  display: flex;                /* ここだけでOK */
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.game-info__download-label .arrow {
  width: 6px;
  height: auto;
}

/* Download + ボタン全体のラッパー */
.game-info__store-wrap {
  display: none;     /* ★最初は「丸ごと」非表示 */
}

/* ゲームが選択されたら（has-data）出す */
.game-info.has-data .game-info__store-wrap {
  display: block;
}

/* DLボタンエリア */
.game-info__store {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

/* 各バッジ */
.game-info__badge {
  display: inline-block;
  flex: 0 0 48%;   /* 2つでほぼ横並びに */
}

.game-info__badge img {
  display: block;
  width: 100%;
  height: auto;
}

.game-info__coming {
  display: none;             /* JSで必要なときだけ block にする */
  margin-top: 8px;
  font-size: 1.2rem;
  text-align: center;
}


/* 表示アニメ */
/* ゲーム詳細表示アニメーション（右からスライドイン） */
.game-info.is-animating {
  animation: gameInfoSlideIn 0.35s ease-out;
}

@keyframes gameInfoSlideIn {
  0% {
    opacity: 0;
    transform: translateX(24px); /* 右からちょっとズレてスタート */
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 矢印アニメ */
@keyframes arrowBounce {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(2px); }
  100% { transform: translateY(0); }
}

.arrow--bounce {
  animation: arrowBounce 1.5s infinite ease-in-out;
}

/* Download の文字アニメ */
.download-text {
  display: inline-flex;
  gap: 1px;            /* 好みで文字の間隔調整 */
}

.download-char {
  display: inline-block;
  animation: downloadJump 1.2s ease-in-out infinite;
}

/* 1文字ずつ少しずつ遅らせる → 波みたいに動く */
.download-char:nth-child(1) { animation-delay: 0s; }
.download-char:nth-child(2) { animation-delay: 0.1s; }
.download-char:nth-child(3) { animation-delay: 0.2s; }
.download-char:nth-child(4) { animation-delay: 0.3s; }
.download-char:nth-child(5) { animation-delay: 0.4s; }
.download-char:nth-child(6) { animation-delay: 0.5s; }
.download-char:nth-child(7) { animation-delay: 0.6s; }
.download-char:nth-child(8) { animation-delay: 0.7s; }

@keyframes downloadJump {
  0%   { transform: translateY(0); }
  20%  { transform: translateY(-3px); }  /* 上にちょいピョン */
  40%  { transform: translateY(0); }     /* 戻る */
  100% { transform: translateY(0); }     /* しばらく待機 → 次の文字の番 */
}


/* ////////////////////////////
    pc 769px～
//////////////////////////// */

@media screen and (min-width: 769px) {

  .game-device__screen {
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.35) transparent;
  }

    /* Chrome / Edge / Safari */
  .game-device__screen::-webkit-scrollbar {
    width: 6px;  /* ← 細さ調整：5〜8pxがオススメ */
  }

  .game-device__screen::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 999px;
  }

  .game-device__screen::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35); /* ← つまみも薄め */
    border-radius: 999px;
  }

  .game-device__screen::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.55); /* ← hover時だけ少し濃く */
  }


  .game-info {
      font-size: 1.6rem;
      line-height: 2;
      padding: 5.3%;
  }
  
  .game-info__header {
    gap: 24px; /* アイコンとタイトルの隙間 */
    margin-bottom: 24px;
  }

  .game-info__thumb {
    width: 100px;
    border-radius: 22px;
  }

  .game-info__thumb-img {
    border-radius: 22px;
  }

  .game-info__title {
    font-size: 2.2rem;
    line-height: auto;
  }

  .game-info__text {
    margin: 24px 0;
  }

  .game-info__download-label {
    font-size: 2rem;
    margin: 0 0 10px;
    gap: 8px;
  }

  .game-info__download-label .arrow {
    width: 9px;
  }

  .game-info__store {
    gap: 10px;
  }

  .game-info__badge {
    flex: 0 0 40%;
  }

  .game-info__coming {
    font-size: 1.5rem;
    margin-top: 12px;
  }

}


/* ==============================
   下のゲームセレクト横スクロール
============================== */

.game-select {
  padding: 16px 0 0;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(2px);
  position: relative;
  left: auto;
  bottom: auto;
  width: 100%;
  z-index: 30;
}

.game-select__label {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

/* ベースの矢印 */
.sel-arrow {
  display: inline-block;
  width: 7px;
  height: 15px;
  background-image: url("../images/game/3arrow.svg");
  background-size: contain;
  background-repeat: no-repeat;
  margin: -2.5px 4px;
}

/* 左矢印は -90° 回転 → <<< */
.sel-arrow--left {
  transform: rotate(90deg);
  animation: arrowMoveLeft 1.5s infinite ease-in-out;
}

/* 右矢印は 90° 回転 → >>> */
.sel-arrow--right {
  transform: rotate(-90deg);
  animation: arrowMoveRight 1.5s infinite ease-in-out;
}

/* フィルター */
.game-select__filter {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 16px 2px;
}

.game-filter {
  min-width: 70px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--black);
  background: rgba(255, 255, 255, 0.6);
  font-size: 1.2rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.15s;
}

.game-filter.is-active {
  background: #ffb347; /* お好みのアクセント色に変えてOK */
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
  transform: translateY(1px);
}

.game-filter:hover {
  background: #ffe34798;
}

.game-filter:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}


/* スクロールの「実体」はこっち（ul） */
.game-select__list {
  display: flex;
  gap: 8px;
  padding: 10px 10px;  /* ← 上下にちょっとクッションを入れる */
  overflow-x: auto;
  overflow-y: visible; /* ← 縦方向にはみ出してもOKにする */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.game-select__list::-webkit-scrollbar {
  display: none;                  /* Chrome / Safari */
}

/* 各アイテム枠 */
.game-select__item {
  position: relative;
  width: 60px;
  height: 60px;
  background: none;
  border: none;
  padding: 0;
  flex: 0 0 auto;
  cursor: pointer;
  outline: none;

  /* ここにアニメーションをまとめる */
  transition: transform 0.2s ease;
}

/* 選択時：見た目だけ大きくする（レイアウトは変えない） */
.game-select__item.is-active {
  transform: scale(1.16); /* 1.15〜1.2くらいで好み調整してOK */
  margin: -5px 12px 0; /* ちょい上にポップ */
  z-index: 3;            /* 周りより前に出したいとき用（任意） */
}

/* サムネイル画像（中に90%で中央寄せ） */
.game-select__item img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90%;
  height: 90%;
  object-fit: cover;
  border-radius: 4px;
  transform: translate(-50%, -50%);
  z-index: 1;
}

/* フレーム */
.game-select__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../images/game/game-s.webp");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  z-index: 2;
}

/* ラッパーは「入れ物」だけ。スクロールは持たせない */
.game-select__list-wrapper {
  overflow: visible;
}

/* スクロールバー */
.game-select__scrollbar {
  height: 3px;
  background: #ddd;
  width: calc(100% - 16px); /* 左右 8px 余白 */
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.game-select__scrollbar span {
  display: block;
  height: 3px;
  background: #999;
  width: 30%; /* JSで上書きされるので仮値でOK */
  transform: translateX(0);
}

/* ★矢印アニメ */
@keyframes arrowMoveLeft {
  0%   { transform: translateX(0) rotate(90deg); }
  50%  { transform: translateX(-3px) rotate(90deg); }
  100% { transform: translateX(0) rotate(90deg); }
}

@keyframes arrowMoveRight {
  0%   { transform: translateX(0) rotate(-90deg); }
  50%  { transform: translateX(3px) rotate(-90deg); }
  100% { transform: translateX(0) rotate(-90deg); }
}

/* // SP少サイズ対応 // */

/* 必要なら 700px ↔ 720px くらいで微調整してOK */
@media screen and (max-height: 757px) {
  .game-select {
    position: fixed;
    left: 0;
    right: 0;
    bottom: env(safe-area-inset-bottom); /* iPhoneの下安全領域 */
    width: 100%;
  }
}

/* ////////////////////////////
    pc 769px～
//////////////////////////// */

@media screen and (min-width: 769px) {

  .game-select {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    width: auto;

    padding: 32px 16px 24px;
    flex: 1;
    max-width: 30%;
    height: 70vh;
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 8px;

    display: flex;
    flex-direction: column;
  }

  .game-select__label {
    font-size: 2.8rem;
    margin-bottom: 20px;
  }

  .game-select__filter {
    margin: 0 16px 8px;
  }
  
  .game-filter {
    min-width: 98px;
    padding: 4px 12px;
    font-size: 1.6rem;
  }

  .game-select__list {
    display: grid;
    grid-template-columns: repeat(
      auto-fit,
      minmax(clamp(70px, 5vw, 100px), 1fr)
    );
    gap: 6%;

    width: 100%;
    margin: 0 auto;
    padding: clamp(8px, 2vw, 20px) clamp(12px, 2vw, 30px);

    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.35) transparent; /* ← track を透明へ */

    justify-items: center;
    align-items: start;   /* アイテム単体の縦伸び防止 */
    align-content: start; /* ★ 行を縦に引き伸ばさない！ここがポイント */
  }

  .game-select__list::-webkit-scrollbar {
    width: 6px;
  }

  .game-select__list::-webkit-scrollbar-track {
    background: transparent;
  }

  .game-select__list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.35);
    border-radius: 999px;
  }


  .game-select__scrollbar {
    display: none;
  }

  .sel-arrow {
    width: 10px;
    height: 21px;
    margin: -0.5px 4px;
  }

  /* アイテム本体：自分のサイズをキープ */
  .game-select__item {
    position: relative;
    width: clamp(70px, 6vw, 120px);
    aspect-ratio: 1 / 1;   /* 正方形キープ */
    height: auto;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    outline: none;
    transition: transform 0.2s ease;
  }
  
  
  .game-select__item:hover {
    transform: scale(1.06);
  }

  .game-select__item.is-active {
    transform: scale(1.2);  /* 大きく見せるのは transform だけにする */
    margin:0;
    z-index: 3;
  }

  /* 矢印アニメ（縦方向に動かす版） */
  @keyframes arrowMoveLeft {
    0%   { transform: translateY(0) rotate(0deg); }
    50%  { transform: translateY(3px) rotate(0deg); }
    100% { transform: translateY(0) rotate(0deg); }
  }

  @keyframes arrowMoveRight {
    0%   { transform: translateY(0) rotate(0deg); }
    50%  { transform: translateY(3px) rotate(0deg); }
    100% { transform: translateY(0) rotate(0deg); }
  }
}

/* ==============================
   game-device / game-select 入場アニメ
============================== */

/* 初期状態：ちょっと下＆透明 */
.game-device,
.game-select {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* 黒バーが開いたあとに付けるクラス */
.game-device.is-enter,
.game-select.is-enter {
  opacity: 1;
  transform: translateY(0);
}

/* ===== タップ操作の最適化（ズーム防止） ===== */

/* 連打するボタン系 */
.game-device__pager,
.game-select__item,
.game-filter,
button,
a {
  touch-action: manipulation; /* ダブルタップズーム防止 */

  -webkit-tap-highlight-color: transparent; /* 青ハイライト消す */
  -webkit-user-select: none;
  user-select: none;
}

/* 画像タップ時の誤動作防止 */
img {
  pointer-events: auto;
  -webkit-user-drag: none;
}