* {
    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%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 1200px;
    width: 100%;
}

.game-header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px 15px 0 0;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.game-header h1 {
    text-align: center;
    color: #333;
    margin-bottom: 15px;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 10px 20px;
    border-radius: 10px;
    color: white;
    min-width: 120px;
}

.info-item .label {
    font-size: 0.85em;
    opacity: 0.9;
    margin-bottom: 5px;
}

.info-item .value {
    font-size: 1.5em;
    font-weight: bold;
}

/* Прогресс-бар времени */
.timer-bar-container {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 15px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.timer-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 50%, #CDDC39 100%);
    border-radius: 6px;
    transition: width 0.3s ease, background 0.5s ease;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.timer-bar.warning {
    background: linear-gradient(90deg, #FF9800 0%, #FFC107 100%);
    box-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

.timer-bar.danger {
    background: linear-gradient(90deg, #F44336 0%, #FF5722 100%);
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    overflow: auto;
}

#gameCanvas {
    border: 2px solid #667eea;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    background: #2C3E50;
    max-width: 100%;
    height: auto;
}

.controls {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 0 0 15px 15px;
    padding: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

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

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    font-size: 2em;
    margin-bottom: 20px;
    color: #333;
}

.modal-content p {
    font-size: 1.2em;
    margin-bottom: 15px;
    color: #666;
}

.modal-stats {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.modal-stats p {
    margin: 10px 0;
    font-weight: bold;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 15px;
}

/* Адаптивность */
@media (max-width: 768px) {
    .game-header h1 {
        font-size: 1.5em;
    }

    .info-item {
        min-width: 80px;
        padding: 8px 12px;
    }

    .info-item .value {
        font-size: 1.2em;
    }

    .btn {
        padding: 10px 18px;
        font-size: 0.9em;
    }

    .modal-content {
        padding: 25px;
    }
}

/* Анимация пульсации для подсказки */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

.tile-hint {
    animation: pulse 1s infinite;
}
