:root {
    --bg-color: #0f0518;
    --card-bg: #1f1135;
    --gold: #d4af37;
    --gold-glow: rgba(212, 175, 55, 0.5);
    --text-light: #e0d8ea;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    padding: 0;
    height: 100dvh;
    background: radial-gradient(circle at center, #2a164a 0%, var(--bg-color) 100%);
    color: var(--text-light);
    font-family: 'Lato', sans-serif;
    overflow: hidden;
    user-select: none;
    display: flex;
    flex-direction: column;
}

h1, h2, h3 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    text-align: center;
    margin: 0;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

header {
    padding: 1.5rem 1rem 0.5rem;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    text-shadow: 0 0 10px var(--gold-glow);
    letter-spacing: 2px;
}

#instruction {
    font-size: 1rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}

.table {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    padding: 1rem;
}

.deck-container {
    position: relative;
    width: 80px;
    height: 120px;
    cursor: pointer;
}

.card {
    width: 80px;
    height: 120px;
    border-radius: 8px;
    position: absolute;
    top: 0;
    left: 0;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.card-face {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    border-radius: 8px;
    border: 2px solid var(--gold);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
}

.card-back {
    background: linear-gradient(135deg, #1f1135 25%, #3a1c61 50%, #1f1135 75%);
    background-size: 200% 200%;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(212, 175, 55, 0.1) 10px, rgba(212, 175, 55, 0.1) 20px);
}

.card-back::after {
    content: '✧';
    color: var(--gold);
    font-size: 2rem;
}

.card-front {
    transform: rotateY(180deg);
    background: #2a164a;
    padding: 5px;
    text-align: center;
}

.card-emoji {
    font-size: 2.5rem;
    margin-bottom: 5px;
}

.card-name {
    font-family: 'Cinzel', serif;
    font-size: 0.6rem;
    color: var(--gold);
    font-weight: bold;
    text-transform: uppercase;
}

.spread-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    margin-top: 2rem;
}

.card-slot {
    width: 80px;
    height: 120px;
    border: 1px dashed rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-slot::after {
    content: attr(data-label);
    position: absolute;
    bottom: -25px;
    font-size: 0.8rem;
    color: var(--gold);
    font-family: 'Cinzel', serif;
    opacity: 0.6;
}

/* Modals */
.reading-modal {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 5, 24, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.reading-modal.visible {
    opacity: 1;
    pointer-events: all;
}

.reading-content {
    background: var(--card-bg);
    border: 1px solid var(--gold);
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.2);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.reading-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}
.reading-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.reading-item h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    text-align: left;
    display: flex;
    justify-content: space-between;
}

.reading-item p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
    color: #c9bada;
}

#reset-btn {
    background: transparent;
    color: var(--gold);
    border: 2px solid var(--gold);
    padding: 1rem;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1rem;
}

#reset-btn:active {
    background: var(--gold);
    color: var(--bg-color);
}