/**
 * Solitaire Game - Clean CSS
 */

:root {
    --card-gap: clamp(6px, 2vw, 12px);
    --card-overlap: clamp(16px, 4vw, 2.25rem);
    --card-radius: clamp(4px, 0.5vw, 8px);
    --card-border: clamp(3px, 0.5vw, 4px);
    --red: #d9333a;
    --black: #21314a;
}

/* === LAYOUT === */

body.game-active #gameRoot.solitaire {
    color: #fff;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 0% 100%, hsl(175, 50%, 35%) 0%, transparent 55%),
        radial-gradient(ellipse at 100% 0%, hsl(145, 55%, 40%) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 50%, hsl(160, 50%, 30%) 0%, transparent 50%),
        linear-gradient(135deg, #2a796c, #2f9361);
}

.solitaire-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    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 === */

.solitaire-top-row {
    display: flex;
    gap: var(--card-gap);
    margin-bottom: 2rem;
}

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

/* === CARD SLOTS === */

.card-slot {
    width: 100%;
    height: 100%;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: var(--card-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6vw;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    box-sizing: border-box;
    position: relative;
}

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

/* === WASTE PILE - 3 CARD DRAW === */
.waste-pile.draw-3 .card-slot {
    overflow: visible;
}

.waste-pile.draw-3 .card-slot .playing-card {
    top: 0;
    left: calc(var(--index, 0) * 28%);
    transition: left 0.15s ease;
}

.card-slot .card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    border-radius: calc(var(--card-radius) - 2px);
}


/* === TABLEAU === */

.solitaire-tableau {
    display: flex;
    gap: var(--card-gap);
    margin-bottom: 30px;
    padding-bottom: 10px;
}

.tableau-column {
    position: relative;
    flex: 1;
}

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

.solitaire-tableau .placeholder-king {
    width: 100%;
    aspect-ratio: 5 / 7;
    border-radius: var(--card-radius);
    border: 2px dashed rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    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%;
}

/* === PLAYING CARDS === */

.playing-card {
    position: absolute;
    width: 100%;
    aspect-ratio: 5 / 7;
    border-radius: var(--card-radius);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: box-shadow 0.15s ease;
    top: calc(var(--index, 0) * var(--card-overlap));
}

.playing-card.face-down {
    cursor: default;
}

.playing-card.face-up:hover {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4), 0 0 0 2px gold;
}

/* === HIDDEN: azonnal eltűnik, NINCS transition === */
.playing-card.card-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: none !important;
}

/* === DRAG === */
.playing-card.dragging {
    z-index: 1000;
    cursor: grabbing;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

/* === FLY === */
.playing-card.flying {
    pointer-events: none;
}

/* === HINT === */
.playing-card.hint {
    animation: hint-pulse 0.5s ease-in-out;
}

/* === NEW CARD (draw from stock) === */
.playing-card.new-card {
    animation: card-draw 0.25s ease-out;
}

@keyframes card-draw {
    0% {
        transform: translateX(-120%) rotateY(90deg);
        opacity: 0;
    }
    50% {
        transform: translateX(-40%) rotateY(30deg);
        opacity: 1;
    }
    100% {
        transform: translateX(0) rotateY(0deg);
        opacity: 1;
    }
}

@keyframes hint-pulse {

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

    50% {
        transform: translateY(-10px) scale(1.06);
        box-shadow: 0 8px 20px rgba(46, 204, 113, 0.5);
    }
}

/* === CARD FACES === */

.card-back {
    width: 100%;
    height: 100%;
    background: url(/games/solitaire/assets/card-back.svg);
    border-radius: var(--card-radius);
    box-sizing: border-box;
    border: solid var(--card-border) #00a08f;
}

.card-front {
    width: 100%;
    min-height: 100%;
    background: linear-gradient(to bottom, #efefee, #e4e2dd);
    box-shadow: inset 0 0 0 1px #fff;
    border: solid 2px #fff;
    border-radius: var(--card-radius);
    box-sizing: border-box;
    position: relative;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    padding: clamp(3px, 0.5vw, 1rem);
    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-center-graphic {
    width: 84%;
    margin: 0 auto;
    overflow: hidden;
}

.card-center-graphic svg {
    display: block;
}

/* Színek */
.card-front.hearts,
.card-front.diamonds {
    color: var(--red);
}

.card-front.hearts svg,
.card-front.diamonds svg {
    fill: var(--red);
}

.card-front.spades,
.card-front.clubs {
    color: var(--black);
}

.card-front.spades svg,
.card-front.clubs svg {
    fill: var(--black);
}

/* === MOBILE === */

@media (hover: none) {
    .playing-card.face-up:hover {
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    }
}

@media (prefers-reduced-motion: reduce) {
    .playing-card {
        transition: none;
    }

    .playing-card.hint {
        animation: none;
        box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.7);
    }
}