/* Hauptstyling für das Spiel */

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

body {
    font-family: 'Arial', sans-serif;
    background-color: black;
    color: #333;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.game-container {
    width: 100%;
    max-width: 500px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
}

header h1 {
    color: #e91e63;
    margin-bottom: 15px;
    font-size: 28px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: bold;
    color: #e91e63;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background-color: #f0f0f0;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background-color: #e91e63;
    border-radius: 10px;
    transition: width 0.5s ease;
    width: 0%;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-gap: 5px;
    background-color: #ffebee;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.tile {
    width: 100%;
    position: relative;
    padding-bottom: 100%; /* Macht die Kacheln quadratisch */
}

.tile-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 20px;
}

.tile-icon {
    width: 90%;
    height: 90%;
    object-fit: cover;
}

.power-up-icon {
    width: 90%;
    height: 90%;
    object-fit: contain;
}

.tile.selected .tile-content {
    transform: scale(1.1);
    box-shadow: 0 0 0 3px #ffd700;
    z-index: 5;
}

/* WICHTIG: Verbesserte Stile für gematched und neue Kacheln */
.tile.matched .tile-content {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tile.new {
    z-index: 4;
}

.tile.new .tile-content {
    animation: drop-in 0.5s ease-in;
}

@keyframes drop-in {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(0);
    }
}

.tile.blocked .tile-content {
    background-color: #777;
    border: 2px solid #555;
}

/* Power-Up-Animationen */
.power-up-row .tile-content {
    animation: horizontal-shake 1.5s infinite;
    border: 2px solid #ffd700;
}

.power-up-col .tile-content {
    animation: vertical-shake 1.5s infinite;
    border: 2px solid #ffd700;
}

.power-up-bomb .tile-content {
    animation: pulse-grow 1.5s infinite;
    border: 2px solid #ff3d00;
    border-radius: 50%;
}

.power-up-color .tile-content {
    animation: rainbow-pulse 2s infinite;
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Animation Keyframes */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes horizontal-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

@keyframes vertical-shake {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-3px); }
    75% { transform: translateY(3px); }
}

@keyframes pulse-grow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes rainbow-pulse {
    0% { 
        border-color: #FF0000;
        box-shadow: 0 0 5px #FF0000;
    }
    16.666% { 
        border-color: #FF9900;
        box-shadow: 0 0 5px #FF9900;
    }
    33.333% { 
        border-color: #FFFF00;
        box-shadow: 0 0 5px #FFFF00;
    }
    50% { 
        border-color: #00FF00;
        box-shadow: 0 0 5px #00FF00; 
    }
    66.666% { 
        border-color: #0099FF;
        box-shadow: 0 0 5px #0099FF;
    }
    83.333% { 
        border-color: #6633FF;
        box-shadow: 0 0 5px #6633FF;
    }
    100% { 
        border-color: #FF0000;
        box-shadow: 0 0 5px #FF0000;
    }
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.button {
    background-color: #e91e63;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
}

.button:hover {
    background-color: #c2185b;
}

.instructions {
    text-align: left;
    font-size: 14px;
    color: #e91e63;
    margin-top: 15px;
}

.instructions p {
    margin-bottom: 5px;
}

/* Highscore Styling */
.highscore-table {
    margin: 20px 0;
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

table th, table td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
}

table th {
    background-color: #ffebee;
    color: #e91e63;
    font-weight: bold;
}

table tr:nth-child(even) {
    background-color: #fafafa;
}

table tr:hover {
    background-color: #fff5f8;
}

/* Highscore Form */
.highscore-form {
    margin: 20px 0;
    padding: 15px;
    background-color: #ffebee;
    border-radius: 10px;
}

.highscore-form h2 {
    margin-bottom: 15px;
    color: #e91e63;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #e91e63;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    max-width: 80%;
}

.modal-content h2 {
    color: #e91e63;
    margin-bottom: 15px;
}

.modal-content p {
    margin-bottom: 10px;
}

.success-message {
    color: #4caf50;
    font-weight: bold;
    margin: 10px 0;
}

/* Power-Up Aktivierung Animationen */
.power-up-activated {
    z-index: 100;
}

.row-clear-activated::before {
    content: '';
    position: absolute;
    top: 0;
    left: -500%;
    width: 1000%;
    height: 100%;
    background-color: rgba(255, 215, 0, 0.5);
    animation: flash 0.5s;
}

.col-clear-activated::before {
    content: '';
    position: absolute;
    top: -500%;
    left: 0;
    width: 100%;
    height: 1000%;
    background-color: rgba(255, 215, 0, 0.5);
    animation: flash 0.5s;
}

.bomb-activated::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background-color: rgba(255, 61, 0, 0.5);
    border-radius: 50%;
    animation: expand 0.5s;
}

.color-clear-activated {
    animation: rainbow-flash 0.5s;
}

@keyframes flash {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

@keyframes expand {
    0% { transform: scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes rainbow-flash {
    0% { box-shadow: 0 0 50px #FF0000; }
    16% { box-shadow: 0 0 50px #FF9900; }
    33% { box-shadow: 0 0 50px #FFFF00; }
    50% { box-shadow: 0 0 50px #00FF00; }
    66% { box-shadow: 0 0 50px #0099FF; }
    83% { box-shadow: 0 0 50px #6633FF; }
    100% { box-shadow: 0 0 50px #FF0000; }
}

/* Responsive Design */
@media (max-width: 500px) {
    .game-container {
        padding: 10px;
    }
    
    .game-board {
        grid-gap: 3px;
        padding: 5px;
    }
    
    .tile-content {
        font-size: 16px;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    .game-info {
        font-size: 14px;
    }
    
    .instructions {
        font-size: 12px;
    }
}