/* Candy Match 3 PlayMix Style */

#game-wrapper {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: radial-gradient(circle at center, #1b2735 0%, #090a0f 100%);
    overflow: hidden;
}

#ui-overlay {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    margin-top: 60px; /* Leave space for back button/header */
}

#score-board {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.hud-item {
    font-size: 1rem;
    font-weight: 700;
    padding: 8px 15px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.highlight-pill.yellow { border-left: 4px solid #facc15; }
.highlight-pill.blue { border-left: 4px solid #3b82f6; }
.highlight-pill.red { border-left: 4px solid #f43f5e; }
.highlight-pill.green { border-left: 4px solid #4ade80; }

.grid-container {
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    margin-bottom: 40px;
}

#game-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 4px;
    width: 90vw;
    max-width: 450px;
    height: 90vw;
    max-height: 450px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 5px;
    touch-action: none; /* Prevent scroll on mobile drag */
}

.candy-square {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s ease, filter 0.2s ease;
    background: rgba(255,255,255,0.05);
}

@media (max-width: 500px) {
    .candy-square {
        font-size: 24px;
        border-radius: 6px;
    }
}

.candy-square.dragging {
    transform: scale(1.3);
    z-index: 20;
    filter: brightness(1.5);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.9), inset 0 0 15px rgba(255, 255, 255, 0.6);
    border: 3px solid rgba(255, 255, 255, 0.9);
}

.candy-square[data-type="blank"] {
    background: transparent;
    cursor: default;
}

.candy-square[data-type="red"] { box-shadow: inset 0 0 10px rgba(244, 63, 94, 0.2); }
.candy-square[data-type="purple"] { box-shadow: inset 0 0 10px rgba(168, 85, 247, 0.2); }
.candy-square[data-type="orange"] { box-shadow: inset 0 0 10px rgba(249, 115, 22, 0.2); }
.candy-square[data-type="yellow"] { box-shadow: inset 0 0 10px rgba(250, 204, 21, 0.2); }
.candy-square[data-type="green"] { box-shadow: inset 0 0 10px rgba(74, 222, 128, 0.2); }
.candy-square[data-type="blue"] { box-shadow: inset 0 0 10px rgba(59, 130, 246, 0.2); }

/* Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    backdrop-filter: blur(10px);
}

.overlay.hidden {
    display: none;
}

.overlay-box {
    background: linear-gradient(135deg, #1e1e2f, #2a2a40);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 15px 50px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    max-width: 400px;
    width: 90%;
}

.pmg-btn {
    background: linear-gradient(90deg, #4facfe, #00f2fe);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: 800;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(79, 172, 254, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pmg-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(79, 172, 254, 0.4);
}
