/* 2048 Game Styles */

/* Game Container */
.game-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
    position: relative;
    overflow: hidden;
}

/* Animated Background Elements */
.game-bg-element {
    position: absolute;
    border-radius: 20px;
    opacity: 0.15;
    animation: rotateAndShift 20s ease-in-out infinite;
    z-index: -1;
}

.game-bg-element-1 {
    top: 10%;
    left: 5%;
    width: 180px;
    height: 180px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 400% 400%;
    animation-delay: 0s;
}

.game-bg-element-2 {
    top: 60%;
    right: 10%;
    width: 140px;
    height: 140px;
    background: linear-gradient(45deg, #feca57, #ff9ff3, #54a0ff, #5f27cd);
    background-size: 400% 400%;
    animation-delay: -7s;
    animation-direction: reverse;
}

.game-bg-element-3 {
    bottom: 15%;
    left: 15%;
    width: 120px;
    height: 120px;
    background: linear-gradient(45deg, #00d2d3, #ff9f43, #10ac84, #ee5a24);
    background-size: 400% 400%;
    animation-delay: -14s;
}

.game-bg-element-4 {
    top: 30%;
    right: 25%;
    width: 100px;
    height: 100px;
    background: linear-gradient(45deg, #ff3838, #ff6348, #ff4757, #ff3742);
    background-size: 400% 400%;
    animation-delay: -3s;
}

@keyframes rotateAndShift {
    0% {
        transform: rotate(0deg) scale(1);
        background-position: 0% 50%;
    }
    25% {
        transform: rotate(90deg) scale(1.1);
        background-position: 100% 50%;
    }
    50% {
        transform: rotate(180deg) scale(0.9);
        background-position: 100% 100%;
    }
    75% {
        transform: rotate(270deg) scale(1.05);
        background-position: 0% 100%;
    }
    100% {
        transform: rotate(360deg) scale(1);
        background-position: 0% 50%;
    }
}

.game-wrapper {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    /* Center the wrapper content without affecting the overall layout */
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

/* Game Controls & Stats */
.game-controls-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 500px;
}

.game-controls {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.game-btn {
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border);
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.game-btn:hover {
    background: var(--hover-bg);
    border-color: var(--primary-500);
    transform: translateY(-1px);
}

/* New Game Button - Primary Color */
#new-game-btn {
    background: var(--primary-600);
    color: var(--white);
    border-color: var(--primary-600);
    min-width: 100px;
    white-space: nowrap;
}

#new-game-btn:hover {
    background: var(--primary-700);
    border-color: var(--primary-700);
    transform: translateY(-1px);
}

/* Undo Button - Neutral Color */
#undo-btn {
    background: var(--neutral-600);
    color: var(--white);
    border-color: var(--neutral-600);
    min-width: 60px;
    white-space: nowrap;
}

#undo-btn:hover {
    background: var(--neutral-700);
    border-color: var(--neutral-700);
    transform: translateY(-1px);
}

.game-btn.primary {
    background: var(--primary-600);
    color: var(--white);
    border-color: var(--primary-600);
}

.game-btn.primary:hover {
    background: var(--primary-700);
    border-color: var(--primary-700);
}

/* Game Board Frame */
.game-board-frame {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px var(--shadow);
    overflow: hidden;
    width: 100%;
    max-width: 500px;
}

/* Board Header */
.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.5rem;
    background: var(--neutral-50);
    border-bottom: 1px solid var(--border);
}

.board-controls {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    justify-content: space-between;
}

.game-btn {
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.game-btn:hover {
    background: var(--hover-bg);
    border-color: var(--primary-500);
    transform: translateY(-1px);
}

.game-btn.primary {
    background: var(--primary-600);
    color: var(--white);
    border-color: var(--primary-600);
}

.game-btn.primary:hover {
    background: var(--primary-700);
    border-color: var(--primary-700);
}

/* Game Board */
.game-board-container {
    position: relative;
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 0.75rem;
    background: var(--warm-200);
    padding: 0.75rem;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
    position: relative;
    margin: 0 auto;
}

.game-cell {
    background: var(--warm-100);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
}

.game-tile {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    background: var(--tile-bg);
    color: var(--tile-text);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    transition: all 0.15s ease;
    z-index: 1;
}

/* Board Footer */
.board-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--neutral-50);
    border-top: 1px solid var(--border);
}

