/* Spider Solitaire - Casino Poker Table Theme */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #fff;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Start Screen Overlay */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, rgba(10, 92, 61, 0.98) 0%, rgba(5, 46, 30, 0.98) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
    overflow: hidden;
}

.start-screen.hidden {
    display: none !important;
    pointer-events: none !important;
}

.start-content {
    text-align: center;
    animation: slideUp 0.5s ease;
    position: relative;
    z-index: 1;
}

.start-logo {
    width: 400px;
    height: auto;
    margin-bottom: 30px;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.7));
    animation: logoFloat 3s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.start-logo:hover {
    transform: scale(1.05);
}

.start-title {
    font-size: 48px;
    font-weight: 700;
    color: #FFD700;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
    letter-spacing: 2px;
    margin-top: 20px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: #0a5c3d; /* Casino green felt */
    background-image:
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 50%);
    border-radius: 12px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Top Bar */
.top-bar {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 10px 20px;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.game-title {
    font-size: 24px;
    font-weight: 700;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    letter-spacing: 1px;
}

.stats-bar {
    display: flex;
    gap: 25px;
    justify-content: center;
    padding: 8px 20px;
    margin-bottom: 10px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 10px;
    color: #FFD700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
    font-weight: 600;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* Game Area */
.game-area {
    min-height: 600px;
    position: relative;
}

/* Foundation Container */
.foundation-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 8px;
}

#foundation-slots {
    display: flex;
    gap: 8px;
}

.foundation-slot {
    width: 70px;
    height: 95px;
    border: 2px dashed rgba(255, 215, 0, 0.4);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 35px;
    color: rgba(255, 215, 0, 0.3);
    position: relative;
    transition: all 0.3s ease;
}

.foundation-slot.filled {
    background: rgba(255, 215, 0, 0.15);
    border-color: #FFD700;
    border-style: solid;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.foundation-card-image {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    object-fit: cover;
    animation: foundationAppear 0.5s ease, foundationGlow 2s ease-in-out infinite;
}

@keyframes foundationAppear {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.1) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

@keyframes foundationGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.9);
    }
}

@keyframes glow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Tableau Container */
.tableau-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 15px;
    min-height: 420px;
}

.tableau-column {
    min-width: 80px;
    min-height: 120px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.15);
    position: relative;
    transition: all 0.3s ease;
}

.tableau-column.empty {
    border-color: rgba(255, 215, 0, 0.4);
    background: rgba(255, 215, 0, 0.05);
}

.tableau-column.highlight {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

/* Cards */
.card {
    width: 80px;
    height: 110px;
    border-radius: 6px;
    position: absolute;
    left: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    user-select: none;
    will-change: transform, opacity;
    touch-action: none; /* Prevent default touch actions for better dragging */
}

/* Touch drag element for mobile */
#touch-drag-element {
    pointer-events: none;
    user-select: none;
    touch-action: none;
    z-index: 10000;
}

.card-image {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    display: block;
    pointer-events: none;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.5);
    z-index: 100;
}

.card.dragging {
    opacity: 0.7;
    transform: rotate(3deg);
}

.card.dragging-sequence {
    opacity: 0.7;
    /* Maintain relative z-index for cards in sequence */
}

.card.face-down {
    background-image: url('/spider-solitaire/assets/card_backside.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid #333;
    cursor: default;
    pointer-events: none;
}

.card.dimmed {
    opacity: 0.8;
    filter: brightness(0.85);
    transition: all 0.3s ease;
}

.card.newly-dealt {
    animation: dealHighlight 0.8s ease;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

@keyframes dealHighlight {
    0% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(255, 215, 0, 1);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    }
}

.card.face-down:hover {
    transform: none;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* Stock */
.stock {
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stock:hover .card-back-container {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4);
}

.card-back-container {
    width: 80px;
    height: 110px;
    border-radius: 6px;
    background-image: url('/spider-solitaire/assets/card_backside.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid #FFD700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    margin: 0 auto;
    will-change: transform, opacity;
}

.stock-label {
    display: block;
    margin-top: 8px;
    color: #FFD700;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stock-count {
    display: block;
    margin-top: 3px;
    color: #fff;
    font-size: 11px;
}

.stock.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.stock.disabled:hover .card-back-container {
    transform: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.stock.highlight .card-back-container {
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    animation: stockPulse 1s ease-in-out 3;
}

@keyframes stockPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 1);
    }
}

/* Controls */
.controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 10px;
    padding: 10px;
}

.btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    background: rgba(255, 215, 0, 0.3);
    border-color: #FFD700;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

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

.btn-primary {
    background: rgba(255, 215, 0, 0.3);
    border-color: #FFD700;
}

.btn-hint {
    min-width: 100px;
    background: rgba(255, 215, 0, 0.2);
    border-color: #FFD700;
    animation: hintPulse 2s ease-in-out infinite;
}

.btn-hint:hover {
    background: rgba(255, 215, 0, 0.4);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.5);
}

#sound-btn {
    transition: opacity 0.3s ease;
}

@keyframes hintPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    }
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.15);
}

/* Navigation Links */
.nav-link-home,
.nav-link-games {
    position: fixed;
    bottom: 20px;
    background: rgba(10, 92, 61, 0.95);
    padding: 12px 20px;
    border-radius: 25px;
    text-decoration: none;
    color: #FFD700;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.6);
    z-index: 1000;
}

.nav-link-home {
    left: 20px;
}

.nav-link-games {
    right: 20px;
}

