/* =============================================
CSS VARIABLES & BASE STYLES
============================================= */
:root {
    --color-bg: #08060f;
    --color-surface: #100e1e;
    --color-card: #13112299;
    --color-border: rgba(139, 92, 246, 0.18);
    --color-glow: #7c3aed;
    --color-glow-soft: rgba(124, 58, 237, 0.35);
    --color-accent: #a78bfa;
    --color-gold: #e2c97e;
    --color-text: #e8e4f0;
    --color-muted: #8b85a1;
    --font-display: "Cinzel", serif;
    --font-body: "Cormorant Garamond", serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 18px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* =============================================
STARFIELD CANVAS
============================================= */
#starfield {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* =============================================
RADIAL NEBULA BACKGROUND
============================================= */
.nebula {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(
            ellipse 80% 60% at 50% -10%,
            rgba(109, 40, 217, 0.22) 0%,
            transparent 70%
        ),
        radial-gradient(
            ellipse 50% 40% at 90% 80%,
            rgba(67, 20, 120, 0.18) 0%,
            transparent 60%
        ),
        radial-gradient(
            ellipse 60% 50% at 10% 90%,
            rgba(30, 10, 80, 0.25) 0%,
            transparent 60%
        );
}

/* =============================================
LAYOUT WRAPPER
============================================= */
#app {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* =============================================
SECTIONS
============================================= */
.section {
    display: none;
    width: 100%;
    max-width: 560px;
    animation: fadeIn 0.7s ease forwards;
}

.section.active {
    display: block;
}

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

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-18px);
    }
}

.section.leaving {
    animation: fadeOut 0.4s ease forwards;
}

/* =============================================
CARD
============================================= */
.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 1.5rem;
    padding: 2.8rem 2.5rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow:
        0 0 60px rgba(109, 40, 217, 0.1),
        0 2px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(167, 139, 250, 0.09);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(167, 139, 250, 0.5),
        transparent
    );
}

/* =============================================
DIVIDER ORNAMENT
============================================= */
.divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    opacity: 0.4;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-accent));
}

.divider::after {
    background: linear-gradient(90deg, var(--color-accent), transparent);
}

.divider span {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-accent);
}

/* =============================================
TYPOGRAPHY
============================================= */
.title-display {
    font-family: var(--font-display);
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    line-height: 1.1;
}

.subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-style: italic;
    color: var(--color-accent);
    letter-spacing: 0.05em;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.8;
    color: var(--color-text);
    font-size: 1rem;
}

/* =============================================
GLYPH ICON (SVG symbol)
============================================= */
.glyph {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.5rem;
    opacity: 0.7;
    filter: drop-shadow(0 0 8px var(--color-glow));
}

/* =============================================
BUTTONS
============================================= */
.btn-primary {
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 50%, #6d28d9 100%);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 0.75rem;
    padding: 1rem 2.5rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 20px rgba(124, 58, 237, 0.3),
        0 4px 16px rgba(0, 0, 0, 0.4);
}

.btn-primary::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.08) 0%,
        transparent 60%
    );
    pointer-events: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow:
        0 0 35px rgba(124, 58, 237, 0.55),
        0 8px 24px rgba(0, 0, 0, 0.4);
    border-color: rgba(167, 139, 250, 0.6);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-ghost {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-accent);
    background: transparent;
    border: 1px solid rgba(167, 139, 250, 0.25);
    border-radius: 0.75rem;
    padding: 0.85rem 2rem;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
}

.btn-ghost:hover {
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(167, 139, 250, 0.5);
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.2);
}

/* =============================================
DATE INPUT
============================================= */
.date-input-wrap {
    position: relative;
}

.date-input-label {
    font-family: var(--font-display);
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-accent);
    display: block;
    margin-bottom: 0.6rem;
    opacity: 0.8;
}

.date-inputs-group {
    display: flex;
    gap: 0.75rem;
}

.date-inputs-group input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 0.75rem;
    padding: 0.7rem;
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 300;
    outline: none;
    transition: all 0.3s ease;
    text-align: center;
    /* Hide number spinners */
    -moz-appearance: textfield;
}

.date-inputs-group input::-webkit-outer-spin-button,
.date-inputs-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#birth-day    { width: 25%; }
#birth-month  { width: 25%; }
#birth-year   { flex: 1; }