.game-stats {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    width: 100%;
}

.stat-item {
    text-align: center;
    background: var(--surface);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    flex: 1;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Tile Colors - Better Progression */
.tile-2 { --tile-bg: var(--neutral-100); --tile-text: var(--text-primary); }
.tile-4 { --tile-bg: var(--accent-100); --tile-text: var(--accent-800); }
.tile-8 { --tile-bg: var(--primary-100); --tile-text: var(--primary-800); }
.tile-16 { --tile-bg: var(--accent-200); --tile-text: var(--accent-900); }
.tile-32 { --tile-bg: var(--primary-200); --tile-text: var(--primary-900); }
.tile-64 { --tile-bg: var(--accent-300); --tile-text: var(--white); }
.tile-128 { --tile-bg: var(--primary-300); --tile-text: var(--white); }
.tile-256 { --tile-bg: var(--accent-400); --tile-text: var(--white); }
.tile-512 { --tile-bg: var(--primary-400); --tile-text: var(--white); }
.tile-1024 { --tile-bg: var(--accent-500); --tile-text: var(--white); }
.tile-2048 { --tile-bg: var(--primary-500); --tile-text: var(--white); }
.tile-4096 { --tile-bg: var(--accent-600); --tile-text: var(--white); }

/* Game Overlay */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10;
}

.game-overlay.active {
    opacity: 1;
    visibility: visible;
}

.overlay-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    max-width: 300px;
    margin: 1rem;
}

.overlay-content h2 {
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
}

.overlay-content p {
    color: var(--text-secondary);
    margin: 0 0 1.5rem 0;
}

/* Game Header (Moved to bottom) */
.game-header {
    background: linear-gradient(135deg, var(--primary-500), var(--secondary-500));
    color: var(--white);
    padding: 1.5rem 0;
    margin-top: auto;
}

.game-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.game-title-section {
    flex: 1;
}

.game-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    text-shadow: 0 2px 4px var(--text-shadow);
}

.game-description {
    font-size: 0.875rem;
    margin: 0;
    opacity: 0.9;
}

.game-stats {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

.stat-item {
    text-align: center;
    background: var(--surface);
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    min-width: 60px;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-container {
        padding: 0.5rem 0;
    }
    
    .game-wrapper {
        gap: 1rem;
    }
    
    .game-board-frame {
        max-width: 100%;
    }
    
    .board-header {
        padding: 0.75rem 1rem;
    }
    
    .board-controls {
        gap: 0.5rem;
    }
    
    .game-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .game-board-container {
        padding: 1rem;
    }
    
    .game-board {
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .game-tile {
        font-size: 1.25rem;
    }
    
    .board-footer {
        padding: 0.75rem 1rem;
    }
    
    .game-stats {
        gap: 1rem;
        width: 100%;
    }
    
    .stat-item {
        min-width: 60px;
        padding: 0.5rem 0.75rem;
        flex: 1;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .game-header {
        /* Add bottom padding for mobile navbar */
        padding-bottom: calc(1.5rem + 70px + env(safe-area-inset-bottom));
    }
    
    .game-header-content {
        text-align: center;
    }
    
    .game-title {
        font-size: 1.25rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .game-header {
        /* Add bottom padding for tablet navbar */
        padding-bottom: calc(1.5rem + 70px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 480px) {
    .game-wrapper {
        padding: 0 0.5rem;
    }
    
    .game-board-container {
        padding: 0.5rem;
        max-width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .game-board {
        max-width: 100%;
        width: 100%;
        aspect-ratio: 1;
    }
    
    .game-tile {
        font-size: 1rem;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    
    .game-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .game-stats {
        gap: 0.5rem;
    }
    
    .stat-item {
        min-width: 45px;
        padding: 0.5rem 0.25rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .stat-value {
        font-size: 0.9rem;
    }
}

/* Alpha Notification Banner */
.alpha-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--warning-500);
    color: var(--white);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 4px 12px var(--shadow);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    max-width: 90%;
    text-align: center;
}

.alpha-notification.show {
    opacity: 1;
    visibility: visible;
}

.alpha-notification .alpha-icon {
    margin-right: 0.5rem;
    font-weight: bold;
}
