/* Klondike Solitaire Styles */

:root {
    --primary-gradient: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    --dark-bg: #0f2027;
    --card-bg: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --slot-bg: rgba(0, 0, 0, 0.2);
    --slot-border: rgba(255, 255, 255, 0.2);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: radial-gradient(circle at center, #203a43 0%, #2c5364 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.klondike-game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.header-title {
    text-align: center;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.back-button,
.control-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.back-button:hover,
.control-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Stats */
.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.stat-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-label {
    color: var(--text-secondary);
    margin-right: 8px;
}

.stat-value {
    font-weight: bold;
    color: #4facfe;
}

/* Board */
.game-board {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.top-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.stock-waste-container {
    display: flex;
    gap: 20px;
}

.foundations-container {
    display: flex;
    gap: 15px;
}

.tableau-row {
    display: flex;
    justify-content: space-between;
    flex: 1;
    min-height: 400px;
    gap: 10px;
}

.card-slot {
    width: 100px;
    height: 140px;
    border: 2px dashed var(--slot-border);
    border-radius: 8px;
    background: var(--slot-bg);
    position: relative;
    transition: all 0.2s;
}

.card-slot.highlight {
    border-color: #4facfe;
    background: rgba(79, 172, 254, 0.2);
    box-shadow: 0 0 15px rgba(79, 172, 254, 0.5);
}

/* Card Styles (Adapted from Durak) */
.card {
    width: 100px;
    height: 140px;
    background: linear-gradient(180deg, #fff 0%, #f0f0f0 100%);
    border-radius: 6px;
    border: 1px solid #ccc;
    position: absolute;
    /* Changed to absolute for easier stacking */
    top: 0;
    left: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    user-select: none;
    cursor: grab;
    color: #1a1a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s;
}

.card:active {
    cursor: grabbing;
}

.card.red {
    color: #e53935;
}

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

/* Card Face Content */
.card-content {
    width: 100%;
    height: 100%;
    position: relative;
}

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

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

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

.card-corner .rank {
    font-size: 18px;
    font-weight: bold;
}

.card-corner .suit {
    font-size: 18px;
}

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

.suit-large {
    font-size: 48px;
}

/* Card Back */
.card.back {
    background: repeating-linear-gradient(45deg,
            #1e3c72,
            #1e3c72 10px,
            #2a5298 10px,
            #2a5298 20px);
    border: 2px solid #fff;
}

.card.back .card-content {
    display: none;
}

/* Dragging state */
.card.dragging {
    z-index: 1000 !important;
    pointer-events: none;
    /* Let events pass through to drop targets */
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

/* Foundation Placeholders */
.foundation-slot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    opacity: 0.2;
}

#foundation-0::before {
    content: '♥';
    color: #e53935;
}

#foundation-1::before {
    content: '♦';
    color: #e53935;
}

#foundation-2::before {
    content: '♣';
    color: #fff;
}

#foundation-3::before {
    content: '♠';
    color: #fff;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal.not-visible {
    display: none;
}

.modal-content {
    background: #1a1a2e;
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    color: #ffd700;
}

.result-title {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #fff;
}

.result-message {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: #ccc;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.primary-button,
.secondary-button {
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-size: 1rem;
}

.primary-button {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
}

.secondary-button {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 900px) {

    .card-slot,
    .card {
        width: 60px;
        height: 84px;
    }

    .card-corner .rank {
        font-size: 14px;
    }

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

    .suit-large {
        font-size: 30px;
    }

    .card-corner.top-left {
        top: 2px;
        left: 2px;
    }

    .card-corner.bottom-right {
        bottom: 2px;
        right: 2px;
    }

    .foundations-container {
        gap: 8px;
    }

    .stock-waste-container {
        gap: 8px;
    }

    .tableau-row {
        gap: 4px;
    }
}

@media (max-width: 600px) {
    .klondike-game-container {
        padding: 5px;
    }

    .game-header {
        padding: 8px 10px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .header-title {
        order: -1;
        width: 100%;
        margin-bottom: 5px;
    }

    .header-title h1 {
        font-size: 1.2rem;
    }

    .card-slot,
    .card {
        width: 42px;
        height: 60px;
    }

    .card-corner .rank {
        font-size: 10px;
    }

    .card-corner .suit {
        font-size: 10px;
    }

    .suit-large {
        font-size: 20px;
    }

    .game-board {
        padding: 10px;
        gap: 15px;
    }
}