@font-face {
    font-family: 'Safira March';
    src: url('https://dl.dropboxusercontent.com/s/v8c1w49cnzsm3cf/Safira%20March.ttf') format('truetype');
}

@font-face {
    font-family: 'HK Grotesk';
    src: url('https://dl.dropboxusercontent.com/s/9n6sj3s8hvpc6pv/HKGrotesk-Regular.otf') format('opentype');
}

:root {
    --primary-color: #6A0DAD; /* Bright Purple */
    --secondary-color: #D4AF37; /* Gold */
    --accent-color: #EE82EE; /* Violet (Pink/Lilac) */
    --text-color: #E6E6FA; /* Lavender (Lilac) */
    --card-text: #3d325a; /* Darker purple for text on card */
}

body {
    font-family: 'Playfair Display', serif;
    background: linear-gradient(135deg, #2c1f43, #5a397e); /* Mystical dark purple gradient */
    color: var(--text-color);
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.container {
    max-width: 1000px;
    text-align: center;
    padding: 20px;
}

h1 {
    font-family: 'Safira March', 'Playfair Display', serif;
    color: var(--text-color);
    font-size: clamp(1.8em, 7.5vw, 4em);
    text-shadow: 2px 2px 8px var(--accent-color);
    margin-bottom: 30px;
    letter-spacing: 2px;
    line-height: 1.2;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

h1 span {
    font-size: 0.8em;
    margin: 0 0.25em;
    display: inline-block;
    vertical-align: middle;
}

.deck {
    position: relative;
    width: 300px;
    height: 510px;
    margin: 20px auto;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.deck:hover {
    transform: scale(1.05);
}

.card {
    position: absolute;
    width: 300px;
    height: 510px;
    border-radius: 15px;
    background: linear-gradient(45deg, #4a4a4a, #2d2d2d);
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 20px rgba(238, 130, 238, 0.4);
    transition: transform 0.6s ease;
    transform-style: preserve-3d;
    cursor: pointer;
}

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

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

.card-back {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color), #DA70D6);
    background-size: 400% 400%;
    animation: gradientBG 3s ease infinite;
}

.card-front {
    background: var(--text-color);
    transform: rotateY(180deg);
    color: var(--card-text);
}

.card-image {
    width: 240px;
    height: 300px;
    object-fit: contain;
    margin-bottom: 15px;
}

.card-title {
    margin: 0 0 10px 0;
    font-weight: bold;
    text-align: center;
    font-size: 1.5em;
    color: var(--card-text);
}

.card-meaning {
    margin: 0 0 15px 0;
    font-style: italic;
    font-size: 1.1em;
    display: none;
    color: var(--card-text);
    font-family: 'HK Grotesk', sans-serif;
}

.daily-advice-label {
    margin: 0;
    font-size: 1em;
    font-weight: bold;
    color: var(--primary-color);
    display: none;
    font-family: 'HK Grotesk', sans-serif;
}

.daily-advice {
    margin-top: 5px;
    color: var(--card-text);
    font-weight: normal;
    font-size: 1.1em;
    display: none;
    font-family: 'HK Grotesk', sans-serif;
}

.reset-button {
    margin-top: 20px;
    padding: 15px 30px;
    background: var(--secondary-color);
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    display: none;
    font-family: 'HK Grotesk', sans-serif;
    font-size: 1.1em;
    transition: all 0.3s ease;
}

.reset-button:hover {
    background: var(--primary-color);
    transform: scale(1.05);
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes cardShuffle {
    0% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-5px) rotate(-5deg); }
    75% { transform: translateX(5px) rotate(5deg); }
    100% { translateX(0) rotate(0deg); }
}

.shuffling {
    animation: cardShuffle 0.5s ease infinite;
}

@media (max-width: 600px) {
    .deck {
        width: 240px;
        height: 408px;
    }
    .card {
        width: 240px;
        height: 408px;
    }
    .card-image {
        width: 200px;
        height: 240px;
    }
}