/* Základní styly */
body {
    margin: 0;
    padding: 10px;
    background: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

.container {
    text-align: center;
    width: 100%;
    max-width: 100%;
}

canvas {
    border: 2px solid #444;
    box-shadow: 0 0 20px rgba(0, 255, 100, 0.3);
    background: #0a0a0a;
    max-width: 100%;
    height: auto;
}

.stats {
    color: #0f9;
    margin-top: 10px;
    font-size: 14px;
    text-shadow: 0 0 5px rgba(0, 255, 100, 0.5);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.stat-item {
    background: rgba(0, 255, 100, 0.1);
    padding: 8px;
    border-radius: 5px;
    border: 1px solid rgba(0, 255, 100, 0.3);
}

.controls {
    margin-top: 15px;
}

button {
    background: #0f9;
    border: none;
    color: #000;
    padding: 10px 20px;
    margin: 0 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    border-radius: 5px;
    touch-action: manipulation; /* Zlepší dotykové ovládání */
}

button:hover,
button:active {
    background: #0fa;
    box-shadow: 0 0 10px rgba(0, 255, 100, 0.5);
}

.game-status {
    color: #0f9;
    margin-top: 10px;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 255, 100, 0.8);
    min-height: 25px;
}

.victory { color: #4f4; }
.defeat { color: #f44; }

.instructions {
    color: #888;
    font-size: 12px;
    margin-top: 10px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Responzivní design pro mobilní zařízení */
@media screen and (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .stats {
        font-size: 12px;
        gap: 8px;
        grid-template-columns: repeat(3, 1fr); /* Méně sloupců na menších obrazovkách */
    }
    
    .stat-item {
        padding: 6px;
        text-align: center;
    }
    
    button {
        padding: 12px 16px; /* Větší tlačítka pro lepší dotykové ovládání */
        margin: 2px;
        font-size: 14px;
    }
    
    .game-status {
        font-size: 16px;
    }
    
    .instructions {
        font-size: 11px;
        padding: 0 10px;
    }
}



/* Pro landscapový režim na mobilech */
@media screen and (max-height: 500px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding-top: 10px;
    }
    
    .container {
        margin-top: 0;
    }
    
    .stats {
        margin-top: 5px;
        grid-template-columns: repeat(5, 1fr);
        gap: 5px;
    }
    
    .controls {
        margin-top: 8px;
    }
    
    .game-status {
        margin-top: 5px;
        font-size: 14px;
    }
}

  /* Mobilní ovládání - zobrazí se jen na malých obrazovkách */
.mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    z-index: 1000;
    pointer-events: none; /* Umožní klikání skrz kontejner */
}


/* D-pad vlevo */
.dpad {
    position: absolute;
    left: 20px;
    bottom: 0;
    width: 220px;
    height: 120px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 100, 0.5);
    pointer-events: auto; /* Povolí interakci s D-padem */
}

.dpad-button {
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(0, 255, 100, 0.2);
    border: 1px solid rgba(0, 255, 100, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f9;
    font-weight: bold;
    user-select: none;
    touch-action: manipulation;
    cursor: pointer;
    transition: all 0.1s;
    font-size: 18px;
}

.dpad-button:active {
    background: rgba(0, 255, 100, 0.4);
    transform: scale(0.95);
}

.dpad-up {
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-down {
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.dpad-left {
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.dpad-right {
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

/* Akční tlačítka vpravo */
.action-buttons {
    position: absolute;
    right: 20px;
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    pointer-events: auto; /* Povolí interakci s tlačítky */
}

.action-button {
    width: 60px;
    height: 60px;
    background: rgba(255, 100, 0, 0.2);
    border: 2px solid rgba(255, 100, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f90;
    font-weight: bold;
    font-size: 16px;
    user-select: none;
    touch-action: manipulation;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 2px 8px rgba(255, 100, 0, 0.3);
}

.action-button:active {
    background: rgba(255, 100, 0, 0.4);
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(255, 100, 0, 0.5);
}

/* Různé barvy tlačítek */
.action-button.primary {
    background: rgba(0, 150, 255, 0.2);
    border-color: rgba(0, 150, 255, 0.5);
    color: #09f;
    box-shadow: 0 2px 8px rgba(0, 150, 255, 0.3);
}

.action-button.primary:active {
    background: rgba(0, 150, 255, 0.4);
    box-shadow: 0 1px 4px rgba(0, 150, 255, 0.5);
}

.action-button.secondary {
    background: rgba(255, 0, 150, 0.2);
    border-color: rgba(255, 0, 150, 0.5);
    color: #f09;
    box-shadow: 0 2px 8px rgba(255, 0, 150, 0.3);
}

.action-button.secondary:active {
    background: rgba(255, 0, 150, 0.4);
    box-shadow: 0 1px 4px rgba(255, 0, 150, 0.5);
}

        /* Alternativní styl - čtyři samostatná tlačítka */
        .button-controls {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            grid-template-rows: 1fr 1fr 1fr;
            gap: 5px;
            width: 150px;
            height: 150px;
        }

        .control-btn {
            background: rgba(0, 255, 100, 0.2);
            border: 1px solid rgba(0, 255, 100, 0.5);
            border-radius: 8px;
            color: #0f9;
            font-weight: bold;
            font-size: 18px;
            user-select: none;
            touch-action: manipulation;
            cursor: pointer;
            transition: all 0.1s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .control-btn:active {
            background: rgba(0, 255, 100, 0.4);
            transform: scale(0.95);
        }

        .btn-up { grid-column: 2; grid-row: 1; }
        .btn-left { grid-column: 1; grid-row: 2; }
        .btn-right { grid-column: 3; grid-row: 2; }
        .btn-down { grid-column: 2; grid-row: 3; }

/* Pro velmi malé telefony */
@media screen and (max-width: 480px) {
    .stats {
        grid-template-columns: repeat(2, 1fr); /* Jen 2 sloupce na velmi malých obrazovkách */
        gap: 5px;
        font-size: 11px;
    }
    
    .stat-item {
        padding: 4px;
    }
    
    button {
        padding: 10px 12px;
        font-size: 13px;
        margin: 1px;
    }
    
    .dpad {
        left: 15px;
    }
    
    .action-buttons {
        right: 15px;
    }

    .controls {
        margin-top: 10px;
    }
    
    .game-status {
        font-size: 14px;
    }
    
    .instructions {
        font-size: 10px;
    }

        .mobile-controls {
        display: block;
    }
}

/* Pro celou stránku na mobilních zařízeních */
@media screen and (max-width: 768px) {
    * {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        
        -webkit-touch-callout: none; /* iOS - zakáže kontextové menu */
        -webkit-tap-highlight-color: transparent; /* Odstraní modré zvýraznění na dotek */
    }
    
    /* Povolíme označování jen u vstupních polí */
    input, textarea, [contenteditable="true"] {
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
        
        -webkit-touch-callout: default;
    }
}