/* ====== BLOCK SORT ====== */
.blocksort-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 24px 16px;
}

.blocksort-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    width: 100%;
    max-width: 600px;
}

.blocksort-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 16px;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 12px;
    min-width: 70px;
}

.blocksort-stat-value {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--accent-cyan);
    line-height: 1;
}

.blocksort-stat-label {
    font-size: 11px;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.blocksort-status {
    text-align: center;
    color: var(--secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    transition: all 0.3s ease;
    flex: 1;
    max-width: 280px;
}

.blocksort-status:empty::before {
    content: "Select a stack, then tap where to move (top has to match same color)";
}

.blocksort-platforms {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 900px;
}

.blocksort-platform {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
    border: 2px solid var(--border-subtle);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 110px;
    position: relative;
    overflow: visible;
}

.blocksort-platform::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.blocksort-platform:hover {
    border-color: var(--border-highlight);
    box-shadow: 0 0 24px rgba(6, 182, 212, 0.3), 0 4px 16px rgba(0, 0, 0, 0.2);
}

.blocksort-platform:hover::before {
    opacity: 0.1;
}

.blocksort-platform.selected {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 32px rgba(6, 182, 212, 0.5), 0 4px 16px rgba(6, 182, 212, 0.3);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(6, 182, 212, 0.03));
}

.blocksort-platform.completed {
    border: 3px solid #22c55e;
    box-shadow:
        0 0 40px rgba(34, 197, 94, 0.6),
        0 0 20px rgba(34, 197, 94, 0.4),
        0 4px 16px rgba(34, 197, 94, 0.3);
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
    animation: completedPulse 2s ease-in-out infinite;
}

@keyframes completedPulse {

    0%,
    100% {
        box-shadow:
            0 0 40px rgba(34, 197, 94, 0.6),
            0 0 20px rgba(34, 197, 94, 0.4),
            0 4px 16px rgba(34, 197, 94, 0.3);
    }

    50% {
        box-shadow:
            0 0 50px rgba(34, 197, 94, 0.8),
            0 0 30px rgba(34, 197, 94, 0.6),
            0 6px 20px rgba(34, 197, 94, 0.4);
    }
}

.blocksort-platform.selected::before {
    opacity: 0.15;
}


.blocksort-blocks {
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    align-items: center;
    min-height: 380px;
    justify-content: flex-start;
    padding: 8px 0;
    position: relative;
}

.blocksort-blocks::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--border-subtle), transparent);
    opacity: 0.3;
}

.blocksort-block {
    width: 70px;
    height: 70px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.15);
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
}

/* Inner shine effect */
.blocksort-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 8px 8px 0 0;
    pointer-events: none;
}

/* Pattern for colorblind accessibility */
.blocksort-block::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.3;
    pointer-events: none;
}

.blocksort-block.selected {
    transform: translateY(-10px) scale(1.05);
    box-shadow:
        0 0 30px rgba(6, 182, 212, 0.7),
        0 8px 20px rgba(6, 182, 212, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    border-color: var(--accent-cyan);
    z-index: 10;
}

/* Block hover effect */
.blocksort-platform:not(.selected) .blocksort-block:hover {
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.15);
}

