:root {
    /* Rich Mystical Color Palette (HSL) */
    --cosmos-dark: hsl(230, 40%, 5%);
    --cosmos-deep: hsl(230, 35%, 10%);
    --nebula-purple: hsla(280, 50%, 40%, 0.3);
    --nebula-blue: hsla(210, 60%, 40%, 0.3);
    --accent-primary: hsl(280, 70%, 65%);
    --accent-secondary: hsl(190, 70%, 60%);
    --accent-gold: hsl(45, 100%, 70%);
    --text-primary: hsl(0, 0%, 95%);
    --text-muted: hsl(230, 20%, 70%);
    --glass-bg: hsla(230, 30%, 15%, 0.4);
    --glass-border: hsla(0, 0%, 100%, 0.1);
    --glass-glow: hsla(280, 70%, 65%, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--cosmos-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Immersive Background --- */
.cosmos-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at center, var(--cosmos-deep) 0%, var(--cosmos-dark) 100%);
}

.stars-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/123163/stars.png') repeat;
    opacity: 0.5;
    animation: slow-pan 200s linear infinite;
}

.nebula-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 30%, var(--nebula-purple) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, var(--nebula-blue) 0%, transparent 50%);
    filter: blur(80px);
    animation: pulse-nebula 20s ease-in-out infinite alternate;
}

@keyframes slow-pan {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 1000px 1000px;
    }
}

@keyframes pulse-nebula {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* --- App Layout --- */
.app-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.main-header {
    text-align: center;
    margin-bottom: 4rem;
}

/* --- Mystic Orb --- */
.mystic-orb-container {
    margin-bottom: 2rem;
    perspective: 1000px;
}

.mystic-orb {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    position: relative;
    background: radial-gradient(circle at 30% 30%, hsla(0, 0%, 100%, 0.4), transparent);
    box-shadow:
        0 0 60px var(--nebula-purple),
        inset 0 0 30px hsla(280, 70%, 65%, 0.5);
    animation: orb-float 6s ease-in-out infinite;
    overflow: hidden;
}

.orb-core {
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
    filter: blur(10px);
    animation: orb-pulse 3s infinite alternate;
}

.orb-swirl {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: conic-gradient(from 0deg, transparent, var(--accent-secondary), transparent);
    opacity: 0.2;
    animation: orb-rotate 10s linear infinite;
}

@keyframes orb-float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

@keyframes orb-pulse {
    0% {
        transform: scale(0.8);
        opacity: 0.4;
    }

    100% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes orb-rotate {
    to {
        transform: rotate(360deg);
    }
}

.title-main {
    font-family: 'Cinzel', serif;
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(to bottom, #fff, var(--accent-primary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
    letter-spacing: 4px;
}

.title-sub {
    font-size: 1.1rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    font-family: 'Orbit', sans-serif;
}

/* --- Content Panels --- */
.content-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.glass-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, var(--glass-glow), transparent 70%);
    pointer-events: none;
}

/* --- Input Section --- */
.input-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.input-icon {
    font-size: 1.5rem;
}

.input-label {
    font-family: 'Orbit', sans-serif;
    font-size: 1.2rem;
    color: var(--accent-gold);
}

.textarea-container {
    position: relative;
    margin-bottom: 2rem;
}

textarea {
    width: 100%;
    height: 180px;
    background: hsla(230, 30%, 5%, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    line-height: 1.7;
    resize: none;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: hsla(230, 30%, 5%, 0.7);
    box-shadow: 0 0 20px var(--glass-glow);
}

.textarea-accent {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    transition: width 0.3s ease;
}

textarea:focus+.textarea-accent {
    width: 100%;
}

.btn-interpret {
    width: 100%;
    padding: 1.2rem;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    font-family: 'Orbit', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-interpret:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px hsla(280, 70%, 65%, 0.4);
}

.btn-aura {
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent, hsla(0, 0%, 100%, 0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.btn-interpret:hover .btn-aura {
    transform: translateX(100%);
}

.btn-interpret:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

/* --- Result Section --- */
.result-card {
    animation: slide-up 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--glass-border), transparent);
}

.result-tab-title {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: var(--accent-gold);
    text-shadow: 0 0 10px hsla(45, 100%, 70%, 0.3);
}

.result-body {
    font-size: 1.15rem;
    line-height: 2;
    color: var(--text-primary);
    background: hsla(0, 0%, 100%, 0.03);
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    min-height: 150px;
    white-space: pre-wrap;
}

/* --- Lucky Item Section --- */
.lucky-item-container {
    background: linear-gradient(135deg, hsla(280, 50%, 20%, 0.4), hsla(190, 50%, 20%, 0.4));
    border: 1px solid hsla(45, 100%, 70%, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    animation: fade-in 1s ease forwards;
}

.lucky-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.lucky-star {
    color: var(--accent-gold);
}

.lucky-title {
    font-family: 'Orbit', sans-serif;
    font-size: 1rem;
    color: var(--accent-gold);
    letter-spacing: 1px;
}

.lucky-content {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* --- Utilities --- */
.hidden {
    display: none;
}

.main-footer {
    margin-top: auto;
    padding: 4rem 0 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    opacity: 0.6;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .title-main {
        font-size: 2.5rem;
    }

    .glass-panel {
        padding: 1.5rem;
    }

    .app-wrapper {
        padding: 2rem 1rem;
    }
}
/* --- API Key Input --- */
.api-key-section {
    margin-bottom: 1.5rem;
}

.api-key-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: hsla(230, 30%, 5%, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--accent-gold);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.api-key-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: hsla(230, 30%, 5%, 0.5);
    box-shadow: 0 0 10px var(--glass-glow);
}

.api-key-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

