: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;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.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; /* 逼近苹果 22.5% 的圆角比例 */
    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;
    padding: 1.5rem;
}

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

.modal-content {
    background: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: 32px;
    padding: 3rem 2rem;
    max-width: 440px;
    width: 100%;
    text-align: center;
    transform: scale(0.9);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

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

#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;
}

.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;
}

@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; }

@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; }
}

