:root {
    --bg-color: #0f0c29;
    --bg-gradient: linear-gradient(to bottom, #0f0c29, #302b63, #24243e);
    --gold: #ffd700;
    --gold-dim: #c5a000;
    --text-color: #e0e0e0;
    --card-ratio: 1.55; /* Standard Tarot ratio approx */
    --card-width: 280px;
    --card-height: calc(var(--card-width) * var(--card-ratio));
}

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

body {
    font-family: 'Noto Serif KR', serif;
    background: var(--bg-color);
    background: var(--bg-gradient);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

/* Background Animation */
.stars, .twinkling {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.stars {
    background: #000 url('data:image/svg+xml;utf8,%3Csvg%20width%3D%22200%22%20height%3D%22200%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20cx%3D%2220%22%20cy%3D%2220%22%20r%3D%221%22%20fill%3D%22white%22%20opacity%3D%220.5%22%2F%3E%3Ccircle%20cx%3D%22150%22%20cy%3D%2280%22%20r%3D%221.5%22%20fill%3D%22white%22%20opacity%3D%220.3%22%2F%3E%3C%2Fsvg%3E') repeat;
    z-index: -2;
}

.twinkling {
    background: transparent;
    z-index: -1;
    animation: twinkle 5s infinite alternate;
}

@keyframes twinkle {
    0% { opacity: 0.3; }
    100% { opacity: 0.7; }
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.main-header h1 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.main-header p {
    color: #a0a0a0;
    margin-bottom: 2rem;
    font-size: 1rem;
}

/* Card Stage */
.card-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

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

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

.card {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-style: preserve-3d;
}

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

/* Back of Card */
.card-back {
    background: #1a1a2e;
    background-image: repeating-linear-gradient(
        45deg,
        #1a1a2e 0,
        #1a1a2e 10px,
        #24243e 10px,
        #24243e 20px
    );
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-back::after {
    content: '★';
    font-size: 3rem;
    color: var(--gold);
    text-shadow: 0 0 15px var(--gold);
}

.pattern {
    width: 90%;
    height: 90%;
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
}

/* Front of Card */
.card-front {
    background: linear-gradient(135deg, #2c2c54, #474787);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: white;
}

.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
}

.card-image-placeholder {
    width: 100%;
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--gold-dim);
    margin-bottom: 15px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.arcana-number {
    position: absolute;
    top: 10px;
    left: 10px;
    font-family: 'Cinzel', serif;
    color: var(--gold);
}

.card-symbol {
    font-size: 4rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.card-front h2 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 1.5rem;
    margin-bottom: 5px;
    text-align: center;
}

.keywords {
    font-size: 0.9rem;
    color: #bbb;
    margin-bottom: 10px;
    font-style: italic;
}

.instruction {
    margin-top: 20px;
    animation: pulse 2s infinite;
    color: var(--gold);
    font-size: 0.9rem;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Reading Area */
.reading-area {
    margin-top: 20px;
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s, transform 1s;
}

.reading-area.visible {
    opacity: 1;
    transform: translateY(0);
}

.reading-area.hidden {
    display: none;
}

.interpretation h3 {
    color: var(--gold);
    margin-bottom: 10px;
    font-family: 'Cinzel', serif;
}

.interpretation p {
    line-height: 1.6;
    margin-bottom: 20px;
}

.btn-reset {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 10px 30px;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 50px;
}

.btn-reset:hover {
    background: var(--gold);
    color: #000;
    box-shadow: 0 0 15px var(--gold);
}

@media (max-width: 400px) {
    :root {
        --card-width: 240px;
    }
}