/* ═══════════════════════════════════════════════════════════════
   NOESIS DESIGN SYSTEM
   Inspired by moro. studio — Dark, minimalist, hyper-modern
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─────────────────────────────────────────────────────────────────
   CSS Custom Properties
   ───────────────────────────────────────────────────────────────── */
:root {
    /* Colors */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #161616;
    --bg-elevated: #1a1a1a;
    --bg-hover: #1f1f1f;
    
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-muted: #52525b;
    
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-soft: rgba(99, 102, 241, 0.15);
    --accent-glow: rgba(99, 102, 241, 0.4);
    
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.15);
    --error: #ef4444;
    --error-soft: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.15);
    
    --border-default: #27272a;
    --border-subtle: #1f1f23;
    --border-hover: #3f3f46;
    
    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    
    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-glow);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─────────────────────────────────────────────────────────────────
   Reset & Base
   ───────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─────────────────────────────────────────────────────────────────
   Ambient Background & Visual Effects
   ───────────────────────────────────────────────────────────────── */
.ambient-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
    bottom: -100px;
    left: -100px;
    animation-delay: -7s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 10px) scale(1.02); }
}

/* Noise texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: -1;
}

/* ─────────────────────────────────────────────────────────────────
   Layout
   ───────────────────────────────────────────────────────────────── */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-lg) var(--space-3xl);
    position: relative;
    text-align: center;
}

.container-wide {
    max-width: 1400px;
}

.container-narrow {
    max-width: 680px;
}

/* ─────────────────────────────────────────────────────────────────
   Navigation
   ───────────────────────────────────────────────────────────────── */
.nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) 0;
    margin-bottom: var(--space-xl);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.nav-logo:hover {
    color: var(--accent);
}

.nav-logo svg {
    flex-shrink: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ─────────────────────────────────────────────────────────────────
   Typography
   ───────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: var(--radius-full);
    margin-bottom: var(--space-md);
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: var(--space-lg);
}

.gradient-text {
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 50%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
}

/* ─────────────────────────────────────────────────────────────────
   Hero Section
   ───────────────────────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding: var(--space-3xl) 0 var(--space-2xl);
}

.container > header {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* ─────────────────────────────────────────────────────────────────
   Cosmos Background
   ───────────────────────────────────────────────────────────────── */
.cosmos-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(ellipse at bottom, #1B2735 0%, #090A0F 100%);
    opacity: 0.65;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 4px #fff;
    animation: twinkle var(--duration) linear infinite;
    opacity: 0;
}

@keyframes twinkle {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.5); opacity: 0; }
}

.shooting-star {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1), 
                0 0 0 8px rgba(255, 255, 255, 0.1), 
                0 0 20px rgba(255, 255, 255, 1);
    animation: shoot 3s linear infinite;
    opacity: 0;
    transform: translate(-50%, -50%);
}

.shooting-star::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 300px;
    height: 1px;
    background: linear-gradient(90deg, #fff, transparent);
    right: 1px;
}

@keyframes shoot {
    0% {
        transform: rotate(315deg) translateX(0);
        opacity: 1;
    }
    70% {
        opacity: 1;
    }
    100% {
        transform: rotate(315deg) translateX(-1500px);
        opacity: 0;
    }
}

/* ─────────────────────────────────────────────────────────────────
   Capsule Prompt Input (ChatGPT-style)
   ───────────────────────────────────────────────────────────────── */
.prompt-wrapper {
    max-width: 720px;
    margin: var(--space-2xl) auto;
    width: 100%;
}

.prompt-capsule {
    display: flex;
    align-items: flex-end; /* Align bottom for multi-line expansion support */
    gap: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: 26px; /* Pill shape */
    padding: var(--space-sm) var(--space-md); /* Compact padding */
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    min-height: 52px; /* Minimum height similar to ChatGPT */
}

.prompt-capsule:focus-within {
    border-color: var(--border-hover); /* Subtle border change */
    background: var(--bg-elevated);
    box-shadow: var(--shadow-md);
}

