* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: manipulation;
}

body {
    overflow: hidden;
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    height: 100vh;
    background: #000;
    position: fixed;
    width: 100%;
}

.universe {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);
    overflow: hidden;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    max-width: 100%;
    max-height: 100%;
    padding: 10px;
    overflow: hidden;
}

.game-board {
    background-color: rgba(0, 0, 20, 0.7);
    border: 3px solid #4d4dff;
    border-radius: 5px;
    box-shadow: 0 0 20px #4d4dff, inset 0 0 20px #4d4dff;
    display: grid;
    grid-template-rows: repeat(20, 1fr);
    grid-template-columns: repeat(10, 1fr);
    flex-shrink: 0;
}

.side-panel {
    background-color: rgba(0, 0, 30, 0.7);
    border: 3px solid #4d4dff;
    border-radius: 5px;
    box-shadow: 0 0 20px #4d4dff, inset 0 0 20px #4d4dff;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: auto;
    flex-shrink: 0;
}

h1 {
    font-family: 'Press Start 2P', cursive;
    font-size: 22px;
    color: #4d4dff;
    text-shadow: 0 0 10px #4d4dff;
    text-align: center;
    margin-bottom: 10px;
    line-height: 1.3;
}

h3 {
    color: #4d4dff;
    text-shadow: 0 0 5px #4d4dff;
    margin-bottom: 8px;
    font-size: 16px;
}

.score-display {
    background: rgba(0, 0, 50, 0.5);
    border: 1px solid #4d4dff;
    border-radius: 5px;
    padding: 8px;
}

.score, .level, .lines {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 16px;
}

.highscore {
    margin-top: 15px;
    font-size: 18px;
    color: #ffcc00;
    text-shadow: 0 0 5px #ffcc00;
    white-space: nowrap;
    overflow: visible;
    display: flex;
    justify-content: space-between;
}

.next-piece {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 50, 0.5);
    border: 1px solid #4d4dff;
    border-radius: 5px;
    padding: 8px;
}

.controls {
    background: rgba(0, 0, 50, 0.5);
    border: 1px solid #4d4dff;
    border-radius: 5px;
    padding: 8px;
    flex-grow: 1;
}

.controls ul {
    list-style-type: none;
    padding-left: 10px;
}

.controls li {
    margin-bottom: 4px;
    font-size: 14px;
}

.neon-button {
    background: rgba(0, 0, 50, 0.5);
    border: 2px solid #4d4dff;
    color: #fff;
    padding: 10px 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
    box-shadow: 0 0 10px #4d4dff;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 100%;
}

.neon-button:hover {
    background: #4d4dff;
    box-shadow: 0 0 20px #4d4dff, 0 0 40px #4d4dff;
    transform: translateY(-2px);
}

.neon-button:active {
    transform: translateY(1px);
}

.cell {
    border: 1px solid rgba(77, 77, 255, 0.1);
}

.I { background-color: #00f0f0; box-shadow: inset 0 0 10px #00f0f0, 0 0 10px #00f0f0; }
.J { background-color: #0000f0; box-shadow: inset 0 0 10px #0000f0, 0 0 10px #0000f0; }
.L { background-color: #f0a000; box-shadow: inset 0 0 10px #f0a000, 0 0 10px #f0a000; }
.O { background-color: #f0f000; box-shadow: inset 0 0 10px #f0f000, 0 0 10px #f0f000; }
.S { background-color: #00f000; box-shadow: inset 0 0 10px #00f000, 0 0 10px #00f000; }
.T { background-color: #a000f0; box-shadow: inset 0 0 10px #a000f0, 0 0 10px #a000f0; }
.Z { background-color: #f00000; box-shadow: inset 0 0 10px #f00000, 0 0 10px #f00000; }

@keyframes flash {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

.line-clear {
    animation: flash 0.3s ease-in-out;
}

@media (max-width: 700px) {
    .game-container {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        width: 100%;
        height: auto;
    }
    
    .game-board, .side-panel {
        width: 100%;
        max-width: 300px;
        height: auto;
        aspect-ratio: 1/2;
    }
    
    h1 {
        font-size: 18px;
    }
    
    .controls li {
        font-size: 13px;
    }
    
    .score, .level, .lines, .highscore {
        font-size: 15px;
    }
}

@media (max-height: 600px) {
    .game-container {
        transform: scale(0.8);
    }
}