:root {
    --easing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.grid-box {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 17px;
    height: calc(100% - 74px);
    justify-content: center;
    margin: 30px 0px 0px 0px;
    overflow: hidden;
    background-color: var(--bg-primary);
}


.grid-loader {
    width: 50px;
    height: 50px;
    margin: 0 auto;
}

.grid-letters {
    /* font-family: outfit; */
    margin-bottom: 4px;
}

.grid-loading {
    color: var(--txt-primary);
    font-family: Outfit;
    font-size: 20px;
    font-weight: 500;
    text-align: center;
}

.loader-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    width: 100%;
}

.grid-box .waffle-wrapper {
    /* padding: 0px 18px; */
    display: flex;
    flex-direction: column;
    gap: 17px;
    margin-bottom: 35px;
}

.daily-challenge {
    color: var(--txt-secondary);
    text-align: center;
    font-family: Outfit;
    font-size: 20px;
    font-style: normal;
    font-weight: 600;
    line-height: normal;
    letter-spacing: 3.2px;
    text-transform: uppercase;
    flex-shrink: 0;
    margin-bottom: 9px;
    margin-top: 25px;
}

/* Moves section with fading border */
.moves-section {
    position: relative;
    padding: 10px 0;
    text-align: center;
    margin-bottom: 10px;
}

.moves-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #CCCCCC 50%, transparent 100%);
}

.moves-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, #CCCCCC 50%, transparent 100%);
}



.moves-left-top {
    color: var(--txt-secondary);
    text-align: center;
    font-family: Outfit;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0;
}

/* Action buttons section */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

/*  */
.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border: 1px solid #d4d4d4;
    border-radius: 9px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--txt-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.action-btn:hover:not(.disabled) {
    background: var(--bg-primary);
    border-color: var(--bg-secondary);
}

.action-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-primary);
}

.btn-icon {
    width: 16px;
    height: 16px;
}

