* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background: linear-gradient(135deg, #481e72 0%, #2a5298 100%);
    color: #fff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 107, 107, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(78, 205, 196, 0.3) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

#login-screen {
    background: rgb(0 0 0 / 65%);
    backdrop-filter: blur(10px);
}

.menu-footer {
    position: absolute;
    bottom: 22px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 11;
    pointer-events: auto;
}

.github-button {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.github-button:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.98);
}

.github-button:active {
    transform: translateY(0);
}

.login-container {
    text-align: center;
    max-width: 600px;
    padding: 50px 40px;
    background: rgb(0 0 0 / 17%);
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-title {
    font-size: 3.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #4ecdc4f0;
}

.game-subtitle {
    font-size: 1.2rem;
    color: rgb(255 255 255 / 50%);
    margin-bottom: 30px;
    font-weight: 300;
}

#nickname-input {
    width: 100%;
    padding: 16px 25px;
    font-size: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    background: rgb(255 255 255 / 1%);
    color: #fff;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

#nickname-input:focus {
    outline: none;
    border-color: #4ecdc4;
    box-shadow: 0 0 25px rgba(78, 205, 196, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

#nickname-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.color-selector {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.color-option {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.color-option.selected {
    border-color: #fff;
    transform: scale(1.3);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
}

.color-option:hover {
    transform: scale(1.2);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.color-option[data-color="#ff6b6b"] { background: #ff6b6b; }
.color-option[data-color="#4ecdc4"] { background: #4ecdc4; }
.color-option[data-color="#45b7d1"] { background: #45b7d1; }
.color-option[data-color="#f9ca24"] { background: #f9ca24; }
.color-option[data-color="#f0932b"] { background: #f0932b; }
.color-option[data-color="#eb4d4b"] { background: #eb4d4b; }
.color-option[data-color="#6c5ce7"] { background: #6c5ce7; }
.color-option[data-color="#a29bfe"] { background: #a29bfe; }

.play-button {
    width: 100%;
    padding: 18px 35px;
    font-size: 1.5rem;
    font-weight: bold;
    background: #4ecdc41c;
    color: #4ecdc4f0;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.play-button:hover {
    transform: translateY(-3px);
    background: #4ecdc42e;
}

.feature {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 0.95rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.feature-icon {
    font-size: 1.4rem;
}

#game-screen {
    background: transparent;
    position: relative;
}

#game-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #111;
    z-index: 1;
}

body.menu-active #game-canvas {
    filter: brightness(0.5) saturate(0.9);
}

.game-ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

.top-ui {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    pointer-events: none;
}

.score-display, .length-display, .rank-display {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-label, .length-label, .rank-label {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-right: 5px;
}

.score-value, .length-value, .rank-value {
    font-weight: bold;
    font-size: 1rem;
    color: #4ecdc4;
}

.leaderboard {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 200px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: auto;
}

.leaderboard-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    font-size: 1rem;
    margin-bottom: 10px;
    text-align: center;
    color: #4ecdc4;
}
.leaderboard-content {
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-content::-webkit-scrollbar {
    width: 4px;
}

.leaderboard-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.leaderboard-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.leaderboard-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.leaderboard-item:last-child {
    border-bottom: none;
}

.leader-rank {
    width: 20px;
    font-weight: bold;
    color: #f9ca24;
}

.leader-name {
    flex: 1;
    margin: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.leader-score {
    font-weight: bold;
    color: #4ecdc4;
    min-width: 40px;
    text-align: right;
}

.game-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.control-hint {
    font-size: 0.9rem;
    opacity: 0.8;
    text-align: center;
}

.death-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    z-index: 50;
    align-items: center;
    justify-content: center;
}

.death-container {
    text-align: center;
    max-width: 500px;
    width: 90%;
    padding: 50px 40px;
    background: rgb(255 255 255 / 6%);
    border-radius: 25px;
    border: 1px solid rgb(255 255 255 / 14%);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(14px);
}

.death-title {
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    gap: 0.30rem;
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: #ff6b6b;
}

.death-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.stat {
    padding: 1rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #4ecdc4;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
}

.death-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.action-button {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 140px;
}

.action-button.primary {
    background: #161616;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffffdb;
    white-space: nowrap;
}

.action-button.secondary {
    color: #e5e5e5;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    white-space: nowrap;
    background: transparent;
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.action-button.primary:hover {
    background: #1e1e1e;
}

.action-button.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.connection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.connection-message {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
}

.connection-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.connection-message h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #ff6b6b;
}

.connection-message p {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 20px;
}

.connection-progress {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.connection-progress::after {
    content: '';
    display: block;
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4);
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.spectator-overlay {
    position: fixed;
    top: auto;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 20px 30px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
    z-index: 30;
    opacity: .5;
    max-width: min(520px, calc(100vw - 40px));
    width: max-content;
}

.spectator-text {
    font-size: 1.2rem;
    font-weight: bold;
    color: #f9ca24;
    margin-bottom: 10px;
    text-align: center;
}

.spectator-target {
    font-size: 1rem;
    color: #4ecdc4;
    text-align: center;
}

@media (max-width: 768px) {
    .game-title {
        font-size: 2.8rem;
    }

    .login-container {
        padding: 30px 25px;
    }

    .game-features {
        grid-template-columns: 1fr;
    }

    .top-ui {
        flex-direction: column;
        gap: 10px;
    }

    .leaderboard {
        width: 180px;
        max-height: 200px;
    }

    .leaderboard-content {
        max-height: 150px;
    }

    .leaderboard-item {
        padding: 6px 0;
        font-size: 0.8rem;
    }

    .leaderboard-title {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .death-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .death-actions {
        flex-direction: column;
        align-items: center;
    }

    #game-canvas {
        touch-action: none;
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(78, 205, 196, 0.3); }
    50% { box-shadow: 0 0 30px rgba(78, 205, 196, 0.6); }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

.glow {
    animation: glow 2s ease-in-out infinite;
} 
