/* Modern CSS Reset & Variables */
:root {
    /* 主色调系统 */
    --primary-50: #f0f4ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    /* 兼容性变量 */
    --primary-color: var(--primary-500);
    --primary-dark: var(--primary-600);
    --secondary-color: #f59e0b;
    --accent-color: #06b6d4;

    /* 文本颜色 */
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* 背景颜色 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --border-color: #e2e8f0;

    /* 渐变系统 */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);

    /* 玻璃拟态系统 */
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-bg-light: rgba(255, 255, 255, 0.12);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --glass-backdrop: blur(12px);

    /* 阴影系统 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.1);

    /* 圆角系统 */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;

    /* 动画系统 */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --text-muted: #64748b;
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --border-color: #334155;
    }
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Enhanced Navigation with Glassmorphism */
.navbar {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    border-bottom: 1px solid var(--glass-border);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: all var(--transition-normal);
    box-shadow: var(--glass-shadow);
}

@media (prefers-color-scheme: dark) {
    .navbar {
        background: rgba(15, 23, 42, 0.08);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.nav-logo h2 {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    font-size: 1.75rem;
    letter-spacing: -0.025em;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    transition: all 0.3s ease;
}

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

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* 移动端导航系统 */
.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    transition: all var(--transition-normal);
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all var(--transition-normal);
    transform-origin: center;
}

.mobile-nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.mobile-nav-overlay.active {
    opacity: 1;
}

/* Main Content */
main {
    padding-top: 80px;
}

/* Hero Section - Modern & Bold */
.hero {
    min-height: 65vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    position: relative;
    overflow: hidden;
}

/* Removed overlay that was causing readability issues */

.hero-content {
    text-align: center;
    color: white;
    position: relative;
    z-index: 2;
    max-width: 800px;
    padding: 0 2rem;
}

.hero-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out;
}

.hero-content h1 {
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
    animation: fadeInUp 0.8s ease-out 0.2s both;
    text-align: center;
}

.hero-content .highlight {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.hero-content p {
    font-size: 1.25rem;
    margin-bottom: 3rem;
    opacity: 0.9;
    font-weight: 400;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--glass-bg-light);
    color: var(--primary-600);
    padding: 1rem 2rem;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all var(--transition-normal);
    backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--glass-border);
    animation: fadeInUp 0.8s ease-out 0.6s both;
    position: relative;
    overflow: hidden;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1));
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 1;
}

.cta-button:hover::before {
    opacity: 1;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    background: var(--glass-bg-light);
    border-color: var(--primary-300);
}

.cta-button > * {
    position: relative;
    z-index: 2;
}

.arrow-icon {
    transition: transform 0.3s ease;
}

.cta-button:hover .arrow-icon {
    transform: translate(4px, -4px);
}

/* Apps Section - Bento Grid Layout */
.apps-section {
    padding: 8rem 0;
    background: var(--bg-secondary);
}

.apps-section h2 {
    text-align: center;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    margin-bottom: 4rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.app-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    border-radius: var(--radius-3xl);
    padding: 2.5rem;
    border: 1px solid var(--glass-border);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-glass);
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 1;
    pointer-events: none;
}

.app-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity var(--transition-slow);
    z-index: 1;
    pointer-events: none;
}

.app-card:hover::before {
    opacity: 1;
}

.app-card:hover::after {
    opacity: 1;
}

.app-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0,0,0,0.15), 0 0 0 1px var(--glass-border);
    border-color: var(--primary-400);
}

.app-card.placeholder {
    border: 2px dashed var(--border-color);
    text-align: center;
    opacity: 0.7;
}

.app-card > * {
    position: relative;
    z-index: 2;
}

.app-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.app-card:hover .app-icon {
    transform: scale(1.05);
}

/* Fortune Oracle特殊悬停效果 */
.fortune-oracle-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.fortune-oracle-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(99, 102, 241, 0.25), 0 0 0 1px rgba(99, 102, 241, 0.1);
    border-color: var(--primary-color);
}

.fortune-oracle-card::before {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

.fortune-oracle-card:hover::before {
    opacity: 0.08;
}

.fortune-oracle-card:hover .app-icon {
    transform: scale(1.1) rotate(2deg);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.2);
}

/* Caffeine Mode特殊悬停效果 */
.caffeine-mode-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.caffeine-mode-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(139, 69, 19, 0.25), 0 0 0 1px rgba(139, 69, 19, 0.1);
    border-color: #8B4513;
}

.caffeine-mode-card::before {
    background: linear-gradient(135deg, #8B4513 0%, #D2691E 50%, #CD853F 100%);
}

.caffeine-mode-card:hover::before {
    opacity: 0.08;
}

.caffeine-mode-card:hover .app-icon {
    transform: scale(1.1) rotate(-2deg);
    box-shadow: 0 10px 25px rgba(139, 69, 19, 0.2);
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder-icon {
    font-size: 2.5rem;
    color: var(--text-muted);
    font-weight: 300;
}

.app-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-align: center;
}

.app-info p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    text-align: center;
    line-height: 1.7;
    font-size: 1.05rem;
}

