/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

/* Dark mode */
body.dark {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: #ecf0f1;
}

/* Game container */
.game-container {
    display: flex;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 20px;
}



/* Game area */
.game-area {
    display: flex;
    flex-direction: column;
    max-width: 800px;
    width: 100%;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.game-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-primary {
    background: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Game board */
.game-board {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

/* Foundation area */
.foundation-area {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.foundation-pile {
    width: 80px;
    height: 120px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
}

.foundation-pile.drag-over {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.3);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.7);
    border-width: 3px;
}

/* Tableau area */
.tableau-area {
    display: flex;
    justify-content: center;
    gap: 15px;
    min-height: 200px;
}

.tableau-pile {
    width: 80px;
    min-height: 200px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
    padding-bottom: 120px; /* Extra space for stacked cards */
}

.tableau-pile.drag-over {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.3);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.7);
    border-width: 3px;
}

/* Stock area */
.stock-area {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.stock-pile, .waste-pile {
    width: 80px;
    height: 120px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.stock-pile.drag-over, .waste-pile.drag-over {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.3);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.7);
    border-width: 3px;
}

/* Card styles */
.card {
    width: 70px;
    height: 100px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: absolute;
    user-select: none;
    z-index: 1;
}

/* Ensure pile highlighting shows through */
[data-pile].drag-over {
    z-index: 5;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

/* Stacked cards - all face-up cards in a stack are playable */
.card {
    cursor: pointer;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

/* Face-down cards are not playable */
.card:has(.card-back) {
    cursor: default;
}

.card:has(.card-back):hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.card:active {
    cursor: grabbing;
    transform: scale(1.05) translateY(-2px);
}

.card.dragging {
    opacity: 0.8;
    transform: rotate(5deg);
    z-index: 1000;
}

/* Drag preview styling */
.drag-preview-container {
    pointer-events: none;
    z-index: 1000;
}

.drag-preview-container .card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(76, 175, 80, 0.5);
}

/* Enhanced highlight for selected card destinations */
.drag-over {
    animation: pulse-highlight 1.5s ease-in-out infinite;
}

@keyframes pulse-highlight {
    0%, 100% {
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.7);
        background: rgba(76, 175, 80, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(76, 175, 80, 0.9);
        background: rgba(76, 175, 80, 0.4);
    }
}

.card.selected {
    box-shadow: 0 0 0 3px #4CAF50;
    transform: translateY(-2px);
}

.card-back {
    width: 70px;
    height: 100px;
    background: linear-gradient(45deg, #1e3c72, #2a5298);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-back:hover {
    transform: scale(1.05);
}

.empty-stock {
    width: 70px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

.card-value {
    font-weight: 600;
    font-size: 16px;
}

.card-suit {
    font-size: 20px;
    text-align: center;
}

.card.red {
    color: #d32f2f;
}

.card.black {
    color: #212121;
}

/* Card stacking in tableau */
.tableau-pile .card {
    margin-bottom: -60px;
}

.tableau-pile .card:last-child {
    margin-bottom: 0;
}

/* Win message */
.win-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.win-message.hidden {
    display: none;
}

.win-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.win-content h2 {
    color: #4CAF50;
    margin-bottom: 20px;
    font-size: 2rem;
}

.win-content p {
    margin-bottom: 30px;
    font-size: 1.2rem;
    color: #666;
}

/* Game over message */
.game-over-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.game-over-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.game-over-content h2 {
    color: #f44336;
    margin-bottom: 20px;
    font-size: 2rem;
}

.game-over-content p {
    margin: 15px 0;
    font-size: 16px;
    line-height: 1.5;
}

/* No moves indicator */
.no-moves-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 193, 7, 0.95);
    border-radius: 12px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 2px solid #ffc107;
    box-shadow: 0 8px 32px rgba(255, 193, 7, 0.3);
    z-index: 2000;
    animation: slideIn 0.3s ease-out;
}

.no-moves-indicator.hidden {
    display: none;
}

.no-moves-content {
    text-align: center;
    color: #333;
}

.no-moves-content p {
    margin: 8px 0;
    font-size: 16px;
    font-weight: 500;
}

.no-moves-content p:first-child {
    font-size: 18px;
    font-weight: 600;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Hint highlighting */
.hint-source {
    animation: hintPulse 1s ease-in-out infinite;
    border: 3px solid #4CAF50;
    border-radius: 8px;
}

.hint-target {
    animation: hintPulse 1s ease-in-out infinite;
    border: 3px solid #2196F3;
    border-radius: 8px;
}

@keyframes hintPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
}

.hint-target {
    animation: hintPulseBlue 1s ease-in-out infinite;
}

@keyframes hintPulseBlue {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(33, 150, 243, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(33, 150, 243, 0);
    }
}

/* Game Info Section */
.game-info {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 30px;
    margin-top: 30px;
    backdrop-filter: blur(10px);
    color: white;
}

.game-info h2 {
    font-size: 1.8rem;
    margin-bottom: 15px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.game-info h3 {
    font-size: 1.4rem;
    margin-top: 25px;
    margin-bottom: 12px;
    color: #f0f0f0;
}

.game-info p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.9);
}

