/* CSS Variables - Design System */

:root {
    --primary: 229 100% 62%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96%;
    --secondary-foreground: 222.2 84% 4.9%;
    --muted: 210 40% 96%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96%;
    --accent-foreground: 222.2 84% 4.9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 229 100% 62%;
    --radius: 0.5rem;
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    
    /* Custom gradients */
    --gradient-primary: linear-gradient(135deg, hsl(var(--primary)), hsl(229 100% 70%));
    --gradient-hero: linear-gradient(180deg, 
        hsl(var(--background)) 0%, 
        hsl(var(--primary) / 0.05) 50%, 
        hsl(var(--background)) 100%);
    --shadow-glow: 0 0 40px hsl(var(--primary) / 0.3);
    --shadow-card: 0 4px 6px -1px hsl(0 0% 0% / 0.1), 0 2px 4px -1px hsl(0 0% 0% / 0.06);
}

[data-theme="dark"] {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;
    --primary: 229 100% 62%;
    --primary-foreground: 222.2 84% 4.9%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 229 100% 62%;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    line-height: 1.5;
}

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

/* Utility Classes */
.gradient-primary {
    background: var(--gradient-primary);
}

.gradient-hero {
    background: var(--gradient-hero);
}

.shadow-glow {
    box-shadow: var(--shadow-glow);
}

.shadow-card {
    box-shadow: var(--shadow-card);
}

.backdrop-blur-sm {
    backdrop-filter: blur(4px);
}

.bg-clip-text {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.text-transparent {
    color: transparent;
}

/* Animations */
@keyframes fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

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

.animate-fade-in-up {
    animation: fade-in-up 1s ease-out;
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

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

/* Hero Section */
.hero-section {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-image: url('hero-bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.3;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: var(--gradient-hero);
}

.hero-content {
    position: relative;
    z-index: 10;
}

/* Initial State */
.hero-initial {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-center {
    text-align: center;
    animation: fade-in-up 1s ease-out;
}

/* Badge */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: hsl(var(--primary) / 0.1);
    border: 1px solid hsl(var(--primary) / 0.2);
    border-radius: 9999px;
    padding: 0.5rem 1rem;
    margin-bottom: 2rem;
}

.hero-badge-icon {
    width: 1rem;
    height: 1rem;
    color: hsl(var(--primary));
}

.hero-badge-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--primary));
}

/* Main Heading */
.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

@media (min-width: 768px) {
    .hero-title {
        font-size: 4.5rem;
    }
}

.hero-title-gradient {
    background: var(--gradient-primary);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

/* Tagline Block */
.hero-tagline {
    display: inline-block;
    background: linear-gradient(135deg, hsl(var(--primary) / 0.2), hsl(280 100% 70% / 0.2));
    backdrop-filter: blur(4px);
    border: 1px solid hsl(var(--primary) / 0.3);
    border-radius: 1rem;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
}

.hero-tagline-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: hsl(var(--primary) / 0.9);
}

@media (min-width: 768px) {
    .hero-tagline-text {
        font-size: 1.875rem;
    }
}

/* Search Section */
.search-section {
    max-width: 512px;
    margin: 0 auto 2rem;
}

.search-container {
    position: relative;
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem;
    background-color: hsl(var(--background) / 0.8);
    backdrop-filter: blur(4px);
    border-radius: 1rem;
    border: 1px solid hsl(var(--border));
    box-shadow: var(--shadow-card);
}

.search-input-wrapper {
    flex: 1;
    position: relative;
}

.search-input {
    width: 100%;
    height: 3.5rem;
    padding: 0 3rem 0 1rem;
    border: none;
    background: transparent;
    font-size: 1.125rem;
    outline: none;
    color: hsl(var(--foreground));
}

.search-input::placeholder {
    color: hsl(var(--muted-foreground) / 0.6);
}

.clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 0.25rem;
    display: none;
}

