:root {
    --bg-color: #0f0c29;
    --bg-gradient: linear-gradient(to bottom, #0f0c29, #302b63, #24243e);
    --text-color: #e0e0e0;
    --accent-color: #ffd700;
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-border: rgba(255, 255, 255, 0.2);
    --input-bg: rgba(255, 255, 255, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Animation - CSS Only */
.stars,
.twinkling {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

.stars {
    background: #000;
    background-image:
        radial-gradient(2px 2px at 20px 30px, #eee, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 40px 70px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 50px 160px, #ddd, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 90px 40px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 130px 80px, #fff, rgba(0, 0, 0, 0)),
        radial-gradient(2px 2px at 160px 120px, #ddd, rgba(0, 0, 0, 0));
    background-repeat: repeat;
    background-size: 200px 200px;
    z-index: 0;
}

.twinkling {
    background: transparent;
    z-index: 1;
    background-image:
        radial-gradient(white, rgba(255, 255, 255, .2) 2px, transparent 3px),
        radial-gradient(white, rgba(255, 255, 255, .15) 1px, transparent 2px),
        radial-gradient(white, rgba(255, 255, 255, .1) 2px, transparent 3px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    animation: move-twink-back 60s linear infinite;
    opacity: 0.3;
}

@keyframes move-twink-back {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-550px);
    }
}

.container {
    position: relative;
    z-index: 2;
    width: 90%;
    max-width: 600px;
    text-align: center;
    padding: 2rem;
}

header {
    margin-bottom: 2rem;
}

h1 {
    font-family: 'Batang', 'Gungsuh', 'Gowun Batang', serif;
    font-size: 2.5rem;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.8;
}

/* Input Section */
.input-section {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 20px;
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--accent-color);
}

input[type="date"] {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: white;
    font-size: 1.1rem;
    font-family: 'Noto Sans KR', sans-serif;
    outline: none;
    transition: all 0.3s ease;
}

input[type="date"]:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
}

/* Button */
.magic-button {
    position: relative;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(45deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s;
}

.magic-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 117, 252, 0.4);
}

.magic-button:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.7;
    transform: none;
    box-shadow: none;
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.3) 50%,
            rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    100% {
        left: 200%;
    }
}

/* Result Section */
.result-section.hidden {
    display: none;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid var(--card-border);
    padding: 2rem;
    min-height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Loading Animation - Crystal Ball */
.crystal-ball {
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), rgba(100, 100, 255, 0.4) 40%, rgba(50, 0, 100, 0.8) 80%);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(100, 100, 255, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
    margin: 0 auto 1rem auto;
    /* Center horizontally */
    animation: float 3s ease-in-out infinite;
}

.inner-light {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.5;
    animation: pulse 2s infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

/* Fortune Content */
.fortune-content {
    text-align: left;
    line-height: 1.8;
    width: 100%;
    white-space: pre-wrap;
    /* To handle newlines from AI */
}

.fortune-content h3 {
    color: var(--accent-color);
    margin-top: 1rem;
}

/* Footer */
footer {
    margin-top: 2rem;
    font-size: 0.8rem;
    opacity: 0.6;
    color: var(--text-color);
    text-align: left;
}