* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0d5e2e 0%, #1a7a42 30%, #0d5e2e 60%, #15673f 100%);
    min-height: 100vh;
    color: white;
    user-select: none;
    overflow-x: hidden;
}

.game-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 15px;
}

.header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 25px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.title {
    font-size: 1.8em;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

.score-panel {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-label {
    font-size: 0.7em;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #ffd700;
}

.controls {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 22px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffd700, #e6b800);
    color: #1a1a1a;
    font-size: 0.95em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.btn:hover {
    background: linear-gradient(180deg, #ffed4a, #ffd700);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-large {
    padding: 14px 35px;
    font-size: 1.1em;
}

/* Game Board */
.game-board {
    position: relative;
}

.top-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    gap: 15px;
}

.stock-area {
    display: flex;
    gap: 15px;
}

.foundations-area {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

.tableau-area {
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

/* Card Pile */
.card-pile {
    width: 105px;
    border-radius: 10px;
    position: relative;
}

.stock-pile, .waste-pile, .foundation {
    height: 148px;
}

.stock-pile {
    border: 2px dashed rgba(255, 255, 255, 0.25);
}

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

.foundation-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    color: rgba(255, 255, 255, 0.2);
    font-weight: bold;
    pointer-events: none;
}

.tableau {
    min-width: 105px;
}

/* Card */
.card {
    width: 105px;
    height: 148px;
    border-radius: 10px;
    position: absolute;
    cursor: pointer;
    transition: box-shadow 0.15s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.card-back {
    background: linear-gradient(135deg, #1a3a8a, #2255cc);
    border: 2px solid #fff;
}

.card-back::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(255, 255, 255, 0.04) 5px,
        rgba(255, 255, 255, 0.04) 10px
    );
}

.card-front {
    background: white;
    border: 2px solid #ccc;
    color: #1a1a1a;
}

.card-front.red {
    color: #cc0000;
}

.card-front.black {
    color: #1a1a1a;
}

.card-corner {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.card-corner .rank {
    font-size: 1em;
    font-weight: bold;
}

.card-corner .suit-icon {
    font-size: 1.1em;
}

.card-top {
    top: 5px;
    left: 6px;
}

.card-bottom {
    bottom: 5px;
    right: 6px;
    transform: rotate(180deg);
}

.card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3em;
}

.card.selected {
    box-shadow: 0 0 0 3px #ffd700, 0 0 20px rgba(255, 215, 0, 0.6);
    z-index: 1000 !important;
}

.card.dragging {
    opacity: 0.85;
    z-index: 9999 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: none;
}

/* Stock click area */
.stock-pile.clickable {
    cursor: pointer;
}

/* Empty tableau with ghost */
.tableau .card-pile {
    position: relative;
}

/* Win overlay */
.win-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.win-overlay.show {
    display: flex;
}

.win-content {
    background: linear-gradient(180deg, #1a1a2e, #16213e);
    padding: 45px 55px;
    border-radius: 20px;
    text-align: center;
    border: 3px solid #ffd700;
    box-shadow: 0 0 60px rgba(255, 215, 0, 0.3);
}

.win-content h2 {
    font-size: 2.5em;
    color: #ffd700;
    margin-bottom: 10px;
}

.win-content p {
    font-size: 1.2em;
    margin-bottom: 25px;
    color: rgba(255, 255, 255, 0.8);
}

.final-stats {
    margin-bottom: 30px;
    text-align: center;
}

.final-stats > div {
    font-size: 1.1em;
    margin: 8px 0;
    color: rgba(255, 255, 255, 0.9);
}

.final-stats span {
    color: #ffd700;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 900px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .top-row {
        flex-direction: column;
        align-items: center;
    }

    .foundations-area {
        margin-left: 0;
    }

    .card-pile, .card {
        width: 75px;
        height: 106px;
    }

    .card-center {
        font-size: 2em;
    }

    .card-corner .rank {
        font-size: 0.8em;
    }

    .card-corner .suit-icon {
        font-size: 0.9em;
    }

    .foundation-label {
        font-size: 1.5em;
    }
}

@media (max-width: 600px) {
    .card-pile, .card {
        width: 50px;
        height: 72px;
    }

    .card-center {
        font-size: 1.4em;
    }

    .card-corner .rank {
        font-size: 0.6em;
    }

    .card-corner .suit-icon {
        font-size: 0.7em;
    }

    .tableau-area {
        gap: 5px;
    }

    .foundations-area {
        gap: 5px;
    }

    .stock-area {
        gap: 8px;
    }
}
