/* Spider Solitaire */

.sp2-stage {
    --sp2-w: min(46px, 8.6vw);
    --sp2-h: calc(var(--sp2-w) * 1.42);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    user-select: none;
    width: 100%;
}

.sp2-hud {
    display: flex;
    gap: 1.2rem;
    font-weight: 600;
    color: var(--color-text-light);
    font-variant-numeric: tabular-nums;
    flex-wrap: wrap;
    justify-content: center;
}

.sp2-tableau {
    display: grid;
    grid-template-columns: repeat(10, var(--sp2-w));
    gap: 4px;
    width: 100%;
    max-width: calc(var(--sp2-w) * 10 + 40px);
    align-items: start;
    justify-content: center;
}

.sp2-col {
    position: relative;
    min-height: var(--sp2-h);
    cursor: pointer;
}

/* Cards overlap so a long column still fits; only rank and suit need to show. */
.sp2-col .sp2-card { margin-top: calc(var(--sp2-h) * -0.7); }
.sp2-col .sp2-card:first-child { margin-top: 0; }
.sp2-col .sp2-card.down { margin-top: calc(var(--sp2-h) * -0.86); }
.sp2-col .sp2-card.down:first-child { margin-top: 0; }

.sp2-card {
    position: relative;
    width: var(--sp2-w);
    height: var(--sp2-h);
    border-radius: 4px;
    background: #fff;
    border: 1px solid var(--color-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1px;
    font-weight: 700;
    line-height: 1;
    color: #222;
    -webkit-tap-highlight-color: transparent;
}

.sp2-card.red { color: #d33; }

.sp2-card.down {
    background: repeating-linear-gradient(
        45deg, #2f7d55, #2f7d55 4px, #256845 4px, #256845 8px);
    border-color: #256845;
    /* A lit top edge, because face-down cards overlap so tightly that without
       it a stack of five reads as one solid block. */
    border-top: 2px solid #58a97c;
}

.sp2-card.selected {
    outline: 3px solid var(--color-primary-dark);
    outline-offset: -1px;
    transform: translateX(4px);
}

.sp2-rank { font-size: calc(var(--sp2-w) * 0.4); }
.sp2-suit-sym { font-size: calc(var(--sp2-w) * 0.38); }

.sp2-slot {
    width: var(--sp2-w);
    height: var(--sp2-h);
    border-radius: 4px;
    border: 2px dashed var(--color-border);
}

.sp2-actions,
.sp2-suits {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.sp2-btn,
.sp2-suit {
    padding: 0.5rem 1.1rem;
    font-size: 0.92rem;
    font-weight: 600;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-card-bg);
    color: var(--color-text);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sp2-btn:hover:not(:disabled),
.sp2-suit:hover { border-color: var(--color-primary-dark); }
.sp2-btn:disabled { opacity: 0.45; cursor: default; }

.sp2-suit.active {
    background: var(--color-primary);
    border-color: var(--color-primary-dark);
}

.sp2-btn:focus-visible,
.sp2-suit:focus-visible {
    outline: 3px solid var(--color-text);
    outline-offset: 2px;
}

.sp2-feedback {
    min-height: 1.4em;
    margin: 0;
    font-weight: 600;
    color: var(--color-text-light);
    text-align: center;
}

/* Ten columns need more room than the default game column. */
.game-container .content:has(.sp2-stage) { max-width: 760px; }