/* Remove dedicated icon wrapper to match minimal style */
.prompt-icon {
    display: none;
}

.prompt-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.5;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    padding: var(--space-sm) 0;
}

.prompt-capsule textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.5;
    resize: none;
    min-height: 24px;
    max-height: 200px;
    padding: var(--space-sm) 0;
}

.prompt-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--text-primary); /* White/Light for contrast like ChatGPT */
    color: var(--bg-primary); /* Dark icon */
    border: none;
    border-radius: 50%; /* Rounded circle */
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    align-self: flex-end; /* Stick to bottom */
    margin-bottom: 4px; /* Slight offset */
}

.prompt-submit:hover {
    opacity: 0.9;
}

.prompt-submit:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ─────────────────────────────────────────────────────────────────
   Suggestions
   ───────────────────────────────────────────────────────────────── */
.suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.suggestion-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.suggestion-chip:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* ─────────────────────────────────────────────────────────────────
   Context Section (File Upload)
   ───────────────────────────────────────────────────────────────── */
.context-section {
    margin-top: var(--space-2xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-subtle);
}

.context-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.context-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}

.context-header span {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ─────────────────────────────────────────────────────────────────
   File Drop Zone
   ───────────────────────────────────────────────────────────────── */
.file-drop-zone {
    position: relative;
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    transition: all var(--transition-base);
    cursor: pointer;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.file-drop-zone.has-file {
    border-color: var(--success);
    background: var(--success-soft);
}

.file-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-secondary);
}

.drop-content svg {
    opacity: 0.5;
}

.drop-text {
    font-size: 0.9375rem;
}

.drop-text em {
    color: var(--accent);
    font-style: normal;
    font-weight: 500;
}

.drop-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* ─────────────────────────────────────────────────────────────────
   Features Grid
   ───────────────────────────────────────────────────────────────── */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-3xl);
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all var(--transition-base);
}

.feature-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--accent-soft);
    border-radius: var(--radius-md);
    color: var(--accent);
    margin-bottom: var(--space-md);
}

.feature-card h3 {
    font-size: 1rem;
    margin-bottom: var(--space-sm);
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ─────────────────────────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: var(--accent);
    color: white;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 500;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ─────────────────────────────────────────────────────────────────
   Checkpoint Timeline
   ───────────────────────────────────────────────────────────────── */
.checkpoints-page {
    max-width: 900px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: var(--space-2xl);
    padding: var(--space-3xl) 0 var(--space-xl);
    border-bottom: 1px solid var(--border-subtle);
    text-align: center;
}

.page-header h1 {
    font-size: 1.75rem;
    margin-bottom: var(--space-sm);
}

.page-header p {
    color: var(--text-secondary);
}

.checkpoint-stats {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    justify-content: center;
    margin-top: var(--space-sm);
}

.checkpoint-timeline {
    position: relative;
    padding-left: var(--space-2xl);
}

.checkpoint-item {
    position: relative;
    padding-bottom: var(--space-xl);
}

.checkpoint-item:last-child {
    padding-bottom: 0;
}

.checkpoint-connector {
    position: absolute;
    left: -28px;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.checkpoint-dot {
    width: 14px;
    height: 14px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-default);
    border-radius: 50%;
    flex-shrink: 0;
    z-index: 1;
    transition: all var(--transition-base);
}

.checkpoint-item.completed .checkpoint-dot {
    background: var(--success);
    border-color: var(--success);
}

.checkpoint-item.active .checkpoint-dot {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.checkpoint-line {
    width: 2px;
    flex: 1;
    background: var(--border-default);
    margin-top: var(--space-sm);
}

.checkpoint-item:last-child .checkpoint-line {
    display: none;
}

.checkpoint-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 0;
    transition: all var(--transition-base);
    display: block;
    overflow: hidden;
}

.checkpoint-content:hover {
    border-color: var(--border-hover);
}

.checkpoint-card {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: var(--space-lg);
    padding: var(--space-xl);
    min-height: 140px; /* Enforce a bit of height uniformity */
}

.checkpoint-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.checkpoint-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.checkpoint-info h3 .badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 8px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: var(--radius-full);
}

