/* Free daily Minesweeper: board, status bar and tools. Loaded after puzzles.css. */

@media (max-width: 400px) { .play-card.ms-card { padding-left: 10px; padding-right: 10px; } }

/* ---------- status bar: time · hearts · mines left */
.ms-bar { display: grid; grid-template-columns: 1fr auto 1fr; }
.ms-bar .status { justify-self: end; }
.ms-hearts { display: inline-flex; gap: 3px; }
.ms-heart { width: 22px; height: 22px; display: block; }
.ms-heart path { fill: #e8524a; stroke: #b5312b; stroke-width: 1.3; stroke-linejoin: round; transition: fill .25s ease, stroke .25s ease; }
.ms-heart.lost path { fill: #ebe5d5; stroke: #c9c0aa; }
.ms-heart.lost { animation: ms-break .45s ease; }
@keyframes ms-break { 30% { transform: scale(1.25) rotate(-8deg); } 60% { transform: scale(.85) rotate(6deg); } }
.ms-left { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); }
.ms-left .ms-i { width: 18px; height: 18px; }
.ms-left b { font-variant-numeric: tabular-nums; font-size: 16px; }
.ms-left-word { color: var(--muted); font-weight: 700; }

/* ---------- icons (inline SVG, coloured here) */
.ms-i { display: block; }
.ms-mine .spike { stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; }
.ms-mine .body { fill: currentColor; }
.ms-mine .shine { fill: #fff; opacity: .8; }
.ms-flag .pole { fill: var(--ink); }
.ms-flag .cloth { fill: var(--yellow); stroke: var(--ink); stroke-width: 1.7; stroke-linejoin: round; }
.ms-dig .stroke { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.ms-dig .fill { fill: currentColor; }

/* ---------- board */
.ms {
  --cols: 9; --rows: 10;
  display: grid; grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  width: min(100%, calc(var(--cols) * 46px)); aspect-ratio: var(--cols) / var(--rows); margin: 0 auto;
  border: 3px solid var(--ink); border-radius: 16px; overflow: hidden; background: #fbf8f1;
  container-type: inline-size;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  transition: box-shadow .15s ease, border-color .2s ease;
}
.ms.flagging { box-shadow: 0 0 0 4px var(--yellow); }
.ms.solved { border-color: var(--green); }
.ms.lost { border-color: var(--danger); }
.ms-row { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
.ms-cell {
  position: relative; display: grid; place-items: center; min-width: 0; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: transparent; color: var(--ink); cursor: pointer; line-height: 1;
  font-weight: 800; font-variant-numeric: tabular-nums; font-size: clamp(14px, 4.6vw, 24px); font-size: calc(100cqi / var(--cols) * .56);
  box-shadow: inset -1px -1px 0 rgba(23, 27, 30, .07);
}
/* Covered: a raised tile in the board's colour (set per square from JS as --tc). */
.ms-cell::before {
  content: ""; position: absolute; inset: 2px; border-radius: 24%; background: var(--tc, #9a86e4);
  box-shadow: inset 0 -3px 0 rgba(40, 18, 60, .2), inset 0 2px 0 rgba(255, 255, 255, .3);
  transition: transform .1s ease, filter .12s ease;
}
.ms-cell > svg { position: relative; width: 64%; height: 64%; pointer-events: none; }
.ms-cell[data-s^="n"] { cursor: default; }
.ms-cell[data-s^="n"]::before { display: none; }
.ms-cell[data-s="n0"] { background: #f4efe3; }
/* Digits carry the count; the colour only helps tell them apart. All pass 4.5:1 on the paper. */
.ms-cell[data-s="n1"] { color: #2563b8; cursor: pointer; }
.ms-cell[data-s="n2"] { color: #137a50; cursor: pointer; }
.ms-cell[data-s="n3"] { color: #c0392b; cursor: pointer; }
.ms-cell[data-s="n4"] { color: #5b3bb8; cursor: pointer; }
.ms-cell[data-s="n5"] { color: #9a4a12; cursor: pointer; }
.ms-cell[data-s="n6"] { color: #0f727a; cursor: pointer; }
.ms-cell[data-s="n7"] { color: var(--ink); cursor: pointer; }
.ms-cell[data-s="n8"] { color: #565d63; cursor: pointer; }
.ms-cell[data-s="flag"] > svg { animation: ms-pop .22s ease-out; }
.ms-cell[data-s="boom"]::before { background: #ef6450; box-shadow: inset 0 0 0 2px #b5312b; }
.ms-cell[data-s="boom"] > svg { color: var(--ink); animation: ms-pop .3s ease-out; }
.ms-cell[data-s="mine"] > svg { color: rgba(23, 27, 30, .82); }
.ms-cell[data-s="mine"]::before { filter: saturate(.55) brightness(1.1); }
.ms-cell[data-s="wrong"]::after { content: ""; position: absolute; left: 16%; right: 16%; top: 50%; height: 3px; margin-top: -1.5px; border-radius: 2px; background: var(--danger); transform: rotate(-45deg); }
.ms-cell > svg.plant { animation: ms-plant .4s cubic-bezier(.2, 1.5, .4, 1) both; }
@media (hover: hover) { .ms-cell[data-s="cov"]:hover::before, .ms-cell[data-s="flag"]:hover::before { filter: brightness(1.08); } }
.ms-cell[data-s="cov"]:active::before { transform: scale(.9); }
.ms-cell:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; border-radius: 6px; z-index: 1; }
.ms-cell.shake { animation: shake .36s; z-index: 1; }
.ms-cell.nudge { animation: ms-nudge .3s ease; }
/* Hint: the opened square glows; the numbers that prove it are ringed. */
.ms-cell.hinted::after { content: ""; position: absolute; inset: 1px; border-radius: 8px; box-shadow: 0 0 0 3px var(--yellow), inset 0 0 0 2px var(--ink); animation: ms-glow 1.9s ease forwards; z-index: 1; pointer-events: none; }
.ms-cell.why::after { content: ""; position: absolute; inset: 12%; border-radius: 50%; border: 2.5px solid var(--purple); animation: ms-glow 1.9s ease forwards; pointer-events: none; }
@keyframes ms-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes ms-plant { 0% { transform: translateY(-40%) scale(.3); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes ms-nudge { 40% { transform: scale(.86); } }
@keyframes ms-glow { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- tools: Dig | Flag switch, Hint */
.ms-tools { align-items: stretch; }
.ms-mode { flex: 1 1 200px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: rgba(23, 27, 30, .08); }
.ms-mode button { min-height: 48px; border: 0; border-radius: 12px; background: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; font-size: 16px; color: #4a5054; cursor: pointer; }
.ms-mode button .ms-i { width: 22px; height: 22px; flex: none; }
.ms-mode button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 2px 0 rgba(70, 52, 18, .1), 0 4px 10px rgba(70, 52, 18, .1); }
.ms-mode .ms-flag-btn[aria-pressed="true"] { background: var(--yellow); }
.ms-mode button:disabled, .ms-tools .tool:disabled { opacity: .45; cursor: default; }
.ms-tools .tool { min-height: 56px; padding: 0 16px; }
.ms-tip { margin: 10px 0 0; text-align: center; font-size: 13.5px; font-weight: 700; color: var(--muted); line-height: 1.4; }
