/* =========================================================
   Single Gacha Page Styles
   ========================================================= */

/* =========================
   レイアウト（本体）
   ========================= */
.gacha-single {
  max-width: 450px;
  width: 92vw;
  margin: 16px auto 0;
}

/* バナー */
.gacha-banner {
  display: block;
  max-width: 100%;
  height: auto;
  margin-top: 10px;
}

/* ラインナップ画像（通常はレスポンシブ） */
.gacha-lineup {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ラインナップを原寸で表示したい時は .is-fullsize を併用 */
.gacha-lineup.is-fullsize {
  width: auto;
  max-width: none;
  height: auto;
  display: inline-block;
}

/* No Image のプレースホルダ */
.gacha-visual__placeholder {
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  aspect-ratio: 9/16;
}

/* =========================
   固定購入フッター（footer-2）
   ========================= */
.gacha-footer2 {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
}

.gf2-inner {
  width: min(94vw, 450px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  background: silver; /* TODO: テーマ色に合わせて変更可 */
}

.gf2-stats {
  display: flex;
  gap: 16px;
  align-items: center;
}

.gf2-left__label {
  color: #6b7280;
  margin-right: 4px;
}
.gf2-left__num {
  font-size: 18px;
}
.gf2-left__sep {
  color: #6b7280;
}

.gf2-price {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.gf2-coin {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(#fde68a, #f59e0b);
  display: inline-block;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.08);
}

/* フッターボタン */
.gf2-actions {
  display: flex;
  gap: 8px;
}

.gf2-btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  background: #111;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gf2-btn--accent {
  background: #ef4444;
}

.gf2-btn.is-disabled {
  background: #a1a1aa;
  cursor: not-allowed;
  pointer-events: none;
}

.gf2-sc .button,
.gf2-sc a {
  border-radius: 10px !important;
  padding: 10px 14px !important;
  font-weight: 700 !important;
}

/* SP調整 */
@media (max-width: 420px) {
  .gf2-inner {
    width: 94vw;
  }
  .gf2-actions {
    justify-content: space-between;
  }
}

/* =========================
   ガチャ演出モーダル
   ========================= */
.gacha-ov {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    sans-serif;
  /* 調整用カスタムプロパティ */
  --landing-y: -54%; /* 単発の最終位置（-50%=真ん中） */
  --grid-top: 10%; /* 5連一覧の上余白 */
}
.gacha-ov[hidden] {
  display: none;
}

.gacha-ov__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: saturate(130%) blur(3px);
}

.gacha-ov__stage {
  position: relative;
  z-index: 1;
  width: min(94vw, 640px);
  padding: 22px 20px 18px;
  border-radius: 18px;
  background: #0a0f24;
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 16px;
  justify-items: center;
}

.gacha-ov__header {
  width: 100%;
  display: flex;
  justify-content: center;
}
.gacha-ov__title {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.gacha-ov__machine {
  width: 100%;
  display: grid;
  gap: 14px;
  justify-items: center;
}

.gacha-ov__window {
  width: 100%;
  height: 260px;
  border-radius: 14px;
  background: radial-gradient(
    120% 90% at 50% 0%,
    #14204a,
    #0c1433 60%,
    #080d22
  );
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.06);
  isolation: isolate;
}

.gacha-ov__lever {
  width: 80px;
  height: 10px;
  border-radius: 6px;
  background: #64748b;
  transform-origin: left center;
}

/* 抽選画像（中央基準で落とす） */
.gacha-ov__image {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -320px);
  width: min(70%, 360px);
  max-height: 75%;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  will-change: transform;
  z-index: 3;
}

.gacha-ov__card {
  width: min(92%, 520px);
  padding: 18px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(2px) saturate(120%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: grid;
  gap: 8px;
  justify-items: center;
}

.gacha-ov__badge {
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.gacha-ov__desc {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
}

.gacha-ov__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.gacha-ov__start,
.gacha-ov__close,
.gacha-ov__contact {
  appearance: none;
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.gacha-ov__start {
  background: #38bdf8;
  color: #041014;
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.35);
}
.gacha-ov__close {
  background: #10b981;
  color: #062d27;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
  font-weight: 700;
}
.gacha-ov__contact {
  background: #fbbf24;
  color: #3b2f06;
  box-shadow: 0 6px 18px rgba(251, 191, 36, 0.35);
  display: inline-block;
}

.gacha-ov__start[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}
.gacha-ov__close:hover,
.gacha-ov__start:hover,
.gacha-ov__contact:hover {
  filter: brightness(1.05);
}

/* 効果 */
.gacha-ov__rays {
  position: absolute;
  inset: -20%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 255, 255, 0.1) 0deg,
    rgba(255, 255, 255, 0) 8deg,
    rgba(255, 255, 255, 0.1) 16deg
  );
  filter: blur(2px) saturate(140%);
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
  z-index: 1;
}

