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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
}

h1 {
    text-align: center;
    color: white;
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    letter-spacing: 8px;
}

.game-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.game-board {
    position: relative;
    background: #1a1a2e;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#tetris {
    display: block;
    border: 3px solid #0f3460;
    background: #0f0f1e;
    border-radius: 5px;
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 10px;
    text-align: center;
    border: 3px solid #e94560;
}

.game-over h2 {
    color: #e94560;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.game-over p {
    color: white;
    font-size: 1.2em;
}

.hidden {
    display: none;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 200px;
}

.info-panel {
    background: #1a1a2e;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.info-panel h3 {
    color: #16213e;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#next-piece {
    display: block;
    margin: 0 auto;
    background: #0f0f1e;
    border: 2px solid #0f3460;
    border-radius: 5px;
}

.stat-value {
    color: white;
    font-size: 2em;
    font-weight: bold;
    text-align: center;
    padding: 10px;
    background: #0f3460;
    border-radius: 5px;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 12px 20px;
    font-size: 1em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.instructions {
    background: #1a1a2e;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.instructions h3 {
    color: #16213e;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.instructions ul {
    list-style: none;
    color: white;
    font-size: 0.9em;
}

.instructions li {
    padding: 5px 0;
    border-bottom: 1px solid #0f3460;
}

.instructions li:last-child {
    border-bottom: none;
}

.instructions strong {
    color: #667eea;
    display: inline-block;
    min-width: 80px;
}

/* Responsive Design */
@media (max-width: 768px) {
    h1 {
        font-size: 2em;
        letter-spacing: 4px;
    }

    .game-container {
        flex-direction: column;
        align-items: center;
    }

    .sidebar {
        width: 100%;
        max-width: 320px;
    }
}

/* Animation für gelöschte Zeilen */
@keyframes line-clear {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.line-clearing {
    animation: line-clear 0.3s ease-in-out;
}

/* Mobile Touch Controls */
.mobile-controls {
    display: none; /* Standardmäßig versteckt */
    margin-top: 15px;
    padding: 15px;
    background: rgba(26, 26, 46, 0.8);
    border-radius: 10px;
}

.controls-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

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

.touch-btn {
    width: 70px;
    height: 70px;
    font-size: 2em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.touch-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.rotate-btn {
    width: 90px;
    font-size: 2.5em;
}

/* Touch Controls nur auf Mobilgeräten anzeigen */
@media (max-width: 768px) {
    .mobile-controls {
        display: block;
    }

    .instructions {
        display: none; /* Verstecke Tastatur-Anleitung auf Mobile */
    }

    #tetris {
        max-width: 100%;
        height: auto;
    }

    .game-board {
        width: 100%;
    }
}

/* Landscape-Modus auf Smartphones */
@media (max-width: 768px) and (orientation: landscape) {
    .game-container {
        flex-direction: row;
    }

    .mobile-controls {
        margin-top: 0;
        margin-left: 10px;
    }

    .sidebar {
        display: none; /* Verstecke Sidebar im Landscape */
    }

    h1 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
}

/* Sehr kleine Bildschirme */
@media (max-width: 400px) {
    .touch-btn {
        width: 60px;
        height: 60px;
        font-size: 1.8em;
    }

    .rotate-btn {
        width: 80px;
        font-size: 2.2em;
    }
}

/* Portrait auf Tablets */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {
    .mobile-controls {
        display: block;
    }
}
