.minesweeper-wrapper {

  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  font-family: "Montserrat", Helvetica, Arial, sans-serif;
}
.minesweeper-wrapper button:hover {
    background-color: #6c6c6c;
    transform: translateY(0px);
}
.minesweeper-game .game-mode {
    margin: 0 auto 15px;
    font-family: 'Indie Flower', -apple-system, cursive;
border: 3px solid #373737;
    border-radius: 6px;
}
div.absolute2[hidden] {
  display: none !important;
}
.minesweeper-container {
  background: #181818;
  border: 4px solid #333;
  border-radius: 8px;
  box-shadow: 0 0 16px #000a;
  padding: 24px 16px 16px 16px;
  /* Отключаем масштабирование при двойном тапе */

}
.buttonand {
    border: 2px solid white;
    display: inline-block;
    padding: 4px 4px 6px;
    line-height: 1;
    cursor: pointer;
    text-align: center;
    font-size: 27px;
    width: 250px;
    background: #1a1a1a;
    border-radius: 10px;
    transition: 0.3s all;
}
.buttonand:hover {
    background-color: #5f1212 !important;
}
.cancelMenu {    text-align: center;
    margin: 10px 0 14px;}
  #startMenu {
    margin: 0 auto;
}
.absolute2 >div {background: #2f2f2fd4;    border: 1px solid white;
  padding: 12px 12px;    font-size: 22px;    width: 320px;
    text-align: center;
  border-radius: 8px;}
p.winMenu, p.cancelMenu {    margin-top: 11px;}

#custom-settings  {    margin-top: 10px;
    margin-bottom: 10px;}
