/* ------------------------------------------------------------------ *
 * Minesweeper - Windows 98 remake
 * Every measurement here is in the original's pixels (16px cells, 13x23
 * LED digits, 2px cell bevels). The whole window is scaled as a block by
 * js/minesweeper.js instead of being made "responsive", so the layout
 * never drifts from the original proportions.
 * ------------------------------------------------------------------ */

:root {
  --face: #c0c0c0;        /* button face  */
  --hl: #ffffff;          /* highlight    */
  --lt: #dfdfdf;          /* light shadow */
  --sh: #808080;          /* shadow       */
  --dk: #0a0a0a;          /* dark shadow  */
  --nav: #000080;         /* active title */
  --desktop: #008080;     /* teal         */
  --cell: 16px;
  --font: "MS Sans Serif", "Microsoft Sans Serif", Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  --layout: fixed;             /* read by js/site.js to know what to reserve */
  background: var(--desktop);
  font-family: var(--font);
  font-size: 11px;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--header-h, 58px) 8px var(--footer-h, 84px);
  min-height: 100vh;
  height: 100svh;
  overflow: hidden;          /* the stage is scaled to fit, so nothing is cut off */
  -webkit-text-size-adjust: 100%;
  -webkit-touch-callout: none;
}

.stage[hidden] { display: none; }

.stage {
  /* scaled as one block by js/minesweeper.js to fit the viewport */
  transform-origin: center center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --------------------------- window chrome --------------------------- */

.window {
  background: var(--face);
  padding: 3px;
  box-shadow:
    inset -1px -1px var(--dk),
    inset  1px  1px var(--lt),
    inset -2px -2px var(--sh),
    inset  2px  2px var(--hl);
  transform-origin: top center;
}

#window { width: max-content; }

.title-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  padding: 0 2px 0 3px;
  background: linear-gradient(90deg, var(--nav), #1084d0);
  color: #fff;
  user-select: none;
}

.title-bar-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg fill='%23000'%3E%3Crect x='7' y='2' width='2' height='12'/%3E%3Crect x='2' y='7' width='12' height='2'/%3E%3Crect x='7' y='3' width='2' height='10' transform='rotate(45 8 8)'/%3E%3Crect x='3' y='7' width='10' height='2' transform='rotate(45 8 8)'/%3E%3Crect x='5' y='4' width='6' height='8'/%3E%3Crect x='4' y='5' width='8' height='6'/%3E%3C/g%3E%3Crect x='6' y='6' width='2' height='2' fill='%23fff'/%3E%3C/svg%3E") center/16px no-repeat;
}

.title-bar-text {
  flex: 1 1 auto;
  font-weight: bold;
  letter-spacing: 0;
  white-space: nowrap;
}

.title-bar-controls {
  display: flex;
  gap: 2px;
}

.tb-btn {
  width: 16px;
  height: 14px;
  padding: 0;
  border: 0;
  background: var(--face);
  box-shadow:
    inset -1px -1px var(--dk),
    inset  1px  1px var(--hl),
    inset -2px -2px var(--sh),
    inset  2px  2px var(--lt);
  background-repeat: no-repeat;
  background-position: center;
  font: inherit;
  cursor: default;
}
.tb-btn:active:not(:disabled) {
  box-shadow:
    inset  1px  1px var(--dk),
    inset -1px -1px var(--hl),
    inset  2px  2px var(--sh),
    inset -2px -2px var(--lt);
}
.tb-btn:disabled { color: var(--sh); opacity: .55; }

