/* === FONTS === */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Quicksand:wght@300;400;500;700&display=swap');

/* === CUSTOM ANIMATIONS === */
@keyframes cardArrival {
    from { transform: translateY(-100px) rotate(10deg); opacity: 0; }
    to { transform: translateY(0) rotate(0deg); opacity: 1; }
}

@keyframes winPulse {
    0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(212, 175, 55, 0); }
    100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); }
}

/* === EFFECTS === */
body {
    background-image: url('/static/img/felt-texture.png');
    background-size: 500px;
    background-repeat: repeat;
    background-attachment: fixed;
}

.noise-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIj48ZmlsdGVyIGlkPSJuIj48ZmVidXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC42NSIgbnVtT2N0YXZlcz0iMyIgc3RpdGNoVGlsZXM9InN0aXRjaCIvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNuKSIgb3BhY2l0eT0iMC4wNSIvPjwvc3ZnPg==');
    pointer-events: none;
    z-index: 100;
}

/* === CARD STYLES === */
:root {
    --card-offset: 25px;
    --card-padding: 0.5rem;
}

@media (max-width: 640px) {
    :root {
        --card-offset: 15px;
        --card-padding: 0.25rem;
    }
}

.card-slot {
    aspect-ratio: 2.5/3.5;
    border: 2px dashed rgba(212, 175, 55, 0.2);
    border-radius: 0.3rem;
    background: rgba(0, 0, 0, 0.1);
}

.playing-card {
    aspect-ratio: 2.5/3.5;
    position: relative;
    user-select: none;
    cursor: grab;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
    border-radius: 0.3rem;
    perspective: 1000px;
}

.playing-card:active {
    cursor: grabbing;
    transform: scale(1.05) rotate(2deg);
    z-index: 1000 !important;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    border-radius: 0.3rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.card-face, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 0.3rem;
    border: 1px solid rgba(0,0,0,0.1);
}

.card-face {
    background: white;
    color: black;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--card-padding);
}

.card-face .card-suit { font-size: 1.5rem; line-height: 1; }
.card-face .card-rank { font-size: 1.2rem; font-weight: bold; line-height: 1; }

@media (max-width: 640px) {
    .card-face .card-suit { font-size: 1rem; }
    .card-face .card-rank { font-size: 0.8rem; }
}

.card-back {
    background: url('/static/img/card-back.png') center/cover no-repeat;
    transform: rotateY(180deg);
}

.card-face.red { color: #e11d48; }
.card-face.black { color: #1f2937; }

.playing-card.card-hidden .card-inner {
    transform: rotateY(180deg);
}

/* module: game */
.tableau-pile {
    position: relative;
    min-height: 150px;
}

.tableau-pile .playing-card {
    position: absolute;
    width: 100%;
}

/* Stacking offset */
.tableau-pile .playing-card:nth-child(2) { top: calc(1 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(3) { top: calc(2 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(4) { top: calc(3 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(5) { top: calc(4 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(6) { top: calc(5 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(7) { top: calc(6 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(8) { top: calc(7 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(9) { top: calc(8 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(10) { top: calc(9 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(11) { top: calc(10 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(12) { top: calc(11 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(13) { top: calc(12 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(14) { top: calc(13 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(15) { top: calc(14 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(16) { top: calc(15 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(17) { top: calc(16 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(18) { top: calc(17 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(19) { top: calc(18 * var(--card-offset)); }
.tableau-pile .playing-card:nth-child(20) { top: calc(19 * var(--card-offset)); }

