/* ========================================
   StackStorm - Modern Minimalist Theme
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    color: #f1f5f9;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Subtle animated background */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    width: 100%;
    max-width: 1600px;
    height: 100vh;
    position: relative;
    z-index: 1;
    justify-content: center;
}

/* ===== HEADER ===== */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1.5rem 2rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.brand i {
    font-size: 2rem;
    color: #6366f1;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

.game-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

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

.stat {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    transition: all 0.3s ease;
}

.stat:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 1.5rem;
    color: #6366f1;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f1f5f9;
}

/* ===== GAME AREA ===== */
.game-area {
    display: flex;
    gap: 3rem;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1400px;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 220px;
    flex-shrink: 0;
}

.next-piece, .hold-piece, .controls-info, .high-score {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.next-piece h3, .hold-piece h3, .controls-info h3, .high-score h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

canvas {
    display: block;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.controls-info {
    font-size: 0.85rem;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.control-item:last-child {
    border-bottom: none;
}

.key {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #6366f1;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.75rem;
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    min-width: 45px;
    text-align: center;
}

.high-score-value {
    font-size: 2rem;
    font-weight: 700;
    color: #6366f1;
    text-align: center;
}

/* ===== MAIN GAME AREA ===== */
.main-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    flex-shrink: 0;
}

#gameCanvas {
    width: 420px;
    height: 840px;
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(148, 163, 184, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.4);
}

.game-controls {
    display: flex;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
}

.game-btn {
    flex: 1;
    padding: 1rem 2rem;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 16px rgba(99, 102, 241, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(99, 102, 241, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.2);
}

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

.game-btn i {
    font-size: 1.2rem;
}

/* ===== GAME OVER SCREEN ===== */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-over-content {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: slideUp 0.4s ease;
}

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

.game-over-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #ef4444 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.final-stats {
    font-size: 1.25rem;
    line-height: 2;
    margin-bottom: 2rem;
    color: #cbd5e1;
}

.final-stats span {
    font-weight: 700;
    color: #6366f1;
    font-size: 1.5rem;
}

#restartBtn {
    padding: 1.25rem 3rem;
    font-size: 1.1rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .game-area {
        flex-direction: column;
        align-items: center;
    }
    
    .side-panel {
        flex-direction: row;
        width: 100%;
        max-width: 600px;
    }
    
    .game-stats {
        flex-wrap: wrap;
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 1rem;
        gap: 1rem;
    }
    
    .game-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .brand {
        flex-direction: column;
        text-align: center;
    }
    
    .project-badge {
        position: static;
        margin-top: 0.5rem;
    }
    
    .game-title {
        font-size: 1.5rem;
    }
    
    .stat {
        padding: 0.5rem 1rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .side-panel {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .next-piece, .hold-piece, .controls-info, .high-score {
        flex: 1;
        min-width: calc(50% - 0.5rem);
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.25rem;
    }
    
    .game-stats {
        gap: 0.5rem;
    }
    
    .stat {
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.75rem;
    }
    
    .stat-icon {
        font-size: 1.25rem;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .game-over-title {
        font-size: 2rem;
    }
    
    .final-stats {
        font-size: 1rem;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.game-container,
.game-header,
.game-btn,
canvas {
    transform: translateZ(0);
    backface-visibility: hidden;
}

.game-btn,
.stat {
    will-change: transform;
}

.game-btn:not(:hover),
.stat:not(:hover) {
    will-change: auto;
}
