/* 扫雷 —— 棋盘与格子 */

.boardwrap{
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  position: relative;
}

.board{
  display: grid;
  grid-template-columns: repeat(var(--cols, 9), var(--size, 34px));
  gap: var(--gap, 3px);
  padding: var(--gap, 3px);
  background: rgba(6, 10, 20, .6);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(120,160,255,.16),
    0 0 38px rgba(34,211,238,.07),
    0 14px 40px rgba(0,0,0,.45);
}

.sq{
  width: var(--size, 34px);
  height: var(--size, 34px);
  padding: 0;
  border-radius: max(3px, calc(var(--size, 34px) * .16));
  border: 1px solid rgba(255,255,255,.10);
  background:
    linear-gradient(150deg, rgba(255,255,255,.10), rgba(255,255,255,.025)),
    rgba(28, 38, 58, .9);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
  cursor: pointer;
  font-family: var(--mono);
  font-size: calc(var(--size, 34px) * .52);
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background .1s, border-color .1s, transform .06s;
}
.sq:active{ transform: scale(.94); }
.sq svg{ width: 62%; height: 62%; }

/* 翻开之后是凹陷的 */
.sq.open{
  background: rgba(10, 16, 28, .82);
  border-color: rgba(120,160,255,.10);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.4);
  cursor: default;
}
.sq.open:active{ transform: none; }

/* 数字配色：相邻的数不能撞色，暗底上调过明度 */
.sq[data-n="1"]{ color: #60a5fa; }
.sq[data-n="2"]{ color: #4ade80; }
.sq[data-n="3"]{ color: #fb7185; }
.sq[data-n="4"]{ color: #c084fc; }
.sq[data-n="5"]{ color: #fbbf24; }
.sq[data-n="6"]{ color: #22d3ee; }
.sq[data-n="7"]{ color: #f472b6; }
.sq[data-n="8"]{ color: #cbd5e1; }

.sq.flag{ color: var(--n-amber); }
.sq.flag:not(.open){
  background:
    linear-gradient(150deg, rgba(251,191,36,.20), rgba(251,191,36,.06)),
    rgba(34, 30, 24, .9);
  border-color: rgba(251,191,36,.34);
}
.sq.mine{ color: var(--ink-soft); }
.sq.boom{
  color: #fff;
  background: radial-gradient(circle at 50% 50%, #f43f5e, #7f1d3a);
  border-color: rgba(255,120,150,.6);
  box-shadow: 0 0 22px rgba(244,63,94,.55);
}
.sq.wrong::after{
  content: '';
  position: absolute;
  width: 62%; height: 2px;
  background: var(--n-red);
  transform: rotate(-45deg);
  border-radius: 2px;
}
.sq.wrong{ position: relative; color: var(--n-red); }

/* 底部那一个大按钮 */
.pad{
  flex: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}
.pad .k{ min-height: 62px; }
.hint{
  flex: none;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .04em;
  color: var(--ink-dim);
  padding-top: 2px;
}

/* 横屏：棋盘和按钮并排，别让棋盘被挤扁 */
@media (orientation: landscape) and (max-height: 600px){
  .game{ gap: 6px; }
  .bar{ padding: 6px 2px 0; }
  .hud{ grid-auto-flow: column; }
  .hint{ display: none; }
  .pad{ position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); width: 108px; }
  .pad .k{ min-height: 56px; }
  .boardwrap{ padding-right: 120px; }
}
