:root {
  color-scheme: dark;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  background: #0c1110;
  color: #e7ede8;
  --ink: #e7ede8;
  --muted: #99a69f;
  --paper: #151d1a;
  --green: #83c5a1;
  --green-dark: #9ad9b5;
  --line: #2a3731;
  --cell-size: 34px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: #0c1110;
}

body {
  width: 100%;
  min-width: 320px;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% -28%, rgba(45, 92, 69, 0.2), transparent 56%),
    #0c1110;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible,
a:focus-visible,
.board-scroll:focus-visible {
  outline: 3px solid #e7b96d;
  outline-offset: 2px;
}

.page-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr);
  padding: 0 clamp(10px, 2.2vw, 34px);
}

.site-header {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(153, 177, 161, 0.12);
}

.brand {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid #4c765e;
  border-radius: 7px;
  background: #244333;
}

.brand-mark span {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: #b9e3c8;
  transform: rotate(45deg);
}

.brand-mark span::before,
.brand-mark span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #b9e3c8;
  content: "";
}

.brand-mark span::before {
  transform: translateY(-7px);
}

.brand-mark span::after {
  transform: translateX(7px);
}

.brand-name {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.7px;
}

.brand-period {
  color: #e9ae6b;
}

.header-note {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: #a3b0a8;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-decoration: none;
}

a.header-note:hover {
  color: #f2f6f2;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8ccd9e;
  box-shadow: 0 0 0 3px rgba(140, 205, 158, 0.12);
}

.game-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 7px 0 9px;
}

.intro {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 2px 5px 8px;
}

.eyebrow {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  flex: 0 0 auto;
  margin: 0;
  color: #9cb6a5;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.15em;
}

.eyebrow-line {
  width: 14px;
  height: 1px;
  background: #e5a967;
}

h1 {
  margin: 0;
  color: #edf2ed;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(20px, 2.3vw, 27px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
  white-space: nowrap;
}

h1 span {
  color: #88c6a0;
  font-style: italic;
}

.intro-copy {
  margin: 0 0 0 auto;
  color: #96a39b;
  font-size: 10px;
  letter-spacing: 0.01em;
}

.game-card {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #2b3832;
  border-radius: 13px;
  background: #141b18;
  box-shadow: 0 17px 56px rgba(0, 0, 0, 0.26), 0 1px 4px rgba(0, 0, 0, 0.35);
}

.game-toolbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px clamp(12px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
  background: #18211d;
}

.difficulty-wrap {
  display: flex;
  align-items: center;
  gap: 13px;
}

.control-label,
.counter-label {
  color: #a3b0a8;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.13em;
}

.difficulty-switch {
  display: flex;
  align-items: center;
  padding: 3px;
  border: 1px solid #35443c;
  border-radius: 8px;
  background: #111815;
}

.difficulty-button {
  min-height: 27px;
  padding: 0 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #b1bcb5;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  transition: background 140ms ease, color 140ms ease;
}

.difficulty-button:hover {
  color: #f2f6f2;
}

.difficulty-button.is-selected {
  border: 1px solid #45564b;
  background: #29372f;
  color: #c2e8ce;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
}

.board-size {
  margin: 0;
  color: #a2afa6;
  font-size: 10px;
  white-space: nowrap;
}

.board-size span {
  padding: 0 4px;
  color: #617568;
}

.game-console {
  width: min(100%, 380px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  padding: 8px 15px 4px;
}

.counter-block {
  display: grid;
  gap: 4px;
}

.counter-block-right {
  text-align: right;
}

.counter-label {
  font-size: 7px;
}

.digital-display {
  min-width: 54px;
  padding: 4px 6px 3px;
  border: 1px solid #3a4941;
  border-radius: 4px;
  background: #0b100e;
  color: #f3c87e;
  font-family: "Courier New", monospace;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  text-align: center;
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.55);
}

.face-button {
  width: 37px;
  height: 37px;
  display: grid;
  place-items: center;
  border: 1px solid #45564a;
  border-radius: 11px;
  background: #25382c;
  color: #d1ead6;
  cursor: pointer;
  font-family: "Segoe UI Emoji", sans-serif;
  font-size: 21px;
  line-height: 1;
  transition: transform 150ms ease, background 150ms ease;
}

.face-button:hover {
  transform: translateY(-1px);
  background: #304736;
}

.face-button:active {
  transform: translateY(1px);
}

.undo-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #45564a;
  border-radius: 11px;
  background: #25382c;
  color: var(--green);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  transition: transform 150ms ease, background 150ms ease;
}

.undo-button:hover {
  transform: translateY(-1px);
  background: #304736;
}

