/* ダンジョンテーマのスタイル */

:root {
  --bg: #0d0d0d;
  --surface: #1a1a2e;
  --surface2: #16213e;
  --border: #2d2d5e;
  --text: #c8c8d4;
  --text-dim: #6b6b8a;
  --accent: #7b68ee;
  --gold: #ffd700;
  --danger: #e05252;
  --success: #52c27e;
  --treasure: #52c2be;
  --staircase: #f0a830;

  /* マインスイーパの数字色 */
  --num1: #60a5fa;
  --num2: #4ade80;
  --num3: #f87171;
  --num4: #c084fc;
  --num5: #fb923c;
  --num6: #22d3ee;
  --num7: #f472b6;
  --num8: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', monospace;
  min-height: 100vh;
}

/* ヘッダー */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

#header h1 {
  font-size: 1.1rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

#header-center {
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 0.95rem;
  font-weight: 600;
}

#header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ミュートボタン */
#mute-btn {
  font-size: 1.1rem;
  padding: 2px 8px;
  min-width: 2rem;
}
#mute-btn.muted {
  text-decoration: line-through;
  opacity: 0.45;
}

/* サイドバーのアクションパネル */
#action-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
}

/* アクションパネル内の回復薬クイック使用ボタン */
#heal-btn-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
#heal-btn-wrap .heal-header-btn {
  background: #1a2e1a;
  border: 1px solid #52c27e;
  color: #52c27e;
  font-family: inherit;
  font-size: 0.72rem;
  padding: 3px 10px;
  cursor: pointer;
  border-radius: 3px;
}
#heal-btn-wrap .heal-header-btn:hover {
  background: #52c27e;
  color: #111;
}
#heal-btn-wrap .heal-header-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ヘッダーの探知の巻物ボタン */
#scan-btn-wrap .scan-header-btn {
  background: #2a2a4e;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 3px 12px;
  cursor: pointer;
  border-radius: 3px;
}
#scan-btn-wrap .scan-header-btn:hover {
  background: var(--accent);
  color: #fff;
}
#scan-btn-wrap .scan-header-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

#floor-info {
  font-size: 0.9rem;
  color: var(--gold);
  font-weight: bold;
}

#enemy-count {
  font-size: 0.9rem;
  color: var(--danger);
  font-weight: bold;
}

/* メインレイアウト */
#main {
  display: flex;
  gap: 16px;
  padding: 16px;
  align-items: stretch; /* サイドバーをボードと同じ高さに引き伸ばす */
}

/* ボード列（ボード＋ログを縦並び） */
#board-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  position: relative; /* モーダルオーバーレイの基点 */
}

/* ボードセクション */
#board-section {
  flex-shrink: 0;
  position: relative;
}

/* フロアクリアエフェクト */
#clear-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

#clear-text {
  font-size: 2.2rem;
  font-weight: bold;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.4);
  opacity: 0;
  transform: scale(0.5);
}

@keyframes stageClear {
  0%   { opacity: 0; transform: scale(0.5); }
  20%  { opacity: 1; transform: scale(1.15); }
  45%  { opacity: 1; transform: scale(1.0); }
  70%  { opacity: 0.9; transform: scale(1.05); }
  100% { opacity: 0; transform: scale(1.4); }
}

#clear-text.playing {
  animation: stageClear 1.8s ease-out forwards;
}

#board {
  display: grid;
  grid-template-columns: repeat(10, 44px);
  gap: 2px;
  background: var(--border);
  padding: 2px;
  border: 1px solid var(--border);
  /* 長いメッセージで #board-column が広がっても board 自体は stretch しない */
  width: max-content;
}

/* セル */
.cell {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  border-radius: 2px;
  transition: background 0.1s;
}

/* 非表示マス */
.cell.hidden {
  background: var(--surface2);
  border: 1px solid var(--border);
}
.cell.hidden:hover {
  background: #1e2a4a;
}

