* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-primary: #195e08;
    --bg-secondary: #5e0202;
    --text-primary: #ecf0f1;
    --text-secondary: #bdc3c7;
    --cell-hidden: #95a5a6;
    --cell-revealed: #ecf0f1;
    --cell-mine: #521c16;
    --cell-flag:  #184b16;;
    --cell-qr-black: #000000;
    --cell-qr-white: #ffffff;
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;

}

.container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    height:100%;
    position: absolute;
}

/* Header */
header {
    text-align: center;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 10px;
    box-shadow: 0 4px 6px var(--shadow);
}

header h1 {
    font-size: 24px;
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 18px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.difficulty-stat {
    color: #f39c12;
    font-weight: bold;
}

.icon {
    font-size: 20px;
}

/* Game Board */
main {
    position: relative;
    padding: 20px;
  //  background: var(--bg-secondary);
    border-radius: 10px;
    box-shadow: 0 4px 6px var(--shadow);
    overflow: visible;
    max-height: 70vh;
    touch-action: none;
    overflow:hidden;
}

.game-board {
    display: grid;
    gap: 1px;
 //   background: var(--bg-primary);
    padding: 5px;
    border-radius: 5px;
    aspect-ratio: 1;
  //  width: 100%;
 //   transition: gap 3s ease, padding 3s ease;
    transform-origin: center center;
    will-change: transform;
}

/* QR reveal animace - skryje čáry mezi poli a přidá bílý okraj */
.game-board.qr-reveal {
    gap: 0px;
 
    background: white;
 
}

.game-board.qr-reveal2 {
    transition: all 3s ease;
    transform: translate(0px, 0px) scale(1) !important;
}
main.qr-reveal {
    background-color: white;
}
/* Skryje ikony (miny, vlajky) a čísla při QR reveal */
.game-board.qr-reveal .cell {
    transition: all 3s ease;
}

.game-board.qr-reveal .cell::before {
    content: '';
    transition: opacity 3s ease;
}

.cell {
    background: var(--cell-hidden);
    border: none;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
  //  width:13px;
  //  height:13px;
}

/* Skrytí textu při QR reveal */
.game-board.qr-reveal .cell {
    font-size: 0;
    border-radius: 0;
    transition: font-size 3s ease, border-radius 3s ease, color 3s ease;
}

.game-board.qr-reveal .cell::after {
    content: attr(data-content);
    font-size: 0;
    transition: font-size 3s ease;
}

.cell.hidden {
    background: var(--cell-hidden);
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.cell.revealed {
    background: var(--cell-revealed);
    color: var(--bg-primary);
    cursor: default;
}

.cell.black-cell {
    background: #000000;
    color: #FFD700;
    font-weight: bold;
    cursor: default;
}

.cell.flagged {
    background: var(--cell-flag);
}

.cell.mine {
    font-size: 20px;
}

.cell.qr-black {
    background: var(--cell-qr-black);
}

.cell.qr-white {
    background: var(--cell-qr-white);
}

/* Number colors */
.cell[data-count="1"] { color: #3498db; }
.cell[data-count="2"] { color: #2ecc71; }
.cell[data-count="3"] { color: #e74c3c; }
.cell[data-count="4"] { color: #9b59b6; }
.cell[data-count="5"] { color: #e67e22; }
.cell[data-count="6"] { color: #1abc9c; }
.cell[data-count="7"] { color: #34495e; }
.cell[data-count="8"] { color: #7f8c8d; }

/* Messages */
.lose-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

.lose-message.hidden {
    display: none;
}

.lose-content h2 {
    font-size: 32px;
    margin-bottom: 10px;
}

.lose-content p {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

/* Footer */
footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
}

.footer-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.btn {
    flex: 1 !important;
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px var(--shadow);
}

.btn-primary {
    background: #2ecc71;
    color: white;
}

.btn-primary:hover {
    background: #27ae60;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #4a5f7f;
}

#zoomInBtn,
#zoomOutBtn {
    flex: 0 0 60px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 400px) {
    header h1 {
        font-size: 20px;
    }
    
    .stats {
        font-size: 16px;
    }
    
    .cell {
        font-size: 12px;
    }
}

/* PWA Install prompt */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    padding: 15px 25px;
    border-radius: 25px;
    box-shadow: 0 4px 12px var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

.install-prompt.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}
