/* すべての要素に border-box を適用してサイズ計算をわかりやすくする */
* {
  box-sizing: border-box;
}

/* html 全体の余白をなくし高さを100%にする */
html {
  margin: 0;
  height: 100%;
}

/* 画面全体の基本レイアウト設定 */
body {
  margin: 0;
  height: 100vh;
  font-family: sans-serif;
  background: #f2f2f2;

  display: flex;
  justify-content: center;
  align-items: center;

  user-select: none;
}

/* ゲーム全体を囲むコンテナ */
.container {
  margin: 0 auto;
  background: #ffffff;
  border: 2px solid #333;

  width: 100%;
  max-width: 1196px;
  height: 540px;

  display: flex;
  flex-direction: column;
}

/* 上部ヘッダーエリア */
.game-header {
  height: 50px;
  flex: 0 0 50px;

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;

  padding: 0 12px;
  background: #ffffff;
  border-bottom: 2px solid #333;
}

/* 左側のタイマー表示 */
.header-left {
  justify-self: start;
  font-size: 16px;
  font-weight: bold;
  white-space: nowrap;
}

/* 中央のタイトル表示 */
.header-title {
  font-size: 20px;
  font-weight: bold;
  text-align: center;
}

/* 右側のハイスコア表示 */
.header-record {
  justify-self: end;
  font-size: 16px;
  font-weight: bold;
  white-space: nowrap;
}

/* メインゲームエリア */
.game-main {
  position: relative;
  flex: 1;

  overflow: hidden;

  display: grid;
  place-items: center;

  background: #000511;
  color: #ffffff;

  touch-action: none;
}

/* ボタン共通デザイン */
.btn {
  padding: 15px 50px;
  font-size: 24px;
  cursor: pointer;

  border-radius: 50px;
  border: none;

  background: #0088ff;
  color: white;
  box-shadow: 0 4px 0 #0055aa;

  transition: transform 0.05s ease;
}

/* ボタンを押したときの演出 */
.btn:active {
  transform: translateY(4px);
  box-shadow: none;
}

/* スタートボタンを最前面に表示 */
.start-btn {
  z-index: 100;
}

/* 魚を配置する海エリア */
#ocean {
  position: absolute;
  inset: 0;
  z-index: 5;
}

/* 懐中電灯のライト演出 */
#flashlight {
  position: absolute;
  width: 250px;
  height: 250px;

  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(0, 0, 0, 1) 75%
  );

  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 10;

  display: none;
}

/* 魚画像のスタイル */
.fish {
  position: absolute;
  width: 120px;
  height: auto;

  cursor: pointer;
  z-index: 8;

  touch-action: manipulation;
}

/* 結果画面 */
.result {
  position: absolute;
  inset: 0;

  display: none;

  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;

  background: rgba(0, 10, 40, 0.95);
  text-align: center;
  z-index: 200;
}

/* 結果画面のタイトル */
.result-title {
  margin: 0;
  font-size: 32px;
}

/* スコア表示 */
.result-text {
  margin: 0;
  font-size: 22px;
  font-weight: bold;
}

/* 新記録メッセージ */
.new-record {
  display: none;
  margin: 0;
  font-size: 24px;
  font-weight: bold;
}

/* ===============================
   点数ポップ表示
   =============================== */

/* 魚をタッチした時の点数ポップ */
.point-popup {
  position: absolute;
  font-size: 32px;
  font-weight: bold;
  color: #ffff66;

  text-shadow:
    2px 2px 0 #000,
    -2px 2px 0 #000,
    2px -2px 0 #000,
    -2px -2px 0 #000;

  pointer-events: none;
  z-index: 100;

  animation: popupFloat 0.8s ease-out forwards;
}

/* 点数ポップが浮き上がるアニメーション */
@keyframes popupFloat {
  0% {
    opacity: 1;
    transform: translateY(0px) scale(0.8);
  }

  20% {
    transform: translateY(-10px) scale(1.2);
  }

  100% {
    opacity: 0;
    transform: translateY(-50px) scale(1);
  }
}