.game-container {
    padding: 1rem 5%;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    animation: fadeInDown 0.6s ease-out;
}

.btn-back {
    align-self: flex-start;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 1.5rem;
    transition: color 0.2s ease;
    display: inline-block;
}

.header-section {
    text-align: center;
    margin-bottom: 1.5rem;
}

.header-section h2 {
    font-size: 2.2rem;
    color: #fff;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-section p {
    color: var(--text-secondary);
    font-size: 1rem;
    padding: 0 10px;
}

.dashboard {
    width: 100%;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.controls {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

select {
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.7rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn-action {
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    box-shadow: 0 4px 15px var(--accent-glow);
    font-size: 0.95rem;
    min-width: 130px;
}

.btn-action.stop {
    background: #ef4444;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-share {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    font-size: 1rem;
    min-width: unset;
}
.btn-share:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-share.hidden {
    display: none;
}

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

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-color);
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    min-width: 100px;
}

.stat-box.best {
    border: 1px solid rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.05);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.stat-value.highlight {
    color: var(--accent-color);
    text-shadow: 0 0 10px var(--accent-glow);
}

.message {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    min-height: 24px;
    text-align: center;
    transition: all 0.3s ease;
}

.message.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.message.error { color: #ef4444; }
.message.success { color: #10b981; }
.message.warning { color: #f59e0b; }
.message.info { color: #60a5fa; }

.play-area {
    background: var(--surface);
    border-radius: 20px;
    min-height: 450px;
    position: relative;
    overflow: hidden;
    border: 2px solid var(--surface-light);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.play-area.waiting {
    border-color: rgba(255, 255, 255, 0.1);
    pointer-events: none;
    opacity: 0.8;
}

.play-area.ready {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: inset 0 0 50px rgba(59, 130, 246, 0.1);
}

.memory-board {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    transition: all 0.5s ease;
}

.memory-board.grid-3 {
    grid-template-columns: repeat(3, 1fr);
    max-width: 500px;
}

.pad-btn {
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
    background-color: var(--pad-color, #333);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.5), 0 4px 10px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    touch-action: manipulation; /* Prevents double-tap zoom on mobile */
    user-select: none; /* Prevents text selection on rapid tapping */
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent; /* Removes blue flash on mobile tap */
}

.pad-btn::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 50%);
    pointer-events: none;
}

.pad-btn:active, .pad-btn.lit {
    opacity: 1;
    transform: scale(0.95);
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 30px var(--pad-color, #fff), inset 0 0 30px var(--pad-color, #fff);
    z-index: 2;
}

/* Colors for the pads */
.pad-0 { --pad-color: #ef4444; } /* Red */
.pad-1 { --pad-color: #3b82f6; } /* Blue */
.pad-2 { --pad-color: #10b981; } /* Green */
.pad-3 { --pad-color: #f59e0b; } /* Yellow */
.pad-4 { --pad-color: #8b5cf6; } /* Purple */
.pad-5 { --pad-color: #ec4899; } /* Pink */
.pad-6 { --pad-color: #06b6d4; } /* Cyan */
.pad-7 { --pad-color: #f97316; } /* Orange */

/* Shuffling animations */
.shuffling .pad-btn {
    pointer-events: none;
}

/* Distractor Elite Mode */
@keyframes distractor-shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

@keyframes distractor-glitch {
    0% { filter: hue-rotate(0deg) contrast(1); }
    25% { filter: hue-rotate(90deg) contrast(1.5); }
    50% { filter: hue-rotate(180deg) invert(0.2); }
    75% { filter: hue-rotate(270deg) contrast(2); }
    100% { filter: hue-rotate(360deg) contrast(1); }
}

.distractor-active {
    animation: distractor-shake 0.3s cubic-bezier(.36,.07,.19,.97) infinite;
}

.distractor-glitch {
    animation: distractor-glitch 0.2s linear;
}

.countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 11, 20, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.countdown-overlay.hidden {
    display: none;
}

#countdown-text {
    font-size: 8rem;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 30px rgba(59, 130, 246, 0.8);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.screenshot-area {
    width: 100%;
}

@media (max-width: 768px) {
    .dashboard {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }
    .controls {
        justify-content: center;
        gap: 0.5rem;
    }
    select { 
        flex: 1; 
        min-width: 0;
    }
    .btn-action { 
        flex: 1; 
        min-width: 0;
        font-size: 0.85rem;
    }
    .btn-share {
        flex: 1 1 100%;
    }
    .stats {
        flex-wrap: nowrap;
        justify-content: center;
        gap: 0.5rem;
    }
    .stat-box { 
        flex: 1; 
        min-width: 0;
        padding: 0.5rem;
    }
    .stat-label {
        font-size: 0.65rem;
    }
    .stat-value {
        font-size: 1.1rem;
    }
    
    .play-area {
        min-height: 300px;
        padding: 10px;
    }

    .memory-board {
        gap: 10px;
    }
}
