body {
    font-family: 'Inter', sans-serif;
    background-color: #0f172a;
    color: #f8fafc;
    user-select: none;
    overflow-x: hidden;
}

/* Card sizing shared by cards, placeholders and pile slots */
:root {
    --card-w: 65px;
    --card-h: 90px;
    --card-offset: 23px; /* vertical step between cards in a tableau pile */
}

@media (min-width: 640px) {
    :root {
        --card-w: 76px;
        --card-h: 106px;
    }
}

/* Cards are absolutely positioned, so a slot needs its own height or it
   collapses to 0 once it holds only cards (and tableau piles must grow). */
.pile-slot {
    min-height: var(--card-h);
}

/* Tableau area is always tall enough for the deepest possible pile
   (19 cards, each offset by --card-offset), so the board doesn't resize mid-game. */
.tableau-grid {
    min-height: calc(var(--card-h) + 18 * var(--card-offset));
}

/* Card styles */
.card {
    width: var(--card-w);
    height: var(--card-h);
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    position: absolute;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px;
    font-weight: 700;
    font-size: 14px;
    box-sizing: border-box;
}

@media (min-width: 640px) {
    .card {
        padding: 8px;
        font-size: 16px;
    }
}

/* Card face: explicit line-heights so the corners and centre always fit inside the card
   (Tailwind's text-* utilities set their own line-height and made the face taller than the card) */
.card-corner {
    display: flex;
    flex-direction: column;
    align-items: center;
    align-self: flex-start;
    line-height: 1;
}

.card-corner-bottom {
    align-self: flex-end;
    transform: rotate(180deg);
}

.card-rank {
    font-size: 12px;
    font-weight: 700;
}

.card-suit {
    font-size: 10px;
    margin-top: 1px;
}

.card-center {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
}

@media (min-width: 640px) {
    .card-rank {
        font-size: 14px;
    }

    .card-suit {
        font-size: 12px;
    }

    .card-center {
        font-size: 26px;
    }
}

.card.dragging {
    opacity: 0.85;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    z-index: 1000 !important;
    transform: scale(1.05);
}

.card-back {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: 2px solid #93c5fd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.card-back-pattern {
    width: 85%;
    height: 85%;
    border: 1px dashed rgba(255, 255, 255, 0.4);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 20px;
}

.card.red {
    color: #ef4444;
}

.card.black {
    color: #0f172a;
}

/* Drop target glow */
.drop-highlight {
    box-shadow: 0 0 0 3px #3b82f6, 0 10px 15px -3px rgba(59, 130, 246, 0.5);
    background-color: rgba(59, 130, 246, 0.05);
}

/* Pile placeholder */
.pile-placeholder {
    width: var(--card-w);
    height: var(--card-h);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.02);
}

/* Smooth confetti or win animations */
@keyframes pulse-glow {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.hint-pulse {
    animation: pulse-glow 1s infinite;
    box-shadow: 0 0 15px #eab308 !important;
    border: 2px solid #eab308;
}
/* ---------- FreeCell additions ---------- */
/* soft 1px edge so stacked cards read as separate cards */
.card {
    border: 1px solid #b9c4d6;
}

.card.selected {
    box-shadow: 0 0 0 3px #38bdf8, 0 8px 14px rgba(0, 0, 0, 0.45);
    transform: translateY(-4px);
}

.pile-slot {
    cursor: pointer;
}
