body {
  margin: 0;
  padding: 20px 10px;
  background: #111;
  font-family: 'Segoe UI', sans-serif;
  color: #fff;
  animation: fadeIn 1s ease-in;
  overflow-x: hidden;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
*, *::before, *::after { box-sizing: border-box; }

/* ===== 共通ヘッダー ===== */
.game-thumb {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.thumb-left img {
  max-width: 700px;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.image-title {
  text-align: center;
  margin: 0;
  font-size: 20px;
  color: #fff;
  text-shadow: 0 0 6px #ffa500;
}

.sub-title1, .sub-title2 {
  text-align: center;
  margin: 0;
  font-size: 13px;
  color: rgb(255, 142, 233);
  text-shadow: 0 0 8px #ff00cc;
}

@media (min-width: 768px) {
  .sub-title1, .sub-title2 { font-size: 19px; }
}

/* ===== HUD ===== */
.hud {
  max-width: 860px;
  margin: 14px auto 10px;
  padding: 10px 12px;
  border: 2px solid #00ffe7;
  box-shadow: 0 0 18px #00ffe7;
  background: #000;
  border-radius: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.hud-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.stat {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(17,17,17,0.7);
  color: #00ffe7;
  text-shadow: 0 0 6px #00ffe7;
  min-width: 120px;
  justify-content: center;
}

.stat .label {
  color: #ffa500;
  text-shadow: 0 0 6px #ffa500;
  font-size: 12px;
}

.stat .value {
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.control {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

select, button { font-family: inherit; }

button {
  font-size: 15px;
  padding: 11px 18px;
  background-color: #00ffe7;
  border: none;
  color: #fff;
  font-weight: 900;
  border-radius: 10px;
  box-shadow: 0 0 12px #00ffe7, 0 0 24px #00ffe7;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  letter-spacing: 0.5px;
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 16px #00ffe7, 0 0 32px #00ffe7;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 0 8px rgba(0,255,231,0.25);
}

.hint {
  text-align: center;
  color: #ffa500;
  text-shadow: 0 0 6px #ffa500;
  font-size: 13px;
  margin-top: -2px;
}

/* ===== 盤面 ===== */
#boardWrap {
  max-width: 860px;
  margin: 10px auto 0;
  padding: 12px;
  border: 2px solid #00ffe7;
  box-shadow: 0 0 18px #00ffe7;
  background: #000;
  border-radius: 12px;
}

.hidden { display: none; }

#board {
  display: grid;
  gap: 6px;
  justify-content: center;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ★ ① 押せるマスと押せないマスの見分け
   - 押せる: 明るいネオン、ホバー時に発光
   - 押せない(壁): 暗め・メタル・斜線、cursor not-allowed */
.cell {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;

  /* 押せるマスを明るく */
  background: radial-gradient(circle at 30% 30%, rgba(0,255,231,0.10), rgba(0,0,0,0.0) 65%), #121212;
  border: 1px solid rgba(0,255,231,0.45);
  box-shadow: 0 0 14px rgba(0, 255, 231, 0.25), inset 0 0 10px rgba(0,255,231,0.10);
  color: #fff;
  font-weight: 900;
  transition: transform 0.08s, box-shadow 0.12s, background 0.12s, filter 0.15s;
}

.cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(0, 255, 231, 0.45), inset 0 0 10px rgba(255,0,204,0.10);
  filter: brightness(1.05);
}

.cell.open {
  background: rgba(255,255,255,0.06);
  cursor: default;
  border-color: rgba(255,165,0,0.35);
  box-shadow: 0 0 12px rgba(255, 165, 0, 0.22);
}

.cell.flag {
  background: rgba(255, 0, 204, 0.12);
  border-color: rgba(255, 0, 204, 0.55);
  box-shadow: 0 0 18px rgba(255, 0, 204, 0.38), inset 0 0 10px rgba(255,0,204,0.15);
}

.cell.boom {
  background: rgba(255, 68, 68, 0.22);
  box-shadow: 0 0 24px rgba(255, 68, 68, 0.85);
  border-color: rgba(255, 68, 68, 0.95);
}

.cell .txt {
  text-shadow: 0 0 10px rgba(255,255,255,0.25);
  font-size: 15px;
}

/* 壁 */
.cell.wall {
  cursor: not-allowed;
  background:
    repeating-linear-gradient(135deg,
      rgba(255,255,255,0.04) 0 6px,
      rgba(0,0,0,0.0) 6px 12px
    ),
    radial-gradient(circle at 30% 30%, rgba(255,255,255,0.06), rgba(0,0,0,0.0) 60%),
    #070707;
  border: 1px solid rgba(180,180,180,0.25);
  box-shadow: inset 0 0 14px rgba(0,0,0,0.8);
  filter: saturate(0.4) brightness(0.9);
}

.cell.wall:hover {
  transform: none;
  box-shadow: inset 0 0 14px rgba(0,0,0,0.9);
  filter: saturate(0.35) brightness(0.9);
}

/* 数字色 */
.n1 { color: #00ffe7; text-shadow: 0 0 10px rgba(0,255,231,0.7); }
.n2 { color: #7CFF00; text-shadow: 0 0 10px rgba(124,255,0,0.55); }
.n3 { color: #ffa500; text-shadow: 0 0 10px rgba(255,165,0,0.60); }
.n4 { color: #ff00cc; text-shadow: 0 0 10px rgba(255,0,204,0.60); }
.n5 { color: #ff4444; text-shadow: 0 0 10px rgba(255,68,68,0.60); }
.n6 { color: #B388FF; text-shadow: 0 0 10px rgba(179,136,255,0.60); }
.n7 { color: #ffffff; text-shadow: 0 0 10px rgba(255,255,255,0.40); }
.n8 { color: #9aa0a6; text-shadow: 0 0 10px rgba(154,160,166,0.40); }

@media (max-width: 420px) {
  .cell { width: 30px; height: 30px; border-radius: 9px; }
  #board { gap: 5px; }
}

/* ===== モーダル共通 ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  padding: 18px;
}

.modal-card {
  width: min(520px, 92vw);
  border-radius: 14px;
  border: 2px solid #00ffe7;
  box-shadow: 0 0 24px rgba(0,255,231,0.65);
  background: radial-gradient(circle at 20% 20%, rgba(255,0,204,0.14), rgba(0,0,0,0.0) 55%), #050505;
  padding: 18px 16px 16px;
  text-align: center;
  animation: popIn 0.22s ease;
}

@keyframes popIn {
  from { transform: translateY(16px) scale(0.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-title {
  margin: 0 0 6px;
  color: #fff;
  text-shadow: 0 0 8px #ffa500;
  letter-spacing: 0.8px;
}

.modal-sub {
  margin: 0 0 14px;
  color: #00ffe7;
  text-shadow: 0 0 6px #00ffe7;
  font-size: 13px;
}

.modal-form {
  display: grid;
  gap: 10px;
  text-align: left;
  margin: 6px auto 14px;
  width: min(420px, 100%);
}

.modal-label {
  font-size: 12px;
  color: #ffa500;
  text-shadow: 0 0 6px #ffa500;
  letter-spacing: 0.5px;
}

.modal-note {
  font-size: 13px;
  color: rgb(255, 142, 233);
  text-shadow: 0 0 8px #ff00cc;
}

.modal-form select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25);
  background: #111;
  color: #fff;
  box-shadow: 0 0 10px rgba(255, 0, 204, 0.25);
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.modal-close-hint {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
}

/* ===== 結果モーダル ===== */
#resultScreen {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 130;
  text-align: center;
  padding: 18px;
}

#resultScreen.show {
  display: flex;
  animation: fadeIn 0.35s ease;
}

#resultScreen h2 {
  margin: 0 0 10px;
  color: #fff;
  text-shadow: 0 0 8px #ffa500;
  line-height: 1.4;
}

#resultScreen .sub {
  margin: 0 0 18px;
  color: #00ffe7;
  text-shadow: 0 0 6px #00ffe7;
  font-size: 14px;
}

/* ===== 爆発演出 ===== */
@keyframes screenShake {
  0% { transform: translate(0,0); }
  20% { transform: translate(-6px, 3px); }
  40% { transform: translate(5px, -4px); }
  60% { transform: translate(-4px, -2px); }
  80% { transform: translate(6px, 4px); }
  100% { transform: translate(0,0); }
}

.shake {
  animation: screenShake 0.35s ease;
}

@keyframes boomPulse {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(1.18); filter: brightness(1.25); }
  100% { transform: scale(1); filter: brightness(1); }
}

.boom-anim {
  animation: boomPulse 0.45s ease;
}

/* ===== クリア演出（congratulations） ===== */
.celebrate-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 125;
  overflow: hidden;
  display: none;
}

.celebrate-layer.show {
  display: block;
}

.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0.95;
  filter: drop-shadow(0 0 10px rgba(0,255,231,0.7));
  animation: fall 1.6s linear forwards;
}

@keyframes fall {
  0% { transform: translateY(-30px) rotate(0deg); opacity: 0.0; }
  10% { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

@keyframes congratsPulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.congrats-pulse {
  animation: congratsPulse 0.6s ease 0s 2;
}

/* ===== フッター ===== */
.logo-footer {
  text-align: center;
  margin-top: 30px;
}

.logo-footer a { display: inline-block; }

.logo-footer img {
  max-width: 75px;
  width: 100%;
  height: auto;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.logo-footer img:hover { opacity: 1; }


.game-title {
    margin-bottom: -15px;
    margin-top: -10px;
}

/* ====== ① boardWrapをスクロールコンテナ化 ====== */
#boardWrap {
  /* 既存の装飾はそのままでOK */
  overflow: auto;                 /* 横/縦スクロール */
  -webkit-overflow-scrolling: touch; /* iOS慣性スクロール */
  max-height: 72vh;               /* 画面内に収める（必要に応じて調整） */
}

/* boardは「内容サイズのまま」保持させる（縮めない） */
#board {
  justify-content: start; /* centerだとスクロール時に妙な余白が出やすい */
  width: max-content;
  height: max-content;
  transform-origin: top left;
}

/* ====== ② ZOOM切替：boardWrapにクラスを付けて拡大 ====== */
#boardWrap.zoom-1 #board { transform: scale(1); }
#boardWrap.zoom-125 #board { transform: scale(1.25); }
#boardWrap.zoom-150 #board { transform: scale(1.5); }

/* スマホ時の見やすさ（任意の微調整） */
@media (max-width: 768px) {
  #boardWrap { max-height: 70vh; }
}