.undo-button:active {
  transform: translateY(1px);
}

.counter-block-best {
  text-align: right;
}

.best-display {
  min-width: 44px;
  color: var(--green-dark);
}

.custom-size {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 0 2px;
}

.custom-size[hidden],
.play-controls[hidden],
.replay-bar[hidden] {
  display: none;
}

.replay-bar {
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2px 14px 8px;
}

.replay-slider {
  width: min(260px, 40vw);
  accent-color: #83c5a1;
}

.replay-position {
  min-width: 128px;
  color: #a2aea6;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.replay-speed {
  min-height: 28px;
  padding: 0 6px;
  border: 1px solid #35443c;
  border-radius: 7px;
  background: #111815;
  color: var(--ink);
  font: inherit;
  font-size: 10px;
}

.custom-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.custom-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.1em;
}

.custom-input {
  width: 60px;
  padding: 4px 6px;
  border: 1px solid #3a4941;
  border-radius: 8px;
  background: #0b100e;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  text-align: center;
}

.custom-input:focus-visible {
  outline: 2px solid #e7b96d;
  outline-offset: 1px;
}

.custom-apply {
  padding: 5px 14px;
  border: 1px solid #4c765e;
  border-radius: 8px;
  background: #244333;
  color: var(--green-dark);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: background 150ms ease, transform 100ms ease;
}

.custom-apply:hover {
  background: #2c4f3b;
}

.custom-apply:active {
  transform: translateY(1px);
}

.play-controls {
  min-height: 42px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 2px 14px 8px;
}

.mode-switch {
  display: inline-flex;
  gap: 3px;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid #303d35;
  border-radius: 7px;
  background: #101613;
}

