@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Inter:wght@300;400;600&display=swap');
:root {
    --bg-dark: #020617;
    --cobalt: #1e3a8a;
    --cobalt-light: #3b82f6;
    --cyan: #22d3ee;
    --silver: #f8fafc;
    --glass: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(148, 163, 184, 0.2);
    --glow-cyan: 0 0 20px rgba(34, 211, 238, 0.3);
    --glow-cobalt: 0 0 30px rgba(30, 58, 138, 0.5);
    --transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--silver);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Starfield & Particles */
.starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
    z-index: -2;
}

.starfield::before, .starfield::after {
    content: "";
    position: absolute;
    top: -50%; left: -50%; right: -50%; bottom: -50%;
    background-image: 
        radial-gradient(1px 1px at 25% 25%, #fff 50%, transparent 50%),
        radial-gradient(1px 1px at 50% 50%, #fff 50%, transparent 50%),
        radial-gradient(1.5px 1.5px at 75% 75%, #fff 50%, transparent 50%),
        radial-gradient(2px 2px at 15% 85%, #fff 50%, transparent 50%),
        radial-gradient(1px 1px at 85% 15%, #fff 50%, transparent 50%);
    background-size: 300px 300px;
    opacity: 0.2;
    animation: rotate 200s linear infinite;
}

.starfield::after {
    background-size: 400px 400px;
    opacity: 0.1;
    animation: rotate 300s linear reverse infinite;
}

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

.particles {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

/* Glassmorphism Refinement */
.btn, .enter-btn, .card-face {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: var(--glass);
    border: 1px solid var(--glass-border);
}

/* App Container */
#app {
    width: 100%;
    min-height: 100vh;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    padding: 2rem 1.5rem 3rem;
}

h1, h2, h3 {
    font-family: 'Cinzel', serif;
    text-transform: uppercase;
    letter-spacing: 0.3rem;
}

.accent-text {
    color: var(--cyan);
    text-shadow: var(--glow-cyan);
}

/* Portal Screen */
#portal {
    opacity: 1;
    transition: opacity 1.5s ease;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#portal.hidden {
    opacity: 0;
    pointer-events: none;
}

.portal-hero {
    width: min(1100px, 100%);
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
    align-items: center;
}

.portal-art {
    width: 100%;
    display: flex;
    justify-content: center;
}

.portal-card {
    position: relative;
    width: min(390px, 100%);
    aspect-ratio: 0.72;
    border-radius: 34px;
    padding: 1.25rem;
    background:
        linear-gradient(180deg, rgba(8, 14, 34, 0.9), rgba(6, 10, 24, 0.95)),
        radial-gradient(circle at 50% 20%, rgba(34, 211, 238, 0.18), transparent 45%);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow:
        0 0 0 1px rgba(34, 211, 238, 0.06) inset,
        0 40px 80px rgba(0, 0, 0, 0.45),
        0 0 60px rgba(34, 211, 238, 0.08);
    overflow: hidden;
}

.portal-card-image {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 22px;
    filter: drop-shadow(0 0 24px rgba(34, 211, 238, 0.18));
}

.portal-card::before {
    content: "";
    position: absolute;
    inset: 12px;
    border-radius: 26px;
    border: 1px solid rgba(34, 211, 238, 0.16);
    pointer-events: none;
}

.portal-card-glow {
    position: absolute;
    inset: -15%;
    background:
        radial-gradient(circle at 50% 42%, rgba(34, 211, 238, 0.22), transparent 34%),
        radial-gradient(circle at 50% 72%, rgba(30, 58, 138, 0.35), transparent 20%);
    filter: blur(18px);
    pointer-events: none;
}

.portal-card-top {
    position: absolute;
    top: 0;
    left: 50%;
    width: 56%;
    height: 16px;
    transform: translateX(-50%);
    border-bottom-left-radius: 999px;
    border-bottom-right-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(34, 211, 238, 0.18), rgba(255, 255, 255, 0.08));
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.portal-copy {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.portal-eyebrow {
    font-family: 'Cinzel', serif;
    font-size: 0.92rem;
    letter-spacing: 0.42rem;
    text-transform: uppercase;
    color: rgba(248, 250, 252, 0.72);
}

.portal-copy h1 {
    font-size: clamp(2.8rem, 5vw, 5rem);
    line-height: 1.04;
    letter-spacing: 0.18rem;
}

.portal-subtitle {
    width: min(34rem, 100%);
    font-size: 1.08rem;
    line-height: 1.7;
    color: rgba(224, 224, 224, 0.68);
}

.enter-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--silver);
    padding: 1rem 3rem;
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    border-radius: 50px;
    transition: all 0.3s ease;
    box-shadow: var(--glass);
    min-width: 290px;
    margin-top: 0.75rem;
}

.enter-btn:hover {
    background: rgba(0, 229, 255, 0.1);
    border-color: var(--cyan);
    box-shadow: var(--glow-cyan);
    transform: scale(1.05);
}

.reading-note {
    width: min(920px, 100%);
    margin-top: 2rem;
    padding: 1.25rem 1.5rem;
    border-radius: 18px;
    border: 1px solid rgba(34, 211, 238, 0.18);
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    text-align: center;
}

.reading-note p {
    max-width: 820px;
    color: rgba(248, 250, 252, 0.88);
    line-height: 1.7;
}

.note-cta,
.home-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.note-cta {
    padding: 0.9rem 1.5rem;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(34, 211, 238, 0.95), rgba(59, 130, 246, 0.95));
    color: #fff;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    letter-spacing: 0.14rem;
    text-transform: uppercase;
    border: 1px solid transparent;
    box-shadow: 0 12px 30px rgba(34, 211, 238, 0.22);
    transition: var(--transition);
}

.note-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(34, 211, 238, 0.3);
}

/* Tarot Arena */
#arena {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    max-width: 1200px;
    padding-bottom: 2rem;
}

