/* CSS Variables */
:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --card-bg: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.8);
  --border-radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.2);
  --shadow-heavy: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #0A0A23;
    color: #FFFFFF;
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Game Main Layout */
.game-main {
    padding: 20px;
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-layout {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    gap: 30px;
    max-width: 1000px;
    width: 100%;
    align-items: start;
}

/* Left Panel - Stats */
.left-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.stats-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-box {
    background: linear-gradient(135deg, #003566, #001D3D);
    border: 2px solid #00B4DB;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: #00B4DB;
}

.next-piece-container {
    background: linear-gradient(135deg, #003566, #001D3D);
    border: 2px solid #00B4DB;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.next-piece-container h3 {
    margin-bottom: 10px;
    color: #00B4DB;
}

#nextCanvas {
    background: #001D3D;
    border: 1px solid #003566;
    border-radius: 5px;
}

/* Center - Game Board */
.game-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

#gameCanvas {
    background: #001D3D;
    border: 3px solid #00B4DB;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 180, 219, 0.3);
}

.game-controls {
    display: flex;
    gap: 15px;
}

.control-btn {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Right Panel - Controls */
.right-panel {
    display: flex;
    flex-direction: column;
}

.controls-info {
    background: linear-gradient(135deg, #003566, #001D3D);
    border: 2px solid #00B4DB;
    border-radius: 10px;
    padding: 20px;
}

.controls-info h3 {
    margin-bottom: 15px;
    color: #00B4DB;
    text-align: center;
}

.control-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 0;
}

.key {
    background: #001D3D;
    border: 1px solid #00B4DB;
    border-radius: 4px;
    padding: 4px 8px;
    font-family: monospace;
    font-size: 0.9rem;
    color: #00B4DB;
}

.desc {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Modals */
.game-over-modal, .pause-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 35, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(135deg, #003566, #001D3D);
    border: 2px solid #00B4DB;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #4CAF50;
}

.final-stats {
    margin: 20px 0;
}

.final-stats p {
    font-size: 1.1rem;
    margin: 8px 0;
    color: #00B4DB;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.modal-buttons button {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 20px;
        text-align: center;
    }
    
    .left-panel, .right-panel {
        order: 2;
    }
    
    .game-center {
        order: 1;
    }
    
    .stats-container {
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }
    
    .stat-box {
        flex: 1;
        min-width: 80px;
        padding: 10px;
    }
    
    .stat-value {
        font-size: 1.4rem;
    }
    
    #gameCanvas {
        width: 250px;
        height: 500px;
    }
    
    #nextCanvas {
        width: 80px;
        height: 80px;
    }
    
    .controls-info {
        display: none;
    }
}

@media (max-width: 480px) {
    .game-main {
        padding: 10px;
    }
    
    #gameCanvas {
        width: 200px;
        height: 400px;
    }
    
    .stat-box {
        padding: 8px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .next-piece-container {
        padding: 10px;
    }
    
    #nextCanvas {
        width: 60px;
        height: 60px;
    }
}