body{
    font-family:'Arial',sans-serif;
    text-align:center;
    background-color:#70c5ce;
    margin:0;
    padding:0;
    transition:background-color 0.5s ease;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    min-height:100vh;
}

.game-container{
    position:relative;
    display: inline-block;
}
#board{
    background-color:transparent;
    box-shadow:0 0 20px rgba(0,0,0,0.5);

    display: block;
}

.lobby-stats{
    position:absolute;
    top:10px;
    left:10px;
    background-color: rgba(0,0,0,0.7);
    padding: 8px 12px;
    border-radius:10px;
    z-index:995;
    display:flex;
    flex-direction:column;
    gap:5px;
    border:2px solid rgba(255,255,255,0.3);
}

.stat-item{
    color:white;
    font-size:16px;
    font-weight:bold;
    text-align:left;
}

.top-right-buttons{
    position:absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction:column;
    gap: 10px;
    z-index: 995;
}

.icon-button{
    background-color: rgba(0,0,0,0.7);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:24px;
    cursor:pointer;
    border: 2px solid rgba(255,255,255,0.3);
    transition: all 0.3s ease;
}

.icon-button:hover{
    background-color: rgba(0,0,0,0.9);
    transform:scale(1.1);
}

#settingsPopup,
#historyPopup,
#soundPopup{
    display:none;
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:100%;
    background-color:rgba(0,0,0,0.8);
    z-index:2000;
    justify-content:center;
    align-items:center;
}

.settings-content,
.history-content,
.sound-content{
    position: absolute;
    top: 50%;
    left: 50%;
    transform:translate(-50%,-50%);
    background:linear-gradient(135deg,#657de9 0%,#764ba2 100%);
    padding: 30px;
    border-radius:20px;
    box-shadow:0 0 50px rgba(0,0,0,0.9);
    border:3px solid #fff;
    min-width:400px;
    max-height:80vh;
    overflow-y:auto;
}

.settings-content h2,
.history-content h2,
.sound-content h2{
    color:white;
    margin:0 0 25px 0;
    font-size:36px;
    text-shadow:3px 3px 6px rgba(0,0,0,0.5);
}

.settings-section{
    margin-bottom:15px;
}

.settings-section h3{
    color: white;
    font-size:22px;
    margin-bottom:15px;
    text-shadow:2px 2px 4px rgba(0,0,0,0.5);
}

.theme-options,
.difficulty-options{
    display:flex;
    gap:15px;
    justify-content:center;
}

.theme-option-btn{
    padding:15px 20px;
    font-size:18px;
    font-weight:bold;
    border:3px solid transparent;
    border-radius: 12px;
    cursor:pointer;
    transition: all 0.3s ease;
    background:white;
    color: #333;
    min-width:120px;
}

.theme-option-btn.active{
    border-color:#FFD700;
    box-shadow:0 0 15px rgba(255,0,0,1);
    transform:scale(1.05); 
}

.theme-option-btn:hover{
    border-color:#FFD700;
    box-shadow:0 0 15px rgba(255,215,0,0.6);
    transform:scale(1.05);
}

.theme-icon{
    font-size:32px;
    margin-bottom:5px;
}

.difficulty-option-btn{
    padding:12px 25px;
    font-size:16px;
    font-weight:bold;
    border:3px solid transparent;
    border-radius:10px;
    cursor:pointer;
    transition: all 0.3s ease;
    background:white;
    color:#333;
    min-width:100px;

}

.difficulty-option-btn.active{
    border-color:#FFD700;
    box-shadow:0 0 15px rgba(255,0,0,1);
    transform:scale(1.05);
}

.difficulty-option-btn:hover{
    border-color:#FFD700;
    box-shadow:0 0 15px rgba(255,215,0,0.6);
    transform:scale(1.05);
}

.data-buttons{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.data-btn{
    padding:12px 20px;
    font-size:16px;
    font-weight:bold;
    border:none;
    border-radius:10px;
    cursor:pointer;
    transition:all 0.3s ease;
    color:white;
}

.clear-history-btn{
    background-color:#ff9800;
}

.reset-all-btn{
    background-color:#f44336
}

.clear-history-btn:hover{
    background-color: #e68900;
    transform:scale(1.02);
}

.reset-all-btn:hover{
    background-color:#d32f2f;
    transform:scale(1.02);
}

#closeSettingsBtn,
#closeHistoryBtn{
    padding: 12px 40px;
    font-size:20px;
    background-color: #4CAF50;
    color:white;
    border:none;
    border-radius:10px;
    cursor:pointer;
    font-weight:bold;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition:all 0.3s ease;
    width:100%;
}
#closeHistoryBtn{
    margin-top:20px;
}

