/* =============================== */
/* 全要素共通設定 */
/* レイアウト計算を安定させるための基本設定 */
/* =============================== */
* {
  box-sizing: border-box;
}

/* =============================== */
/* html全体設定 */
/* 余白削除と高さ100%指定 */
/* =============================== */
html {
  margin: 0;
  height: 100%;
}

/* =============================== */
/* body設定 */
/* 画面中央にゲームを配置 */
/* =============================== */
body {
  margin: 0;
  height: 100vh;
  font-family: sans-serif;
  background: #f2f2f2;
  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;
  display: flex;
  flex-direction: column;
}

/* =============================== */
/* ヘッダー */
/* 上部の情報表示エリア */
/* =============================== */
.game-header {
  height: 50px;
  padding: 10px;
  background: #ffffff;
  flex: 0 0 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* =============================== */
/* 残り問題数表示 */
/* 左側に固定表示 */
/* =============================== */
.header-left {
  position: absolute;
  left: 10px;
  font-weight: bold;
}

/* =============================== */
/* タイトル表示 */
/* 中央配置 */
/* =============================== */
.title {
  width: 100%;
  text-align: center;
  font-size: 20px;
  font-weight: bold;
}

/* =============================== */
/* メインゲームエリア */
/* 背景画像と中央配置 */
/* =============================== */
.game-main {
  position: relative;
  background-image: url("assets/bg.png");
  background-size: cover;
  background-position: center -230px;
  background-repeat: no-repeat;
  flex: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* =============================== */
/* ボタン共通デザイン */
/* =============================== */
.btn {
  padding: 12px 20px;
  font-size: 16px;
  border: 2px solid #333;
  background: #fff;
  cursor: pointer;
  border-radius: 10px;
  transition:
    background-color 0.15s ease,
    transform 0.05s ease;
}

/* ホバー時の色変更 */
.btn:hover {
  background: #d6f0ff;
}

/* クリック時の押し込み表現 */
.btn:active {
  transform: scale(0.98);
}

/* =============================== */
/* ゲーム本体エリア */
/* 初期は非表示 */
/* =============================== */
.cake-game {
  display: none;
  width: 100%;
  max-width: 700px;
  text-align: center;
  position: relative;
}

/* =============================== */
/* 吹き出し共通 */
/* =============================== */
.balloon {
  position: relative;
  display: inline-block;
  background: #fff;
  border: 3px dashed #ff85a1;
  border-radius: 15px;
  padding: 10px 18px;
  font-weight: bold;
}

/* =============================== */
/* 注文ボックス */
/* 問題表示用 */
/* =============================== */
#order-box {
  background: #fff9fb;
  border: 4px dashed #ff85a1;
  border-radius: 15px;
  padding: 12px;
  font-size: 20px;
  font-weight: bold;
}

/* 注文吹き出しの三角 */
.order-balloon::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 15px 10px 0 10px;
  border-style: solid;
  border-color: #ff85a1 transparent transparent transparent;
}

/* =============================== */
/* 顔アイコン */
/* =============================== */
.face {
  font-size: 30px;
  margin: 0 0 2px;
}

/* =============================== */
/* メッセージ表示 */
/* 正解・不正解表示 */
/* =============================== */
#message {
  position: absolute;
  top: 115px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-block;
  visibility: hidden;
  min-width: 120px;
  padding: 6px 12px;
  color: #e91e63;
  font-size: 18px;
  font-weight: bold;
  background: #fff9fb;
  border: 3px dashed #ff85a1;
  border-radius: 15px;
}

/* メッセージ吹き出しの三角 */
.message-balloon::after {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 8px 12px 8px;
  border-style: solid;
  border-color: transparent transparent #ff85a1 transparent;
}

/* =============================== */
/* ケーキ一覧表示 */
/* グリッドレイアウト */
/* =============================== */
#showcase {
  margin-top: 60px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 10px;
  position: relative;
}

/* =============================== */
/* ケーキ枠 */
/* =============================== */
.cake-slot {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =============================== */
/* ケーキ画像 */
/* ホバーで拡大 */
/* =============================== */
.cake-item {
  width: 90%;
  height: 90%;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none; 
}

/* ホバー時拡大 */
.cake-item:hover {
  transform: scale(1.15);
}

/* =============================== */
/* 結果表示エリア */
/* =============================== */
.result {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
}

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

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

/* 完全正解表示 */
.perfect {
  display: none;
  font-size: 20px;
  font-weight: bold;
}