/* Game specific styles for Spider Solitaire */

:root {
    --primary-color: #FF9800;
    --primary-hover: #F57C00;
    --text-main: #333;
    --bg-card: #FFFFFF;
    --felt-green: #2E7D32;
    --felt-border: #1B5E20;

    /* Responsive card sizing */
    --card-width: 35px;
    --card-height: 50px;
    --card-gap: 5px;
}

@media (min-width: 400px) {
    :root {
        --card-width: 40px;
        --card-height: 57px;
    }
}

@media (min-width: 600px) {
    :root {
        --card-width: 55px;
        --card-height: 79px;
    }
}

@media (min-width: 800px) {
    :root {
        --card-width: 70px;
        --card-height: 100px;
    }
}

.game-container {
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
    padding: 20px 0;
}

.game-container h1 {
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.game-description {
    margin-bottom: 3rem;
    color: #555;
    font-size: 1.1rem;
}

.game-controls {
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.game-area-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
    margin-bottom: 2rem;
    user-select: none;
    -webkit-user-select: none;
}

.game-board {
    background-color: var(--felt-green);
    border: 8px solid var(--felt-border);
    border-radius: 12px;
    padding: 10px;
    width: 100%;
    min-height: 600px;
    position: relative;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px 10px;
    color: #fff;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Completed Sets Area */
.completed-sets {
    display: flex;
    gap: 5px;
    min-height: var(--card-height);
}

.completed-sets .mini-card {
    width: calc(var(--card-width) * 0.5);
    height: calc(var(--card-height) * 0.5);
    background: #fff;
    border-radius: 2px;
    border: 1px solid #ccc;
    font-size: 0;
    position: relative;
}

.completed-sets .mini-card::after {
    content: 'K';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #333;
    font-size: 10px;
}

/* Stock */
.top-row {
    position: absolute;
    bottom: 15px;
    /* Spider solitaire stock often at bottom right */
    right: 15px;
    z-index: 100;
}

.stock-pile {
    width: var(--card-width);
    height: var(--card-height);
    background: repeating-linear-gradient(45deg,
            #1565C0,
            #1565C0 5px,
            #1976D2 5px,
            #1976D2 10px);
    border: 2px solid #fff;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stock-count {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-size: 12px;
}

/* Tableau */
.tableau-row {
    display: flex;
    justify-content: space-between;
    /* Evenly space 10 cols */
    margin-top: 10px;
    height: 100%;
}

.tableau {
    width: var(--card-width);
    position: relative;
    /* For absolute cards inside */
    /* min-height: 500px; */
}

/* Placeholder for empty col */
.tableau::before {
    content: '';
    display: block;
    width: var(--card-width);
    height: var(--card-height);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Cards */
.card {
    width: var(--card-width);
    height: var(--card-height);
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    position: absolute;
    /* Stacked via top styling */
    left: 0;
    font-family: Arial, sans-serif;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px;
    box-sizing: border-box;
    cursor: grab;
    z-index: 10;
    font-size: 12px;
}

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

.card.back {
    background: repeating-linear-gradient(45deg,
            #1565C0,
            #1565C0 5px,
            #1976D2 5px,
            #1976D2 10px);
    border: 1px solid #fff;
    cursor: default;
}

.red {
    color: #E53935;
}

.black {
    color: #333;
}

.card-top,
.card-center,
.card-bottom {
    pointer-events: none;
}

.card-top {
    text-align: left;
    line-height: 1;
}

/* .card-bottom { text-align: right; transform: rotate(180deg); } */
/* Too small usually */
.card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2em;
}

/* Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
}

.hidden {
    display: none;
}

/* Buttons */
.primary-btn {
    background-color: var(--primary-color);
    color: white;
    font-size: 1rem;
    font-weight: bold;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--primary-shadow);
}

.primary-btn:active {
    transform: translateY(4px);
    box-shadow: none;
}

.primary-btn:hover {
    background-color: var(--primary-hover);
}

/* Instructions */
.instructions {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    text-align: left;
    margin: 3rem auto 5rem;
    color: #444;
    line-height: 1.8;
}

.instructions h3 {
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: var(--primary-color);
    font-size: 1.3rem;
    font-weight: 700;
}

.instructions h3:first-child {
    margin-top: 0.5rem;
}