/* すべての要素に対してボックスサイズをborder-boxに設定（paddingやborderを含めたサイズ計算） */
* {
/* 要素のサイズ計算方法を変更（paddingとborderを含める） */
  box-sizing: border-box;
/* モバイルでタップ時のハイライトを無効化 */
  -webkit-tap-highlight-color: transparent;
}

/* html全体の余白と高さをリセット */
html {
/* デフォルトの余白を削除 */
  margin: 0;
/* 高さを画面いっぱいにする */
  height: 100%;
}

/* bodyの基本レイアウト設定（中央配置） */
body {
/* デフォルトの余白を削除 */
  margin: 0;
/* 画面の高さに合わせる */
  height: 100vh;
/* フォントを設定 */
  font-family: sans-serif;
/* 背景色を白に */
  background: #fff;
/* Flexboxを使用 */
  display: flex;
/* 横方向中央揃え */
  justify-content: center;
/* 縦方向中央揃え */
  align-items: center;
}

/* ゲーム全体のコンテナ */
.container {
/* 中央寄せ */
  margin: 0 auto;
/* 背景色 */
  background: #ffffff;
/* 枠線 */
  border: 2px solid #333;
/* 横幅 */
  width: 100%;
/* 最大幅 */
  max-width: 1196px;
/* 高さ */
  height: 540px;
/* Flexbox */
  display: flex;
/* 縦方向に並べる */
  flex-direction: column;
/* 背景画像 */
  background-image: url("assets/bg.png");
/* 画像を全面に表示 */
  background-size: cover;
/* 中央配置 */
  background-position: center;
/* テキスト選択禁止 */
  user-select: none;
/* Safari対応 */
  -webkit-user-select: none;
/* はみ出しを隠す */
  overflow: hidden;
/* 疑似要素の基準 */
  position: relative;
}

/* 半透明の白オーバーレイ */
.container::before {
/* 空の要素を生成 */
  content: "";
/* 親要素基準で配置 */
  position: absolute;
/* 全体に広げる */
  inset: 0;
/* 半透明の白 */
  background: rgba(255, 255, 255, 0.25);
/* 背面レイヤー */
  z-index: 0;
}

/* ヘッダー部分 */
.game-header {
/* 高さ */
  height: 50px;
/* 内側余白 */
  padding: 4px 14px;
/* 高さ固定 */
  flex: 0 0 50px;
/* Gridレイアウト */
  display: grid;
/* 3カラム構成 */
  grid-template-columns: 1fr auto 1fr;
/* 縦中央揃え */
  align-items: center;
/* 半透明背景 */
  background: rgba(255, 255, 255, 0.65);
/* 背景ぼかし */
  backdrop-filter: blur(4px);
/* 下の境界線 */
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
/* 下のみ角丸 */
  border-radius: 0 0 12px 12px;
}

/* ヘッダー左側（余白用） */
.header-left {
/* 最小幅 */
  min-width: 1px;
}

/* ヘッダー中央（メッセージ） */
.header-center {
/* 中央揃え */
  text-align: center;
/* 行間 */
  line-height: 1.1;
}

/* ヘッダーとメインを前面に表示 */
.game-header,
.game-main {
/* 重なり順調整 */
  position: relative;
/* 前面に表示 */
  z-index: 1;
}

/* タイトルメッセージ */
.target-message {
/* 余白なし */
  margin: 0;
/* 文字サイズ */
  font-size: 22px;
/* 太字 */
  font-weight: bold;
/* 色 */
  color: #1b5e20;
}

/* 右側スコア表示 */
.header-right {
/* 右寄せ */
  justify-self: end;
/* 文字サイズ */
  font-size: 18px;
/* 太字 */
  font-weight: bold;
/* 色 */
  color: #333;
/* 改行防止 */
  white-space: nowrap;
}

/* ゲームメインエリア */
.game-main {
/* 基準位置 */
  position: relative;
/* 残り領域使用 */
  flex: 1;
/* はみ出し非表示 */
  overflow: hidden;
/* Grid */
  display: grid;
/* 中央配置 */
  place-items: center;
}

