* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: url('images/Background.png') no-repeat center center fixed;
    background-size: cover;
    background-attachment: fixed;
    background-color: #000;
    color: white;
    text-align: center;
    padding: 10px;
    overflow-x: hidden;
}
h1 {
    padding: 20px 15px;
    font-size: 2.5rem;
    color: #FFD700;
    text-shadow: 
        2px 2px 0px #8B4513,
        4px 4px 8px rgba(0, 0, 0, 0.8);
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.3), rgba(160, 82, 45, 0.3));
    border: 3px solid #8B4513;
    border-radius: 15px;
    margin-bottom: 15px;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

h1:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 0 30px rgba(255, 215, 0, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: auto;
    max-width: 100vw;
}

#board {
    background-color: black;
    border: 2px solid #333;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    margin: 25px 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    padding: 20px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(51, 51, 51, 0.6));
    border: 2px solid #8B4513;
    border-radius: 20px;
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.4),
        inset 0 2px 8px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.controls-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 5px 0;
}

.control-btn {
    width: 60px;
    height: 60px;
    border: 3px solid #FFD700;
    background: linear-gradient(145deg, #8B4513, #A0522D);
    color: #FFD700;
    font-size: 24px;
    font-weight: bold;
    border-radius: 15px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    margin: 0 8px;
    transition: all 0.3s ease;
    touch-action: manipulation;
    outline: none;
    display: inline-block;
    text-align: center;
    line-height: 54px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.1),
        0 0 10px rgba(255, 215, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.control-btn::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.5s;
    opacity: 0;
}

.control-btn:hover::before {
    animation: shine 0.8s ease-in-out;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); opacity: 0; }
}

.control-btn:active,
.control-btn:focus {
    background: linear-gradient(145deg, #FFD700, #FFA500);
    color: #333;
    transform: scale(0.95) translateY(2px);
    outline: none;
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.4),
        inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.control-btn:hover {
    background: linear-gradient(145deg, #A0522D, #CD853F);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.2),
        0 0 15px rgba(255, 215, 0, 0.4);
}

.center-space {
    width: 60px;
    height: 60px;
}

/* Instructions */
.instructions {
    margin-top: 25px;
    padding: 15px 25px;
    font-size: 16px;
    color: #FFD700;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7), rgba(51, 51, 51, 0.5));
    border: 2px solid #8B4513;
    border-radius: 15px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.3),
        inset 0 2px 6px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-weight: 500;
}

.instructions p {
    margin: 8px 0;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.instructions p:hover {
    color: #FFA500;
}

.instructions::before {
    content: '🎮';
    display: block;
    font-size: 24px;
    margin-bottom: 10px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

/* Media Queries for Mobile */
@media screen and (max-width: 768px) {
    body {
        padding: 5px;
        /* Optimize background for mobile performance */
        background-attachment: scroll;
        background-size: cover;
    }
    
    h1 {
        font-size: 2rem;
        padding: 15px 10px;
        margin-bottom: 10px;
    }
    
    .game-container {
        height: auto;
        justify-content: flex-start;
        padding-top: 10px;
    }
    
    #board {
        max-width: 95vw;
        max-height: 60vh;
        width: auto;
        height: auto;
    }
    
    .mobile-controls {
        display: block !important;
        margin: 15px 5px;
        padding: 15px;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 18px;
        line-height: 44px;
        margin: 0 5px;
        border-width: 2px;
    }
    
    .center-space {
        width: 50px;
        height: 50px;
    }
    
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
    
    .instructions {
        font-size: 14px;
        margin-top: 15px;
        padding: 12px 15px;
        max-width: 95%;
    }
    
    .instructions::before {
        font-size: 20px;
        margin-bottom: 8px;
    }
}

@media screen and (max-width: 480px) {
    #board {
        max-width: 98vw;
        max-height: 50vh;
    }
    
    .control-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
        margin: 0 3px;
    }
    
    .center-space {
        width: 45px;
        height: 45px;
    }
}

/* Landscape orientation on mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .game-container {
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
    }
    
    #board {
        max-height: 80vh;
        max-width: 60vw;
    }
    
    .mobile-controls {
        margin: 0 20px;
    }
    
    .instructions {
        position: absolute;
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 10px;
    }
}

