body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #f0f0f0;
    font-family: 'Arial', sans-serif;
}

#gameCanvas {
    display: block;
}

#nameOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#nameModal {
    background-color: white;
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#nameModal h1 {
    margin-top: 0;
    color: #333;
}

#nameInput {
    width: 250px;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 5px;
    margin-bottom: 20px;
    outline: none;
}

#nameInput:focus {
    border-color: #4CAF50;
}

#playButton {
    padding: 12px 40px;
    font-size: 16px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

#playButton:hover {
    background-color: #45a049;
}

#darkModeToggle {
    margin-bottom: 20px;
}

#darkModeToggle label {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #555;
}

#darkModeToggle input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

/* Account Promo */
#accountPromo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    color: white;
}

#accountPromo p {
    margin: 5px 0;
    font-size: 14px;
}

#accountPromo p:first-child {
    font-size: 15px;
}

#accountPromo strong {
    font-size: 16px;
    color: #FFD700;
}

.promo-links {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.promo-link, .promo-link-secondary {
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.2s;
    font-size: 14px;
}

.promo-link {
    background-color: white;
    color: #667eea;
}

.promo-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.promo-link-secondary {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
}

.promo-link-secondary:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

body.dark-mode #accountPromo {
    background: linear-gradient(135deg, #5568d3 0%, #6a4a95 100%);
}

/* Dark mode styles */
body.dark-mode {
    background-color: #1a1a1a;
}

body.dark-mode #leaderboard {
    background-color: rgba(40, 40, 40, 0.9);
    color: #fff;
}

body.dark-mode #leaderboard h2 {
    color: #fff;
}

body.dark-mode #leaderboardList li {
    color: #ccc;
}

/* User Info Styles */
#userInfo {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 100;
    font-size: 14px;
}

body.dark-mode #userInfo {
    background-color: rgba(40, 40, 40, 0.9);
}

#authLinks a {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
}

#authLinks a:hover {
    text-decoration: underline;
}

body.dark-mode #authLinks a {
    color: #8b9dff;
}

#userDisplay {
    text-align: center;
    position: relative;
}

#userEmail {
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

body.dark-mode #userEmail {
    color: #fff;
}

#userCoins {
    font-size: 18px;
    margin-bottom: 10px;
    color: #FFD700;
    font-weight: bold;
    transition: transform 0.3s, color 0.3s;
}

#userCoins.coin-increase {
    animation: coinPulse 0.5s ease-out;
}

@keyframes coinPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
        color: #FFE44D;
    }
    100% {
        transform: scale(1);
    }
}

.coin-indicator {
    position: absolute;
    top: 50%;
    left: 100%;
    margin-left: 10px;
    color: #FFD700;
    font-size: 20px;
    font-weight: bold;
    animation: floatUp 1s ease-out forwards;
    pointer-events: none;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

#shopButton, #logoutButton {
    padding: 8px 16px;
    margin: 4px;
    font-size: 13px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

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

#shopButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#logoutButton {
    background-color: #f44336;
    color: white;
}

#logoutButton:hover {
    background-color: #d32f2f;
}

#leaderboard {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    width: 200px;
    z-index: 100;
}

#leaderboard h2 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
    text-align: center;
}

#leaderboardList {
    list-style-position: inside;
    padding: 0;
    margin: 0;
}

#leaderboardList li {
    padding: 5px;
    margin: 3px 0;
    font-size: 14px;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#leaderboardList li strong {
    color: #4CAF50;
    font-size: 12px;
}

#leaderboardList li:first-child {
    color: #FFD700;
    font-weight: bold;
}

#leaderboardList li:nth-child(2) {
    color: #C0C0C0;
    font-weight: bold;
}

#leaderboardList li:nth-child(3) {
    color: #CD7F32;
    font-weight: bold;
}

#howToPlay {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    font-size: 12px;
    line-height: 1.5;
}

#howToPlay p {
    margin: 0;
    color: #555;
    text-align: center;
}

body.dark-mode #howToPlay {
    border-top-color: #555;
}

body.dark-mode #howToPlay p {
    color: #bbb;
}

