
:root {
    --bg-color: #1a1a2e;
    --text-color: #e6e6e6;
    --primary-color: #4cc9f0;
    --secondary-color: #4361ee;
    --accent-color: #f72585;
    --board-color: #16213e;
    --grid-line: rgba(255, 255, 255, 0.05);
    --piece-i: #00f0f0;
    --piece-j: #0000f0;
    --piece-l: #f0a000;
    --piece-o: #f0f000;
    --piece-s: #00f000;
    --piece-t: #a000f0;
    --piece-z: #f00000;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
}

.game-container {
    display: flex;
    gap: 2rem;
    margin: 2rem 0;
}

.game-board {
    position: relative;
    width: 300px;
    height: 600px;
    background-color: var(--board-color);
    border: 8px solid var(--secondary-color);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.grid {
    display: grid;
    grid-template-rows: repeat(20, 1fr);
    grid-template-columns: repeat(10, 1fr);
    width: 100%;
    height: 100%;
}

.grid-cell {
    border: 1px solid var(--grid-line);
}

.piece {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.3),
                inset 0 -3px 0 rgba(0, 0, 0, 0.2),
                inset 0 2px 3px rgba(255, 255, 255, 0.2);
    transition: transform 0.1s ease;
}

.piece.i { background-color: var(--piece-i); }
.piece.j { background-color: var(--piece-j); }
.piece.l { background-color: var(--piece-l); }
.piece.o { background-color: var(--piece-o); }
.piece.s { background-color: var(--piece-s); }
.piece.t { background-color: var(--piece-t); }
.piece.z { background-color: var(--piece-z); }

.side-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 200px;
}

.panel {
    background-color: var(--board-color);
    border: 5px solid var(--secondary-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.next-piece-container {
    height: 120px;
    margin-bottom: 1rem;
    position: relative;
}

.next-piece-grid {
    display: grid;
    grid-template-rows: repeat(4, 1fr);
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
    height: 100%;
}

.next-piece-cell {
    border: 1px solid var(--grid-line);
}

.score-display {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.level-display {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.lines-display {
    font-size: 1.2rem;
}

h1 {
    color: var(--primary-color);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

.controls {
    margin-top: 1rem;
    text-align: center;
}

button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    margin: 0.5rem;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

button:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.game-over.show {
    opacity: 1;
    pointer-events: all;
}

.game-over h2 {
    color: var(--accent-color);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.game-over p {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.mobile-controls {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 10px;
    margin-top: 20px;
    width: 300px;
}

.mobile-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.2rem;
    cursor: pointer;
    user-select: none;
}

.mobile-btn:active {
    background-color: var(--primary-color);
}

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

.left-btn {
    grid-column: 1;
    grid-row: 2;
}

.down-btn {
    grid-column: 2;
    grid-row: 2;
}

.right-btn {
    grid-column: 3;
    grid-row: 2;
}

.drop-btn {
    grid-column: 3;
    grid-row: 1;
}

@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
        align-items: center;
    }

    .side-panel {
        width: 300px;
        gap: 1rem;
    }

    .mobile-controls {
        display: grid;
    }
}

/* Animation für gelöschte Reihen */
@keyframes rowClear {
    0% { background-color: white; }
    50% { background-color: var(--accent-color); }
    100% { background-color: white; }
}

.row-clearing {
    animation: rowClear 0.5s ease;
}