/*
Theme Name: PlayBitz
Description: ミニゲームポータル用PWA対応テーマ
Version: 1.0
Author: PlayBitz
*/

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f0f1a;
  --bg2:       #1a1a2e;
  --bg3:       #16213e;
  --card:      #1e1e35;
  --card-hover:#252545;
  --pink:      #ff6b9d;
  --blue:      #60a5fa;
  --yellow:    #fbbf24;
  --green:     #34d399;
  --text:      #e2e8f0;
  --text-muted:#94a3b8;
  --border:    rgba(255,255,255,0.08);
  --radius:    14px;
  --header-h:  56px;
  /* AdSense モバイルアンカー広告のセーフエリア（モバイル底部 100px 想定） */
  --pbz-anchor-ad-gap: 0px;
}

@media (max-width: 767px) {
  :root { --pbz-anchor-ad-gap: 100px; }
  body { padding-bottom: calc(var(--pbz-anchor-ad-gap) + env(safe-area-inset-bottom)); }
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Fredoka', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(15,15,26,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.header-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--pink), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}

/* PC nav */
.site-nav { display: none; }

.site-nav a {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 20px;
  transition: color 0.2s, background 0.2s;
}

.site-nav a:hover,
.site-nav a.current {
  color: var(--text);
  background: rgba(255,255,255,0.07);
}

/* Hamburger */
.hamburger {
  width: 40px;
  height: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  border-radius: 8px;
  transition: background 0.2s;
}

.hamburger:hover { background: rgba(255,255,255,0.07); }

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer */
.mobile-nav {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 16px;
  z-index: 99;
  flex-direction: column;
  gap: 4px;
}

.mobile-nav.open { display: flex; }

.mobile-nav a {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 12px 16px;
  border-radius: 10px;
  transition: background 0.2s, color 0.2s;
}

.mobile-nav a:hover { background: var(--border); color: var(--text); }

@media (min-width: 768px) {
  .site-header { padding: 0 24px; }
  .site-nav { display: flex; gap: 4px; }
  .hamburger { display: none; }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 768px) { .container { padding: 0 24px; } }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 56px 16px 48px;
  text-align: center;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(255,107,157,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 100%, rgba(96,165,250,0.10) 0%, transparent 60%);
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--pink);
  background: rgba(255,107,157,0.1);
  border: 1px solid rgba(255,107,157,0.25);
  border-radius: 20px;
  padding: 4px 14px;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

.hero h1 .accent-pink  { color: var(--pink); }
.hero h1 .accent-blue  { color: var(--blue); }

.hero-sub {
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 28px;
  line-height: 1.7;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  padding: 13px 32px;
  background: linear-gradient(135deg, var(--pink), #c84b8a);
  color: #fff;
  border: none;
  border-radius: 50px;
  box-shadow: 0 4px 24px rgba(255,107,157,0.35);
  transition: transform 0.15s, box-shadow 0.2s;
  text-decoration: none;
}

.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(255,107,157,0.45);
}

/* ============================================================
   SECTION HEADING
   ============================================================ */
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.section-head h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.section-head .bar {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================================
   GAME CARDS GRID
   ============================================================ */
.games-section { padding: 32px 0 56px; }

/* スマホ 2 列 / タブレット 3 列 / PC 3 列 / 広 PC 4 列 */
.games-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 600px) {
  .games-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
}

@media (min-width: 900px) {
  .games-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }
}

@media (min-width: 1200px) {
  .games-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

.game-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(.22,1,.36,1), box-shadow 0.25s, border-color 0.25s;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--text);
  position: relative;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  min-height: 44px;
}

.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,107,157,0.06), rgba(96,165,250,0.06));
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.game-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.42), 0 0 0 1px rgba(255,107,157,0.22);
  border-color: rgba(255,107,157,0.22);
}

.game-card:hover::before { opacity: 1; }
.game-card:hover .game-card-thumb img { transform: scale(1.07); }

.game-card.is-active {
  border-color: rgba(96,165,250,0.42);
  box-shadow: 0 0 0 1px rgba(96,165,250,0.28), 0 14px 36px rgba(0,0,0,0.42);
}

.game-card-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, var(--bg3), var(--bg2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  overflow: hidden;
  position: relative;
}

.game-card-thumb.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      100deg,
      rgba(255,255,255,0) 15%,
      rgba(255,255,255,0.12) 38%,
      rgba(255,255,255,0.22) 50%,
      rgba(255,255,255,0.10) 62%,
      rgba(255,255,255,0) 85%
    );
  transform: translateX(-120%);
  animation: game-card-shimmer 1.45s ease-in-out infinite;
  pointer-events: none;
}

