/* games.css - Общие стили для всех игр */

:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --secondary: #64748B;
    --success: #10B981;
    --warning: #F59E0B;
    --error: #EF4444;
    --bg-primary: #F8FAFC;
    --bg-card: #FFFFFF;
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --border: #E2E8F0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
}

/* TOP BAR С ВЫПАДАЮЩИМ МЕНЮ */
#top-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.client-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.client-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.client-nick {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* МЕНЮ */
.menu-button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.menu-button:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 24px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    padding: 8px;
    min-width: 200px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--text-primary);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
}

.menu-item:hover {
    background: var(--bg-primary);
}

.menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ОСНОВНОЙ КОНТЕНТ */
.game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 24px;
    text-align: center;
}

.game-header {
    margin-bottom: 48px;
}

.game-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    display: block;
}

.game-title {
    font-size: 3rem;
    font-weight: 800;
    color: white;
    margin-bottom: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    line-height: 1.6;
}

/* КНОПКИ ДЕЙСТВИЙ */
.action-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* МОДАЛЬНЫЕ ОКНА */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-hover);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ФОРМЫ В МОДАЛКАХ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: left;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.radio-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 120px;
}

.radio-label:hover {
    border-color: var(--primary);
}

.radio-label.selected {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
}

.radio-label.selected .radio-custom {
    border-color: var(--primary);
    background: var(--primary);
}

.radio-label.selected .radio-custom::after {
    content: '';
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ПРАВИЛА В МОДАЛКЕ */
.rules-content {
    line-height: 1.7;
    color: var(--text-secondary);
}

.rules-list {
    margin: 16px 0;
    padding-left: 20px;
}

.rules-list li {
    margin-bottom: 8px;
}

.example {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 12px;
    margin: 16px 0;
    border-left: 4px solid var(--primary);
    font-style: italic;
}

/* ВАРИАНТЫ ИГР */
.game-variants {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.variant-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    cursor: pointer;
    text-align: center;
}

.variant-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}

.variant-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--bg-card) 0%, #f0f9ff 100%);
}

.variant-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

.variant-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.variant-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

.variant-details {
    background: var(--bg-primary);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* АДАПТИВНОСТЬ */
@media (max-width: 768px) {
    .game-container {
        padding: 40px 16px;
    }
    
    .game-title {
        font-size: 2.5rem;
    }
    
    .game-icon {
        font-size: 3rem;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
    }
    
    .modal {
        width: 95%;
    }
    
    .game-variants {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    #top-bar {
        padding: 12px 16px;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .game-subtitle {
        font-size: 1.1rem;
    }
    
    .dropdown-menu {
        right: 16px;
        min-width: 180px;
    }
    
    .radio-group {
        flex-direction: column;
    }
    
    .modal-body {
        padding: 16px;
    }
}

/* Дополнительные стили для игры в пятнашки */

/* Варианты размеров для пятнашек */
.variant-card.size-3x3 {
    border-left: 4px solid #10B981;
}

.variant-card.size-4x4 {
    border-left: 4px solid #3B82F6;
}

.variant-card.size-5x5 {
    border-left: 4px solid #EF4444;
}

/* Адаптация для мобильных устройств */
@media (max-width: 768px) {
    .game-variants {
        grid-template-columns: 1fr;
    }
    
    .variant-card {
        padding: 20px;
    }
    
    .variant-icon {
        font-size: 2rem;
    }
}

/* Стили для формы с двумя полями ввода */
.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}