/**
 * Minesweeper Stylesheet - Popyca Games
 *
 * Warm cream board with raised tiles, classic number colors,
 * and a responsive grid that scales from 360px phones to desktop.
 */

:root {
  --ms-board-max: min(94vw, 560px);
  --ms-tile: #d9cfbf;
  --ms-tile-hover: #e4dbcc;
  --ms-tile-revealed: #f7f3ec;
  --ms-gap: 2px;
}

.game-view-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 12px 40px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: var(--ms-board-max);
  margin-bottom: 12px;
  gap: 12px;
}

.game-title-group h1 {
  font-size: clamp(1.7rem, 6vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-ink, #1f1d1a);
  margin: 0;
  line-height: 1.05;
}

.game-subtitle {
  font-size: 0.85rem;
  color: var(--color-ink-muted, #787063);
  margin-top: 4px;
}

.btn-game-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  background-color: #8c7a65;
  color: #ffffff;
  transition: background-color 0.15s ease, transform 0.1s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-game-action:hover {
  background-color: #796853;
}

.btn-game-action:active {
  transform: scale(0.97);
}

.game-board-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* Meta bar: difficulty, counters */
.ms-meta-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
  width: 100%;
  max-width: var(--ms-board-max);
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-ink-secondary, #4a433a);
}

.ms-diff-tabs {
  display: flex;
  gap: 4px;
  background: #e2dbcd;
  padding: 3px;
  border-radius: 8px;
}

.ms-diff-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-ink-secondary, #4a433a);
  cursor: pointer;
}

.ms-diff-btn.active {
  background: #ffffff;
  color: var(--color-primary, #e26938);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ms-stats {
  display: flex;
  gap: 14px;
  font-variant-numeric: tabular-nums;
}

.ms-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Board */
.ms-board-scroll {
  width: 100%;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.ms-board {
  --ms-cols: 9;
  --ms-rows: 9;
  display: grid;
  grid-template-columns: repeat(var(--ms-cols), 1fr);
  gap: var(--ms-gap);
  width: min(var(--ms-board-max), calc(var(--ms-cols) * 44px));
  padding: 6px;
  background: #b9ab97;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(60, 45, 30, 0.15);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

@media (min-width: 720px) {
  .ms-board[data-difficulty="hard"] {
    --ms-board-max: 940px;
  }
}

.ms-cell {
  aspect-ratio: 1 / 1;
  min-width: 0;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: var(--ms-tile);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(10px, calc(var(--ms-board-max) / var(--ms-cols) * 0.55), 22px);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-ink, #1f1d1a);
}

.ms-cell:hover {
  background: var(--ms-tile-hover);
}

.ms-cell:focus-visible {
  outline: 2px solid var(--color-primary, #e26938);
  outline-offset: -2px;
}

.ms-cell.is-revealed {
  background: var(--ms-tile-revealed);
  box-shadow: none;
  cursor: default;
}

.ms-cell.is-mine {
  background: #f3d2c4;
}

.ms-cell.is-exploded {
  background: #e53e3e;
}

.ms-cell.is-flagged.is-wrong {
  background: #fde2e2;
  text-decoration: line-through;
}

.ms-cell.n1 { color: #2563eb; }
.ms-cell.n2 { color: #15803d; }
.ms-cell.n3 { color: #dc2626; }
.ms-cell.n4 { color: #1e3a8a; }
.ms-cell.n5 { color: #9a3412; }
.ms-cell.n6 { color: #0e7490; }
.ms-cell.n7 { color: #1f1d1a; }
.ms-cell.n8 { color: #6b7280; }

/* Action bar */
.ms-action-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.ms-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--color-border-hover, #d1c6b4);
  background: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-ink-secondary, #4a433a);
  cursor: pointer;
}

.ms-tool-btn.active {
  background: var(--color-primary, #e26938);
  border-color: var(--color-primary, #e26938);
  color: #ffffff;
}

.ms-hint {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--color-ink-muted, #787063);
  text-align: center;
}

/* SEO guide content */
.game-info-section {
  width: 100%;
  max-width: 620px;
  margin-top: 28px;
  line-height: 1.6;
  color: #38332c;
}

.game-info-section h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1f1d1a;
  margin: 18px 0 8px;
}

.game-info-section h3 {
  font-size: 1.02rem;
  font-weight: 800;
  color: #1f1d1a;
  margin: 14px 0 4px;
}

.game-info-section p,
.game-info-section ul {
  font-size: 0.95rem;
  margin: 0 0 12px;
}

.game-info-section ul {
  padding-left: 20px;
}
