/* Сброс стилей и базовые настройки */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.game-header {
    background: linear-gradient(90deg, #667eea, #764ba2);
    color: white;
    text-align: center;
    padding: 20px;
}

.game-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-header p {
    font-size: 1.1em;
    opacity: 0.9;
}

.game-wrapper {
    display: flex;
    gap: 20px;
    padding: 20px;
    align-items: flex-start;
}

/* Игровое поле */
#gameCanvas {
    border: 3px solid #333;
    border-radius: 8px;
    background: #f0f0f0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

#gameCanvas:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Панель информации */
.game-info-panel {
    min-width: 300px;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.info-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.info-section h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.info-section h4 {
    color: #555;
    margin-bottom: 8px;
}

/* Статус игроков */
.player-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.player1 .color-indicator {
    background: #337ab7;
}

.player2 .color-indicator {
    background: #d9534f;
}

.color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #333;
}

/* Сообщение о победе */
.winner-message {
    text-align: center;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border-left-color: #ffc107;
    animation: celebration 2s ease-in-out infinite;
}

@keyframes celebration {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.winner-message h3 {
    color: #d48806;
    font-size: 1.5em;
}

.restart-btn {
    background: linear-gradient(90deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1em;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

/* Управление */
.control-instructions {
    font-size: 0.9em;
    line-height: 1.6;
}

.control-instructions p {
    margin-bottom: 8px;
}

.control-instructions strong {
    color: #667eea;
}

/* Действия */
.cost-info {
    background: #fff;
    padding: 10px;
    border-radius: 5px;
    font-size: 0.9em;
}

.cost-info p {
    margin-bottom: 5px;
}

/* Панель управления */
.controls-panel {
    background: #e9ecef;
    border-radius: 8px;
    padding: 15px;
    border: 2px solid #dee2e6;
}

.controls-panel h3 {
    color: #495057;
    margin-bottom: 15px;
    text-align: center;
}

/* Инструкции */
.game-instructions {
    background: #f8f9fa;
    padding: 20px;
    border-top: 1px solid #dee2e6;
}

.game-instructions h3 {
    color: #495057;
    margin-bottom: 15px;
}

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

.game-instructions li {
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.game-instructions li::before {
    content: "▶";
    color: #667eea;
    position: absolute;
    left: 0;
}

/* Адаптивность */
@media (max-width: 1000px) {
    .game-wrapper {
        flex-direction: column;
        align-items: center;
    }
    
    #gameCanvas {
        max-width: 100%;
        height: auto;
    }
    
    .game-info-panel {
        width: 100%;
        max-width: 500px;
    }
}

@media (max-width: 600px) {
    .game-header h1 {
        font-size: 2em;
    }
    
    body {
        padding: 10px;
    }
    
    .game-container {
        margin: 0;
    }
    
    #gameCanvas {
        width: 100%;
        max-width: 400px;
        height: 400px;
    }
}

/* Анимации загрузки */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.loading {
    animation: pulse 2s infinite;
}

/* Цвета для различных элементов игры */
.grid-cell {
    stroke: #ddd;
    stroke-width: 1;
}

.grid-cell:hover {
    stroke: #667eea;
    stroke-width: 2;
}

.player-token {
    stroke: #333;
    stroke-width: 2;
}

.kiosk {
    stroke: #333;
    stroke-width: 1;
}

.territory-influence {
    opacity: 0.3;
}

/* Эффекты наведения */
#gameCanvas:hover {
    cursor: crosshair;
}

/* Стили для индикаторов активного хода */
.active-player {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.active-player .color-indicator {
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Статус индикаторы */
.status-active {
    background: #d4edda;
    border-left-color: #28a745;
}

.status-waiting {
    background: #fff3cd;
    border-left-color: #ffc107;
}

.status-ai {
    background: #f8d7da;
    border-left-color: #dc3545;
}

/* Анимация для сообщений */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.message {
    animation: slideIn 0.5s ease-out;
}