/* ボタン共通スタイル */
.btn {
/* 内側余白 */
  padding: 18px 40px;
/* 文字サイズ */
  font-size: 24px;
/* 太字 */
  font-weight: bold;
/* 枠なし */
  border: none;
/* 丸ボタン */
  border-radius: 999px;
/* 背景色 */
  background: #18c56e;
/* 文字色 */
  color: white;
/* カーソル変更 */
  cursor: pointer;
/* 影 */
  box-shadow: 0 6px #0e9f56;
/* アニメーション */
  transition: all 0.15s ease;
/* 前面 */
  z-index: 20;
}

/* ホバー時の色変化 */
.btn:hover {
/* 明るい色に */
  background: #1edc7c;
}

/* クリック時 */
.btn:active {
/* 下に移動 */
  transform: translateY(4px);
/* 影を小さく */
  box-shadow: 0 2px #0e9f56;
}

/* ゲーム表示パネル */
.game-panel {
/* 全体配置 */
  position: absolute;
/* 全体に広げる */
  inset: 0;
/* 非表示 */
  display: none;
/* はみ出し非表示 */
  overflow: hidden;
}

/* 結果表示画面 */
.result {
/* 全体配置 */
  position: absolute;
/* 全体に広げる */
  inset: 0;
/* 非表示 */
  display: none;
/* 中央揃え */
  align-items: center;
/* 横中央 */
  justify-content: center;
/* 縦並び */
  flex-direction: column;
/* 要素間の間隔 */
  gap: 16px;
/* 中央揃え */
  text-align: center;
/* 内側余白 */
  padding: 20px;
/* 半透明黒背景 */
  background: rgba(0, 0, 0, 0.7);
/* 最前面 */
  z-index: 100;
}

/* 結果タイトル */
.result-title {
/* 余白なし */
  margin: 0;
/* 文字サイズ */
  font-size: 40px;
/* 色 */
  color: #ffeb3b;
}

/* 結果テキスト */
.result-text {
/* 余白なし */
  margin: 0;
/* 文字サイズ */
  font-size: 30px;
/* 太字 */
  font-weight: bold;
/* 色 */
  color: #ffffff;
}

/* 新記録表示 */
.new-record {
/* 余白なし */
  margin: 0;
/* 文字サイズ */
  font-size: 26px;
/* 太字 */
  font-weight: bold;
/* 色 */
  color: #ffeb3b;
}

/* =========================
   かけざんモンスターゲーム用
   ========================= */

/* ゲーム全体を左右に分ける */
.monster-wrapper {
/* 横幅 */
  width: 100%;
/* 高さ */
  height: 100%;
/* Flexbox */
  display: flex;
}

/* 左側：モンスター表示エリア */
.left-panel {
/* 可変幅 */
  flex: 1;
/* Flexbox */
  display: flex;
/* 横中央 */
  justify-content: center;
/* 縦中央 */
  align-items: center;
/* 背景画像 */
  background-image: url("assets/bg.png");
/* 全体に表示 */
  background-size: cover;
/* 中央配置 */
  background-position: center;
/* 繰り返しなし */
  background-repeat: no-repeat;
/* 右の境界線 */
  border-right: 2px solid rgba(0,0,0,0.1);
/* はみ出し非表示 */
  overflow: hidden;
}

/* モンスター */
#monster {
/* サイズ */
  font-size: 100px;
/* 行間 */
  line-height: 1;
/* アニメーション */
  transition: transform 0.1s linear;
/* 拡大の基準 */
  transform-origin: center center;
}

/* 右側：問題とテンキー */
.right-panel {
/* 幅 */
  width: 420px;
/* Flexbox */
  display: flex;
/* 縦並び */
  flex-direction: column;
/* 上下に配置 */
  justify-content: space-between;
/* 内側余白 */
  padding: 14px;
/* 背景 */
  background: #ffffff;
}

/* タイムとスコア表示 */
#status {
/* Flexbox */
  display: flex;
/* 均等配置 */
  justify-content: space-around;
/* 縦中央 */
  align-items: center;
/* 文字サイズ */
  font-size: 18px;
/* 太字 */
  font-weight: bold;
/* 背景色 */
  background: #3498db;
/* 文字色 */
  color: #ffffff;
/* 内側余白 */
  padding: 8px 10px;
/* 角丸 */
  border-radius: 10px;
}

/* 問題表示エリア */
#question-area {
/* 中央揃え */
  text-align: center;
