/* Bloqed: Full External Style Sheet */

/* LOBBY & GRID LAYOUT */
.lobby-container { 
    max-width: 900px; 
    margin: 40px auto; 
    padding: 0 20px; 
}

.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); 
    gap: 25px;
    margin-top: 20px;
    justify-content: center;
}

.puzzle-card { 
    background: white; 
    padding: 25px 15px; 
    border-radius: 20px; 
    text-decoration: none; 
    color: inherit; 
    text-align: center; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.02); 
    border: 2px solid transparent; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 8px; 
    position: relative;
    will-change: transform;
}

/* Standard Hover Effect */
.puzzle-card:hover { 
    border-color: var(--accent); 
    transform: translateY(-5px); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

/* State Management */
.puzzle-card.is-done {
    opacity: 0.6;
}

.puzzle-card.perfect-glow {
    border-color: var(--gold) !important;
    background: linear-gradient(145deg, #ffffff, #fffdf5) !important;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.1) !important;
    opacity: 0.6;
}

.puzzle-card.is-done:hover,
.puzzle-card.perfect-glow:hover {
    opacity: 1 !important;
    box-shadow: 0 12px 30px rgba(251, 191, 36, 0.25) !important;
}

/* Mini Icon Styles */
.puzzle-icon {
    width: 50px; 
    height: 50px;
    background-color: var(--board-bg);
    border-radius: 10px;
    position: relative;
    margin-bottom: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.puzzle-card:hover .puzzle-icon {
    transform: scale(1.1);
}

.perfect-glow .puzzle-icon {
    background: var(--gold) !important;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}

.puzzle-icon::before {
    content: ''; 
    position: absolute;
    width: 18px; 
    height: 8px;
    background: var(--accent);
    top: 22px; 
    left: 4px;
    border-radius: 2px; 
    z-index: 2;
}

.perfect-glow .puzzle-icon::before {
    background: white !important;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

/* Seals & Stars */
.completion-seal { 
    position: absolute; 
    top: -12px; 
    right: -12px; 
    width: 32px; 
    height: 32px; 
    background: var(--accent); 
    color: white; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: bold; 
    border: 3px solid white; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); 
    z-index: 10;
}

.completion-seal.perfect {
    background: var(--gold) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4) !important;
    font-size: 14px;
    animation: star-pulse 2s infinite ease-in-out;
}

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

/* GAMEPLAY UI */
.game-wrapper { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 20px; 
    touch-action: none; 
    max-width: 500px; 
    margin: 0 auto; 
}

#board { 
    width: 330px; 
    height: 330px; 
    background: var(--board-bg); 
    padding: 8px; 
    box-sizing: content-box; 
    border-radius: 20px; 
    box-shadow: inset 0 0 40px rgba(0,0,0,0.6), 0 20px 50px rgba(0,0,0,0.15); 
    position: relative; 
    overflow: hidden; 
}

.block { 
    position: absolute; 
    border-radius: 12px; 
    cursor: grab; 
    user-select: none; 
    box-shadow: 0 6px 0 rgba(0,0,0,0.3); 
    z-index: 5; 
    box-sizing: border-box; 
    transition: transform 0.05s ease-out; 
}

.block-wood { 
    background: linear-gradient(135deg, #a0522d, #8b4513); 
    border: 2px solid #5d2e0a; 
}

.block-target { 
    background: linear-gradient(135deg, #88b04b, #6b8e23); 
    border: 2px solid #4a6118; 
    z-index: 10; 
}

.exit-gate { 
    position: absolute; 
    right: -10px; /* Pull it slightly into the board border */
    width: 20px; 
    height: calc(100% / 6); /* Dynamically scales with the board size */
    top: calc(100% / 6 * 2); /* Positions it exactly at the 3rd row */
    background: var(--accent); 
    border-radius: 0 8px 8px 0; 
    opacity: 0.8; /* Higher opacity makes it clearer where to go */
    z-index: 1;
}

.btn { 
    padding: 12px 20px; 
    border-radius: 15px; 
    border: none; 
    font-weight: 700; 
    cursor: pointer; 
    text-decoration: none; 
    display: inline-block; 
    font-size: 14px; 
}

.btn-outline { 
    background: white; 
    border: 1px solid #e2e8f0; 
    color: var(--dark); 
    flex: 1; 
}

/* RESPONSIVE OVERRIDES */
@media (max-width: 480px) {
    .puzzle-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }
}

/* TABLET PORTRAIT SCALE-UP */
@media (min-width: 600px) and (max-width: 1024px) {
    #board {
        width: 450px; 
        height: 450px; 
    }
    .game-wrapper { 
        max-width: 600px; 
    }
}

/* DESKTOP STABILIZATION */
@media (min-width: 1025px) {
    #board { 
        width: 380px; 
        height: 380px; 
    }
}