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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #000000 0%, #0a0a0f 50%, #0d0d15 100%);
    min-height: 100vh;
    height: 100vh;
    padding: 20px;
    overflow: hidden;
}

html {
    overflow: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.site-logo {
    display: block;
    margin: 0 auto 20px;
    max-width: 400px;
    height: auto;
}

.cards-wrapper {
    position: relative;
    padding-top: 50px;
}

.shuffle-btn,
.reset-btn {
    position: absolute;
    top: 0;
    padding: 12px 30px;
    font-size: 1em;
    color: #ffffff;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.shuffle-btn {
    left: 20px;
}

.reset-btn {
    left: 140px;
}

.shuffle-btn:hover,
.reset-btn:hover {
    background: #252525;
    border-color: #555;
}

/* Shuffle Animation - Krupiyer Style */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 15px;
    padding: 20px;
    position: relative;
}

.card {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    cursor: pointer;
    perspective: 1000px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s;
    transform-style: preserve-3d;
}

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

.card.flipped.highest-coin {
    box-shadow: 0 0 15px 3px #00ff00;
    border-radius: 12px;
}

.card.flipped.lower-coin {
    box-shadow: 0 0 15px 3px #ff0000;
    border-radius: 12px;
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-front {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.card-back {
    background: #0a0a0a;
    transform: rotateY(180deg);
    padding: 10px;
    gap: 5px;
}

.card-back img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.gift-name {
    color: #ffffff;
    font-size: 0.75em;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gift-coins {
    color: #ffd700;
    font-size: 0.8em;
    font-weight: bold;
}

.card-number {
    font-size: 2.5em;
    font-weight: bold;
    color: white;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }
    
    .cards-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 10px;
    }
    
    .card-number {
        font-size: 1.8em;
    }
    
    .card-back img {
        width: 35px;
        height: 35px;
    }
    
    .gift-name {
        font-size: 0.6em;
    }
    
    .gift-coins {
        font-size: 0.65em;
    }
}

/* Popup Styles */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay.active {
    opacity: 1;
}

.popup-card {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 280px;
    height: 373px;
    transform: translate(-50%, -50%) scale(0.3);
    z-index: 1001;
    perspective: 1000px;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-card.active {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
}

.popup-card.flipped {
    transform: translate(-50%, -50%) scale(1.3);
}

.popup-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
}

.popup-card.flipped .popup-card-inner {
    transform: rotateY(180deg);
}

.popup-card-front,
.popup-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.popup-card-front {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    border: 2px solid #444;
}

.popup-card-front .card-number {
    font-size: 4em;
}

.popup-card-back {
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    transform: rotateY(180deg);
    padding: 10px 20px 20px;
    border: 2px solid #ffd700;
    justify-content: space-between;
}

.popup-card-back .popup-logo {
    width: 120px;
    height: auto;
    margin-top: 10px;
}

.popup-card-back .popup-gift-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
}

.popup-card-back .gift-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.popup-card-back .gift-name {
    font-size: 1.3em;
    color: #fff;
    text-align: center;
}

.popup-card-back .gift-coins {
    font-size: 1.4em;
    color: #ffd700;
    font-weight: bold;
}

/* Shuffle Animation */
.card.shuffling {
    position: relative;
}

/* Shuffle Message */
.shuffle-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: rgba(0, 0, 0, 0.9);
    padding: 30px 50px;
    border-radius: 20px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.shuffle-message img {
    width: 250px;
    height: auto;
}

.shuffle-message span {
    color: #fff;
    font-size: 1.3em;
    font-weight: 500;
}

.shuffle-message.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
