/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    /* 重要：确保在standalone模式下填满整个屏幕 */
    height: 100vh;
    overflow-x: hidden;
    /* 为iOS状态栏区域添加渐变背景 */
    position: relative;
}

/* iOS状态栏区域渐变背景 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 44px);
    background: linear-gradient(135deg, 
        rgba(102, 126, 234, 0.95) 0%, 
        rgba(118, 75, 162, 0.95) 50%,
        rgba(74, 144, 226, 0.95) 100%);
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* 在iOS设备上始终显示，便于测试 */
    display: none;
}

/* iOS设备检测 - 在iOS上显示状态栏背景 */
@supports (-webkit-touch-callout: none) {
    body::before {
        display: block;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* iOS上始终预留状态栏空间 */
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
    position: relative;
    z-index: 1;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
}

.header h1 {
    font-size: 2.5rem;
    color: white;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Section Styles */
section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 2px solid #e74c3c;
    padding-bottom: 10px;
}

/* Instructions */
.instructions ol {
    padding-left: 20px;
}

.instructions li {
    margin-bottom: 10px;
    font-size: 1.1rem;
    line-height: 1.8;
}

.share-icon {
    background: #007AFF;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Feature Grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.feature-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    color: white;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.feature-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.feature-card p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Status Info */
.status-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007AFF;
}

.label {
    font-weight: 600;
    color: #2c3e50;
}

.value {
    font-weight: 500;
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
    padding: 5px 10px;
    border-radius: 5px;
}

/* Demo Content */
.demo-content p {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 20px;
    color: #555;
}

.color-palette {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.color-box {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.color-box:hover {
    transform: scale(1.1);
}

/* Platform Info Styles */
.platform-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.platform-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid;
}

.platform-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.platform-card.ios {
    border-left-color: #007AFF;
}

.platform-card.desktop {
    border-left-color: #34C759;
}

.platform-card.chrome {
    border-left-color: #FF9500;
}

.platform-icon {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 15px;
}

.platform-card h3 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.platform-card ul {
    list-style: none;
    padding: 0;
}

.platform-card li {
    padding: 8px 0;
    font-size: 0.9rem;
    line-height: 1.4;
    border-bottom: 1px solid #f0f0f0;
}

.platform-card li:last-child {
    border-bottom: none;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.footer p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* PWA Specific Styles */
@media (display-mode: standalone) {
    body {
        /* 在standalone模式下，确保使用整个屏幕空间 */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .header h1::after {
        content: " (PWA模式)";
        font-size: 0.6em;
        background: rgba(39, 174, 96, 0.8);
        color: white;
        padding: 2px 8px;
        border-radius: 12px;
        margin-left: 10px;
    }
}

/* Desktop-specific styles */
.desktop-device .header h1::after {
    content: " (桌面端演示)";
    font-size: 0.5em;
    background: rgba(52, 152, 219, 0.8);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 10px;
}

.desktop-info-banner {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 15px;
    margin: 20px 0;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    animation: slideIn 0.5s ease-out;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.banner-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.banner-text {
    flex: 1;
}

.banner-text strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.banner-text p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9rem;
    line-height: 1.4;
}

.banner-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background 0.3s ease;
}

.banner-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

/* macOS specific adjustments */
.macos-device {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .status-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .color-palette {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    section {
        padding: 20px;
    }
    
    .feature-card {
        padding: 15px;
    }
}

/* 防止iOS Safari的橡皮筋效果 */
body {
    overscroll-behavior: none;
    touch-action: pan-x pan-y;
}

/* 隐藏滚动条但保持滚动功能 */
::-webkit-scrollbar {
    display: none;
}

html {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* iOS Safari 特定优化 */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    @media (display-mode: standalone) {
        body::before {
            background: linear-gradient(135deg, 
                rgba(102, 126, 234, 0.98) 0%, 
                rgba(118, 75, 162, 0.98) 30%,
                rgba(74, 144, 226, 0.98) 70%,
                rgba(64, 224, 208, 0.98) 100%);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        }
    }
}

/* 暗黑模式适配 */
@media (prefers-color-scheme: dark) {
    @media (display-mode: standalone) {
        body::before {
            background: linear-gradient(135deg, 
                rgba(45, 55, 72, 0.95) 0%, 
                rgba(74, 85, 104, 0.95) 50%,
                rgba(113, 128, 150, 0.95) 100%);
        }
    }
}
