* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #0d0d0d;
    overflow: hidden; /* Вимикаємо скролінг сторінки */
    touch-action: none; /* Вимикаємо системні жести (зум, оновлення свайпом) */
    font-family: sans-serif;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center; /* Розміщуємо гру по центру */
}

canvas {
    /* Робимо піксель-арт чітким (без розмиття) при масштабуванні */
    image-rendering: pixelated; 
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
}

/* Стилі для наекранного джойстика */
#dpad {
    position: absolute;
    bottom: 40px; /* Відступ знизу екрана */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 10; /* Джойстик має бути поверх Canvas */
}

.dpad-middle {
    display: flex;
    gap: 75px; /* Простір між кнопками "Вліво" та "Вправо" */
}

.dpad-btn {
    width: 65px;
    height: 65px;
    background-color: rgba(255, 255, 255, 0.2); /* Напівпрозорий білий */
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    color: white;
    font-size: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none; /* Текст не виділяється */
    outline: none;
    -webkit-tap-highlight-color: transparent; /* Вимикаємо стандартну синю підсвітку кнопок на мобільних */
    transition: background-color 0.1s;
}

.dpad-btn:active {
    background-color: rgba(255, 255, 255, 0.6); /* Яскравіше при натисканні */
}

#orientation-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #0d0d0d;
    color: #fff;
    z-index: 99999;
    text-align: center;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    font-size: 24px;
    font-weight: bold;
}
@media screen and (max-width: 900px) and (orientation: portrait) {
    #orientation-overlay {
        display: flex;
    }
}
