:root {
    --card-width: 64px;
    --card-height: 90px;
    --crescent-gap: 9px;
}

.game-board {
    padding: 14px;
    overflow: hidden;
}

.crescent-status {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 8px;
    color: var(--accent-gold);
    font-size: 0.9rem;
}

.crescent-layout {
    position: relative;
    min-height: 515px;
    max-width: 780px;
    margin: 0 auto;
}

.crescent-tableau {
    display: grid;
    grid-template-columns: repeat(8, var(--card-width));
    grid-template-rows: calc(var(--card-height) + 42px) 126px 126px calc(var(--card-height) + 42px);
    justify-content: center;
    gap: 5px var(--crescent-gap);
}

.crescent-pile {
    position: relative;
    width: var(--card-width);
    height: calc(var(--card-height) + 42px);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.08);
}

.crescent-pile:nth-child(1) { grid-area: 1 / 2; transform: translateY(28px); }
.crescent-pile:nth-child(2) { grid-area: 1 / 3; transform: translateY(10px); }
.crescent-pile:nth-child(3) { grid-area: 1 / 4; }
.crescent-pile:nth-child(4) { grid-area: 1 / 5; }
.crescent-pile:nth-child(5) { grid-area: 1 / 6; transform: translateY(10px); }
.crescent-pile:nth-child(6) { grid-area: 1 / 7; transform: translateY(28px); }
.crescent-pile:nth-child(7) { grid-area: 2 / 1; }
.crescent-pile:nth-child(8) { grid-area: 3 / 1; }
.crescent-pile:nth-child(9) { grid-area: 2 / 8; }
.crescent-pile:nth-child(10) { grid-area: 3 / 8; }
.crescent-pile:nth-child(11) { grid-area: 4 / 2; transform: translateY(-28px); }
.crescent-pile:nth-child(12) { grid-area: 4 / 3; transform: translateY(-10px); }
.crescent-pile:nth-child(13) { grid-area: 4 / 4; }
.crescent-pile:nth-child(14) { grid-area: 4 / 5; }
.crescent-pile:nth-child(15) { grid-area: 4 / 6; transform: translateY(-10px); }
.crescent-pile:nth-child(16) { grid-area: 4 / 7; transform: translateY(-28px); }

.crescent-card {
    position: absolute;
    left: 0;
}

.crescent-card.covered {
    cursor: default;
}

.crescent-card.exposed {
    cursor: grab;
    touch-action: none;
}

.crescent-card.exposed:active {
    cursor: grabbing;
}

.crescent-card.selected {
    box-shadow: 0 0 0 3px var(--accent-gold), 0 6px 14px rgba(0, 0, 0, 0.45);
}

#drag-ghost {
    transition: none;
    will-change: left, top;
}

.foundation-panel {
    position: absolute;
    z-index: 30;
    top: 157px;
    left: 50%;
    width: min-content;
    transform: translateX(-50%);
    padding: 20px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.16);
}

.crescent-foundations {
    display: grid;
    grid-template-columns: repeat(4, var(--card-width));
    grid-template-rows: repeat(2, var(--card-height));
    gap: 20px var(--crescent-gap);
}

.crescent-foundation {
    position: relative;
    width: var(--card-width);
    height: var(--card-height);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

.crescent-foundation .game-card {
    inset: -2px;
}

.foundation-label {
    position: absolute;
    z-index: 40;
    left: 50%;
    transform: translateX(-50%);
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(5, 30, 20, 0.88);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
}

.foundation-label--up {
    top: 3px;
}

.foundation-label--down {
    top: calc(20px + var(--card-height) + 3px);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.no-moves-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

@media (max-width: 768px) {
    :root {
        --card-width: calc((100vw - 44px) / 8.7);
        --card-height: calc(var(--card-width) * 1.4);
        --crescent-gap: 2px;
    }

    .game-board {
        margin-right: 0;
        margin-left: 0;
        padding: 8px 2px;
    }

    .crescent-layout {
        min-height: calc(var(--card-height) * 6 + 94px);
    }

    .crescent-pile {
        height: calc(var(--card-height) + 28px);
    }

    .crescent-tableau {
        grid-template-rows: repeat(4, calc(var(--card-height) + 36px));
        gap: 3px var(--crescent-gap);
    }

    .crescent-card {
        --card-design-corner-padding: 2px;
        --card-design-corner-font-size: 0.48rem;
    }

    .crescent-card .game-card-center {
        font-size: 0.8rem;
    }

    .foundation-panel {
        top: calc(var(--card-height) + 58px);
        padding: 16px 5px;
        border-radius: 9px;
    }

    .crescent-foundations {
        gap: 20px var(--crescent-gap);
    }

    .foundation-label--down {
        top: calc(16px + var(--card-height) + 3px);
    }

    .foundation-label {
        font-size: 0.52rem;
    }

    .crescent-status {
        gap: 18px;
        font-size: 0.78rem;
    }
}

@media (min-width: 769px) and (max-width: 900px) {
    :root {
        --card-width: 56px;
        --card-height: 78px;
        --crescent-gap: 6px;
    }

    .crescent-layout {
        min-height: 480px;
    }

    .foundation-panel {
        top: 145px;
    }
}
