:root {
    --primary-mystic: #6a11cb;
    --secondary-mystic: #2575fc;
    --accent-gold: #ffd700;
    --dark-bg: #0f0c29;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
}

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

html,
body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
}

#app {
    height: 100%;
    width: 100%;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--dark-bg);
    color: #fff;
    overflow-x: hidden;
}

h1,
h2,
h3 {
    font-family: 'Cinzel', serif;
}

.screen {
    display: none;
    min-height: 100vh;
    /* Changed from height: 100% to allow scrolling */
    width: 100vw;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2rem;
    padding-top: calc(2rem + env(safe-area-inset-top));
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
    animation: fadeIn 1s ease-out;
    overflow-y: auto;
    /* Enable vertical scrolling */
}



.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.language-selector {
    position: absolute;
    top: calc(1rem + env(safe-area-inset-top));
    right: calc(1rem + env(safe-area-inset-right));
    z-index: 100;
}

#lang-select {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

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

/* Landing Page */
#landing {
    overflow: hidden;
    justify-content: flex-end;
    padding-bottom: 5vh;
    /* Position at middle-bottom */
}

.background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.background-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    /* Ensures wizard face is fully visible at top in 375x667 */
    filter: brightness(0.7);
}

/* Orb Effects */
#orbs-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4) 0%, rgba(106, 17, 203, 0.1) 70%, transparent 100%);
    filter: blur(5px);
    animation: floatOrb 20s infinite linear;
}

@keyframes floatOrb {
    0% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(100px, 50px);
    }

    50% {
        transform: translate(50px, 150px);
    }

    75% {
        transform: translate(-50px, 100px);
    }

    100% {
        transform: translate(0, 0);
    }
}

.content-overlay {
    position: relative;
    z-index: 10;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 1.2rem;
    border-radius: 20px;
    text-align: center;
    width: 85%;
    max-width: 320px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
}

.title {
    font-size: 1.5rem;
    margin-bottom: 0.4rem;
    color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.subtitle {
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
    opacity: 0.95;
    line-height: 1.4;
}

.input-group {
    margin-bottom: 1.2rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    text-align: center;
}

.date-select-row {
    display: flex;
    gap: 8px;
}

.date-select-row select {
    padding: 10px 2px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    backdrop-filter: blur(5px);
}

#birth-year {
    flex: 1.5;
}

#birth-month {
    flex: 1;
}

#birth-day {
    flex: 1;
}

#gender-select {
    flex: 1.2;
}

.date-select-row select option {
    background: var(--dark-bg);
    color: #fff;
}

.button-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    width: 100%;
}

.magic-btn {
    flex: 1;
    max-width: 250px;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
    transition: all 0.3s ease;
    display: block;
    margin: 30px auto;
}

.button-row .magic-btn {
    margin: 30px 0;
}

.test-btn {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4) !important;
}

.magic-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.6);
}

.test-btn:hover {
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6) !important;
}

.crypto-note {
    margin-top: 1.2rem;
    font-size: 0.75rem;
    opacity: 0.7;
    line-height: 1.3;
}

/* Loading - Crystal Ball */
.crystal-ball-container {
    position: relative;
    width: 120px;
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.crystal-ball {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05) 60%, rgba(255, 255, 255, 0));
    box-shadow:
        0 0 20px rgba(106, 17, 203, 0.4),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    z-index: 2;
    animation: ballFloat 3s ease-in-out infinite;
}

.energy-swirl {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(169, 88, 255, 0.4), transparent 60%);
    transform: translate(-50%, -50%);
    animation: energyFlow 4s linear infinite;
    mix-blend-mode: overlay;
}

.crystal-ball::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 20%;
    width: 25%;
    height: 15%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    filter: blur(2px);
    transform: rotate(-45deg);
}

.stand {
    width: 60px;
    height: 20px;
    background: linear-gradient(to bottom, #444, #111);
    border-radius: 50%;
    margin-top: -10px;
    z-index: 1;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

@keyframes ballFloat {

    0%,
    100% {
        transform: translateY(0);
        box-shadow:
            0 0 20px rgba(106, 17, 203, 0.4),
            inset 0 0 20px rgba(255, 255, 255, 0.2);
    }

    50% {
        transform: translateY(-10px);
        box-shadow:
            0 0 40px rgba(106, 17, 203, 0.8),
            0 0 60px rgba(169, 88, 255, 0.4),
            inset 0 0 20px rgba(255, 255, 255, 0.2);
    }
}

@keyframes energyFlow {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) rotate(180deg) scale(1.2);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1);
    }
}

.crystal-ball.expand-animation {
    animation: expandAndBrighten 1.5s forwards ease-in;
}

@keyframes expandAndBrighten {
    0% {
        transform: scale(1);
        filter: brightness(1);
    }

    100% {
        transform: scale(15);
        filter: brightness(5) opacity(0);
    }
}

/* Result Page */
#result {
    background: url('assets/arabian-bg.png') no-repeat center center fixed;
    background-size: cover;
}

#result::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.result-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1000px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    padding: 2rem;
    border-radius: 30px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    text-align: center;
}

.result-title {
    font-size: 2rem;
    color: var(--accent-gold);
    margin-bottom: 1.5rem;
}

.fortune-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .fortune-grid {
        grid-template-columns: 1fr;
    }
}

.fortune-card {
    background: var(--glass-bg);
    padding: 1.2rem;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    text-align: left;
    transition: background 0.3s;
}

.fortune-card:hover {
    background: rgba(255, 255, 255, 0.15);
}

.fortune-card h3 {
    color: var(--accent-gold);
    margin-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
    padding-bottom: 0.4rem;
}

.fortune-card p {
    line-height: 1.5;
    font-size: 0.9rem;
    opacity: 0.9;
}