/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 注意：颜色和字体变量从 style.css 继承，这里只定义 aigc 特有的变量 */
:root {
    /* 间距 */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(180deg, var(--background-primary) 0%, var(--background-secondary) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    /* 防止初始渲染闪屏 */
    opacity: 0;
    animation: fadeInBody 0.3s ease forwards;
}

@keyframes fadeInBody {
    to {
        opacity: 1;
    }
}

/* 减少动画偏好支持 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 背景光效 - 使用 style.css 中的颜色 */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 122, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 122, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(0, 122, 255, 0.05) 0%, transparent 60%);
    animation: backgroundGlow 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    will-change: transform, opacity;
    /* 延迟显示，避免初始闪屏 */
    animation-delay: 0.3s;
    animation-fill-mode: forwards;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 10% 20%, rgba(0, 122, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 122, 255, 0.06) 0%, transparent 40%);
    animation: backgroundGlow 15s ease-in-out infinite reverse;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    will-change: transform, opacity;
    /* 延迟显示，避免初始闪屏 */
    animation-delay: 0.4s;
    animation-fill-mode: forwards;
}

/* 光晕效果 - 深紫色和亮蓝色圆形光晕 */
body {
    position: relative;
}
/* 输入框后方的光晕 */
.input-section {
    position: relative;
}

.input-section::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(0);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 122, 255, 0.2) 0%, transparent 60%);
    filter: blur(160px);
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    will-change: transform, opacity;
    animation: inputGlow 6s ease-in-out infinite;
    animation-delay: 0.7s;
    animation-fill-mode: forwards;
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.6;
        transform: translateZ(0) scale(1);
    }
    50% {
        opacity: 0.9;
        transform: translateZ(0) scale(1.1);
    }
}

@keyframes inputGlow {
    0%, 100% {
        opacity: 0.4;
        transform: translate3d(-50%, -50%, 0) scale(1);
    }
    50% {
        opacity: 0.7;
        transform: translate3d(-50%, -50%, 0) scale(1.15);
    }
}

@keyframes backgroundGlow {
    0%, 100% {
        transform: translate3d(0, 0, 0) scale(1);
        opacity: 0.6;
    }
    33% {
        transform: translate3d(5%, 5%, 0) scale(1.1);
        opacity: 0.8;
    }
    66% {
        transform: translate3d(-5%, -5%, 0) scale(0.9);
        opacity: 0.5;
    }
}

/* 确保内容在光效之上 */
.container,
.navbar,
.main-container {
    position: relative;
    z-index: 1;
}

.main-container {
    position: relative;
    z-index: 1;
    overflow: hidden;
    min-height: 80vh;
    justify-content: center;
    align-items: center;
    display: flex;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* 导航栏 */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    box-shadow: 
        0 1px 0 rgba(255, 255, 255, 0.05) inset,
        0 4px 20px rgba(0, 0, 0, 0.3);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.logo-link {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.logo-link:hover {
    opacity: 0.8;
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 400;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--text-primary);
}

/* 主容器 */
.main-container {
    margin-top: 60px;
    padding: var(--spacing-xl) 0;
}

/* 标题区域 */
.header-section {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.page-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    background: linear-gradient(135deg, 
        #007AFF 0%, 
        #00BFFF 25%, 
        #5856D6 50%, 
        #8A2BE2 75%, 
        #007AFF 100%
    );
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 30px rgba(0, 122, 255, 0.3));
    animation: gradientShift 5s ease infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.page-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* 输入区域 */
.input-section {
    margin-bottom: var(--spacing-xl);
    position: relative;
    z-index: 1;
}

.input-card {
    /* 玻璃拟态效果 */
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 0 60px rgba(0, 122, 255, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
    /* 优化渲染性能 */
    transform: translateZ(0);
    will-change: box-shadow, border-color;
}

.input-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent
    );
    opacity: 0.6;
}

/* 输入框获得焦点时，卡片也发光 */
.input-card:has(.text-input:focus) {
    border-color: rgba(0, 122, 255, 0.5);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 0 80px rgba(0, 122, 255, 0.15),
        0 0 40px rgba(0, 122, 255, 0.1);
    animation: cardGlow 2s ease-in-out infinite;
}

@keyframes cardGlow {
    0%, 100% {
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.1) inset,
            0 0 80px rgba(0, 122, 255, 0.15),
            0 0 40px rgba(0, 122, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 8px 32px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.15) inset,
            0 0 100px rgba(0, 122, 255, 0.25),
            0 0 60px rgba(0, 122, 255, 0.15);
    }
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.input-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.char-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.text-input {
    width: 100%;
    /* 玻璃拟态效果 */
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: var(--spacing-md);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    position: relative;
    z-index: 1;
    /* 优化渲染性能 */
    transform: translateZ(0);
    will-change: box-shadow, border-color, transform;
}

