/* CSS 스타일 정의 */
:root {
    --color-gold: #d4af37;
    --color-gold-light: #f3e5ab;
    --color-gold-muted: rgba(212, 175, 55, 0.4);
    --color-bg-dark: #05010f;
    --color-bg-light: #160a29;
    --font-kr: 'Noto Serif KR', serif;
    --font-en: 'Cinzel', serif;
}

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

body, html {
    width: 100%;
    height: 100%;
    background-color: var(--color-bg-dark);
    color: #fff;
    font-family: var(--font-kr);
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* 몽환적인 배경 및 파티클 */
.ambient-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 120%, var(--color-bg-light) 0%, var(--color-bg-dark) 70%);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.35;
    animation: floatOrb 15s infinite alternate ease-in-out;
}

.orb-1 { width: 40vw; height: 40vw; background: rgba(138, 43, 226, 0.25); top: 5%; left: -10%; }
.orb-2 { width: 50vw; height: 50vw; background: rgba(65, 105, 225, 0.2); bottom: -20%; right: -10%; animation-delay: -5s; }
.orb-3 { width: 30vw; height: 30vw; background: rgba(212, 175, 55, 0.15); top: 35%; right: 10%; animation-delay: -10s; }

@keyframes floatOrb {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, -40px); }
}

#stars {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}
.star {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    opacity: 0;
    animation: twinkle var(--duration, 3s) infinite alternate ease-in-out;
}

@keyframes twinkle {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 0.9; box-shadow: 0 0 10px rgba(255, 255, 255, 0.9); }
    100% { opacity: 0; transform: scale(1.2); }
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

/* 히어로 텍스트 */
.hero-text {
    position: absolute;
    top: 12vh;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    transition: opacity 0.8s ease, transform 0.8s ease;
    width: 100%;
    z-index: 10;
    padding: 0 20px;
}
.hero-text.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    pointer-events: none;
}

.mystic-icon {
    font-size: 26px;
    color: var(--color-gold);
    margin-bottom: 15px;
    animation: pulseGlow 3s infinite alternate;
}

@keyframes pulseGlow {
    0% { filter: drop-shadow(0 0 5px var(--color-gold)); }
    100% { filter: drop-shadow(0 0 18px var(--color-gold)); }
}

.main-title {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--color-gold-light);
    margin-bottom: 12px;
    text-shadow: 0 0 25px rgba(212, 175, 55, 0.6);
    letter-spacing: 3px;
}

.subtitle {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 300;
    letter-spacing: 1.5px;
    line-height: 1.5;
}

/* 하단 안내 문구 */
.instruction {
    position: absolute;
    bottom: 6vh;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.95rem;
    color: var(--color-gold);
    letter-spacing: 2px;
    opacity: 0.8;
    animation: bob 2s infinite ease-in-out;
    transition: opacity 0.5s ease;
    white-space: nowrap;
}
.instruction.hidden {
    opacity: 0;
    pointer-events: none;
}

@keyframes bob {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, -10px); }
}

/* 타로 보드 및 덱 컨테이너 */
.tarot-board {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    margin-top: 8vh;
}

.deck-container {
    position: relative;
    width: 250px;
    height: 420px;
    perspective: 1400px;
    cursor: pointer;
    transition: transform 1s ease;
    z-index: 30;
    -webkit-tap-highlight-color: transparent;
}

.card {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    transition: all 0.8s cubic-bezier(0.25, 1.2, 0.3, 1);
    border-radius: 16px;
}

.card-bottom {
    transform: translateZ(-35px) translateY(18px) rotate(-3deg);
    opacity: 0.4;
}

.card-middle {
    transform: translateZ(-18px) translateY(10px) rotate(1deg);
    opacity: 0.7;
}

.card-top {
    transform: translateZ(0);
    animation: floatDeck 5s infinite ease-in-out;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
}

@keyframes floatDeck {
    0%, 100% { transform: translateY(0) translateZ(0); }
    50% { transform: translateY(-15px) translateZ(5px); }
}

.deck-container:hover .card-top {
    transform: translateY(-25px) translateZ(25px) scale(1.04);
    box-shadow: 0 30px 60px rgba(212, 175, 55, 0.25);
    animation: none;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 1.2s cubic-bezier(0.2, 0.9, 0.3, 1.1);
    transform-style: preserve-3d;
    border-radius: 16px;
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
}

/* 카드 양면 공통 */
.card-back, .card-front {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 16px;
    overflow: hidden;
}

