:root {
    --rows: 6;
    --cols: 6;
}

.btn, .card {
    border-radius: 0 !important;
}

.container, .card, .btn {
    font-family: "Tabac Sans"
}

.board-container {
    --rows: 11;
    --cols: 11;
    --tile-w: 32px;
    --tile-h: 32px;
    --sheet-cols: 5;           /* kolik sloupců má tileset */
    display: grid;
    grid-template-rows: repeat(var(--rows), var(--tile-h));
    grid-template-columns: repeat(var(--cols), var(--tile-w));
    image-rendering: pixelated;  /* hezké pixely */
    justify-content: center;
    align-items: center;


    width: calc(var(--cols) * var(--tile-w));
    height: calc(var(--rows) * var(--tile-h));
    /*width: 100%;*/
    /*max-width: 500px; /* Omezí maximální šířku na desktopu */
    aspect-ratio: 1 / 1; /* Udržuje čtvercový poměr stran */
    margin: auto;
    /*border: 2px solid #000;*/
    /*border-right:none*/
  }
  
  .tile {
    width: var(--tile-w);
    height: var(--tile-h);
    background-image: url(/pub/sokoban/tileset.png);
    background-size: calc(var(--sheet-cols) * var(--tile-w)) auto; /* škálování na skutečnou šířku sheetu */
    background-repeat: no-repeat;
    /* souřadnice tile: --tx (sloupec), --ty (řádek) – nula nahoře/ vlevo */
    background-position:
      calc(var(--tx) * var(--tile-w) * -1)
      calc(var(--ty) * var(--tile-h) * -1);
    position:relative;
    overflow:hidden;
  }
  
  .tile > img.bg {
    position: absolute;
    top:  calc(var(--ty) * var(--tile-h) * -1);
    left: calc(var(--tx) * var(--tile-w) * -1);
    width: calc(var(--sheet-cols) * var(--tile-w)); /* šířka celého tilesetu v px */
    height: auto;
    image-rendering: pixelated;
    pointer-events: none; /* aby kliknutí padalo na .tile, ne na překrytý <img> */
  }


.game-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50vw;
    height: 50vh;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.game-overlay.show {
    display: flex;
}

.game-overlay h2 {
    margin-bottom: 20px;
    font-size: 2rem;
    color:#fff;
}

.game-overlay .time {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.joypad {
    width: 160px; max-width: 40vw;
}

.joypad svg { display:block; width:100%; height:auto; }
.joypad .hit { fill: transparent; cursor: pointer; }
.joypad .hit:hover, .joypad .hit:focus { fill: rgba(255,255,255,.08); outline: none; }

@media (max-width: 600px) {
    .game-overlay {
      inset: 0;          /* top:0; right:0; bottom:0; left:0; */
      width: 100vw;      /* šířka celé viewport šířky  */
      height: 100dvh;    /* 100 % výšky včetně dynamického viewportu */
      transform: none;   /* vycentrování už není potřeba */
    }
  }