/* Premium Minimalist CSS Variables */
:root {
    --primary: #FFFFFF;
    --background: #000000;
    --accent: #C0C0C0;
    --background-gradient: #050505;
    --radial-glow: #1a1a1a;
    --text-primary: rgba(255, 255, 255, 1);
    --text-secondary: rgba(255, 255, 255, 0.6);
    --border-subtle: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-dark: rgba(30, 30, 30, 0.6);
    --gold-accent: #D4AF37;
    --gold-accent-light: rgba(212, 175, 55, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Subtle Radial Gradient Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, var(--radial-glow) 0%, var(--background) 70%);
    z-index: 0;
    pointer-events: none;
}

/* Global Logo */
.site-logo {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.site-logo img {
    height: 40px;
    width: auto;
    display: block;
}

/* Dust Particles Container */
.dust-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.dust-particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float-dust 20s infinite ease-in-out;
    opacity: 0;
}

@keyframes float-dust {
    0% {
        opacity: 0;
        transform: translateY(100vh) translateX(0);
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) translateX(100px);
    }
}

/* Landing Page Styles */
.landing-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    z-index: 2;
    overflow: hidden;
}

/* Hero Background Section */
.hero-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.hero-image {
    position: absolute;
    top: -10%;
    left: 0;
    width: 100%;
    height: 120%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.9;
    transform: scale(1.1);
    transition: transform 0.3s ease-out;
    filter: brightness(0.6) contrast(1.2);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.7) 50%,
        rgba(0, 0, 0, 0.95) 100%
    );
    z-index: 1;
}

.hero-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    }

.landing-container {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 2rem;
    max-width: 900px;
    width: 100%;
}

.landing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    position: relative;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    z-index: 10;
    animation: fadeInUp 1s ease-out;
}

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

/* Ambient Glow Effect */
.ambient-glow {
    position: absolute;
    width: 800px;
    height: 800px;
    background: radial-gradient(
        circle,
        rgba(212, 175, 55, 0.15) 0%,
        rgba(212, 175, 55, 0.05) 30%,
        transparent 70%
    );
    border-radius: 50%;
    pointer-events: none;
    transition: transform 0.5s ease-out;
    z-index: -1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: blur(60px);
    animation: pulseGlow 4s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* Floating Letters Animation */
.floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.floating-letter {
    position: absolute;
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 700;
    color: rgba(212, 175, 55, 0.15);
    animation: floatUp var(--duration, 20s) linear infinite;
    animation-delay: var(--delay, 0s);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

.floating-letter:nth-child(1) {
    left: 10%;
    top: 80%;
}

.floating-letter:nth-child(2) {
    left: 80%;
    top: 70%;
}

.floating-letter:nth-child(3) {
    left: 20%;
    top: 90%;
}

.floating-letter:nth-child(4) {
    left: 70%;
    top: 85%;
}

.floating-letter:nth-child(5) {
    left: 50%;
    top: 75%;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

.title-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 0;
    }

.main-title {
    font-family: 'Playfair Display', 'Instrument Serif', Georgia, serif;
    font-size: 4.5rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--primary);
    margin: 0;
    line-height: 1.1;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    
}

.title-line {
    display: inline-block;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 1) 0%,
        rgba(255, 255, 255, 0.95) 50%,
        rgba(212, 175, 55, 0.9) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s linear infinite;
    animation-delay: calc(var(--i, 0) * 0.2s);
}

.title-line.highlight {
    background: linear-gradient(
        135deg,
        rgba(212, 175, 55, 1) 0%,
        rgba(255, 255, 255, 1) 50%,
        rgba(212, 175, 55, 0.9) 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    text-shadow: 0 0 40px rgba(212, 175, 55, 0.5);
}

.title-underline {
    width: 200px;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(212, 175, 55, 0.8),
        transparent
    );
    margin-top: 1rem;
    animation: expandLine 1.5s ease-out;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

@keyframes shimmer {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

@keyframes expandLine {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 200px;
        opacity: 1;
    }
}

.subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    color: #fff;
    margin: 0;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
    animation: fadeInUp 1s ease-out 0.3s both;
    }

.description {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    color: rgba(212, 175, 55, 1);
    margin: 0;
    font-weight: 600;
    letter-spacing: 0;
    max-width: 600px;
    line-height: 120%;
    animation: fadeInUp 1s ease-out 0.5s both;
    }

