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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    text-align: center;
    color: #667eea;
    margin-bottom: 30px;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
    margin-bottom: 20px;
}

.score-board {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 15px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
    margin-bottom: 5px;
}

.value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #667eea;
}

.game-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

#gameCanvas {
    border: 4px solid #667eea;
    border-radius: 10px;
    background: #1a1a2e;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.overlay-content {
    text-align: center;
    color: white;
}

#overlayTitle {
    font-size: 2rem;
    margin-bottom: 15px;
}

#overlayMessage {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: #ccc;
}

#startBtn {
    padding: 15px 40px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    font-weight: bold;
}

#startBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.control-btn {
    padding: 12px 30px;
    font-size: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    font-weight: bold;
}

.control-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.4);
}

.leaderboard {
    margin-bottom: 30px;
}

.leaderboard h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 20px;
}

.leaderboard-list {
    max-height: 300px;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

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

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

.leaderboard-entry:last-child {
    margin-bottom: 0;
}

.leaderboard-rank {
    font-weight: bold;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-size: 1.1rem;
}

.leaderboard-entry:nth-child(1) .leaderboard-rank {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    font-size: 1.3rem;
}

.leaderboard-entry:nth-child(2) .leaderboard-rank {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.leaderboard-entry:nth-child(3) .leaderboard-rank {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.leaderboard-name {
    flex: 1;
    margin-left: 15px;
    font-weight: 600;
    color: #333;
}

.leaderboard-score {
    font-weight: bold;
    color: #667eea;
    font-size: 1.2rem;
}

.leaderboard-date {
    font-size: 0.8rem;
    color: #999;
    margin-left: 15px;
}

.leaderboard-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#playerName {
    padding: 12px 20px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
    flex: 1;
    max-width: 200px;
}

#playerName:focus {
    border-color: #667eea;
}

.save-btn, .clear-btn {
    padding: 12px 25px;
    font-size: 1rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.3s, box-shadow 0.3s;
}

.save-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.clear-btn {
    background: #f8f9fa;
    color: #666;
}

.save-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.4);
}

.clear-btn:hover {
    background: #e9ecef;
}

.empty-leaderboard {
    text-align: center;
    color: #999;
    padding: 30px;
    font-style: italic;
}

.instructions {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 15px;
}

.instructions h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 8px 0;
    color: #555;
    line-height: 1.6;
}

.instructions strong {
    color: #667eea;
    font-weight: 600;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2rem;
    }

    #gameCanvas {
        width: 100%;
        max-width: 350px;
        height: auto;
    }

    .score-board {
        flex-direction: column;
        gap: 10px;
    }

    .value {
        font-size: 1.5rem;
    }

    .controls {
        flex-direction: column;
    }

    .leaderboard-controls {
        flex-direction: column;
    }

    #playerName {
        max-width: 100%;
    }

    .leaderboard-score {
        font-size: 1rem;
    }
}

/* Scrollbar styling for leaderboard */
.leaderboard-list::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

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

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