/* CSS for .hidden class fallback when TailwindCSS is blocked */
.hidden {
    display: none !important;
}

/* Responsive utilities fallback */
.block {
    display: block !important;
}

.flex {
    display: flex !important;
}

.items-center {
    align-items: center !important;
}

.justify-center {
    justify-content: center !important;
}

.text-center {
    text-align: center !important;
}

.w-full {
    width: 100% !important;
}

.mx-auto {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Меню */
.menu-bar {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

.how-to-play {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

.start-screen {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

/* Карпатські Пазли - Стилі гри */

body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    padding: 0;
}

/* Фон */
.game-background {
    background: linear-gradient(160deg, #e0eafc 0%, #cfdef3 100%);
}

/* Контейнер */
.main-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Меню */
.menu-bar {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

/* Пазлова дошка */
.puzzle-board {
    display: grid;
    gap: 2px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    margin: 0 auto;
    max-width: 600px;
}

/* Різні розміри сітки для рівнів складності */
.puzzle-board.grid-2x2 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    max-width: 300px;
}

.puzzle-board.grid-3x3 {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    max-width: 400px;
}

.puzzle-board.grid-5x5 {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    max-width: 500px;
}

.puzzle-board.grid-7x7 {
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(7, 1fr);
    max-width: 600px;
}

/* Частинка пазла */
.puzzle-piece {
    aspect-ratio: 1;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: grab;
    transition: all 0.3s ease;
    background-size: cover;
    background-position: center;
    position: relative;
    min-height: 60px;
}

.puzzle-piece:hover {
    transform: scale(1.05);
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    z-index: 10;
}

.puzzle-piece.touching {
    border-color: #8b5cf6;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.6);
    transform: scale(1.03);
    z-index: 12;
}

.puzzle-piece.dragging {
    cursor: grabbing;
    transform: scale(1.1);
    z-index: 20;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.puzzle-piece.correct {
    border-color: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
    cursor: not-allowed;
}



.puzzle-piece.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.8);
    transform: scale(1.05);
    z-index: 15;
}

.puzzle-piece.selectable {
    cursor: pointer;
}

.puzzle-piece.selectable:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.puzzle-piece.drop-zone {
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.1);
    border-style: dashed;
}

/* Порожня позиція для частинки */
.puzzle-slot {
    aspect-ratio: 1;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    min-height: 60px;
}

.puzzle-slot.drag-over {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
}

/* Модальні вікна */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none !important;
    pointer-events: none !important;
}

.end-game-modal-content {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
    max-width: 400px;
    margin: 0 auto;
    z-index: 1001;
}

/* Анімація конфеті */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f39c12;
    animation: confetti-fall 3s linear infinite;
}

.confetti:nth-child(odd) { background: #e74c3c; }
.confetti:nth-child(even) { background: #3498db; }
.confetti:nth-child(3n) { background: #2ecc71; }
.confetti:nth-child(4n) { background: #f39c12; }
.confetti:nth-child(5n) { background: #9b59b6; }

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

/* Responsive дизайн */
@media (max-width: 640px) {
    .puzzle-board {
        max-width: 90vw;
        gap: 1px;
        padding: 0.5rem;
    }
    
    .puzzle-piece, .puzzle-slot {
        min-height: 40px;
    }
    
    .puzzle-board.grid-5x5, 
    .puzzle-board.grid-7x7 {
        max-width: 85vw;
    }
}