input[type="date"]:focus {
    border-color: rgba(139, 92, 246, 0.6);
    background: rgba(139, 92, 246, 0.08);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* =============================================
LOADING SECTION
============================================= */
.loading-orb {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 35% 35%,
        rgba(167, 139, 250, 0.5),
        rgba(109, 40, 217, 0.2) 60%,
        transparent
    );
    border: 1px solid rgba(167, 139, 250, 0.3);
    margin: 0 auto;
    position: relative;
    animation: orbPulse 2s ease-in-out infinite;
    box-shadow:
        0 0 30px rgba(124, 58, 237, 0.4),
        0 0 60px rgba(124, 58, 237, 0.2),
        inset 0 0 30px rgba(124, 58, 237, 0.15);
}

.loading-orb::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid rgba(167, 139, 250, 0.15);
    animation: orbRing 3s linear infinite;
}

.loading-orb::after {
    content: "";
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    border: 1px dashed rgba(167, 139, 250, 0.08);
    animation: orbRing 5s linear infinite reverse;
}

@keyframes orbPulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow:
            0 0 30px rgba(124, 58, 237, 0.4),
            0 0 60px rgba(124, 58, 237, 0.2);
    }
    50% {
        transform: scale(1.07);
        box-shadow:
            0 0 50px rgba(124, 58, 237, 0.6),
            0 0 90px rgba(124, 58, 237, 0.3);
    }
}

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

#loading-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-style: italic;
    color: var(--color-accent);
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    min-height: 1.8em;
    transition: opacity 0.3s ease;
}

/* =============================================
RESULT NUMBER DISPLAY
============================================= */
.result-number-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
}

.result-number {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(5rem, 20vw, 8rem);
    line-height: 1;
    background: linear-gradient(
        135deg,
        #e2c97e 0%,
        #f0dfa0 40%,
        #c8a84b 70%,
        #e2c97e 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(226, 201, 126, 0.6));
    animation: numberGlow 3s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

.result-number-ring {
    position: absolute;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 1px solid rgba(226, 201, 126, 0.15);
    animation: orbRing 8s linear infinite;
}

.result-number-ring-2 {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 1px dashed rgba(226, 201, 126, 0.07);
    animation: orbRing 14s linear infinite reverse;
}

@keyframes numberGlow {
    0%,
    100% {
        filter: drop-shadow(0 0 20px rgba(226, 201, 126, 0.6));
    }
    50% {
        filter: drop-shadow(0 0 40px rgba(226, 201, 126, 0.9))
            drop-shadow(0 0 60px rgba(226, 201, 126, 0.4));
    }
}

/* =============================================
ARCHETYPE TAG
============================================= */
.archetype-tag {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--color-gold);
    background: rgba(226, 201, 126, 0.08);
    border: 1px solid rgba(226, 201, 126, 0.2);
    border-radius: 2rem;
    padding: 0.45rem 1.2rem;
}

/* =============================================
TRAIT CARDS (3 categories)
============================================= */
.trait-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(139, 92, 246, 0.12);
    border-radius: 1rem;
    padding: 1.25rem 1.4rem;
    transition:
        border-color 0.3s ease,
        background 0.3s ease;
}

.trait-card:hover {
    border-color: rgba(139, 92, 246, 0.28);
    background: rgba(139, 92, 246, 0.05);
}

.trait-label {
    font-family: var(--font-display);
    font-size: 0.6rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.trait-content {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.6;
    color: var(--color-text);
    opacity: 0.85;
}

/* =============================================
CALCULATION NOTE
============================================= */
.calc-note {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-muted);
    font-style: italic;
    opacity: 0.6;
}

/* =============================================
PRIVACY NOTE
============================================= */
.privacy-note {
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 300;
    color: var(--color-muted);
    opacity: 0.5;
    text-align: center;
    font-style: italic;
}

/* =============================================
ERROR MESSAGE
============================================= */
.error-msg {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: #f87171;
    font-style: italic;
    display: none;
}

/* =============================================
MOBILE RESPONSIVE TWEAKS
============================================= */
@media (max-width: 480px) {
    .card {
        padding: 2rem 1.5rem;
    }
}
