:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --accent: #8b5cf6;
    --accent-glow: rgba(139, 92, 246, 0.25);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 5rem;
    padding-bottom: 5rem;
    overflow-x: hidden;
    position: relative;
}

#swarm-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

.glow-bg {
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, rgba(15, 23, 42, 0) 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    pointer-events: none;
    transition: all 0.5s ease;
}

.glow-bg.active {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, rgba(15, 23, 42, 0) 70%);
    width: 800px;
    height: 800px;
}

.container {
    width: 100%;
    max-width: 850px;
    padding: 0 2rem;
    z-index: 1;
}

header {
    margin-bottom: 3rem;
    text-align: center;
}

h1 {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #f8fafc, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

h1 span {
    background: linear-gradient(to right, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    font-size: 1.2rem;
    color: #94a3b8;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem;
    backdrop-filter: blur(16px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.3s ease;
}

.card h2 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.subtitle {
    color: #94a3b8;
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.5;
}

.input-group {
    margin-bottom: 2rem;
}

textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    color: #f8fafc;
    font-family: inherit;
    font-size: 1.05rem;
    resize: vertical;
    transition: all 0.3s ease;
    line-height: 1.6;
}

textarea:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--accent));
    color: white;
    border: none;
    padding: 1.25rem 2rem;
    font-size: 1.15rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    width: 100%;
    font-family: inherit;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.primary-btn:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

.hidden {
    display: none !important;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.result-box {
    margin-top: 2.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--card-border);
    animation: fadeIn 0.5s ease-out forwards;
}

.result-box h3 {
    margin-bottom: 1.5rem;
    color: #60a5fa;
    font-size: 1.3rem;
}

/* Markdown Rendering Styles */
.markdown-body {
    line-height: 1.7;
    color: #cbd5e1;
    font-size: 1.05rem;
}

.markdown-body p {
    margin-bottom: 1.2rem;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
    color: #f8fafc;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.markdown-body ul, .markdown-body ol {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.markdown-body li {
    margin-bottom: 0.5rem;
}

.markdown-body strong {
    color: #f8fafc;
    font-weight: 600;
}

/* Animations */
.fade-in {
    animation: fadeIn 1s ease-out forwards;
}

.slide-up {
    animation: slideUp 0.8s ease-out 0.2s forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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