.checkpoint-info p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

.checkpoint-meta {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
    font-size: 0.8125rem;
}

.checkpoint-content a.btn-primary {
    align-self: flex-start;
    margin-top: var(--space-xs);
    white-space: nowrap;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
}

.checkpoint-item.completed .checkpoint-content {
    opacity: 0.6;
}

.checkpoint-item.completed .checkpoint-content h3::after {
    content: '✓';
    margin-left: auto;
    color: var(--success);
}

/* Fix grid layout for smaller screens */
@media (max-width: 600px) {
    .checkpoint-card {
        grid-template-columns: 1fr;
    }
    .checkpoint-content a.btn-primary {
        width: 100%;
        margin-top: var(--space-md);
    }
}

/* ─────────────────────────────────────────────────────────────────
   RAG Panel
   ───────────────────────────────────────────────────────────────── */
.rag-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    overflow: hidden;
}

.rag-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.rag-header:hover {
    background: var(--bg-hover);
}

.rag-header h3 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9375rem;
    font-weight: 500;
}

.rag-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--warning-soft);
    border-radius: var(--radius-sm);
    color: var(--warning);
}

.rag-header .chevron {
    color: var(--text-tertiary);
    transition: transform var(--transition-fast);
}

.rag-panel.open .rag-header .chevron {
    transform: rotate(180deg);
}

/* Support expanded class used in JS */
.rag-panel.expanded .rag-content {
    display: block;
}

.rag-panel.expanded .rag-header .chevron {
    transform: rotate(180deg);
}

.rag-content {
    display: none;
    padding: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

.rag-panel.open .rag-content {
    display: block;
}

.rag-chunk {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.rag-chunk:last-child {
    margin-bottom: 0;
}

.rag-chunk strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}

.rag-chunk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
    color: var(--text-tertiary);
    font-size: 0.8125rem;
}

.rag-chunk-header .source {
    color: var(--text-secondary);
    font-weight: 500;
}

.rag-chunk-header .score {
    color: var(--accent);
}

.rag-chunk pre {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    line-height: 1.6;
}

/* ─────────────────────────────────────────────────────────────────
   Editor Page
   ───────────────────────────────────────────────────────────────── */
.editor-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    margin-bottom: var(--space-lg);
}

.nav-back {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.nav-back:hover {
    color: var(--text-primary);
}

.progress-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.progress-indicator span {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.progress-bar {
    width: 120px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

/* Module Header */
.module-header {
    margin-bottom: var(--space-xl);
}

.module-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    margin-bottom: var(--space-md);
}

.module-header h1 {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
}

.module-header p {
    color: var(--text-secondary);
}

/* Editor Layout */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.editor-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-lg) var(--space-3xl);
}

.instructions-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

@media (max-width: 900px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }
}

/* Panel Sections */
.panel-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.section-header svg {
    opacity: 0.6;
}

.section-content {
    padding: var(--space-lg);
}

.section-content h4 {
    font-size: 0.9375rem;
    margin-bottom: var(--space-sm);
}

.section-content p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.7;
    margin-bottom: var(--space-lg);
}

.section-content p:last-child {
    margin-bottom: 0;
}

.requirements-list,
.hints-list {
    list-style: none;
    padding-left: 0;
    display: grid;
    gap: var(--space-sm);
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.requirements-list li,
.hints-list li {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-start;
}

.requirements-list li::before,
.hints-list li::before {
    content: '•';
    color: var(--accent);
    margin-top: 2px;
}

.code-signature {
    display: block;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--accent);
    margin-top: var(--space-md);
    overflow-x: auto;
}

/* Code Panel */
.code-panel {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--bg-secondary);
}

