/* 地雷さがし 固有の見た目（共通は ../common/base.css） */
[hidden] { display: none !important; }
.board-wrap { max-width: none; }

/* 盤は紙の盤のように、ダーク表示でも明るいまま（数字の色を保つ） */
.mine-scroll {
  --closed: #C9D4DF; --closed-hi: #DCE4EC; --closed-lo: #9AABBD; --opened: #F5F2EA; --grid-line: #DCD6C8;
  --n1: #2F6DB5; --n2: #2E7D4F; --n3: #B23A3A; --n4: #3E3A8C; --n5: #8A4A1C; --n6: #1D7874; --n7: #1F2328; --n8: #6B6F76;
  position: relative; margin: 0 auto; max-width: 100%; overflow: auto; overscroll-behavior: contain;
  border-radius: var(--radius); -webkit-overflow-scrolling: touch;
}
.mine-scroll.scrolls { max-height: max(300px, calc(100svh - 230px)); border: 2px solid var(--line); }
.mine-box { width: max-content; margin: 0 auto; }
.grid {
  --cell: 36px;
  display: grid; grid-template-columns: repeat(var(--w), var(--cell)); grid-auto-rows: var(--cell);
  background: var(--grid-line); gap: 1px; padding: 1px; border-radius: 4px; width: max-content;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  font-family: var(--font); font-weight: 800; font-size: max(12px, calc(var(--cell) * 0.58)); line-height: 1;
  outline: none;
}
.grid.won { background: #9CCBAE; }
.c { position: relative; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
/* 開いていないマス: 手で触る物なので、ほんのり立体（上が明るく下が暗い縁） */
.c.closed {
  background: var(--closed); cursor: pointer;
  box-shadow: inset 0 2px 0 var(--closed-hi), inset 0 -2px 0 var(--closed-lo);
  border-radius: 3px;
}
@media (hover: hover) { .grid:not(.over) .c.closed:hover { background: #D6DFE8; } }
.c.open { background: var(--opened); color: var(--ink); }
.c.n1 { color: var(--n1); } .c.n2 { color: var(--n2); } .c.n3 { color: var(--n3); } .c.n4 { color: var(--n4); }
.c.n5 { color: var(--n5); } .c.n6 { color: var(--n6); } .c.n7 { color: var(--n7); } .c.n8 { color: var(--n8); }

/* 旗と地雷（SVG を背景に） */
.c.flag::after, .c.mine::after {
  content: ''; position: absolute; inset: 12%; background: center / contain no-repeat;
}
.c.flag::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Crect x='8.6' y='3' width='1.9' height='12.6' fill='%234A4F57'/%3E%3Crect x='5' y='15.2' width='9.6' height='2.4' rx='1' fill='%234A4F57'/%3E%3Cpath d='M10.4 2.6 L17 6.5 L10.4 10.4 Z' fill='%23C8453B' stroke='%23973029' stroke-width='.8' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.c.mine::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cg stroke='%232B3038' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M10 2.6V17.4M2.6 10H17.4M4.8 4.8L15.2 15.2M15.2 4.8L4.8 15.2'/%3E%3C/g%3E%3Ccircle cx='10' cy='10' r='5.4' fill='%232B3038'/%3E%3Ccircle cx='8.2' cy='8.2' r='1.5' fill='%23FFFFFF' opacity='.75'/%3E%3C/svg%3E"); }
.c.mine.boom { background: #F1C9C4; }
.c.flag.wrong::before {
  content: ''; position: absolute; inset: 8%; z-index: 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4 4L16 16M16 4L4 16' stroke='%23FFFFFF' stroke-width='4.4' stroke-linecap='round'/%3E%3Cpath d='M4 4L16 16M16 4L4 16' stroke='%23B23A3A' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* 開いたときの小さな動き（0 のマスから広がる順に） */
.c.pop { animation: open .16s ease-out both; animation-delay: var(--dl, 0ms); }
@keyframes open { from { transform: scale(.82); opacity: .35; } to { transform: none; opacity: 1; } }
.c.flag.pop::after { animation: flagin .2s ease-out both; }
@keyframes flagin { from { transform: translateY(-18%) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
.c.mine.pop::after { animation: minein .22s ease-out both; animation-delay: var(--dl, 0ms); }
@keyframes minein { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* 目印: キーボードのカーソル、ヒント、数字を押したときのまわり、旗が足りないとき */
.c.cur { outline: 3px solid var(--accent); outline-offset: -3px; z-index: 2; }
.c.hint-safe { outline: 3px dashed #2E7D4F; outline-offset: -3px; z-index: 2; }
.c.hint-safe.closed { background: #CFE6D6; box-shadow: none; }
.c.hint-mine { outline: 3px dashed #B7791F; outline-offset: -3px; z-index: 2; }
.c.hint-from { outline: 3px solid #B7791F; outline-offset: -3px; z-index: 2; }
.c.peek.closed { background: #E8EEF3; box-shadow: inset 0 0 0 2px #9AABBD; }
.c.wrongflag { outline: 3px dashed #B23A3A; outline-offset: -3px; z-index: 2; }

/* 手番のバー: 大きさ・残りの地雷・時計 */
.status { flex-wrap: wrap; column-gap: 12px; row-gap: 0; }
.st-name { white-space: nowrap; }
.lv { display: inline-block; white-space: nowrap; font-size: 14px; font-weight: 700; padding: 0 8px; border-radius: 999px; border: 1.5px solid currentColor; margin-left: 6px; vertical-align: middle; color: var(--accent); }
.left { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.left svg { width: 20px; height: 20px; }
.left b { font-size: 1.15em; }
.timer { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 18px; min-width: 56px; text-align: right; margin-left: auto; }

/* 開ける／旗 の切り替え */
.seg { display: inline-flex; border: 2px solid var(--accent); border-radius: var(--radius); overflow: hidden; }
.seg-b {
  appearance: none; font: inherit; font-size: 17px; font-weight: 700; min-height: var(--tap); padding: 0 14px;
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--surface); color: var(--accent); cursor: pointer;
}
.seg-b + .seg-b { border-left: 2px solid var(--accent); }
.seg-b svg { width: 20px; height: 20px; }
.seg-b[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); }
.seg-b:focus-visible { outline: 3px solid var(--warn); outline-offset: -3px; }
.zoom { display: inline-flex; gap: 4px; margin-left: auto; }
.zoom .btn { min-width: var(--tap); font-size: 20px; padding: 0; }
#tools2 { margin-top: 8px; }

/* ヒント */
.think { margin: 10px auto 0; border: 2px solid var(--line); border-left: 6px solid var(--warn); border-radius: var(--radius); padding: 10px 14px; background: var(--surface); }
.think h3 { margin: 0 0 4px; font-size: 16px; }
.think p { margin: 0 0 6px; }
.think p:last-child { margin-bottom: 0; }

/* 自分で決める */
.custom { border-left: 4px solid var(--line); padding-left: 12px; margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.custom .hint { flex-basis: 100%; margin: 0; }
.num-field { display: inline-flex; align-items: center; gap: 6px; }
.num-field input { width: 4.2em; min-height: var(--tap); font: inherit; font-size: 17px; padding: 0 8px; border: 2px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.num-field input:focus-visible { outline: 3px solid var(--warn); outline-offset: 1px; }
.choice input:disabled + span { opacity: .4; }

/* 結果は盤の下に出す（盤を隠さない） */
.result-box { position: static; margin: 10px auto 0; padding: 16px 20px; max-width: 560px; }
.result-box h2 { font-size: 1.4rem; margin-bottom: 4px; }
.result-box .big { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.result-box ul { list-style: none; padding: 0; margin: 0 0 8px; }
.result-box .controls { flex-wrap: wrap; }
.callout { z-index: 5; }

@media (max-width: 420px) {
  .stage { padding: 8px; }
  .controls .btn.icon { padding: 0 9px; }
  .seg-b { padding: 0 10px; font-size: 16px; }
  .result-box { padding: 12px; }
  .result-box h2 { font-size: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { .c.pop, .c.pop::after, .c.flag.pop::after, .c.mine.pop::after { animation: none; } }
.howto img.narrow { max-width: 560px; }
/* 上のバーの高さを一定に（No.93。数字は一番長い文が画面の幅（360px・375px 以上・641px 以上）で何行になるか。--tb-rt はふりがなの分。base.css・turnbar.js） */
.turnbar { --tb-msg-lines: 3; --tb-st-lines: 1; --tb-rt: 0px; --tb-st-rt: 0px; }
@media (min-width: 375px) { .turnbar { --tb-msg-lines: 3; --tb-st-lines: 1; } }
@media (min-width: 641px) { .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
:root:lang(en) .turnbar { --tb-msg-lines: 4; --tb-st-lines: 2.25; --tb-rt: 0px; --tb-st-rt: 0px; }
@media (min-width: 375px) { :root:lang(en) .turnbar { --tb-msg-lines: 4; --tb-st-lines: 2.25; } }
@media (min-width: 641px) { :root:lang(en) .turnbar { --tb-msg-lines: 2; --tb-st-lines: 1; } }
/* 上のバーの高さ ここまで */