.mode-button {
  min-height: 26px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #aab5ad;
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.mode-button.is-selected {
  border: 1px solid #3e5145;
  background: #29372f;
  color: #cae9d2;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.mode-icon {
  width: 12px;
  height: 12px;
  display: inline-grid;
  place-items: center;
}

.reveal-icon {
  border: 1.5px solid currentColor;
  border-radius: 3px;
}

.reveal-icon::after {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.flag-icon {
  color: #f2bc70;
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 15px;
}

.tool-bar {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.tool-button {
  min-height: 28px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #35443c;
  border-radius: 7px;
  background: #111815;
  color: #b9c5bd;
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.tool-button:hover:not(:disabled) {
  border-color: #4c765e;
  color: #f2f6f2;
}

.tool-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.tool-button.is-on,
.tool-button[aria-pressed="true"] {
  border-color: #4c765e;
  background: #244333;
  color: var(--green-dark);
}

.tool-icon {
  min-width: 10px;
  color: #e9ae6b;
  font-size: 11px;
  line-height: 1;
  text-align: center;
}

.play-hint {
  margin: 0;
  color: #a2aea6;
  font-size: 9px;
  line-height: 1.4;
  text-align: right;
}

.board-frame {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: clamp(8px, 1.6vh, 16px);
  background:
    radial-gradient(ellipse at 50% 45%, rgba(55, 82, 65, 0.12), transparent 68%),
    #0d1310;
}

.board-scroll {
  max-width: 100%;
  max-height: 100%;
  overflow: auto;
  border: 1px solid #344139;
  border-radius: 5px;
  background: #18211c;
  scrollbar-color: #4b6152 #111815;
  scrollbar-width: thin;
}

.board {
  width: max-content;
  display: grid;
  grid-template-columns: repeat(var(--columns), var(--cell-size));
  gap: 2px;
  padding: 2px;
  margin: 0 auto;
  background: #202b24;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #4a5a50;
  border-radius: 3px;
  background: linear-gradient(145deg, #39463e, #29352e);
  color: #e5ece6;
  cursor: pointer;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-size: clamp(13px, calc(var(--cell-size) * 0.48), 21px);
  font-weight: 800;
  line-height: 1;
  box-shadow:
    inset 1px 1px 0 rgba(215, 235, 220, 0.12),
    inset -1px -1px 0 rgba(0, 0, 0, 0.27),
    0 1px 1px rgba(0, 0, 0, 0.18);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.cell:hover:not(.is-revealed) {
  border-color: #738b78;
  background: linear-gradient(145deg, #46564a, #334137);
}

.cell.is-revealed {
  border: 1px solid #252f29;
  background: #171e1a;
  color: #e7ece7;
  cursor: default;
  box-shadow:
    inset 1px 1px 3px rgba(0, 0, 0, 0.42),
    inset -1px -1px 0 rgba(176, 196, 181, 0.045);
}

.cell.is-revealed:focus-visible {
  outline-offset: -3px;
}

.cell.is-flagged {
  border-color: #77603a;
  background: linear-gradient(145deg, #4a4030, #392f24);
  color: #ffd27e;
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: clamp(14px, calc(var(--cell-size) * 0.52), 22px);
}

.cell.is-mine,
.cell.is-exposed-mine {
  border-color: #7b4d48;
  background: #432c2b;
  color: #ff9c87;
  font-size: clamp(15px, calc(var(--cell-size) * 0.56), 24px);
}

.cell.is-exposed-mine {
  background: #492e2d;
}

.cell.is-wrong-flag {
  border-color: #87504b;
  background: #492e2d;
  color: #ff9d91;
  font-size: clamp(15px, calc(var(--cell-size) * 0.56), 24px);
}

.cell.is-ghost-mine {
  color: rgba(255, 156, 135, 0.42);
}

.cell.is-hint {
  outline: 2px solid #f3c87e;
  outline-offset: -2px;
  animation: hint-pulse 1.1s ease-in-out infinite;
}

.cell.is-hint-clue {
  box-shadow: inset 0 0 0 2px rgba(120, 194, 255, 0.75);
}

@keyframes hint-pulse {
  50% { outline-color: rgba(243, 200, 126, 0.35); }
}

.cell.is-revealed.number-1 { color: #78c2ff; }
.cell.is-revealed.number-2 { color: #83d39a; }
.cell.is-revealed.number-3 { color: #ff8e82; }
.cell.is-revealed.number-4 { color: #c5a5ff; }
.cell.is-revealed.number-5 { color: #ffb36e; }
.cell.is-revealed.number-6 { color: #67d4d0; }
.cell.is-revealed.number-7 { color: #f0e8d9; }
.cell.is-revealed.number-8 { color: #b1bcb4; }

/* Okabe–Ito based colors, brightened for the dark board. */
[data-colorblind] .cell.is-revealed.number-1 { color: #56b4e9; }
[data-colorblind] .cell.is-revealed.number-2 { color: #f0e442; }
[data-colorblind] .cell.is-revealed.number-3 { color: #ff8a3d; }
[data-colorblind] .cell.is-revealed.number-4 { color: #e08ac0; }
[data-colorblind] .cell.is-revealed.number-5 { color: #e6b800; }
[data-colorblind] .cell.is-revealed.number-6 { color: #2fcfa5; }
[data-colorblind] .cell.is-revealed.number-7 { color: #ffffff; }
[data-colorblind] .cell.is-revealed.number-8 { color: #bdbdbd; }

[data-high-contrast] .cell {
  border-color: #a9bdb0;
  background: #5a6d61;
  color: #ffffff;
}

[data-high-contrast] .cell:hover:not(.is-revealed) {
  border-color: #e6f2e9;
  background: #6c8273;
}

[data-high-contrast] .cell.is-revealed {
  border-color: #3d4b42;
  background: #030504;
}

[data-high-contrast] .cell.is-flagged {
  border-color: #ffd27e;
  background: #5d4a26;
}

[data-high-contrast] .board {
  background: #000000;
}

[data-high-contrast] .tool-button,
[data-high-contrast] .difficulty-button,
[data-high-contrast] .mode-button {
  color: #ffffff;
}

[data-high-contrast] .game-message,
[data-high-contrast] .play-hint,
[data-high-contrast] .control-label,
[data-high-contrast] .counter-label {
  color: #ffffff;
}

[data-reduce-motion] *,
[data-reduce-motion] *::before,
[data-reduce-motion] *::after {
  scroll-behavior: auto !important;
  transition-duration: 0.01ms !important;
  animation: none !important;
}

.game-footer {
  min-height: 37px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px clamp(12px, 2vw, 22px);
  border-top: 1px solid #28352e;
  background: #151c19;
}

.game-message {
  min-height: 1.4em;
  margin: 0;
  color: #aad8b6;
  font-size: 10px;
  font-weight: 650;
}


.panel {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: auto;
  border: 1px solid #35443c;
  border-radius: 12px;
  background: #141b18;
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.panel::backdrop {
  background: rgba(4, 8, 6, 0.72);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #18211d;
}

.panel-head h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.panel-head form {
  margin: 0;
}

.panel-close {
  width: 30px;
  height: 30px;
  border: 1px solid #35443c;
  border-radius: 8px;
  background: #111815;
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.settings-list {
  display: grid;
  gap: 2px;
  padding: 8px;
}

.setting {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.setting:hover {
  background: #18211d;
}

.setting input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 1px 0 0;
  accent-color: #83c5a1;
}

.setting input:focus-visible {
  outline: 3px solid #e7b96d;
  outline-offset: 2px;
}

.setting strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
}

.setting small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.panel-wide {
  width: min(760px, calc(100vw - 24px));
}

.stats-wrap {
  margin: 12px 16px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stats-table th,
.stats-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.stats-table thead th {
  background: #18211d;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stats-table th[scope="row"],
.stats-table thead th:first-child {
  text-align: left;
}

.stats-table tbody tr:last-child > * {
  border-bottom: 0;
}

.stats-table abbr {
  text-decoration: none;
}

.panel-note {
  margin: 12px 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.share-text {
  display: block;
  width: calc(100% - 32px);
  margin: 0 16px;
  padding: 10px;
  resize: vertical;
  border: 1px solid #3a4941;
  border-radius: 8px;
  background: #0b100e;
  color: var(--ink);
  font: 12px/1.5 "Courier New", monospace;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 16px;
}

.panel-action {
  padding: 7px 16px;
  border: 1px solid #4c765e;
  border-radius: 8px;
  background: #244333;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.panel-action:hover {
  background: #2c4f3b;
}

.panel-action.is-danger {
  border-color: #7b4d48;
  background: #3a2423;
  color: #ffb3a6;
}

@media (min-width: 700px) {
  .board {
    --cell-size: clamp(24px, min(calc((100vw - 140px) / var(--columns)), calc((100dvh - 383px) / var(--rows))), 76px);
  }
}

@media (max-width: 699px) {
  .page-shell {
    grid-template-rows: 48px minmax(0, 1fr);
    padding: 0 9px;
  }

  .header-note {
    font-size: 9px;
  }

  .game-main {
    padding-top: 4px;
    padding-bottom: 5px;
  }

  .intro {
    min-height: 39px;
    gap: 9px;
    padding: 2px 3px 6px;
  }

  .eyebrow {
    gap: 5px;
    font-size: 7px;
    letter-spacing: 0.1em;
  }

  .eyebrow-line {
    width: 9px;
  }

  h1 {
    font-size: clamp(17px, 4.8vw, 23px);
  }

  .intro-copy {
    display: none;
  }

  .game-card {
    border-radius: 10px;
  }

  .game-toolbar {
    min-height: 51px;
    flex-wrap: wrap;
    gap: 4px 7px;
    padding: 6px 8px;
  }

  .difficulty-wrap {
    gap: 6px;
  }

  .control-label {
    font-size: 7px;
    letter-spacing: 0.08em;
  }

  .difficulty-button {
    min-height: 25px;
    padding: 0 6px;
    font-size: 9px;
  }

  .board-size {
    font-size: 9px;
  }

  .game-console {
    width: min(100%, 310px);
    padding: 5px 13px 2px;
  }

  .digital-display {
    min-width: 49px;
    font-size: 18px;
  }

  .face-button {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 19px;
  }

  .undo-button {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    font-size: 16px;
  }

  .best-display {
    min-width: 40px;
  }

  .custom-input {
    width: 54px;
  }

  .play-controls {
    min-height: 39px;
    flex-wrap: wrap;
    gap: 5px 9px;
    padding: 2px 7px 6px;
  }

  .mode-button {
    min-height: 24px;
    padding: 0 7px;
    font-size: 9px;
  }

  .play-hint {
    display: none;
  }

  .tool-button {
    min-height: 26px;
    padding: 0 8px;
    font-size: 9px;
  }

  .board-frame {
    padding: 6px;
  }

  .board {
    --cell-size: clamp(18px, min(calc((100vw - 52px) / var(--columns) - 2px), calc((100dvh - 330px) / var(--rows))), 40px);
    margin: 0;
  }

  .game-footer {
    min-height: 34px;
    gap: 5px;
    padding: 4px 8px;
  }

  .game-message {
    font-size: 8px;
  }

}

@media (max-width: 370px) {
  .header-note {
    max-width: 132px;
    font-size: 8px;
  }

  .tool-text {
    display: none;
  }
}

@media (max-height: 520px) {
  .page-shell {
    grid-template-rows: 42px minmax(0, 1fr);
  }

  .game-main {
    padding-top: 2px;
    padding-bottom: 3px;
  }

  .intro {
    min-height: 32px;
    padding-bottom: 4px;
  }

  .game-toolbar {
    min-height: 42px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .game-console {
    padding-top: 3px;
    padding-bottom: 1px;
  }

  .face-button {
    width: 30px;
    height: 30px;
  }

  .play-controls {
    min-height: 32px;
    padding-bottom: 4px;
  }

  .game-footer {
    min-height: 30px;
  }

  .board {
    --cell-size: clamp(8px, min(calc((100vw - 140px) / var(--columns)), calc((100dvh - 300px) / var(--rows))), 32px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
