/* 全体のリセットとページ背景 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  background: #02020a;
  color: #e0e0ff;
  font-family: 'Segoe UI', 'Noto Sans JP', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ゲーム全体を包むコンテナ */
#game-wrapper {
  position: relative;
  width: 480px;
  max-width: 100vw;
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.25), 0 0 60px rgba(255, 0, 255, 0.15);
  border: 2px solid rgba(0, 240, 255, 0.4);
  border-radius: 8px;
  overflow: hidden;
  background: #050510;
}

/* キャンバス */
#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #050510;
  touch-action: none; /* タッチスクロールを無効化 */
  cursor: none;       /* マウスカーソルを非表示にして没入感を向上 */
}

/* 上部ステータス表示（HUD） */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(5, 5, 16, 0.95), rgba(5, 5, 16, 0.7));
  border-bottom: 1px solid rgba(0, 240, 255, 0.35);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.7);
  pointer-events: none;
  z-index: 10;
}

#hud-stage {
  color: #00f0ff;
}

#hud-score {
  color: #39ff14;
}

#hud-lives {
  color: #ff2a6d;
}

/* モーダルオーバーレイ */
#modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 2, 10, 0.78);
  backdrop-filter: blur(4px);
  z-index: 20;
}

#modal.hidden {
  display: none;
  opacity: 0;
}

/* モーダルボックス */
.modal-box {
  width: 320px;
  max-width: 90%;
  padding: 28px 22px;
  text-align: center;
  background: rgba(10, 10, 28, 0.92);
  border: 1px solid rgba(0, 240, 255, 0.5);
  border-radius: 12px;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.25), inset 0 0 20px rgba(0, 240, 255, 0.06);
}

.modal-box h1 {
  margin-bottom: 12px;
  font-size: 24px;
  color: #00f0ff;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.8);
}

.modal-box p {
  margin-bottom: 22px;
  font-size: 14px;
  line-height: 1.6;
  color: #c8c8ff;
}

/* モーダル内ボタン */
#modal-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}

#modal-buttons button {
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #050510;
  background: linear-gradient(135deg, #00f0ff, #39ff14);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.45);
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}

#modal-buttons button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.7);
}

#modal-buttons button:active {
  transform: translateY(0);
}

/* 危険/ゲームオーバー用ボタンスタイル */
#modal-buttons button.danger {
  background: linear-gradient(135deg, #ff2a6d, #ffae00);
  box-shadow: 0 0 12px rgba(255, 42, 109, 0.45);
}

#modal-buttons button.danger:hover {
  box-shadow: 0 0 18px rgba(255, 42, 109, 0.7);
}

/* HUD内のREADMEリンク */
#hud-readme {
  color: #00f0ff;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 4px;
  background: rgba(0, 240, 255, 0.1);
  text-shadow: none;
  pointer-events: auto;
  cursor: pointer;
  transition: all 0.15s ease;
}

#hud-readme:hover {
  background: rgba(0, 240, 255, 0.25);
  border-color: rgba(0, 240, 255, 0.8);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
  color: #ffffff;
}

/* モーダルフッター（READMEリンク） */
.modal-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(0, 240, 255, 0.15);
}

.readme-link {
  display: inline-block;
  color: #00f0ff;
  font-size: 13px;
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.08);
  transition: all 0.15s ease;
  cursor: pointer;
}

.readme-link:hover {
  background: rgba(0, 240, 255, 0.25);
  border-color: rgba(0, 240, 255, 0.8);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
  color: #ffffff;
}

/* スマホ表示の調整 */
@media (max-width: 520px) {
  #game-wrapper {
    border: none;
    border-radius: 0;
  }

  #hud {
    font-size: 11px;
    padding: 0 8px;
  }

  #hud-readme {
    font-size: 10px;
    padding: 2px 6px;
  }
}