.text-input:focus {
    outline: none;
    border-color: rgba(0, 122, 255, 0.6);
    background: rgba(255, 255, 255, 0.08);
    /* 呼吸发光边框效果 */
    box-shadow: 
        0 0 0 2px rgba(0, 122, 255, 0.3),
        0 0 30px rgba(0, 122, 255, 0.4),
        0 0 60px rgba(0, 122, 255, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    transform: translate3d(0, -1px, 0);
    animation: inputBreath 2s ease-in-out infinite;
}

@keyframes inputBreath {
    0%, 100% {
        box-shadow: 
            0 0 0 2px rgba(0, 122, 255, 0.3),
            0 0 30px rgba(0, 122, 255, 0.4),
            0 0 60px rgba(0, 122, 255, 0.2),
            0 2px 8px rgba(0, 0, 0, 0.2),
            0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    }
    50% {
        box-shadow: 
            0 0 0 3px rgba(0, 122, 255, 0.4),
            0 0 40px rgba(0, 122, 255, 0.5),
            0 0 80px rgba(0, 122, 255, 0.3),
            0 2px 8px rgba(0, 0, 0, 0.2),
            0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    }
}

.text-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* 美化滚动条 - Webkit浏览器 (Chrome, Safari, Edge) */
.text-input::-webkit-scrollbar {
    width: 10px;
}

.text-input::-webkit-scrollbar-track {
    background: rgba(44, 44, 46, 0.3);
    border-radius: 10px;
    margin: 4px 0;
}

.text-input::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
    border: 2px solid rgba(44, 44, 46, 0.3);
    transition: all 0.3s ease;
    opacity: 0.6;
}

.text-input::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
    opacity: 0.8;
    border: 2px solid rgba(44, 44, 46, 0.5);
    box-shadow: 0 0 10px rgba(0, 122, 255, 0.2);
}

.text-input::-webkit-scrollbar-thumb:active {
    background: var(--primary-color);
    opacity: 1;
}

/* Firefox 滚动条美化 */
.text-input {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) rgba(44, 44, 46, 0.3);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
}

.detect-btn {
    background: var(--primary-color);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    min-width: 140px;
    justify-content: center;
    box-shadow: 
        0 4px 12px rgba(0, 122, 255, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    position: relative;
    overflow: hidden;
}

.detect-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.2), 
        transparent
    );
    transition: left 0.5s ease;
}

.detect-btn:hover:not(:disabled) {
    background: #0056CC;
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(0, 122, 255, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}

.detect-btn:hover:not(:disabled)::before {
    left: 100%;
}

.detect-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(0, 122, 255, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.detect-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--background-input);
    box-shadow: none;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 结果显示区域 */
.result-display {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex: 1;
    opacity: 0;
    transition: opacity 0.3s ease;
    will-change: opacity;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.result-badge.ai {
    background: rgba(255, 59, 48, 0.2);
    color: var(--error-color);
    border: 1px solid rgba(255, 59, 48, 0.3);
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.2);
}

.result-badge.ai:hover {
    background: rgba(255, 59, 48, 0.3);
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.3);
    transform: scale(1.05);
}

.result-badge.human {
    background: rgba(52, 199, 89, 0.2);
    color: var(--success-color);
    border: 1px solid rgba(52, 199, 89, 0.3);
    box-shadow: 0 0 15px rgba(52, 199, 89, 0.2);
}

.result-badge.human:hover {
    background: rgba(52, 199, 89, 0.3);
    box-shadow: 0 0 20px rgba(52, 199, 89, 0.3);
    transform: scale(1.05);
}

.badge-icon {
    font-size: 1rem;
}

.badge-text {
    font-size: 0.9375rem;
}

.result-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.probability-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9375rem;
}

