/**
 * Solitaire Game Engine - Professional CSS
 * GPU-accelerated animations, responsive design, touch-optimized
 */

/* GPU acceleration baseline */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

:root {
    --card-gap: clamp(6px, 2vw, 12px);
    --card-overlap: clamp(20px, 5vw, 2.5rem);
}



body.game-active #gameRoot.solitaire {
    background: radial-gradient(hsla(140, 60%, 15%, 1) 92px, transparent 485px),
        radial-gradient(hsla(150, 55%, 20%, 0.9) 118px, transparent 625px),
        radial-gradient(hsla(135, 50%, 12%, 0.95) 73px, transparent 395px),
        radial-gradient(hsla(145, 45%, 18%, 0.85) 145px, transparent 720px),
        radial-gradient(hsla(155, 55%, 16%, 0.9) 88px, transparent 540px),
        radial-gradient(hsla(142, 60%, 14%, 0.95) 132px, transparent 680px),
        radial-gradient(hsla(138, 50%, 10%, 0.8) 67px, transparent 440px),
        radial-gradient(hsla(148, 55%, 19%, 0.7) 108px, transparent 590px),
        radial-gradient(hsla(152, 50%, 17%, 0.8) 97px, transparent 765px),
        linear-gradient(135deg, #051008 0%, #0a1512 50%, #08120f 100%);
    background-size: 1215px 1840px, 1680px 975px, 825px 1390px, 1470px 1125px, 695px 1755px, 1920px 840px, 1065px 1580px, 780px 1260px, 1545px 1015px, 100% 100%;
    background-position: 345px 1165px, 1725px 420px, 95px 1890px, 1085px 95px, 1540px 1420px, 285px 745px, 865px 1685px, 1390px 580px, 520px 315px, center;
    background-repeat: repeat, repeat, repeat, repeat, repeat, repeat, repeat, repeat, repeat, no-repeat;
    box-shadow: inset 0 0 10vw hsla(155, 55%, 7%, 0.7);
    min-height: 100vh;
    overflow: hidden;
}

.solitaire-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    min-height: 100vh;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.solitaire-controls {
    display: flex;
    gap: var(--card-gap);
    margin-bottom: 1rem;
    font-size: smaller;
}

.solitaire-stats {
    margin-bottom: 1rem;
}

/* Top row - Stock, Waste, Foundations */
.solitaire-top-row {
    display: flex;
    gap: var(--card-gap);
    margin-bottom: 2rem;
    justify-content: flex-start;
}

.card-pile {
    position: relative;
    width: calc((100% - (6 * var(--card-gap))) / 7);
    aspect-ratio: 5 / 7;
    flex-shrink: 0;
}



.card-slot {
    width: 100%;
    height: 100%;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 8px;

    color: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    transition: all 0.2s ease;
    cursor: pointer;
    transform: translateZ(0);
    will-change: transform, opacity;
    position: relative;
    box-sizing: border-box;
    font-size: 6vw;
}

.card-slot.with-cards {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    border-style: solid;

}

/* Külön szabály, ha a slotban kártyahátlap van (Stock) */
.card-slot .card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 6px;
    /* Kicsit kisebb, hogy beférjen a keretbe */
}

.solitaire-tableau .card-slot.empty {
    align-items: flex-start;
    border: none;
    background: none;
}

.card-slot.empty[data-pile="stock"]:before {
    content: '↻';
}

.solitaire-tableau .placeholder-king {
    width: 100%;
    aspect-ratio: 5 / 7;
    border-radius: 6px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: larger;
    font-weight: bold;
    pointer-events: none;

}

.placeholder-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 80%;
}

.solitaire-tableau .placeholder-king svg,
.placeholder-icon svg {

    fill: #fff;
    opacity: 0.2;
    width: 80%;
}

