/* /minesweeper/ — port of the Pocket Games minesweeper look (minesweeper.css in
   the app): a pale blue "expedition" board, or the unlockable Classic 1990 grey.
   Page frame, headline, mode tabs, rank box and the more-games row come from
   games.css. The board keeps the app's own colours; it sits on its own panel.
   Shared by all locales. */

.ms-stage { position: relative; inline-size: 100%; margin-inline: auto; }
.ms-stage, .ms-stage * { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.ms-stage button { font: inherit; cursor: pointer; touch-action: manipulation; }
.ms-card { padding: 0 !important; overflow: hidden; }

.ms-root {
  --ms-bg: #e5eff4; --ms-panel: #d5e4ec; --ms-ink: #233f52; --ms-muted: #496474; --ms-accent: #397d9b; --ms-border: #b5ceda;
  --ms-board-h: min(72svh, 760px);
  --text: var(--ms-ink);           /* site-wide b/strong/headings read --text */
  position: relative;
  display: grid;
  color: var(--ms-ink);
  background: var(--ms-bg);
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  text-align: center;
  min-block-size: 360px;
}
.ms-root.classic { --ms-bg: #c0c0c0; --ms-panel: #d1d1d1; --ms-ink: #202020; --ms-muted: #4c4c4c; --ms-accent: #333b86; --ms-border: #888; }
.ms-root[data-state="start"] .ms-game, .ms-root[data-state="play"] .ms-start { display: none; }

/* ── Start screen (app .ms-start) ────────────────────────────────── */
.ms-start { inline-size: 100%; max-inline-size: 580px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 26px 24px 22px; }
.ms-eyebrow { font-size: 10px; font-weight: 900; letter-spacing: 1.7px; color: var(--ms-muted); }
.ms-start h2 { margin: 0; font-family: var(--font-body); font-size: 37px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.05; color: var(--ms-ink); text-transform: none; }
.ms-tagline { margin: 0; color: var(--ms-muted); font-size: 13px; line-height: 1.6; }
.ms-hero { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; inline-size: 174px; block-size: 174px; transform: rotate(-7deg); margin: 6px 0 2px; }
.ms-hero > span { display: grid; place-items: center; border-radius: 9px; background: #88b7cb; box-shadow: inset 0 2px #b8d8e4, 0 4px #6696ac; color: #397d9b; font-size: 33px; font-weight: 900; }
.ms-hero > span.revealed { background: #f5fbfd; box-shadow: 0 3px #c0d6e0; }
.ms-hero svg { inline-size: 32px; color: var(--ms-ink); }
.ms-difficulties { display: grid; grid-template-columns: repeat(3, 1fr); inline-size: 100%; gap: 8px; }
.ms-difficulties button { min-block-size: 93px; display: grid; align-content: center; gap: 6px; padding: 10px 4px; border: 1.5px solid var(--ms-border); border-radius: 15px; background: transparent; color: var(--ms-ink); transition: background-color .15s, border-color .15s; }
.ms-difficulties button:hover { border-color: var(--ms-accent); }
.ms-difficulties button[aria-pressed="true"] { border-color: var(--ms-accent); background: #f7fbfe; box-shadow: 0 3px 0 #c8dce5; }
.ms-difficulties strong { font-size: 15px; }
.ms-difficulties span { font-size: 11px; }
.ms-difficulties small { color: var(--ms-muted); font-size: 10px; }
.ms-primary { inline-size: 100%; border: 0; display: flex; justify-content: space-between; align-items: center; background: var(--ms-accent); color: #fff; border-radius: 15px; padding: 17px 21px; font-size: 17px !important; font-weight: 900 !important; box-shadow: 0 4px #28627c; transition: transform .1s, box-shadow .1s; }
.ms-primary:active { transform: translateY(3px); box-shadow: 0 1px #28627c; }
.ms-primary > span { font-size: 24px; }
.ms-skin-progress { inline-size: 100%; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 15px 12px; border-radius: 14px; background: var(--ms-panel); text-align: start; }
.ms-skin-progress > span { font-size: 31px; color: var(--ms-accent); line-height: 1; }
.ms-skin-progress > div:not(.ms-skins) { display: grid; gap: 5px; flex: 1; min-inline-size: 0; }
.ms-skin-progress b { font-size: 13px; }
.ms-skin-progress small { color: var(--ms-muted); font-size: 11px; }
.ms-skin-progress progress { inline-size: 45px; block-size: 6px; margin-inline-start: auto; accent-color: var(--ms-accent); }
.ms-skin-progress progress[hidden] { display: none; }
.ms-skins { display: flex; gap: 6px; flex-basis: 100%; }
.ms-skins[hidden] { display: none; }
.ms-skins button { flex: 1; min-block-size: 38px; border-radius: 11px; border: 1.5px solid var(--ms-border); background: transparent; color: var(--ms-ink); font-size: 12px !important; font-weight: 800 !important; }
.ms-skins button[aria-pressed="true"] { border-color: var(--ms-accent); background: #f7fbfe; }
.ms-menu-note { margin: 0; font-size: 11px; color: var(--ms-muted); }
.ms-root :focus-visible { outline: 2px solid var(--ms-accent); outline-offset: 2px; }

/* ── Game (app .ms-game) ─────────────────────────────────────────── */
.ms-game { inline-size: 100%; max-inline-size: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 6px; padding: 6px 10px 10px; }
.ms-status { display: flex; align-items: center; justify-content: space-between; min-block-size: 47px; padding: 0 7px; gap: 10px; }
.ms-counter { display: flex; align-items: center; gap: 7px; }
.ms-counter svg { inline-size: 23px; block-size: 23px; }
.ms-counter b { font-size: 27px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ms-counter small { font-size: 9px; font-weight: 900; color: var(--ms-muted); }
.ms-clock { display: grid; gap: 1px; }
.ms-clock b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.ms-clock > span { font-size: 9px; letter-spacing: .7px; color: var(--ms-muted); text-transform: uppercase; }
.ms-flag-toggle { display: flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--ms-border); background: #f4fafc; color: var(--ms-ink); border-radius: 11px; min-inline-size: 71px; min-block-size: 39px; padding: 0 8px; }
.ms-flag-toggle svg { inline-size: 20px; block-size: 22px; }
.ms-flag-toggle span { font-size: 9px !important; font-weight: 900 !important; }
.ms-flag-toggle.active { background: #f9d5c9; border-color: #e6a896; }
.ms-frame { position: relative; display: flex; justify-content: center; }
.ms-board {
  inline-size: min(100%, calc(var(--ms-board-h) * var(--cols) / var(--rows)));
  aspect-ratio: var(--cols) / var(--rows);
  box-sizing: border-box;
  padding: 4px;
  border-radius: 10px;
  background: #b6cdd8;
  box-shadow: inset 0 1px 4px #7796a344;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  gap: 2px;
  container-type: inline-size;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}
.ms-cell { min-inline-size: 0; min-block-size: 0; display: grid; place-items: center; border-radius: 4px; font-size: clamp(11px, calc(52cqw / var(--cols)), 26px); font-weight: 900; line-height: 1; color: #274956; outline-offset: -3px; cursor: pointer; }
.ms-cell.closed, .ms-cell.flag { background: linear-gradient(155deg, #a5ccdb, #82b1c5); box-shadow: inset 0 1.5px #d0e8f1, inset 0 -2px #6897ae; }
@media (hover: hover) { .ms-board:is(.idle, .playing) .ms-cell.closed:hover { background: linear-gradient(155deg, #b5d7e4, #91bdd0); } }
.ms-cell.open { background: #eef5f8; cursor: default; }
.ms-cell.n1 { color: #287eaf; } .ms-cell.n2 { color: #368463; } .ms-cell.n3 { color: #c75555; } .ms-cell.n4 { color: #7457a0; }
.ms-cell.n5 { color: #a46b2c; } .ms-cell.n6 { color: #28858b; } .ms-cell.n7 { color: #253844; } .ms-cell.n8 { color: #687483; }
.ms-cell.mine { background: #f4b7a8; color: #233f52; }
.ms-cell.boom { background: #f1786a; animation: ms-boom .5s ease; }
.ms-cell svg { inline-size: min(67%, 27px); block-size: 67%; max-block-size: 27px; }
.ms-cell.flag svg { color: #233f52; }
.ms-instruction { font-size: 11px; color: var(--ms-muted); line-height: 16px; min-block-size: 16px; }
.ms-keys { margin: 0; font-size: 10px; color: var(--ms-muted); opacity: .8; }
@media (hover: none), (pointer: coarse) { .ms-keys { display: none; } }

/* Juice: deal, flood reveal, flag drop, win cheer, praise text, confetti, shake. */
.ms-cell.deal { animation: ms-deal .32s cubic-bezier(.2, .9, .3, 1.3) backwards; animation-delay: var(--d, 0ms); }
/* A reveal shows the tile's number at once: only a short, subtle settle (no fade, no hidden delay). */
.ms-cell.open.reveal { animation: ms-pop .14s ease-out; animation-delay: var(--d, 0ms); }
.ms-cell.flag.planted svg { animation: ms-plant .16s ease-out; }
.ms-cell.mine.pop { animation: ms-boom .4s ease; }
.ms-cell.cheer { animation: ms-cheer .5s ease backwards; animation-delay: var(--d, 0ms); }
.ms-frame.shake { animation: ms-shake .45s ease; }
.ms-fx { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 2; }
.ms-praise { position: absolute; transform: translate(-50%, -50%); display: grid; justify-items: center; white-space: nowrap; animation: ms-float 1.05s ease forwards; }
.ms-praise strong { font-size: 27px; font-weight: 900; color: var(--ms-accent); -webkit-text-stroke: 1px var(--ms-bg); text-shadow: 0 3px var(--ms-bg); }
.ms-praise small { font-size: 13px; font-weight: 800; color: var(--ms-accent); text-shadow: 0 1px var(--ms-bg); }
.ms-confetti { position: absolute; inline-size: 8px; block-size: 12px; border-radius: 2px; animation: ms-confetti 1.5s cubic-bezier(.15, .7, .4, 1) both; }
@keyframes ms-deal { from { opacity: 0; transform: scale(.6); } }
@keyframes ms-pop { 0% { transform: scale(.9); } 100% { transform: none; } }
@keyframes ms-plant { 0% { transform: translateY(-18%) scale(1.2); } 100% { transform: none; } }
@keyframes ms-boom { 0% { transform: scale(1); } 30% { transform: scale(1.25); filter: brightness(1.3); } 100% { transform: scale(1); } }
@keyframes ms-cheer { 0%, 100% { transform: none; } 40% { transform: translateY(-14%) scale(1.06); filter: brightness(1.08); } }
@keyframes ms-shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-7px); } 40%, 60% { transform: translateX(7px); } }
@keyframes ms-float { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 20% { opacity: 1; transform: translate(-50%, -60%) scale(1.08); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -130%) scale(1); } }
@keyframes ms-confetti { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 35% { transform: translate(calc(var(--dx) * .6), var(--dy)) rotate(calc(var(--r) * .5)); opacity: 1; } 100% { transform: translate(var(--dx), 120px) rotate(var(--r)); opacity: 0; } }

/* ── Classic 1990 (app .classic) ─────────────────────────────────── */
.ms-root.classic { font-family: Arial, sans-serif; }
.classic .ms-board { border-radius: 0; padding: 3px; border: 3px solid; border-color: #808080 #fff #fff #808080; background: #808080; box-shadow: none; gap: 1px; }
.classic .ms-cell { border-radius: 0; font-family: 'Courier New', monospace; font-weight: 900; }
.classic .ms-cell.closed, .classic .ms-cell.flag { background: #c0c0c0; border: 2px solid; border-color: #fff #808080 #808080 #fff; box-shadow: none; }
.classic .ms-cell.open { background: #c0c0c0; }
.classic .ms-cell.n1 { color: #0000ff; } .classic .ms-cell.n2 { color: #008000; } .classic .ms-cell.n3 { color: #ff0000; } .classic .ms-cell.n4 { color: #000080; }
.classic .ms-cell.n5 { color: #800000; } .classic .ms-cell.n6 { color: #008080; } .classic .ms-cell.n7 { color: #000; } .classic .ms-cell.n8 { color: #808080; }
.classic .ms-cell.boom { background: #f00; }
.classic .ms-counter b, .classic .ms-clock b { color: #f44336; background: #202020; padding: 3px 5px; font-family: 'Courier New', monospace; }
.classic .ms-flag-toggle { border-radius: 0; background: #c0c0c0; border: 2px solid; border-color: #fff #808080 #808080 #fff; }
.classic .ms-flag-toggle.active { border-color: #808080 #fff #fff #808080; background: #aaa; }
.classic .ms-hero > span { border-radius: 0; background: #c0c0c0; border: 3px solid; border-color: #fff #808080 #808080 #fff; box-shadow: none; color: #0000ff; }
.classic .ms-hero > span.revealed { border: 1px solid #888; background: #c0c0c0; }
.classic .ms-primary { box-shadow: 0 4px #25295a; }
.classic .ms-difficulties button[aria-pressed="true"], .classic .ms-skins button[aria-pressed="true"] { background: #e0e0e0; box-shadow: 0 3px #999; }

/* ── Overlay (standalone page only) ──────────────────────────────── */
.ms-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; border-radius: inherit; background: color-mix(in srgb, var(--ms-bg) 62%, transparent); backdrop-filter: blur(3px); animation: ms-fade .25s ease; }
.ms-overlay[hidden] { display: none; }
.ms-ov-card { inline-size: min(360px, 100%); display: grid; gap: 10px; justify-items: center; padding: 22px 20px; border-radius: 18px; background: var(--ms-bg); border: 1.5px solid var(--ms-border); box-shadow: 0 18px 40px #23405233; color: var(--ms-ink); }
.ms-ov-kicker { margin: 0; font-size: 10px; font-weight: 900; letter-spacing: 1.3px; text-transform: uppercase; color: var(--ms-muted); }
.ms-ov-title { margin: 0; font-family: var(--font-body); font-size: 30px; font-weight: 900; letter-spacing: -1px; text-transform: none; color: var(--ms-ink); }
.ms-overlay[data-kind="lost"] .ms-ov-title { color: #c75555; }
.ms-ov-sub { margin: 0; font-size: 13px; color: var(--ms-muted); line-height: 1.5; }
.ms-ov-stars { display: flex; gap: 6px; }
.ms-ov-stars:empty { display: none; }
.ms-ov-stars i { inline-size: 30px; block-size: 30px; background: #c8dce5; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.ms-ov-stars i.on { background: #f4c04e; animation: ms-star .45s cubic-bezier(.2, .9, .3, 1.5) backwards; animation-delay: calc(var(--k) * 140ms); }
.ms-ov-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; inline-size: 100%; }
.ms-btn { flex: 1; min-block-size: 46px; padding: 0 16px; border-radius: 13px; border: 1.5px solid var(--ms-border); background: transparent; color: var(--ms-ink); font-weight: 800 !important; font-size: 15px !important; }
.ms-btn--primary { border: 0; background: var(--ms-accent); color: #fff; box-shadow: 0 4px #28627c; }
.classic .ms-btn--primary { box-shadow: 0 4px #25295a; }
@keyframes ms-fade { from { opacity: 0; } }
@keyframes ms-star { from { transform: scale(0) rotate(-40deg); } }

/* ── Play layer: the game panel fills the slot, the board fits the height ── */
html.play-open .ms-play { display: flex; flex-direction: column; gap: var(--space-2); }
html.play-open .ms-card { border: 0 !important; background: none !important; box-shadow: none !important; }
html.play-open .ms-card::before, html.play-open .ms-card::after { display: none !important; }
html.play-open .ms-root { --ms-board-h: calc(var(--play-slot-h, calc(100dvh - 112px)) - 96px); min-block-size: 0; }
html.play-open .ms-board { touch-action: none; }
html.play-open .ms-overlay { display: none; }
html.play-open .ms-keys { display: none; }
@media (max-width: 599px) {
  .ms-root { --ms-board-h: min(68svh, 640px); }
  html.play-open .ms-root { --ms-board-h: calc(var(--play-slot-h, calc(100dvh - 97px)) - 80px); }
  .ms-game { padding: 4px 6px 8px; }
  .ms-start { padding: 20px 14px 16px; gap: 13px; }
  .ms-hero { inline-size: 140px; block-size: 140px; }
  .ms-start h2 { font-size: 32px; }
  .ms-difficulties button { min-block-size: 82px; }
}
@media (max-height: 700px) {
  .ms-start { gap: 12px; padding: 15px 23px; }
  .ms-hero { inline-size: 120px; block-size: 120px; margin: 3px; }
  .ms-hero > span { font-size: 24px; }
  .ms-primary { padding: 13px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .ms-root *, .ms-root *::before, .ms-root *::after { animation: none !important; transition: none !important; }
}

/* ── /minesweeper-leaderboard/: season 2 head + read-only Classic section ── */
.ms-season { display: grid; gap: var(--space-1); justify-items: center; text-align: center; margin-block: var(--space-4) var(--space-2); }
.ms-season h2 { margin: 0; }
.ms-season p { margin: 0; max-inline-size: 70ch; font-size: var(--step--1); text-wrap: pretty; }
.ms-classic { margin-block: var(--space-6) var(--space-4); }
.ms-classic .ms-season { margin-block-start: 0; }
.ms-classic .lb-categories { margin-block: var(--space-3); }
