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

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a25;
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --gradient-1: linear-gradient(135deg, #FF6B6B, #F7DC6F, #4ECDC4, #45B7D1, #BB8FCE);
    --gradient-2: linear-gradient(90deg, #FF6B6B, #F7DC6F);
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    position: relative;
    padding: 3rem 1.5rem 2rem;
    text-align: center;
    overflow: hidden;
}

.header-bg {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 107, 107, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(78, 205, 196, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(187, 143, 206, 0.1) 0%, transparent 50%);
    z-index: 0;
}

.app-title {
    font-family: 'Crimson Pro', serif;
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: 600;
    background: var(--gradient-1);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s linear infinite;
    position: relative;
    z-index: 1;
    letter-spacing: -0.02em;
}

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

.app-subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    color: var(--text-secondary);
    margin-top: 0.75rem;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

/* Main content */
.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
    width: 100%;
}

/* Input section */
.input-section {
    margin-bottom: 3rem;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.equation-input {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--text-primary);
    resize: none;
    transition: all 0.3s ease;
}

.equation-input:focus {
    outline: none;
    border-color: rgba(78, 205, 196, 0.5);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.1);
}

.equation-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.colorize-btn {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 2rem;
    background: var(--gradient-1);
    background-size: 200% auto;
    border: none;
    border-radius: 12px;
    color: #0a0a0f;
    cursor: pointer;
    transition: all 0.3s ease;
}

.colorize-btn:hover:not(:disabled) {
    background-position: right center;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
}

.colorize-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Examples */
.examples-section {
    margin-top: 2rem;
    text-align: center;
}

.examples-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.examples-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.example-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.example-btn:hover, .example-btn.active {
    border-color: rgba(78, 205, 196, 0.5);
    transform: translateY(-2px);
}

.example-btn.active {
    background: rgba(78, 205, 196, 0.1);
}

.example-name {
    font-size: 0.9rem;
    color: var(--text-primary);
}

/* Results section */
.results-section {
    animation: fadeIn 0.5s ease;
}

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

.equation-display {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 16px;
}

.equation-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Colored formula - the actual equation with colored text */
.colored-formula {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    justify-content: center;
    align-items: baseline;
    margin-bottom: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(2rem, 6vw, 3.5rem);
    font-weight: 700;
    line-height: 1.4;
}

.formula-part {
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
}

.formula-part:hover {
    transform: scale(1.15);
    filter: brightness(1.2);
}

.save-btn {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--text-secondary);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.save-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Component cards - simplified without images */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}

.component-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.component-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 25px color-mix(in srgb, var(--card-color) 30%, transparent);
}

.card-header {
    padding: 1rem;
    text-align: center;
}

.card-symbol {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
}

.card-content {
    padding: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.card-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ELI5 section */
.eli5-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.eli5-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.eli5-text {
    font-size: 1.1rem;
    line-height: 2;
    color: var(--text-secondary);
}

.eli5-highlight {
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

/* Legend */
.legend-section {
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: 12px;
}

.legend-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.legend-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Saved equations */
.saved-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.saved-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.saved-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.saved-btn {
    font-family: 'Space Grotesk', sans-serif;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.saved-btn:hover {
    background: rgba(78, 205, 196, 0.1);
    border-color: rgba(78, 205, 196, 0.3);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.app-footer a {
    color: #FF6B6B;
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

.footer-tagline {
    font-style: italic;
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti-particle {
    position: absolute;
    top: -10px;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Mobile responsive */
@media (max-width: 640px) {
    .app-header {
        padding: 2rem 1rem 1.5rem;
    }
    
    .main-content {
        padding: 0 1rem 2rem;
    }
    
    .equation-input {
        font-size: 1rem;
        padding: 1rem;
    }
    
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .eli5-container {
        padding: 1.5rem;
    }
    
    .legend-grid {
        gap: 0.75rem;
    }
    
    .colored-formula {
        font-size: clamp(1.5rem, 5vw, 2.5rem);
    }
}