/* common.css */

/* --- 簡易リセット --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: #1c1c1c; /* ダーク背景 */
  color: #f2f2f2;
  font-family: 'Press Start 2P', cursive, sans-serif;
  overflow-x: hidden;
  /* タップ系のズーム抑止（対応ブラウザ） */
  -ms-touch-action: manipulation;
  touch-action: manipulation;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body {
  margin: 0;
}

/* --- ヘッダー & フッター 共通 --- */
header, footer {
  background-color: #333;
  text-align: center;
  padding: 1rem;
}

header h1, footer p {
  font-size: 1rem;
  color: #f2f2f2;
  margin-bottom: 0.2rem;
}

footer p {
  font-size: 0.7rem;
  color: #ccc;
}

/* HUD items: keep scores on a single line */
.hud-item { white-space: nowrap; }

/* 共通メイン＆HUD（各ゲームで統一レイアウト） */
.game-main { padding-left: 0 !important; padding-right: 0 !important; display: flex; flex-direction: column; align-items: center; }
.game-hud { width: 360px; margin: 0.5rem auto; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.game-hud .hud-item { flex: 1; background: #333; border: 2px solid #777; padding: 6px; font-size: 10px; text-align: center; }

/* Prevent long-press selection/callout on canvases (iOS Safari) */
canvas {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* --- メイン --- */
main {
  width: 100%;
  max-width: 960px;
  margin: 1rem auto;
  padding: 0 1rem;
  text-align: center;
}

/* --- ボタン類 --- */
.btn, .menu-btn {
  display: inline-block;
  background-color: #444;
  color: #fff;
  border: 2px solid #777;
  padding: 0.5rem 1rem;
  font-size: 0.7rem;
  margin: 0.2rem;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s;
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  -webkit-touch-callout: none;
}
.btn:hover, .menu-btn:hover {
  background-color: #555;
}

/* --- リンク --- */
a {
  color: #f2f2f2;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* --- ハンバーガーメニューなどのラベル/アイコンの例 --- */
.hamburger-menu {
  display: inline-block;
  cursor: pointer;
  background-color: #444;
  border: 2px solid #777;
  padding: 0.4rem;
  font-size: 0.9rem;
  margin: 0.5rem;
}
.nav-links {
  display: none; /* toggleで表示 */
  text-align: center;
  margin: 0.5rem 0;
}
.nav-links a {
  display: block;
  margin: 0.3rem 0;
}

/* 旧メニューは全ページで非表示にする */
.hamburger-menu, .nav-links { display: none !important; }

/* --- 固定メニュー（画面左上） --- */
.fixed-menu {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  background: rgba(0,0,0,0.6);
  border: 1px solid #666;
  border-radius: 8px;
  padding: 6px 8px;
  max-height: 80vh;
  overflow: auto;
  backdrop-filter: blur(2px);
}
.fixed-menu .menu-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px;
}
.fixed-menu .menu-toggle {
  border: 1px solid #666; background: #333; color: #eee;
  font-size: 10px; padding: 2px 6px; border-radius: 6px; cursor: pointer;
}
.fixed-menu .menu-body { margin-top: 6px; }
.fixed-menu.collapsed .menu-body { display: none; }
.fixed-menu .menu-title {
  font-size: 10px;
  color: #ddd;
  margin-bottom: 6px;
  text-align: left;
}
.fixed-menu a.menu-link {
  display: block;
  font-size: 10px;
  padding: 4px 6px;
  margin: 2px 0;
  border-radius: 4px;
}
.fixed-menu a.menu-link:hover {
  background: rgba(255,255,255,0.08);
}

/* --- 画面内オーバーレイ（スコア表示など） --- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
}
.overlay.hidden { display: none; }
.overlay-card {
  background: #222;
  border: 2px solid #777;
  border-radius: 10px;
  padding: 1rem;
  min-width: 240px;
  max-width: 90vw;
  text-align: center;
}
.overlay-title { font-size: 1rem; margin-bottom: 0.6rem; }
.overlay-score { font-size: 0.85rem; margin-bottom: 0.8rem; color: #f2c14e; }
.overlay-actions { display: flex; gap: 8px; justify-content: center; }

/* --- disabled 状態のボタン --- */
.btn:disabled,
.menu-btn:disabled {
  background-color: #666;
  border-color: #555;
  cursor: not-allowed;
}

/* --- レイアウト調整（小さい画面対応） --- */
@media (max-width: 480px) {
  .btn, .menu-btn {
    font-size: 0.6rem;
    padding: 0.3rem 0.7rem;
  }
}

/* ヒーロー部 */
.hero {
  width: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; text-shadow: 2px 2px #000;
  margin-top: 1rem;
  margin-bottom: 1rem;
}
.hero-title {
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  background-color: rgba(0,0,0,0.5);
  border: 2px solid #fff;
}
