html, body {
  height: 100%;
  margin: 0;
  overflow: hidden; /* ← スクロール完全禁止 */
}

body {
  background: linear-gradient(180deg, #f9f9f9 0%, #ececec 100%);
  color: #333;
  font-family: 'Poppins', sans-serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 40px;
  min-height: 100vh;
}

.layout {
  display: flex;
  gap: 40px;
}

/* タイトルとスコア */
.left-panel h1 {
  font-size: 2.2em;
  text-align: center;
  color: #2d3748;
  letter-spacing: 1px;
}

#scoreDisplay {
  text-align: center;
  font-size: 1.2em;
  color: #2b6cb0;
  font-weight: 600;
  margin-top: 5px;
  letter-spacing: 2px;
}

/* Canvasスタイル */
canvas {
  border: 3px solid #a0aec0;
  background-color: #ffffffee;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  display: block;
  margin-top: 20px;
  border-radius: 10px;
}

.game-container {
  position: relative;
  display: inline-block;
}

/* =============================== */
/* スタート画面オーバーレイ */
/* =============================== */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 600px;
  height: 600px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 10;
  backdrop-filter: blur(6px);
  border-radius: 10px;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
  transition: opacity 0.4s ease;
}

/* オーバーレイ内容 */
.overlay-content {
  padding: 25px 40px;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  max-width: 80%;
  border: 1px solid #e2e8f0;
}

.overlay-content h2 {
  font-size: 24px;
  margin-bottom: 10px;
  color: #2b6cb0;
}

.overlay-content p {
  margin: 6px 0;
  font-size: 15px;
  color: #4a5568;
}

/* 入力フォーム */
.overlay-content input {
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: 1px solid #cbd5e0;
  margin-top: 15px;
  width: 70%;
  text-align: center;
  background-color: #f9fafb;
  color: #333;
  outline: none;
  transition: border-color 0.3s;
}

.overlay-content input:focus {
  border-color: #2b6cb0;
}

/* スタートボタン */
.overlay-content button {
  padding: 10px 30px;
  font-size: 17px;
  margin-top: 18px;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #63b3ed, #48bb78);
  color: #fff;
  box-shadow: 0 3px 10px rgba(72, 187, 120, 0.3);
  transition: transform 0.15s, box-shadow 0.3s;
}

.overlay-content button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.start-hint {
  margin-top: 10px;
  color: #718096;
  font-size: 13px;
}

/* =============================== */
/* ゲームオーバーオーバーレイ */
/* =============================== */
#gameOverOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 600px;
  height: 600px;
  background: rgba(255, 255, 255, 0.9);
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 20;
  backdrop-filter: blur(6px);
  border-radius: 10px;
  box-shadow: inset 10px 10px rgba(0,0,0,0.05);
  transition: opacity 0.4s ease;
}

/* オーバーレイ内容 */
#gameOverOverlay .overlay-content {
  padding: 25px 40px;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  max-width: 80%;
  border: 1px solid #e2e8f0;
}

/* タイトル */
#gameOverOverlay h2 {
  font-size: 26px;
  margin-bottom: 10px;
  color: #e53e3e; /* 赤すぎず少し落ち着いた警告カラー */
}

/* スコア表示と通知 */
#gameOverOverlay p {
  margin: 6px 0;
  font-size: 16px;
  color: #4a5568;
}

/* 入賞・圏外メッセージ */
#rankingNotice {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 600;
  color: #2b6cb0; /* 青系で統一感を持たせる */
}

/* ボタン */
#gameOverOverlay button {
  padding: 10px 30px;
  font-size: 17px;
  margin-top: 20px;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #63b3ed, #48bb78);
  color: #fff;
  box-shadow: 0 3px 10px rgba(72, 187, 120, 0.3);
  transition: transform 0.15s, box-shadow 0.3s;
}

/* ボタンhover時 */
#gameOverOverlay button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

/* =============================== */
/* ランキングパネル */
/* =============================== */
.right-panel {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px 25px;
  width: 240px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-top: 120px;
}

/* タイトル部分 */
.right-panel h2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 18px;
  color: #2b6cb0;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 6px;
  margin-bottom: 10px;
  font-weight: 600;
}

.right-panel h2::before {
  content: "🏆";
  font-size: 20px;
}

/* ランキングリスト */
#rankingList {
  list-style: none;
  padding: 0;
  margin: 0;
}

#rankingList li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 10px;
  border-bottom: 1px solid #edf2f7;
  font-size: 15px;
  line-height: 1.6;
  border-radius: 8px;
  margin-bottom: 4px;
  transition: background-color 0.3s;
}

/* --- トップ3専用装飾 --- */

/* 1位：金 */
#rankingList li:nth-child(1) {
  background: linear-gradient(90deg, #fff8dc, #D0A900);
  font-weight: 600;
}

/* 2位：銀 */
#rankingList li:nth-child(2) {
  background: linear-gradient(90deg, #f9fafb, #C0C0C0);
  font-weight: 600;
}

/* 3位：銅 */
#rankingList li:nth-child(3) {
  background: linear-gradient(90deg, #fff7ed, #B87333);
  font-weight: 600;
}

/* 最後の行だけボーダー削除 */
#rankingList li:last-child {
  border-bottom: none;
}

/* 順位・名前・スコア */
#rankingList li span.rank {
  font-weight: 600;
  width: 24px;
  text-align: right;
  margin-right: 6px;
  color: #4a5568;
}

#rankingList li span.name {
  flex: 1;
  text-align: left;
  color: #333;
}

#rankingList li span.score {
  font-weight: 600;
  color: #2b6cb0;
}

/* 上位3位の順位カラー */
#rankingList li:nth-child(1) span.rank {
  color: #d4af37; /* 金 */
}
#rankingList li:nth-child(2) span.rank {
  color: #a0aec0; /* 銀 */
}
#rankingList li:nth-child(3) span.rank {
  color: #cd7f32; /* 銅 */
}
