/* お散歩ビンゴ - スタイル（Phase 1: シンプル版） */

/* ==================== 変数定義 ==================== */
:root {
  /* カラーパレット: グリーン系 */
  --primary: #157F1F;
  --primary-light: #4aaf54;
  --primary-dark: #0e5c16;
  --accent: #ffb347;
  
  /* 背景 */
  --bg: #f8faf9;
  --card-bg: #ffffff;
  
  /* テキスト */
  --text: #2d3436;
  --text-light: #636e72;
  --text-lighter: #b2bec3;
  
  /* ビンゴセル */
  --cell-bg: #ffffff;
  --cell-marked: #157F1F;
  --cell-free: #4aaf54;
  --cell-bingo: #c05000;
  --cell-border: #e0e0e0;
  --cell-hover: #f0f4f2;
  
  /* シャドウ */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.12);
  
  /* スペーシング */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  
  /* ボーダー半径 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  /* トランジション */
  --transition: all 0.2s ease;
}

/* ==================== リセット ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 
               'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-top: 52px; /* 固定グローバルヘッダー分 */
}

/* LP以外（ゲーム画面など）ではヘッダーを出さないため、上余白なし */
body.page-game {
  padding-top: 0;
}

/* ==================== グローバルヘッダー（固定・プラットフォーム⇔プロダクト行き来） ==================== */
.global-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 52px;
  background: #f2f4f3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.global-header a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  transition: background 0.2s, color 0.2s;
}

.global-header a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--primary-dark);
}

.global-header .global-header-platform {
  color: var(--text);
  font-weight: 500;
}

.global-header .global-header-platform img {
  height: 26px;
  width: auto;
  display: block;
  object-fit: contain;
}

.global-header .global-header-product {
  color: var(--primary-dark);
}

.global-header .global-header-product img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
}

/* ==================== レイアウト ==================== */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--spacing-lg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ==================== ヘッダー ==================== */
.header {
  text-align: center;
  position: relative;
}

.header-back {
  display: inline-block;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  padding: 8px 12px;
  z-index: 10;
  transition: var(--transition);
}

.header-back:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: var(--spacing-sm);
}

.subtitle {
  font-size: 0.95rem;
  color: var(--text-light);
}

/* ==================== メインエリア ==================== */
.main {
  flex: 0 0 auto;
}
/* ゲーム画面ではbingo-boardの下マージンを削除（containerのgapで制御） */
.main .bingo-board {
  margin-bottom: 0;
}

/* ==================== ビンゴボード ==================== */
.bingo-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--card-bg);
  padding: 2px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--spacing-lg);
  position: relative;
}

/* ビンゴセル（画像・テキストは中央寄せ） */
.bingo-cell {
  aspect-ratio: 5 / 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;

  background: var(--cell-bg);
  border: 1px solid var(--cell-border);
  border-radius: var(--radius-sm);

  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;

  transition: var(--transition);

  overflow: hidden;
  padding: 2px;
  padding-bottom: 2px;
}

