/*
 * No-Guess Minesweeper - retro Windows 95 inspired theme.
 * Avoids CSS that breaks on older phones and browsers: no flex "gap",
 * no color-mix(), no clamp(), no backdrop-filter, no inset shorthand.
 */

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #008080;
}

body {
  margin: 0;
  padding: 18px 10px 40px;
  background: #008080;
  color: #000000;
  font: 13px/1.5 Tahoma, Verdana, "Segoe UI", Arial, Helvetica, sans-serif;
  -webkit-text-size-adjust: 100%;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------- Window shell ---------- */

.window {
  max-width: 1240px;
  margin: 0 auto;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  box-shadow: 2px 2px 0 #404040;
}

.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 4px;
  background: #000080;
  color: #ffffff;
}

.brand {
  overflow: hidden;
  color: #ffffff;
  font-size: 13px;
  font-weight: bold;
  white-space: nowrap;
  text-decoration: none;
}

.title-bar-icon {
  width: 14px;
  height: 14px;
  margin-right: 5px;
  color: #c0c0c0;
  vertical-align: -2px;
}

.window-controls i {
  display: inline-block;
  width: 18px;
  height: 16px;
  margin-left: 2px;
  border: 1px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  background: #c0c0c0;
  color: #000000;
  font-style: normal;
  font-size: 10px;
  line-height: 14px;
  text-align: center;
}

/* ---------- Tabs, left aligned like a Win95 tab strip ---------- */

.tab-strip {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 5px 6px 0;
  border-bottom: 1px solid #808080;
}

.tabs {
  padding: 0;
}

.tab {
  position: relative;
  bottom: 0;
  z-index: 1;
  display: inline-block;
  margin-right: 3px;
  padding: 4px 14px;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  background: #c0c0c0;
  color: #000000;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.tab.active {
  bottom: -1px;
  z-index: 2;
  border-bottom-color: #c0c0c0;
  font-weight: bold;
}

/* ---------- Page content ---------- */

main {
  padding: 0 16px 24px;
}

.hero {
  padding: 24px 8px 18px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: #000080;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.eyebrow span {
  display: none;
}

h1 {
  margin: 0;
  color: #000080;
  font-size: 26px;
  font-weight: bold;
  line-height: 1.25;
}

.hero-copy {
  max-width: 620px;
  margin: 8px auto 0;
  color: #303030;
  font-size: 13px;
}

/* ---------- Game ---------- */

.play-layout {
  padding: 4px 0 16px;
  text-align: center;
}

.game-card {
  position: relative;
  display: inline-block;
  max-width: 100%;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  background: #c0c0c0;
  text-align: left;
  vertical-align: top;
}

.game-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px;
  border-bottom: 1px solid #808080;
}

.difficulty-picker {
  display: inline-block;
}

.difficulty-picker button {
  margin-right: 4px;
  padding: 4px 10px;
  font-size: 12px;
}

.difficulty-picker button small {
  margin-left: 4px;
  font-size: 10px;
}

.game-toolbar .new-game-button {
  margin-left: 10px;
}

.difficulty-picker button,
.new-game-button,
.flag-mode-button,
.check-button,
.face-button {
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  background: #c0c0c0;
  color: #000000;
  cursor: pointer;
}

.difficulty-picker button:active,
.difficulty-picker button.active,
.new-game-button:active,
.flag-mode-button:active,
.flag-mode-button.active,
.check-button:active,
.face-button:active {
  border-color: #808080 #ffffff #ffffff #808080;
  background: #b8b8b8;
}

.difficulty-picker button.active {
  outline: 1px dotted #000000;
  outline-offset: -5px;
}

.new-game-button {
  padding: 4px 10px;
  font-size: 12px;
}

.check-button {
  margin-left: 6px;
  padding: 4px 10px;
  font-size: 12px;
}

.flag-mode-button {
  margin-left: 6px;
  padding: 4px 10px;
  font-size: 12px;
}

.flag-mode-button svg {
  width: 13px;
  height: 13px;
  margin-right: 5px;
  vertical-align: -2px;
}

/* Pressed state while flag mode is on. */
.flag-mode-button.active {
  font-weight: bold;
}