#closeSettingsBtn:hover,
#closeHistoryBtn:hover{
    background-color:#45a049;
    transform:scale(1.05);
}

.history-list{
    background-color:rgba(255,255,255,0.95);
    border-radius:10px;
    padding:15px;
    max-height:400px;
    overflow-y:auto;
}

.history-item{
    background-color:rgba(102,126,234,0.1);
    border-left:4px solid #667eea;
    padding:12px;
    margin-bottom:10px;
    border-radius:5px;
    text-align:left;
}

.history-header{
    display:flex;
    justify-content: space-between;
    align-items:center;
    margin-top:8px;
}

.history-left-info{
    display:flex;
    flex-direction:column;
    gap:5px;
}

.history-meta{
    font-size:14px;
    color:#333;
}

.history-right-info{
    display:flex;
    flex-direction:column;
    gap: 5px;
    /* align-items:center; */
}

.history-item:last-child{
    margin-bottom:0;
}

.history-date{
    font-size:12px;
    color:#666;
    margin-bottom:5px;
}

.history-stats{
    display:flex;
    justify-content:space-between;
    font-size:16px;
    font-weight:bold;
    color:#333;
}

.history-score{
    color:#ff9800;
}

.history-coins{
    color:#FFD700;
}

.no-history{
    text-align:center;
    color:#999;
    font-size:18px;
    padding:20px;
}

.sound-content{
    background:linear-gradient(135deg,#11998e 0%,#38ef7d 100%);
}

.sound-options{
    display:flex;
    flex-direction:column;
    gap:20px;
    background:rgba(255,255,255,0.15);
    padding: 20px;
    border-radius:15px;
    margin-bottom:20px;
}

.sound-toggle{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:15px;
    background:rgba(255 ,255,255,0.1);
    border-radius:10px;
    transition: background-color 0.3s ease;
}

.sound-toggle:hover{
    background:rgba(255,255,255,0.2);
}

.sound-label{
    color:white;
    font-size:18px;
    font-weight:bold;
    text-shadow:1px 1px 2px rgba(0,0,0,0.3);
}

.toggle-switch{
    position:relative;
    display:inline-block;
    width:60px;
    height:30px;
}

.toggle-switch input{
    opacity:0;
    width:0;
    height:0;
}

.toggle-slider{
    position:absolute;
    cursor:pointer;
    top:0;
    left:0;
    right:0;
    bottom:0;
    background-color:#ccc;
    transition: 0.4s;
    border-radius:30px;
}

.toggle-slider:before{
    position:absolute;
    content:"";
    height:22px;
    width: 22px;
    left:4px;
    bottom:4px;
    background-color:white;
    transition: 0.4s;
    border-radius:50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

input:checked+.toggle-slider{
    background-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76,175,80,0.5);
}

input:checked+.toggle-slider:before{
    transform: translateX(30px);
}

.volume-control{
    display:flex;
    flex-direction:column;
    gap:10px;
    padding: 15px;
    background:rgba(255,255,255,0.1);
    border-radius:10px;
    transition:background-color 0.3s ease;
}

.volume-control:hover{
    background-color: rgba(255,255,255,0.2);
}

.volume-row{
    display:flex;
    align-items:center;
    gap:15px;
}

.volume-slider{
    -webkit-appearance:none;
    appearance:none;
    flex:1;
    height: 10px;
    border-radius:5px;
    background:linear-gradient(to right,#ddd,#fff);
    outline:none;
    cursor:pointer;
}

.volume-slider::-webkit-slider-thumb{
    -webkit-appearance:none;
    appearance:none;
    width:24px;
    height: 24px;
    border-radius: 50%;
    background:linear-gradient(135deg,#667eea,#764ba2);
    cursor:pointer;
    transition:transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.volume-slider::-webkit-slider-thumb:hover{
    transform:scale(1.2);
}

.volume-slider::-moz-range-thumb{
    width:24px;
    height:24px;
    border-radius:50%;
    background:linear-gradient(135deg,#667eea,#764ba2);
    cursor:pointer;
    border:none;
    box-shadow:0 2px 8px rgba(0,0,0,0.3);
}

#musicVolumeValue,
#sfxVolumeValue{
    color:white;
    font-size: 16px;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
    background-color: rgba(0,0,0,0.3);
    padding:5px 10px;
    border-radius:5px;
}

#closeSoundBtn{
    padding: 12px 40px;
    font-size: 20px;
    background-color :#2196F3;
    color:white;
    border:none;
    border-radius:10px;
    cursor:pointer;
    font-weight: bold;
    box-shadow:0 5px 15px rgba(0,0,0,0.3);
    transition:all 0.3s ease;
    width:100%;
}

#closeSoundBtn:hover{
    background-color: #1976D2;
    transform:scale(1.05);
}

#heading{
    display:inline-block;
    position: absolute;
    font-style:italic ;
    font-family: cursive;
    font-weight: bold;
    top: 25%;
    /* left: 45%; */
    font-size: 3.5em;
    color: hsl(0, 87%, 51%);
    -webkit-text-stroke: 1px gold;
    /* max-width: 200px;
    text-align: left; */
    /* z-index: 10001; */
}

#startBtn{
    display:block;
    position:fixed;
    top:75%;
    left:50%;
    transform:translate(-50%,-50%);
    padding:20px 50px;
    font-size:28px;
    background-color:#4CAF50;
    color:white;
    border:none;
    border-radius:10px;
    cursor:pointer;
    font-weight:bold;
    box-shadow:0 5px 15px rgba(0,0,0,0.3);
    z-index:1000;
}