.clear-btn:hover {
    background-color: hsl(var(--muted) / 0.5);
}

.clear-btn-icon {
    width: 1rem;
    height: 1rem;
    color: hsl(var(--muted-foreground));
}

.search-btn, .reset-btn {
    height: 3.5rem;
    padding: 0 2rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.search-btn {
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    box-shadow: var(--shadow-glow);
}

.search-btn:hover {
    box-shadow: var(--shadow-card);
}

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

.reset-btn {
    background: transparent;
    color: hsl(var(--foreground));
    border: 1px solid hsl(var(--primary) / 0.3);
}

.reset-btn:hover {
    background-color: hsl(var(--primary) / 0.05);
}

.btn-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Description */
.hero-description {
    font-size: 1.25rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 3rem;
    max-width: 768px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

@media (min-width: 768px) {
    .hero-description {
        font-size: 1.5rem;
    }
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 1024px;
    margin: 0 auto 3rem;
}

@media (min-width: 768px) {
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.feature-card {
    background-color: hsl(var(--background) / 0.5);
    backdrop-filter: blur(4px);
    border: 1px solid hsl(var(--border) / 0.5);
    border-radius: 1rem;
    padding: 1.5rem;
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: hsl(var(--primary) / 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.feature-icon svg {
    width: 1.5rem;
    height: 1.5rem;
    color: hsl(var(--primary));
}

.feature-title {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.feature-description {
    color: hsl(var(--muted-foreground));
}

/* Research State */
.research-state {
    padding: 2rem 0;
}

.research-header {
    text-align: center;
    margin-bottom: 2rem;
}

.research-title {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .research-title {
        font-size: 2.25rem;
    }
}

.compact-search {
    max-width: 512px;
    margin: 0 auto;
}

.compact-search .search-input {
    height: 3rem;
    font-size: 1rem;
}

.compact-search .search-btn,
.compact-search .reset-btn {
    height: 3rem;
    padding: 0 1.5rem;
}

.compact-search .reset-btn {
    padding: 0 1rem;
}

.compact-search .btn-icon {
    width: 1rem;
    height: 1rem;
}

/* Results Area */
.results-area {
    max-width: 1536px;
    margin: 0 auto;
}

.results-container {
    background-color: hsl(var(--background) / 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid hsl(var(--border));
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-card);
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 3rem 0;
}

.loading-spinner {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    border: 4px solid hsl(var(--primary) / 0.2);
    border-top: 4px solid hsl(var(--primary));
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.loading-description {
    color: hsl(var(--muted-foreground));
}

/* Results Display */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.results-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: hsl(var(--primary));
}

.export-btn {
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-glow);
    transition: all 0.3s ease;
}

.export-btn:hover {
    box-shadow: var(--shadow-card);
}

.results-content {
    background-color: hsl(var(--muted) / 0.3);
    border-radius: 0.75rem;
    padding: 1.5rem;
    height: calc(100vh - 250px); /* 占满屏幕，预留头部和按钮空间 */
    overflow-y: auto;
}

.results-text {
    white-space: pre-wrap;
    font-size: 0.875rem;
    line-height: 1.6;
    font-family: 'Courier New', monospace;
}

/* Features Section */
.features-section {
    padding: 6rem 0;
    background-color: hsl(var(--secondary) / 0.3);
}

.features-title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

@media (min-width: 768px) {
    .features-title {
        font-size: 3rem;
    }
}

.features-subtitle {
    font-size: 1.25rem;
    color: hsl(var(--muted-foreground));
    max-width: 768px;
    margin: 0 auto 4rem;
    text-align: center;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.feature-card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    cursor: pointer;
}

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

.feature-icon-wrapper {
    width: 4rem;
    height: 4rem;
    border-radius: 1rem;
    padding: 2px;
    margin-bottom: 1.5rem;
    position: relative;
}

.feature-icon-inner {
    width: 100%;
    height: 100%;
    background-color: hsl(var(--background));
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-icon {
    width: 2rem;
    height: 2rem;
    color: hsl(var(--primary));
    transition: transform 0.3s ease;
}

.feature-card:hover .feature-icon {
    transform: scale(1.1);
}

.feature-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.feature-card:hover .feature-card-title {
    color: hsl(var(--primary));
}

.feature-card-description {
    color: hsl(var(--muted-foreground));
    line-height: 1.6;
}

/* CTA Section */
.cta-section {
    padding: 6rem 0;
    background-color: hsl(var(--background));
}

.cta-container {
    position: relative;
    overflow: hidden;
    border-radius: 1.5rem;
    background: var(--gradient-primary);
    padding: 3rem;
    text-align: center;
    color: white;
}

@media (min-width: 768px) {
    .cta-container {
        padding: 5rem;
    }
}

.cta-bg-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.2;
}

.cta-bg-circle-1 {
    position: absolute;
    top: 0;
    left: 25%;
    width: 18rem;
    height: 18rem;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    filter: blur(3rem);
}

.cta-bg-circle-2 {
    position: absolute;
    bottom: 0;
    right: 25%;
    width: 24rem;
    height: 24rem;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    filter: blur(3rem);
}

.cta-content {
    position: relative;
    z-index: 10;
}

.cta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    padding: 0.75rem 1.5rem;
    margin-bottom: 2rem;
    font-weight: 500;
}

.cta-title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

@media (min-width: 768px) {
    .cta-title {
        font-size: 3.75rem;
    }
}

.cta-subtitle {
    font-size: 1.25rem;
    margin-bottom: 3rem;
    max-width: 768px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.9;
    line-height: 1.6;
}

@media (min-width: 768px) {
    .cta-subtitle {
        font-size: 1.5rem;
    }
}

.cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 3rem;
}

@media (min-width: 640px) {
    .cta-buttons {
        flex-direction: row;
    }
}

.cta-btn-primary {
    background-color: white;
    color: hsl(var(--primary));
    border: none;
    border-radius: 0.5rem;
    padding: 1rem 2rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.cta-btn-primary:hover {
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4);
}

.cta-btn-secondary {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    padding: 1rem 2rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

.cta-btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.cta-features {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    font-size: 0.875rem;
    opacity: 0.8;
    flex-wrap: wrap;
}

.cta-feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cta-feature-dot {
    width: 0.5rem;
    height: 0.5rem;
    background-color: #4ade80;
    border-radius: 50%;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Responsive utilities */
@media (max-width: 767px) {
    .search-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .search-btn, .reset-btn {
        height: 3rem;
    }
    
    .results-header {
        flex-direction: column;
        gap: 1rem;
    }
}


/* markdown */
.markdown-body h1 { font-size: 1.6rem; font-weight: 700; color: var(--accent); margin: 1em 0 0.5em; }
.markdown-body h2 { font-size: 1.3rem; font-weight: 600; color: var(--primary); margin: 0.9em 0 0.4em; }
.markdown-body h3 { font-size: 1.05rem; font-weight: 600; color: var(--primary); margin: 0.7em 0 0.3em; }
.markdown-body p  { margin: 0.6em 0; line-height: 1.6; color: var(--text); }
.markdown-body table { border-collapse: collapse; margin: 1em 0; width:100%; color: var(--text); }
.markdown-body th, .markdown-body td { border:1px solid #e4e7eb; padding:8px 12px; }
.markdown-body pre { background:#f3f4f6; padding:12px; border-radius:6px; color:var(--text); overflow-x:auto; white-space:pre-wrap; word-break:break-word; }
.markdown-body code { font-family: ui-monospace, monospace; background:#eef2ff; padding:2px 6px; border-radius:6px; color:var(--text); }
.markdown-body img { max-width:100%; border-radius:8px; margin:1em 0; }

.mermaid { display:block; width:100% !important; max-width:100% !important; overflow-x:auto; overflow-y:visible; }
.mermaid svg { display:block; width:100% !important; height:auto !important; max-width:none !important; text-rendering:geometricPrecision; }
.chartjs-container canvas { max-width:100% !important; display:block; }

.container { padding:24px; max-width:1100px; margin:0 auto; }
.grid { display:grid; grid-template-columns: repeat(12,1fr); gap:16px; }
.control { grid-column: span 4 / span 4; }
.report-area { grid-column: span 8 / span 8; }

.flex { display:flex; gap:8px; }
.flex-1 { flex:1 1 auto; }
.no-grow { flex:none; }

.spinner {
    display:inline-block; vertical-align:middle; width:16px; height:16px; margin-left:8px;
    animation: spin 1s linear infinite; border: 2px solid rgba(255,255,255,0.2);
    border-top: 2px solid rgba(255,255,255,0.9); border-radius: 50%;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-disabled { opacity:0.6; pointer-events:none; }

@media (max-width:768px){ .control{ grid-column:span 12 / span 12 } .report-area{ grid-column:span 12 / span 12 } }

/* 语言切换：两项式，选中项高亮/加深 */
.lang-switch {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 60;
    font-size: 12px;
    line-height: 1;
}

.lang-btn.lang-opt {
background: transparent;
border: 1px solid rgba(255,255,255,0.06);
color: inherit;
cursor: pointer;
padding: 0.18rem 0.5rem;
border-radius: 6px;
font-size: 12px;
line-height: 1;
min-width: 28px;
text-align: center;
transition: all 0.12s ease;
opacity: 0.85;
}
.lang-btn.lang-opt:hover {
transform: translateY(-1px);
opacity: 1;
border-color: rgba(255,255,255,0.12);
}
/* 选中态：更深的背景、更明显文字 */
.lang-btn.lang-opt.active {
background: linear-gradient(90deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
box-shadow: 0 1px 3px rgba(0,0,0,0.15);
color: #120202;
font-weight: 600;
border-color: rgba(255,255,255,0.14);
opacity: 1;
}

/* 当页面处于英文语言时，把占位符字体缩小一点 */
.lang-en .search-input::placeholder,
.lang-en .search-input::-webkit-input-placeholder,
.lang-en .search-input:-ms-input-placeholder,
.lang-en #compactResearchInput::placeholder,
.lang-en #compactResearchInput::-webkit-input-placeholder,
.lang-en #compactResearchInput:-ms-input-placeholder {
font-size: 0.55rem; /* 英文占位符缩小为 85% */
letter-spacing: 0;  /* 如果需要可微调 */
}

.search-input::placeholder,
.search-input::-webkit-input-placeholder,
.search-input:-ms-input-placeholder,
#compactResearchInput::placeholder,
#compactResearchInput::-webkit-input-placeholder,
#compactResearchInput:-ms-input-placeholder {
font-size: 0.85rem;   /* 占位符字体大小：85%（可按需调整为 0.8rem / 0.9rem） */
line-height: 1.2;
opacity: 0.7;         /* 占位符透明度，避免看起来太粗重 */
/* 如果你想让占位符更紧凑，可以取消注释下一行微调字间距 */
/* letter-spacing: -0.02em; */
}

/* 当按钮被禁用时，禁止 pointer 事件，防止 JS 绑定仍触发 */
.btn-disabled { pointer-events: none; }


/* results/report 区 */
.results-area { padding: 1rem 0; }
.markdown-body { font-size: clamp(0.95rem, 1.2vw, 1.05rem); line-height: 1.6; }


.results-content {
  overflow-y: auto;          /* 保留滚动功能 */
  scrollbar-width: none;     /* Firefox */
  -ms-overflow-style: none;  /* IE/Edge */
}

.results-content::-webkit-scrollbar {
  display: none;             /* Chrome / Safari */
}