/* 旗マス */
.cell.flagged {
  background: #2a1a1a;
  border: 1px solid #5a2020;
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cell.flagged:hover {
  background: #3a2020;
}

/* 開放済みマス（空） */
.cell.revealed-empty {
  background: #0d1117;
  border: 1px solid #1a1a2e;
  cursor: default;
}

/* 数字マス */
.cell.num1 { color: var(--num1); background: #0d1117; border: 1px solid #1a1a2e; cursor: default; }
.cell.num2 { color: var(--num2); background: #0d1117; border: 1px solid #1a1a2e; cursor: default; }
.cell.num3 { color: var(--num3); background: #0d1117; border: 1px solid #1a1a2e; cursor: default; }
.cell.num4 { color: var(--num4); background: #0d1117; border: 1px solid #1a1a2e; cursor: default; }
.cell.num5 { color: var(--num5); background: #0d1117; border: 1px solid #1a1a2e; cursor: default; }
.cell.num6 { color: var(--num6); background: #0d1117; border: 1px solid #1a1a2e; cursor: default; }
.cell.num7 { color: var(--num7); background: #0d1117; border: 1px solid #1a1a2e; cursor: default; }
.cell.num8 { color: var(--num8); background: #0d1117; border: 1px solid #1a1a2e; cursor: default; }

/* 宝箱マス（CSS描画・開封後は目立たない地味な配色） */
.cell.revealed-treasure {
  background: #0e1110;
  border: 1px solid #252520;
  cursor: default;
  position: relative;
}

/* 蓋（上部・くすんだ金） */
.cell.revealed-treasure::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 7px;
  right: 7px;
  height: 9px;
  background: #1e1a08;
  border-radius: 3px 3px 0 0;
  border: 1px solid #2e2810;
}

/* 本体（下部・ほぼ黒） */
.cell.revealed-treasure::after {
  content: '';
  position: absolute;
  top: 19px;
  left: 7px;
  right: 7px;
  height: 14px;
  background: #140c04;
  border-radius: 0 0 2px 2px;
  border: 1px solid #2a2010;
  border-top: 1px solid #2a2010;
}

/* 開くアニメーション：光が広がってフェードアウト */
@keyframes chestGlow {
  0%   { box-shadow: none; }
  15%  { box-shadow: 0 0 6px 2px rgba(255, 215, 0, 0.9), 0 0 12px 4px rgba(255, 180, 0, 0.6); }
  40%  { box-shadow: 0 0 20px 10px rgba(255, 215, 0, 0.6), 0 0 40px 20px rgba(255, 150, 0, 0.3); }
  100% { box-shadow: 0 0 60px 30px rgba(255, 215, 0, 0), 0 0 80px 40px rgba(255, 150, 0, 0); }
}
.cell.revealed-treasure.chest-opening {
  animation: chestGlow 1.4s ease-out forwards;
}

/* 階段マス */
.cell.revealed-staircase {
  background: #1e1400;
  border: 1px solid var(--staircase);
  color: var(--staircase);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 商人マス */
.cell.revealed-merchant {
  background: #0d1a0d;
  border: 1px solid #52c27e;
  color: #52c27e;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* レアリティバッジ */
.rarity-rare {
  color: #4da6ff;
  font-size: 0.75em;
  margin-left: 2px;
}
.rarity-epic {
  color: #c07aff;
  font-size: 0.75em;
  margin-left: 2px;
}

/* 撃破済み敵マス */
.cell.revealed-dead {
  background: #1f0f0f;
  border: 1px solid #6b2a2a;
  color: #c0504a;
  font-size: 1.3rem;
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* セル内画像（dead.png など） */
.cell-icon {
  width: 70%;
  height: 70%;
  object-fit: contain;
  display: block;
}

/* インベントリ・装備・商人・ドロップ欄のアイテムアイコン */
.item-left {
  display: flex;
  align-items: center;
  gap: 4px;
}
.item-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

#board-hint {
  margin-top: 8px;
  font-size: 0.7rem;
  color: var(--text-dim);
  text-align: center;
}

/* サイドバー：#main の stretch でボードと同じ高さになる */
#sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 220px;
  max-width: 280px;
  overflow: hidden;
}

/* メッセージパネル（ボード下に配置） */
#message-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  flex-shrink: 0; /* メッセージパネル以外は縮まない */
}

/* サイドバーはすべて縮まない（メッセージパネルはボード列に移動済み） */

.panel h2 {
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

/* タイマー2列レイアウト */
.timer-group {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 5px 8px;
  margin-bottom: 6px;
}
.timer-col {
  flex: 1;
  text-align: center;
}
.timer-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.timer-value {
  font-size: 0.82rem;
  font-weight: bold;
  color: var(--text);
}
.timer-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 8px;
  flex-shrink: 0;
}

/* HPバー */
#hp-bar-wrap {
  background: #1a0d0d;
  border: 1px solid #3a2020;
  border-radius: 2px;
  height: 8px;
  margin: 4px 0 8px;
}
#hp-bar {
  height: 100%;
  background: var(--danger);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ステータス行 */
.stat-row {
  font-size: 0.82rem;
  margin-bottom: 4px;
  color: var(--text);
}
.stat-label {
  color: var(--text-dim);
}
.stat-value {
  float: right;
  font-weight: bold;
}
.stat-value.gold {
  color: var(--gold);
}

/* EXPバー */
#exp-bar-wrap {
  background: #0d0d1e;
  border: 1px solid #1a1a3e;
  border-radius: 2px;
  height: 4px;
  margin: 2px 0 6px;
}
#exp-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

/* インベントリパネルの所持品リスト部分をスクロール可能に */
#inventory-list {
  max-height: 120px;
  overflow-y: auto;
}

/* インベントリ */
.inventory-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  padding: 4px 6px;
  margin-bottom: 3px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 2px;
}
/* アイテム名の種別カラー */
.item-name { font-weight: bold; }
.item-attack_boost  { color: #fb923c; }   /* 橙：攻撃系 */
.item-defense_boost { color: #60a5fa; }   /* 青：防御系（胴） */
.item-head_boost    { color: #93c5fd; }   /* 薄青：防御系（頭） */
.item-heal          { color: #4ade80; }   /* 緑：回復 */
.item-scan          { color: #c084fc; }   /* 紫：巻物 */

.inventory-item button {
  background: #2a2a4e;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.7rem;
  padding: 1px 6px;
  cursor: pointer;
  border-radius: 2px;
  font-family: inherit;
}
.inventory-item button:hover {
  background: var(--accent);
  color: #fff;
}
.inventory-empty {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* 所持品が多い場合の「続きあり」インジケーター */
#inventory-more {
  font-size: 0.7rem;
  color: var(--accent);
  text-align: center;
  padding-top: 3px;
  min-height: 1em;
}

/* メッセージログ：固定高さでスクロール */
#message-log {
  max-height: 160px;
  overflow-y: auto;
}
.message {
  font-size: 0.75rem;
  padding: 2px 0;
  border-bottom: 1px solid #1a1a2e;
  color: var(--text);
  overflow-wrap: anywhere; /* 長いメッセージで #board-column が広がるのを防ぐ */
}
.message:first-child {
  color: #e0e0f0;
  font-weight: bold;
}
.message.combat {
  color: var(--danger);
}
.message.item {
  color: var(--treasure);
}
.message.staircase {
  color: var(--staircase);
}
.message.levelup {
  color: var(--gold);
}

/* モーダル：ボード列全体を覆い、背景をぼかす */
#modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 4px;
}
#modal-overlay.hidden {
  display: none;
}

#modal-box {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 20px;
  width: 92%;
  max-width: 440px;
  max-height: 85%;
  overflow-y: auto;
}

#modal-content h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}
#modal-content .combat-log {
  font-size: 0.78rem;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 10px;
  max-height: 280px;
  overflow-y: auto;
  line-height: 1.7;
}
#modal-content .combat-log p {
  margin: 0;
}
#modal-content .combat-log p.advantage {
  color: var(--success);
}
#modal-content .combat-log p.damage {
  color: var(--danger);
}
#modal-content .combat-log p.win {
  color: var(--gold);
  font-weight: bold;
}
#modal-content .combat-log p.lose {
  color: var(--danger);
  font-weight: bold;
}

