/* CSS Custom Properties */
:root {
    /* Colors */
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --white: #ffffff;
    --black: #000000;
    --gray-light: #f0f0f0;
    
    /* Shadows */
    --shadow-sm: 0 5px 15px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-text: 2px 2px 4px rgba(0, 0, 0, 0.2);
    
    /* Spacing */
    --border-radius: 20px;
    --spacing-xs: 5px;
    --spacing-sm: 12px;
    --spacing-md: 15px;
    --spacing-lg: 20px;
    --spacing-xl: 30px;
    
    /* Transitions */
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;
    
    /* Z-index */
    --z-modal: 1000;
    --z-overlay: 10000;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础样式 */
html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* 背景设置 */
body {
    background-image: url('lsp.gif');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    will-change: background-position;
}

/* 移动端优化背景 */
@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }
}

/* 弹窗遮罩层 */
.modal {
    display: none;
    position: fixed;
    z-index: var(--z-modal);
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
    will-change: opacity;
}

.modal.show,
.modal[aria-hidden="false"] {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 弹窗内容 */
.modal-content {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    margin: 15% auto;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: slideUp 0.4s ease;
    text-align: center;
    will-change: transform;
}

/* 关闭按钮 */
.close-btn {
    position: absolute;
    right: var(--spacing-md);
    top: var(--spacing-md);
    font-size: 28px;
    font-weight: bold;
    color: var(--white);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: var(--transition);
    padding: var(--spacing-xs);
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.close-btn:hover,
.close-btn:active {
    opacity: 1;
    transform: scale(1.1);
}

.close-btn:focus-visible {
    outline: 2px solid var(--white);
    outline-offset: 2px;
    border-radius: 4px;
}

/* 弹窗主体内容 */
.modal-body {
    padding: var(--spacing-lg) 0;
}

/* 标题样式 */
.title-en {
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    color: var(--white);
    margin: 0 0 var(--spacing-xl) 0;
    font-weight: 700;
    text-shadow: var(--shadow-text);
    line-height: 1.4;
}

/* 领取按钮 */
.claim-btn {
    display: inline-block;
    position: relative;
    background: var(--white);
    color: var(--primary-color);
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    font-size: clamp(0.95rem, 3vw, 1.1rem);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    border: none;
    width: 100%;
    max-width: 280px;
    animation: bounce 1.5s ease-in-out infinite;
    will-change: transform;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.claim-btn:hover,
.claim-btn:focus-visible {
    animation-play-state: paused;
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-md);
    background: var(--gray-light);
    outline: none;
}

.claim-btn:active {
    transform: translateY(0) scale(0.98);
    animation-play-state: paused;
}

.claim-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn-text-en {
    display: block;
    font-weight: 700;
    transition: opacity 0.3s ease;
}

.claim-btn.loading .btn-text-en {
    opacity: 0;
}

.btn-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 3px solid rgba(102, 126, 234, 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.claim-btn.loading .btn-loader {
    display: block;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* 跳转加载覆盖层 */
.redirect-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    z-index: var(--z-overlay);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.redirect-overlay.show {
    display: flex;
    opacity: 1;
}

.redirect-content {
    text-align: center;
    color: var(--white);
}

.redirect-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: redirectSpin 1s linear infinite;
    margin: 0 auto 20px;
}

.redirect-text {
    font-size: 1.2rem;
    font-weight: 600;
    text-shadow: var(--shadow-text);
    animation: pulse 1.5s ease-in-out infinite;
    margin: 0;
}

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

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

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* 弹跳动画 */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(0);
    }
    75% {
        transform: translateY(-5px);
    }
}

/* 减少动画（尊重用户偏好） */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 响应式设计 */
@media (max-width: 480px) {
    .modal-content {
        width: 85%;
        padding: 25px var(--spacing-lg);
        margin: 20% auto;
    }
    
    .title-en {
        margin-bottom: 25px;
    }
    
    .claim-btn {
        padding: 14px 35px;
    }
    
    .close-btn {
        font-size: 24px;
        right: var(--spacing-sm);
        top: var(--spacing-sm);
    }
}

@media (max-width: 360px) {
    .modal-content {
        width: 90%;
        padding: var(--spacing-lg) var(--spacing-md);
    }
    
    .claim-btn {
        padding: 12px var(--spacing-xl);
    }
}

/* 横屏适配 */
@media (orientation: landscape) and (max-height: 500px) {
    .modal-content {
        margin: 5% auto;
        padding: var(--spacing-lg);
    }
    
    .title-en {
        margin-bottom: var(--spacing-md);
    }
    
    .claim-btn {
        padding: 10px 25px;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .modal-content {
        border: 2px solid var(--white);
    }
    
    .claim-btn {
        border: 2px solid var(--primary-color);
    }
}

/* 打印样式 */
@media print {
    .modal,
    .redirect-overlay {
        display: none !important;
    }
    
    body {
        background: var(--white);
    }
}

