:root {
    --card-width: 70px;
    --card-height: 98px;
    --card-gap: 8px;
    --selected-color: #ffd700;
}

.game-header {
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.game-header h1 {
    font-size: 1.4rem;
}

.score {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent-color);
}

/* Layout */
.top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
    padding: 15px;
    width: 100%;
}

.stock-reserve-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Reserve */
.reserve {
    display: flex;
    gap: var(--card-gap);
}

.reserve-pile {
    position: relative;
    width: var(--card-width);
    min-height: calc(var(--card-height) + 24px);
}

.reserve-pile .game-card {
    position: absolute;
    left: 0;
}

.reserve-pile .game-card:nth-child(1) { top: 0; z-index: 4; }
.reserve-pile .game-card:nth-child(2) { top: 8px; z-index: 3; }
.reserve-pile .game-card:nth-child(3) { top: 16px; z-index: 2; }
.reserve-pile .game-card:nth-child(4) { top: 24px; z-index: 1; }

/* Foundations */
.foundations {
    display: flex;
    gap: var(--card-gap);
}

.foundation {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.15);
}

.foundation .game-card {
    position: absolute;
    left: 0;
    top: 0;
}

.foundation .game-card .foundation-indicator {
    display: none;
}

/* Foundation indicator (like Canfield) */
.foundation-indicator {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 0.65rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.2);
    z-index: 1;
    pointer-events: none;
    line-height: 1.1;
    white-space: pre;
}

/* Stock & Waste */
.stock-waste {
    display: flex;
    gap: var(--card-gap);
}

.stock, .waste, .foundation {
    width: var(--card-width);
    height: var(--card-height);
    border-radius: 6px;
    position: relative;
}

.stock {
    background: var(--card-back);
    border: 2px solid var(--card-back-border);
    cursor: pointer;
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.05) 10px,
        rgba(255, 255, 255, 0.05) 20px
    );
}

.stock:empty {
    cursor: default;
    opacity: 0.3;
}

.stock.can-reshuffle {
    cursor: pointer;
    opacity: 1;
    animation: pulse-reshuffle 1.5s ease-in-out infinite;
}

.stock.can-reshuffle::after {
    content: '↻';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    opacity: 0.9;
}

@keyframes pulse-reshuffle {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px 5px rgba(212, 175, 55, 0.2);
        transform: scale(1.02);
    }
}

.waste {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.15);
}

.waste .game-card:nth-child(1) { z-index: 3; }
.waste .game-card:nth-child(2) { left: 6px; z-index: 2; }
.waste .game-card:nth-child(3) { left: 12px; z-index: 1; }

/* Game Card */
.game-card {
    width: var(--card-width);
    height: var(--card-height);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.game-card:hover:not(.covered):not(.removed):not(.selected) {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5), 0 4px 8px rgba(0, 0, 0, 0.4);
}

.game-card.selected {
    box-shadow: 0 0 0 3px var(--selected-color), 0 4px 8px rgba(0, 0, 0, 0.4);
}

.game-card.selected:hover {
    box-shadow: 0 0 0 3px var(--selected-color), 0 4px 8px rgba(0, 0, 0, 0.4);
}

.game-card.covered {
    cursor: not-allowed;
    opacity: 0.7;
}

.game-card.dragging {
    opacity: 0.5;
}

.game-card[draggable="true"] {
    cursor: grab;
}

.game-card[draggable="true"]:active {
    cursor: grabbing;
}

.game-card.removed {
    visibility: hidden;
}

/* Mobile */
@media (max-width: 768px) {
    .game-board {
        margin-left: 0;
        margin-right: 0;
        padding-left: 5px;
        padding-right: 5px;
        min-height: calc(100vh - 200px);
    }

    :root {
        --card-width: clamp(60px, 18vw, 75px);
        --card-height: calc(var(--card-width) * 1.4);
        --card-gap: clamp(6px, 1.5vw, 10px);
    }

    .top-row {
        gap: 12px;
        flex-wrap: wrap;
        justify-content: center;
        flex-direction: column;
        align-items: center;
    }

    .stock-reserve-area {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--card-gap);
        padding-bottom: 30px;
        order: 1;
    }

    .stock-waste {
        justify-content: center;
        order: 1;
    }

    .reserve {
        width: 100%;
        justify-content: center;
        order: 2;
    }

    .foundations {
        width: 100%;
        justify-content: center;
        order: 3;
        padding-top: 30px;
    }

    .reserve-pile {
        min-height: calc(var(--card-height) + 20px);
    }

    .reserve-pile .game-card:nth-child(2) { top: 6px; }
    .reserve-pile .game-card:nth-child(3) { top: 12px; }
    .reserve-pile .game-card:nth-child(4) { top: 18px; }

    .waste .game-card:nth-child(2) { left: 4px; }
    .waste .game-card:nth-child(3) { left: 8px; }

    .game-header {
        justify-content: center;
    }

    .game-header h1 {
        width: 100%;
        text-align: center;
    }

    .game-card-face {
        padding: clamp(2px, 0.6vw, 5px);
        font-size: clamp(0.6rem, 3vw, 0.9rem);
    }

    .game-card-corner {
        font-size: clamp(0.5rem, 2.5vw, 0.75rem);
        line-height: 1.15;
    }

    .game-card-center {
        font-size: clamp(1.4rem, 5vw, 2rem);
    }

    .game-card-corner-bottom {
        transform: rotate(180deg);
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --card-width: 60px;
        --card-height: 84px;
        --card-gap: 8px;
    }
}
