#difficulty-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  background: #f5f5f5;
  padding: 10px 24px;
  border-radius: 999px;
  border: 1.5px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  margin-bottom: 18px;
  margin-top: 8px;
}

#difficulty-controls-label {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #888;
  margin-right: 10px;
  letter-spacing: 1px;
  user-select: none;
  text-shadow: none;
  background: none;
  border: none;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  height: 40px;
}

.difficulty-btn, .newgame-btn {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #444;
  background: #fff;
  border: 1.5px solid #bbb;
  border-radius: 8px;
  padding: 7px 18px;
  margin: 0 2px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  outline: none;
}

.difficulty-btn.active, .difficulty-btn:focus {
  background: #1976d2;
  color: #fff;
  border-color: #1976d2;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(25,118,210,0.08);
  text-decoration: none;
}

.difficulty-btn:hover:not(.active), .newgame-btn:hover {
  background: #e3f0fd;
  color: #1976d2;
  border-color: #90caf9;
}

.newgame-btn {
  background: #43a047;
  color: #fff;
  border-color: #388e3c;
  font-weight: 700;
  margin-left: 18px;
  padding: 7px 22px;
  box-shadow: 0 2px 8px rgba(67,160,71,0.08);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.newgame-btn:active {
  background: #388e3c;
  border-color: #2e7031;
}
/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cell-size: 24px;
  --primary-color: #4a90e2;
  --primary-hover: #357abd;
  --bg-light: #ffffff;
  --bg-dark: #2a2a2a;
  --text-light: #333333;
  --text-dark: #f0f0f0;
  --border-light: #dddddd;
  --border-dark: #555555;
}

.minesweeper-container {
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  /* padding: 20px; */
}

.game-wrapper {
  /* background-color: var(--bg-light); */
  border-radius: 12px;
  /* padding: 24px; */
  /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.game-wrapper.dark {
  background-color: var(--bg-dark);
  color: var(--text-dark);
}

/* Difficulty Controls */
#difficulty-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.03);
  padding: 8px 16px;
  border-radius: 50px;
  /* Pill shape container */
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.game-wrapper.dark #difficulty-controls {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

#difficulty-controls-label {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  margin-right: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  height: 32px;
  /* border-radius: 50%; */
  /* border: 1px solid #ddd; */
  cursor: pointer;
  background-size: 18px;
  background-position: center;
  background-repeat: no-repeat;
  transition: all 0.2s ease;
  margin-right: 8px;
}

.theme-toggle.light {
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f39c12' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='5'%3E%3C/circle%3E%3Cline x1='12' y1='1' x2='12' y2='3'%3E%3C/line%3E%3Cline x1='12' y1='21' x2='12' y2='23'%3E%3C/line%3E%3Cline x1='4.22' y1='4.22' x2='5.64' y2='5.64'%3E%3C/line%3E%3Cline x1='18.36' y1='18.36' x2='19.78' y2='19.78'%3E%3C/line%3E%3Cline x1='1' y1='12' x2='3' y2='12'%3E%3C/line%3E%3Cline x1='21' y1='12' x2='23' y2='12'%3E%3C/line%3E%3Cline x1='4.22' y1='19.78' x2='5.64' y2='18.36'%3E%3C/line%3E%3Cline x1='18.36' y1='5.64' x2='19.78' y2='4.22'%3E%3C/line%3E%3C/svg%3E");
}

.theme-toggle.dark {
  background-color: #333;
  border-color: #555;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f1c40f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'%3E%3C/path%3E%3C/svg%3E");
}

.theme-toggle:hover {
  transform: rotate(15deg);
  background-color: #f5f5f5;
}

.game-wrapper.dark .theme-toggle:hover {
  background-color: #444;
}

/* Game Info Panel */
.board-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Center the board */
  width: 100%;
}

#game-info {
  display: flex;
  flex-direction: row;
  /* Horizontal alignment */
  justify-content: flex-start;
  /* Align to left */
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: fit-content;
  /* Match board width roughly */
  /* margin-bottom: 12px; */
  align-self: center;
}

.info-box {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: #000;
  padding: 4px 8px;
  border-style: solid;
  border-width: 2px;
  border-color: #808080 #fff #fff #808080;
  min-width: 60px;
  justify-content: center;
  box-shadow: inset 0 0 0 1px #000;
}

