/* ===== GAMES PAGE STYLES ===== */

/* Page background */
body {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Main content */
.main-content {
    padding-top: 100px;
}

/* Hide games section on mobile devices */
@media (max-width: 768px) {
    .games-section {
        display: none;
    }
    
    .main-content {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: calc(100vh - 100px);
        padding: 100px var(--spacing-lg) var(--spacing-lg);
    }
    
    .main-content::before {
        content: "Игры доступны только на настольных устройствах";
        display: block;
        text-align: center;
        font-size: var(--font-size-lg);
        color: var(--text-secondary);
        background: var(--background-secondary);
        padding: var(--spacing-xl);
        border-radius: var(--radius-lg);
        border: 1px solid var(--border-color);
        box-shadow: var(--shadow-sm);
    }
}

/* Game Tabs */
.game-tabs {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    margin: var(--spacing-2xl) auto;
    padding: 0 var(--spacing-md);
    max-width: 600px;
    width: 100%;
    flex-wrap: wrap;
}

.tab-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 24px;
    border: 2px solid #1e293b;
    border-radius: var(--radius-xl);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    position: relative;
    min-width: 140px;
    text-align: center;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: transparent;
    color: #1e293b;
}

.tab-button:hover {
    background: #1e293b;
    color: white;
    border-color: #1e293b;
    box-shadow: 0 2px 8px rgba(30, 41, 59, 0.3);
}

.tab-button.active {
    background: #1e293b;
    color: white;
    border-color: #1e293b;
    box-shadow: 0 2px 8px rgba(30, 41, 59, 0.3);
}

.tab-button i {
    font-size: 1rem;
}

/* Game Tab Content */
.game-container {
    position: relative;
    width: 100%;
}

.game-tab-content {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.game-tab-content.active {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    opacity: 1;
    transform: translateY(0);
    animation: fadeInUp 0.3s ease forwards;
    gap: var(--spacing-lg);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.games-section {
    padding: 60px 0;
}

.games-grid {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: var(--spacing-2xl);
    margin-top: var(--spacing-3xl);
    flex-wrap: wrap;
    min-height: 60vh;
    width: 100%;
}

.game-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 600px;
    min-height: 580px;
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.game-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.game-title i {
    width: 48px;
    height: 48px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 20px;
}

.game-score {
    display: flex;
    gap: 16px;
    align-items: center;
}

.game-score-count,
.game-score-rating {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    min-width: 100px;
    text-align: center;
    transition: all 0.2s ease;
}

.game-score-count:hover,
.game-score-rating:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.game-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: space-between;
}

.game-container {
    position: relative;
    width: 100%;
}



/* 2048 Game Styles */
.game2048-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: var(--spacing-sm);
    background: var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm);
    width: 320px;
    height: 320px;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.game2048-tile {
    background: var(--background-secondary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
    font-weight: bold;
    color: var(--text-primary);
    transition: all var(--transition-fast, 0.15s ease);
    position: relative;
    box-shadow: var(--shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.05));
    min-height: 70px;
    min-width: 70px;
    aspect-ratio: 1;
}