.game-card-skeleton {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.035), rgba(255,255,255,0.02)),
    linear-gradient(135deg, #27304c, #1e2237 55%, #182034);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.game-card-thumb.is-loading .game-card-skeleton {
  opacity: 1;
}

.game-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transition: opacity 0.28s ease, transform 0.45s cubic-bezier(.22,1,.36,1);
}

.game-card-thumb.is-loading img {
  opacity: 0;
  transform: scale(1.03);
}

.game-card-thumb.is-loaded img {
  opacity: 1;
  transform: scale(1);
}

.game-card-thumb .thumb-placeholder {
  font-size: 2.8rem;
  line-height: 1;
}

@keyframes game-card-shimmer {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(120%);
  }
}

.game-card-body {
  padding: 10px 12px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.game-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-card-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.45;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-card-play {
  align-self: flex-start;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--pink), var(--blue));
  padding: 5px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(255,107,157,0.25);
  pointer-events: none;
  transition: transform 0.25s, box-shadow 0.25s;
}

.game-card:hover .game-card-play {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255,107,157,0.4);
}

@media (min-width: 900px) {
  .game-card-title { font-size: 0.95rem; }
  .game-card-desc  { font-size: 0.78rem; }
  .game-card-body  { padding: 12px 14px 14px; }
}

body.game-modal-open {
  overflow: hidden;
}

.game-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: block;
  width: 100vw;
  height: 100dvh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.game-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.game-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 16, 0.76);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.game-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 1400px);
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 auto;
  padding: 18px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-modal-head {
  padding: 10px 68px 0 6px;
}

.game-modal-kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--pink);
  margin-bottom: 6px;
}

.game-modal-title {
  font-size: clamp(1.25rem, 2.6vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
}

.game-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  background: rgba(15,15,26,0.88);
  color: #fff;
  font-size: 1.9rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}

.game-modal-frame {
  flex: 1;
  min-height: 0;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(8, 10, 20, 0.92);
  box-shadow: 0 20px 48px rgba(0,0,0,0.42);
}

.game-modal-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #090b13;
}

@media (max-width: 767px) {
  .games-section {
    padding: 24px 0 44px;
  }

  .game-modal-dialog {
    padding: 12px 12px 16px;
    gap: 10px;
    width: 100%;
    height: 100dvh;
  }

  .game-modal-head {
    padding: 8px 58px 0 2px;
  }

  .game-modal-close {
    top: 12px;
    right: 12px;
    width: 48px;
    height: 48px;
    font-size: 1.7rem;
  }

  .game-modal-frame {
    border-radius: 18px;
    min-height: calc(100dvh - 110px);
  }
}

/* ============================================================
   GAME PAGE (page.php)
   ============================================================ */
.game-page-wrap {
  padding: 16px 0 0;
}

.game-page-breadcrumb {
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0 16px 12px;
  max-width: 1100px;
  margin: 0 auto;
}

.game-page-breadcrumb a { color: var(--text-muted); }
.game-page-breadcrumb a:hover { color: var(--text); }
.game-page-breadcrumb span { margin: 0 6px; opacity: 0.4; }

.game-page-title {
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0 16px 12px;
  max-width: 1100px;
  margin: 0 auto;
  color: var(--text);
}

.game-page-content {
  width: 100%;
}

/* ゲーム iframe ラッパー（figure にリセット適用） */
.playbitz-game-wrap {
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.playbitz-game-wrap iframe {
  width: 100%;
  max-width: 520px;
  height: calc(90vh - var(--pbz-anchor-ad-gap, 0px));
  max-height: 820px;
  border: none;
  display: block;
}

.playbitz-game-wrap.game-id-007 iframe {
  max-width: min(100%, 1100px);
  height: auto;
  aspect-ratio: 16 / 9;
  min-height: min(78vh, 680px);
}

@media (max-width: 767px) {
  .playbitz-game-wrap.game-id-007 iframe {
    min-height: min(72vw, 56dvh);
  }
}

@media (min-width: 768px) {
  .game-page-breadcrumb,
  .game-page-title { padding-left: 24px; padding-right: 24px; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 16px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
}

.site-footer a {
  color: var(--text-muted);
  transition: color 0.2s;
}

.site-footer a:hover { color: var(--text); }

/* ============================================================
   404
   ============================================================ */
.not-found-wrap {
  min-height: calc(100vh - var(--header-h) - 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 16px;
}

.not-found-code {
  font-size: 6rem;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(135deg, var(--pink), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.not-found-msg {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.btn-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--pink), #c84b8a);
  color: #fff;
  border: none;
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(255,107,157,0.3);
  transition: transform 0.15s, box-shadow 0.2s;
}

.btn-home:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(255,107,157,0.4);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