.tb-min  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Crect x='1' y='7' width='6' height='2' fill='%23000'/%3E%3C/svg%3E"); background-size: 10px; }
.tb-max  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Crect x='1' y='1' width='8' height='8' fill='none' stroke='%23000'/%3E%3Crect x='1' y='1' width='8' height='2' fill='%23000'/%3E%3C/svg%3E"); background-size: 10px; }
.tb-close{ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M2 2 L8 8 M8 2 L2 8' stroke='%23000' stroke-width='1.4'/%3E%3C/svg%3E"); background-size: 10px; }

/* ------------------------------ menus ------------------------------ */

.menu-bar {
  position: relative;
  display: flex;
  padding: 1px 0 2px;
  user-select: none;
}

.menu-title {
  border: 0;
  background: transparent;
  font: 11px var(--font);
  color: #000;
  padding: 1px 6px 2px;
  cursor: default;
}
.menu-title u { text-decoration: none; }
.menu-bar.keyboard .menu-title u { text-decoration: underline; }
.menu-title.open { background: var(--nav); color: #fff; }

.menu-popup {
  position: absolute;
  top: 100%;
  z-index: 40;
  min-width: 148px;
  padding: 2px;
  background: var(--face);
  box-shadow:
    inset -1px -1px var(--dk),
    inset  1px  1px var(--hl),
    inset -2px -2px var(--sh),
    inset  2px  2px var(--lt);
}

.menu-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: 18px;
  border: 0;
  background: transparent;
  font: 11px var(--font);
  color: #000;
  padding: 0 4px;
  cursor: default;
  text-align: left;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--nav); color: #fff; outline: none; }
.menu-mark  { width: 14px; flex: 0 0 14px; align-self: stretch; }
.menu-item.radio.checked .menu-mark {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Ccircle cx='4' cy='4' r='2' fill='%23000'/%3E%3C/svg%3E") center/8px no-repeat;
}
.menu-item.radio.checked:hover .menu-mark {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Ccircle cx='4' cy='4' r='2' fill='%23fff'/%3E%3C/svg%3E");
}
.menu-item.check.checked .menu-mark {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 5 L4 8 L9 2' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E") center/10px no-repeat;
}
.menu-item.check.checked:hover .menu-mark {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 5 L4 8 L9 2' fill='none' stroke='%23fff' stroke-width='1.6'/%3E%3C/svg%3E");
}
.menu-label { flex: 1 1 auto; white-space: nowrap; }
.menu-accel { padding-left: 18px; color: inherit; }
.menu-sep {
  height: 2px;
  margin: 2px 1px;
  border-top: 1px solid var(--sh);
  border-bottom: 1px solid var(--hl);
}

/* --------------------------- game client --------------------------- */

.client {
  padding: 6px;
  background: var(--face);
}
.client.collapsed { display: none; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 35px;
  padding: 3px 5px;
  margin-bottom: 6px;
  border: 2px solid;
  border-color: var(--sh) var(--hl) var(--hl) var(--sh);
}

/* LED displays: three seven-segment digits on black, 13x23 each */
.led {
  display: flex;
  gap: 0;
  padding: 1px;
  background: #000;
  border: 1px solid #000;
}
.led svg { display: block; width: 13px; height: 23px; }
.led .seg { fill: #480000; }        /* unlit segments stay faintly visible */
.led .seg.on { fill: #ff0000; }

.face {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background-color: var(--face);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 17px 17px;
  box-shadow:
    inset -1px -1px var(--dk),
    inset  1px  1px var(--hl),
    inset -2px -2px var(--sh),
    inset  2px  2px var(--lt);
  cursor: default;
}
.face:active, .face.pressed {
  box-shadow: inset 1px 1px var(--sh);
  background-position: calc(50% + 1px) calc(50% + 1px);
}

.face[data-face="smile"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 17'%3E%3Ccircle cx='8.5' cy='8.5' r='7.6' fill='%23ffff00' stroke='%23000'/%3E%3Crect x='5' y='5.5' width='2' height='3' fill='%23000'/%3E%3Crect x='10' y='5.5' width='2' height='3' fill='%23000'/%3E%3Cpath d='M4.4 10.2 Q8.5 14.2 12.6 10.2' fill='none' stroke='%23000' stroke-width='1.3'/%3E%3C/svg%3E"); }
.face[data-face="oh"]    { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 17'%3E%3Ccircle cx='8.5' cy='8.5' r='7.6' fill='%23ffff00' stroke='%23000'/%3E%3Crect x='5' y='5' width='2' height='3' fill='%23000'/%3E%3Crect x='10' y='5' width='2' height='3' fill='%23000'/%3E%3Ccircle cx='8.5' cy='11.4' r='2.2' fill='none' stroke='%23000' stroke-width='1.3'/%3E%3C/svg%3E"); }
.face[data-face="dead"]  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 17'%3E%3Ccircle cx='8.5' cy='8.5' r='7.6' fill='%23ffff00' stroke='%23000'/%3E%3Cpath d='M4 4.5 L7.4 7.9 M7.4 4.5 L4 7.9 M9.6 4.5 L13 7.9 M13 4.5 L9.6 7.9' stroke='%23000' stroke-width='1.3'/%3E%3Cpath d='M4.6 12.8 Q8.5 9 12.4 12.8' fill='none' stroke='%23000' stroke-width='1.3'/%3E%3C/svg%3E"); }
.face[data-face="cool"]  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 17'%3E%3Ccircle cx='8.5' cy='8.5' r='7.6' fill='%23ffff00' stroke='%23000'/%3E%3Cpath d='M1.6 5.4 H15.4' stroke='%23000' stroke-width='1.2'/%3E%3Crect x='2.4' y='5.4' width='5' height='3.4' fill='%23000'/%3E%3Crect x='9.6' y='5.4' width='5' height='3.4' fill='%23000'/%3E%3Cpath d='M4.4 11 Q8.5 14.6 12.6 11' fill='none' stroke='%23000' stroke-width='1.3'/%3E%3C/svg%3E"); }

/* ------------------------------ field ------------------------------ */

.field {
  display: flex;
  flex-direction: column;
  border: 3px solid;
  border-color: var(--sh) var(--hl) var(--hl) var(--sh);
  background: var(--face);
  touch-action: pinch-zoom;      /* no panning, no double-tap zoom, but pinch works */
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  width: max-content;
}

.field-row { display: flex; }

.cell {
  width: var(--cell);
  height: var(--cell);
  background: var(--face);
  border: 2px solid;
  border-color: var(--hl) var(--sh) var(--sh) var(--hl);
  font: bold 13px/1 Tahoma, Verdana, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  cursor: default;
  overflow: hidden;
}

/* A pressed-but-not-yet-released square looks like an empty open one */
.cell.pressed,
.cell.open {
  border: 1px solid var(--sh);
  border-width: 1px 0 0 1px;
  padding: 0 1px 1px 0;
}

.cell[data-n="1"] { color: #0000ff; }
.cell[data-n="2"] { color: #008000; }
.cell[data-n="3"] { color: #ff0000; }
.cell[data-n="4"] { color: #000080; }
.cell[data-n="5"] { color: #800000; }
.cell[data-n="6"] { color: #008080; }
.cell[data-n="7"] { color: #000000; }
.cell[data-n="8"] { color: #808080; }

.cell.flag {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='8' y='2' width='1' height='9' fill='%23000'/%3E%3Cpolygon points='8,2 3,5 8,8' fill='%23ff0000'/%3E%3Crect x='6' y='11' width='5' height='1' fill='%23000'/%3E%3Crect x='4' y='12' width='9' height='2' fill='%23000'/%3E%3C/svg%3E");
}

.cell.mine {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg fill='%23000'%3E%3Crect x='7' y='2' width='2' height='12'/%3E%3Crect x='2' y='7' width='12' height='2'/%3E%3Crect x='7' y='3' width='2' height='10' transform='rotate(45 8 8)'/%3E%3Crect x='3' y='7' width='10' height='2' transform='rotate(45 8 8)'/%3E%3Crect x='5' y='4' width='6' height='8'/%3E%3Crect x='4' y='5' width='8' height='6'/%3E%3C/g%3E%3Crect x='6' y='6' width='2' height='2' fill='%23fff'/%3E%3C/svg%3E");
}

.cell.mine-hit { background-color: #ff0000; }

/* a flag that turned out to be wrong: mine with a red cross over it */
.cell.wrong {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 2 L14 14 M14 2 L2 14' stroke='%23ff0000' stroke-width='2'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg fill='%23000'%3E%3Crect x='7' y='2' width='2' height='12'/%3E%3Crect x='2' y='7' width='12' height='2'/%3E%3Crect x='7' y='3' width='2' height='10' transform='rotate(45 8 8)'/%3E%3Crect x='3' y='7' width='10' height='2' transform='rotate(45 8 8)'/%3E%3Crect x='5' y='4' width='6' height='8'/%3E%3Crect x='4' y='5' width='8' height='6'/%3E%3C/g%3E%3Crect x='6' y='6' width='2' height='2' fill='%23fff'/%3E%3C/svg%3E");
}

/* ----------------------------- touch bar ----------------------------- */

.touch-bar[hidden] { display: none; }

.touch-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 6px;
  justify-content: center;
  background: var(--face);
  box-shadow:
    inset -1px -1px var(--dk),
    inset  1px  1px var(--hl),
    inset -2px -2px var(--sh),
    inset  2px  2px var(--lt);
}
.touch-bar .btn98 { min-width: 60px; height: 26px; }
.touch-bar .btn98.active {
  box-shadow:
    inset  1px  1px var(--sh),
    inset -1px -1px var(--hl),
    inset  2px  2px var(--dk),
    inset -2px -2px var(--lt);
  font-weight: bold;
}

/* ------------------------------ widgets ------------------------------ */

.btn98 {
  min-width: 75px;
  height: 23px;
  padding: 0 10px;
  border: 0;
  background: var(--face);
  font: 11px var(--font);
  color: #000;
  box-shadow:
    inset -1px -1px var(--dk),
    inset  1px  1px var(--hl),
    inset -2px -2px var(--sh),
    inset  2px  2px var(--lt);
  cursor: default;
}
.btn98:active {
  box-shadow:
    inset  1px  1px var(--dk),
    inset -1px -1px var(--hl),
    inset  2px  2px var(--sh),
    inset -2px -2px var(--lt);
  padding: 1px 9px 0 11px;
}
.btn98:focus-visible,
.face:focus-visible,
.tb-btn:focus-visible,
.menu-title:focus-visible,
.help-topic:focus-visible {
  outline: 1px dotted #000;
  outline-offset: -4px;
}
.input98:focus-visible { outline: 1px dotted #000; outline-offset: -3px; }
.help-topic.active:focus-visible { outline-color: #fff; }
.desktop-icon:focus-visible { outline: 1px dotted #fff; }

.input98 {
  width: 100%;
  height: 21px;
  padding: 2px 3px;
  border: 0;
  background: #fff;
  font: 11px var(--font);
  color: #000;
  box-shadow:
    inset -1px -1px var(--hl),
    inset  1px  1px var(--sh),
    inset -2px -2px var(--lt),
    inset  2px  2px var(--dk);
}
.input98:focus { outline: none; }

/* ------------------------------ dialogs ------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(0, 0, 0, .28);
}
.modal[hidden] { display: none; }

.dialog {
  width: max-content;
  max-width: 100%;
  transform: scale(var(--scale, 1));
  transform-origin: center center;
}
.dialog[hidden] { display: none; }
.dialog .title-bar { padding-left: 4px; }

.dialog-body {
  padding: 12px 12px 10px;
  min-width: 230px;
}
.dialog-body p { margin: 0 0 10px; line-height: 1.45; }

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
}

.best-table { border-collapse: collapse; width: 100%; }
.best-table td { padding: 3px 10px 3px 0; white-space: nowrap; font: 11px var(--font); }
.best-table .bt-time { text-align: right; }
.best-table .bt-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

/* --------------------------- statistics ---------------------------- */

.stats-table { border-collapse: collapse; }
.stats-table th,
.stats-table td {
  font: 11px var(--font);
  padding: 3px 6px;
  white-space: nowrap;
}
.stats-table thead th {
  text-align: right;
  border-bottom: 1px solid var(--sh);
  box-shadow: 0 1px 0 var(--hl);
  padding-bottom: 4px;
}
.stats-table tbody th {
  text-align: left;
  font-weight: normal;
  padding-left: 0;
  padding-right: 14px;
}
.stats-table tbody td { text-align: right; }
.stats-table tbody tr:first-child th,
.stats-table tbody tr:first-child td { padding-top: 6px; }
.stats-note { margin: 14px 0 0; max-width: 330px; opacity: .8; line-height: 1.45; }

.about-body { display: grid; grid-template-columns: 34px 1fr; gap: 10px; max-width: 300px; }
.about-body .dialog-buttons { grid-column: 1 / -1; }
.about-icon {
  width: 32px;
  height: 32px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg fill='%23000'%3E%3Crect x='7' y='2' width='2' height='12'/%3E%3Crect x='2' y='7' width='12' height='2'/%3E%3Crect x='7' y='3' width='2' height='10' transform='rotate(45 8 8)'/%3E%3Crect x='3' y='7' width='10' height='2' transform='rotate(45 8 8)'/%3E%3Crect x='5' y='4' width='6' height='8'/%3E%3Crect x='4' y='5' width='8' height='6'/%3E%3C/g%3E%3Crect x='6' y='6' width='2' height='2' fill='%23fff'/%3E%3C/svg%3E") center/32px no-repeat;
}

.howto-list { margin: 0; padding-left: 18px; line-height: 1.6; max-width: 280px; }

/* --------------------------- desktop icon --------------------------- */

.desktop-icon {
  position: fixed;
  top: 24px;
  left: 24px;
  width: 74px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #fff;
  text-align: center;
  cursor: default;
  user-select: none;
}
.desktop-icon[hidden] { display: none; }
.desktop-icon:focus-visible { outline: 1px dotted #fff; }
.desktop-icon-img {
  width: 32px;
  height: 32px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' fill='%23c0c0c0'/%3E%3Cg fill='%23000'%3E%3Crect x='7' y='2' width='2' height='12'/%3E%3Crect x='2' y='7' width='12' height='2'/%3E%3Crect x='7' y='3' width='2' height='10' transform='rotate(45 8 8)'/%3E%3Crect x='3' y='7' width='10' height='2' transform='rotate(45 8 8)'/%3E%3Crect x='5' y='4' width='6' height='8'/%3E%3Crect x='4' y='5' width='8' height='6'/%3E%3C/g%3E%3Crect x='6' y='6' width='2' height='2' fill='%23fff'/%3E%3C/svg%3E") center/32px no-repeat;
}
.desktop-icon-label { background: var(--nav); padding: 1px 3px; }

/* --------------------------- question marks --------------------------- */
/* Drawn like the original bitmap: a plain black "?" on the covered square,
   and on a black background once the field opens up at the end of a game. */
.cell.question { color: #000; }
.cell.question::after { content: "?"; font: bold 12px Tahoma, Verdana, sans-serif; }

/* ------------------------- black and white mode ------------------------- */
/* The "Color" command in the original switches the field to how it looked on
   a monochrome monitor: no coloured numbers, no red flag, no red LEDs. */
body.mono .cell[data-n] { color: #000; }
body.mono .cell.flag {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect x='8' y='2' width='1' height='9' fill='%23000'/%3E%3Cpolygon points='8,2 3,5 8,8' fill='%23000'/%3E%3Crect x='6' y='11' width='5' height='1' fill='%23000'/%3E%3Crect x='4' y='12' width='9' height='2' fill='%23000'/%3E%3C/svg%3E");
}
body.mono .cell.wrong {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 2 L14 14 M14 2 L2 14' stroke='%23000' stroke-width='2'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg fill='%23000'%3E%3Crect x='7' y='2' width='2' height='12'/%3E%3Crect x='2' y='7' width='12' height='2'/%3E%3Crect x='7' y='3' width='2' height='10' transform='rotate(45 8 8)'/%3E%3Crect x='3' y='7' width='10' height='2' transform='rotate(45 8 8)'/%3E%3Crect x='5' y='4' width='6' height='8'/%3E%3Crect x='4' y='5' width='8' height='6'/%3E%3C/g%3E%3Crect x='6' y='6' width='2' height='2' fill='%23fff'/%3E%3C/svg%3E");
}
body.mono .cell.mine-hit { background-color: #000; }
body.mono .cell.mine-hit.mine {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cg fill='%23fff'%3E%3Crect x='7' y='2' width='2' height='12'/%3E%3Crect x='2' y='7' width='12' height='2'/%3E%3Crect x='7' y='3' width='2' height='10' transform='rotate(45 8 8)'/%3E%3Crect x='3' y='7' width='10' height='2' transform='rotate(45 8 8)'/%3E%3Crect x='5' y='4' width='6' height='8'/%3E%3Crect x='4' y='5' width='8' height='6'/%3E%3C/g%3E%3Crect x='6' y='6' width='2' height='2' fill='%23000'/%3E%3C/svg%3E");
}
body.mono .led .seg { fill: #333; }
body.mono .led .seg.on { fill: #fff; }
body.mono .face { filter: grayscale(1); }

/* ----------------------------- cheat pixel ----------------------------- */
/* xyzzy then Shift+Enter: the top-left pixel of the screen turns black while
   the pointer sits on a mine, exactly like the original easter egg. */
#cheat-pixel {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  z-index: 999;
  background: transparent;
}
#cheat-pixel.safe { background: #fff; }
#cheat-pixel.mine { background: #000; }

/* --------------------------- custom dialog --------------------------- */
.custom-grid {
  display: grid;
  grid-template-columns: max-content 44px;
  gap: 7px 10px;
  align-items: center;
  width: max-content;
}
.input98.small { width: 44px; text-align: left; }
.custom-hint { margin: 10px 0 0; color: #000; opacity: .75; line-height: 1.45; }

/* ---------------------------- help dialog ---------------------------- */
.help-body {
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 10px;
  width: 430px;
  max-width: 100%;
}
.help-topics {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 2px;
  background: #fff;
  box-shadow:
    inset -1px -1px var(--hl),
    inset  1px  1px var(--sh),
    inset -2px -2px var(--lt),
    inset  2px  2px var(--dk);
}
.help-topic {
  border: 0;
  background: transparent;
  font: 11px var(--font);
  color: #000;
  text-align: left;
  padding: 3px 4px;
  cursor: default;
}
.help-topic.active { background: var(--nav); color: #fff; }
.help-pane {
  height: 190px;
  overflow-y: auto;
  padding: 6px 8px;
  background: #fff;
  box-shadow:
    inset -1px -1px var(--hl),
    inset  1px  1px var(--sh),
    inset -2px -2px var(--lt),
    inset  2px  2px var(--dk);
}
.help-pane h2 { margin: 0 0 6px; font-size: 11px; }
.help-pane p { margin: 0 0 8px; line-height: 1.5; }
.help-pane ul { margin: 0 0 8px; padding-left: 16px; line-height: 1.5; }
.help-pane li { margin-bottom: 3px; }
.help-body .dialog-buttons { grid-column: 1 / -1; margin-top: 8px; }

/* A zero-width ruler for the small viewport height. Reading 100svh through
   an element is stable where innerHeight is not: it does not jump when the
   browser hides its toolbar, and it settles correctly after a rotation. */
#vh-probe {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 100vh;
  height: 100svh;
  visibility: hidden;
  pointer-events: none;
}

/* ------------------------------- header ------------------------------- */
/* Sits above the desktop, outside the scaled stage: inside it, the width of
   the title would drive the zoom and shrink the field on a phone. Its height
   is measured by js/site.js and reserved through --header-h. */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 18px 8px 10px;
  text-align: center;
  pointer-events: none;
}
.site-header h1 {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(17px, 5vw, 26px);
  font-weight: bold;
  letter-spacing: .02em;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .3);
}
.site-header a {
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
}

@media (max-height: 560px) {
  .site-header { padding: 6px 8px 5px; }
  .site-header h1 { font-size: clamp(15px, 4vw, 19px); }
  .site-footer { padding: 5px 8px 6px; gap: 3px; }
  .site-footer img { width: 120px; }
}

/* ------------------------------- footer ------------------------------- */
/* Fixed to the bottom of the desktop, outside the scaled stage so the badge
   keeps its own size. The window is kept clear of it by --footer-h, which
   js/minesweeper.js measures and feeds back into the body padding. */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px 12px;
  text-align: center;
  pointer-events: none;          /* never steals a click meant for the field */
}
.site-footer a { pointer-events: auto; }
.site-footer img {
  display: block;
  width: 170px;
  height: auto;
  max-width: 60vw;
}
/* A Windows checkbox, drawn on the input itself so the label, the focus ring
   and the keyboard all keep working. */
.desktop-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #e2f2f2;
  font-size: 11px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .35);
  cursor: default;
  pointer-events: auto;
  user-select: none;
}
.desktop-toggle input {
  appearance: none;
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  margin: 0;
  background: #fff;
  box-shadow:
    inset -1px -1px var(--hl),
    inset  1px  1px var(--sh),
    inset -2px -2px var(--lt),
    inset  2px  2px var(--dk);
}
.desktop-toggle input:checked {
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 5 L4 7.5 L8.5 2' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E") center/9px no-repeat;
}
.desktop-toggle input:focus-visible { outline: 1px dotted #fff; outline-offset: 2px; }

.footer-note {
  margin: 0;
  color: #e2f2f2;
  font-size: 11px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .35);
}

/* ---------------------------- 404 page ---------------------------- */

.error-window { width: max-content; max-width: 100%; }

.error-body {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  max-width: 330px;
}
.error-body p { margin: 0 0 8px; line-height: 1.5; }
.error-body p:last-child { margin-bottom: 0; }
.error-body .dialog-buttons { grid-column: 1 / -1; }

/* the dead smiley stands in for the usual error icon */
.error-icon {
  width: 32px;
  height: 32px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 17'%3E%3Ccircle cx='8.5' cy='8.5' r='7.6' fill='%23ffff00' stroke='%23000'/%3E%3Cpath d='M4 4.5 L7.4 7.9 M7.4 4.5 L4 7.9 M9.6 4.5 L13 7.9 M13 4.5 L9.6 7.9' stroke='%23000' stroke-width='1.3'/%3E%3Cpath d='M4.6 12.8 Q8.5 9 12.4 12.8' fill='none' stroke='%23000' stroke-width='1.3'/%3E%3C/svg%3E") center/32px no-repeat;
}

/* a three by three scrap of field, with the mine that was stepped on */
.error-field {
  display: grid;
  grid-template-columns: repeat(3, var(--cell));
  margin-top: 14px;
  border: 3px solid;
  border-color: var(--sh) var(--hl) var(--hl) var(--sh);
  background: var(--face);
}

/* buttons that are really links */
a.btn98 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
a.btn98[hidden] { display: none; }
a.tb-btn { display: inline-block; }

.noscript-note {
  max-width: 420px;
  margin: 24px auto;
  padding: 0 12px;
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, .3);
}

/* ------------------------- no tap-to-zoom delay ------------------------- */
/* Safari drops its wait-and-see delay on a click only while double-tap zoom
   is impossible. A page at its normal size qualifies, but the moment a reader
   pinches in it becomes zoomable again and every button answers about a third
   of a second late. Saying it per control keeps them instant at any zoom; the
   field is left out because it has its own touch-action, and it reads
   pointerup anyway. */
.menu-title,
.menu-item,
.btn98,
.face,
.tb-btn,
.help-topic,
.desktop-icon,
.desktop-toggle,
.desktop-toggle input,
.neocities-badge {
  touch-action: manipulation;
}

/* --------------------------- screen readers --------------------------- */
/* Announcements that belong to the game but have no place on the screen */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* On a phone the vertical room is the scarce one, and a footer pinned to the
   bottom spends a hundred pixels of it that the field wants. There the page
   becomes an ordinary scrolling document: title, game, then the footer below
   it. The game is sized to the screen as before, so nothing has to be
   scrolled to play - only the footer sits past the fold. */
@media (max-width: 720px), (max-height: 700px) {
  body {
    --layout: flow;
    display: block;
    height: auto;
    min-height: 100svh;
    overflow: visible;
    overflow-x: hidden;        /* a wide field is scaled to fit, never sideways-scrolled */
    padding: 0 8px 0;
  }
  .site-header { position: static; padding: 12px 8px 8px; }
  .site-footer { position: static; margin-top: 26px; padding-bottom: 18px; }
  .stage { width: max-content; margin: 0 auto; }
}

/* ---------------------------- dark desktop ---------------------------- */
/* For playing in the dark: the desktop goes black - properly black, so an
   OLED screen can switch those pixels off - while the window itself is left
   exactly as Windows drew it. Only the site's own chrome around it dims. */
:root.dark {
  --desktop: #000;
}
.dark .site-header h1 {
  color: #3d7a7a;                /* the site's teal, turned down for the dark */
  text-shadow: none;
}
.dark .footer-note,
.dark .desktop-toggle {
  color: #6a6a6a;
  text-shadow: none;
}
.dark .noscript-note { color: #8a8a8a; text-shadow: none; }
.dark .site-footer img { opacity: .55; }
.dark .desktop-icon-label { background: #1a1a4d; }
.dark .desktop-toggle input:focus-visible { outline-color: #6a6a6a; }
