:root {
    /* Elegant Palette */
    --primary-gradient: linear-gradient(135deg, #8e0e00 0%, #1f1c18 100%);
    /* Deep Burgundy to Black */
    --bg-gradient: linear-gradient(135deg, #09121a 0%, #0d1216 100%);
    /* Deep Midnight */
    --card-bg: rgba(253, 251, 245, 0.96);
    /* Warm Cream (Paper-like) */
    --text-color: #2c241b;
    /* Dark Brown/Charcoal */
    --accent-color: #c5a059;
    /* Muted Gold */

    --font-heading: 'Cinzel', serif;
    --font-body: 'Outfit', sans-serif;
    --font-handwriting: 'Great Vibes', cursive;
}

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

body {
    background: var(--bg-gradient);
    color: var(--text-color);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1.8;
    /* Increased line height for elegance */
    overflow-x: hidden;
    position: relative;
    font-weight: 300;
}

/* Subtle Snow Effect */
.snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Reduced opacity for elegance */
    opacity: 0.4;
    background-image:
        radial-gradient(2px 2px at 100px 50px, #fff, transparent),
        radial-gradient(3px 3px at 200px 150px, #fff, transparent),
        radial-gradient(2px 2px at 300px 250px, #fff, transparent);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    animation: snow 20s linear infinite;
    /* Slower animation */
    z-index: 0;
}

@keyframes snow {
    0% {
        background-position: 0px 0px;
    }

    100% {
        background-position: 550px 550px;
    }
}

.container {
    width: 100%;
    max-width: 650px;
    /* Reduced top padding */
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
    /* Ensure room at bottom for fixed signature using padding */
    padding-bottom: 20vh;
    /* Large scroll buffer to show dark background */
    height: 100vh;
    z-index: 1;
    position: relative;
}

@media (min-width: 768px) {
    .container {
        height: auto;
        min-height: 85vh;
    }
}

header {
    text-align: center;
    margin-bottom: 1.2rem;
    animation: fadeIn 1.5s ease-out;
}

h1 {
    font-family: var(--font-body);
    /* Sans-serif (Outfit) */
    font-size: 3rem;
    font-weight: 800;
    /* Bolder for sans-serif */
    letter-spacing: 1px;
    /* Slightly tighter than serif */
    text-transform: uppercase;

    /* Golden Sparkle Effect */
    background: linear-gradient(45deg,
            #c5a059 0%,
            #fceabb 25%,
            #f8b500 50%,
            #fceabb 75%,
            #c5a059 100%);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 4s linear infinite;
    text-shadow: 0 2px 10px rgba(197, 160, 89, 0.2);
    /* Subtle glow behind */
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.story-card {
    background: var(--card-bg);
    /* Subtle border instead of double solid */
    border: 1px solid rgba(197, 160, 89, 0.3);
    border-radius: 4px;
    /* Sharper corners for elegance */
    padding: 3rem;
    /* More breathing room */
    flex-grow: 1;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    font-size: 1.1rem;
    color: #4a4238;
}

/* Elegant decorative line at top */
.story-card::before {
    content: "";
    display: block;
    width: 60px;
    height: 2px;
    background: var(--accent-color);
    margin: 0 auto 2rem auto;
}

.story-content {
    white-space: pre-wrap;
    line-height: 1.5;
    /* Reduced from 1.8 inherited from body */
}

/* Markdown styling improvements */
.story-content p {
    margin-bottom: 0.3rem;
    /* Very tight paragraphs */
}

/* Tighter list items */
.story-content li {
    margin-bottom: 0.1rem;
}

.story-content ul,
.story-content ol {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

.story-content strong {
    color: #8e0e00;
    /* Deep red for emphasis */
    font-weight: 600;
}

.loading {
    color: var(--accent-color);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 300;
    font-size: 0.9rem;
}

.snowflake {
    animation: spin 5s linear infinite;
    display: inline-block;
}

.cursor {
    display: inline-block;
    width: 1px;
    height: 1.2em;
    background-color: var(--accent-color);
    margin-left: 2px;
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

.fixed-signature {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    font-family: var(--font-handwriting);
    font-size: 2.4rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    z-index: 10;
    padding-bottom: 30px;
    padding-top: 50px;
    /* Gradient fade area */
    pointer-events: none;
    /* Let clicks pass through if it covers anything */
    background: linear-gradient(to top, rgba(0, 0, 0, 0.4) 0%, transparent 100%);
    /* Subtle dark gradient at bottom */
}

.small-signature {
    font-size: 1.5rem;
    opacity: 0.9;
    margin-top: 0.2rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

    to {
        transform: rotate(360deg);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Refined Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(197, 160, 89, 0.3);
    border-radius: 3px;
}