.check-button svg {
  width: 13px;
  height: 13px;
  margin-right: 5px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
  vertical-align: -2px;
}

.new-game-button svg {
  width: 13px;
  height: 13px;
  margin-right: 5px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  vertical-align: -2px;
}

.status-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 300px;
  max-width: 100%;
  margin: 10px auto;
  padding: 6px 8px;
  border: 3px solid;
  border-color: #808080 #ffffff #ffffff #808080;
}

.stat {
  display: grid;
  grid-template-columns: auto;
  justify-content: center;
  justify-items: center;
}

.stat strong {
  min-width: 64px;
  padding: 2px 4px;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  background: #000000;
  color: #ff0000;
  font-family: "Courier New", "Lucida Console", monospace;
  font-size: 22px;
  font-weight: bold;
  line-height: 1.15;
  letter-spacing: 2px;
  text-align: center;
}

.stat small {
  margin-top: 3px;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.08em;
}

.face-button {
  width: 38px;
  height: 38px;
  padding: 0;
  font-family: Arial, sans-serif;
  font-size: 19px;
  line-height: 1;
}

.board-frame {
  position: relative;
  display: grid;
  align-items: center;
  justify-items: center;
  overflow: auto;
  min-height: 140px;
  margin: 0 8px;
  padding: 6px;
  border: 3px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  background: #c0c0c0;
}

.board {
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell-size));
  gap: 0;
  background: #c0c0c0;
  -webkit-user-select: none;
  user-select: none;
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--cell-size);
  height: var(--cell-size);
  padding: 0;
  border: 3px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  background: #c0c0c0;
  color: #000000;
  font-family: Tahoma, Arial, Helvetica, sans-serif;
  font-size: 15px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
}

.cell:hover:not(.revealed) {
  background: #d0d0d0;
}

.cell:focus {
  outline: 1px dotted #000000;
  outline-offset: -5px;
}

.cell.revealed {
  border: 1px solid #808080;
  background: #c0c0c0;
  cursor: default;
}

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

.cell.mine-other {
  border-color: #d0d0d0;
  background: #c0c0c0;
}

.mine-cell-icon {
  width: 68%;
  height: 68%;
  color: #000000;
}

.flag-cell-icon {
  width: 62%;
  height: 62%;
}

.cell.flagged {
  background: #c8c8c8;
}

.cell.wrong-flag {
  border-color: #d0d0d0;
  background: #c0c0c0;
}

.cell-x {
  position: absolute;
  width: 62%;
  height: 62%;
  margin: 0;
}

.wrong-flag .cell-x path {
  stroke: #ff0000;
}

.mine-highlight {
  fill: #c0c0c0;
}