/* Tableau - JAVÍTOTT: Scroll eltávolítva */
.solitaire-tableau {
    display: flex;
    gap: var(--card-gap);
    margin-bottom: 30px;

    padding-bottom: 10px;
    justify-content: space-between;

    flex-wrap: nowrap;
}

.tableau-column {
    position: relative;

    flex: 1;


}

/* Playing cards */
.playing-card {
    position: absolute;
    width: 100%;
    aspect-ratio: 5 / 7;
    border-radius: clamp(4px, 0.5vw, 8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
    top: calc(var(--index, 0) * var(--card-overlap));
}

/* JAVÍTOTT: Csak a felfordított kártyákra van hover effekt */
.playing-card.face-up:hover {
    outline: solid 2px gold;

}

/* JAVÍTOTT: Lefordított kártyákon nincs kéz kurzor */
.playing-card.face-down {
    cursor: default;
}

.playing-card.selected {
    transform: translateY(-10px) scale(1.05) translateZ(0);
    box-shadow: 0 8px 24px rgba(52, 152, 219, 0.6);
    z-index: 20;
}

.playing-card.dragging {
    z-index: 1000;
    cursor: grabbing;
    transform: scale(1.05) rotate(3deg) translateZ(0);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);

}

.playing-card.dragging-group {
    z-index: 999;
    cursor: grabbing;
    transform: scale(1.05) rotate(3deg) translateZ(0);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.playing-card.hint {
    animation: hint-pulse 0.6s ease-in-out;
}

data-action="autowin" {
    width: 100%;
    flex-wrap: wrap;
}

@keyframes hint-pulse {

    0%,
    100% {
        transform: translateY(0) scale(1) translateZ(0);
    }

    50% {
        transform: translateY(-15px) scale(1.1) translateZ(0);
        box-shadow: 0 12px 32px rgba(46, 204, 113, 0.6);
    }
}

/* Card faces */
.card-back {
    width: 100%;
    height: 100%;
    background: url(/games/solitaire/assets/card-back.svg);
    border-radius: clamp(4px, 0.5vw, 8px);
    position: relative;
    box-sizing: border-box;
    border: solid clamp(3px, 0.5vw, 4px) #00a08f;
}



.card-front {
    width: 100%;
    min-height: 100%;
    background: linear-gradient(to bottom, #efefee, #e4e2dd);
    box-shadow: inset 0 0 0px 1px #fff;
    border: solid 2px #fff;
    border-radius: clamp(4px, 0.5vw, 8px);
    box-sizing: border-box;
    position: relative;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    padding: clamp(3px, 0.5vw, 1rem);
    gap: 0;
    font-size: clamp(1rem, 4vw, 2rem);
    font-weight: 900;
    line-height: 0;
}

.card-corner {
    display: flex;
    justify-content: space-between;
    align-items: center;

}

.small-suit {
    width: 30%;
    flex-shrink: 0;
}

.card-front.hearts,
.card-front.diamonds {
    color: #d9333a;
}

.card-front.hearts svg,
.card-front.diamonds svg {
    fill: #d9333a;
}


.card-front.spades,
.card-front.clubs {
    color: #21314a;
}

.card-front.spades svg,
.card-front.clubs svg {
    fill: #21314a;
}


.card-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.card-center-graphic {
    width: 84%;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
}

.card-center-graphic svg {

    display: block;
}


/* Game controls */
.game-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--card-gap);
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}


.game-stats {
    display: flex;
    gap: 20px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

/* Performance optimizations */
.playing-card,
.card-slot,
.btn-control {
    contain: layout style paint;
}


.playing-card.flipping {
    animation: softFlip 0.4s ease-in-out both;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}


@keyframes softFlip {
    0% {
        transform: perspective(2000px) rotateY(0deg);
    }

    50% {
        transform: perspective(2000px) rotateY(90deg) scale(1.02);
        opacity: 0.9;
    }

    100% {
        transform: perspective(2000px) rotateY(0deg) scale(1);
        opacity: 1;
    }
}