/* =====================================================================
   style.css — マインスイーパー ツール固有の微調整のみ。
   共通スタイルは /_shared/shirugear.css に任せる。
   ===================================================================== */

/* 難易度切替（手本のモード切替を流用） */
.sg-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: var(--sg-space-1, 4px);
}
.sg-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

/* カスタム入力欄 */
.ms-custom__row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.ms-custom__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 90px;
  min-width: 90px;
}
.ms-custom__item .sg-input {
  width: 100%;
}
.ms-err {
  color: var(--sg-danger, #e03131);
  font-weight: 600;
}

/* ステータスバー（残り地雷・顔・タイム・ベスト） */
.ms-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: 420px;
  margin: 14px auto 0;
  padding: 10px 14px;
  background: var(--sg-surface, #fff);
  border: 1px solid var(--sg-border, #e2e6ee);
  border-radius: 12px;
}
.ms-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 64px;
}
.ms-stat__label {
  font-size: 0.72rem;
  color: var(--sg-muted, #777);
}
.ms-stat__value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.ms-face {
  font-size: 1.6rem;
  line-height: 1;
  padding: 4px 8px;
  border: 1px solid var(--sg-border, #e2e6ee);
  border-radius: 10px;
  background: var(--sg-bg, #f4f6fb);
  cursor: pointer;
}
.ms-face:active {
  transform: translateY(1px);
}

/* 操作モード切替 + 新規 */
.ms-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}
.ms-modeswitch {
  display: inline-flex;
  border: 1px solid var(--sg-border, #e2e6ee);
  border-radius: 10px;
  overflow: hidden;
}
.ms-mode {
  padding: 8px 16px;
  font-size: 0.95rem;
  border: none;
  background: var(--sg-surface, #fff);
  cursor: pointer;
  color: var(--sg-fg, #222);
}
.ms-mode + .ms-mode {
  border-left: 1px solid var(--sg-border, #e2e6ee);
}
.ms-mode--active {
  background: var(--sg-primary, #3b5bdb);
  color: #fff;
}
.ms-hint {
  text-align: center;
  max-width: 560px;
  margin: 8px auto 0;
}

/* 盤面 */
.ms-board-wrap {
  margin: 14px auto 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.ms-board {
  display: grid;
  grid-template-columns: repeat(var(--ms-cols, 9), 30px);
  gap: 2px;
  width: max-content;
  margin: 0 auto;
  padding: 6px;
  background: var(--sg-border, #cfd6e4);
  border-radius: 10px;
  touch-action: manipulation;
}

/* セル */
.ms-cell {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--sg-border, #b8c0d4);
  border-radius: 4px;
  background: linear-gradient(180deg, #eef1f7, #dbe1ee);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  color: #222;
}
.ms-cell:hover {
  filter: brightness(1.03);
}
.ms-cell:active {
  transform: translateY(1px);
}
.ms-cell--open {
  background: var(--sg-surface, #fbfcfe);
  cursor: default;
  box-shadow: none;
}
.ms-cell--flag {
  background: linear-gradient(180deg, #fff3d6, #ffe6ad);
}
.ms-cell--mine {
  background: #ffd0d0;
}
.ms-cell--wrong {
  background: #ffe0e0;
  color: var(--sg-danger, #e03131);
}
.ms-cell:disabled {
  cursor: default;
}

/* 数字の色分け（1〜8） */
.ms-cell[data-n="1"] { color: #1971c2; }
.ms-cell[data-n="2"] { color: #2f9e44; }
.ms-cell[data-n="3"] { color: #e03131; }
.ms-cell[data-n="4"] { color: #364fc7; }
.ms-cell[data-n="5"] { color: #a61e4d; }
.ms-cell[data-n="6"] { color: #0c8599; }
.ms-cell[data-n="7"] { color: #212529; }
.ms-cell[data-n="8"] { color: #868e96; }

.ms-status {
  text-align: center;
  margin-top: 12px;
  min-height: 1.4em;
  font-weight: 600;
}

/* 小さい画面ではセルを少し詰める */
@media (max-width: 420px) {
  .ms-board {
    grid-template-columns: repeat(var(--ms-cols, 9), 28px);
    gap: 2px;
  }
  .ms-cell {
    width: 28px;
    height: 28px;
    font-size: 0.95rem;
  }
}

/* ダークテーマ微調整（共有変数がない場合のフォールバック） */
.sg-dark .ms-cell {
  background: linear-gradient(180deg, #3a4152, #2c3240);
  border-color: #4a5163;
  color: #e6e9f0;
}
.sg-dark .ms-cell--open {
  background: #232833;
}
.sg-dark .ms-cell--flag {
  background: linear-gradient(180deg, #5a4a1e, #6b581f);
}
.sg-dark .ms-cell--mine {
  background: #5a2a2a;
}