#startBtn:hover{
    background-color:#45a049;
    transform:translate(-50%,-50%) scale(1.05);
}

#instructions{
    display:none;
    position:fixed;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    font-size:32px;
    color:white;
    font-weight:bold;
    text-shadow:3px 3px 6px rgba(0,0,0,0.7);
    animation: blink 1s infinite;
    z-index:999;
    background-color:rgba(0,0,0,0.5);
    padding:30px 50px;
    border-radius:15px;
}

@keyframes blink{
    0%, 50%, 100% {opacity:1;}
    25%, 75% {opacity:0.5;}
}

#gameOverPopup{
    display:none;
    position:fixed;
    top:50%;
    left:50%;
    transform:translate(-50%,-50%);
    background-color:white;
    padding:40px 60px;
    border-radius:15px;
    box-shadow:0 0 30px rgba(0,0,0,0.7);
    z-index:1000;
    min-width: 350px;
}

#gameOverPopup h1{
    color:#ff4444;
    margin:0 0 20px 0;
    font-size:36px;
}

.game-over-stats{
    margin:20px 0px;
}

#game-over-stats p{
    font-size:20px;
    margin:12px 0;
    color: #333;
}

#highScoreMessage{
    display: none;
    color: #FFD700;
    font-size:28px;
    font-weight: bold;
    margin:15px 0;
    animation: pulse 1s infinite;
    text-shadow: 2px 2px 4px rgba(255, 0, 0, 0.3);
}

@keyframes pulse{
    0%, 100%{transform: scale(1);}
    50%{transform: scale(1.1);}
}

.game-over-buttons{
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

#restartBtn,
#backToLobbyBtn{ 
    padding:15px 30px;
    font-size:18px;
    color:white;
    border:none;
    border-radius:8px;
    cursor:pointer;
    font-weight:bold;
    transition: all 0.3s ease;
}

#restartBtn{
    background-color:#ff9800;
}

#restartBtn:hover{
    background-color:#e68900;
    transform:scale(1.05);
}

#backToLobbyBtn{
    background-color:#2196F3;
}

#backToLobbyBtn:hover{
    background-color:#0b7dda;
    transform:scale(1.05);
}

.hint{
    font-size: 14px;
    color: #666;
    margin-top: 10px;
}


.powerup-legend{
    display: block;
    position:fixed;
    top:20px;
    right:20px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px;
    border-radius: 10px;
    font-size:14px;
    max-width:220px;
    z-index:997;
    border: 2px solid rgba(255,255,255,0.2);
}

.powerup-legend h3{
    margin:0 0 10px 0;
    color: #FFD700;
    font-size: 20px;
    text-align: center;
    text-shadow: 0 0 10px #FFD700;
}

.powerup-legend p{
    margin: 8px 0;
    font-size:13px;
    line-height:1.4;
    padding: 8px;
    background-color: rgba(255,255,255,0.1);
    border-radius:5px;
}