.app-links {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.app-links a {
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: var(--radius-xl);
    font-size: 0.95rem;
    font-weight: 600;
    transition: all var(--transition-normal);
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
    backdrop-filter: var(--glass-backdrop);
}

.app-store-link {
    background: var(--primary-500);
    color: white;
    border: 1px solid var(--primary-600);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.app-store-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1));
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.app-store-link:hover::before {
    opacity: 1;
}

.app-store-link:hover {
    background: var(--primary-600);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.policy-link, .support-link, .agreement-link, .terms-link {
    background: var(--glass-bg);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-backdrop);
}

.policy-link:hover, .support-link:hover, .agreement-link:hover, .terms-link:hover {
    background: var(--glass-bg-light);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--glass-shadow);
    border-color: var(--primary-300);
}

/* About Section */
.about-section {
    padding: 8rem 0;
    background: var(--bg-primary);
}

.about-section h2 {
    text-align: center;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    margin-bottom: 3rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.about-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.about-content p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

/* Footer */
footer {
    background: var(--text-primary);
    color: var(--bg-primary);
    padding: 3rem 0;
    text-align: center;
}

.footer-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-links {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--bg-primary);
}

footer p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

footer p a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

footer p a:hover {
    color: var(--primary-light);
    text-decoration: underline;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .nav-container {
        padding: 0 1.5rem;
    }
}

@media (max-width: 768px) {
    /* 移动端导航显示 */
    .mobile-nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: var(--glass-bg);
        backdrop-filter: var(--glass-backdrop);
        border-left: 1px solid var(--glass-border);
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        padding: 6rem 2rem 2rem;
        gap: 0;
        transition: right var(--transition-slow);
        z-index: 1000;
        box-shadow: var(--glass-shadow);
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-item {
        margin: 0;
        border-bottom: 1px solid var(--glass-border);
    }

    .nav-link {
        display: block;
        padding: 1.5rem 0;
        font-size: 1.1rem;
        font-weight: 600;
        text-align: left;
        border-bottom: none;
    }

    .nav-link::after {
        display: none;
    }

    .hero {
        min-height: 80vh;
        padding: 4rem 0;
    }

    .hero-content {
        padding: 0 1rem;
    }

    .apps-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .app-card {
        padding: 2rem;
    }

    .apps-section,
    .about-section {
        padding: 5rem 0;
    }

    .footer-links {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .nav-container {
        padding: 0 1rem;
    }
    
    .hero {
        padding: 3rem 0;
    }
    
    .app-card {
        padding: 1.5rem;
    }
    
    .app-links {
        flex-direction: column;
        align-items: center;
    }
    
    .app-links a {
        width: 200px;
        text-align: center;
    }
    
    .cta-button {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* 可访问性和焦点样式 */
*:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #333333;
        --bg-primary: #ffffff;
        --border-color: #000000;
        --glass-bg: rgba(255, 255, 255, 0.9);
        --glass-border: rgba(0, 0, 0, 0.3);
    }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 键盘导航增强 */
.nav-link:focus,
.app-links a:focus,
.cta-button:focus,
.mobile-nav-toggle:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    background: var(--glass-bg-light);
}

/* 跳转到主内容链接 */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-500);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: 1002;
    transition: top var(--transition-normal);
}

.skip-to-content:focus {
    top: 6px;
}

/* 低性能设备优化 */
.low-performance * {
    animation: none !important;
    transition: none !important;
    transform: none !important;
}

.low-performance .app-card:hover {
    transform: none !important;
    box-shadow: var(--shadow-md) !important;
}

.low-performance .glass-bg,
.low-performance .glass-bg-light {
    background: var(--bg-primary) !important;
    backdrop-filter: none !important;
    border: 1px solid var(--border-color) !important;
}

/* 打印样式 */
@media print {
    .navbar,
    .mobile-nav-toggle,
    .mobile-nav-overlay,
    .skip-to-content {
        display: none !important;
    }

    .app-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    body {
        background: white !important;
        color: black !important;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .app-icon img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 横屏模式优化 */
@media (orientation: landscape) and (max-height: 500px) {
    .hero {
        min-height: 100vh;
        padding: 2rem 0;
    }

    .hero-content h1 {
        font-size: clamp(2rem, 6vw, 4rem);
    }
}

/* 超大屏幕优化 */
@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }

    .apps-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Smooth scrolling for Safari */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    html {
        scroll-behavior: smooth;
    }
}

/* 确保所有交互元素都有足够的点击区域 */
@media (pointer: coarse) {
    .nav-link,
    .app-links a,
    .cta-button,
    .mobile-nav-toggle {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}