/* ===== ブランドカラー(ここを変えるだけで世界観が変わる) ===== */
:root {
  --bg: #0f1020;
  --panel: #1a1b33;
  --accent: #ff4d6d;
  --text: #f2f2f7;
  --muted: #8d8fb0;
  --header-h: 64px;
  --side-w: 180px;
  --stage-max: 1040px;  /* ゲーム画面の最大幅 */
  --menu-max: 1080px;   /* メニューの最大幅 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== ヘッダー / フッター(全ページ共通) ===== */
.site-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 2px solid var(--accent);
}
.logo { color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.4rem; letter-spacing: .08em; }
.logo span { color: var(--accent); }
.site-header nav a { color: var(--muted); text-decoration: none; margin-left: 20px; font-size: .9rem; }
.site-header nav a:hover { color: var(--text); }

.site-footer { text-align: center; padding: 20px; color: var(--muted); background: var(--panel); }

.info { max-width: var(--stage-max); margin: 0 auto; padding: 32px 24px; width: 100%; }
.info h2 { margin-bottom: 12px; color: var(--accent); }
.info p + p { margin-top: 8px; }
.back-link { margin-top: 20px; }
.back-link a { color: var(--muted); text-decoration: none; }
.back-link a:hover { color: var(--accent); }

.game-back-top {
  width: 100%;
  max-width: var(--stage-max);
  margin: 0 auto;
  padding: 10px 24px 0;
}
.game-back-top a {
  display: inline-block;
  color: var(--muted);
  font-size: .9rem;
  text-decoration: none;
}
.game-back-top a:hover { color: var(--accent); }

/* ===== メニューページ(ゲーム選択) ===== */
.menu-main {
  flex: 1;
  width: 100%;
  max-width: var(--menu-max);
  margin: 0 auto;
  padding: 40px 24px;
}
.hero { text-align: center; margin-bottom: 40px; }
.hero h1 { font-size: 2.6rem; letter-spacing: .1em; }
.hero h1 span { color: var(--accent); }
.hero p { margin-top: 10px; color: var(--muted); }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}
.card {
  display: block;
  background: var(--panel);
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
a.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 28px rgba(255, 77, 109, .3);
}
.card-thumb {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  font-size: 3.4rem;
  background: linear-gradient(135deg, #2a2b55, #111327);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 14px 16px 18px; }
.card-tag {
  display: inline-block;
  font-size: .72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}
.card-body h3 { margin: 8px 0 4px; font-size: 1.1rem; }
.card-body p { color: var(--muted); font-size: .85rem; line-height: 1.5; }
.card-soon { opacity: .5; cursor: default; }
.card-soon .card-tag { background: var(--muted); }

/* スマートフォンでは画像を小さくした横長カードにして、一覧を一目で見渡せるように */
@media (max-width: 640px) {
  .site-header {
    min-height: 56px;
    height: auto;
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px 14px;
    gap: 6px;
  }
  .logo { font-size: 1rem; }
  .site-header nav { display: flex; width: 100%; justify-content: center; gap: 12px; }
  .site-header nav a { margin-left: 0; font-size: .72rem; }

  .menu-main { padding: 20px 14px 28px; }
  .hero { margin-bottom: 18px; }
  .hero h1 { font-size: clamp(1.25rem, 5.8vw, 2rem); letter-spacing: .03em; }
  .hero p { margin-top: 6px; font-size: .88rem; }

  .game-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }
  .card {
    display: flex;
    align-items: center;
    min-height: 76px;
    border-radius: 10px;
  }
  .card-thumb {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    aspect-ratio: auto;
    font-size: 1.8rem;
  }
  .card-body {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 3px 8px;
    min-width: 0;
    padding: 8px 10px;
  }
  .card-tag { font-size: .65rem; }
  .card-body h3 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: .98rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .card-body p {
    grid-column: 1 / -1;
    display: -webkit-box;
    overflow: hidden;
    font-size: .76rem;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

/* ===== ゲームページ ===== */
/* 3カラム: 左サイド / ゲーム / 右サイド。ゲームは常に中央 */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, var(--stage-max)) var(--side-w);
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: 24px;
}

.side-box {
  aspect-ratio: 1 / 3;
  background: var(--panel);
  border: 1px dashed var(--muted);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  font-size: .85rem;
}

/* ゲームステージ: 16:9固定で、幅に応じて自動的に拡大縮小 */
.stage-wrap { position: relative; width: 100%; }
.stage-frame {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
  border: 3px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 0 40px rgba(255, 77, 109, .35);
  overflow: hidden;
}
.stage-frame-tall {
  aspect-ratio: 4 / 3;
  max-width: min(var(--stage-max), calc(133.333vh - 293px));
  margin-inline: auto;
}
.stage-frame canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.stage-note { margin-top: 10px; text-align: center; color: var(--muted); font-size: .8rem; }
.stage-buttons { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.stage-buttons button {
  background: transparent; color: var(--text);
  border: 1px solid var(--muted); border-radius: 6px;
  padding: 4px 14px; cursor: pointer;
}
.stage-buttons button:hover { border-color: var(--accent); }

/* 画面が狭くなったらサイドを非表示にして、ゲームを中央に */
@media (max-width: 1500px) {
  .layout { grid-template-columns: minmax(0, var(--stage-max)); }
  .side { display: none; }
}
