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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #0f4c75 0%, #3282b8 50%, #bbe1fa 100%);
    min-height: 100vh;
    color: #333;
    padding: 20px;
    user-select: none;
}

.game-container {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.game-header {
    text-align: center;
    margin-bottom: 30px;
}

.game-header h1 {
    color: #0f4c75;
    font-size: 2.5em;
    margin-bottom: 20px;
    font-weight: 700;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    font-weight: 600;
}

.stat span {
    color: #3282b8;
    font-weight: 700;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: #3282b8;
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn:hover {
    background: #0f4c75;
    transform: translateY(-2px);
}

.btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.game-board {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stock-pile, .waste-pile {
    width: 80px;
    height: 110px;
    position: relative;
}

.foundation-piles {
    display: flex;
    gap: 10px;
}

.card-slot {
    width: 80px;
    height: 110px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.5);
    position: relative;
    transition: all 0.3s ease;
}

.foundation-slot {
    border-color: #3282b8;
    background: rgba(50, 130, 184, 0.1);
}

.stock-slot, .waste-slot {
    position: relative;
    cursor: pointer;
}

.empty-slot {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #666;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 8px;
}

.empty-foundation {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #3282b8;
    opacity: 0.5;
}

.tableau {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.tableau-pile {
    width: 80px;
    min-height: 150px;
    position: relative;
}

.empty-tableau {
    width: 80px;
    height: 110px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #666;
    background: rgba(255, 255, 255, 0.3);
}

.card {
    width: 80px;
    height: 110px;
    border-radius: 8px;
    background: white;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    user-select: none;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
}

.card.red {
    color: #e74c3c;
}

.card.black {
    color: #2c3e50;
}

.card.face-down {
    background: linear-gradient(135deg, #34495e, #2c3e50);
    color: white;
    cursor: default;
}

.card.face-down:hover {
    transform: none;
}

.card-back {
    font-size: 40px;
}

.card-corner {
    position: absolute;
    font-size: 10px;
    line-height: 1;
}

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

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

.card-center {
    font-size: 32px;
    line-height: 1;
}

.card-value {
    font-weight: bold;
    margin-bottom: 2px;
}

.card-suit {
    font-size: 8px;
}

.card.selected {
    border: 3px solid #f39c12;
    transform: translateY(-10px);
    box-shadow: 0 8px 20px rgba(243, 156, 18, 0.4);
}

.card.dragging {
    opacity: 0.6;
    transform: translateY(-5px) rotate(3deg);
    z-index: 999;
}

.drag-proxy {
    pointer-events: none;
    z-index: 1000;
}

.drag-proxy .card {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    transform: rotate(5deg);
}

.valid-drop-target {
    border-color: #27ae60 !important;
    background: rgba(39, 174, 96, 0.2) !important;
    transform: scale(1.05);
}

.invalid-drop-target {
    border-color: #e74c3c !important;
    background: rgba(231, 76, 60, 0.2) !important;
}

.auto-complete-animation {
    animation: cardFly 1s ease-out forwards;
}

@keyframes cardFly {
    0% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.2) rotate(360deg);
    }
    100% {
        transform: scale(0) rotate(720deg);
        opacity: 0;
    }
}

.win-celebration .card {
    animation: celebrate 2s ease-in-out infinite;
}

@keyframes celebrate {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(5deg); }
    75% { transform: translateY(-10px) rotate(-5deg); }
}

.game-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-message.show {
    display: flex;
}

.message-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
}

.message-content h2 {
    color: #3282b8;
    margin-bottom: 15px;
    font-size: 2em;
}

.message-content p {
    margin-bottom: 15px;
    font-size: 1.2em;
    color: #495057;
}

/* 拖拽增强效果 */
.card[draggable="true"] {
    cursor: grab;
}

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

.card:not(.face-down):hover::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 20px;
        margin: 10px;
    }
    
    .game-header h1 {
        font-size: 2em;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .top-row {
        flex-direction: column;
        gap: 20px;
        align-items: center;
    }
    
    .foundation-piles {
        order: 2;
    }
    
    .tableau {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .card, .card-slot, .empty-tableau {
        width: 60px;
        height: 80px;
        font-size: 12px;
    }
    
    .card-center {
        font-size: 24px;
    }
    
    .card-back {
        font-size: 30px;
    }
    
    .empty-foundation {
        font-size: 24px;
    }
    
    .tableau-pile {
        width: 60px;
    }
}

@media (max-width: 480px) {
    .tableau {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }
    
    .card, .card-slot, .empty-tableau {
        width: 50px;
        height: 70px;
        font-size: 10px;
    }
    
    .card-center {
        font-size: 20px;
    }
    
    .card-corner {
        font-size: 8px;
    }
}

/* 触摸设备优化 */
@media (hover: none) {
    .card:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
    
    .card.selected {
        transform: translateY(-5px);
    }
}