@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Noto+Serif+SC:wght@400;600;700&display=swap');

:root {
    --primary: #1a0b2e;
    --secondary: #2d1b4e;
    --accent: #d4af37;
    --accent-glow: #ffd700;
    --text: #f0e6d2;
    --text-dim: #b8a890;
    --card-back: #16213e;
    --shadow: rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: 'Noto Serif SC', 'Cinzel', serif;
    color: var(--text);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at top, rgba(42, 25, 70, 0.9), transparent),
        radial-gradient(ellipse at bottom, rgba(13, 5, 30, 0.95), transparent),
        linear-gradient(135deg, #0d051e 0%, #1a0b2e 50%, #2d1b4e 100%);
    z-index: -2;
}

.background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, rgba(212, 175, 55, 0.3), transparent),
        radial-gradient(2px 2px at 60% 70%, rgba(212, 175, 55, 0.2), transparent),
        radial-gradient(1px 1px at 50% 50%, rgba(255, 215, 0, 0.2), transparent),
        radial-gradient(1px 1px at 80% 10%, rgba(212, 175, 55, 0.3), transparent);
    background-size: 200% 200%, 180% 180%, 220% 220%, 190% 190%;
    animation: stars 20s ease-in-out infinite;
    z-index: -1;
}

@keyframes stars {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

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

.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 1s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.title {
    font-family: 'Cinzel', 'Noto Serif SC', serif;
    font-size: 4rem;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 
        0 0 20px var(--accent-glow),
        0 0 40px rgba(212, 175, 55, 0.5),
        2px 2px 4px var(--shadow);
    letter-spacing: 0.3rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-dim);
    letter-spacing: 0.5rem;
    font-weight: 400;
}

.game-area {
    min-height: 500px;
    position: relative;
}

.hidden {
    display: none !important;
}

.start-screen {
    animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.spread-selection {
    text-align: center;
}

.spread-selection h2 {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 3rem;
    font-weight: 600;
}

.spread-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.spread-btn {
    background: linear-gradient(135deg, rgba(45, 27, 78, 0.8), rgba(22, 33, 62, 0.8));
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    cursor: pointer;
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    position: relative;
    overflow: hidden;
}

.spread-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.2), transparent);
    transition: left 0.5s ease;
}

.spread-btn:hover::before {
    left: 100%;
}

.spread-btn:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 
        0 10px 40px rgba(212, 175, 55, 0.4),
        0 0 60px rgba(212, 175, 55, 0.2),
        inset 0 0 20px rgba(212, 175, 55, 0.1);
    border-color: var(--accent-glow);
}

.spread-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

.spread-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent);
}

.spread-desc {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-align: center;
}

.draw-screen {
    animation: fadeIn 0.6s ease-out;
}

.instruction {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 1.3rem;
    color: var(--text);
}

.instruction span {
    color: var(--accent);
    font-weight: 600;
}

.cards-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 3rem;
    perspective: 1000px;
}

.card {
    width: 140px;
    height: 240px;
    position: relative;
    cursor: pointer;
    transition: all 0.4s ease;
    transform-style: preserve-3d;
    animation: cardAppear 0.6s ease-out backwards;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(50px) rotateY(-90deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateY(0);
    }
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.15s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.25s; }
.card:nth-child(5) { animation-delay: 0.3s; }
.card:nth-child(6) { animation-delay: 0.35s; }
.card:nth-child(7) { animation-delay: 0.4s; }
.card:nth-child(8) { animation-delay: 0.45s; }
.card:nth-child(9) { animation-delay: 0.5s; }
.card:nth-child(10) { animation-delay: 0.55s; }

.card:hover {
    transform: translateY(-20px) scale(1.05);
    filter: drop-shadow(0 10px 30px rgba(212, 175, 55, 0.6));
}

.card.selected {
    animation: cardFlip 0.8s ease-out forwards;
}

@keyframes cardFlip {
    0% {
        transform: rotateY(0deg) scale(1);
    }
    50% {
        transform: rotateY(90deg) scale(1.1);
    }
    100% {
        transform: rotateY(180deg) scale(1);
    }
}

