:root {
    --bg-color: #020617;
    --card-bg: rgba(30, 41, 59, 0.5);
    --primary-color: #10b981;
    --primary-glow: rgba(16, 185, 129, 0.3);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-blur: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(59, 130, 246, 0.08) 0%, transparent 40%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1.5rem;
    overflow-x: hidden;
}

.container {
    max-width: 900px;
    width: 100%;
    animation: fadeIn 0.8s ease-out;
}

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

header {
    text-align: center;
    margin-bottom: 4rem;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-box {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
}

.intro-box p {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.intro-box .site-link {
    color: var(--primary-color);
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.9;
    margin-top: 0.5rem;
}

.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.download-card {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 2.5rem 2rem;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.download-card:hover {
    transform: translateY(-8px);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
    background: rgba(30, 41, 59, 0.7);
}

.app-icon-tile {
    width: 88px;
    height: 88px;
    background: #fff;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    padding: 0;
    position: relative;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.download-card:hover .app-icon-tile {
    transform: scale(1.08) rotate(2deg);
}

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

.card-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.card-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.6;
    min-height: 3rem;
}

.warning-badge {
    display: block;
    margin-top: 0.5rem;
    color: #f87171;
    font-size: 0.8rem;
    font-weight: 500;
}

.btn-download {
    width: 100%;
    padding: 1.1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1.05rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-download:hover {
    filter: brightness(1.1);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-download:active {
    transform: scale(0.98);
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    z-index: 1000;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 400px;
    padding: 3rem 2rem;
    border-radius: 32px;
    text-align: center;
    transform: scale(0.9);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.active .modal-content {
    transform: scale(1);
}

@media (max-width: 640px) {
    .modal.active.keyboard-open .modal-content {
        transform: scale(1) translateY(-110px);
    }
}

#status-text {
    font-size: 1.25rem;
    color: #fff;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

#expiry-timer {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
}

.verify-inputs {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.modal-footer.three-buttons {
    justify-content: space-between;
}

.modal-footer.three-buttons button {
    flex: 1;
    padding: 0.8rem 0.5rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

/* 按钮禁用状态变灰 */
.btn-confirm:disabled, .btn-cancel:disabled {
    background: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.3) !important;
    cursor: not-allowed;
    opacity: 0.8;
    box-shadow: none !important;
    filter: grayscale(1);
}

/* 确认按钮调暗状态已移除，改为由 JS 控制 Class 切换 */

.code-input {
    width: 60px;
    height: 72px;
    background: rgba(2, 6, 23, 0.4);
    border: 2px solid var(--border-color);
    border-radius: 18px;
    font-size: 1.75rem;
    font-weight: 800;
    color: white;
    text-align: center;
    transition: all 0.2s ease;
}

.code-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(16, 185, 129, 0.05);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.error-text {
    color: #ef4444;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    display: none;
}

.resend-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 2rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.resend-link:hover:not(:disabled) {
    background: rgba(16, 185, 129, 0.1);
}

.resend-link:disabled { opacity: 0.5; cursor: not-allowed; }

.modal-footer {
    display: flex;
    gap: 1rem;
}

.btn-cancel, .btn-confirm {
    flex: 1;
    padding: 1.1rem;
    border-radius: 16px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.btn-cancel:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.btn-confirm {
    background: var(--primary-color);
    color: white;
}

.btn-confirm.dimmed {
    opacity: 0.5;
    filter: brightness(0.8);
    cursor: not-allowed;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.shake { animation: shake 0.4s ease-in-out; }

#gatekeeper-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    transition: all 0.6s ease;
}

#gatekeeper-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.1);
}

.gatekeeper-content {
    max-width: 400px;
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    padding: 3rem 2rem;
    border-radius: 32px;
}

.container {
    filter: blur(20px);
    transition: filter 0.8s ease;
}

.container.unlocked {
    filter: blur(0);
}

@media (max-width: 640px) {
    body { padding: 2rem 1rem; }
    .download-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .modal-content { padding: 2.5rem 1.5rem; }
    .code-input { width: 50px; height: 60px; font-size: 1.5rem; }
}

html.is-desktop .mobile-only {
    display: none !important;
}

html.is-mobile .desktop-only {
    display: none !important;
}

/* 苹果系统拦截样式 */
html.is-apple body > *:not(#apple-block) {
    display: none !important;
}

html.is-apple #apple-block {
    display: flex !important;
    position: fixed;
    inset: 0;
    background: var(--bg-color);
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.apple-content {
    background: var(--card-bg);
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    padding: 3rem 2rem;
    border-radius: 24px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: fadeIn 0.4s ease-out;
}

.apple-content h2 {
    color: #ef4444;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.apple-content p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.5;
}

/* 微信拦截样式 */
html.is-wechat body > *:not(#wechat-block) {
    display: none !important;
}

html.is-wechat #wechat-block {
    display: block !important;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.92);
    backdrop-filter: blur(4px);
    z-index: 99999;
}

.wechat-hint {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.wechat-hint .arrow {
    font-size: 4.5rem;
    color: white;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
    line-height: 1;
    animation: bounceTopRight 1.5s infinite ease-in-out;
}

.hint-text {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 1.5rem;
    border-radius: 20px;
    text-align: right;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.hint-warning {
    font-size: 1.05rem;
    color: #fbbf24;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.hint-action {
    color: white;
    font-size: 1.15rem;
    line-height: 1.6;
}

.hint-action strong {
    color: var(--primary-color);
    font-weight: 700;
}

@keyframes bounceTopRight {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(12px, -12px); }
}

/* 微信拦截：电脑端大屏居中排版优化 */
@media (min-width: 641px) {
    html.is-wechat #wechat-block {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: var(--bg-color);
        backdrop-filter: none;
    }

    .wechat-hint {
        padding: 0;
        align-items: center;
    }

    .hint-text {
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        padding: 3rem 2rem;
        border-radius: 24px;
        text-align: center;
        max-width: 400px;
        width: 90vw;
        box-shadow: none;
    }

    .wechat-hint .arrow {
        display: none; /* 电脑端隐藏右上角箭头 */
    }
}

