:root {
       --sat: env(safe-area-inset-bottom, 0px);
    }
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
@font-face {
    font-family: 'zabras';
    src: url('fonts/zabars.ttf') format('truetype'); 
    font-weight: normal;
    font-style: normal;
}
html, body {
    margin: 0;
    overflow: hidden;
    background: #000;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: url('img/bg/bg2.webp') center/cover no-repeat;
    padding-bottom: var(--sat);
}
.main-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}
.canvas-wrapper {
    position: relative;
    width: 720px;
    height: 480px;
    margin: auto;
    text-align: center;
}
canvas {
    display: block;
    background-image: url('img/polo-loco.png');
    background-position: center;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.control-buttons {
    position: absolute;
    top: -15px;
    right: -22px;
    transform: translateX(67%);
    display: flex;
    gap: 10px;
    z-index: 100;
}
.control-buttons button {
    width: 80px; 
    height: 40px; 
    background: url('img/bg/wood-texture.jpg') center/cover no-repeat;
    border: 3px solid #8b5a2b; /* Brown border (wood color) */
    border-radius: 8px; /* Slight rounded corners — looks carved */
    color: #fffbe6; /* Off-white text to match wood */
    font-family: 'Comic Sans MS', 'Patrick Hand', 'Baloo', sans-serif;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 2px 4px 6px rgba(0, 0, 0, 0.5); 
    transition: all 0.2s ease;
}
.control-buttons button:hover {
    transform: scale(1.05);
    box-shadow: 3px 6px 8px rgba(0, 0, 0, 0.6);
}
.menu-buttons {
    position: fixed;
    top: 50%;           
    left: 50%;          
    transform: translate(-50%, -50%); 
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 90;
    text-align: center;
}
.menu-buttons button {
    padding: 16px 40px; 
    background: url('img/bg/wood-texture.jpg') center/cover no-repeat; 
    color: #fffbe6; /* Slightly off-white text */
    border: 3px solid #8b5a2b; /* Dark brown border */
    border-radius: 12px; /* Slight rounded edges */
    font-size: 28px;
    font-weight: bold;
    font-family: 'Comic Sans MS', 'Patrick Hand', 'Baloo', sans-serif; 
    cursor: pointer;
    min-width: 220px;
    box-shadow: 3px 6px 12px rgba(0, 0, 0, 0.5); 
    transition: all 0.3s ease;
}
.menu-buttons button:hover {
    transform: scale(1.05);
    box-shadow: 4px 8px 14px rgba(0, 0, 0, 0.6);
}
#start-btn, #info-btn {
    display: block; 
    font-family: 'zabras', Arial, sans-serif;
}
.popup {
    display: none; 
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    color: white;
    z-index: 1000;
    width: 80%; /* Responsive width */
    max-width: 400px; /* Ensures a max size */
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
    overflow: hidden;
}
canvas.paused {
    pointer-events: none;
}
.popup-content {
    font-family: 'zabras', Arial, sans-serif;
    font-size: 44px;
    padding: 20px;
    border-radius: 10px;
    color: white;
    overflow: hidden; 
}
.popup-content h2 {
    font-size: 36px;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
}
.popup-content p {
    font-size: 24px;
    margin-bottom: 20px;
}
.popup-content button {
    border: none;
    padding: 12px 25px;
    font-size: 20px;
    cursor: pointer;
    margin: 10px;
    border-radius: 5px;
    font-family: 'zabras', Arial, Helvetica, sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease, background 0.3s ease;
}
#restartWinButton {
    background: #4CAF50; 
    color: white;
}
#restartWinButton:hover {
    background: #45a049; 
    transform: scale(1.05);
}
/* Main Menu Button (Red) */
#mainMenuButton {
    background: #f44336; 
    color: white;
}
#mainMenuButton:hover {
    background: #d32f2f; 
    transform: scale(1.05);
}
#pausePopup {
    display: none; 
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    color: white;
    z-index: 1000;
    width: 80%;
    max-width: 400px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    overflow: hidden; 
}
#pausePopup h2 {
    font-size: 34px;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 15px;
}
#pausePopup p {
    font-size: 22px;
    margin-bottom: 20px;
} 
#continueGame {
    background: #28a745; 
    color: white;
}
#continueGame:hover {
    background: #218838;
    transform: scale(1.05);
}
#exitToHome {
    background: #dc3545; /* Red */
    color: white;
}
#exitToHome:hover {
    background: #c82333;
    transform: scale(1.05);
}
footer{
    margin-bottom: 16px;
}
footer a{
    font-size: 24px;
    font-family: 'zabras', Arial, sans-serif;
    color: #fff;
}
#mobile-controls {/* === MOBILE CONTROLS === */
    display: none !important;
    position: fixed;
    width: 100%;
    height: auto;
    z-index: 10000;
    pointer-events: none;
    justify-content: space-between;
    padding: 1vh 2vw;
    box-sizing: border-box;
}
#left-controls,
#right-controls {
    display: flex;
    flex-direction: column;
    gap: 2vh;
    pointer-events: auto;
}
#left-controls {
    left: 2vw;
    bottom: -44vh;
    position: absolute;
}
#right-controls {
    right: 2vw;
    bottom: -44vh;
    position: absolute;
}
.control-btn {
    min-width: 60px;
    min-height: 60px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    opacity: 0.9;
    transition: transform 0.1s ease, opacity 0.1s ease;
    touch-action: manipulation;
    user-select: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}