.card-back, .card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    box-shadow: 0 8px 25px var(--shadow);
}

.card-back {
    background: linear-gradient(135deg, var(--secondary), var(--card-back));
    border: 3px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--accent);
}

.card-back::before {
    content: '✦';
    position: absolute;
    font-size: 4rem;
    opacity: 0.3;
    animation: rotate 10s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.card-front {
    transform: rotateY(180deg);
    overflow: hidden;
}

.card-front img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.result-screen {
    animation: fadeIn 0.8s ease-out;
}

.result-title {
    text-align: center;
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 3rem;
    text-shadow: 0 0 20px var(--accent-glow);
}

.result-cards {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.result-card {
    text-align: center;
    animation: resultCardAppear 0.8s ease-out backwards;
}

.result-card:nth-child(1) { animation-delay: 0.2s; }
.result-card:nth-child(2) { animation-delay: 0.4s; }
.result-card:nth-child(3) { animation-delay: 0.6s; }
.result-card:nth-child(4) { animation-delay: 0.8s; }
.result-card:nth-child(5) { animation-delay: 1s; }

@keyframes resultCardAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.result-card-image {
    width: 160px;
    height: 280px;
    border-radius: 12px;
    box-shadow: 0 10px 40px var(--shadow);
    margin-bottom: 1rem;
    border: 3px solid var(--accent);
}

.result-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.result-card-position {
    font-size: 1.1rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.result-card-name {
    font-size: 1.3rem;
    color: var(--text);
    font-weight: 600;
}

.interpretation {
    background: linear-gradient(135deg, rgba(45, 27, 78, 0.6), rgba(22, 33, 62, 0.6));
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    animation: fadeIn 1s ease-out 1.2s backwards;
}

.interpretation-section {
    margin-bottom: 2rem;
}

.interpretation-section:last-child {
    margin-bottom: 0;
}

.interpretation-section h3 {
    color: var(--accent);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.interpretation-section h3::before {
    content: '✦';
    font-size: 1.2rem;
}

.interpretation-section p {
    color: var(--text);
    line-height: 1.8;
    font-size: 1.05rem;
    text-align: justify;
}

.interpretation-section ul {
    list-style: none;
    padding-left: 0;
}

.interpretation-section li {
    color: var(--text);
    line-height: 1.8;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.interpretation-section li::before {
    content: '◆';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.spread-description {
    text-align: center;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.spread-description h3 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.healing-quote {
    text-align: center;
    padding: 2rem;
    margin: 2rem 0;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(255, 215, 0, 0.05));
    border-left: 4px solid var(--accent);
    border-radius: 10px;
}

.healing-quote p {
    font-size: 1.2rem;
    font-style: italic;
    color: var(--accent);
    line-height: 1.8;
}

.interpretation-section h4 {
    color: var(--text);
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.summary-section {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(255, 215, 0, 0.1));
    border: 2px solid var(--accent);
    border-radius: 15px;
    padding: 2rem;
    margin-top: 2rem;
}

.summary-section h3 {
    text-align: center;
    font-size: 1.6rem;
}

.summary-section p {
    font-size: 1.1rem;
    text-align: center;
}

.reset-btn {
    display: block;
    margin: 0 auto;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    font-family: 'Noto Serif SC', serif;
    background: linear-gradient(135deg, var(--secondary), var(--card-back));
    color: var(--accent);
    border: 2px solid var(--accent);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.4s ease;
    font-weight: 600;
    letter-spacing: 0.2rem;
}

.reset-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px var(--accent-glow);
    background: linear-gradient(135deg, var(--accent), var(--accent-glow));
    color: var(--primary);
}

@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    
    .spread-options {
        grid-template-columns: 1fr;
        max-width: 320px;
    }
    
    .spread-btn {
        width: 100%;
    }
    
    .card {
        width: 110px;
        height: 190px;
    }
    
    .result-card-image {
        width: 130px;
        height: 230px;
    }
    
    .interpretation {
        padding: 1.5rem;
    }
    
    .result-cards {
        gap: 1rem;
    }
}
