:root {
    --bg: #1a1a1a;
    --bg-secondary: rgba(26, 26, 26, 0.6);
    --card-bg: rgba(26, 26, 26, 0.8);
    --surface: #1a1a1a;
    --text-primary: #f5f7ff;
    --text-secondary: rgba(245, 247, 255, 0.7);
    --accent: linear-gradient(120deg, #9f7bff, #5ac8ff 60%, #55ffe3);
    --border-color: rgba(255, 255, 255, 0.15);
    --chip-bg: rgba(255, 255, 255, 0.12);
    --shadow-strong: 0 20px 60px rgba(0, 0, 0, 0.55);
    --blur: blur(24px);
}

body[data-theme="light"],
body[data-theme="auto"][data-system-theme="light"] {
    --bg: #f7f8ff;
    --bg-secondary: rgba(255, 255, 255, 0.75);
    --card-bg: rgba(255, 255, 255, 0.9);
    --surface: #ffffff;
    --text-primary: #0c0f1f;
    --text-secondary: rgba(12, 15, 31, 0.7);
    --border-color: rgba(12, 15, 31, 0.12);
    --chip-bg: rgba(12, 15, 31, 0.08);
    --shadow-strong: 0 20px 60px rgba(15, 17, 34, 0.1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    font-family: "Inter", "SF Pro SC", "PingFang SC", -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft Yahei", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    background: var(--bg);
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 28px;
}

.cosmic-background {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(123, 112, 255, 0.18), transparent 45%),
        radial-gradient(circle at 80% 0%, rgba(86, 228, 255, 0.2), transparent 55%),
        radial-gradient(circle at 50% 80%, rgba(85, 255, 198, 0.15), transparent 50%);
    z-index: -3;
    overflow: hidden;
    opacity: 0;
    animation: fadeIn 1.2s ease-out 0.1s forwards;
}

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

.grid-lines {
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 80px 80px;
    opacity: 0.5;
}

.aurora {
    position: absolute;
    width: 60vw;
    height: 60vw;
    filter: blur(60px);
    opacity: 0.7;
    animation: drift 18s infinite linear;
}

.aurora-left {
    left: -20%;
    top: 10%;
    background: radial-gradient(circle, rgba(159, 123, 255, 0.45), transparent 65%);
}

.aurora-right {
    right: -15%;
    top: -10%;
    background: radial-gradient(circle, rgba(85, 255, 227, 0.35), transparent 60%);
    animation-direction: reverse;
}

.particle-field::before,
.particle-field::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 200px 200px;
    animation: float 20s linear infinite;
}

.particle-field::after {
    animation-duration: 25s;
    opacity: 0.4;
}

.hero {
    position: relative;
    padding: 48px 0 120px;
}

/* Hero Enter Animations - Initial State */
.hero-nav,
.hero-copy > *,
.hero-visual {
    opacity: 0;
}

/* Ensure hero-actions container is visible (buttons handle their own opacity) */
.hero-actions {
    opacity: 1;
}

.hero-nav {
    transform: translateY(-30px);
}

.logo {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
}

.floating-badge {
    transform: translateX(-30px);
}

.hero-copy h1 {
    transform: translateY(40px) scale(0.95);
}

.hero-copy p {
    transform: translateY(20px);
}

