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

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 50%, #FDB99B 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#gameContainer {
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border-radius: 10px;
    overflow: hidden;
}

#gameCanvas {
    display: block;
    background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 70%, #C2B280 85%, #8B7355 100%);
}

#ui {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#score {
    pointer-events: none;
}

#health {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

#armor {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 60px;
    pointer-events: none;
    font-size: 20px;
}

#settingsIcon {
    width: 40px;
    height: 40px;
    cursor: pointer;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: all 0.3s;
    pointer-events: auto;
}

#settingsIcon:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

#settingsMenu {
    position: absolute;
    top: 70px;
    right: 20px;
    background: rgba(0,0,0,0.9);
    padding: 20px;
    border-radius: 15px;
    display: none;
    min-width: 200px;
    pointer-events: auto;
}

#settingsMenu.active {
    display: block;
}

#settingsMenu h3 {
    margin: 0 0 15px 0;
    font-size: 20px;
    color: white;
}

.difficulty-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.difficulty-btn:hover {
    transform: scale(1.05);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 0 20px rgba(245, 87, 108, 0.5);
}

#gameOver {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.85);
    padding: 40px 60px;
    border-radius: 20px;
    text-align: center;
    color: white;
    display: none;
}

#gameOver h1 {
    font-size: 48px;
    margin-bottom: 20px;
    color: #ff6b6b;
}

#gameOver p {
    font-size: 24px;
    margin-bottom: 30px;
}

#restartBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 20px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
}

#restartBtn:hover {
    transform: scale(1.1);
}

/* Pause Menu */
#pauseMenu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.95);
    padding: 40px 60px;
    border-radius: 20px;
    text-align: center;
    color: white;
    display: none;
    min-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

#pauseMenu h1 {
    font-size: 48px;
    margin-bottom: 30px;
    color: #667eea;
}

.pause-stats {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.pause-stats p {
    font-size: 20px;
    margin: 10px 0;
}

.pause-controls {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.pause-controls h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #f093fb;
}

.pause-controls p {
    font-size: 16px;
    margin: 8px 0;
    color: #E0E0E0;
}

.pause-difficulty {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.pause-difficulty h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #f093fb;
}

.pause-difficulty-btns {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.pause-difficulty-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 20px;
    font-size: 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.pause-difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.pause-difficulty-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    transform: scale(1.05);
}

.pause-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
    margin: 10px 0;
}

.pause-btn:hover {
    transform: scale(1.05);
}

.pause-btn:nth-child(5) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

/* Name Input Container */
#nameInputContainer {
    margin: 20px 0;
}

#nameInputContainer input {
    width: 100%;
    padding: 12px 20px;
    font-size: 18px;
    border: 2px solid #667eea;
    border-radius: 10px;
    margin-bottom: 15px;
    background: rgba(255,255,255,0.9);
    color: #2C3E50;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#nameInputContainer input:focus {
    outline: none;
    border-color: #f093fb;
    box-shadow: 0 0 10px rgba(240, 147, 251, 0.5);
}

#submitScoreBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
    width: 100%;
}

#submitScoreBtn:hover:not(:disabled) {
    transform: scale(1.05);
}

#submitScoreBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#scoreSubmittedMsg {
    display: none;
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-radius: 10px;
    color: white;
}

#scoreSubmittedMsg p {
    margin: 5px 0;
    font-size: 18px;
}

#viewLeaderboardBtn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.2s;
    margin-top: 10px;
}

#viewLeaderboardBtn:hover {
    transform: scale(1.05);
}

/* Leaderboard Modal */
#leaderboardModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#leaderboardContent {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

#leaderboardContent h2 {
    color: white;
    font-size: 36px;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

#closeLeaderboard {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#closeLeaderboard:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

#leaderboardList {
    background: rgba(255,255,255,0.95);
    border-radius: 15px;
    padding: 20px;
    margin-top: 10px;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.leaderboard-entry:hover {
    transform: translateX(5px);
}

.leaderboard-entry .rank {
    font-weight: bold;
    color: #667eea;
    min-width: 60px;
    font-size: 18px;
}

.leaderboard-entry .player-name {
    flex: 1;
    font-size: 18px;
    color: #2C3E50;
    padding: 0 15px;
}

.leaderboard-entry .score {
    font-weight: bold;
    font-size: 20px;
    color: #f5576c;
}

#leaderboardLoading,
#leaderboardError {
    text-align: center;
    padding: 20px;
    color: white;
    font-size: 18px;
}

#leaderboardError {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.2);
    border-radius: 10px;
    margin-top: 10px;
}

/* Responsive adjustments for tablets */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    #gameContainer {
        transform: scale(0.9);
    }
}

/* Hide hover effects on touch devices */
@media (hover: none) and (pointer: coarse) {
    .difficulty-btn:hover,
    #settingsIcon:hover,
    #restartBtn:hover,
    .pause-btn:hover,
    #closeLeaderboard:hover,
    .leaderboard-entry:hover {
        transform: none !important;
    }

    #settingsIcon:hover {
        background: rgba(255,255,255,0.2) !important;
    }
}
