/* Mystical Tarot Aesthetic */
:root {
    --bg-dark: #0d0d1a;
    --bg-mid: #1a1a2e;
    --bg-light: #16213e;
    --accent-gold: #d4af37;
    --accent-purple: #9d4edd;
    --accent-moon: #f8e3c4;
    --text-light: #e8e8e8;
    --text-muted: #a0a0a0;
    --shadow-glow: 0 0 30px rgba(212, 175, 55, 0.3);
}

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

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-mid) 50%, var(--bg-light) 100%);
    min-height: 100vh;
    color: var(--text-light);
    overflow-x: hidden;
}

/* Animated Stars Background */
.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.stars::before,
.stars::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, #eee, transparent),
        radial-gradient(2px 2px at 40px 70px, #fff, transparent),
        radial-gradient(2px 2px at 50px 160px, #ddd, transparent),
        radial-gradient(2px 2px at 90px 40px, #fff, transparent),
        radial-gradient(2px 2px at 130px 80px, #eee, transparent),
        radial-gradient(2px 2px at 160px 120px, #fff, transparent);
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: twinkle 5s ease-in-out infinite;
}

.stars::after {
    background-size: 300px 300px;
    animation-delay: 2.5s;
    opacity: 0.5;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.3; }
}

.container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-purple), var(--accent-moon));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(212, 175, 55, 0.5);
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.subtitle {
    color: var(--text-muted);
    font-style: italic;
    font-size: 1.1rem;
}

/* Deck */
.deck-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    perspective: 1000px;
}

.deck {
    position: relative;
    width: 140px;
    height: 220px;
}

.card-back {
    position: absolute;
    width: 140px;
    height: 220px;
    border-radius: 12px;
    background: linear-gradient(145deg, #2d1b4e 0%, #1a0f2e 100%);
    border: 2px solid var(--accent-gold);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.card-back::before {
    content: '🔮';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    opacity: 0.8;
}

.card-back::after {
    content: '';
    position: absolute;
    inset: 8px;
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    opacity: 0.5;
}

.card-back:nth-child(1) { transform: translate(0, 0) rotate(0deg); }
.card-back:nth-child(2) { transform: translate(2px, -2px) rotate(1deg); }
.card-back:nth-child(3) { transform: translate(4px, -4px) rotate(2deg); }
.card-back:nth-child(4) { transform: translate(6px, -6px) rotate(3deg); }
.card-back:nth-child(5) { transform: translate(8px, -8px) rotate(4deg); }

.deck.shuffling .card-back {
    animation: shuffle 0.5s ease-in-out infinite;
}

.deck.shuffling .card-back:nth-child(1) { animation-delay: 0s; }
.deck.shuffling .card-back:nth-child(2) { animation-delay: 0.05s; }
.deck.shuffling .card-back:nth-child(3) { animation-delay: 0.1s; }
.deck.shuffling .card-back:nth-child(4) { animation-delay: 0.15s; }
.deck.shuffling .card-back:nth-child(5) { animation-delay: 0.2s; }

@keyframes shuffle {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-20px, -10px) rotate(-5deg); }
    50% { transform: translate(0, -20px) rotate(0deg); }
    75% { transform: translate(20px, -10px) rotate(5deg); }
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

button {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-family: inherit;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-shuffle {
    background: linear-gradient(135deg, var(--accent-purple), #6b2c91);
    color: white;
    box-shadow: 0 4px 20px rgba(157, 78, 221, 0.4);
}

.btn-shuffle:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(157, 78, 221, 0.6);
}

.btn-draw {
    background: linear-gradient(135deg, var(--accent-gold), #b8941f);
    color: #1a1a2e;
    font-weight: bold;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
}

.btn-draw:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(212, 175, 55, 0.6);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Card Display */
.card-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 400px;
}

.card-slot {
    width: 280px;
    height: 420px;
    border: 2px dashed var(--accent-purple);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    position: relative;
    background: rgba(255, 255, 255, 0.02);
}

.placeholder {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

/* Tarot Card */
.tarot-card {
    width: 260px;
    height: 400px;
    border-radius: 16px;
    background: linear-gradient(145deg, #f8e3c4 0%, #e8d5b5 100%);
    border: 4px solid var(--accent-gold);
    box-shadow: var(--shadow-glow);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    animation: reveal 0.8s ease-out;
    position: relative;
    overflow: hidden;
}

.tarot-card::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 2px solid var(--accent-gold);
    border-radius: 12px;
    opacity: 0.5;
}

@keyframes reveal {
    0% {
        transform: rotateY(90deg) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: rotateY(45deg) scale(1.05);
    }
    100% {
        transform: rotateY(0) scale(1);
        opacity: 1;
    }
}

.card-header {
    text-align: center;
    margin-bottom: 1rem;
    z-index: 1;
}

.card-header h3 {
    color: #1a1a2e;
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
}

.card-number {
    color: var(--accent-purple);
    font-size: 0.9rem;
    font-weight: bold;
}

.card-image {
    font-size: 6rem;
    margin: 1rem 0;
    z-index: 1;
}

.card-description {
    text-align: center;
    color: #333;
    font-size: 0.85rem;
    line-height: 1.4;
    z-index: 1;
}

/* Card Info */
.card-info {
    text-align: center;
    max-width: 500px;
    animation: fadeIn 0.5s ease-out 0.5s both;
}

.card-info.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-info h2 {
    font-size: 2rem;
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
}

#cardNumber {
    color: var(--accent-purple);
    font-size: 1rem;
    margin-bottom: 1rem;
}

#cardMeaning {
    color: var(--text-light);
    line-height: 1.6;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.keywords {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.keyword {
    background: rgba(157, 78, 221, 0.2);
    border: 1px solid var(--accent-purple);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--accent-moon);
}

/* History */
.history {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.history h3 {
    text-align: center;
    color: var(--accent-gold);
    margin-bottom: 1rem;
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.history-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--accent-purple);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    min-width: 120px;
}

.history-item .date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.history-item .card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.history-item .card-name {
    font-size: 0.9rem;
    color: var(--accent-moon);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    button {
        width: 200px;
    }
    
    .card-slot {
        width: 240px;
        height: 360px;
    }
    
    .tarot-card {
        width: 220px;
        height: 340px;
    }
}