.game-wrapper.dark .info-box {
  background: #3a3a3a;
  border-color: #505050;
}

.info-icon {
   width: 32px;
  height: 32px;
  background-image: url('/minesweeper/UI.png');
  background-size: 512px 544px;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  display: inline-block;
  margin-right: -9px;
  /* background-color: #897a6c; */
  /* margin: 4px 4px 0px 4px; */
}

.mine-icon::before {
  content: '';
}

.mine-icon {
  background-position: -48px -24px;
}

`r`n`r`n.mine-icon {
  `r`n background-position: -48px -24px;
  `r`n
}

.clock-icon::before {
  content: '';
}

.clock-icon {
  background-position: 0px -24px;
  position: relative;
}

.clock-icon::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
   width: 32px;
  height: 32px;
  background-image: url('/minesweeper/UI.png');
  background-size: 512px 544px;
  background-position: 0px -288px;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  z-index: -1;
}

.clock-icon {
  background-position: 0px -32px;
}

.flag-icon::before {
  content: '';
}

.flag-icon {
  background-position: -32px -32px;
  position: relative;
}

.flag-icon::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
   width: 32px;
  height: 32px;
  background-image: url('/minesweeper/UI.png');
  background-size: 512px 544px;
  background-position: 0px -288px;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  z-index: -1;
}


.info-display {
  font-family: 'Roboto Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

.game-wrapper.dark .info-display {
  color: #fff;
}

/* Digit sprites for counters */
.digit {
   width: 32px;
  height: 32px;
  background-image: url('/minesweeper/UI.png');
  background-size: 512px 544px;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  display: inline-block;
  margin-right: -12px;
}

.digit-0 {
  background-position: 0px -64px;
}

.digit-1 {
  background-position: -32px -64px;
}

.digit-2 {
  background-position: -64px -64px;
}

.digit-3 {
  background-position: -96px -64px;
}

.digit-4 {
  background-position: -128px -64px;
}

.digit-5 {
  background-position: -160px -64px;
}

.digit-6 {
  background-position: -192px -64px;
}

.digit-7 {
  background-position: -224px -64px;
}

.digit-8 {
  background-position: -0px -96px;
}

.digit-9 {
  background-position: -32px -96px;
}


/* Game Board */
.board-container {
  display: inline-block;
  position: relative;
  border-style: solid;
  border-width: 4px 10px 10px 4px;
  border-image-source: url('/Micro-Classics-Minesweeper/16x16/Tiles/border-light.png');
  border-image-slice: 30;
  border-image-width: 15px 20px 20px 15px;
  border-image-repeat: stretch;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
  background-color: #8b7355;
}

#game-board {
  display: grid;
  gap: 0;
  background: #8b7355;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-repeat: no-repeat;
  background-position: -72px -96px;
  /* Default unrevealed */
  cursor: pointer;
  image-rendering: pixelated;
}

.cell:hover:not(.revealed):not(.flagged) {
  filter: brightness(1.1);
}

.cell.flagged {
  background-position: 0px -96px;
}

.cell.revealed {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Backgrounds.png');
  background-position: 0px 0px;
  cursor: default;
}

.cell.revealed:not([data-count]):not(.mine) {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Grids24.png');
  background-position: 0px 0px;
}

/* Number cells */
.cell.revealed[data-count="1"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: 0px 0px;
}

.cell.revealed[data-count="2"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -24px 0px;
}

.cell.revealed[data-count="3"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -48px 0px;
}

.cell.revealed[data-count="4"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -72px 0px;
}

.cell.revealed[data-count="5"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -96px 0px;
}

.cell.revealed[data-count="6"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -120px 0px;
}

.cell.revealed[data-count="7"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -144px 0px;
}

.cell.revealed[data-count="8"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -168px 0px;
}

.cell.mine {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -48px -96px;
}

.cell.mine.revealed {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -48px -96px;
}

/* Game Status */
#game-status {
  height: 24px;
  font-family: 'Inter', sans-serif;
  font-weight: bold;
  text-align: center;
  margin-bottom: 8px;
}

#game-status.win {
  color: #2ecc71;
}

