/* ``` */

/* ### 2. Файл `styles.css` - Стилизация */
/* ```css */
/* Базовые стили */
:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --success-hover: #059669;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --warning-color: #f59e0b;
    --dark-bg: #0f172a;
    --dark-card: #1e293b;
    --dark-border: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 1200px;
    width: 100%;
    background: var(--dark-card);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: 1px solid var(--dark-border);
}

/* Шапка */
.header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    padding: 30px 40px;
    text-align: center;
    border-bottom: 1px solid var(--dark-border);
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.title i {
    font-size: 2.2rem;
    animation: pulse 2s infinite;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Основной контент */
.main-content {
    padding: 40px;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 40px;
}

/* Информация о игре */
.game-info {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.stat-icon {
    font-size: 1.8rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
	margin:0;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.instructions {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    padding: 25px;
    backdrop-filter: blur(10px);
}

.instructions h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: var(--text-secondary);
}

.instructions li:before {
    content: "•";
    color: var(--primary-color);
    position: absolute;
    left: 0;
    font-size: 1.5rem;
}

/* Игровая область */
.game-area {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.quadrat-container {
    position: relative;
    width: 500px;
    height: 500px;
    margin: 50px auto;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 15px;
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(59, 130, 246, 0.2);
    border: 2px solid rgba(59, 130, 246, 0.3);
    overflow: hidden;
    padding: 2px;
}

.quadrat-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    width: 100%;
    height: 100%;
    gap: 1px;
}

.cell {
    background: rgba(59, 130, 246, 0.15);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.cell:hover:not(.blocked):not(.selected) {
    background: rgba(59, 130, 246, 0.3);
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    z-index: 1;
}

.cell.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2),
                0 0 15px rgba(59, 130, 246, 0.4);
}
.cell.selected {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.3),
                0 0 20px rgba(16, 185, 129, 0.5);
    animation: pulse-green 2s infinite;
}

.cell.blocked {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}
.cellselected{
	width: 100%;
    height: 100%;
	background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.3),
                0 0 20px rgba(16, 185, 129, 0.5);
    animation: pulse-green 2s infinite;
	border-radius:10px;
	margin:0;
}
.cell-coords {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 8px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

/* Элементы управления */
.controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 200px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(-1px);
}

.btn-save {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-hover) 100%);
    color: white;
}

.btn-save:hover {
    background: linear-gradient(135deg, var(--success-hover) 0%, #047857 100%);
}

.btn-reset {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: white;
}

.btn-reset:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.status-message {
    text-align: center;
    padding: 20px;
    background: rgba(30, 41, 59, 0.7);
    border-radius: 12px;
    border: 1px solid var(--dark-border);
    font-size: 1.1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    backdrop-filter: blur(10px);
}

/* Подвал */
.footer {
    background: rgba(15, 23, 42, 0.8);
    padding: 20px 40px;
    border-top: 1px solid var(--dark-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.db-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-text {
    color: var(--danger-color);
    font-weight: 600;
}

.status-text.connected {
    color: var(--success-color);
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--dark-card);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--dark-border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.modal-header {
    background: linear-gradient(135deg, var(--success-color) 0%, var(--success-hover) 100%);
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: white;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px;
}

.modal-body p {
    margin-bottom: 20px;
    font-size: 1.1rem;
    line-height: 1.6;
}

.modal-stats {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.modal-stats p {
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
}

.modal-footer {
    padding: 20px 30px;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    justify-content: flex-end;
}

.btn-confirm {
    background: var(--primary-color);
    color: white;
    padding: 12px 30px;
    min-width: auto;
}

.btn-confirm:hover {
    background: var(--primary-hover);
}

/* Анимации */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

@keyframes pulse-green {
    0%, 100% {
        box-shadow: 
            inset 0 0 10px rgba(255, 255, 255, 0.3),
            0 0 20px rgba(16, 185, 129, 0.5);
    }
    50% {
        box-shadow: 
            inset 0 0 10px rgba(255, 255, 255, 0.3),
            0 0 30px rgba(16, 185, 129, 0.7);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптивность */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .quadrat-container {
        margin: 30px auto;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 20px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .footer {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}