.perplexity-value {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 页脚 */
.footer {
    background: var(--background-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-lg) 0;
    text-align: center;
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    /* 移动端性能优化 - 减少背景动画 */
    body::before,
    body::after {
        opacity: 0.3 !important;
        animation-duration: 30s !important;
    }
    
    .input-section::before {
        opacity: 0.3 !important;
        animation-duration: 8s !important;
        filter: blur(120px) !important;
    }
    
    /* 移动端减少backdrop-filter效果 */
    .input-card {
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }
    
    .text-input {
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }
    
    /* 移动端导航栏优化 */
    .navbar {
        padding: 0;
    }
    
    .nav-container {
        padding: 0 var(--spacing-sm);
    }
    
    .logo-link {
        font-size: 1.25rem;
    }
    
    /* 移动端主容器优化 */
    .main-container {
        margin-top: 60px;
        padding: var(--spacing-md) 0;
    }
    
    .container {
        padding: 0 var(--spacing-sm);
        max-width: 100%;
    }
    
    /* 移动端标题区域 */
    .header-section {
        margin-bottom: var(--spacing-lg);
        padding: 0 var(--spacing-sm);
    }
    
    .page-title {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: var(--spacing-xs);
    }
    
    .page-subtitle {
        font-size: 0.9375rem;
        line-height: 1.5;
        padding: 0 var(--spacing-xs);
    }
    
    /* 移动端输入区域 */
    .input-section {
        margin-bottom: var(--spacing-lg);
    }
    
    .input-card {
        padding: var(--spacing-md);
        border-radius: var(--radius-md);
        margin: 0 var(--spacing-xs);
    }
    
    .input-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
        margin-bottom: var(--spacing-sm);
    }
    
    .input-title {
        font-size: 1.125rem;
    }
    
    .char-count {
        font-size: 0.8125rem;
        align-self: flex-end;
    }
    
    /* 移动端文本输入框 */
    .text-input {
        font-size: 0.9375rem;
        padding: var(--spacing-sm);
        min-height: 150px;
        line-height: 1.5;
        border-radius: var(--radius-sm);
    }
    
    .text-input:focus {
        transform: translateZ(0);
        /* 移动端减少动画效果 */
        animation: none;
    }
    
    /* 移动端输入底部区域 */
    .input-footer {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-sm);
    }
    
    /* 移动端结果显示 */
    .result-display {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
        width: 100%;
        padding: var(--spacing-sm);
        background: rgba(255, 255, 255, 0.03);
        border-radius: var(--radius-sm);
    }
    
    .result-badge {
        font-size: 0.875rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    .result-info {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-xs);
        font-size: 0.8125rem;
        width: 100%;
    }
    
    .probability-value {
        font-size: 0.875rem;
    }
    
    .perplexity-value {
        font-size: 0.8125rem;
    }
    
    /* 移动端按钮 */
    .detect-btn {
        width: 100%;
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.9375rem;
        min-width: auto;
    }
    
    /* 移动端页脚 */
    .footer {
        padding: var(--spacing-md) 0;
    }
    
    .footer p {
        font-size: 0.8125rem;
        padding: 0 var(--spacing-sm);
    }
}

/* 小屏幕优化 */
@media (max-width: 480px) {
    /* 小屏幕进一步减少动画效果 */
    body::before,
    body::after {
        display: none;
    }
    
    .input-section::before {
        display: none;
    }
    
    /* 小屏幕导航栏 */
    .nav-container {
        padding: 0 var(--spacing-xs);
    }
    
    .logo-link {
        font-size: 1.125rem;
    }
    
    .main-container {
        padding: var(--spacing-sm) 0;
    }
    
    .header-section {
        margin-bottom: var(--spacing-md);
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .page-subtitle {
        font-size: 0.875rem;
    }
    
    .input-card {
        padding: var(--spacing-sm);
        margin: 0;
        border-radius: var(--radius-sm);
    }
    
    .input-title {
        font-size: 1rem;
    }
    
    .char-count {
        font-size: 0.75rem;
    }
    
    .text-input {
        font-size: 0.875rem;
        padding: var(--spacing-xs) var(--spacing-sm);
        min-height: 120px;
    }
    
    .detect-btn {
        font-size: 0.875rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    .result-badge {
        font-size: 0.8125rem;
    }
    
    .result-info {
        font-size: 0.75rem;
    }
    
    .probability-value {
        font-size: 0.8125rem;
    }
    
    .perplexity-value {
        font-size: 0.75rem;
    }
    
    .footer {
        padding: var(--spacing-sm) 0;
    }
    
    .footer p {
        font-size: 0.75rem;
    }
}

/* 横屏优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .main-container {
        padding: var(--spacing-sm) 0;
    }
    
    .header-section {
        margin-bottom: var(--spacing-md);
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .text-input {
        min-height: 100px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .detect-btn {
        min-height: 44px; /* iOS 推荐的最小触摸目标 */
    }
    
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .text-input {
        font-size: 16px; /* 防止 iOS 自动缩放 */
    }
}

/* 移动端设备类优化 */
body.mobile-device {
    /* 确保平滑渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.mobile-device .input-card,
body.mobile-device .text-input {
    /* 移动端减少backdrop-filter */
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