.cell.number-1 { color: #0000ff; }
.cell.number-2 { color: #008000; }
.cell.number-3 { color: #ff0000; }
.cell.number-4 { color: #000080; }
.cell.number-5 { color: #800000; }
.cell.number-6 { color: #008080; }
.cell.number-7 { color: #000000; }
.cell.number-8 { color: #808080; }

.game-won {
  outline: 2px solid #000080;
  outline-offset: -2px;
}

.generating {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(192, 192, 192, 0.92);
  text-align: center;
}

.generating[hidden] {
  display: none;
}

.generating strong {
  margin-top: 10px;
  font-size: 12px;
}

.generating small {
  margin-top: 3px;
  color: #303030;
  font-size: 11px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid #808080;
  border-top-color: #000080;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.game-hint {
  padding: 7px 10px;
  border-top: 1px solid #808080;
  font-size: 11px;
  text-align: center;
}

.game-hint strong {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.game-hint span {
  display: block;
}

.game-hint i {
  margin-right: 5px;
  color: #000080;
  font-style: normal;
}

.game-hint .hint-icon {
  width: 11px;
  height: 11px;
  margin-right: 5px;
  vertical-align: -1px;
}

/* ---------- Result popup, a classic Windows message box ---------- */

.result-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: rgba(0, 0, 0, 0.28);
}

.result-overlay[hidden] {
  display: none;
}

.result-box {
  width: 340px;
  max-width: 100%;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  background: #c0c0c0;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}

.result-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 3px 2px 6px;
  background: #000080;
  color: #ffffff;
  font-size: 12px;
  font-weight: bold;
}

.result-box-lost .result-title {
  background: #800000;
}

.result-x {
  width: 19px;
  height: 16px;
  padding: 0;
  border: 1px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  background: #c0c0c0;
  color: #000000;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 11px;
  font-weight: bold;
  line-height: 14px;
  cursor: pointer;
}

.result-body {
  display: flex;
  align-items: flex-start;
  padding: 16px 14px 10px;
}

.result-face {
  margin-right: 12px;
  font-family: Arial, sans-serif;
  font-size: 32px;
  line-height: 1;
}

.game-message {
  margin: 0;
  color: #000000;
  font-size: 12px;
  line-height: 1.45;
}

.game-message-won {
  color: #000080;
}

.game-message-lost {
  color: #800000;
}

.result-actions {
  display: flex;
  justify-content: center;
  padding: 4px 10px 14px;
}

.result-actions button {
  min-width: 92px;
  margin: 0 5px;
  padding: 5px 12px;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  background: #c0c0c0;
  color: #000000;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
}

.result-actions button:active,
.result-actions button:focus {
  border-color: #808080 #ffffff #ffffff #808080;
}

.result-actions button[hidden] {
  display: none;
}

.noscript-note {
  margin: 0;
  padding: 8px 10px;
  border-top: 1px solid #808080;
  background: #ffffcc;
  color: #303030;
  font-size: 11px;
  text-align: center;
}

/* ---------- Article sections ---------- */

.seo-intro {
  max-width: 760px;
  margin: 22px auto;
  text-align: center;
}

.section-kicker {
  margin: 0 0 5px;
  color: #000080;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.seo-intro h2,
.guide-grid h2,
.faq h2 {
  margin: 0;
  color: #000080;
  font-size: 19px;
  font-weight: bold;
}

.seo-intro > p:last-child {
  margin: 8px 0 0;
  color: #303030;
  font-size: 13px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  max-width: 1160px;
  margin: 0 auto 20px;
  padding: 10px 6px;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  background: #c0c0c0;
}

.content-grid article {
  padding: 4px 16px;
}

.content-grid article + article {
  border-left: 1px solid #808080;
}

.content-grid h2 {
  margin: 0 0 5px;
  color: #000080;
  font-size: 13px;
}

.content-grid p {
  margin: 0;
  color: #303030;
  font-size: 12px;
}

.article-icon {
  display: none;
}

.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1160px;
  margin: 0 auto 20px;
  padding: 16px 18px;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  background: #c0c0c0;
}

.guide-grid article {
  padding-right: 18px;
}

.guide-grid article + article {
  padding-left: 18px;
  border-left: 1px solid #808080;
}

.guide-grid h2 {
  margin-bottom: 10px;
  font-size: 17px;
}

.guide-grid article > p:not(.section-kicker),
.guide-grid li {
  color: #303030;
  font-size: 12px;
}

.guide-grid article > p:not(.section-kicker) {
  margin: 0 0 10px;
}

.guide-grid ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}

.guide-grid li {
  position: relative;
  margin-bottom: 10px;
  padding-left: 26px;
  counter-increment: steps;
}

.guide-grid li:before {
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 18px;
  border: 1px solid #808080;
  background: #c0c0c0;
  color: #000080;
  content: counter(steps);
  font-size: 11px;
  font-weight: bold;
  line-height: 17px;
  text-align: center;
}

.guide-grid strong {
  color: #000000;
}

/* ---------- Difficulty table and strategy list ---------- */

.levels,
.tips {
  max-width: 1160px;
  margin: 0 auto 20px;
  padding: 16px 18px;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  background: #c0c0c0;
}

.levels h2,
.tips h2 {
  margin: 0 0 8px;
  color: #000080;
  font-size: 17px;
  font-weight: bold;
}

.levels > p,
.tips > p {
  margin: 0 0 12px;
  color: #303030;
  font-size: 12px;
}

.levels table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 12px;
}

.levels caption {
  padding: 0 0 8px;
  color: #404040;
  font-size: 11px;
  text-align: left;
}

.levels th,
.levels td {
  padding: 5px 8px;
  border: 1px solid #808080;
  text-align: left;
}

.levels thead th {
  background: #c0c0c0;
  color: #000000;
  font-size: 11px;
}

.levels tbody th {
  background: #e8e8e8;
  font-weight: bold;
}

.tips ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: tips;
}

.tips li {
  position: relative;
  margin-bottom: 10px;
  padding-left: 26px;
  color: #303030;
  font-size: 12px;
  counter-increment: tips;
}

.tips li:last-child {
  margin-bottom: 0;
}

.tips li:before {
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 18px;
  border: 1px solid #808080;
  background: #c0c0c0;
  color: #000080;
  content: counter(tips);
  font-size: 11px;
  font-weight: bold;
  line-height: 17px;
  text-align: center;
}

.tips strong {
  color: #000000;
}

/* Wider screens: two balanced columns keep the strategy list readable. */
@media (min-width: 900px) {
  .tips ol {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-column-gap: 32px;
  }

  .tips li:last-child {
    grid-column: 1 / -1;
  }
}

.faq {
  max-width: 1160px;
  margin: 0 auto 24px;
}

.faq > .section-kicker,
.faq > h2 {
  text-align: center;
}

.faq > h2 {
  margin-bottom: 12px;
}

.faq details {
  margin-bottom: 4px;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  background: #c0c0c0;
}

.faq summary {
  padding: 5px 8px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.faq details[open] summary {
  border-bottom: 1px solid #808080;
}

.faq details p {
  margin: 0;
  padding: 8px;
  color: #303030;
  font-size: 12px;
}

footer {
  padding: 8px 12px;
  border-top: 1px solid #808080;
  font-size: 11px;
  text-align: center;
}

footer p {
  margin: 0;
}

/* ---------- Ad containers, hidden until a network is connected ---------- */

.ad-slot {
  max-width: 728px;
  min-height: 90px;
  margin: 0 auto 16px;
  overflow: hidden;
  border: 1px dashed #808080;
  color: #404040;
  font-size: 11px;
  text-align: center;
}

.ad-slot[hidden] {
  display: none;
}

.ad-rail {
  max-width: 300px;
  min-height: 600px;
}

/* ---------- Focus ---------- */

a:focus,
button:focus,
summary:focus {
  outline: 1px dotted #000080;
  outline-offset: 2px;
}

.brand:focus {
  outline-color: #ffffff;
}

/* ---------- Small screens ---------- */

@media (max-width: 700px) {
  body {
    padding: 8px 6px 24px;
    font-size: 12px;
  }

  .window {
    box-shadow: none;
  }

  .window-controls {
    display: none;
  }

  .brand {
    font-size: 12px;
  }

  main {
    padding: 0 6px 16px;
  }

  .hero {
    padding: 16px 4px 12px;
  }

  h1 {
    font-size: 20px;
  }

  .hero-copy {
    font-size: 12px;
  }

  .game-card {
    display: block;
  }

  .difficulty-picker {
    display: block;
    margin-bottom: 6px;
  }

  .difficulty-picker button {
    padding: 6px 10px;
    min-height: 32px;
    font-size: 11px;
  }

  .difficulty-picker button small {
    display: none;
  }

  .game-toolbar .new-game-button {
    margin-left: 0;
    padding: 6px 12px;
    min-height: 32px;
  }

  .status-bar {
    width: auto;
  }

  .board-frame {
    justify-items: start;
    margin: 0 6px;
  }

  .content-grid,
  .guide-grid {
    grid-template-columns: 1fr;
    padding: 14px 16px;
  }

  .content-grid article {
    padding: 4px 0;
  }

  .content-grid article + article {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid #808080;
    border-left: 0;
  }

  .guide-grid article {
    padding-right: 0;
  }

  .guide-grid article + article {
    margin-top: 14px;
    padding-top: 14px;
    padding-left: 0;
    border-top: 1px solid #808080;
    border-left: 0;
  }

  .levels,
  .tips {
    margin-bottom: 14px;
    padding: 12px 10px;
  }

  .levels {
    overflow-x: auto;
  }

  .levels table {
    min-width: 470px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 0.01ms;
  }
}