.theme-toggle.dark {
  background-color: #333;
  border-color: #555;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f1c40f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'%3E%3C/path%3E%3C/svg%3E");
}

.theme-toggle:hover {
  transform: rotate(15deg);
  background-color: #f5f5f5;
}

.game-wrapper.dark .theme-toggle:hover {
  background-color: #444;
}

/* Game Info Panel */
.board-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Center the board */
  width: 100%;
}

#game-info {
  display: flex;
  flex-direction: row;
  /* Horizontal alignment */
  justify-content: flex-start;
  /* Align to left */
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: fit-content;
  /* Match board width roughly */
  /* margin-bottom: 12px; */
  align-self: center;
}

/* .info-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  padding: 0px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
  min-width: 80px;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
} */

.game-wrapper.dark .info-box {
  background: #3a3a3a;
  border-color: #505050;
}

/* 
.info-icon {
  `r`n width: 24px;
  `r`n height: 24px;
  `r`n background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/UI.png');
  `r`n background-repeat: no-repeat;
  `r`n image-rendering: pixelated;
  `r`n display: inline-block;
  `r`n
}

.mine-icon::before {
  `r`n content: '';
  `r`n
}

`r`n`r`n.mine-icon {
  `r`n background-position: -48px -24px;
  `r`n
}

.clock-icon::before {
  `r`n content: '';
  `r`n
}

`r`n`r`n.clock-icon {
  `r`n background-position: 0 0;
  `r`n
}

.flag-icon::before {
  `r`n content: '';
  `r`n
}

`r`n`r`n.flag-icon {
  `r`n background-position: -24px 0;
  `r`n
} */

.info-display {
  font-family: 'Roboto Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: #333;
}

.game-wrapper.dark .info-display {
  color: #fff;
}

/* Game Board */
.board-container {
  display: inline-block;
  position: relative;
  border-style: solid;
  border-width: 5px 10px 10px 5px;
  border-image-source: url('/Micro-Classics-Minesweeper/16x16/Tiles/border-light.png');
  border-image-slice: 30;
  border-image-width: 15px 20px 20px 15px;
  border-image-repeat: stretch;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
  background-color: #8b7355;
}

#game-board {
  display: grid;
  gap: 0;
  background: #8b7355;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-repeat: no-repeat;
  background-position: -72px -96px;
  /* Default unrevealed */
  cursor: pointer;
  image-rendering: pixelated;
}

.cell:hover:not(.revealed):not(.flagged) {
  filter: brightness(1.1);
}

.cell.flagged {
  background-position: 0px -96px;
}

.cell.revealed {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Backgrounds.png');
  background-position: 0px 0px;
  cursor: default;
}

.cell.revealed:not([data-count]):not(.mine) {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Grids24.png');
  background-position: 0px 0px;
}

/* Number cells */
.cell.revealed[data-count="1"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: 0px 0px;
}

.cell.revealed[data-count="2"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -24px 0px;
}

.cell.revealed[data-count="3"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -48px 0px;
}

.cell.revealed[data-count="4"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -72px 0px;
}

.cell.revealed[data-count="5"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -96px 0px;
}

.cell.revealed[data-count="6"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -120px 0px;
}

.cell.revealed[data-count="7"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -144px 0px;
}

.cell.revealed[data-count="8"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -168px 0px;
}

.cell.mine {
  /* Add mine style if needed, usually handled by sprite or class */
}

/* Game Status */
#game-status {
  height: 24px;
  font-family: 'Inter', sans-serif;
  font-weight: bold;
  text-align: center;
  margin-bottom: 8px;
}

#game-status.win {
  color: #2ecc71;
}

.theme-toggle.dark {
  background-color: #333;
  border-color: #555;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f1c40f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'%3E%3C/path%3E%3C/svg%3E");
}

.theme-toggle:hover {
  transform: rotate(15deg);
  background-color: #f5f5f5;
}

.game-wrapper.dark .theme-toggle:hover {
  background-color: #444;
}

/* Game Info Panel */
.board-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Center the board */
  width: 100%;
}

#game-info {
  display: flex;
  flex-direction: row;
  /* Horizontal alignment */
  justify-content: flex-start;
  /* Align to left */
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: fit-content;
  /* Match board width roughly */
  /* margin-bottom: 12px; */
  align-self: center;
}

