:root {
    /* Color System - Premium & Delightful Palette */
    --primary-color: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.2);
    --primary-hover: #4f46e5;
    --primary-active: #4338ca;
    
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --input-border: #cbd5e1;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    /* Platform Colors - Refined for Contrast & Aesthetics */
    --x-color: #000000;
    --instagram-gradient: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    --tiktok-color: #000000;
    --linkedin-color: #0a66c2;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    
    /* Typography Tokens */
    --font-inter: 'Inter', system-ui, -apple-system, sans-serif;
    --h1-size: 2.75rem;
    --h2-size: 2rem;
    --h3-size: 1.25rem;
    --body-size: 1rem;
    --caption-size: 0.875rem;
    --small-size: 0.75rem;
    
    /* Rhythm - 8px Grid Alignment */
    --space-1: 0.25rem;  /* 4px */
    --space-2: 0.5rem;   /* 8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-6: 1.5rem;   /* 24px */
    --space-8: 2rem;     /* 32px */
    --space-12: 3rem;    /* 48px */
}

[data-theme="dark"] {
    --bg-color: #0f172a;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --card-bg: #1e293b;
    --border-color: #334155;
    --input-border: #475569;
    --x-color: #ffffff;
    --tiktok-color: #ff0050;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-inter);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Header & Nav - Integrated from OpenClaw Hub */
.main-header {
    background: var(--card-bg);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
}

.logo-image {
    height: 32px;
    width: auto;
}

.brand-name {
    font-weight: 800;
    font-size: 1.4rem;
    margin-left: 0.75rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
}

/* Typography Hierarchy */
.tool-header h1 {
    font-size: var(--h1-size);
    font-weight: 800;
    margin-bottom: var(--space-2);
    letter-spacing: -0.025em;
    color: var(--text-color);
}

.word-swap {
    display: inline-block;
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.word-swap.fade-out {
    opacity: 0;
    transform: translateY(10px);
}

.word-swap.fade-in {
    opacity: 1;
    transform: translateY(0);
}

/* Social Proof Banner */
.social-proof-banner {
    margin-bottom: var(--space-8);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.8s ease;
}

.social-proof-banner.visible {
    opacity: 1;
    transform: translateY(0);
}

.proof-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

.proof-text strong {
    color: var(--primary-color);
    font-weight: 700;
}

/* Hero Actions */
.hero-actions {
    margin-bottom: var(--space-8);
}

.demo-btn {
    background: var(--bg-color);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.6rem 1.2rem;
    border-radius: 2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.demo-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

h2 {
    font-size: var(--h2-size);
    font-weight: 800;
    margin-bottom: var(--space-8);
    letter-spacing: -0.02em;
}

h3 {
    font-size: var(--h3-size);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: var(--space-4);
}

/* Results Celebration Animation */
.platform-cards.celebrate .card {
    animation: cardFanIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes cardFanIn {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(50px) rotate(-5deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0) rotate(0);
    }
}

/* Contextual Tip */
.contextual-tip {
    margin: 2rem 0;
    padding: 1rem;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: var(--radius-md);
    position: relative;
    animation: slideIn 0.5s ease-out;
}

.tip-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tip-icon { font-size: 1.5rem; }

.dismiss-tip {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #b45309;
}

/* Smart Suggestions */
.smart-suggestions {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px dashed var(--border-color);
    display: flex;
    justify-content: space-around;
    gap: 2rem;
    flex-wrap: wrap;
}

.suggestion-block h4 {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.suggestion-pills {
    display: flex;
    gap: 0.5rem;
}

.suggest-tone {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s;
}

.suggest-tone:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--card-bg);
    padding: 2rem;
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 99;
}

.mobile-menu.active { display: flex; }

@media (max-width: 992px) {
    .nav-links { display: none; }
    .mobile-toggle { display: block; }
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--space-4) var(--space-12);
}

/* Footer Improvements */
footer {
    border-top: 1px solid var(--border-color);
    margin-top: var(--space-12);
    padding: var(--space-12) 0 var(--space-8);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-6);
}

/* Input Section - Micro-animations */
.input-section {
    background: var(--card-bg);
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--space-12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.input-section:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.input-group {
    display: flex;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

#urlInput {
    flex: 1;
    padding: 0.875rem var(--space-4);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-md);
    font-size: var(--body-size);
    background: var(--bg-color);
    color: var(--text-color);
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes inputGlow {
    0% { box-shadow: 0 0 0 0 var(--primary-glow); border-color: var(--primary-color); }
    50% { box-shadow: 0 0 0 6px var(--primary-glow); border-color: var(--primary-color); }
    100% { box-shadow: 0 0 0 0 var(--primary-glow); border-color: var(--primary-color); }
}

#urlInput:focus {
    animation: inputGlow 2s infinite ease-in-out;
    background: var(--card-bg);
}

