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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 500px;
    max-height: 800px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    display: block;
    background: linear-gradient(180deg, #87CEEB 0%, #E0F6FF 100%);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    cursor: pointer;
}

#ui {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
    pointer-events: none;
}

#score-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#score, #high-score, #level {
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 18px;
    color: #667eea;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#high-score {
    font-size: 14px;
    color: #764ba2;
}

#level {
    font-size: 16px;
    color: #f093fb;
}

#mute-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    pointer-events: auto;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
}

#mute-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

#mute-btn:active {
    transform: translateY(0) scale(0.95);
}

#start-screen, #game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 10px;
    color: white;
    text-align: center;
    padding: 20px;
}

#start-screen h1, #game-over h1 {
    font-size: 48px;
    margin-bottom: 20px;
    color: #fff;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

#start-screen p, #game-over p {
    font-size: 20px;
    margin-bottom: 10px;
    color: #ddd;
}

.instructions {
    font-size: 16px !important;
    color: #aaa !important;
    margin-top: 10px !important;
}

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

#start-btn, #restart-btn, #submit-score-btn {
    font-size: 24px;
    margin-top: 30px;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

button:active {
    transform: translateY(0);
}

#skip-score-btn, #view-leaderboard-btn, #leaderboard-btn {
    background: linear-gradient(135deg, #555 0%, #777 100%);
    font-size: 18px;
    padding: 12px 30px;
}

.hidden {
    display: none !important;
}

#final-score {
    font-size: 28px !important;
    color: #fff !important;
    font-weight: bold;
}

#final-high-score {
    font-size: 20px !important;
    color: #ffd700 !important;
}

/* High Score Entry */
#high-score-entry, #leaderboard {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 150;
    border-radius: 10px;
    color: white;
    text-align: center;
    padding: 20px;
}

#high-score-entry h1, #leaderboard h1 {
    font-size: 42px;
    margin-bottom: 20px;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

#new-high-score-value {
    font-size: 32px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 20px;
}

#player-name-input {
    padding: 15px 20px;
    font-size: 20px;
    border: 3px solid #667eea;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-align: center;
    margin: 20px 0;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#player-name-input:focus {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

#player-name-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Leaderboard */
#leaderboard-list {
    width: 100%;
    max-width: 500px;
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s, background 0.2s;
}

.leaderboard-entry:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.15);
}

.leaderboard-entry.top-3 {
    border-left-width: 6px;
    background: rgba(255, 215, 0, 0.15);
}

.leaderboard-entry.rank-1 {
    border-left-color: #ffd700;
}

.leaderboard-entry.rank-2 {
    border-left-color: #c0c0c0;
}

.leaderboard-entry.rank-3 {
    border-left-color: #cd7f32;
}

.leaderboard-rank {
    font-size: 24px;
    font-weight: bold;
    min-width: 50px;
}

.leaderboard-name {
    flex: 1;
    font-size: 20px;
    text-align: left;
    margin: 0 20px;
}

.leaderboard-score {
    font-size: 22px;
    font-weight: bold;
    color: #ffd700;
}

/* Mobile optimizations */
@media (max-width: 600px) {
    #start-screen h1, #game-over h1 {
        font-size: 36px;
    }

    #start-btn, #restart-btn {
        font-size: 20px;
        padding: 12px 30px;
    }

    #score, #high-score, #level {
        font-size: 16px;
        padding: 8px 16px;
    }

    #ui {
        top: 10px;
        left: 10px;
        right: 10px;
    }
}

@media (max-height: 600px) {
    #start-screen h1, #game-over h1 {
        font-size: 32px;
        margin-bottom: 10px;
    }

    #start-screen p, #game-over p {
        font-size: 16px;
        margin-bottom: 5px;
    }

    #start-btn, #restart-btn {
        margin-top: 15px;
        padding: 10px 25px;
        font-size: 18px;
    }
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    pointer-events: auto;
    backdrop-filter: blur(10px);
    border-left: 4px solid #667eea;
}

.toast-show {
    opacity: 1;
    transform: translateX(0);
}

.toast-hide {
    opacity: 0;
    transform: translateX(400px) scale(0.8);
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
}

.toast-message {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

/* Toast Types */
.toast-success {
    border-left-color: #52c41a;
}

.toast-success .toast-icon {
    background: rgba(82, 196, 26, 0.1);
    color: #52c41a;
}

.toast-error {
    border-left-color: #ff4d4f;
}

.toast-error .toast-icon {
    background: rgba(255, 77, 79, 0.1);
    color: #ff4d4f;
}

.toast-warning {
    border-left-color: #faad14;
}

.toast-warning .toast-icon {
    background: rgba(250, 173, 20, 0.1);
    color: #faad14;
}

.toast-info {
    border-left-color: #1890ff;
}

.toast-info .toast-icon {
    background: rgba(24, 144, 255, 0.1);
    color: #1890ff;
}

.toast-celebration {
    border-left-color: #ffd700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.toast-celebration .toast-icon {
    background: transparent;
    font-size: 28px;
}

/* Mobile toast adjustments */
@media (max-width: 600px) {
    #toast-container {
        top: 60px;
        right: 10px;
        left: 10px;
    }

    .toast {
        min-width: auto;
        max-width: 100%;
    }
}