/* 余白なし */
  margin: 0;
/* 内側余白なし */
  padding: 0;
}

/* 問題文 */
#question {
/* 余白なし */
  margin: 0;
/* 文字サイズ */
  font-size: 56px;
/* 太字 */
  font-weight: bold;
/* 色 */
  color: #2c3e50;
/* 中央揃え */
  text-align: center;
}

/* 入力した答え */
#answer-display {
/* 横幅 */
  width: 140px;
/* 高さ */
  height: 48px;
/* 上余白 */
  margin: 5px auto 0;
/* 文字サイズ */
  font-size: 36px;
/* 行の高さ */
  line-height: 48px;
/* 中央揃え */
  text-align: center;
/* 太字 */
  font-weight: bold;
/* 色 */
  color: #e74c3c;
/* 下線 */
  border-bottom: 3px solid #bdc3c7;
}

/* テンキー全体 */
#keypad {
/* Grid */
  display: grid;
/* 3列 */
  grid-template-columns: repeat(3, 1fr);
/* 間隔 */
  gap: 8px;
}

/* テンキーボタン */
.key {
/* 高さ */
  height: 60px;
/* 背景 */
  background: #ffffff;
/* 枠線 */
  border: 2px solid #3498db;
/* 角丸 */
  border-radius: 12px;
/* 文字サイズ */
  font-size: 26px;
/* 太字 */
  font-weight: bold;
/* 色 */
  color: #2c3e50;
/* カーソル */
  cursor: pointer;
/* 影 */
  box-shadow: 0 5px #2980b9;
/* アニメーション */
  transition: 0.1s;
}

/* 通常ボタンのホバー */
.key:hover {
/* 背景変更 */
  background: #f3faff;
}

/* 押したときの見た目 */
.key:active,
.key.active {
/* 影小さく */
  box-shadow: 0 1px #2980b9;
/* 下に移動 */
  transform: translateY(4px);
}

/* クリアボタン */
.key.clear {
/* 背景 */
  background: #ecf0f1;
/* 枠色 */
  border-color: #95a5a6;
/* 影 */
  box-shadow: 0 5px #7f8c8d;
/* 文字サイズ */
  font-size: 20px;
}

/* クリアボタンのホバー */
.key.clear:hover {
/* 背景変更 */
  background: #f7f9fa;
}

/* ダミーボタン */
.key.empty {
/* 非表示 */
  visibility: hidden;
/* カーソル無効 */
  cursor: default;
/* 影なし */
  box-shadow: none;
}

/* 正解時の丸エフェクト */
.correct-circle {
/* 絶対配置 */
  position: absolute;
/* 枠線 */
  border: 8px solid #ff5252;
/* 円形 */
  border-radius: 50%;
/* 幅 */
  width: 90px;
/* 高さ */
  height: 90px;
/* 中央配置 */
  transform: translate(-50%, -50%);
/* クリック無効 */
  pointer-events: none;
/* 前面 */
  z-index: 50;
/* アニメーション */
  animation: circle-out 0.5s ease-out forwards;
}

/* 円が広がるアニメーション */
@keyframes circle-out {
  0% {
/* 初期状態 */
    transform: translate(-50%, -50%) scale(0.4);
/* 不透明 */
    opacity: 1;
  }
  100% {
/* 拡大 */
    transform: translate(-50%, -50%) scale(1.6);
/* 透明 */
    opacity: 0;
  }
}

/* レスポンシブ対応 */
@media (max-width: 900px) {
/* タイトルサイズ調整 */
  .target-message {
    font-size: 18px;
  }

/* スコア文字サイズ調整 */
  .header-right {
    font-size: 14px;
  }

/* 右パネル調整 */
  .right-panel {
    width: 340px;
    padding: 12px;
  }

/* ステータス調整 */
  #status {
    font-size: 16px;
    padding: 8px;
  }

/* 問題サイズ調整 */
  #question {
    font-size: 48px;
  }

/* 回答欄調整 */
  #answer-display {
    width: 120px;
    height: 44px;
    font-size: 32px;
    line-height: 44px;
  }

/* キーサイズ調整 */
  .key {
    height: 54px;
    font-size: 22px;
  }

/* モンスターサイズ調整 */
  #monster {
    font-size: 80px;
  }
}