#arena.visible {
    display: flex;
    animation: fadeIn 1.5s ease forwards;
}

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

/* Deck and Spread */
.deck-container {
    margin: 2rem 0;
    perspective: 1000px;
}

.spread {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-top: 3rem;
}

.spread-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.spread-position {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    letter-spacing: 0.18rem;
    text-transform: uppercase;
    color: rgba(248, 250, 252, 0.7);
}

/* Card Styles */
.card {
    width: 220px;
    height: 380px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.card:hover {
    transform: translateY(-10px);
}

.card:hover .card-face {
    border-color: var(--cyan);
    box-shadow: 0 0 30px rgba(0, 229, 255, 0.4);
}

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

.card.flipped:hover {
    transform: rotateY(180deg) translateY(-10px);
}

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

.card-back {
    background-color: var(--bg-dark);
    background-image: url('assets/card-back.png');
    background-size: cover;
    background-position: center;
    transform: rotateY(0deg);
}

.card-front {
    background: #0a0f1e;
    transform: rotateY(180deg) translateZ(1px);
    position: relative;
    padding: 0;
    overflow: hidden;
}

.card-image-container {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    border-radius: 13px;
}

.tarot-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.95) contrast(1.05);
}

.card-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(10, 15, 30, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.8rem;
    text-align: center;
    border-bottom-left-radius: 13px;
    border-bottom-right-radius: 13px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card-title {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--cyan);
    margin: 0;
    text-align: center;
    text-shadow: 0 0 10px var(--glow-cyan);
}

.card-meaning {
    font-size: 0.8rem;
    line-height: 1.3;
    color: rgba(224, 224, 224, 0.95);
    text-align: center;
    padding: 0 0.25rem;
}

/* Controls */
.controls {
    margin-top: 3rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
}

#arena header {
    margin-bottom: 1.5rem;
}

.btn {
    padding: 0.8rem 2rem;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    color: var(--silver);
    font-family: 'Cinzel', serif;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.home-btn {
    align-self: center;
    padding: 0.8rem 2rem;
}

.btn:hover {
    background: var(--cobalt);
    border-color: var(--cyan);
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Animations */
.card-deal {
    animation: deal 0.6s ease-out forwards;
}

@keyframes deal {
    from { transform: translateY(-500px) rotate(20deg); opacity: 0; }
    to { transform: translateY(0) rotate(0); opacity: 1; }
}

@media (max-width: 768px) {
    #portal {
        padding: 1.5rem 0;
    }

    .portal-hero {
        gap: 2rem;
    }

    .portal-card {
        width: min(320px, 100%);
    }

    .portal-eyebrow {
        letter-spacing: 0.28rem;
        font-size: 0.8rem;
    }

    .portal-copy h1 {
        font-size: clamp(2.2rem, 11vw, 3.4rem);
    }

    .portal-subtitle {
        font-size: 1rem;
    }

    .enter-btn {
        min-width: min(100%, 280px);
    }

    .card {
        width: 160px;
        height: 280px;
    }
    .card-symbol {
        width: 80px;
        height: 80px;
    }

    #app {
        padding: 1.25rem 1rem 2rem;
    }

    .spread {
        gap: 1.25rem;
        margin-top: 2rem;
    }

    .controls {
        margin-top: 2rem;
        gap: 0.85rem;
    }

    .interpretation-box {
        max-height: 38vh;
        padding: 1.25rem;
    }

    .reading-note {
        padding: 1rem 1.1rem;
    }
}

.interpretation-box {
    margin-top: 3rem;
    width: min(700px, 100%);
    max-height: min(32vh, 280px);
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: fadeIn 1s ease-out forwards;
}

.interpretation-title {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: var(--cyan);
    margin-bottom: 1rem;
    letter-spacing: 0.15rem;
    text-shadow: 0 0 10px var(--glow-cyan);
}

.interpretation-text {
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(224, 224, 224, 0.85);
    font-style: italic;
}

#interpretation-container {
    width: 100%;
    display: flex;
    justify-content: center;
}