.game2048-tile[data-value="2"] { background: #eee4da; color: #776e65; }
.game2048-tile[data-value="4"] { background: #ede0c8; color: #776e65; }
.game2048-tile[data-value="8"] { background: #f2b179; color: #f9f6f2; }
.game2048-tile[data-value="16"] { background: #f59563; color: #f9f6f2; }
.game2048-tile[data-value="32"] { background: #f67c5f; color: #f9f6f2; }
.game2048-tile[data-value="64"] { background: #f65e3b; color: #f9f6f2; }
.game2048-tile[data-value="128"] { background: #edcf72; color: #f9f6f2; font-size: 1.25rem; }
.game2048-tile[data-value="256"] { background: #edcc61; color: #f9f6f2; font-size: 1.25rem; }
.game2048-tile[data-value="512"] { background: #edc850; color: #f9f6f2; font-size: 1.25rem; }
.game2048-tile[data-value="1024"] { background: #edc53f; color: #f9f6f2; font-size: 1rem; }
.game2048-tile[data-value="2048"] { background: #edc22e; color: #f9f6f2; font-size: 1rem; }



/* Circular Pong Game Styles */
.circular-pong-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: var(--spacing-lg) 0;
}

#circular-pong-canvas {
    border: 2px solid var(--border-color);
    border-radius: 50%;
    background: var(--background-primary);
    box-shadow: var(--shadow-md);
    cursor: none;
}

/* Player Name Input Styles */
.player-name-section {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: var(--radius-lg);
    padding: 32px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.player-name-section:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.player-name-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #475569;
    font-size: 0.9rem;
}

.player-name-input {
    width: 100%;
    padding: 15px 20px;
    border: 1px solid #d1d5db;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background: #ffffff;
    color: #1e293b;
    box-sizing: border-box;
    transition: all 0.3s ease;
    outline: none;
}

.player-name-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.player-name-input.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.player-name-input::placeholder {
    color: #9ca3af;
}

/* Game Record Card Styles */
.game-record-card {
    width: 100%;
    max-width: 600px;
    padding: 32px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    display: none;
    transition: all 0.3s ease;
}

.game-record-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
}

.record-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.record-player {
    font-weight: 600;
    font-size: 1.1rem;
    color: #1e293b;
    flex: 1;
    text-align: left;
}

.record-score {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
    min-width: 100px;
    text-align: center;
    transition: all 0.2s ease;
}

.record-score:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.game-record-card.has-record {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.1));
    border-color: var(--accent-color);
}

.record-content {
    text-align: center;
}

.record-title {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 12px;
    font-weight: 500;
    text-align: center;
}

.no-record {
    text-align: center;
    color: #9ca3af;
    font-style: italic;
    font-size: 0.9rem;
    padding: 20px;
}

/* Record Notification Styles */
.record-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    color: var(--text-primary);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    transform: translateX(400px);
    opacity: 0;
    transition: all var(--transition-normal);
    z-index: 1000;
    max-width: 320px;
    backdrop-filter: blur(10px);
}

.record-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.record-notification-content {
    text-align: center;
}

.record-notification-content i {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-md);
    display: block;
    color: var(--accent-color);
}

.record-notification-content h4 {
    margin: 0 0 var(--spacing-md) 0;
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
}

.record-notification-content p {
    margin: var(--spacing-sm) 0;
    font-size: var(--font-size-md);
    color: var(--text-secondary);
}

.record-notification-content p:first-of-type {
    font-weight: 600;
    font-size: var(--font-size-lg);
    color: var(--accent-color);
}

/* Game Controls */
.game-controls {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    margin-top: auto;
    padding-top: 16px;
}

.game-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: 2px solid #1e293b;
    border-radius: var(--radius-xl);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    position: relative;
    min-width: 150px;
    text-align: center;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: #1e293b;
    color: white;
    box-shadow: 0 2px 8px rgba(30, 41, 59, 0.3);
    font-family: inherit;
}

.game-btn:hover:not(:disabled) {
    background: #334155;
    border-color: #334155;
    box-shadow: 0 4px 12px rgba(30, 41, 59, 0.4);
}

.game-btn:active:not(:disabled) {
    background: #0f172a;
    border-color: #0f172a;
    box-shadow: 0 1px 4px rgba(30, 41, 59, 0.5);
}

.game-btn:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Custom Select Dropdown for Games */
.custom-select {
    position: relative;
    width: auto;
    min-width: 180px;
    z-index: 1050;
}

.select-button {
    width: 100%;
    padding: 15px 20px;
    font-size: 1rem;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    gap: var(--spacing-sm);
}

.select-button:focus,
.select-button.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.select-arrow {
    transition: transform 0.3s ease;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.select-button.active .select-arrow {
    transform: rotate(180deg);
}

.select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1051;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    margin-top: 4px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

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

.select-option {
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    font-size: 1rem;
}

.select-option:hover {
    background: var(--background-primary);
}

.select-option.selected {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-color);
    font-weight: 500;
}

/* Game Instructions */
.game-instructions {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-top: 16px;
}

.game-instructions p {
    margin: 6px 0;
}

.game-instructions strong {
    color: #1e293b;
    font-weight: 600;
}

/* Game Status Messages */
.game-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    z-index: 10;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-tabs {
        flex-direction: column;
        gap: var(--spacing-xs, 4px);
        margin: var(--spacing-xl) 0;
    }
    
    .tab-button {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: var(--font-size-xs, 0.8rem);
        min-width: auto;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }
    
    .game-card {
        padding: 24px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .game-score {
        flex-direction: column;
        gap: 12px;
        align-items: center;
    }
    
    .game-score-count,
    .game-score-rating,
    .record-score {
        min-width: 140px;
        font-size: 0.85rem;
    }
    

    
    .game2048-board {
        width: 280px;
        height: 280px;
    }
    


}

@media (max-width: 480px) {
    .games-section {
        padding: 100px 0 60px;
    }
    
    .game-card {
        padding: 20px;
    }
    
    .game-title {
        font-size: 1.25rem;
    }
    
    .game-controls {
        gap: 8px;
    }
    
    .game-btn {
        padding: 12px 20px;
        font-size: 12px;
        min-width: 120px;
        letter-spacing: 0.3px;
    }
    

    
    .game2048-board {
        width: 240px;
        height: 240px;
    }
    

    
    .game2048-tile {
        font-size: 1.25rem;
    }
    
    .game2048-tile[data-value="128"],
    .game2048-tile[data-value="256"],
    .game2048-tile[data-value="512"] {
        font-size: 1rem;
    }
    
    .game2048-tile[data-value="1024"],
    .game2048-tile[data-value="2048"] {
        font-size: 0.875rem;
    }
}



/* Stack Tower Game Styles */
.stack-tower-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
}

#stack-tower-canvas {
    border: 2px solid #1e293b;
    border-radius: var(--radius-md);
    background: #0f172a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Knife Hit Game Styles */
.knife-hit-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
}

#knife-hit-canvas {
    border: none;
    border-radius: var(--radius-md);
    background: #f1f5f9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Footer transparent background */
.footer {
    background: transparent !important;
    backdrop-filter: blur(10px);
}