.info-display {
  display: flex;
}

.info-box {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  position: relative;
  background-image: url('/minesweeper/ui-l1.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  width: 108px;
  height: 46px;
  padding-left: 5px;
  padding-bottom: 8px;
  box-sizing: border-box;
  border: none;
  min-width: 0;
  box-shadow: none;
}

.game-wrapper.dark .info-box {
  background: #3a3a3a;
  border-color: #505050;
}

.info-display {
  font-family: 'Roboto Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: #333;
  width: 67px;
}

.game-wrapper.dark .info-display {
  color: #fff;
}

/* Game Board */
.board-container {
  display: inline-block;
    position: relative;
    border-style: solid;
    border-width: 4px 10px 10px 4px;
    border-image-source: url('/minesweeper/border-l1.png');
    border-image-slice: 4 10 10 4;
    border-image-width: 4px 10px 10px 4px;
    border-image-repeat: stretch;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
    background-color: #8b7355;
}

#game-board {
  display: grid;
  gap: 0;
  background: #8b7355;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-repeat: no-repeat;
  background-position: -72px -96px;
  /* Default unrevealed */
  cursor: pointer;
  image-rendering: pixelated;
}

.cell:hover:not(.revealed):not(.flagged) {
  filter: brightness(1.1);
}

.cell.flagged {
  background-position: 0px -96px;
}

.cell.revealed {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Backgrounds.png');
  background-position: 0px 0px;
  cursor: default;
}

.cell.revealed:not([data-count]):not(.mine) {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Grids24.png');
  background-position: 0px 0px;
}

/* Number cells */
.cell.revealed[data-count="1"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: 0px 0px;
}

.cell.revealed[data-count="2"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -24px 0px;
}

.cell.revealed[data-count="3"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -48px 0px;
}

.cell.revealed[data-count="4"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -72px 0px;
}

.cell.revealed[data-count="5"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -96px 0px;
}

.cell.revealed[data-count="6"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -120px 0px;
}

.cell.revealed[data-count="7"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -144px 0px;
}

.cell.revealed[data-count="8"] {
  background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
  background-position: -168px 0px;
}

.cell.mine {
  /* Add mine style if needed, usually handled by sprite or class */
}

/* Game Status */
#game-status {
  height: 24px;
  font-family: 'Inter', sans-serif;
  font-weight: bold;
  text-align: center;
  margin-bottom: 8px;
}

#game-status.win {
  color: #2ecc71;
}

#game-status.lose {
  border-image-slice: 30;
  border-image-width: 12px;
  border-image-repeat: stretch;
  background-color: #4a4a4a;
  padding: 4px;
  cursor: pointer;
}

.reset-btn-face {
  width: 32px;
  height: 32px;
  background-image: url('/minesweeper/UI.png');
  background-size: 512px 544px;
  background-position: -64px 0;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}