.hero-actions .btn {
    opacity: 0;
    transform: translateY(20px);
    position: relative;
    z-index: 10;
    /* Explicitly set visibility to prevent inheritance of hidden state */
    visibility: visible;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Safety fallback: ensure buttons are visible even if animations fail or don't trigger */
.hero:not(.animate) .hero-actions .btn {
    visibility: visible;
    animation: btnFallback 0.1s ease 0.5s forwards;
}

.hero-stats div {
    transform: translateY(20px);
}

.hero-visual {
    transform: scale(0.9);
}

/* Hero Enter Animations - Active State */
.hero.animate .hero-nav {
    animation: slideDownFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero.animate .logo {
    animation: logoEnter 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

.hero.animate .floating-badge {
    animation: slideLeftFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.hero.animate .hero-copy h1 {
    animation: heroTitleEnter 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
}


.hero.animate .hero-copy p {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

.hero.animate .hero-actions {
    opacity: 1;
}

.hero.animate .hero-actions .btn {
    visibility: visible;
}

.hero.animate .hero-actions .btn:nth-child(1) {
    animation: fadeInUpBtn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
}

.hero.animate .hero-actions .btn:nth-child(2) {
    animation: fadeInUpBtn 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

.hero.animate .hero-stats div:nth-child(1) {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 1s forwards;
}

.hero.animate .hero-stats div:nth-child(2) {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 1.1s forwards;
}

.hero.animate .hero-stats div:nth-child(3) {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 1.2s forwards;
}

.hero.animate .hero-visual {
    animation: heroVisualEnter 1s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

.hero-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0 32px;
    position: relative;
    z-index: 10003;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background-image: var(--accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 18px;
    color: #050505;
    box-shadow: 0 15px 40px rgba(91, 143, 255, 0.45);
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-title {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.logo-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    position: relative;
    z-index: 10001;
}

.nav-links a {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text-secondary);
    transition: background 0.3s ease, color 0.3s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.nav-link-ghost {
    border: 1px solid var(--border-color);
}

.theme-toggle {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.toggle-icon {
    font-size: 16px;
    opacity: 0.6;
}

.hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 48px;
    align-items: center;
    margin-top: 32px;
}

.hero-copy h1 {
    font-size: clamp(40px, 5vw, 72px);
    margin: 12px 0 20px;
    max-width: 640px;
    line-height: 1.1;
    position: relative;
    color: var(--text-primary);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.hero-copy h1::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(159, 123, 255, 0.4), transparent);
    animation: shimmer 3s infinite;
    pointer-events: none;
}

@supports (-webkit-background-clip: text) or (background-clip: text) {
    .hero-copy h1 {
        background: linear-gradient(135deg, var(--text-primary) 0%, rgba(159, 123, 255, 0.95) 50%, var(--text-primary) 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    .hero-copy h1::before {
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    }
}

.hero-copy h1 .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px) rotateX(90deg) scale(0.8);
    filter: blur(5px);
    /* Override transparent text fill to ensure visibility */
    -webkit-text-fill-color: unset;
    color: inherit;
    /* Emergency fallback: ensure text is visible after 0.3 seconds if JavaScript fails */
    animation: charFallback 0.1s ease 0.3s forwards;
}

/* Animate characters when animate-chars class is present */
.hero-copy h1.animate-chars .char {
    /* Main animation with per-character delay, plus fallback safety net */
    animation: charReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards,
                charFallback 0.1s ease 1s forwards;
    /* Use 0s as fallback if --char-index is not defined */
    animation-delay: calc((var(--char-index, 0) * 0.05s) + 0.3s), 0s;
}

/* Emergency fallback animation */
@keyframes charFallback {
    from {
        opacity: 0;
        -webkit-text-fill-color: var(--text-primary) !important;
        color: var(--text-primary) !important;
    }
    to {
        opacity: 1 !important;
        transform: translateY(0) rotateX(0deg) scale(1);
        filter: blur(0);
        /* Override transparent text fill to ensure visibility */
        -webkit-text-fill-color: var(--text-primary) !important;
        color: var(--text-primary) !important;
    }
}

.hero-copy p {
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1.7;
    max-width: 560px;
}

.floating-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 18px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 28px 0;
}

.btn {
    padding: 14px 32px;
    border-radius: 999px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn.primary {
    background-image: var(--accent);
    color: #050505;
    box-shadow: 0 15px 40px rgba(91, 143, 255, 0.45);
}

.btn.primary:hover {
    transform: translateY(-3px);
}

.btn.secondary {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
}

.btn.secondary.ghost {
    background: #ffffff;
    color: #060815;
    border-color: transparent;
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn.pulse {
    position: relative;
    overflow: hidden;
}

.btn.pulse::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: inherit;
    opacity: 0.4;
    filter: blur(20px);
    z-index: -1;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.hero-stats div {
    padding: 18px;
    border-radius: 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    text-align: left;
    box-shadow: var(--shadow-strong);
}

.hero-stats strong {
    display: block;
    font-size: 32px;
}

.hero-visual {
    position: relative;
    padding: 32px 0;
    z-index: 1;
}

.pulse-ring {
    position: absolute;
    inset: 30px;
    border-radius: 36px;
    background: radial-gradient(circle, rgba(159, 123, 255, 0.2), transparent 70%);
    filter: blur(40px);
    animation: pulse 7s ease-in-out infinite;
    z-index: 0;
}

.glass-card {
    position: relative;
    z-index: 1;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    padding: 28px;
    backdrop-filter: blur(28px);
    box-shadow: var(--shadow-strong);
}

.card-header,
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #5dffb5;
    box-shadow: 0 0 20px rgba(93, 255, 181, 0.8);
}

.code-preview {
    margin: 18px 0;
    background: rgba(3, 5, 15, 0.85);
    border-radius: 24px;
    padding: 22px;
    color: #d0deff;
    font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-footer button {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    padding: 8px 18px;
    border-radius: 999px;
    cursor: pointer;
}

.floating-metrics {
    position: absolute;
    top: 10px;
    right: -10px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 10;
}

.metric-chip {
    background: var(--chip-bg);
    border-radius: 18px;
    padding: 12px 18px;
    backdrop-filter: blur(24px);
    min-width: 150px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-strong);
}

.metric-chip span {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
}

.metric-chip strong {
    font-size: 22px;
}

.section {
    position: relative;
    padding: 100px 0;
}

.section-title {
    text-align: center;
    max-width: 780px;
    margin: 0 auto 56px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.section-badge {
    display: inline-flex;
    padding: 6px 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    letter-spacing: 0.08em;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.section-title h2 {
    font-size: clamp(32px, 4vw, 48px);
    margin: 20px 0 16px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.section-title p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.8;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Language Switcher */
.lang-switcher {
    position: relative;
    z-index: 10002;
}

.lang-toggle {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-primary);
    border-radius: 999px;
    padding: 6px 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    transition: background 0.3s ease;
}

.lang-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.lang-current {
    font-weight: 500;
}

.lang-arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.lang-dropdown.active ~ .lang-toggle .lang-arrow,
.lang-switcher.active .lang-arrow {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 8px;
    min-width: 140px;
    box-shadow: var(--shadow-strong);
    backdrop-filter: var(--blur);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 10000;
}

.lang-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: block;
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    transition: background 0.2s ease;
    text-align: left;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.lang-option.active {
    background: rgba(159, 123, 255, 0.15);
    color: var(--text-primary);
}

/* Creative Intro Section */
.intro-showcase {
    position: relative;
    padding: 60px 0;
}

.intro-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 32px;
    margin-top: 48px;
}

.intro-feature-card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 40px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-strong);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.intro-feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.intro-feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border-color: rgba(159, 123, 255, 0.3);
}

.intro-feature-card:hover::before {
    transform: scaleX(1);
}

.feature-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 8px;
}

.feature-icon {
    position: relative;
    width: 100%;
    height: 100%;
    color: var(--text-primary);
    z-index: 2;
}

.feature-icon svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 12px rgba(159, 123, 255, 0.3));
    transition: transform 0.3s ease;
}

.intro-feature-card:hover .feature-icon svg {
    transform: scale(1.1) rotate(5deg);
}

.feature-icon-bg {
    position: absolute;
    inset: -20px;
    background: radial-gradient(circle, rgba(159, 123, 255, 0.15), transparent 70%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.intro-feature-card:hover .feature-icon-bg {
    opacity: 1;
}

.feature-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature-content h3 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    background: var(--accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
}

.feature-content p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
    font-size: 15px;
    flex: 1;
}

.feature-stat {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 8px;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    background: var(--accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

@media (max-width: 768px) {
    .intro-features-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        margin-top: 32px;
    }

    .intro-feature-card {
        padding: 32px;
    }

    .feature-icon-wrapper {
        width: 64px;
        height: 64px;
    }

    .feature-content h3 {
        font-size: 22px;
    }

    .stat-value {
        font-size: 32px;
    }
}

.ai-section {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 60%);
}

/* AI Flow 容器 - 左右布局 */
.ai-flow-container {
    display: grid;
    grid-template-columns: minmax(300px, 420px) 1fr;
    gap: 40px;
    margin-top: 48px;
    align-items: stretch;
}

/* 左侧功能列表 */
.ai-flow-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-feature-item {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
    min-width: 0; /* 允许flex子元素收缩 */
}

.ai-feature-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: rgba(93, 255, 181, 0.3);
    transition: all 0.3s ease;
}

.ai-feature-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(93, 255, 181, 0.3);
}

.feature-number {
    font-size: 32px;
    font-weight: 700;
    color: rgba(93, 255, 181, 0.8);
    line-height: 1;
    min-width: 40px;
    transition: all 0.3s ease;
}

.feature-content {
    flex: 1;
    min-width: 0; /* 允许flex子元素收缩 */
}

.feature-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.feature-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* 右侧演示窗口 */
.ai-flow-demo {
    position: relative;
    height: 100%;
}

.demo-window {
    background: var(--card-bg);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-strong);
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.demo-window-header {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.demo-window-dots {
    display: flex;
    gap: 6px;
}

.demo-window-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.demo-window-dots span:nth-child(1) {
    background: rgba(255, 95, 87, 0.6);
}

.demo-window-dots span:nth-child(2) {
    background: rgba(255, 189, 46, 0.6);
}

.demo-window-dots span:nth-child(3) {
    background: rgba(40, 200, 65, 0.6);
}

.demo-window-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.demo-window-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0; /* 允许flex子元素收缩 */
    min-height: 0; /* 允许flex子元素收缩 */
}

.ai-demo {
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
    min-width: 0; /* 允许flex子元素收缩 */
}

.ai-demo::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(93, 255, 181, 0.6), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 代码补全演示 */
.ai-demo-code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

.demo-code-line {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    margin: 4px 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex-wrap: wrap;
}

.code-keyword {
    color: #c792ea;
}

.code-function {
    color: #82aaff;
}

.code-param {
    color: #f78c6c;
}

.code-paren {
    color: #89ddff;
}

.code-string {
    color: #c3e88d;
}

.code-operator {
    color: #89ddff;
}

.code-comment {
    color: #546e7a;
    font-style: italic;
}

.code-indent {
    display: inline-block;
    width: 20px;
}

.typing::after {
    content: '▋';
    animation: blink 1s infinite;
    color: rgba(93, 255, 181, 0.8);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 聊天演示 */
.ai-demo-chat {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 85%;
    min-width: 0; /* 允许flex子元素收缩 */
    font-size: 13px;
    animation: slideIn 0.4s ease-out;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    box-sizing: border-box;
}

.chat-bubble span {
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.chat-bubble.user {
    background: rgba(93, 255, 181, 0.15);
    border: 1px solid rgba(93, 255, 181, 0.3);
    color: var(--text-primary);
    align-self: flex-end;
}

.chat-bubble.ai {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    align-self: flex-start;
}

.chat-bubble.ai .demo-code-line {
    margin: 4px 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

.chat-bubble.ai .demo-code-block {
    margin-top: 8px;
}

.chat-bubble.ai .terminal-line {
    margin-top: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.chat-bubble.ai .terminal-line span {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(93, 255, 181, 0.6);
    animation: typingDot 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* 代码编辑演示 */
.ai-demo-edit {
    padding: 16px;
    justify-content: center;
}

.demo-code-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.code-line {
    padding: 8px 12px;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    transition: all 0.4s ease;
}

.code-line.selected {
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.4);
    color: var(--text-primary);
}

.code-line.transformed {
    background: rgba(93, 255, 181, 0.15);
    border: 1px solid rgba(93, 255, 181, 0.4);
    color: var(--text-primary);
    animation: transformIn 0.5s ease-out;
}

.edit-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: rgba(255, 193, 7, 0.2);
    border-radius: 4px;
    color: rgba(255, 193, 7, 0.9);
    font-weight: 600;
}

.transform-icon {
    font-size: 16px;
    animation: sparkle 1s ease-in-out infinite;
}

@keyframes transformIn {
    0% {
        opacity: 0;
        transform: translateX(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
}

/* 终端演示 */
.ai-demo-terminal {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    justify-content: center;
}

.terminal-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    animation: fadeInUp 0.4s ease-out;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex-wrap: wrap;
    min-width: 0;
}

.terminal-line span {
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex-shrink: 1;
}

.terminal-line:nth-child(2) {
    animation-delay: 0.3s;
}

.terminal-prompt {
    color: rgba(93, 255, 181, 0.8);
    font-weight: 600;
}

.terminal-input {
    color: var(--text-secondary);
    font-style: italic;
}

.terminal-output {
    margin-top: 4px;
    padding-left: 20px;
}

.terminal-command {
    color: var(--text-primary);
}

.terminal-arrow {
    color: rgba(93, 255, 181, 0.6);
    margin-left: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

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

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

@keyframes btnFallback {
    to {
        opacity: 1 !important;
        transform: translateY(0) !important;
        visibility: visible !important;
    }
}

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

@keyframes slideLeftFadeIn {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes heroTitleEnter {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
        filter: blur(10px);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-8px) scale(1.03);
        filter: blur(3px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes charReveal {
    0% {
        opacity: 0;
        transform: translateY(30px) rotateX(90deg) scale(0.8);
        filter: blur(5px);
    }
    50% {
        opacity: 0.7;
        transform: translateY(-5px) rotateX(0deg) scale(1.05);
        filter: blur(1px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotateX(0deg) scale(1);
        filter: blur(0);
        /* Override transparent text fill to ensure visibility */
        -webkit-text-fill-color: unset !important;
        color: inherit !important;
    }
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.hero-copy h1.switching {
    position: relative;
}

.hero-copy h1.switching .char:not(.new) {
    animation: charSwitchOut 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-copy h1 .char.new {
    opacity: 0;
    transform: translateY(30px) rotateX(90deg) scale(0.8);
    filter: blur(5px);
    /* Override transparent text fill from parent h1 to ensure visibility */
    -webkit-text-fill-color: var(--text-primary) !important;
    color: var(--text-primary) !important;
    animation: charSwitchIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards,
                charFallback 0.1s ease forwards;
    /* Use 0s as fallback if --char-index is not defined */
    /* charFallback delay = charSwitchIn delay + charSwitchIn duration (0.6s) + small buffer */
    animation-delay: calc((var(--char-index, 0) * 0.03s)), calc((var(--char-index, 0) * 0.03s) + 0.7s);
    /* Fallback to ensure new characters are visible even if animation fails */
}

@keyframes charSwitchOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-20px) scale(0.9) rotateX(-90deg);
        filter: blur(5px);
    }
}

@keyframes charSwitchIn {
    0% {
        opacity: 0;
        transform: translateY(30px) rotateX(90deg) scale(0.8);
        filter: blur(8px);
        /* Override transparent text fill to ensure visibility from the start */
        -webkit-text-fill-color: var(--text-primary) !important;
        color: var(--text-primary) !important;
    }
    60% {
        opacity: 0.8;
        transform: translateY(-3px) rotateX(0deg) scale(1.05);
        filter: blur(2px);
        /* Override transparent text fill to ensure visibility */
        -webkit-text-fill-color: var(--text-primary) !important;
        color: var(--text-primary) !important;
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotateX(0deg) scale(1);
        filter: blur(0);
        /* Override transparent text fill to ensure visibility */
        -webkit-text-fill-color: var(--text-primary) !important;
        color: var(--text-primary) !important;
    }
}

@keyframes heroVisualEnter {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes logoEnter {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    60% {
        transform: translateY(2px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

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

.copilot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.copilot-card {
    background: var(--card-bg);
    border-radius: 28px;
    padding: 28px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-strong);
}

.copilot-card ul {
    padding-left: 18px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.copilot-card li {
    margin-bottom: 6px;
}

.copilot-card.highlight {
    border-color: rgba(93, 255, 181, 0.4);
    background: linear-gradient(145deg, rgba(93, 255, 181, 0.1), transparent 40%);
}

.chat-demo {
    margin-top: 14px;
    border-left: 2px solid rgba(93, 255, 181, 0.6);
    padding-left: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-secondary);
}

.chat-line.accent {
    color: var(--text-primary);
}

.vscode-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.vscode-grid article {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-strong);
}

.compare-table {
    border-radius: 32px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    background: var(--card-bg);
    box-shadow: var(--shadow-strong);
}

.compare-table .table-header,
.compare-table .table-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    padding: 18px 24px;
    align-items: center;
    gap: 16px;
}

.compare-table .table-header {
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.compare-table .table-row:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.cta-inline {
    margin-top: 40px;
    padding: 32px;
    border-radius: 28px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.cta-inline .btn,
.cta-actions .btn {
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
}

.footer {
    position: relative;
    background: rgba(0, 0, 0, 0.6);
    color: var(--text-secondary);
    text-align: center;
    padding: 40px 0 60px;
    border-top: 1px solid var(--border-color);
}

.footer a {
    color: inherit;
    text-decoration: underline;
}

/* Enterprise Footer Styles */
.enterprise-footer {
    position: relative;
    background: var(--bg-secondary, rgba(0, 0, 0, 0.6));
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    padding: 60px 0 30px;
    margin-top: 80px;
}

.enterprise-footer .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-content {
    display: flex;
    align-items: flex-start;
    gap: 60px;
    margin-bottom: 50px;
    flex-wrap: wrap;
}

.footer-logo {
    flex-shrink: 0;
}

.footer-logo-mark {
    display: flex;
    align-items: center;
}

.logo-square {
    width: 48px;
    height: 48px;
    background: var(--text-primary, #ffffff);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo-square-inner {
    width: 32px;
    height: 32px;
    background: var(--bg-primary, #000000);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.logo-dot {
    width: 6px;
    height: 6px;
    background: var(--text-primary, #ffffff);
    border-radius: 50%;
    display: block;
}

.footer-links {
    display: flex;
    gap: 60px;
    flex: 1;
    flex-wrap: wrap;
}

.footer-column {
    min-width: 140px;
}

.footer-column-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-link-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-link-list li {
    margin-bottom: 12px;
}

.footer-link-list a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
    display: inline-block;
}

.footer-link-list a:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 20px;
}

.footer-copyright {
    flex: 1;
    min-width: 200px;
}

.footer-copyright p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.footer-social {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
}

.social-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease, transform 0.2s ease;
    border-radius: 4px;
    text-decoration: none;
}

.social-icon:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
    text-decoration: none;
}

.social-icon .iconfont {
    font-size: 20px;
    line-height: 1;
}

.footer-back-to-top {
    flex-shrink: 0;
}

.back-to-top-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s ease;
}

.back-to-top-link:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.back-to-top-link .iconfont {
    font-size: 16px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.back-to-top-link:hover .iconfont {
    transform: translateY(-2px);
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .footer-content {
        gap: 40px;
    }

    .footer-links {
        gap: 40px;
    }
}

@media (max-width: 768px) {
    .enterprise-footer {
        padding: 40px 0 20px;
    }

    .footer-content {
        flex-direction: column;
        gap: 40px;
    }

    .footer-links {
        width: 100%;
        gap: 30px;
    }

    .footer-column {
        min-width: auto;
        flex: 1;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .footer-social {
        width: 100%;
        justify-content: flex-start;
    }

    .footer-back-to-top {
        width: 100%;
    }

    .back-to-top-link {
        justify-content: flex-start;
    }
}

@media (max-width: 1024px) {
    .hero-nav {
        flex-direction: column;
        gap: 18px;
        align-items: flex-start;
    }

    .nav-links {
        flex-wrap: wrap;
    }

    .hero-grid {
        gap: 32px;
    }

    .ai-flow-container {
        grid-template-columns: minmax(280px, 380px) 1fr;
        gap: 32px;
    }

    .chat-bubble {
        max-width: 90%;
    }
}

@media (max-width: 768px) {
    .hero-copy h1 {
        font-size: 38px;
    }

    .hero-stats {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .compare-table .table-header,
    .compare-table .table-row {
        grid-template-columns: 1fr;
    }

    .cta-inline {
        flex-direction: column;
        text-align: center;
    }

    .ai-flow-container {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .ai-flow-sidebar {
        order: 2;
        height: auto;
    }

    .ai-flow-demo {
        order: 1;
        height: auto;
    }

    .demo-window {
        min-height: 300px;
        height: auto;
    }

    .demo-window-content {
        min-height: 250px;
        padding: 16px;
    }

    .ai-demo {
        min-height: 250px;
        padding: 16px;
    }

    .ai-feature-item {
        padding: 16px;
        flex-wrap: wrap;
    }

    .feature-number {
        font-size: 28px;
        min-width: 36px;
        flex-shrink: 0;
    }

    .feature-content {
        flex: 1 1 auto;
        min-width: 200px;
    }

    .feature-content h3 {
        font-size: 16px;
    }

    .feature-content p {
        font-size: 12px;
    }

    .ai-demo-code,
    .ai-demo-edit,
    .ai-demo-terminal {
        font-size: 12px;
    }

    .chat-bubble {
        font-size: 12px;
        padding: 8px 12px;
        max-width: 90%;
    }
}

@keyframes drift {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(40px, -20px, 0);
    }
}

@keyframes float {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(-40px);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.2;
        transform: scale(0.95);
    }
    50% {
        opacity: 0.45;
        transform: scale(1.05);
    }
    100% {
        opacity: 0.2;
        transform: scale(0.95);
    }
}

@media (prefers-reduced-motion: reduce) {
    .aurora,
    .particle-field::before,
    .particle-field::after,
    .pulse-ring,
    .btn.primary,
    .cosmic-background {
        animation: none;
    }

    .hero-nav,
    .hero-copy > *,
    .hero-visual,
    .logo {
        opacity: 1;
        transform: none;
    }

    .hero.animate .hero-nav,
    .hero.animate .logo,
    .hero.animate .floating-badge,
    .hero.animate .hero-copy h1,
    .hero.animate .hero-copy p,
    .hero.animate .hero-actions .btn,
    .hero.animate .hero-stats div,
    .hero.animate .hero-visual {
        animation: none;
        opacity: 1;
        transform: none;
    }
}
