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

:root {
    --neon-blue: #0ff;
    --neon-pink: #f0f;
    --neon-purple: #a64dff;
    --neon-green: #0f0;
    --dark-bg: #0a0a16;
    --darker-bg: #050510;
    --panel-bg: rgba(15, 15, 35, 0.8);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--darker-bg);
    color: #fff;
    padding: 20px;
    overflow: hidden;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Спокойный анимированный фон */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.15;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.3;
}

.circle-1 {
    width: 200px;
    height: 200px;
    background: var(--neon-blue);
    top: 15%;
    left: 15%;
    animation: float 25s infinite ease-in-out;
}

.circle-2 {
    width: 250px;
    height: 250px;
    background: var(--neon-purple);
    bottom: 20%;
    right: 15%;
    animation: float 30s infinite ease-in-out reverse;
}

.circle-3 {
    width: 180px;
    height: 180px;
    background: var(--neon-green);
    top: 60%;
    left: 20%;
    animation: float 20s infinite ease-in-out;
}

.circle-4 {
    width: 220px;
    height: 220px;
    background: var(--neon-pink);
    top: 30%;
    right: 25%;
    animation: float 35s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { 
        transform: translate(0, 0) scale(1) rotate(0deg); 
    }
    25% { 
        transform: translate(20px, -15px) scale(1.02) rotate(90deg); 
    }
    50% { 
        transform: translate(-15px, 10px) scale(0.98) rotate(180deg); 
    }
    75% { 
        transform: translate(-10px, -20px) scale(1.01) rotate(270deg); 
    }
}

/* Тонкие линии сетки на фоне */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    z-index: -2;
    opacity: 0.5;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 1200px;
    width: 100%;
}

.header {
    text-align: center;
    margin-bottom: 10px;
    z-index: 1;
}

h1 {
    font-size: 3.5rem;
    background: linear-gradient(45deg, var(--neon-blue), var(--neon-purple));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
    margin-bottom: 10px;
    letter-spacing: 2px;
    font-weight: 700;
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 180px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--neon-blue), transparent);
    border-radius: 50%;
    filter: blur(0.5px);
}

.game-area {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.game-container {
    display: flex;
    gap: 20px;
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.15);
    border: 1px solid rgba(0, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(45deg, var(--neon-blue), var(--neon-purple), var(--neon-blue));
    z-index: -1;
    border-radius: 16px;
    animation: borderGlow 8s linear infinite;
    background-size: 200%;
    opacity: 0.7;
}

@keyframes borderGlow {
    0% { background-position: 0%; filter: hue-rotate(0deg); }
    50% { background-position: 100%; }
    100% { background-position: 0%; filter: hue-rotate(360deg); }
}

canvas {
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 8px;
    background-color: rgba(5, 5, 15, 0.95);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
}

.side-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 200px;
}

.info {
    margin-bottom: 15px;
}

.info h2 {
    color: var(--neon-blue);
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    padding-bottom: 5px;
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
    font-size: 1.3rem;
}

.info p {
    margin: 10px 0;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
}