/* Responsive */
@media (max-width: 768px) {
  .game-wrapper {
    padding: 16px;
    width: 100%;
    max-width: 100%;
    /* Ensure it doesn't exceed viewport */
  }

  #difficulty-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto auto;
    gap: 12px;
    width: 100%;
    border-radius: 16px;
    /* Less rounded on mobile for better space usage */
    padding: 16px;
    justify-items: stretch;
    /* Stretch buttons to fill grid cells */
  }

  /* Row 1: Toggle and Label */
  .theme-toggle {
    grid-column: 1;
    justify-self: start;
    margin-right: 0;
  }

  #difficulty-controls-label {
    grid-column: 2 / span 2;
    justify-self: start;
    align-self: center;
    margin-right: 0;
    white-space: nowrap;
  }

  /* Row 2: Difficulty Buttons */
  .difficulty-btn[data-difficulty="beginner"] {
    grid-column: 1;
  }

  .difficulty-btn[data-difficulty="intermediate"] {
    grid-column: 2;
  }

  .difficulty-btn[data-difficulty="expert"] {
    grid-column: 3;
  }

  /* Row 3: New Game Button */
  .difficulty-btn.new-game-btn {
    grid-column: 1 / -1;
    /* Full width */
    margin-left: 0;
    margin-top: 4px;
  }


  .info-display {
    font-family: 'Roboto Mono', monospace;
    font-size: 16px;
    font-weight: 700;
    color: #333;
  }

  .game-wrapper.dark .info-display {
    color: #fff;
  }

  /* Game Board */
  .board-container {
    display: inline-block;
    position: relative;
    border-style: solid;
    border-width: 9px 23px 22px 9px;
    border-image-source: url('/Micro-Classics-Minesweeper/16x16/Tiles/border-light.png');
    border-image-slice: 9 23 22 9;
    border-image-width: 9px 23px 22px 9px;
    border-image-repeat: stretch;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
    background-color: #8b7355;
  }

  #game-board {
    display: grid;
    gap: 0;
    background: #8b7355;
  }

  .cell {
    width: var(--cell-size);
    height: var(--cell-size);
    background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
    background-repeat: no-repeat;
    background-position: -72px -96px;
    /* Default unrevealed */
    cursor: pointer;
    image-rendering: pixelated;
  }

  .cell:hover:not(.revealed):not(.flagged) {
    filter: brightness(1.1);
  }

  .cell.flagged {
    background-position: 0px -96px;
  }

  .cell.revealed {
    background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Backgrounds.png');
    background-position: 0px 0px;
    cursor: default;
  }

  .cell.revealed:not([data-count]):not(.mine) {
    background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Grids24.png');
    background-position: 0px 0px;
  }

  /* Number cells */
  .cell.revealed[data-count="1"] {
    background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
    background-position: 0px 0px;
  }

  .cell.revealed[data-count="2"] {
    background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
    background-position: -24px 0px;
  }

  .cell.revealed[data-count="3"] {
    background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
    background-position: -48px 0px;
  }

  .cell.revealed[data-count="4"] {
    background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
    background-position: -72px 0px;
  }

  .cell.revealed[data-count="5"] {
    background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
    background-position: -96px 0px;
  }

  .cell.revealed[data-count="6"] {
    background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
    background-position: -120px 0px;
  }

  .cell.revealed[data-count="7"] {
    background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
    background-position: -144px 0px;
  }

  .cell.revealed[data-count="8"] {
    background-image: url('/Micro-Classics-Minesweeper/16x16/Tiles/Cells24.png');
    background-position: -168px 0px;
  }

}

#game-status.lose {
  color: #e74c3c;
}

/* Responsive */
@media (max-width: 768px) {
  .game-wrapper {
    padding: 16px;
    width: 100%;
    max-width: 100%;
    /* Ensure it doesn't exceed viewport */
  }

  #difficulty-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto auto;
    gap: 12px;
    width: 100%;
    border-radius: 16px;
    /* Less rounded on mobile for better space usage */
    padding: 16px;
    justify-items: stretch;
    /* Stretch buttons to fill grid cells */
  }

  /* Row 1: Toggle and Label */
  .theme-toggle {
    grid-column: 1;
    justify-self: start;
    margin-right: 0;
  }

  #difficulty-controls-label {
    grid-column: 2 / span 2;
    justify-self: start;
    align-self: center;
    margin-right: 0;
    white-space: nowrap;
  }

  /* Row 2: Difficulty Buttons */
  .difficulty-btn[data-difficulty="beginner"] {
    grid-column: 1;
  }

  .difficulty-btn[data-difficulty="intermediate"] {
    grid-column: 2;
  }

  .difficulty-btn[data-difficulty="expert"] {
    grid-column: 3;
  }

  /* Row 3: New Game Button */
  .difficulty-btn.new-game-btn {
    grid-column: 1 / -1;
    /* Full width */
    margin-left: 0;
    margin-top: 4px;
  }

  /* Adjust button styles for grid */
  .difficulty-btn {
    width: 100%;
    padding: 10px 4px;
    /* Smaller side padding, rely on width */
    font-size: 13px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0;
    /* Remove bottom margin as we use grid gap */
  }

  .board-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    align-items: flex-start;
    /* Allow scrolling from left */
    padding: 6px 8px;
  }

  .info-display {
    font-size: 14px;
  }

  .board-container {
    display: inline-block;
    min-width: min-content;
    margin-inline: auto;
  }
}