.nav-link-home:hover,
.nav-link-games:hover {
    background: rgba(10, 92, 61, 1);
    border-color: #FFD700;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

/* Instructions Overlay */
.instructions-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.instructions-overlay.active {
    display: flex;
}

.instructions-popup {
    background: linear-gradient(135deg, rgba(10, 92, 61, 0.98) 0%, rgba(5, 46, 30, 0.98) 100%);
    border-radius: 15px;
    padding: 30px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border: 3px solid #FFD700;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.instructions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.instructions-title {
    font-size: 26px;
    font-weight: 700;
    color: #FFD700;
    margin: 0;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid #FFD700;
    font-size: 28px;
    cursor: pointer;
    color: #FFD700;
    padding: 5px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: rotate(90deg);
}

.instructions-content h3 {
    color: #FFD700;
    font-size: 20px;
    margin: 20px 0 10px 0;
}

.instructions-content p,
.instructions-content li {
    color: #e0e0e0;
    line-height: 1.8;
    margin-bottom: 15px;
}

.instructions-content ul,
.instructions-content ol {
    padding-left: 25px;
}

.instructions-content strong {
    color: #FFD700;
}

/* Win Overlay */
.win-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.win-overlay.active {
    display: flex;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.win-card {
    background: linear-gradient(135deg, rgba(10, 92, 61, 0.98) 0%, rgba(5, 46, 30, 0.98) 100%);
    border-radius: 20px;
    padding: 50px;
    text-align: center;
    border: 4px solid #FFD700;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.win-text {
    font-size: 42px;
    font-weight: 700;
    color: #FFD700;
    margin-bottom: 10px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
    animation: pulse 2s ease-in-out infinite;
}

.win-subtitle {
    font-size: 20px;
    color: #e0e0e0;
    margin-bottom: 25px;
}

.win-score {
    font-size: 32px;
    color: #fff;
    margin: 20px 0;
    font-weight: 600;
}

.win-score span {
    color: #FFD700;
    font-size: 40px;
    font-weight: 700;
}

.win-stats {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 25px 0;
    font-size: 18px;
    color: #e0e0e0;
}

.win-stats span {
    color: #FFD700;
    font-weight: 700;
}

/* Stuck Screen Styling */
.stuck-card {
    border-color: #FF8C00; /* Orange instead of gold */
    box-shadow: 0 0 50px rgba(255, 140, 0, 0.4);
}

.stuck-text {
    color: #FF8C00; /* Orange warning color */
    animation: none; /* No pulsing for stuck screen */
}

/* SEO Content */
.seo-content {
    background: rgba(0, 0, 0, 0.3);
    margin-top: 50px;
    padding: 40px;
    border-radius: 12px;
    border: 2px solid rgba(255, 215, 0, 0.2);
}

.seo-container h2 {
    color: #FFD700;
    font-size: 28px;
    margin-bottom: 20px;
}

.seo-container h3 {
    color: #FFD700;
    font-size: 22px;
    margin: 30px 0 15px 0;
}

.seo-container p,
.seo-container li {
    color: #e0e0e0;
    line-height: 1.8;
    margin-bottom: 15px;
}

.seo-container ul {
    list-style: none;
    padding-left: 0;
}

.seo-container ul li {
    padding-left: 25px;
    position: relative;
}

.seo-container ul li::before {
    content: '♠';
    position: absolute;
    left: 0;
    color: #FFD700;
}

/* Footer */
.game-footer {
    background: rgba(0, 0, 0, 0.4);
    margin-top: 50px;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
}

.footer-meta {
    color: #e0e0e0;
}

.footer-meta a {
    color: #FFD700;
    text-decoration: none;
    margin: 0 15px;
    transition: all 0.3s ease;
}

.footer-meta a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .tableau-container {
        gap: 8px;
    }

    .tableau-column {
        min-width: 75px;
    }

    .card {
        width: 75px;
        height: 105px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .stats-bar {
        gap: 15px;
        flex-wrap: wrap;
    }

    .tableau-container {
        gap: 3px;
    }

    .tableau-column {
        min-width: calc((100vw - 60px) / 10);
    }

    .card {
        width: calc((100vw - 60px) / 10);
        height: calc(((100vw - 60px) / 10) * 1.4);
    }

    .card-back-container {
        width: calc((100vw - 60px) / 10);
        height: calc(((100vw - 60px) / 10) * 1.4);
    }

    .controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 11px;
    }

    .foundation-container {
        gap: 4px;
    }

    #foundation-slots {
        gap: 3px;
    }

    .foundation-slot {
        width: calc((100vw - 100px) / 9);
        height: calc(((100vw - 100px) / 9) * 1.35);
    }

    .stock {
        min-width: calc((100vw - 100px) / 9);
    }

    .start-logo {
        width: 300px;
    }

    .start-title {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .game-title {
        font-size: 18px;
    }

    .stat-value {
        font-size: 16px;
    }

    .stat-label {
        font-size: 9px;
    }

    .tableau-container {
        gap: 2px;
    }

    .tableau-column {
        min-width: calc((100vw - 40px) / 10);
    }

    .card {
        width: calc((100vw - 40px) / 10);
        height: calc(((100vw - 40px) / 10) * 1.4);
    }

    .card-back-container {
        width: calc((100vw - 40px) / 10);
        height: calc(((100vw - 40px) / 10) * 1.4);
    }

    .foundation-container {
        gap: 2px;
    }

    #foundation-slots {
        gap: 2px;
    }

    .foundation-slot {
        width: calc((100vw - 60px) / 9);
        height: calc(((100vw - 60px) / 9) * 1.35);
        font-size: 20px;
    }

    .stock {
        min-width: calc((100vw - 60px) / 9);
    }

    .stock-label {
        font-size: 9px;
    }

    .stock-count {
        font-size: 9px;
    }

    .btn {
        padding: 6px 10px;
        font-size: 10px;
    }

    .start-logo {
        width: 200px;
    }

    .start-title {
        font-size: 24px;
    }
}
