@import url('https://fonts.googleapis.com/css2?family=Nanum+Myeongjo:wght@400;700&family=Nanum+Gothic:wght@400;700&display=swap');

:root {
    --bg-color: #0b0914;
    --primary-color: #d4af37; /* Gold */
    --secondary-color: #5c3a93; /* Deep Purple */
    --text-color: #f0f0f0;
    --glass-bg: rgba(25, 20, 40, 0.6);
    --glass-border: rgba(212, 175, 55, 0.3);
}

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

body {
    font-family: 'Nanum Gothic', sans-serif;
    background: radial-gradient(circle at center, #1a1025 0%, var(--bg-color) 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

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

h1 {
    font-family: 'Nanum Myeongjo', serif;
    font-size: 3rem;
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
    margin-bottom: 0.5rem;
}

p.subtitle {
    font-size: 1.1rem;
    color: #a0a0a0;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Glassmorphism Input Area */
.input-section {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 600px;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    animation: fadeInUp 1s ease-out;
}

.input-section h2 {
    font-family: 'Nanum Myeongjo', serif;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #fff;
}

select, input[type="text"] {
    width: 100%;
    padding: 12px 20px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

select:focus, input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

select option {
    background: var(--bg-color);
    color: #fff;
}

.suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 20px;
}

.chip {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 0.85rem;
    color: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chip:hover {
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--primary-color);
    color: #fff;
}

button {
    background: linear-gradient(135deg, #d4af37 0%, #aa8c2c 100%);
    color: #000;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 12px 30px;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
}

button:disabled {
    background: #555;
    color: #888;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Cards Area */
.cards-container {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
    perspective: 1000px;
    min-height: 400px;
}

.card-wrapper {
    width: 220px;
    height: 330px;
    perspective: 1000px;
    position: relative;
    opacity: 0;
    transform: translateY(50px);
}

.card-wrapper.visible {
    animation: slideUpFade 0.6s forwards;
}

.card {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.8s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
    cursor: pointer;
}

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

.card:hover:not(.flipped) {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(212, 175, 55, 0.3);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    overflow: hidden;
    border: 2px solid var(--glass-border);
}

.card-front {
    background: url('https://upload.wikimedia.org/wikipedia/commons/9/90/Tarot_Card_Back_Design.jpg') center / 100% 100% no-repeat;
}

.card-back {
    transform: rotateY(180deg);
    background: #111;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card-back img {
    width: 100%;
    height: 100%;
    object-fit: fill;
}

.card-label {
    position: absolute;
    bottom: -40px;
    width: 100%;
    text-align: center;
    font-family: 'Nanum Myeongjo', serif;
    color: var(--primary-color);
    font-size: 1.1rem;
    opacity: 0;
    transition: opacity 0.5s ease 0.8s;
}

.card-wrapper.flipped-wrapper .card-label {
    opacity: 1;
}

/* Result Area */
.result-section {
    margin-top: 4rem;
    width: 100%;
    max-width: 800px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 2.5rem;
    display: none;
    animation: fadeIn 1s ease;
    line-height: 1.8;
}

.result-section h3 {
    font-family: 'Nanum Myeongjo', serif;
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.result-content p {
    margin-bottom: 1.2rem;
    font-size: 1.05rem;
}

.card-highlight {
    color: var(--primary-color);
    font-weight: 700;
    font-family: 'Nanum Myeongjo', serif;
    background: rgba(212, 175, 55, 0.1);
    padding: 0 4px;
    border-radius: 4px;
    text-shadow: 0 0 5px rgba(212, 175, 55, 0.3);
}

.loading {
    display: none;
    margin-top: 2rem;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 1rem;
}

/* Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

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

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

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

@keyframes slideUpFade {
    to { opacity: 1; transform: translateY(0); }
}

/* Media Queries */
@media (max-width: 768px) {
    header h1 {
        font-size: 2.2rem;
    }
    .cards-container {
        flex-direction: column;
        align-items: center;
        gap: 4rem;
        margin-top: 1rem;
    }
    .card-wrapper {
        width: 200px;
        height: 300px;
        aspect-ratio: unset;
    }
    .card-label {
        font-size: 1rem;
        bottom: -35px;
    }
}

footer {
    margin-top: 4rem;
    margin-bottom: 2rem;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

footer p {
    margin-bottom: 0.5rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: #fff;
    text-decoration: underline;
}