#controls {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ddd;
    font-size: 12px;
    color: #666;
}

#controls div {
    padding: 3px 0;
}

#controls strong {
    color: #333;
    font-weight: bold;
}

body.dark-mode #controls {
    border-top-color: #555;
    color: #aaa;
}

body.dark-mode #controls strong {
    color: #fff;
}

/* Dark mode for name entry screen */
body.dark-mode #nameOverlay {
    background-color: rgba(0, 0, 0, 0.9);
}

body.dark-mode #nameModal {
    background-color: #2a2a2a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
}

body.dark-mode #nameModal h1 {
    color: #fff;
}

body.dark-mode #nameInput {
    background-color: #3a3a3a;
    border-color: #555;
    color: #fff;
}

body.dark-mode #nameInput::placeholder {
    color: #aaa;
}

body.dark-mode #nameInput:focus {
    border-color: #4CAF50;
    background-color: #404040;
}

body.dark-mode #darkModeToggle label {
    color: #ccc;
}

/* Skin Selection Styles */
#skinSelection {
    margin: 20px 0;
}

#skinSelection h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #333;
    text-align: center;
}

body.dark-mode #skinSelection h3 {
    color: #fff;
}

#skinOptions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 8px;
}

body.dark-mode #skinOptions {
    background-color: #3a3a3a;
}

.skin-option {
    cursor: pointer;
    text-align: center;
    padding: 8px;
    border: 3px solid transparent;
    border-radius: 8px;
    transition: all 0.2s;
    background-color: white;
}

body.dark-mode .skin-option {
    background-color: #4a4a4a;
}

.skin-option:hover {
    transform: scale(1.05);
    border-color: #4CAF50;
}

.skin-option.selected {
    border-color: #4CAF50;
    background-color: #e8f5e9;
}

body.dark-mode .skin-option.selected {
    background-color: #2d5a2e;
}

.skin-preview {
    width: 50px;
    height: 50px;
    margin: 0 auto 5px;
    border-radius: 50%;
    border: 2px solid #ddd;
    background-size: cover;
    background-position: center;
}

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

body.dark-mode .skin-preview {
    border-color: #555;
}

.skin-label {
    font-size: 11px;
    color: #555;
    word-break: break-word;
}

body.dark-mode .skin-label {
    color: #ccc;
}

#skinLoader {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px;
}

/* Custom Color Picker */
.custom-color-preview {
    background: #ff6b6b;
}

#colorPickerContainer {
    margin-top: 15px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: 8px;
    text-align: center;
}

body.dark-mode #colorPickerContainer {
    background-color: #3a3a3a;
}

#colorPickerContainer label {
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
    color: #333;
    font-weight: bold;
}

body.dark-mode #colorPickerContainer label {
    color: #fff;
}

#colorPicker {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

/* Server Announcement */
#serverAnnouncement {
    position: fixed;
    top: 20px;
    left: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 14px;
    font-weight: 600;
    max-width: 400px;
    z-index: 900;
    animation: slideInLeft 0.4s ease-out;
    border-left: 4px solid rgba(255, 255, 255, 0.5);
}

#announcementText {
    display: block;
    line-height: 1.4;
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

body.dark-mode #serverAnnouncement {
    background: linear-gradient(135deg, #5568d3 0%, #6a4a95 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Death Overlay */
#deathOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

#deathModal {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    padding: 50px 70px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(244, 67, 54, 0.5);
    animation: scaleIn 0.4s ease-out;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

#deathTitle {
    color: white;
    font-size: 48px;
    margin: 0 0 20px 0;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    font-weight: bold;
}

#deathMessage {
    color: rgba(255, 255, 255, 0.95);
    font-size: 24px;
    margin: 0;
    font-weight: 500;
}

#countdown {
    font-size: 32px;
    font-weight: bold;
    color: #ffeb3b;
    text-shadow: 0 0 10px rgba(255, 235, 59, 0.7);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

body.dark-mode #deathModal {
    background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%);
    box-shadow: 0 10px 40px rgba(198, 40, 40, 0.6);
}