div.absolute2 {
 
        position: fixed;
    top: -70px;
    right: 0;
    left: 0;
    background: #1a1a1a57;
    bottom: 0;
    display: flex
;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    align-items: center;
    z-index: 22;
}
.minesweeper-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #111;
  border: 3px solid #444;
  border-radius: 6px;
  padding: 8px 8px;
  margin-bottom: 0px;
  gap: 10px;
  min-width: 0;
      margin-bottom: 15px;
}
.minesweeper-counter {
    padding: 2px 4px;
    font-size: 2.5rem;
    color: #f33;
    background: #111;
    border: 2px inset #222;
    border: 2px solid #6c6c6c;
    min-width: 76px;
    text-align: center;
    letter-spacing: 2px;
    user-select: none;
    box-sizing: border-box;
    border: 2px solid #6c6c6c;
    border-radius: 7px;
}
.minesweeper-smile {
  font-size: 2.2rem;
  background: #222;
    border: 2px solid #6c6c6c;    margin: 0;
  border-radius: 6px;
width: 43px;
    height: 43px;
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.minesweeper-smile:active {
  background: #444;
}
.minesweeper-board {
      display: grid;
      justify-content: center;
    grid-template-columns: repeat(10, 36px);
    grid-template-rows: repeat(16, 36px);
     gap: 1px; 
    border-radius: 6px;
    padding: 0px;
    /* Отключаем масштабирование при двойном тапе */
    touch-action: manipulation;
}

/* CSS переменные для размера клетки и шрифта */
:root {
  --cell-size: 36px;
  --font-size: 22px;
}
.cell {
    border-top: 3px solid #6c6c6c;
    border-left: 3px solid #6c6c6c;
    border-bottom: 3px solid #111;
    border-right: 3px solid #111;
    background: #232323;
    position: relative;
    border-radius: 0;
    outline: none;
    display: flex
;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size);
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: none;
    width: auto;
    height: auto;
    line-height: initial;
    /* Отключаем масштабирование при двойном тапе */
    touch-action: manipulation;
}
.cell.open {
  background: #3a3a3a;
  border: 0px solid #232323;
  box-shadow: none;
  cursor: default;
}
.cell.flag {
  color: #f3d400;
}
.cell.mine {
  color: #f33;
}
.cell.mine.open { }
.cell.open.explosion {  background: #3a3a3a;}
.cell.num1 { color: #3b7fff; }
.cell.num2 { color: #4ecb4e; }
.cell.num3 { color: #f33; }
.cell.num4 { color: #9797a4; }
.cell.num5 { color: #8a2e2e; }
.cell.num6 { color: #2e8a8a; }
.cell.num7 { color: #000; }
.cell.num8 { color: #888; }
.cell.question {
  color: #ffb300;
  font-size: 1.3rem;
  opacity: 0.85;
}
.game-mode .row{    display: flex;

    justify-content: space-between;}
@keyframes mine-explode {
  0% { background: #fffbe6; transform: scale(1) rotate(0deg); }
  10% { background: #ffe066; transform: scale(1.25) rotate(-2deg); }
  20% { background: #ffd700; transform: scale(1.18) rotate(2deg); }
  35% { background: #ff6666; transform: scale(1.12) rotate(-1deg); }
  50% { background: #f33; transform: scale(1.08) rotate(1deg); }
  65% { background: #f33; transform: scale(1.04) rotate(-1deg); }
  80% { background: #181818; transform: scale(1) rotate(0deg); }
  100% { background: #181818; transform: scale(1) rotate(0deg); }
}
@keyframes mine-shake {
  0% { transform: translate(0,0) scale(1); }
  15% { transform: translate(-2px,2px) scale(1.1); }
  30% { transform: translate(2px,-2px) scale(1.15); }
  45% { transform: translate(-2px,2px) scale(1.1); }
  60% { transform: translate(2px,-2px) scale(1.05); }
  75% { transform: translate(-1px,1px) scale(1.02); }
  100% { transform: translate(0,0) scale(1); }
}
.cell.exploded {
  z-index: 2;
}

.cell.mine-blast {
}
.cell.mine-blast::before {

  content: '';
  position: absolute;
  top: calc(50% - 5px);
  left: calc(50% - 5px);
  width: 100%;
  width: 10px;
  height: 10px;
  z-index: 1;
  border-radius: 50%;
}
.cell.blast-mark {
  color: transparent !important;
  transition: background 0.1s, box-shadow 0.1s;
  background: #3a3a3a;
}
.cell .blast-fire {
  position: absolute;
  left: 0; top: 0; right: 0; bottom: 0;
  width: 100%; height: 100%;
  background: url('mine.png') center center/cover no-repeat;
  pointer-events: none;
  z-index: 10;
  animation: fire-blast-scale 0.5s cubic-bezier(0.4,0.2,0.2,1) forwards, fire-fade-in 0.1s;
}
.cell.blast-center {
  z-index: 11;
  box-shadow: 0 0 20px 8px #ff6347ee;
  color: transparent !important;
}
@keyframes cell-blink {
  0% { filter: brightness(1); }
  20% { filter: brightness(2); }
  40% { filter: brightness(1); }
  60% { filter: brightness(2); }
  80% { filter: brightness(1); }
  100% { filter: brightness(1); }
}
.cell.blink {
  animation: cell-blink 0.4s;
}
.cell.around-active {
  box-shadow: 0 0 0 2px #fffbe6, 0 0 8px 2px #ffe066;
  z-index: 1;
}
@keyframes around-blink {
  0% {background: #3a3a3a;    border: 0px solid #232323;}
  50% { background: #3a3a3a;    border: 0px solid #232323;}
  100% { background: #3a3a3a;    border: 0px solid #232323;}
}
.cell.around-blink {
 /* animation: around-blink 0.4s;*/
  z-index: 1;
}

/* Фон после взрыва только для клетки */
/* .cell-fire больше не нужен */

@keyframes fire-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fire-blast-scale {
  0% {
    background-size: 100% 100%;
    transform: scale(1);
  }
  30% {
    background-size: 100% 100%;
    transform: scale(2);
  }
  100% {
    background-size: 100% 100%;
    transform: scale(1);
  }
}

@media (max-width: 768px) {
    .minesweeper-panel {
        padding: 2px 5px 12px;
        gap: 4px;
        border: none;
    }
    .minesweeper-counter {
        font-size: 2rem;
        padding: 2px 4px;
    }
  .minesweeper-smile {
   font-size: 2rem;
        padding: 2px 4px;    height: 37px;
  }
}

.cell .mine-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  margin: auto;
  pointer-events: none;
}

/* Всплывающее меню для мобильных */
.cell-action-menu {
  position: fixed;
  z-index: 1000;
  background: #222;
  border: 2px solid #444;
  border-radius: 10px;
  box-shadow: 0 4px 24px #000a;
  display: none;
  gap: 12px;
  padding: 12px 16px;
  align-items: center;
  justify-content: center;
  /* top: 50%; left: 50%; transform: translate(-50%, -50%);  убираем */
}
/* Кнопки меню для мобильных */
.menu-btn {
  position: absolute;
  z-index: 1001;
  background: #aeaeaebd;
  border: none;
  border-radius: 10px;
  font-size: 1.5rem;
  color: #fff;
  padding: 0;
  cursor: pointer;
 
  display: none;
  width: 39px;
  height: 39px;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.menu-btn:active {
  background: none;
}
.menu-btn.close-btn {
  color: #ff6666;
  font-size: 1.3rem;
  z-index: 1002;
  width: 39px;
  height: 39px;
  border-radius: 10px;
}
.cell-menu-active {
  outline: 3px solid #ffe066;
  outline-offset: -3px;
  z-index: 1003;
}
@media (min-width: 768px) {
  .cell-action-menu {
    display: none !important;
  }
}
@media (max-width: 768px) {
.minesweeper-container {
    padding: 24px 1px 16px 1px;
}
.minesweeper-board {
    gap: 0px; 
}
}

/* Дополнительные медиа-запросы для очень маленьких экранов */
@media (max-width: 480px) {
.minesweeper-container {
    padding: 16px 0px 8px 0px;
}
}

@media (max-width: 320px) {
.minesweeper-container {
    padding: 12px 0px 6px 0px;
}
}
#custom-settings input {text-align: center;}

.revert {display: none;}
@media (min-device-aspect-ratio: 1/1) and (max-width: 475px), (max-height: 475px){
                        .revert {
                            display: block;
                            font-size: 24px;
                            text-transform: uppercase;
                            color: #dd4141;
                            margin-top: 33px;	text-align: center;font-family: 'Indie Flower', -apple-system, cursive;        margin-bottom: 40px;
                        }
                        .minesweeper-panel, .minesweeper-board, .game-mode {display: none;}
                        .revert::after {         content: '';
                            background: url(/ultimate/revert.png);
                            height: 100px;
                            width: 100%;
                            display: block;
                            position: relative;
                            top: 8px;
                            background-position: center;
                            background-repeat: no-repeat;}
                      }
@media screen and (max-width: 600px) {
    .game-mode {
        width: 291px;
    }
}