body {
    background: linear-gradient(135deg, #f5e6cc, #d4c2a7); /* Subtle sandy beige to parchment gradient */
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    color: white;
    margin: 0;
    padding: 0;
    /* display: flex;
    justify-content: center;
    align-items: center; */
}
.overflow-hidden{overflow: hidden;}

.card {
    width: 10vw;
    max-width: 120px;
    min-width: 60px;
    aspect-ratio: 2 / 3;
    border-radius: 10px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(12px, 2vw, 18px);
    font-weight: bold;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3), inset 0 0 2px rgba(255, 255, 255, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    cursor: pointer;
    user-select: none;
    background: white;
    border: none; /* Removed golden border */
    background-size: cover;
    background-position: center;
}

.card:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    border: none; /* Removed golden border on hover */
}

.card:active {
    transform: translateY(0) scale(0.98);
}

.card.invalid {
    animation: shake 0.3s ease-in-out;
}

.stock-pile .card, .waste-pile .card {
    width: 6.7vw;
    max-width: 80px;
    min-width: 40px;
    aspect-ratio: 2 / 3;
}

.match-cell .card {
    width: 10vw;
    max-width: 120px;
    min-width: 60px;
    aspect-ratio: 2 / 3;
    position: absolute;
}

.match-cell .card:not(:last-child) {
    display: none; /* Hide all but the last card */
}

.drag-overlay {
    width: 10vw;
    max-width: 120px;
    min-width: 60px;
    aspect-ratio: 2 / 3;
    position: absolute;
    z-index: 1000;
    pointer-events: none;
}

.drag-overlay .card {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    background-size: cover;
    background-position: center;
}

.card.red {
    color: #e74c3c;
}

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

.stock-pile, .waste-pile, .match-cell {
    width: 6.7vw;
    max-width: 80px;
    min-width: 40px;
    aspect-ratio: 2 / 3;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.match-cell {
    width: 10vw;
    max-width: 120px;
    min-width: 60px;
    aspect-ratio: 2 / 3;
    position: relative;
    background-image: url('https://images.unsplash.com/photo-1546484396-fb3fc3a8d293?ixlib=rb-4.0.3&auto=format&fit=crop&w=1350&q=80');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.stock-pile:hover, .waste-pile:hover, .match-cell:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.5);
}

.stock-pile {
    cursor: pointer;
    background-image: url('cards/1_back@3x.png');
    background-size: cover;
    background-position: center;
}

.pyramid-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

.pyramid {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.pyramid-row {
    display: flex;
    justify-content: center;
    gap: clamp(5px, 1vw, 10px);
}

.pyramid-card {
    position: relative;
    margin-top: calc(-6.75vw - 2rem);
}

.pyramid-row:first-child .pyramid-card {
    margin-top: 0;
}

.game-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.stock-waste {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.match-section {
    display: flex;
    align-items: center;
}

.intro-deck {
    position: fixed;
    width: 10vw;
    max-width: 120px;
    min-width: 60px;
    aspect-ratio: 2 / 3;
    background-image: url('cards/1_back@3x.png');
    background-size: cover;
    background-position: center;
    z-index: 1000;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes deal-card {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(1); opacity: 1; }
}

@media (min-width: 640px) {
    .game-controls {
        flex-direction: row;
        justify-content: space-between;
    }
    .stock-waste {
        flex-direction: row;
        gap: 2rem;
    }
}

.win-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(44, 62, 80, 0.9));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    animation: fadeIn 0.5s ease-in;
}

.win-message h2 {
    color: #f1c40f;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.win-message button {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    border-radius: 10px;
    padding: 0.75rem 2rem;
    font-size: clamp(1rem, 2vw, 1.2rem);
}

.game-over-overlay {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(192, 57, 43, 0.8));
}

.game-over-popup {
    background: linear-gradient(135deg, #2c3e50, #c0392b);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
}

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

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.game-over-overlay {
    animation: fadeIn 0.5s ease-out forwards;
}

.game-over-popup {
    animation: slideUp 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.game-over-title {
    animation: pulse 1.5s infinite alternate, shake 0.5s 0.5s;
}

.score-badge {
    animation: slideUp 0.8s 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
}

.button-animate {
    transition: all 0.3s ease;
}

.button-animate:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.button-animate:active {
    transform: translateY(1px);
}

.confetti {
    position: absolute;
    width: clamp(5px, 1vw, 10px);
    height: clamp(5px, 1vw, 10px);
    background-color: #f00;
    opacity: 0;
}

@keyframes confetti-fall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

.header {
    backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 1rem;
}

.game-board {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* .btn {
    transition: all 0.3s ease;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    background: linear-gradient(45deg, #3498db, #2980b9);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
} */

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.section-title {
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    color: #f1c40f;
}

.stats {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.5rem 1.4rem 0.5rem 1rem;
    font-size: clamp(0.7rem, 1.5vw, 0.9rem);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 0;
    border: none;
    background: transparent;
}

.pyramid-card:empty {
    visibility: hidden;
}

@media (max-width: 480px) {
    .card {
        min-width: 50px;
    }
    .stock-pile .card, .waste-pile .card {
        min-width: 33px;
    }
    .match-cell .card {
        min-width: 50px;
    }
    .pyramid-card {
        margin-top: calc(-6vw - 1.5rem);
    }
}

@keyframes particleFade {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(0, -30px) scale(1.5); }
}
.animated-card {
    transform-style: preserve-3d;
    backface-visibility: hidden;
}
.animated-card {
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}
#timerContainer {
    display: none;
}
.header {
    padding: 0px !important;
    background: transparent !important;
    margin-bottom: -40px !important;
    z-index: 11 !important;
    position: relative !important;
    backdrop-filter: none !important;
}
.game-board {
    background: transparent;
    border: none;
    box-shadow: none;
}



@media screen and (min-width:1200px){
    .pyramid-card {margin-top: calc(-6.5vw - 2rem);}
    .pyramid-card .card { width: 98px; }
    .pyramid-row{gap: 7px;}
    
    .match-cell {
        width: 79px;
    }
    
    .container {
        width: 100%;
        max-width: 100% !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .pyramid-card:empty {width: 98px !important;}

}
@media screen and (min-width:1500px){
    .pyramid-card { margin-top: calc(-5.75vw - 2rem); }
    .pyramid-card .card { width: 10vw; }
}


@media screen and (max-width:1250px){
    .pyramid-card .card { width: 80px; }
    .pyramid-card { margin-top: -97px; }
    .sm\:text-base {font-size: 13px !important;line-height: 1.2 !important;}
    .match-cell {width: 79px;}
    
}

@media screen and (max-width:1100px){
    .pyramid-card .card { width: 70px; }
    .pyramid-card { margin-top: -82px; }
    .pyramid-row{ gap: 5px;}
    .game-board { padding: 0;}
    .match-cell{width: 6.60vw;}
}

@media screen and (max-width:991px){
    body .top_timer_container {transform: translateX(-300px) !important; }
    body.enabled, body.body {
        margin-left: 0 !important;
    }
}
