html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #1a1a2e;
    touch-action: none; /* Prevent default touch actions like scrolling */
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: 'Press Start 2P', cursive;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #e0e0e0;
    box-sizing: border-box;
}

.main-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    height: 100%;
    width: 100%;
    max-width: 600px;
    padding: 10px;
    box-sizing: border-box;
}

.game-container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    border: 3px solid #00bcd4;
    background-color: #16213e;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 188, 212, 0.4);
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
    width: 100%;
    flex-grow: 1; /* Allow it to grow to fill screen */
}

canvas#tetrisCanvas {
    border: 1px solid #0f3460;
    background-color: #000;
    display: block;
    box-sizing: border-box;
    /* Margin bottom to separate from info */
    margin-bottom: 10px;
}

.info {
    margin-left: 0;
    margin-top: auto; /* Push to bottom if there's space, or just flow naturally */
    width: 100%;
    height: auto;
    padding: 5px 10px;
    background-color: #0f3460;
    border-radius: 8px;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    box-sizing: border-box;
}

.info h2, .info h3 {
    display: none; /* Hide titles */
}

.stats {
    width: auto;
    margin-bottom: 0;
    display: flex;
    gap: 15px;
}

.info p {
    margin: 0;
    font-size: 0.6em;
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.info span {
    font-weight: normal;
    color: #ff9800;
    font-size: 1.2em;
    margin-top: 2px;
}

canvas#nextPieceCanvas {
    display: block;
    border: 1px solid #0f3460;
    background-color: #000;
    margin-bottom: 0;
    width: 60px; /* Smaller preview */
    height: 60px;
}

/* Pause button inside info */
#pauseBtn {
    margin-top: 0;
    margin-left: 10px;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.9);
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 1.5em;
    text-align: center;
    border-radius: 10px;
    z-index: 10;
    display: none;
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.overlay.active {
    display: flex;
    pointer-events: auto;
    opacity: 1;
}

.overlay button {
    margin-top: 20px;
    padding: 15px 30px;
    font-size: 0.7em;
    cursor: pointer;
    background-color: #00bcd4;
    color: #1a1a2e;
    border: none;
    border-radius: 5px;
    font-family: 'Press Start 2P', cursive;
}

#version-info {
    position: fixed;
    bottom: 5px;
    right: 5px;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.5em;
    z-index: 5;
    pointer-events: none;
}

/* Landscape adjustments if user rotates phone */
@media (orientation: landscape) and (max-height: 500px) {
    .main-wrapper {
        flex-direction: row;
        justify-content: center;
    }
    .game-container {
        width: auto;
        height: 100%;
        margin-right: 20px;
    }
}