#generateBtn {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    border: none;
    padding: 1rem var(--space-8);
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 220px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

#generateBtn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
    filter: brightness(1.1);
}

#generateBtn:active {
    transform: translateY(1px);
}

/* Staggered Fade-in */
.card:nth-child(1) { transition-delay: 0.05s; }
.card:nth-child(2) { transition-delay: 0.1s; }
.card:nth-child(3) { transition-delay: 0.15s; }
.card:nth-child(4) { transition-delay: 0.2s; }

/* Tone Pills */
.tone-selector {
    margin-bottom: var(--space-6);
    display: flex;
    justify-content: center;
}

.tone-buttons {
    display: flex;
    gap: var(--space-2);
    padding: 4px;
    background: var(--bg-color);
    border-radius: 3rem;
    border: 1px solid var(--border-color);
}

.pill-btn {
    padding: 0.6rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pill-btn:hover {
    color: var(--text-color);
}

.pill-btn.active {
    background-color: var(--card-bg);
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Advanced Options */
.advanced-options {
    margin-top: var(--space-4);
    border-top: 1px solid var(--border-color);
    padding-top: var(--space-4);
}

.advanced-options summary {
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.advanced-options summary::-webkit-details-marker { display: none; }

.advanced-content {
    padding: var(--space-4) 0;
    display: grid;
    gap: var(--space-4);
}

.advanced-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
}

.persona-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
}

.persona-selector select {
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
}

.toggle-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
}

/* History Sidebar */
.history-sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100%;
    background: var(--card-bg);
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    z-index: 1001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.history-sidebar.open {
    right: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.history-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
    border-radius: var(--radius-sm);
}

.history-item:hover {
    background: var(--bg-color);
}

.history-url {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

/* Platform Specific Colors */
.platform-twitter .platform-identity i { color: var(--x-color); }
.platform-instagram .platform-identity i { background: var(--instagram-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.platform-tiktok .platform-identity i { color: var(--tiktok-color); }
.platform-linkedin .platform-identity i { color: var(--linkedin-color); }

/* Ripple Effect */
.ripple {
    position: absolute;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* FAQ Styles */
.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    border: none;
    text-align: left;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-question i {
    transition: transform 0.3s;
}

.faq-answer {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    background: var(--bg-color);
    color: var(--text-muted);
}

.faq-item.active .faq-question i { transform: rotate(180deg); }
.faq-item.active .faq-answer { padding: 1rem 1.5rem; max-height: 200px; }

/* Newsletter */
.newsletter-section {
    text-align: center;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    padding: var(--space-12) var(--space-6);
    border-radius: var(--radius-lg);
    margin-top: var(--space-12);
}

.newsletter-section h2 { color: white; margin-bottom: 1rem; }
.newsletter-section p { margin-bottom: 2rem; opacity: 0.9; }

.newsletter-form {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    gap: 0.5rem;
}

.newsletter-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: none;
    outline: none;
}

.newsletter-form button {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    border: none;
    background: var(--text-color);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

/* Mobile: 480px and below */
@media (max-width: 480px) {
    .container { padding: 0 var(--space-3); }

    /* Stack URL input + generate button vertically */
    .input-group {
        flex-direction: column;
    }
    .input-group #generateBtn,
    .input-group button[type="submit"] {
        width: 100%;
    }

    /* Tone pills: wrap and shrink */
    .tone-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
    .pill-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Input section less padding */
    .input-section {
        padding: var(--space-4);
    }

    /* Hero text sizing */
    .hero h1 { font-size: 1.6rem; }
    .hero p, .hero .subtitle { font-size: 0.95rem; }

    /* Cards full width */
    .platform-cards {
        grid-template-columns: 1fr;
    }

    /* Floating action bar */
    .floating-action-bar {
        flex-direction: column;
        gap: var(--space-2);
        padding: var(--space-3);
    }
    .floating-action-bar button {
        width: 100%;
    }

    /* Advanced toggles stack */
    .advanced-toggles {
        flex-direction: column;
        gap: var(--space-3);
    }

    /* Suggestion pills wrap */
    .suggestion-pills {
        flex-wrap: wrap;
    }

    /* Social proof smaller */
    .social-proof { font-size: 0.85rem; }

    /* Example chips wrap */
    .example-chips, .demo-chips {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Medium mobile: 768px */
@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
    }
    .input-group #generateBtn,
    .input-group button[type="submit"] {
        width: 100%;
    }
    .tone-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
    .platform-cards {
        grid-template-columns: 1fr;
    }
}

.hidden { display: none !important; }
