/* Game Page Styles */

:root {
    --primary-gradient: linear-gradient(135deg, #0f7a4c 0%, #0b5f3b 100%);
    --secondary-gradient: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    --accent-color: #ffd700;
    --game-bg: #f0fdf4;
    --card-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

body.game-page {
    background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

body.game-page::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 2px, transparent 2px);
    background-size: 40px 40px;
    animation: float 20s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.game-main {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 2rem 0;
    position: relative;
    z-index: 1;
}

.navbar, footer {
    position: relative;
    z-index: 1;
}

/* Game Card */
.game-card-wrapper {
    background: #1e293b;
    border-radius: 24px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    border: 4px solid #334155;
    position: relative;
}

.game-card-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 20px;
    padding: 4px;
    background: var(--primary-gradient);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 2;
}

/* Header / HUD */
.game-header {
    background: #0f172a;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #334155;
}

.game-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #f8fafc;
    display: flex;
    align-items: center;
}

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

.stat-pill {
    background: #1e293b;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    border: 2px solid #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #4ade80;
}

/* Game Stage */
.game-stage-container {
    background: #0f172a;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.snake-canvas-wrap {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1;
    margin: 0 auto;
}

.snake-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: white;
    cursor: crosshair;
}

/* Overlay */
.game-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    animation: fadeIn 0.3s ease;
}

.overlay-content {
    background: white;
    padding: 2.5rem;
    border-radius: 24px;
    text-align: center;
    max-width: 90%;
    width: 450px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    border: 4px solid #e2e8f0;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay-icon {
    font-size: 3.5rem;
    color: #0f7a4c;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

.overlay-title {
    font-size: 2rem;
    font-weight: 900;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.overlay-subtitle {
    font-size: 1.1rem;
    color: #64748b;
    margin-bottom: 2rem;
}

/* Controls Guide */
.controls-guide {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
}

.control-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #64748b;
    font-size: 0.9rem;
}

.control-divider {
    font-weight: 800;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.key-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.key-row {
    display: flex;
    gap: 4px;
}

.key {
    width: 32px;
    height: 32px;
    background: white;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    color: #475569;
    box-shadow: 0 3px 0 #cbd5e1;
    font-size: 0.85rem;
}

/* Buttons */
.play-button {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 10px 20px rgba(15, 122, 76, 0.3);
    width: 100%;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.play-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(15, 122, 76, 0.4);
}

.play-button:active {
    transform: translateY(-1px);
}

.secondary-button {
    display: inline-block;
    color: #64748b;
    text-decoration: none;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: color 0.2s;
}

.secondary-button:hover {
    color: #1e293b;
    background: #f1f5f9;
}

/* Footer Controls */
.game-footer {
    padding: 1rem 1.5rem;
    background: #0f172a;
    border-top: 2px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-link {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: #f8fafc;
}

.game-controls-hint {
    font-size: 0.9rem;
    color: #94a3b8;
    display: flex;
    gap: 1rem;
}

.control-btn {
    background: #334155;
    color: #f1f5f9;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.control-btn:hover {
    background: #475569;
    transform: translateY(-2px);
    color: white;
}

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

/* Animations */
@keyframes popIn {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.pulse-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(15, 122, 76, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(15, 122, 76, 0); }
    100% { box-shadow: 0 0 0 0 rgba(15, 122, 76, 0); }
}

/* Responsive */
@media (max-width: 768px) {
    .overlay-content {
        padding: 1.5rem;
        width: 90%;
    }
    
    .game-title span {
        display: none;
    }
    
    .game-header {
        padding: 0.75rem 1rem;
    }
    
    .game-footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}
