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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(to bottom, #FDB863 0%, #FDB863 33.33%, #006A44 33.33%, #006A44 66.66%, #C1272D 66.66%, #C1272D 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    position: relative;
    overflow: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, 
        rgba(253, 184, 99, 0.9) 0%, 
        rgba(253, 184, 99, 0.9) 33.33%, 
        rgba(0, 106, 68, 0.9) 33.33%, 
        rgba(0, 106, 68, 0.9) 66.66%, 
        rgba(193, 39, 45, 0.9) 66.66%, 
        rgba(193, 39, 45, 0.9) 100%);
    z-index: -1;
}

.game-container {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.game-container.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    animation: explode 1s ease-out forwards;
}

@keyframes explode {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: scale(0) translate(var(--vx, 50px), var(--vy, 50px));
        opacity: 0;
    }
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.game-header h1 {
    font-size: 2.5em;
    font-weight: bold;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
    margin-bottom: 15px;
    background: linear-gradient(45deg, #FFD700, #FFA500, #FF6B6B);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5)); }
    to { filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8)); }
}

.score-display {
    display: flex;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 10px;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-item .label {
    font-size: 0.8em;
    opacity: 0.8;
    margin-bottom: 5px;
}

.score-item span:last-child {
    font-size: 1.2em;
    font-weight: bold;
}

.game-board {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-start;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.hold-piece, .next-piece {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 15px;
    min-width: 120px;
}

.hold-piece h3, .next-piece h3 {
    margin-bottom: 10px;
    font-size: 1em;
    opacity: 0.9;
}

#holdCanvas, #nextCanvas {
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
}

.controls-info {
    text-align: center;
    margin-top: 20px;
    opacity: 0.8;
    font-size: 0.9em;
}

.power-up {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    animation: powerUpPulse 2s ease-in-out infinite;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

@keyframes powerUpPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
}

.power-up.bomb { background: radial-gradient(circle, #ff4444, #cc0000); }
.power-up.clear { background: radial-gradient(circle, #44ff44, #00cc00); }
.power-up.slow { background: radial-gradient(circle, #4444ff, #0000cc); }
.power-up.multi { background: radial-gradient(circle, #ff44ff, #cc00cc); }

.streak-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.2em;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    animation: streakGlow 1s ease-in-out infinite alternate;
    z-index: 1002;
}

@keyframes streakGlow {
    from { box-shadow: 0 0 10px rgba(255, 107, 107, 0.5); }
    to { box-shadow: 0 0 20px rgba(255, 107, 107, 0.8); }
}

.t-spin-effect {
    position: fixed;
    font-size: 3em;
    font-weight: bold;
    color: #ff44ff;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
    animation: tSpinAnimation 2s ease-out forwards;
    pointer-events: none;
    z-index: 1003;
}

@keyframes tSpinAnimation {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    20% {
        transform: scale(1.5) rotate(180deg);
        opacity: 1;
    }
    80% {
        transform: scale(1.2) rotate(360deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 0;
    }
}

.pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    font-size: 3em;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.music-visualizer {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 3px;
    align-items: flex-end;
    height: 50px;
    z-index: 1000;
}

.music-bar {
    width: 4px;
    background: linear-gradient(to top, #ff6b6b, #4ecdc4);
    border-radius: 2px;
    animation: musicPulse 1s ease-in-out infinite;
}

@keyframes musicPulse {
    0%, 100% { height: 10px; }
    50% { height: var(--bar-height, 30px); }
}

.transformer-glow {
    animation: transformerGlow 1s ease-in-out infinite alternate;
}

@keyframes transformerGlow {
    from { 
        filter: hue-rotate(0deg) brightness(1.2);
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    }
    to { 
        filter: hue-rotate(360deg) brightness(1.5);
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
    }
}

.new-piece-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1);
    color: white;
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 1.5em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: newPieceAnimation 3s ease-out forwards;
    z-index: 1004;
    pointer-events: none;
}

@keyframes newPieceAnimation {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

.combo-text {
    position: fixed;
    font-size: 2em;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: comboAnimation 1.5s ease-out forwards;
    pointer-events: none;
    z-index: 1001;
}

@keyframes comboAnimation {
    0% {
        transform: scale(0.5) translateY(0);
        opacity: 0;
    }
    20% {
        transform: scale(1.2) translateY(-20px);
        opacity: 1;
    }
    100% {
        transform: scale(1) translateY(-100px);
        opacity: 0;
    }
}

#gameCanvas.flash {
    animation: flash 0.3s ease-in-out;
}

@keyframes flash {
    0%, 100% { 
        border-color: rgba(255, 255, 255, 0.4);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.1);
    }
    50% { 
        border-color: #FFD700;
        box-shadow: 0 10px 30px rgba(255, 215, 0, 0.8), inset 0 0 30px rgba(255, 215, 0, 0.3);
    }
}