.control-btn:active {
    transform: scale(0.95);
    opacity: 1;
}
.mobile-botle-throw{
    width: 60px;
}
.landscape-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    justify-content: center;
    align-items: center;
    font-size: clamp(16px, 4vw, 24px);
    font-family: 'zabras', Arial, sans-serif;
    text-align: center;
    z-index: 2000;
    padding: 20px;
    line-height: 1.5;
}
body.landscape-warning-active .main-container,
body.landscape-warning-active #mobile-controls {
    display: none !important;
}
/* === MEDIA QUERIES === */
@media (max-width: 1371px) and (orientation: landscape){
    #mobile-controls {
        display: flex !important;
    }
    .control-btn {
        min-width: 100px;
        min-height: 100px;
    }
    #left-controls,
    #right-controls {
        bottom: -48vh;
    }
}
@media (max-width: 1025px) and (orientation: landscape) {
    #mobile-controls {
        display: flex !important;
    }
    .control-btn {
        min-width: 80px;
        min-height: 80px;
    }
    .control-buttons {
        position: absolute;
        top: 46px !important;
        right: 136px !important;
    }
    .control-buttons button {
        width: 54px;
        height: 30px;
    }
    .menu-buttons button{
        min-width: 140px;
        font-size: 24px;
    }
}
@media (max-width: 900px) and (orientation: landscape) {
    .control-buttons {
        position: absolute;
        top: 51px !important;
        right: 172px !important;
    }
    .control-buttons button {
        width: 48px;
        height: 30px;
    }
    .menu-buttons button{
        min-width: 140px;
        font-size: 24px;
    }
}
@media (max-width: 721px) and (orientation: landscape) {
    .popup {
        width: 90%;
        max-width: 350px;
    }
    .popup-content h2 {
        font-size: 28px;
    }
    .popup-content p {
        font-size: 20px;
    }
    .popup-content button {
        font-size: 18px;
        padding: 10px 20px;
    }
    #left-controls,
    #right-controls {
        bottom: -44vh;
    }
    .control-btn {
        min-width: 50px !important;
        min-height: 50px !important;
    }
    .mobile-botle-throw{
        width: 40px !important;
    }
    .control-buttons {
        position: absolute;
        top: 52px !important;
        right: 140px !important;
    }
    .control-buttons button {
        width: 44px;
        height: 28px;
    }
    .menu-buttons button{
        min-width: 120px;
        font-size: 14px;
    }
}
@media (max-width: 480px) {
    html,
    body {
        height: 100dvh;
        width: 100vw;
        overflow: hidden;
    }
    .popup {
        width: 100%;
    }
    .popup-content h2 {
        font-size: 24px;
    }
    .popup-content p {
        font-size: 18px;
    }
    .popup-content button {
        font-size: 16px;
        padding: 8px 15px;
    }
    #mobile-controls button {
        padding: 10px 20px;
        font-size: 16px;
    }
}
@media (orientation: portrait) and (max-width: 1025px) {
    .landscape-warning {
        display: flex;
    }
    #mobile-controls {
        display: none !important;
    }
}