.story-form {
    margin-top: 2rem;
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: ROW;
    gap: 1rem;
    animation: fadeInUp 1s ease-out 0.7s both;
    JUSTIFY-CONTENT: CENTER;
    ALIGN-ITEMS: CENTER;
    }

    .input-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        width: 75%;
        }

.input-icon {
    position: absolute;
    left: 1.5rem;
    z-index: 2;
    color: rgba(212, 175, 55, 0.6);
    transition: all 0.3s ease;
    pointer-events: none;
}

.input-wrapper.focused .input-icon {
    color: rgba(212, 175, 55, 1);
    transform: scale(1.1);
}

.input-wrapper input {
    width: 100%;
    padding: 1.3rem 6.5rem 1.3rem 1.5rem;
    background: #353129;
    backdrop-filter: blur(30px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: #ffffff !important;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    letter-spacing: 0;
    transition: all 0.4s ease-out;
    outline: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }

.input-wrapper input:focus {
    border-color: rgba(212, 175, 55, 0.6);
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.2),
                0 8px 32px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.5);
    transform: translateY(-2px);
}

.input-wrapper.focused {
    transform: scale(1.02);
}

.input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 300;
}

.generate-btn {
    padding: 16PX 1rem;
    background: #ec9b4a;
    border: none;
    color: var(--background);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.4s ease-out;
    text-transform: CAPITALIZE;
    LETTER-SPACING: 0;
    align-self: center;
    min-width: 160px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.4), 0 0 0 0 rgba(212, 175, 55, 0.5);
    width: 25%;
    }

.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s ease;
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 40px rgba(212, 175, 55, 0.5),
                0 0 0 4px rgba(212, 175, 55, 0.2);
    background: linear-gradient(
        135deg,
        rgba(255, 215, 0, 1) 0%,
        rgba(212, 175, 55, 0.95) 100%
    );
}

.generate-btn:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}

.btn-text {
    position: relative;
    z-index: 1;
}

.btn-arrow {
    position: relative;
    z-index: 1;
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.generate-btn:hover .btn-arrow {
    transform: translateX(5px);
}

.btn-icon {
    display: none;
}

/* Chat Page Styles */
.chat-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.chat-container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.chat-header {
    padding: 2rem;
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
}

.chat-title {
    font-family: 'Playfair Display', 'Instrument Serif', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    color: var(--primary);
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    scroll-behavior: smooth;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}

/* .messages-container.blurred {
    filter: blur(3px);
    transition: filter 1s ease-out;
} */

.messages-container::-webkit-scrollbar {
    width: 1px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
}

.message {
    display: flex;
    animation: fadeInSlide 0.8s ease-out;
}

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

.user-message {
    justify-content: flex-end;
}

.ai-message {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    position: relative;
    word-wrap: break-word;
}

.user-bubble {
    padding: 1rem 1.5rem;
    text-align: right;
    position: relative;
    background: var(--glass-dark);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    border-right: 2px solid var(--accent);
    border-right-width: 2px;
}

.user-bubble p {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 300;
    letter-spacing: 0.02em;
    line-height: 1.6;
}

.ai-bubble {
    padding: 0.75rem 0;
    text-align: left;
    animation: fadeInSlide 0.8s ease-out;
}

.ai-bubble p {
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0;
    font-weight: 300;
    letter-spacing: 0.02em;
    line-height: 1.8;
}

.loading-bubble {
    padding: 0.75rem 0;
    text-align: left;
}

.loading-animation {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quill-svg {
    width: 24px;
    height: 24px;
    opacity: 0.6;
}

.quill-svg path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: scribble 2s infinite ease-in-out;
}

.quill-svg path:nth-child(2) {
    animation-delay: 0.2s;
}

.quill-svg path:nth-child(3) {
    animation-delay: 0.4s;
}

.quill-svg path:nth-child(4) {
    animation-delay: 0.6s;
}

@keyframes scribble {
    0% {
        stroke-dashoffset: 200;
        opacity: 0.3;
    }
    50% {
        stroke-dashoffset: 0;
        opacity: 0.8;
    }
    100% {
        stroke-dashoffset: -200;
        opacity: 0.3;
    }
}

.loading-text {
    font-family: 'Inter', sans-serif;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 300;
    font-style: italic;
}

/* Chapter Reveal Styles */
.chapter-bubble {
    max-width: 100%;
    padding: 4rem 3rem;
    margin: 2rem 0;
    background: transparent;
    border: none;
    position: relative;
    z-index: 10;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.02) 2px,
            rgba(255, 255, 255, 0.02) 4px
        ),
        radial-gradient(
            ellipse at center,
            rgba(212, 175, 55, 0.05) 0%,
            transparent 70%
        );
    background-size: 100% 100%, 100% 100%;
}