/* 럭셔리 카드 뒷면 */
.card-back {
    background: radial-gradient(circle at center, #1f0f38 0%, #070114 100%);
    border: 1px solid var(--color-gold-muted);
}

.card-back .ornament {
    position: absolute;
    top: 14px; left: 14px; right: 14px; bottom: 14px;
    border: 1px solid rgba(212, 175, 55, 0.35);
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-back .ornament::before {
    content: '';
    position: absolute;
    width: 88%; height: 88%;
    border: 1px solid rgba(138, 43, 226, 0.35);
    transform: rotate(45deg);
}

.card-back .ornament::after {
    content: '';
    position: absolute;
    width: 88%; height: 88%;
    border: 1px dashed var(--color-gold-muted);
    border-radius: 50%;
}

.card-back .symbol {
    font-size: 55px;
    position: relative;
    z-index: 2;
    color: transparent;
    background: linear-gradient(180deg, #fff2c8 0%, #d4af37 100%);
    -webkit-background-clip: text;
    background-clip: text;
    filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.6));
}

/* 럭셔리 카드 앞면 */
.card-front {
    background: #0d0614;
    border: 1px solid var(--color-gold);
    box-shadow: inset 0 0 50px rgba(212, 175, 55, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 20px;
    transform: rotateY(180deg);
}

.card-front::before {
    content: '';
    position: absolute;
    top: 8px; left: 8px; right: 8px; bottom: 8px;
    border: 1px double var(--color-gold-muted);
    border-width: 3px;
    pointer-events: none;
    border-radius: 8px;
}

.card-number {
    color: var(--color-gold-muted);
    font-family: var(--font-en);
    font-size: 1.5rem;
    letter-spacing: 2px;
    margin-top: 5px;
}

.image-placeholder {
    flex-grow: 1;
    width: 100%;
    margin: 20px 0;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(212, 175, 55, 0.25);
    background: radial-gradient(circle at center, rgba(138, 43, 226, 0.12) 0%, rgba(5, 1, 15, 0.8) 80%);
    overflow: hidden;
    border-radius: 4px;
}

.magic-circle {
    position: absolute;
    width: 130px;
    height: 130px;
    border: 1px dashed var(--color-gold-muted);
    border-radius: 50%;
    animation: spin 25s linear infinite;
    opacity: 0.6;
}

.magic-circle::before {
    content: '';
    position: absolute;
    top: -10px; left: -10px; right: -10px; bottom: -10px;
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 50%;
    transform: rotate(45deg);
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.card-icon {
    font-size: 70px;
    color: var(--color-gold-light);
    filter: drop-shadow(0 0 18px rgba(212, 175, 55, 0.7));
    z-index: 2;
}

.card-name {
    color: var(--color-gold);
    font-family: var(--font-en);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 2.5px;
}

.card-kr-name {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    margin-top: 8px;
    margin-bottom: 5px;
    letter-spacing: 5px;
}


/* DRAWN STATE (카드 뽑혔을 때 애니메이션) */
.tarot-board.drawn .deck-container {
    pointer-events: none;
}

.tarot-board.drawn .card-bottom,
.tarot-board.drawn .card-middle {
    opacity: 0;
    transform: translateZ(-150px) translateY(150px) scale(0.7);
}

.tarot-board.drawn .card-top {
    animation: none;
    box-shadow: 0 40px 80px rgba(0,0,0,0.9), 0 0 60px rgba(212, 175, 55, 0.25);
}

.tarot-board.drawn .card-top .card-inner {
    transform: rotateY(180deg);
}

/* 데스크탑 레이아웃 */
@media (min-width: 900px) {
    .tarot-board.drawn .deck-container {
        transform: translateX(-18vw);
    }
    .tarot-board.drawn .card-top {
        transform: scale(1.2) translateY(-4vh);
    }
}

/* 모바일 레이아웃 */
@media (max-width: 899px) {
    .container {
        padding-top: 5vh;
        justify-content: flex-start;
    }
    .main-title {
        font-size: 2.2rem;
    }
    .tarot-board {
        flex-direction: column;
        justify-content: flex-start;
        margin-top: 15vh;
    }
    .tarot-board.drawn .deck-container {
        transform: translateY(-8vh) scale(0.9);
    }
}


/* 결과창 (글라스모피즘) */
.result-panel {
    position: absolute;
    background: rgba(14, 7, 30, 0.65);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(212, 175, 55, 0.35);
    border-radius: 20px;
    padding: 35px 30px;
    max-width: 460px;
    width: 92%;
    z-index: 20;
    opacity: 0;
    transform: translateY(40px);
    pointer-events: none;
    transition: all 0.9s cubic-bezier(0.165, 0.84, 0.44, 1) 0.6s;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), inset 0 0 25px rgba(212, 175, 55, 0.12);
}

.tarot-board.drawn .result-panel {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

@media (min-width: 900px) {
    .result-panel {
        left: 50%;
        margin-left: 2vw;
    }
}

@media (max-width: 899px) {
    .result-panel {
        position: relative;
        margin-top: -8vh; /* 덱 아래로 적절히 붙음 */
    }
    .tarot-board.drawn .result-panel {
        transform: translateY(10px);
    }
}

.result-title {
    color: var(--color-gold-light);
    font-size: 1.6rem;
    font-family: var(--font-kr);
    font-weight: 700;
    text-align: center;
    margin-bottom: 25px;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

.meaning-section {
    margin-bottom: 20px;
    text-align: center;
}

.section-label {
    color: var(--color-gold);
    font-size: 0.95rem;
    margin-bottom: 12px;
    letter-spacing: 2px;
    font-weight: 600;
}

.section-desc {
    color: #fff;
    font-size: 1.1rem;
    line-height: 1.6;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-gold-muted), transparent);
    margin: 28px 0;
}

.readings {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 35px;
}

.reading-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.reading-icon {
    font-size: 1.3rem;
    color: var(--color-gold);
    margin-top: 1px;
}

.reading-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.reading-label {
    font-size: 0.85rem;
    color: rgba(212, 175, 55, 0.8);
    letter-spacing: 1.5px;
    font-weight: 600;
}

.reading-value {
    font-size: 0.95rem;
    color: #f0f0f0;
    line-height: 1.5;
    font-weight: 300;
}

.btn-gold {
    width: 100%;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.35));
    border: 1px solid var(--color-gold);
    color: var(--color-gold-light);
    font-family: var(--font-kr);
    font-size: 1.15rem;
    padding: 16px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.15);
}

.btn-gold:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.3), rgba(212, 175, 55, 0.5));
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.4);
    transform: translateY(-2px);
    color: #fff;
}