.info span {
    color: var(--neon-green);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

button {
    padding: 10px 16px;
    background: rgba(0, 255, 255, 0.08);
    color: var(--neon-blue);
    border: 1px solid rgba(0, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

button:hover {
    background: rgba(0, 255, 255, 0.15);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.3);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
}

.controls {
    margin-top: 15px;
    padding: 12px;
    background: rgba(0, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(0, 255, 255, 0.15);
}

.controls h3 {
    color: var(--neon-blue);
    margin-bottom: 8px;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
}

.controls p {
    margin: 6px 0;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
}

.controls .key {
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    color: var(--neon-blue);
    font-family: monospace;
    font-size: 0.8rem;
}

.leaderboard {
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 15px rgba(166, 77, 255, 0.15);
    border: 1px solid rgba(166, 77, 255, 0.2);
    backdrop-filter: blur(8px);
    width: 300px;
    position: relative;
    overflow: hidden;
}

.leaderboard::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: linear-gradient(45deg, var(--neon-purple), var(--neon-blue), var(--neon-purple));
    z-index: -1;
    border-radius: 16px;
    animation: borderGlow 10s linear infinite;
    background-size: 200%;
    opacity: 0.6;
}

.leaderboard h2 {
    color: var(--neon-purple);
    text-align: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(166, 77, 255, 0.3);
    padding-bottom: 8px;
    text-shadow: 0 0 8px rgba(166, 77, 255, 0.4);
    font-size: 1.5rem;
}

.leaderboard-list {
    list-style-type: none;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 8px;
}

.leaderboard-list::-webkit-scrollbar {
    width: 6px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: var(--neon-purple);
    border-radius: 8px;
    opacity: 0.5;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: rgba(25, 25, 45, 0.6);
    border-radius: 8px;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.leaderboard-item:hover {
    background: rgba(35, 35, 55, 0.8);
    border-color: rgba(166, 77, 255, 0.3);
    transform: translateX(3px);
}

.leaderboard-item:nth-child(-n+3) {
    background: rgba(166, 77, 255, 0.15);
    border: 1px solid rgba(166, 77, 255, 0.3);
}

.leaderboard-item:nth-child(1) {
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.5);
}

.leaderboard-item:nth-child(2) {
    box-shadow: 0 0 8px rgba(192, 192, 192, 0.3);
    border-color: rgba(192, 192, 192, 0.5);
}

.leaderboard-item:nth-child(3) {
    box-shadow: 0 0 6px rgba(205, 127, 50, 0.3);
    border-color: rgba(205, 127, 50, 0.5);
}

.rank {
    font-weight: bold;
    width: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.leaderboard-item:nth-child(1) .rank {
    color: gold;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.leaderboard-item:nth-child(2) .rank {
    color: silver;
    text-shadow: 0 0 5px rgba(192, 192, 192, 0.5);
}

.leaderboard-item:nth-child(3) .rank {
    color: #cd7f32;
    text-shadow: 0 0 5px rgba(205, 127, 50, 0.5);
}

.player-name {
    flex-grow: 1;
    text-align: left;
    padding: 0 12px;
    font-size: 0.9rem;
}

.player-score {
    font-weight: bold;
    color: var(--neon-green);
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
    font-size: 0.9rem;
}

/* Остальные стили остаются без изменений */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 15, 0.95);
    z-index: 100;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--panel-bg);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.4);
    border: 1px solid var(--neon-blue);
    text-align: center;
    max-width: 450px;
    width: 90%;
    position: relative;
    animation: modalAppear 0.5s ease-out;
}

@keyframes modalAppear {
    from { opacity: 0; transform: scale(0.9) translateY(-30px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h2 {
    color: var(--neon-blue);
    margin-bottom: 15px;
    font-size: 2rem;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.4);
}

.modal p {
    margin: 12px 0;
    font-size: 1.1rem;
    line-height: 1.4;
}

.final-score {
    font-size: 2.5rem;
    color: var(--neon-green);
    margin: 15px 0;
    text-shadow: 0 0 12px rgba(0, 255, 0, 0.4);
    font-weight: bold;
}

.nickname-input {
    padding: 12px;
    font-size: 1.1rem;
    border: 1px solid var(--neon-blue);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    width: 100%;
    margin: 15px 0;
    text-align: center;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
    transition: all 0.3s;
}

.nickname-input:focus {
    outline: none;
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.4);
    border-color: var(--neon-green);
}

.nickname-input::placeholder {
    color: #888;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.sound-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.sound-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 255, 255, 0.08);
    border: 1px solid rgba(0, 255, 255, 0.3);
    color: var(--neon-blue);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}

.sound-btn:hover {
    background: rgba(0, 255, 255, 0.15);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.3);
    transform: scale(1.05);
}

.sound-btn.muted {
    color: #ff5555;
    border-color: rgba(255, 85, 85, 0.5);
    box-shadow: 0 0 8px rgba(255, 85, 85, 0.3);
}

@media (max-width: 900px) {
    .game-area {
        flex-direction: column;
        align-items: center;
    }
    
    .leaderboard {
        width: 100%;
        max-width: 450px;
    }
    
    h1 {
        font-size: 2.2rem;
    }
}

/* Защитные стили */
.no-copy {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}