/* ============================================
   TETRIS EFFECTS - Main Stylesheet
   Mobile-first responsive design
   ============================================ */

:root {
    --primary-bg: #0a0a1a;
    --panel-bg: rgba(20, 20, 40, 0.9);
    --accent-cyan: #00f0ff;
    --accent-pink: #ff00ff;
    --accent-purple: #8b5cf6;
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --glow-cyan: 0 0 20px rgba(0, 240, 255, 0.5);
    --glow-pink: 0 0 20px rgba(255, 0, 255, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--primary-bg);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-primary);
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#bg-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.game-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    max-width: 100%;
}

/* Side Panels */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel-box {
    background: var(--panel-bg);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 12px;
    padding: 15px;
    box-shadow: var(--glow-cyan);
    backdrop-filter: blur(10px);
}

.panel-box h3 {
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--accent-cyan);
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.8);
}

.panel-box canvas {
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

.stats {
    min-width: 120px;
}

.stats div {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    color: var(--text-primary);
    margin: 5px 0 15px 0;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.stats div:last-child {
    margin-bottom: 0;
}

/* Controls Info */
.controls-info {
    font-size: 12px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    color: var(--text-secondary);
}

.key {
    background: rgba(0, 240, 255, 0.2);
    border: 1px solid var(--accent-cyan);
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-family: monospace;
    color: var(--accent-cyan);
    min-width: 60px;
    text-align: center;
}

/* Main Game Area */
.main-game {
    position: relative;
}

#game-canvas {
    border: 2px solid var(--accent-cyan);
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.3), inset 0 0 30px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.5);
    max-width: 100%;
    height: auto;
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay h2 {
    font-size: 36px;
    color: var(--accent-pink);
    text-shadow: 0 0 20px var(--accent-pink), 0 0 40px var(--accent-pink);
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

.overlay p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

#restart-btn {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    border: none;
    border-radius: 8px;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
}

#restart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.8);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Audio Toggle */
.audio-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

#audio-btn {
    background: var(--panel-bg);
    border: 1px solid var(--accent-cyan);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: var(--glow-cyan);
    transition: transform 0.2s;
}

#audio-btn:hover {
    transform: scale(1.1);
}

#audio-btn.muted {
    opacity: 0.5;
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    gap: 10px;
    align-items: center;
}

.touch-area {
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 12px;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    user-select: none;
}

.touch-area:active {
    background: rgba(0, 240, 255, 0.4);
    transform: scale(0.95);
}

.touch-area svg {
    width: 30px;
    height: 30px;
    color: var(--accent-cyan);
}

.touch-center {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#touch-hold {
    width: 60px;
    height: 60px;
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--accent-pink);
    border-color: var(--accent-pink);
    background: rgba(255, 0, 255, 0.15);
}

#touch-hold:active {
    background: rgba(255, 0, 255, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-wrapper {
        gap: 10px;
        padding: 10px;
    }
    
    .side-panel {
        gap: 10px;
    }
    
    .panel-box {
        padding: 10px;
    }
    
    .panel-box h3 {
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    #hold-canvas, #next-canvas {
        width: 80px !important;
        height: 80px !important;
    }
    
    .stats {
        min-width: 80px;
    }
    
    .stats div {
        font-size: 18px;
    }
    
    .controls-info {
        display: none;
    }
    
    #game-canvas {
        width: 240px;
        height: 480px;
    }
    
    .mobile-controls {
        display: flex;
    }
    
    .overlay h2 {
        font-size: 28px;
    }
    
    .overlay p {
        font-size: 16px;
    }
}

@media (max-width: 400px) {
    .game-wrapper {
        gap: 5px;
        padding: 5px;
    }
    
    #game-canvas {
        width: 200px;
        height: 400px;
    }
    
    #hold-canvas, #next-canvas {
        width: 60px !important;
        height: 60px !important;
    }
    
    .panel-box h3 {
        font-size: 10px;
    }
    
    .stats div {
        font-size: 14px;
    }
    
    .touch-area {
        width: 55px;
        height: 55px;
    }
    
    .touch-area svg {
        width: 24px;
        height: 24px;
    }
    
    #touch-hold {
        width: 50px;
        height: 50px;
        font-size: 9px;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .game-wrapper {
        flex-direction: row;
        align-items: center;
    }
    
    .side-panel {
        flex-direction: row;
    }
    
    #game-canvas {
        width: 180px;
        height: 360px;
    }
    
    .mobile-controls {
        bottom: 10px;
    }
    
    .touch-area {
        width: 50px;
        height: 50px;
    }
}