#modal-content .result-summary {
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--text);
}
#modal-content .result-summary .gain {
  color: var(--success);
}

#modal-buttons {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 6px 16px;
  cursor: pointer;
  border-radius: 3px;
}
.btn:hover {
  background: #2a2a4e;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover {
  background: #9b8aff;
}
.btn.danger {
  background: #3a1a1a;
  border-color: var(--danger);
  color: var(--danger);
}
.btn.danger:hover {
  background: var(--danger);
  color: #fff;
}

/* ゲームオーバー */
.gameover-title {
  font-size: 1.5rem;
  color: var(--danger);
  text-align: center;
  margin-bottom: 8px;
}
.gameover-cause {
  text-align: center;
  color: #e07070;
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.gameover-info {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

/* レベルアップ */
.levelup-title {
  font-size: 1.2rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 12px;
}
.levelup-gains {
  font-size: 0.9rem;
  text-align: center;
  color: var(--success);
  line-height: 2;
}

/* 階段 */
.staircase-title {
  font-size: 1.1rem;
  color: var(--staircase);
  text-align: center;
  margin-bottom: 8px;
}
.staircase-info {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ─── タイトル画面 ─── */
#title-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}
#title-overlay.hidden { display: none; }

.title-box {
  text-align: center;
  padding: 40px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 380px;
  width: 100%;
}

.title-heading {
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 28px;
  line-height: 1.4;
}

.title-mode-select {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.title-mode-btn {
  font-size: 1rem;
  padding: 12px 0;
  width: 100%;
}

.title-locked {
  opacity: 0.45;
  cursor: not-allowed;
  font-size: 0.8rem;
}

.title-records {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.title-record {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.title-record-label { color: var(--text); }
.title-record-value { color: var(--gold); }

/* ─── 星マーク ─── */
.star {
  font-size: 1.4rem;
  color: var(--text-dim);
  margin: 0 2px;
}
.star-filled {
  color: var(--gold);
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

/* ゲームクリアモーダルの3段階星グリッド */
.gameclear-stars-grid {
  display: grid;
  grid-template-columns: auto auto auto auto;
  gap: 6px 12px;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
  font-size: 1rem;
}
.gameclear-star-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: right;
}
.stars-group {
  color: var(--gold);
  letter-spacing: 1px;
}

/* 記録画面の行内インライン星 */
.records-stars-inline {
  font-size: 0.75em;
  letter-spacing: -1px;
  color: var(--gold);
}

/* 記録画面の星凡例（縦並び） */
.records-star-legend {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-bottom: 14px;
  line-height: 1.6;
}

/* ─── Goldメッセージ色 ─── */
.message:has-text('[gold]') { color: var(--gold); }

/* ─── 識別撃破フラッシュ（金色：旗・右クリック突撃） ─── */
/* ─── 識別キルフラッシュ（金色：旗/右クリックで敵を仕留めた瞬間） ─── */
/* ─── 識別キルフラッシュ（金色：旗/右クリックで敵を仕留めた瞬間） ─── */
@keyframes kill-flash {
  0%   { background: #e8cc44; color: #fff;
         transform: scale(1.35) rotate(-3deg);
         box-shadow: 0 0 6px 2px rgba(255,210,0,0.3);
         filter: brightness(1.2); z-index: 10; }
  20%  { transform: scale(1.28) rotate(2deg);
         box-shadow: 0 0 4px 1px rgba(255,200,0,0.15); }
  50%  { background: #b8860b; color: #fff;
         transform: scale(1.1) rotate(0deg);
         box-shadow: none; filter: brightness(1); }
  100% { background: #1f0f0f; color: #c0504a; transform: scale(1); }
}
.cell.kill-flash {
  animation: kill-flash 0.45s ease-out forwards;
  position: relative;
  z-index: 10;
}

/* ─── 奇襲撃破フラッシュ（赤色：予測なしで敵を踏んで勝利） ─── */
@keyframes kill-flash-ambush {
  0%   { background: #8b0000; color: #fff; transform: scale(1.25); }
  40%  { background: #5c0000; color: #ff6666; transform: scale(1.1); }
  100% { background: #1f0f0f; color: #c0504a; transform: scale(1); }
}
.cell.kill-flash-ambush {
  animation: kill-flash-ambush 0.35s ease-out forwards;
}

/* ─── 壁激突フラッシュ（プレイヤーステータスパネル） ─── */
@keyframes misfire-flash {
  0%   { box-shadow: 0 0 0px 0px rgba(220, 50, 50, 0); }
  15%  { box-shadow: 0 0 18px 8px rgba(220, 50, 50, 0.95), 0 0 36px 14px rgba(255, 100, 100, 0.5); }
  50%  { box-shadow: 0 0 10px 4px rgba(220, 50, 50, 0.4); }
  100% { box-shadow: 0 0 0px 0px rgba(220, 50, 50, 0); }
}
#player-stats.misfire-flash {
  animation: misfire-flash 0.5s ease-out forwards;
}

/* ─── レベルアップフラッシュ（プレイヤーステータスパネル） ─── */
@keyframes levelup-flash {
  0%   { box-shadow: 0 0 0px 0px rgba(123, 104, 238, 0); }
  20%  { box-shadow: 0 0 16px 6px rgba(123, 104, 238, 0.9), 0 0 32px 12px rgba(180, 160, 255, 0.5); }
  60%  { box-shadow: 0 0 24px 10px rgba(123, 104, 238, 0.5); }
  100% { box-shadow: 0 0 0px 0px rgba(123, 104, 238, 0); }
}
#player-stats.levelup-flash {
  animation: levelup-flash 0.8s ease-out forwards;
}

/* ─── ステータス増減フロートアニメーション（レベルアップ・装備変更） ─── */
@keyframes stat-float {
  0%   { opacity: 1;   transform: translateY(0)     scale(1.1); }
  60%  { opacity: 0.9; transform: translateY(-20px) scale(1.0); }
  100% { opacity: 0;   transform: translateY(-36px) scale(0.85); }
}
.stat-float {
  position: fixed;
  pointer-events: none;
  font-size: 0.85rem;
  font-weight: bold;
  z-index: 9999;
  animation: stat-float 0.9s ease-out forwards;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  white-space: nowrap;
}

/* ─── アイテム取得浮上アニメーション（ドラクエ小さなメダル風） ─── */
@keyframes item-float {
  0%   { opacity: 1;   transform: translateX(-50%) translateY(0)     scale(1.4); }
  60%  { opacity: 0.9; transform: translateX(-50%) translateY(-36px) scale(1.1); }
  100% { opacity: 0;   transform: translateX(-50%) translateY(-56px) scale(0.8); }
}
.item-float-anim {
  position: fixed;
  pointer-events: none;
  font-size: 1.6rem;
  z-index: 9999;
  animation: item-float 0.9s ease-out forwards;
  text-shadow: 0 2px 8px rgba(0,0,0,0.7);
}
.item-float-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.7));
}

/* ─── クリア記録オーバーレイ ─── */
#records-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  overflow-y: auto;
  padding: 20px;
}
#records-overlay.hidden { display: none; }

.records-box {
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.records-title {
  font-size: 1.2rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 8px;
}


.records-section {
  margin-bottom: 16px;
}
.records-section h3 {
  font-size: 0.85rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

/* 最高到達階（クリア前のタイトル画面） */
.title-best-floor {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* 記録テーブル（最小/最大の2行） */
.records-stats-header,
.records-stats-row {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr 1.5fr 0.9fr 0.9fr;
  gap: 4px;
  font-size: 0.78rem;
  padding: 4px 2px;
  align-items: center;
}
.records-stats-header {
  color: var(--text-dim);
  font-size: 0.72rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.records-stats-row { border-bottom: 1px solid #2a2a3a; }
.records-dim { color: var(--text-dim); font-size: 0.75em; }


/* クリア回数・初クリア日 */
.records-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 6px;
}
.records-meta-sep {
  opacity: 0.4;
}

/* ヘッダーセルを2行（ラベル上・星下）で中央揃え */
.records-header-cell {
  line-height: 1.4;
}
