/* すべての要素のサイズ計算を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; /* 背景色 */
  display: flex; /* Flexbox使用 */
  justify-content: center; /* 横中央 */
  align-items: center; /* 縦中央 */
}

/* ゲーム全体コンテナ */
.container {
  margin: 0 auto;
  border: 2px solid #333;
  width: 100%;
  max-width: 1196px;
  height: 650px;
  display: flex;
  flex-direction: column;
  background-image: url("assets/bg.png"); /* 背景画像 */
  background-size: cover;
  background-position: center;
  user-select: none;
  -webkit-user-select: none;
}

/* ヘッダー部分 */
.game-header {
  height: 50px;
  padding: 10px 14px;
  flex: 0 0 50px;
  display: flex;
  align-items: center;
}

/* 情報表示（時間・スコア） */
.info {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: bold;
  width: 100%;
  font-size: 20px;
}

/* メインエリア */
.game-main {
  position: relative;
  flex: 1;
  overflow: hidden;
  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;
}

/* ホバー時 */
.btn:hover {
  background: #1edc7c;
}

/* クリック時 */
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px #0e9f56;
}

/* ゲーム画面 */
.game-panel {
  width: 100%;
  height: 100%;
  display: none; /* 初期は非表示 */
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 76px 28px 24px;
  position: relative;
}

/* 正解数表示 */
.blue-apples {
  position: absolute;
  top: 14px;
  left: 22px;
  font-size: 44px;
  line-height: 1;
  min-height: 52px;
  letter-spacing: 2px;
}

/* りんごエリア */
.apples-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

/* りんご表示 */
.apples {
  font-size: 48px;
  line-height: 1.2;
  min-height: 60px;
  text-align: center;
  letter-spacing: 2px;
  word-break: break-word;
}

/* 「たす」文字 */
.plus-text {
  font-size: 30px;
  font-weight: bold;
  color: #555;
}

/* 数式表示 */
.equation {
  margin-top: 20px;
  font-size: 58px;
  font-weight: bold;
  color: #444;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
  z-index: 2;
}

/* 演算子 */
.operator {
  color: #666;
}

/* 答え表示欄 */
.answer-box {
  min-width: 96px;
  text-align: center;
  color: #e11d48;
  border-bottom: 5px solid #e11d48;
}

/* ○×表示 */
.judge-mark {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  width: 250px;
  height: 250px;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
}

/* 表示ON */
.judge-mark.show {
  display: flex;
}

/* 正解 */
.judge-mark.correct::before {
  content: "◯";
  font-size: 220px;
  line-height: 1;
  color: rgba(255, 90, 90, 0.7);
  font-weight: bold;
}

/* 不正解 */
.judge-mark.wrong::before {
  content: "×";
  font-size: 200px;
  line-height: 1;
  color: rgba(60, 130, 255, 0.75);
  font-weight: bold;
}

/* 数字ボタンエリア */
.number-pad {
  margin-top: 30px;
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  position: relative;
  z-index: 2;
}

/* 数字ボタン */
.num-btn {
  font-size: 30px;
  font-weight: bold;
  padding: 16px 0;
  border: none;
  background: #fbbf24;
  color: white;
  border-radius: 15px;
  box-shadow: 0 5px #d97706;
  cursor: pointer;
}

/* 押した時 */
.num-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px #d97706;
}

/* ホバー */
.num-btn:hover {
  background: #fcd34d;
}

/* ロック状態 */
.num-btn.locked:active {
  transform: none;
  box-shadow: 0 5px #d97706;
}

/* 結果画面 */
.result {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  text-align: center;
  padding: 20px;
}

/* 結果のりんご */
.result-blue-apples {
  font-size: 44px;
  line-height: 1.2;
  min-height: 56px;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

/* タイトル */
.result-title {
  margin: 0;
  font-size: 34px;
}

/* テキスト */
.result-text {
  margin: 0;
  font-size: 30px;
  font-weight: bold;
}

/* 新記録 */
.new-record {
  font-size: 24px;
  font-weight: bold;
  color: #f59e0b;
  margin: 4px 0;
}