.game-info ul {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.game-info li {
    padding: 8px 0;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
}

.game-info li strong {
    color: white;
}

/* Dark mode adjustments for game info */
body.dark .game-info {
    background: rgba(52, 73, 94, 0.3);
}

body.dark .game-info h2,
body.dark .game-info h3 {
    color: #ecf0f1;
}

/* Responsive design */
@media (max-width: 1200px) {
    .game-container {
        padding: 10px;
    }
}

@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .game-header h1 {
        font-size: 2rem;
    }
    
    .game-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .foundation-area, .tableau-area {
        gap: 10px;
    }
    
    .foundation-pile, .tableau-pile, .stock-pile, .waste-pile {
        width: 60px;
    }
    
    .foundation-pile, .stock-pile, .waste-pile {
        height: 90px;
    }
    
    .card {
        width: 50px;
        height: 70px;
        padding: 5px;
    }
    
    .card-back {
        width: 50px;
        height: 70px;
    }
    
    .empty-stock {
        width: 50px;
        height: 70px;
        font-size: 10px;
    }
    
    .tableau-pile .card {
        margin-bottom: -40px;
    }
    
    .card-value {
        font-size: 12px;
    }
    
    .card-suit {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .foundation-area, .tableau-area {
        gap: 5px;
    }
    
    .foundation-pile, .tableau-pile, .stock-pile, .waste-pile {
        width: 50px;
    }
    
    .card {
        width: 40px;
        height: 60px;
        padding: 3px;
    }
    
    .card-back {
        width: 40px;
        height: 60px;
    }
    
    .empty-stock {
        width: 40px;
        height: 60px;
        font-size: 8px;
    }
    
    .tableau-pile .card {
        margin-bottom: -30px;
    }
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes cardDeal {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card.dealing {
    animation: cardDeal 0.3s ease-out;
}

@keyframes winCelebration {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.win-content {
    animation: winCelebration 0.5s ease-in-out 3;
}

/* Windows 95-style bouncing cards */
.bouncing-card-win95 {
    position: absolute;
    pointer-events: none;
    z-index: 3000;
    transition: none;
    will-change: transform;
    
    /* Retro-style card appearance */
    border: 2px solid #000;
    border-radius: 4px;
    box-shadow: 
        0 0 0 1px #fff,
        2px 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 50%, #e0e0e0 100%);
    
    /* Pixelated edges for retro look */
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.bouncing-card-win95 .card-value {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.5);
}

.bouncing-card-win95 .card-suit {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.5);
}

/* Add some variety to card appearances */
.bouncing-card-win95:nth-child(odd) {
    box-shadow: 
        0 0 0 1px #fff,
        2px 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.8),
        0 0 8px rgba(255, 255, 0, 0.3);
}

.bouncing-card-win95:nth-child(even) {
    box-shadow: 
        0 0 0 1px #fff,
        2px 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.8),
        0 0 8px rgba(0, 255, 255, 0.3);
} 