/* Game Container */
.game-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Game Section */
.game-section {
    background: var(--secondary-bg);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

#tetris {
    display: block;
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
}

/* Game Panel */
.game-panel {
    background: var(--secondary-bg);
    padding: 20px;
    border-radius: 10px;
    min-width: 250px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Board Size Controls */
.board-controls {
    background: var(--primary-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.board-controls h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.2em;
    text-align: center;
}

.size-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.size-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.size-control label {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.size-control select {
    background: var(--secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: 4px;
    width: 80px;
    font-size: 0.9em;
}

.size-control select:focus {
    outline: none;
    border-color: var(--accent-color);
}

#applySize {
    width: 100%;
    margin-top: 10px;
}

/* Next Piece Container */
.next-piece-container {
    text-align: center;
}

.next-piece-container h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.2em;
}

#nextPiece {
    display: block;
    margin: 0 auto;
    background: var(--primary-bg);
    border: 1px solid var(--border-color);
    border-radius: 5px;
}

/* Game Stats */
.game-stats {
    background: var(--primary-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.game-stats h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.2em;
    text-align: center;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 1.1em;
}

.stat-item:last-child {
    margin-bottom: 0;
}

.stat-item span:last-child {
    color: var(--text-primary);
    font-weight: 600;
}

/* Game Controls */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-controls button {
    width: 100%;
    padding: 12px;
    font-size: 1em;
    transition: all 0.3s ease;
}

/* Controls Info */
.controls-info {
    background: var(--primary-bg);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.controls-info h3 {
    color: var(--accent-color);
    margin-bottom: 12px;
    font-size: 1.1em;
    text-align: center;
}

.controls-info p {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.controls-info p:last-child {
    margin-bottom: 0;
}

.controls-info .key {
    background: var(--secondary-bg);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    color: var(--accent-color);
    font-family: monospace;
    min-width: 30px;
    text-align: center;
    font-size: 0.9em;
}

/* Animations */
@keyframes gameOver {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes clearLine {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
        background: var(--accent-color);
    }
    100% {
        opacity: 0;
    }
}

@keyframes levelUp {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
        color: var(--accent-color);
    }
    100% {
        transform: scale(1);
    }
}

/* Animation Classes */
.game-over {
    animation: gameOver 0.5s ease forwards;
}

.clear-line {
    animation: clearLine 0.3s ease forwards;
}

.level-up {
    animation: levelUp 0.5s ease;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .game-container {
        flex-direction: column;
        align-items: center;
        padding: 10px;
        gap: 20px;
    }

    .game-section {
        width: 100%;
        padding: 10px;
    }

    .game-panel {
        width: 100%;
        gap: 15px;
    }

    .size-controls {
        gap: 8px;
    }

    .controls-info {
        padding: 12px;
    }

    .controls-info .key {
        padding: 3px 6px;
        min-width: 25px;
    }
}

/* Utility Classes */
.btn-primary {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-primary:disabled {
    background-color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Prevent selection during gameplay */
.game-container {
    user-select: none;
}

const styles = `
.touch-controls-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: grid;
    grid-template-columns: 25% 50% 25%;
    grid-template-rows: 50% 50%;
    opacity: 0;
    transition: opacity 0.3s;
}

@media (hover: none) and (pointer: coarse) {
    .touch-controls-overlay {
        opacity: 0.3;
    }
}

.touch-region {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--accent-color);
    border: 1px solid rgba(100, 255, 218, 0.1);
}

.touch-region.left {
    grid-column: 1;
    grid-row: 1 / span 2;
}

.touch-region.rotate {
    grid-column: 2;
    grid-row: 1;
}

.touch-region.right {
    grid-column: 3;
    grid-row: 1 / span 2;
}

.touch-region.down {
    grid-column: 2;
    grid-row: 2;
}

.game-section {
    position: relative;
}