.btn-label {
    color: var(--txt-primary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.btn-counter {
    background: var(--bg-content);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    margin-left: auto;
    border-radius: 5px;
    font-style: sans-serif;
}

.action-btn.disabled .btn-counter {
    background: #CCCCCC;
}

.daily-challenge-count {
    font-weight: 400;
    color: var(--txt-secondary);
    font-size: 20px;
    line-height: 100%;
    letter-spacing: 16%;
    text-align: center;
    text-transform: uppercase;
}

.grid-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* margin-top: auto; */
    /* max-width: 400px; */
    max-height: 400px;
    overflow: hidden;
}

.grid-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

/* .grid-container .grid-row:nth-child(2) .grid-tile:nth-child(2),
.grid-container .grid-row:nth-child(2) .grid-tile:nth-child(4),
.grid-container .grid-row:nth-child(4) .grid-tile:nth-child(2),
.grid-container .grid-row:nth-child(4) .grid-tile:nth-child(4) {
    visibility: hidden;
} */
.grid-container .grid-row:nth-child(2) div:nth-child(2),
.grid-container .grid-row:nth-child(2) div:nth-child(4),
.grid-container .grid-row:nth-child(4) div:nth-child(2),
.grid-container .grid-row:nth-child(4) div:nth-child(4) {
    visibility: hidden;
}

/* .daily-challenge .grid-row:nth-child(2) .grid-tile:nth-child(2),
.daily-challenge .grid-row:nth-child(2) .grid-tile:nth-child(4),
.daily-challenge .grid-row:nth-child(4) .grid-tile:nth-child(2),
.daily-challenge .grid-row:nth-child(4) .grid-tile:nth-child(4) {
    visibility: hidden;
} */
div:has(> .grid-tile) {
    /* box-shadow: rgba(14, 30, 37, 0.12) 0px 2px 4px 0px, rgba(14, 30, 37, 0.32) 0px 2px 16px 0px; */
    background: url(../../assets/home-assets/emptytiles\ .png);
    background-repeat: no-repeat;
    /* overflow: hidden;
     */
    background-size: cover;
}

.grid-tile {
    width: 75px;
    height: 75px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    /* Smooth transitions for all tile interactions */
    transition: transform 0.3s var(--easing), 
                background-image 0.2s ease,
                color 0.2s ease,
                box-shadow 0.2s ease;
    opacity: 1 !important;
}

.grid-tile:active {
    transform: scale(1.2);
}

grid-tile.swap-animation {
    transform: scale(2.2);
    /* Slightly enlarge the tile during the swap */
}

.grid-tile.fixed {
    background-color: #6fb05c;
    /* Green for fixed tiles */
    color: white;
    cursor: not-allowed;
}

.grid-tile.yellow {
    background-color: #e9ba3a;
    /* Yellow for draggable tiles */
    color: white;
}

.grid-tile.white {
    background-color: #edeff1;
    /* White for draggable tiles */
    color: #333;
}

/* .grid-tile:hover {
    transform: scale(1.1);
} */

.grid-tile:active {
    transform: scale(1);
}

/* Dragging state for tiles */
.tile--dragging {
    transition: transform  var(--easing), 
                z-index  ease,
                box-shadow 0.2s ease;
    z-index: 1000;
    /* opacity: 0.95 !important; */
    /* box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25); */
    transform-origin: center center;
}

/* Tile exchange animation */
.grid-tile.tile--exchanging {
    /* transition: all 0.4s var(--easing); */
    transform: scale(1.05);
}

/* Smooth return to normal state after drag */
.grid-tile:not(.tile--dragging) {
    /* transition-delay: 0.1s; */
}

/* Container for buttons */

.tool {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.tool.game-over {
    justify-content: center;
}

.tool .btn {
    width: 56px;
    height: 56px;
}

.moves-left {
    color: var(--txt-secondary);
    font-family: Outfit;
    font-size: 24px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
    letter-spacing: 3.84px;
    text-transform: uppercase;
}

.moves-number {
    color: var(--txt-primary);
    font-family: Outfit;
    font-size: 20px;
    font-style: normal;
    font-weight: 500;
    line-height: normal;
    letter-spacing: 3.84px;
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .grid-tile {
        width: 61.664px;
        height: 61.664px;
        aspect-ratio: 61.66 / 61.66;
    }

    .grid-box {
        align-items: center;
        display: flex;
        flex-direction: column;
        gap: 12px;
        justify-content: center;
        margin: 15px 0px;
        height: auto;
    }

    .grid-box .waffle-wrapper {
        /* padding: 0 10px; */
        gap: 12px;
    }

    .grid-tile {
        width: 67px;
        height: 67px;
        font-size: 2rem;
    }

    .daily-challenge {
        font-size: 16px;
        letter-spacing: 2px;
        margin-bottom: 5px;
    }

    /* Mobile styles for moves section */
    .moves-section {
        padding: 12px 0;
    }

    .moves-left-top {
        font-size: 14px;
        letter-spacing: 1.5px;
    }

    .moves-left-top .moves-number {
        font-size: 16px;
    }

    /* Mobile styles for action buttons */
    .action-buttons {
        gap: 15px;
        margin-top: 15px;
        padding: 0 10px;
    }

    .action-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-width: 80px;
        border-radius: 16px;
    }

    .btn-icon {
        width: 14px;
        height: 14px;
    }

    .btn-counter {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }

    /* Legacy styles for old elements (in case they still exist) */
    .tool {
        margin-top: 15px;
        display: none;
        /* Hide old tool section on mobile */
    }

    .moves-left {
        font-size: 20px;
        width: 191px;
        letter-spacing: 2px;
    }

    .moves-number {
        font-size: 19px;
    }

    .undo-redo {
        width: 116px;
    }

    .tool .btn {
        width: auto;
    }


}

/* Extra small mobile devices (480px and below) */
@media (max-width: 480px) {
    .grid-box {
        margin: 10px 0px;
        gap: 10px;
        height: auto;
        overflow: visible;
    }

    .grid-box .waffle-wrapper {
        padding: 0 8px;
        gap: 10px;
    }

    .daily-challenge {
        font-size: 14px;
        letter-spacing: 1.5px;
        margin-bottom: 3px;
        white-space: nowrap;
        overflow: visible;
        /* color: var(--txt-secondary); */
        text-align: center;
        font-family: Outfit;
        font-size: 16px;
        font-weight: 500;
        letter-spacing: 2.56px;
        text-transform: uppercase;
        /* margin-bottom: 18px; */
        margin-top: 32px;
    }

    .moves-section {
        padding: 10px 0;
        /* margin-bottom: 22px;
        margin-top: 20px 0px 15px 0px; */
        margin: 20px 0px 4px 0px;
    }

    .moves-left-top {
        font-size: 13px;
        letter-spacing: 1px;
        color: var(--txt-secondary);
        font-family: Outfit;
        font-size: 20px;
        font-style: normal;
        font-weight: 400;
        line-height: normal;
    }

    .moves-left-top .moves-number {
        /* color: var(--txt-primary); */
        text-align: right;
        font-family: Outfit;
        font-size: 20px;
        font-style: normal;
        font-weight: 500;
        line-height: normal;
        text-transform: uppercase;
    }

    .grid-container {
        margin: 5px 0;
    }

    .grid-tile {
        width: 65px;
        height: 65px;
        font-size: 1.8rem;
    }

    .action-buttons {
        gap: 12px;
        margin-top: 12px;
        padding: 0 8px;
        flex-wrap: nowrap;
    }

    .action-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 70px;
        border-radius: 14px;
        gap: 16px;
        width: 138px;
        height: 46px;
        border-radius: 8.283px;
        border: 1px solid #D9D9D9;
        /* background: var(--bg-primary); */
    }

    .btn-icon {
        width: 19px;
        height: 19px;
    }

    .btn-label {
        font-size: 14px;
    }

    .btn-counter {
        width: 22px;
        height: 22px;
        font-size: 10px;
        border-radius: 5px;
        opacity: 0.7;
        /* background: var(--bg-secondary); */
    }

    /* Mobile styles for blog section */
    .game-blog {
        margin-top: 80px;
        /* padding: 0 12px; */
    }

    .blog-content {
        padding: 16px;
    }

    .blog-title {
        font-size: 22px;
        margin-bottom: 12px;
    }

    .blog-intro {
        font-size: 16px;
        margin-bottom: 18px;
    }

    .blog-subtitle {
        font-size: 18px;
        margin-bottom: 8px;
    }

    .blog-section p {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .blog-list li {
        font-size: 16px;
        padding-left: 16px;
        margin-bottom: 6px;
    }

    .color-hints {
        padding: 12px;
        margin: 12px 0;
    }

    .hint-item {
        gap: 8px;
        margin-bottom: 8px;
    }

    .hint-color {
        width: 18px;
        height: 18px;
    }

    .hint-text {
        font-size: 16px;
    }

    .blog-conclusion {
        font-size: 16px;
        padding: 12px;
        margin-top: 16px;
    }
}

/* @media (min-width: 1024px) and (max-width: 1440px) {
    .grid-box {
        margin: 21px 0px;
    }

    .grid-tile {
        width: 75px;
        height: 75px;
    }
} */