.chapter-title {
    font-family: 'Playfair Display', 'Instrument Serif', Georgia, serif;
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    margin-bottom: 3rem;
    color: var(--primary);
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 1.5rem;
    overflow: hidden;
}

.chapter-title span {
    display: inline-block;
    opacity: 0;
    animation: letterFadeIn 0.5s ease-out forwards;
}

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

.chapter-content {
    font-family: 'Playfair Display', 'Instrument Serif', Georgia, serif;
    font-size: 1.1rem;
    line-height: 2;
    color: var(--text-primary);
    max-width: 100%;
    margin: 0;
}

.chapter-content p {
    margin-bottom: 2rem;
    text-align: justify;
    font-weight: 300;
    letter-spacing: 0.02em;
}

.chapter-content p:first-child {
    text-indent: 0;
}

.chapter-content p:first-child::first-letter {
    font-family: 'Playfair Display', 'Instrument Serif', Georgia, serif;
    font-size: 4.5rem;
    font-weight: 400;
    float: left;
    line-height: 0.8;
    margin-right: 0.5rem;
    margin-top: 0.2rem;
    color: var(--primary);
}

.chapter-actions {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.chapter-btn {
    padding: 0.75rem 2rem;
    background: transparent;
    border: 1px solid var(--gold-accent);
    color: var(--gold-accent);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.8s ease-out;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.chapter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gold-accent-light);
    transition: left 0.8s ease-out;
    z-index: -1;
}

.chapter-btn:hover::before {
    left: 0;
}

.chapter-btn:hover {
    color: var(--background);
    border-color: var(--gold-accent);
}

/* Input Bar Styles */
.input-bar-container {
    padding: 2rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--background);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.input-bar {
    max-width: 60%;
    margin: 0 auto;
    display: flex;
    gap: 1rem;
    align-items: center;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: none;
    border-radius: 0;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-subtle);
    transition: all 0.8s ease-out;
}

.input-bar:focus-within {
    border-bottom-color: var(--primary);
}

.input-bar.pulse {
    animation: inputPulse 0.6s ease-out;
}

@keyframes inputPulse {
    0%, 100% {
        box-shadow: none;
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    }
}

.input-bar input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    letter-spacing: 0.02em;
    padding: 0;
    outline: none;
}

.input-bar input::placeholder {
    color: var(--text-secondary);
    font-weight: 300;
}

.send-btn {
    background: transparent;
    border: none;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary);
    transition: all 0.8s ease-out;
    flex-shrink: 0;
    padding: 0;
}

.send-btn.has-text {
    color: var(--gold-accent);
    transform: rotate(15deg);
}

.send-btn:hover {
    opacity: 0.7;
    transform: rotate(15deg) scale(1.1);
}

.send-btn.has-text:hover {
    transform: rotate(15deg) scale(1.1);
}

.send-btn:active {
    opacity: 0.5;
    transform: rotate(15deg) scale(0.95);
}

.send-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    transition: all 0.8s ease-out;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.5rem;
        letter-spacing: 0.08em;
        flex-direction: column;
        gap: 0.2rem;
    }
    
    .title-line {
        display: block;
    }
    
    .title-underline {
        width: 150px;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .description {
        font-size: 0.95rem;
    }
    
    .input-wrapper input {
        padding: 1.25rem 1.25rem 1.25rem 3rem;
        font-size: 1rem;
    }
    
    .generate-btn {
        padding: 1rem 2rem;
        font-size: 1rem;
        min-width: 200px;
    }
    
    .hero-image {
        opacity: 0.6;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .chapter-bubble {
        padding: 2rem 1.5rem;
    }
    
    .chapter-title {
        font-size: 1.5rem;
    }
    
    .chapter-content {
        font-size: 1rem;
    }
    
    .chapter-content p:first-child::first-letter {
        font-size: 3.5rem;
    }
    
    .input-bar {
        max-width: 90%;
    }
    
    .messages-container {
        padding: 2rem 1rem;
    }
    
    .ambient-glow {
        width: 500px;
        height: 500px;
    }
    
    .floating-letter {
        font-size: 2rem;
    }
}
