/* Стили для игры Territory */

* {
    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%);
    color: #fff;
    overflow: hidden;
    user-select: none;
}

.game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Canvas игры */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1a1a2e;
    cursor: crosshair;
}

/* HUD элементы */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 10;
}

.score-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.player-score, .kills {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0;
    font-size: 18px;
}

.player-score .label, .kills .label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.player-score .value, .kills .value {
    font-weight: bold;
    font-size: 20px;
    color: #4ECDC4;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

.kills .value {
    color: #FF6B6B;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

/* Таблица лидеров */
.leaderboard {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    min-width: 200px;
    animation: slideDown 0.5s ease-out 0.2s both;
}

.leaderboard h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
}

#leaderboardList {
    list-style: none;
    padding: 0;
    margin: 0;
}

#leaderboardList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 8px;
    margin: 3px 0;
    border-radius: 5px;
    font-size: 14px;
    transition: all 0.3s ease;
}

#leaderboardList li.current-player {
    background: rgba(78, 205, 196, 0.2);
    border: 1px solid rgba(78, 205, 196, 0.5);
}

#leaderboardList .rank {
    font-weight: bold;
    color: #FECA57;
    min-width: 20px;
}

#leaderboardList .name {
    flex: 1;
    margin: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#leaderboardList .score {
    font-weight: bold;
    color: #4ECDC4;
}

/* Меню игры */
.game-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    z-index: 100;
    animation: fadeIn 0.5s ease-out;
    min-width: 350px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.game-menu h1 {
    font-size: 48px;
    margin: 0 0 10px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
}

.game-menu .subtitle {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 30px;
    font-size: 16px;
}

.player-customization {
    margin: 30px 0;
    text-align: left;
}

.player-customization label {
    display: block;
    margin: 15px 0 8px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

#playerName {
    width: 100%;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    transition: all 0.3s ease;
}

#playerName:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: #4ECDC4;
    box-shadow: 0 0 15px rgba(78, 205, 196, 0.3);
}

.color-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.color-option {
    width: 100%;
    height: 40px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.color-option::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px currentColor;
}

.color-option.selected {
    border-color: #fff;
    box-shadow: 0 0 20px currentColor;
}

.color-option.selected::before {
    width: 100%;
    height: 100%;
}

.play-button, .play-again-button, .menu-button {
    padding: 15px 40px;
    margin: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 30px;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.play-button:hover, .play-again-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.menu-button {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.menu-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.controls-info {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-info h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.8);
}

.controls-info p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin: 5px 0;
}

.controls-info kbd {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 12px;
    margin: 0 2px;
}

/* Экран окончания игры */
.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    padding: 40px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    z-index: 100;
    animation: fadeIn 0.5s ease-out;
}

.game-over h2 {
    font-size: 36px;
    margin: 0 0 20px 0;
    color: #FF6B6B;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.final-stats {
    margin: 20px 0;
}

.final-stats p {
    font-size: 18px;
    margin: 10px 0;
    color: rgba(255, 255, 255, 0.9);
}

.final-stats span {
    font-weight: bold;
    color: #4ECDC4;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

/* Мобильные контролы */
.mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 10px;
    z-index: 50;
    pointer-events: all;
}

.control-btn {
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: absolute;
}

.control-btn:active {
    transform: scale(0.95);
    background: rgba(78, 205, 196, 0.3);
}

.control-btn svg {
    width: 30px;
    height: 30px;
}

.control-btn.up {
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
}

.control-btn.down {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
}

.control-btn.left {
    bottom: 60px;
    left: -70px;
}

.control-btn.right {
    bottom: 60px;
    right: -70px;
}

/* FPS счетчик */
.fps-counter {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    z-index: 100;
}

/* Адаптивность */
@media (max-width: 768px) {
    .score-panel {
        top: 10px;
        left: 10px;
        padding: 10px 15px;
    }
    
    .player-score, .kills {
        font-size: 14px;
    }
    
    .player-score .value, .kills .value {
        font-size: 16px;
    }
    
    .leaderboard {
        display: none; /* Скрываем на мобильных для экономии места */
    }
    
    .game-menu {
        width: 90%;
        padding: 30px 20px;
        min-width: unset;
    }
    
    .game-menu h1 {
        font-size: 36px;
    }
    
    .mobile-controls {
        display: flex;
    }
    
    .controls-info p:last-child {
        display: none; /* Скрываем инфо о свайпах, так как есть кнопки */
    }
}

@media (max-width: 480px) {
    .control-btn {
        width: 50px;
        height: 50px;
    }
    
    .control-btn.up {
        bottom: 100px;
    }
    
    .control-btn.left {
        left: -60px;
        bottom: 50px;
    }
    
    .control-btn.right {
        right: -60px;
        bottom: 50px;
    }
}

/* Анимации */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px currentColor;
    }
    50% {
        box-shadow: 0 0 30px currentColor, 0 0 40px currentColor;
    }
}

/* Эффект свечения для территорий */
.territory-glow {
    animation: pulse 2s ease-in-out infinite;
}

/* Плавные переходы */
* {
    transition: opacity 0.3s ease;
}