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

body {
    font-family: Arial, sans-serif;
    background-color: #0f172a;
    color: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.game-container {
    display: flex;
    flex-direction: column;
    max-width: 800px;
    width: 100%;
    padding: 1rem;
    margin: 0 auto;
}

.game-header {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
    background-color: #1e293b;
    padding: 0.75rem;
    border-radius: 0.5rem;
}

.score-container, .level-container, .rows-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label, .level-label, .rows-label {
    font-size: 0.875rem;
    color: #94a3b8;
}

#score, #level, #rows {
    font-size: 1.25rem;
    font-weight: bold;
    color: #38bdf8;
}

.game-area {
    position: relative;
    background-color: #1e293b;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

#tetris-board {
    display: block;
    margin: 0 auto;
    background-color: rgba(15, 23, 42, 0.7);
}

.game-sidebar {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    background-color: #1e293b;
    border-radius: 0.5rem;
}

.next-piece-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.next-piece-label {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

#next-piece {
    background-color: rgba(15, 23, 42, 0.5);
}

.controls-help {
    font-size: 0.75rem;
    color: #94a3b8;
}

.controls-help ul {
    list-style-type: none;
    margin-top: 0.5rem;
}

.controls-help li {
    margin-bottom: 0.25rem;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.game-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.game-overlay h1 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #3b82f6, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.game-overlay h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: white;
}

.game-overlay p {
    margin-bottom: 1.5rem;
    max-width: 24rem;
}

.game-overlay button {
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    margin: 0.5rem;
    transition: background-color 0.2s;
}

.game-overlay button:hover {
    background-color: #2563eb;
}

/* Touch Controls */
.touch-controls {
    position: fixed;
    bottom: 1rem;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    max-width: 30rem;
    margin: 0 auto;
    z-index: 20;
    pointer-events: auto;
}

.left-controls, .right-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.direction-buttons {
    display: flex;
    gap: 0.5rem;
}

.touch-controls button {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    background-color: #334155;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: background-color 0.2s;
}

.touch-controls button:hover, .touch-controls button:active {
    background-color: #475569;
}

#rotate-btn {
    margin-bottom: 0.5rem;
}

#rotate-btn2 {
    background-color: #3b82f6;
}

#rotate-btn2:hover, #rotate-btn2:active {
    background-color: #2563eb;
}

#hard-drop-btn {
    background-color: #ef4444;
}

#hard-drop-btn:hover, #hard-drop-btn:active {
    background-color: #dc2626;
}

#pause-btn {
    background-color: #1e293b;
}

#pause-btn:hover, #pause-btn:active {
    background-color: #334155;
}

/* Media Queries */
@media (min-width: 768px) {
    .game-container {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .game-header {
        flex-direction: column;
        margin-right: 1rem;
        margin-bottom: 0;
    }
    
    .score-container, .level-container, .rows-container {
        margin-bottom: 1rem;
    }
    
    .game-area {
        flex-grow: 1;
    }
    
    .game-sidebar {
        margin-left: 1rem;
    }
    
    .touch-controls {
        display: none;
    }
}