/* ===== 共通スタイル（レトロゲーム風） ===== */
:root {
  --bg: #0d0f1a;
  --bg2: #161a2e;
  --panel: #1e2340;
  --line: #2f3766;
  --text: #e8ecff;
  --muted: #8f97c7;
  --accent: #ffcc00;
  --accent2: #ff4d6d;
  --ok: #3ddc84;
  --font: "DotGothic16", "Hiragino Sans", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* ---------- ヘッダー ---------- */
.site-header {
  background: linear-gradient(180deg, var(--bg2), var(--bg));
  border-bottom: 2px solid var(--line);
  padding: 20px 16px;
  text-align: center;
}
.site-title {
  margin: 0;
  font-size: clamp(28px, 6vw, 48px);
  letter-spacing: 4px;
  color: var(--accent);
  text-shadow: 3px 3px 0 var(--accent2);
}
.site-title a { color: inherit; text-decoration: none; }
.site-sub { margin: 8px 0 0; color: var(--muted); }

/* ---------- トップ：フィルター ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }

.filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin-bottom: 24px;
}
.filters button {
  font-family: var(--font); font-size: 15px;
  background: var(--panel); color: var(--text);
  border: 2px solid var(--line); border-radius: 6px;
  padding: 6px 14px; cursor: pointer;
}
.filters button.active { border-color: var(--accent); color: var(--accent); }

/* ---------- トップ：ゲームカード ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 760px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .grid { grid-template-columns: 1fr; } }
.card {
  display: block; text-decoration: none; color: var(--text);
  background: var(--panel);
  border: 2px solid var(--line); border-radius: 10px;
  overflow: hidden;
  transition: transform .12s, border-color .12s;
}
.card:hover, .card:focus-visible { transform: translateY(-4px); border-color: var(--accent); outline: none; }
.card .thumb {
  height: 120px; display: grid; place-items: center;
  font-size: 56px; background: var(--bg2);
  image-rendering: pixelated;
}
.card .body { padding: 12px 14px 14px; }
.card h2 { margin: 0 0 4px; font-size: 20px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.tag {
  display: inline-block; margin-top: 8px; font-size: 12px;
  padding: 2px 8px; border-radius: 4px;
  background: var(--bg); border: 1px solid var(--line); color: var(--accent);
}

.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px; border-top: 1px solid var(--line); margin-top: 24px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin-bottom: 8px; }

/* 文章ページ（プライバシーポリシー等） */
.page { max-width: 760px; line-height: 1.8; }
.page h2 { font-size: 20px; color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-top: 2em; }
.page li { margin-bottom: 6px; }
.page table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 8px 0 16px; }
.page th, .page td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.page th { background: var(--panel); color: var(--accent); white-space: nowrap; }
.card[hidden] { display: none; }
.intro { margin: 40px auto 0; padding: 0; }

/* ゲームページ下の解説（ルール・遊び方・コツ） */
.guide { max-width: 760px; margin: 24px auto 0; padding: 0 16px; }
.guide h2:first-child { margin-top: 0.5em; }

/* ---------- ゲームページ共通 ---------- */
.game-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px;
  background: var(--bg2); border-bottom: 2px solid var(--line);
}
.game-header h1 { margin: 0; font-size: 22px; color: var(--accent); }
.back { text-decoration: none; font-size: 15px; }

.game-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 12px; padding: 16px;
}
.hud {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;
  font-size: 18px;
}
.hud b { color: var(--accent); }

.btn {
  font-family: var(--font); font-size: 16px;
  background: var(--accent); color: #1a1a1a;
  border: none; border-radius: 6px;
  padding: 8px 18px; cursor: pointer;
  box-shadow: 0 3px 0 #a88600;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #a88600; }
.btn.sub { background: var(--panel); color: var(--text); box-shadow: 0 3px 0 var(--line); border: 2px solid var(--line); }

.controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.controls select {
  font-family: var(--font); font-size: 15px;
  background: var(--panel); color: var(--text);
  border: 2px solid var(--line); border-radius: 6px; padding: 6px 8px;
}

.help { color: var(--muted); font-size: 14px; text-align: center; max-width: 560px; line-height: 1.6; }

canvas.screen {
  display: block;
  max-width: 100%;
  background: #000;
  border: 3px solid var(--line);
  border-radius: 6px;
  image-rendering: pixelated;
  touch-action: none;
}

/* スマホ用バーチャルパッド */
.pad { display: none; gap: 10px; justify-content: center; flex-wrap: wrap; user-select: none; -webkit-user-select: none; }
.pad button {
  width: 64px; height: 56px; font-size: 22px;
  background: var(--panel); color: var(--text);
  border: 2px solid var(--line); border-radius: 10px;
  touch-action: manipulation;
}
@media (hover: none) and (pointer: coarse) {
  .pad { display: flex; }
}