/* ==================== 難易度グラデーション ==================== */
/* むずかしい：薄めローズ */
.bingo-cell.cell-diff-hard {
  background: linear-gradient(145deg, #fff0f0 0%, #fdd0d0 100%);
}
/* おに：濃い赤 */
.bingo-cell.cell-diff-oni {
  background: linear-gradient(145deg, #f9a0a0 0%, #f07070 100%);
}

/* ==================== ランドマーク ☆ ==================== */
@keyframes landmark-sparkle {
  0%   { box-shadow: inset 0 0 0px 0px rgba(255, 200, 0, 0); }
  40%  { box-shadow: inset 0 0 8px 3px rgba(255, 200, 0, 0.6); }
  100% { box-shadow: inset 0 0 0px 0px rgba(255, 200, 0, 0); }
}
.bingo-cell.cell-landmark {
  background: linear-gradient(145deg, #fffbe6 0%, #fff0b0 100%);
  border-color: #f5c800;
  animation: landmark-sparkle 2.4s ease-in-out infinite;
}
.bingo-cell.cell-landmark .cell-text::before {
  content: '☆ ';
  color: #f5c800;
  font-size: 0.75em;
}

/* マーク・ビンゴ・FREE 時はグラデーションを上書き */
.bingo-cell.marked,
.bingo-cell.bingo,
.bingo-cell.free,
.bingo-cell.locked,
.bingo-cell.claimed-self {
  background: unset;
}
.bingo-cell.marked      { background: var(--cell-marked); }
.bingo-cell.bingo       { background: var(--cell-bingo); }
.bingo-cell.free        { background: var(--cell-free); }
.bingo-cell.locked,
.bingo-cell.locked.marked { background: #cfd8dc; }
.bingo-cell.claimed-self  { background: #157F1F; }

/* ===== バトルモード: プレイヤー4色 ===== */
.bingo-cell.claimed-blue.claimed-self   { background: #1565c0; border-color: #0d47a1; color: #fff; }
.bingo-cell.claimed-red.claimed-self    { background: #c62828; border-color: #7f0000; color: #fff; }
.bingo-cell.claimed-yellow.claimed-self { background: #f9a825; border-color: #e65100; color: #333; }
.bingo-cell.claimed-green.claimed-self  { background: #2e7d32; border-color: #1b5e20; color: #fff; }
.bingo-cell.claimed-blue.locked        { background: #bbdefb; border-color: #90caf9; color: #0d47a1; }
.bingo-cell.claimed-red.locked         { background: #ffcdd2; border-color: #ef9a9a; color: #7f0000; }
.bingo-cell.claimed-yellow.locked      { background: #fff9c4; border-color: #fff176; color: #e65100; }
.bingo-cell.claimed-green.locked       { background: #c8e6c9; border-color: #a5d6a7; color: #1b5e20; }

/* ===== バトルスコアボード ===== */
.battle-scoreboard {
  margin: 0;
  padding: 10px 14px;
  background: #f8faf8;
  border: 1.5px solid #d0e8d0;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.battle-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.battle-score-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.battle-color-blue   { background: #1565c0; }
.battle-color-red    { background: #c62828; }
.battle-color-yellow { background: #f9a825; }
.battle-color-green  { background: #2e7d32; }
.battle-score-name   { flex: 1; font-weight: 700; color: #1a1a1a; display: flex; align-items: center; gap: 5px; }
.battle-score-you    { font-size: 10px; font-weight: 600; color: #fff; background: #1e88e5; border-radius: 4px; padding: 1px 5px; line-height: 1.4; }
.battle-score-row--me { background: rgba(30, 136, 229, 0.06); border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
.battle-score-marks  { color: #555; font-size: 12px; }
.battle-score-bingo  { color: #157F1F; font-weight: 600; font-size: 12px; }
.battle-score-total  { font-weight: 800; color: #1e5c3a; min-width: 36px; text-align: right; }

/* ホバー効果 */
.bingo-cell:hover {
  background: var(--cell-hover);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

/* アクティブ効果 */
.bingo-cell:active {
  transform: translateY(0);
}

/* マーク済み */
.bingo-cell.marked {
  background: var(--cell-marked);
  border-color: var(--primary-dark);
  color: white;
}

/* FREE（中央マス：中央寄せ） */
.bingo-cell.free {
  justify-content: center;
  background: var(--cell-free);
  border-color: var(--primary);
  color: white;
  font-weight: 600;
}

/* カスタムお題 */
.bingo-cell.custom {
  border-style: dashed;
  border-color: var(--primary-light);
}

.bingo-cell.custom.marked {
  border-style: solid;
}

/* ビンゴライン */
.bingo-cell.bingo {
  background: var(--cell-bingo);
  border-color: var(--accent);
  color: white;
  animation: bingoPulse 0.6s ease-in-out;
}

.bingo-cell.locked,
.bingo-cell.locked.marked {
  opacity: 1;
  background: #cfd8dc;
  border-color: #90a4ae;
  color: #37474f;
}

.bingo-cell.claimed-self {
  background: #157F1F;
  border-color: #0e5c16;
  color: #fff;
}

/* セル内のアイコン：セル幅の%ベースで固定サイズ */
.cell-icon {
  /* 絵文字フォールバック用 */
  font-size: clamp(1.2rem, 6vw, 2rem);
  line-height: 1;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-height: 0;
}

/* 画像アイコンのラッパー：フレックス残余高さを使い正方形に収める */
.cell-icon-img-wrap {
  font-size: 0;
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  width: auto;
  max-width: 96%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 画像はラッパーいっぱいに表示 */
.cell-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.bingo-cell:hover .cell-icon {
  transform: scale(1.1);
}

/* セル内のテキスト */
.cell-text {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 100%;
}

/* テキスト長に応じた文字サイズ（アイコンは一切変えない） */
.cell-text-s   { font-size: 1rem; }
.cell-text-m   { font-size: 0.88rem; }
.cell-text-l   { font-size: 0.72rem; }
/* 9文字以上：小さめのフォントで2行折り返し */
.cell-text-xl  {
  font-size: 0.65rem;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}
.cell-text-xxl {
  font-size: 0.60rem;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
}

/* 長テキスト時はgapを詰める（アイコンサイズは変更しない） */
.bingo-cell.cell-len-l,
.bingo-cell.cell-len-xl,
.bingo-cell.cell-len-xxl {
  gap: 0px;
  padding-bottom: 1px;
}

/* マーク済みセルのテキスト */
.bingo-cell.marked .cell-text,
.bingo-cell.free .cell-text {
  font-weight: 600;
}

/* ==================== アニメーション ==================== */
@keyframes bingoPulse {
  0%, 100% { filter: brightness(1); }
  50%       { filter: brightness(1.18); }
}

/* マーク時のポップアニメーション（スケール廃止→内側グロー） */
@keyframes markPop {
  0%   { box-shadow: inset 0 0 0 0 rgba(255,255,255,0); filter: brightness(1); }
  40%  { box-shadow: inset 0 0 0 5px rgba(255,255,255,0.55); filter: brightness(1.22); }
  100% { box-shadow: inset 0 0 0 0 rgba(255,255,255,0); filter: brightness(1); }
}

.bingo-cell.just-marked {
  animation: markPop 0.35s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes slideDown {
  from { opacity: 1; transform: translate(-50%, 0); }
  to   { opacity: 0; transform: translate(-50%, 20px); }
}

/* ==================== リーチ演出 ==================== */
@keyframes reachGlow {
  0%, 100% {
    background: #dbeafe;
    box-shadow: inset 0 0 0 3px rgba(21, 101, 192, 0.8);
  }
  50% {
    background: #bfdbfe;
    box-shadow: inset 0 0 0 3px rgba(21, 101, 192, 1);
  }
}

.bingo-cell.reach {
  animation: reachGlow 0.9s ease-in-out infinite;
  color: #1e3a6e;
}

@keyframes reachToastIn {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.7) translateY(-6px); }
  60%  { opacity: 1; transform: translateX(-50%) scale(1.05) translateY(0); }
  100% { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

@keyframes reachToastOut {
  from { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) scale(0.9) translateY(-8px); }
}

.reach-toast {
  position: fixed;
  top: max(env(safe-area-inset-top, 0px), 16px);
  left: 50%;
  transform: translateX(-50%);
  background: #1565c0;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  padding: 8px 22px;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(21, 101, 192, 0.55);
  z-index: 1200;
  white-space: nowrap;
  pointer-events: none;
  animation: reachToastIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.reach-toast.out {
  animation: reachToastOut 0.3s ease-in forwards;
}

/* ==================== ビンゴ演出 ==================== */
@keyframes cellFlash {
  0%   { filter: brightness(1); }
  25%  { filter: brightness(0.65) contrast(1.3); }
  55%  { filter: brightness(1.15); }
  100% { filter: brightness(1); }
}

.bingo-cell.bingo-flash {
  animation: cellFlash 0.55s ease-out;
}

/* コンフェッティ */
.confetti-wrap {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1500;
  overflow: hidden;
}

@keyframes confettiFall {
  0%   { transform: translateY(-40px) rotate(0deg);   opacity: 1; }
  100% { transform: translateY(110vh) rotate(var(--rot)); opacity: 0; }
}

.confetti-piece {
  position: absolute;
  top: 0;
  opacity: 0;
  animation: confettiFall var(--dur) var(--delay) ease-in forwards;
}

/* ビンゴ祝福テキスト */
@keyframes bingoTextPop {
  0%   { transform: translate(-50%, -50%) scale(0)    rotate(-8deg); opacity: 0; }
  25%  { transform: translate(-50%, -50%) scale(1.12) rotate(2deg);  opacity: 1; }
  40%  { transform: translate(-50%, -50%) scale(0.96) rotate(0deg);  opacity: 1; }
  55%  { transform: translate(-50%, -50%) scale(1)    rotate(0deg);  opacity: 1; }
  80%  { transform: translate(-50%, -50%) scale(1)    rotate(0deg);  opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.88) rotate(0deg);  opacity: 0; }
}

.bingo-celebration-text {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1600;
  pointer-events: none;
  text-align: center;
  line-height: 1.2;
  background: rgba(18, 18, 40, 0.88);
  padding: 20px 36px 18px;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  animation: bingoTextPop 2.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.bingo-celebration-text .big {
  display: block;
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 900;
  color: #ffd600;
  text-shadow: 0 2px 12px rgba(255, 214, 0, 0.55);
}

.bingo-celebration-text .sub {
  display: block;
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

.full-clear-text {
  background: rgba(10, 10, 30, 0.92);
  border: 2px solid rgba(255, 214, 0, 0.4);
}

.full-clear-text .big {
  font-size: clamp(2.4rem, 10vw, 4.2rem);
  background: linear-gradient(135deg, #ffd600, #ff6d00, #ffd600);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 12px rgba(255, 180, 0, 0.7));
}

/* ==================== ビンゴメッセージ ==================== */
.bingo-message {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  padding: var(--spacing-sm) var(--spacing-md);
  background: #c05000;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  margin-bottom: 0;
}

.bingo-message.pulse {
  animation: bingoPulse 0.6s ease-in-out;
}

/* ==================== 統計表示 ==================== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: var(--spacing-xs);
  margin-bottom: 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;

  background: var(--card-bg);
  padding: 6px 4px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  min-height: 48px;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-light);
  font-weight: 500;
  text-align: center;
}

.stat-value {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary-dark);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  word-break: keep-all;
  overflow-wrap: break-word;
  line-height: 1.2;
}

.stat-item-clickable {
  cursor: pointer;
  transition: var(--transition);
}

.stat-item-clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: var(--cell-hover);
}

.stat-item-clickable:active {
  transform: translateY(0);
}

.stat-item-as-btn {
  cursor: pointer;
  border: none;
  background: var(--card-bg);
  font: inherit;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.stat-item-as-btn:hover {
  background: var(--cell-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-item-as-btn .stat-value {
  display: none;
}

/* ==================== コントロール ==================== */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  justify-content: center;
}

.btn {
  padding: 10px var(--spacing-lg);
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn:focus-visible {
  outline: 3px solid var(--primary-light);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: white;
  color: var(--text);
  border: 2px solid var(--cell-border);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.btn-secondary.marked {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-secondary.marked:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* ==================== 説明エリア ==================== */
.info {
  background: var(--card-bg);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.info h2 {
  font-size: 1.25rem;
  color: var(--primary-dark);
  margin-bottom: var(--spacing-md);
}

.info ol {
  margin-left: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.info li {
  margin-bottom: var(--spacing-sm);
  color: var(--text-light);
}

.info-details {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--cell-border);
}

.info-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: var(--spacing-sm);
  user-select: none;
}

.info-details summary:hover {
  color: var(--primary);
}

.info-details ul {
  margin-left: var(--spacing-lg);
  margin-top: var(--spacing-md);
}

.info-details li {
  margin-bottom: var(--spacing-sm);
}

/* ==================== モーダル ==================== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--card-bg);
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  
  position: relative;
  animation: fadeInUp 0.3s ease;
}

.modal-content.modal-large {
  max-width: 700px;
}

.modal-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--text-light);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  
  width: 36px;
  height: 36px;
  border-radius: 50%;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--cell-border);
  color: var(--text);
}

.modal-close:focus-visible {
  outline: 3px solid var(--primary-light);
  outline-offset: 2px;
}

/* 結果画面ライトボックス */
.result-photo-modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--spacing-sm);
  padding-right: 36px; /* ×ボタン分 */
}
.result-photo-modal-img {
  display: block;
  width: 100%;
  max-height: 52vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
}

.modal-content h2 {
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin-bottom: var(--spacing-md);
  text-align: center;
}

.modal-description {
  text-align: center;
  color: var(--text-light);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: var(--spacing-lg);
  padding: 0 var(--spacing-sm);
}

/* モード選択ボタン */
.mode-select-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: var(--spacing-lg);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border: 2px solid var(--cell-border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mode-btn:hover {
  border-color: var(--primary);
  background: #f0f8f4;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.mode-btn:active {
  transform: translateY(0);
}

.mode-btn-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.mode-btn-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: block;
}

.mode-btn-desc {
  font-size: 0.78rem;
  color: var(--text-light);
  display: block;
  margin-top: 2px;
}

/* ステップ戻るリンク（セクション区切り線付き） */
.modal-step-back {
  text-align: center;
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--cell-border);
}

/* ===== 参加ステップ：ルームコードステータス ===== */
.join-room-status {
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 1.4em;
  transition: color 0.2s;
}
.join-room-status.status-checking { color: #888; }
.join-room-status.status-found    { color: #2e7d52; }
.join-room-status.status-empty    { color: #888; }
.join-room-status.status-error    { color: #c0392b; }

/* 参加ステップ：ルーム設定サマリー */
.join-room-info {
  background: #f0f8f0;
  border: 1.5px solid #4aaf54;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: var(--spacing-md);
}
.join-room-info-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #157F1F;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.join-room-info-content {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.join-room-info-chip {
  background: #fff;
  border: 1px solid #4aaf54;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #2e6648;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 0.88rem;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.link-btn:hover {
  color: var(--primary-dark);
  background: rgba(126, 184, 154, 0.1);
}

.modal-back-link {
  text-align: center;
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--cell-border);
}

.link-back-top {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.link-back-top:hover {
  text-decoration: underline;
}

/* フォーム要素 */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--spacing-sm);
  font-size: 0.95rem;
}

.form-help {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: var(--spacing-xs);
}

.play-mode-options {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-xs);
}
.play-mode-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--cell-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  background: var(--card-bg);
}
.play-mode-option:hover {
  border-color: var(--primary-light);
  background: var(--cell-hover);
}
.play-mode-option input {
  margin: 0;
}
.play-mode-label {
  font-weight: 600;
  color: var(--text);
}
.play-mode-desc {
  font-size: 0.8rem;
  color: var(--text-light);
  width: 100%;
  margin-left: 1.6rem;
}

/* フリー入力マス */
.custom-topic-inputs {
  margin-top: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--cell-border);
}

.custom-topic-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.custom-topic-num {
  width: 22px;
  height: 22px;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.custom-topic-input {
  flex: 1;
  padding: 10px 12px !important;
  font-size: 14px !important;
  border-width: 1px !important;
}

.input-text {
  width: 100%;
  padding: var(--spacing-md);
  border: 2px solid var(--cell-border);
  border-radius: var(--radius-sm);
  font-size: 16px; /* iOSでフォーカス時のズームを防ぐ */
  transition: var(--transition);
}

.input-text:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(126, 184, 154, 0.15);
}

.input-text::placeholder {
  color: var(--text-lighter);
}


.input-with-button {
  display: flex;
  gap: var(--spacing-sm);
}

.input-with-button .input-text {
  flex: 1;
}

.btn-icon {
  padding: var(--spacing-md);
  white-space: nowrap;
  min-width: auto;
}

.select-box {
  width: 100%;
  padding: var(--spacing-md);
  border: 2px solid var(--cell-border);
  border-radius: var(--radius-sm);
  font-size: 16px; /* iOSでフォーカス時のズームを防ぐ */
  background: white;
  cursor: pointer;
  transition: var(--transition);
}

.select-box:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-large {
  width: 100%;
  padding: 16px var(--spacing-lg);
  font-size: 1.05rem;
  min-height: 52px;
}

/* マス詳細モーダル */
.cell-modal-header {
  text-align: center;
  margin-bottom: var(--spacing-sm);
}

.cell-modal-icon {
  font-size: 5rem;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell-modal-icon .cell-icon-img {
  width: 100%;
  max-width: 512px;
  height: auto;
  object-fit: contain;
}

.cell-modal-header h2 {
  margin: 0 0 var(--spacing-xs) 0;
}

.cell-modal-description {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0;
}

.cell-modal-notice {
  font-size: 0.75rem;
  color: var(--text-light);
  margin: 0 0 var(--spacing-sm) 0;
  line-height: 1.4;
}

/* ---- State A/B 共通: 写真ヘッダー（タイトル + バッジ） ---- */
.cell-photo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-sm);
  gap: var(--spacing-sm);
  padding-right: 44px; /* ×ボタン（36px）+ right:16px 分の被り防止 */
}

.cell-photo-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-marked-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary-dark);
  background: #e8f5e8;
  border: 1px solid #4aaf54;
  border-radius: 20px;
  padding: 2px 10px;
}

.cell-preview-badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #1565c0;
  background: #e3f0fb;
  border: 1px solid #b3d0f0;
  border-radius: 20px;
  padding: 2px 10px;
}

/* ---- State A: 写真表示 ---- */
.cell-photo-display {
  margin-bottom: var(--spacing-lg);
}

.cell-photo-display img {
  width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-sm);
  display: block;
}

/* 写真表示時のアクションボタン行（保存・変更・削除） */
.cell-photo-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-xs);
}

.cell-photo-actions .btn {
  flex: 1;
  min-width: 0;
}

/* ---- State B: プレビュー ---- */
.photo-preview {
  margin-bottom: var(--spacing-lg);
}

.photo-preview img {
  width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-sm);
  display: block;
}

.photo-preview-actions {
  display: flex;
  gap: var(--spacing-md);
}

.photo-preview-actions .btn {
  flex: 1;
}

/* ---- State C: 写真なし ---- */
.cell-modal-no-photo {
  flex-direction: column;
  gap: var(--spacing-md);
  margin-top: var(--spacing-sm);
  width: 100%;
}

.cell-modal-no-photo .btn {
  width: 100%;
  box-sizing: border-box;
}

.cell-modal-actions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

/* 写真関連（旧互換） */
.photo-actions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.btn-small {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.9rem;
}

.photo-view-container {
  margin: var(--spacing-lg) 0;
}

.photo-view-container img {
  width: 100%;
  border-radius: var(--radius-md);
}

.btn-danger {
  background: #ff6b6b;
  color: white;
}

.btn-danger:hover {
  background: #ff5252;
}

.btn-danger:active {
  background: #e04848;
}

/* 写真付きセル：上に写真・下にテキスト（アップロード前と同じ並び） */
.bingo-cell.has-photo {
  justify-content: flex-end;
}

.bingo-cell.has-photo .cell-photo-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.bingo-cell.has-photo .cell-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.bingo-cell.has-photo .cell-text {
  flex-shrink: 0;
  color: inherit;
}

/* ==================== 終了・結果画面 ==================== */
.screenshot-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  z-index: 1100;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--spacing-lg);
  animation: fadeIn 0.2s ease;
}

.screenshot-view-inner {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  padding-bottom: var(--spacing-md);
}

/* 編集モード：結果カード */
.result-edit-area,
.result-share-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.result-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-md);
}

.result-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0 0 var(--spacing-xs) 0;
  text-align: center;
  letter-spacing: 0.02em;
}

.result-meta {
  text-align: center;
  margin-bottom: var(--spacing-md);
}

.result-date {
  font-size: 0.85rem;
  color: var(--text-light);
}

.result-playtime {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-left: var(--spacing-sm);
}

.result-board-wrap {
  background: rgba(168, 213, 186, 0.12);
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
}

.result-board-wrap .bingo-board {
  margin-bottom: 0;
  gap: 1px;
  padding: 2px;
}

/* 結果画面のビンゴマス：%ベースレイアウトを継承（rem 固定指定なし）
   テキストは cloneNode 後に fitCellText() で再フィット済み */
.result-board-wrap .cell-text,
.result-capture-board .cell-text {
  font-size: 0.8rem;
}

/* 結果ボードの xl/xxl はゲームボードと同じ2行折り返し（高さはJSで固定済み） */
.result-board-wrap .cell-text-xl,
.result-board-wrap .cell-text-xxl,
.result-capture-board .cell-text-xl,
.result-capture-board .cell-text-xxl {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 結果画面: セルは原則タップ無効・ホバーなし */
.result-board-wrap .bingo-cell {
  cursor: default;
  pointer-events: none;
}
.result-board-wrap .bingo-cell:hover {
  transform: none;
  box-shadow: none;
  background: var(--cell-bg);
  border-color: var(--cell-border);
}
.result-board-wrap .bingo-cell.marked:hover {
  background: var(--cell-marked);
  border-color: var(--primary-dark);
}
.result-board-wrap .bingo-cell.bingo:hover {
  background: var(--cell-bingo);
  border-color: var(--accent);
}

/* 写真ありセルのみタップ可能・拡大ヒント */
.result-board-wrap .bingo-cell.has-photo {
  cursor: zoom-in;
  pointer-events: auto;
}
.result-board-wrap .bingo-cell.has-photo:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  background: var(--cell-bg);
  border-color: var(--primary-light);
}

/* 写真ライトボックス */
.result-photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fadeIn 0.2s ease;
  padding: 16px;
}

.result-photo-lightbox img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.result-photo-lightbox-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  pointer-events: none;
}

.result-stats-row {
  display: flex;
  justify-content: center;
  gap: var(--spacing-xl);
  padding-top: var(--spacing-sm);
  border-top: 1px solid var(--cell-border);
}

.result-stat {
  font-size: 1rem;
  color: var(--text);
}

.result-stat strong {
  color: var(--primary-dark);
  font-weight: 700;
}

.result-group-form {
  width: 100%;
}

.result-group-form label {
  display: block;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--spacing-sm);
  font-size: 0.9rem;
}

.result-edit-actions {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
  margin-top: var(--spacing-md);
}

.result-edit-actions .btn {
  flex: 1;
  min-width: 0;
}

@media (max-width: 480px) {
  .result-edit-actions {
    flex-direction: column;
  }

  .result-edit-actions .btn {
    width: 100%;
    min-height: 48px;
  }
}

/* キャプチャエリア（画像化・SNS共有用） */
.result-capture-area {
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-md);
}

.result-capture-header {
  text-align: center;
  margin-bottom: var(--spacing-md);
}

.result-capture-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0 0 var(--spacing-xs) 0;
  letter-spacing: 0.02em;
}

.result-capture-meta {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0;
  line-height: 1.5;
}

.result-meta-divider {
  margin: 0 4px;
  opacity: 0.6;
}

.result-meta-divider.hidden {
  display: none;
}

.result-capture-board {
  background: rgba(168, 213, 186, 0.12);
  padding: var(--spacing-sm);
  border-radius: var(--radius-md);
  margin: 0 0 var(--spacing-md) 0;
}

.result-capture-board .bingo-board {
  margin-bottom: 0;
  gap: 1px;
  padding: 2px;
}

.result-capture-stats {
  display: flex;
  justify-content: center;
  gap: var(--spacing-xl);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--cell-border);
  font-size: 0.95rem;
  color: var(--text);
}

.result-capture-stats strong {
  color: var(--primary-dark);
}

.result-notice {
  font-size: 0.8rem;
  color: var(--text-light);
  margin: var(--spacing-sm) 0 0 0;
  line-height: 1.4;
  text-align: center;
}

.result-share-buttons {
  display: flex;
  gap: var(--spacing-md);
}

.result-share-buttons .btn {
  flex: 1;
  min-width: 0;
}

/* 全写真をまとめて保存：メインボタンより控えめなサイズ */
.result-sub-btn {
  width: 100%;
  margin-top: 0;
  font-size: 0.9rem;
  padding: 10px var(--spacing-md);
}

/* トップへ戻る：リンクスタイル */
.result-exit-btn {
  display: block;
  width: 100%;
  margin-top: 0;
  text-align: center;
}

@media (max-width: 480px) {
  .screenshot-view-inner {
    padding: 0;
  }
  .result-card,
  .result-capture-area {
    padding: var(--spacing-sm);
  }
  .result-board-wrap,
  .result-capture-board {
    padding: var(--spacing-xs);
  }
  .result-share-buttons {
    flex-direction: column;
  }
  .result-share-buttons .btn {
    width: 100%;
  }
}

/* ==================== 確認・通知モーダル ==================== */
.dialog-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
  animation: fadeIn 0.2s ease;
}

.dialog-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.dialog-modal-content {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl) var(--spacing-lg);
  max-width: 340px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.25s ease;
  text-align: center;
}

.dialog-modal-message {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 var(--spacing-xl) 0;
  white-space: pre-line;
}

.dialog-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.dialog-modal-actions.alert-only .dialog-cancel {
  display: none;
}

.dialog-modal .dialog-btn {
  min-width: 110px;
  min-height: 44px;
  padding: 12px 20px;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
}

/* ==================== フッター ==================== */
.footer {
  text-align: center;
  padding-top: var(--spacing-lg);
  color: var(--text-lighter);
  font-size: 0.85rem;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.footer a:hover {
  text-decoration: underline;
}

/* ==================== レスポンシブ（スマホ最適化） ==================== */
@media (max-width: 600px) {
  .container {
    padding: max(var(--spacing-md), env(safe-area-inset-left)) max(var(--spacing-md), env(safe-area-inset-right));
    gap: var(--spacing-md);
  }

  .header-back {
    min-height: 44px;
    padding: 12px 16px;
    display: inline-flex;
    align-items: center;
  }

  .controls .btn {
    min-height: 48px;
    padding: 14px 20px;
  }

  .modal {
    padding: max(var(--spacing-sm), env(safe-area-inset-top)) var(--spacing-md);
  }

  .modal-close {
    width: 44px;
    height: 44px;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
  }

  .screenshot-view {
    padding: max(var(--spacing-md), env(safe-area-inset-top)) var(--spacing-md);
  }
}

@media (max-width: 600px) {
  .bingo-board {
    margin-bottom: 6px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right));
    gap: var(--spacing-md);
  }

  .header-back {
    position: static;
    transform: none;
    display: block;
    margin-bottom: 8px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }
  
  .bingo-board {
    gap: 1px;
    padding: 2px;
    margin-bottom: 6px;
  }

  .bingo-cell {
    min-height: 0;
  }

  .stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .stat-item {
    min-height: 52px;
    padding: 8px 6px;
  }

  .stat-label {
    font-size: 0.62rem;
  }

  .stat-value {
    font-size: 0.88rem;
    white-space: normal;
    word-break: break-all;
    overflow: visible;
    text-overflow: unset;
    text-align: center;
  }
  
  .controls {
    flex-direction: row;
    gap: var(--spacing-sm);
  }

  .controls .btn {
    flex: 1;
    min-height: 48px;
    padding: 14px 8px;
    font-size: 0.95rem;
  }
  
  .modal {
    padding: var(--spacing-sm);
    align-items: center;
  }
  
  .modal-content {
    padding: 20px 16px;
    max-height: 90vh;
    overflow-y: auto;
    margin: auto 0;
  }

  .modal-content h2 {
    font-size: 1.3rem;
    margin-bottom: var(--spacing-sm);
  }

  .modal-description {
    font-size: 0.82rem;
    padding: 0;
    margin-bottom: var(--spacing-md);
  }

  .form-group label {
    font-size: 0.88rem;
    margin-bottom: 6px;
  }

  .form-help {
    font-size: 0.75rem;
  }

  .input-text {
    padding: 12px;
  }

  .select-box {
    padding: 12px;
  }

  .btn-icon {
    padding: 12px 10px;
    font-size: 0.85rem;
  }

  .form-group {
    margin-bottom: var(--spacing-md);
  }

  .info-details summary {
    padding: 12px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .footer {
    padding: var(--spacing-md) 0;
  }

  .footer a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 8px 0;
  }

  .result-share-buttons .btn,
  .result-sub-btn {
    min-height: 48px;
  }

  .dialog-modal {
    padding: var(--spacing-md);
  }

  .dialog-modal .dialog-btn {
    min-height: 48px;
  }
}

@media (max-width: 360px) {
  .bingo-board {
    gap: 1px;
    padding: 2px;
  }

  .stat-item {
    min-height: 48px;
  }

  /* 極狭画面: モーダルの余白を最小化 */
  .modal {
    padding: 4px;
  }

  .modal-content {
    padding: 16px 12px;
    border-radius: var(--radius-md);
  }

  .modal-content h2 {
    font-size: 1.2rem;
  }

  .modal-description {
    font-size: 0.78rem;
  }

  .form-group label {
    font-size: 0.82rem;
  }

  .input-with-button {
    gap: 4px;
  }

  .btn-icon {
    padding: 10px 8px;
    font-size: 0.8rem;
  }
}

/* ========== 広告枠（共通） ========== */
.ad-slot {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

.ad-slot-inner {
  width: 100%;
  max-width: 728px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ad-slot-label {
  font-size: 0.65rem;
  color: #aaa;
  letter-spacing: 0.05em;
  line-height: 1;
}

.ad-placeholder {
  width: 300px;
  height: 250px;
  background: #f5f5f5;
  border: 1px dashed #ddd;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.ad-placeholder-banner {
  width: 100%;
  max-width: 728px;
  height: 90px;
}

.ad-placeholder-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: #ccc;
  letter-spacing: 0.1em;
}

.ad-placeholder-sub {
  font-size: 0.7rem;
  color: #ccc;
}

/* 結果画面の広告枠 */
.ad-slot-result {
  margin: 16px 0 8px;
}

@media (max-width: 600px) {
  .ad-placeholder {
    width: 100%;
    max-width: 300px;
    height: 250px;
  }

  .ad-placeholder-banner {
    max-width: 100%;
    height: 60px;
  }
}

/* お題セット選択（将来の有料・スポンサー拡張の受け口） */
.topic-set-select {
  max-width: 100%;
}

.form-help.topic-set-help {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #3d5a4a;
  margin-top: 6px;
}