.history-list::-webkit-scrollbar,
.settings-content::-webkit-scrollbar,
.sound-content::-webkit-scrollbar{
    width: 8px;
}

.history-list::-webkit-scrollbar-track,
.settings-content::-webkit-scrollbar-track,
.sound-content::-webkit-scrollbar-track{
    background:rgba(0,0,0,0.1);
    border-radius:10px;
}

.history-list::-webkit-scrollbar-thumb{
    background: #667eea;
    border-radius: 10px;
}

.settings-content::-webkit-scrollbar-thumb,
.sound-content::-webkit-scrollbar-thumb{
    background:rgba(255,255,255,0.5);
    border-radius:10px;
}

.history-list::-webkit-scrollbar-thumb:hover{
    background:#764ba2;
}

.settings-content::-webkit-scrollbar-thumb:hover,
.sound-content::-webkit-scrollbar-thumb:hover{
    background:rgba(255,255,255,0.7);
}

@media(max-width:768px){

    html, body{
        height:100%;
        overflow:hidden;
        overscroll-behavior:none;
        margin:0;
        padding:0;
    }

    body{
        min-height:100dvh;
        justify-content:center;
        align-items:center;
    }
    .game-container{
        width:100vw;
        height:100dvh;
        max-width:100vw;
        max-height:100dvh;
    }

    #board{
        width:100%;
        height:100%;
        touch-action: manipulation;
    }

    .lobby-stats{
        top:8px;
        left:8px;
        padding:6px 10px;
        max-width:calc(100% - 16px);
        box-sizing:border-box;
    }

    .stat-item{
        font-size:13px;
    }

    .top-right-buttons{
        top:8px;
        right:8px;
        gap:8px;
    }

    .icon-button{
        width:40px;
        height:40px;
        font-size:22px;
    }

    .powerup-legend{
        display:none !important;
    }

    .settings-content,
    .history-content,
    .sound-content{
        min-width:0;
        width:calc(100vw - 28px);
        max-width:420px;

        max-height:calc(100dvh - 28px);
        box-sizing:border-box;

        padding:14px 12px;
        border-radius:16px;

        display:flex;
        flex-direction:column;
        gap:10px;

        overflow:hidden;
    }

    .settings-content h2,
    .history-content h2,
    .sound-content h2{
        font-size:20px;
        margin:0 0 8px 0;
    }

    .settings-section{
        margin-bottom:8px;
    }

    .settings-section h3{
        font-size:16px;
        margin-bottom:8px;
    }

    .theme-option-btn{
        font-size:14px;
        padding:10px 12px;
        min-width:0;
        flex:1 1 45%;
    }

    .theme-icon{
        font-size:26px;
        margin-bottom:4px;
    }

    .difficulty-option-btn{
        font-size:14px;
        padding:10px 12px;
        min-width:0;
        flex: 1 1 30%;
    }

    .theme-option,
    .difficulty-options{
        flex-wrap:wrap;
        gap:8px;
    }

    .data-btn{
        font-size:14px;
        padding:10px 12px;
    }

    .history-list{
        flex: 1 1 auto;
        min-height: 120px;
        max-height: none;
        overflow-y:auto;
        -webkit-overflow-scrolling: touch;
    }

    .sound-options{
        gap:12px;
        padding:12px;
        margin-bottom:10px;
    }

    .sound-toggle{
        padding:12px;
        gap:10px;
    }

    .sound-label{
        font-size:15px;
    }

    .volume-control{
        gap:12px;
        padding:12px;
    }

    .volume-row{
        gap:10px;
    }

    #musicVolumeValue,
    #sfxVolumeValue{
        font-size:14px;
        min-width:44px;
        padding:4px 8px;
    }

    #closeSettingsBtn,
    #closeHistoryBtn,
    #closeSoundBtn{
        width:100%;
        font-size:16px;
        padding:10px 14px;
        box-sizing:border-box;
        margin-top:0;
    }

    #gameOverPopup{
        min-width:0;
        width:calc(100vw - 28px);
        max-width:420px;
        padding:18px 14px;
        box-sizing:border-box;
    }

    #gameOverPopup h1{
        font-size:26px;
    }

    .game-over-buttons{
        flex-wrap:wrap;
        gap:10px;
    }

    #startBtn{
        font-size:20px;
        padding:14px 28px;
    }

    #instructions{
        font-size:20px;
        padding:16px 18px;
    }

}