.code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    z-index: 1;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.file-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.8125rem;
    color: var(--text-tertiary);
}

.run-button {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    background: var(--success);
    color: white;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.run-button:hover {
    background: #16a34a;
}

.run-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Validation detail blocks */
.result-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.result-message {
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.result-details pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    overflow-x: auto;
}

/* Code Editor */
.code-editor {
    flex: 1;
    min-height: 300px;
    position: relative;
    background: radial-gradient(circle at 20% 20%, rgba(99,102,241,0.06), transparent 40%),
                radial-gradient(circle at 80% 0%, rgba(8,126,164,0.05), transparent 35%),
                var(--bg-primary);
    border-top: 1px solid var(--border-subtle);
}

.code-editor textarea {
    width: 100%;
    height: 100%;
    min-height: 300px;
    padding: var(--space-xl) var(--space-xl) var(--space-xl) 72px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.92rem;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    caret-color: var(--accent);
    letter-spacing: 0.01em;
    font-feature-settings: "calt" 1, "liga" 1;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
    tab-size: 4;
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 70px, transparent 70px),
                repeating-linear-gradient(transparent 0, transparent 26px, rgba(255,255,255,0.03) 26px, rgba(255,255,255,0.03) 27px);
}

.code-editor textarea::placeholder {
    color: var(--text-tertiary);
}

/* Validation Result */
.validation-result {
    padding: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
    display: none;
}

.validation-result.show {
    display: block;
}

.validation-result.success {
    background: var(--success-soft);
}

.validation-result.error {
    background: var(--error-soft);
}

/* Align with JS which adds 'failure' */
.validation-result.failure {
    background: var(--error-soft);
}

.validation-result h4 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9375rem;
    margin-bottom: var(--space-sm);
}

.validation-result.success h4 {
    color: var(--success);
}

.validation-result.error h4 {
    color: var(--error);
}

.validation-result.failure h4 {
    color: var(--error);
}

.validation-result p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.validation-result.hidden {
    display: none;
}

/* ─────────────────────────────────────────────────────────────────
   Admin Page
   ───────────────────────────────────────────────────────────────── */
.admin-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
}

.admin-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.admin-card-header svg {
    color: var(--accent);
}

.admin-card-header h2 {
    font-size: 1.125rem;
}

.info-card {
    display: flex;
    gap: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.info-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--accent-soft);
    border-radius: var(--radius-md);
    color: var(--accent);
    flex-shrink: 0;
}

.info-card h4 {
    font-size: 0.9375rem;
    margin-bottom: var(--space-xs);
}

.info-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid var(--border-default);
}

.badge-primary {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent-soft);
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
    border-color: var(--success-soft);
}

/* ─────────────────────────────────────────────────────────────────
   Forms
   ───────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary);
}

/* ─────────────────────────────────────────────────────────────────
   Alerts
   ───────────────────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
}

.alert-success {
    background: var(--success-soft);
    color: var(--success);
}

.alert-danger {
    background: var(--error-soft);
    color: var(--error);
}

.alert-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.alert-info {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ─────────────────────────────────────────────────────────────────
   Empty State
   ───────────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
}

.empty-state svg {
    color: var(--text-tertiary);
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.125rem;
    margin-bottom: var(--space-sm);
}

.empty-state p {
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto var(--space-lg);
}

/* ─────────────────────────────────────────────────────────────────
   Animations
   ───────────────────────────────────────────────────────────────── */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* ─────────────────────────────────────────────────────────────────
   Utilities
   ───────────────────────────────────────────────────────────────── */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }

/* ─────────────────────────────────────────────────────────────────
   Responsive
   ───────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .container {
        padding: var(--space-md);
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .prompt-capsule {
        padding: var(--space-sm);
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-bar {
        flex-wrap: wrap;
        gap: var(--space-md);
    }
}

@media (max-width: 480px) {
    .suggestions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .suggestion-chip {
        justify-content: center;
    }
}