.blocksort-block-red {
    background: linear-gradient(145deg, #f87171, #dc2626);
    border-color: rgba(248, 113, 113, 0.4);
}

.blocksort-block-red::after {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid currentColor;
    color: rgba(255, 255, 255, 0.5);
}

.blocksort-block-blue {
    background: linear-gradient(145deg, #60a5fa, #2563eb);
    border-color: rgba(96, 165, 250, 0.4);
}

.blocksort-block-blue::after {
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.4);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.blocksort-block-green {
    background: linear-gradient(145deg, #4ade80, #16a34a);
    border-color: rgba(74, 222, 128, 0.4);
}

.blocksort-block-green::after {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 20px solid rgba(255, 255, 255, 0.4);
}

.blocksort-block-yellow {
    background: linear-gradient(145deg, #fbbf24, #d97706);
    border-color: rgba(251, 191, 36, 0.4);
}

.blocksort-block-yellow::after {
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.4);
}

.blocksort-block-empty {
    width: 70px;
    height: 70px;
    border: 2px dashed var(--border-subtle);
    border-radius: 10px;
    opacity: 0.15;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.blocksort-platform:hover .blocksort-block-empty {
    opacity: 0.25;
    border-color: var(--border-highlight);
}


/* ====== RESPONSIVE ====== */
/* Medium screens - scale down slightly */
@media (max-width: 900px) {
    .blocksort-container {
        padding: 16px 12px;
        gap: 16px;
    }

    .blocksort-header {
        gap: 12px;
    }

    .blocksort-stat {
        padding: 8px 12px;
        min-width: 60px;
    }

    .blocksort-stat-value {
        font-size: 18px;
    }

    .blocksort-platforms {
        gap: 12px;
        flex-wrap: nowrap;
    }

    .blocksort-platform {
        min-width: 80px;
        padding: 12px 10px;
    }

    .blocksort-block,
    .blocksort-block-empty {
        width: 55px;
        height: 55px;
    }

    .blocksort-blocks {
        min-height: 300px;
        gap: 4px;
    }
}

/* Small screens - scale down more aggressively */
@media (max-width: 600px) {
    .blocksort-container {
        padding: 12px 6px;
        gap: 12px;
    }

    .blocksort-header {
        gap: 8px;
    }

    .blocksort-stat {
        padding: 6px 10px;
        min-width: 55px;
        border-radius: 8px;
    }

    .blocksort-stat-value {
        font-size: 16px;
    }

    .blocksort-stat-label {
        font-size: 9px;
    }

    .blocksort-status {
        font-size: 11px;
        padding: 6px 10px;
        max-width: 180px;
    }

    .blocksort-platforms {
        gap: 6px;
        flex-wrap: nowrap;
    }

    .blocksort-platform {
        min-width: 56px;
        padding: 8px 6px;
        border-radius: 10px;
    }

    .blocksort-block,
    .blocksort-block-empty {
        width: 42px;
        height: 42px;
        border-radius: 6px;
    }

    .blocksort-blocks {
        min-height: 240px;
        gap: 3px;
    }

    .blocksort-blocks::after {
        height: 2px;
        bottom: -8px;
    }

    /* Scale down patterns */
    .blocksort-block-red::after {
        width: 16px;
        height: 16px;
        border-width: 2px;
    }

    .blocksort-block-blue::after {
        width: 14px;
        height: 14px;
    }

    .blocksort-block-green::after {
        border-left-width: 8px;
        border-right-width: 8px;
        border-bottom-width: 14px;
    }

    .blocksort-block-yellow::after {
        width: 14px;
        height: 14px;
    }
}

/* Extra small screens - use flexbox with proportional sizing */
@media (max-width: 400px) {
    .blocksort-container {
        padding: 10px 4px;
        gap: 10px;
    }

    .blocksort-header {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .blocksort-stat {
        padding: 5px 8px;
        min-width: 50px;
    }

    .blocksort-stat-value {
        font-size: 14px;
    }

    .blocksort-status {
        order: -1;
        width: 100%;
        max-width: none;
        font-size: 11px;
    }

    .blocksort-platforms {
        gap: 4px;
        flex-wrap: nowrap;
    }

    .blocksort-platform {
        min-width: 48px;
        padding: 6px 4px;
        border-radius: 8px;
        border-width: 1px;
    }

    .blocksort-block,
    .blocksort-block-empty {
        width: 36px;
        height: 36px;
        border-radius: 5px;
        border-width: 1px;
    }

    .blocksort-blocks {
        min-height: 200px;
        gap: 2px;
    }

    .blocksort-block.selected {
        transform: translateY(-4px) scale(1.03);
    }

    /* Scale down patterns more */
    .blocksort-block-red::after {
        width: 12px;
        height: 12px;
    }

    .blocksort-block-blue::after {
        width: 10px;
        height: 10px;
    }

    .blocksort-block-green::after {
        border-left-width: 6px;
        border-right-width: 6px;
        border-bottom-width: 10px;
    }

    .blocksort-block-yellow::after {
        width: 10px;
        height: 10px;
    }
}
/* Invalid move feedback */
.blocksort-platform.invalid-move {
    animation: invalidPulse 0.4s ease-in-out;
}

@keyframes invalidPulse {
    0%, 100% {
        border-color: var(--border-subtle);
        box-shadow: none;
    }
    50% {
        border-color: rgba(239, 68, 68, 0.8);
        box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
        background-color: rgba(239, 68, 68, 0.05);
    }
}