.gacha-ov__burst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35);
  pointer-events: none;
  opacity: 0;
  z-index: 2;
}

.gacha-ov__fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  z-index: 4;
}

.gacha-ov__codeimg {
  max-width: 92%;
  height: auto;
  display: none;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.gacha-ov__codeimg.is-show {
  display: block;
}

.gacha-ov__readyimg {
  position: absolute;
  inset: 8% 10%;
  width: 80%;
  height: auto;
  object-fit: contain;
  opacity: 0.95;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
  transition: opacity 0.2s ease;
  z-index: 0;
}
.gacha-ov.is-anim .gacha-ov__readyimg,
.gacha-ov.is-result .gacha-ov__readyimg {
  opacity: 0;
}

/* アニメーション */
@keyframes lever {
  0% {
    transform: rotate(0);
  }
  30% {
    transform: rotate(18deg);
  }
  100% {
    transform: rotate(0);
  }
}
.gacha-ov.is-anim .gacha-ov__lever {
  animation: lever 0.9s ease-in-out 1 both;
}

@keyframes drop-spin {
  0% {
    transform: translate(-50%, -320px) rotate(0);
  }
  60% {
    transform: translate(-50%, var(--landing-y)) rotate(360deg);
  }
  75% {
    transform: translate(-50%, calc(var(--landing-y) - 16px)) rotate(360deg);
  }
  100% {
    transform: translate(-50%, var(--landing-y)) rotate(360deg);
  }
}
.gacha-ov.is-anim .gacha-ov__image {
  animation: drop-spin 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s 1 both;
}

@keyframes bounce-center {
  0% {
    transform: translate(-50%, var(--landing-y));
  }
  50% {
    transform: translate(-50%, calc(var(--landing-y) - 10px));
  }
  100% {
    transform: translate(-50%, var(--landing-y));
  }
}
.gacha-ov.is-result .gacha-ov__image {
  transform: translate(-50%, var(--landing-y));
  animation: bounce-center 0.9s ease-in-out infinite 0.1s;
}

.gacha-ov.is-pop .gacha-ov__rays {
  animation: rays-rotate 2.2s linear infinite, rays-reveal 0.35s ease forwards;
}
@keyframes rays-rotate {
  to {
    transform: rotate(360deg) scale(1);
  }
}
@keyframes rays-reveal {
  to {
    opacity: 0.75;
  }
}

.gacha-ov.is-pop .gacha-ov__fx {
  opacity: 1;
}
.gacha-ov.is-pop .gacha-ov__burst {
  animation: burst-pop 0.6s ease-out forwards;
}
@keyframes burst-pop {
  0% {
    transform: scale(0.4);
    opacity: 0;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35);
  }
  60% {
    transform: scale(1.4);
    opacity: 0.9;
    box-shadow: 0 0 0 14px rgba(255, 255, 255, 0.18);
  }
  100% {
    transform: scale(1);
    opacity: 0;
    box-shadow: 0 0 0 40px rgba(255, 255, 255, 0);
  }
}

/* 5連の一覧（中央寄せ・上余白は --grid-top で調整） */
.gacha-ov__summary {
  position: absolute;
  inset: var(--grid-top) 8% 10% 8%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  place-content: center;
  align-content: center;
  justify-items: center;
  grid-auto-rows: auto;
  z-index: 5;
}
.gacha-ov__summary[hidden] {
  display: none;
}
.gacha-ov__thumb {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: transparent;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.gacha-ov__thumb img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

/* 一覧時は大画像を消す */
.gacha-ov.is-list .gacha-ov__image {
  display: none !important;
}

/* アクセシビリティ：動き軽減設定の尊重 */
@media (prefers-reduced-motion: reduce) {
  .gacha-ov__image {
    animation: none !important;
    transform: translate(-50%, var(--landing-y)) !important;
  }
  .gacha-ov__rays,
  .gacha-ov__burst,
  .gacha-ov__fx {
    display: none !important;
  }
}
