/* styles.css */

/* --- Fő Konténer --- */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* --- Header & Score --- */
.blockdoku-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.blockdoku-score {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* --- Státusz üzenet --- */
.blockdoku-status {
    font-size: 1rem;
    padding: 0.5rem 1rem;
    text-align: center;
    color: white;
    font-weight: 500;
    margin-bottom: 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blockdoku-status.success {
    background: #48bb78;
    transform: scale(1.05);
}

.blockdoku-status.error {
    background: #f56565;
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

/* --- Grid Area --- */
.blockdoku-grid-area {
    width: 100%;
    padding: 10px;
    background: #2d3748;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.blockdoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 2px;
    width: 100%;
 
    aspect-ratio: 1;
    position: relative;
}

/* 3x3-as elválasztó vonalak szimulálása */
.blockdoku-grid::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    border: 2px solid transparent;
    /* Itt lehetne finomítani CSS grid gap trükkökkel, de a sima gap is megteszi */
}

/* --- Cellák --- */
.blockdoku .grid-cell {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: background-color 0.2s, transform 0.2s;
    position: relative;
 
    aspect-ratio: 1;
    border: 1px solid transparent;
}

/* Minden 3. oszlop után kis extra tér (opcionális vizuális tuning) */
.blockdoku .grid-cell:nth-child(3n) {
    margin-right: 1px;
}

.blockdoku .grid-cell:nth-child(27n) {
    margin-bottom: 1px;
}

.blockdoku .grid-cell.occupied {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.blockdoku .grid-cell.highlight {
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* --- Törlési Animáció (Engine használja) --- */
.blockdoku .grid-cell.clearing-animation {
    animation: clearCell 0.3s forwards;
    z-index: 10;
    background: #fff !important;
    /* Villanás */
}

@keyframes clearCell {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
        background: #fbbf24;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* --- Tálca (Tray) --- */
.blockdoku-tray {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    margin-top: 2rem;
    min-height: 100px;
    padding: 10px;
}

.blockdoku-piece {
    cursor: grab;
    transition: transform 0.2s;
    padding: 10px;
}

.blockdoku-piece:active {
    cursor: grabbing;
}

/* Ez a "lebegő" klón stílusa drag közben */
/* styles.css */

.blockdoku-piece.is-dragging {


    z-index: 1000;
    opacity: 0.9;
    pointer-events: none !important;
    /* EZ A LEGFONTOSABB: az egér "átlát" rajta */
    touch-action: none;
    will-change: transform;

}

/* --- Belső Grid a Tálca elemeknek --- */
.blockdoku-piece-grid {
    display: grid;
    gap: 1px;
    pointer-events: none;
    /* A drag event a szülőn van */
}

.piece-cell {
    width: 20px;
    /* Kisebb méret a tálcán */
    height: 20px;
    border-radius: 2px;
}

.piece-cell.filled {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.piece-cell.empty {
    background: transparent;
}

/* --- Gombok --- */
button.small {
    padding: 5px 10px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 4px;
    cursor: pointer;
}

button.small:hover {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* --- Mobil optimalizálás --- */
@media (max-width: 480px) {
    .blockdoku-grid {
        gap: 1px;
    }

    .blockdoku-tray {
        margin-top: 1rem;
        gap: 0.5rem;
    }

    /* Mobilon még kisebbek legyenek a tálca elemei */
    .piece-cell {
        width: 15px;
        height: 15px;
    }
}