/* Minesweeper */
.minesweeper .window-body { padding: 0; }
.menu-bar.live { position: relative; padding: 0; gap: 0; }
.menu-title { padding: 2px 7px; background: none; border: 0; cursor: default; }
.menu-title::first-letter { text-decoration: underline; }
.menu-title.open, .menu-title:focus-visible { background: var(--sel); color: #fff; outline: none; }
.menu-drop {
  position: absolute; top: 100%; z-index: 5; min-width: 170px; padding: 2px; display: flex; flex-direction: column;
  background: var(--face); border: 1px solid; border-color: var(--light) var(--dark) var(--dark) var(--light);
  box-shadow: inset 1px 1px var(--hilite), inset -1px -1px var(--shadow);
}
.menu-cmd { display: flex; align-items: center; gap: 4px; padding: 3px 8px 3px 2px; text-align: left; background: none; border: 0; white-space: nowrap; cursor: default; }
.menu-cmd:hover, .menu-cmd:focus-visible { background: var(--sel); color: #fff; outline: none; }
.menu-check { width: 14px; text-align: center; }
.menu-label { flex: 1; }
.menu-key { margin-left: 20px; }
.menu-sep { margin: 3px 1px; border-top: 1px solid var(--shadow); border-bottom: 1px solid var(--hilite); }

.ms-frame {
  margin: 0 auto; padding: 6px; display: flex; flex-direction: column; gap: 6px; align-self: center;
  background: var(--face); border: 3px solid; border-color: var(--hilite) var(--shadow) var(--shadow) var(--hilite);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.ms-head, .ms-board { border: 2px solid; border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow); }
.ms-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 5px; }
.ms-led { display: flex; padding: 1px; gap: 1px; background: #000; border: 1px solid; border-color: var(--shadow) var(--hilite) var(--hilite) var(--shadow); }
.ms-digit { width: 13px; height: 23px; }
.ms-digit polygon { fill: #200000; }
.ms-digit polygon.on { fill: #f00; }
.ms-face {
  width: 26px; height: 26px; padding: 3px; display: grid; place-items: center; cursor: pointer;
  background: var(--face); border: 2px solid; border-color: var(--hilite) var(--shadow) var(--shadow) var(--hilite); outline: 1px solid var(--shadow);
}
.ms-face:active { border-color: var(--shadow) var(--face) var(--face) var(--shadow); padding: 4px 2px 2px 4px; }
.ms-face svg { width: 17px; height: 17px; display: block; }

.ms-board { --cell: 16px; display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); grid-auto-rows: var(--cell); touch-action: manipulation; }
.ms-cell {
  display: grid; place-items: center; overflow: hidden; cursor: default;
  font: bold calc(var(--cell) * .75)/1 Tahoma, "MS Sans Serif", Arial, sans-serif;
  background: var(--face) no-repeat center / 80%;
  border: calc(var(--cell) / 8) solid; border-color: var(--hilite) var(--shadow) var(--shadow) var(--hilite);
}
.ms-cell.open, .ms-cell.pressed { border: 0; border-left: 1px solid var(--shadow); border-top: 1px solid var(--shadow); }
.ms-cell.flag { background-image: url(/img/ms-flag.svg); }
.ms-cell.mine { background-image: url(/img/ms-mine.svg); }
.ms-cell.boom { background-color: #f00; }
.ms-cell.wrong { background-image: url(/img/ms-wrong.svg); }
.ms-cell.quest { color: #000; }
.ms-cell.n1 { color: #0000ff; }
.ms-cell.n2 { color: #008000; }
.ms-cell.n3 { color: #ff0000; }
.ms-cell.n4 { color: #000080; }
.ms-cell.n5 { color: #800000; }
.ms-cell.n6 { color: #008080; }
.ms-cell.n7 { color: #000; }
.ms-cell.n8 { color: #808080; }

.ms-best { display: grid; grid-template-columns: auto auto 1fr; gap: 6px 14px; padding: 14px 16px 6px; }
.ms-congrats { padding: 12px 16px 4px; }
.ms-congrats p { margin: 0 0 10px; }
.ms-name { width: 100%; height: 22px; padding: 2px 4px; }
.ms-pixel { position: fixed; left: 0; top: 0; width: 1px; height: 1px; z-index: 2147483647; pointer-events: none; }

/* Touch screens: a dig/flag switch under the board. */
.ms-touchbar { display: none; align-items: center; justify-content: center; gap: 10px; padding: 8px; font-size: 13px; color: #333; }
@media (pointer: coarse) {
  .ms-touchbar { display: flex; }
  .ms-flagmode[aria-pressed="true"] { border-color: var(--dark) var(--hilite) var(--hilite) var(--dark); }
}
@media (max-width: 640px), (max-height: 500px) and (pointer: coarse) {
  .minesweeper .window-body { overflow: auto; background: var(--face); }
  .minesweeper .ms-frame { margin: 12px auto; }
  .ms-head { padding: 6px 8px; }
  .ms-face { width: 40px; height: 40px; }
  .ms-face svg { width: 28px; height: 28px; }
  .ms-digit { width: 17px; height: 30px; }
  .menu-title { padding: 6px 12px; }
  .menu-cmd { padding: 9px 12px 9px 4px; }
}
