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

body {
    font-family: 'Noto Sans TC', sans-serif;
    color: #2d3748;
    margin: 0;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    background-color: #0f172a; /* 深色背景基底 */
}

#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
}

.tech-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    opacity: 0.5;
    background: 
        linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px),
        linear-gradient(0deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
}

.glow-circle {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, rgba(59, 130, 246, 0.05) 40%, transparent 70%);
    z-index: -3;
    filter: blur(40px);
    pointer-events: none;
    animation: floating 15s infinite ease-in-out;
}

.glow-circle:nth-child(2) {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(168, 85, 247, 0.04) 40%, transparent 70%);
    animation-delay: -7s;
    right: 5%;
    top: 20%;
}

@keyframes floating {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-5%, 5%); }
    50% { transform: translate(5%, 10%); }
    75% { transform: translate(10%, -5%); }
    100% { transform: translate(0, 0); }
}

.container {
    background-color: rgba(255, 255, 255, 0.88);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1), 
                0 0 0 1px rgba(255, 255, 255, 0.1),
                0 0 30px rgba(59, 130, 246, 0.2);
    max-width: 800px;
    width: calc(100% - 30px); /* 調整寬度，留出固定的 margin */
    backdrop-filter: blur(15px);
    position: relative;
    z-index: 1;
    margin: 15px; /* 添加固定的外部間距 */
}

/* 頂部區域 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 25px;
}

.app-info {
    display: flex;
    align-items: center;
    flex: 3;
    min-width: 280px;
}

.app-icon {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    margin-right: 22px;
    object-fit: cover;
}

.app-title {
    display: flex;
    flex-direction: column;
}

h1 {
    color: #1a202c;
    margin-bottom: 8px;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    position: relative;
    line-height: 1.1;
}

h1:after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: linear-gradient(to right, #0a84ff, rgba(10, 132, 255, 0.5));
    margin-top: 8px;
    border-radius: 2px;
}

.tagline {
    font-size: 15px;
    color: #718096;
    margin: 0;
    font-weight: 400;
    padding-top: 4px;
}

.qr-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 130px;
}

.qr-code {
    width: 100px;
    height: 100px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    padding: 5px;
}

.qr-code img {
    width: 100%;
    height: 100%;
}

.qr-hint {
    margin-top: 8px;
    font-size: 12px;
    color: #718096;
}

/* 下載區域 */
.download-section {
    display: flex;
    justify-content: space-between;
    gap: 20px; /* 增加卡片間距 */
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.download-card {
    flex: 1;
    min-width: 230px;
    padding: 18px 16px; /* 縮減內部間距 */
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.download-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.05);
}

.ios {
    background: linear-gradient(to bottom right, #f9fcff, #edf5ff);
}

.ios:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0; /* 從頂部開始 */
    height: 100%; /* 使其等高於卡片 */
    width: 4px;
    background-color: #0a84ff; /* 使用純色而非半透明 */
    border-radius: 0; /* 移除圓角 */
}

.android {
    background: linear-gradient(to bottom right, #f4fef5, #e8f5e9); /* 調整為更符合Android綠色系 */
}

.android:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0; /* 從頂部開始 */
    height: 100%; /* 使其等高於卡片 */
    width: 4px;
    background-color: #3ddc84; /* 使用Android品牌綠色 */
    border-radius: 0; /* 移除圓角 */
}

.platform-icon {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px; /* 減少底部間距 */
    padding-left: 6px;
    position: relative; /* 為偽元素定位做準備 */
}

.platform-icon:after {
    content: '';
    display: block;
    width: 30px;
    height: 2px;
    border-radius: 2px;
    margin-top: 8px;
}

.ios .platform-icon {
    color: #0a84ff;
}

.ios .platform-icon:after {
    background: linear-gradient(to right, #0a84ff, rgba(10, 132, 255, 0.3));
}

.android .platform-icon {
    color: #3DDC84;
}

.android .platform-icon:after {
    background: linear-gradient(to right, #3DDC84, rgba(61, 220, 132, 0.3));
}

.version-info {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px; /* 減少與按鈕之間的間距 */
    padding-left: 6px; /* 減少左側間距 */
}

/* 更新版本信息的樣式，讓冒號後的內容對齊 */
.version, .update-date {
    font-size: 13px; /* 稍微縮小字體 */
    color: #5a6778;
    margin-bottom: 3px; /* 減少垂直間距 */
    display: grid;
    grid-template-columns: 85px 1fr; /* 調整寬度以適應更長的標籤文字 */
}

.version::before {
    content: "最新版本: ";
}

.update-date::before {
    content: "更新時間: ";
}

/* 修正loading容器樣式 */
.loading-container {
    display: inline-flex; /* 使用inline-flex確保內容在一行 */
    align-items: center; /* 垂直居中 */
    white-space: nowrap; /* 防止換行 */
    color: #94a3b8;
    font-style: italic;
    font-size: 12px;
}

/* 調整loading spinner樣式 */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #0a84ff;
    animation: spin 1s linear infinite;
    margin-left: 4px; /* 與文字保持間距 */
    vertical-align: middle;
}

.android .loading-spinner {
    border-top-color: #3DDC84;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.download-btn {
    display: inline-block;
    padding: 12px 10px; /* 略微減少按鈕高度和寬度 */
    text-decoration: none;
    border-radius: 8px; /* 增加按鈕的圓角 */
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
    width: 100%;
    text-align: center;
    margin-top: 6px; /* 減少上方間距 */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08); /* 為按鈕增加微陰影 */
}

/* 按鈕讀取狀態樣式 */
.download-btn.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    cursor: wait;
    opacity: 0.85;
}

.ios .download-btn.loading {
    background-color: #5a9fe0; /* 較淺的藍色 */
}

.android .download-btn.loading {
    background-color: #6ee19c; /* 較淺的綠色 */
}

/* 按鈕中的loading spinner樣式 */
.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}

.ios .download-btn {
    background-color: #0a84ff;
    color: #fff;
}

.ios .download-btn:hover {
    background-color: #007aee;
    box-shadow: 0 4px 8px rgba(10, 132, 255, 0.3);
}

.android .download-btn {
    background-color: #3DDC84; /* Android 官方綠色 */
    color: #fff;
}

.android .download-btn:hover {
    background-color: #32C77E;
    box-shadow: 0 4px 8px rgba(61, 220, 132, 0.3);
}

.install-tip {
    font-size: 12px;
    color: #718096;
    line-height: 1.4;
    margin-top: auto;
}

footer {
    text-align: center;
    color: #a0aec0;
    font-size: 12px;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* 安裝提示區域 - 更新設計 */
.instructions {
    margin-top: 25px;
    margin-bottom: 20px;
    padding: 16px 20px;
    background-color: #f8fafc;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    /* 移除邊框 */
}

.instructions h2 {
    color: #94a3b8; /* 調淺標題顏色 */
    font-size: 16px;
    font-weight: 500; /* 降低字重 */
    margin-bottom: 10px; /* 減少標題與內文間距 */
    text-align: center;
    letter-spacing: 0.3px;
}

.instruction-content {
    display: flex;
    flex-direction: column;
    gap: 20px; /* 增加項目間距，取代分隔線 */
}

.instruction-item {
    padding: 0;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    position: relative; /* 添加相對定位 */
}

/* 移除舊的分隔線樣式 */
.instruction-divider {
    display: none; /* 隱藏原有分隔線 */
}

.platform-tag {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 500;
    margin-bottom: 6px;
    width: fit-content;
    display: inline-block;
}

.ios-tag {
    background-color: rgba(10, 132, 255, 0.1);
    color: #0a84ff;
}

.android-tag {
    background-color: rgba(61, 220, 132, 0.1); /* 使用 Android 官方色彩 */
    color: #3DDC84; /* Android 官方綠色 */
}

.instruction-text {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

/* 添加版本加載動畫的樣式 */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #0a84ff;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-left: 2px; /* 減少左側間距 */
}

.android .loading-spinner {
    border-top-color: #3DDC84;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #94a3b8;
    font-style: italic;
    font-size: 12px;
    display: inline; /* 確保文字是行內元素 */
}

.version-info.loading .version::before,
.version-info.loading .update-date::before {
    opacity: 0.5;
}

/* 上傳表單樣式 */
.upload-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-group {
    width: 100%;
    margin-bottom: 0;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
}

.input-group input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 14px;
}

.upload-btn {
    width: auto;
    padding: 8px 15px;
    margin-top: 10px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 14px;
}

.upload-btn:hover {
    background: #45a049;
}

.upload-progress {
    width: 0;
    height: 24px;
    background-color: #4CAF50;
    margin: 10px 0;
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
    text-align: center;
    line-height: 24px;
    font-size: 14px;
    /* 新增文字樣式 */
    color: #000000;
    text-shadow: 
        -1px -1px 0 #ffffff,
         1px -1px 0 #ffffff,
        -1px  1px 0 #ffffff,
         1px  1px 0 #ffffff;
    font-weight: bold;
}

/* 隱藏元素 */
.hidden {
    display: none !important;
}

/* 響應式設計 */
@media (max-width: 650px) {
    .header {
        flex-direction: column;
        text-align: center;
        padding-bottom: 20px;
    }
    
    .app-info {
        margin-bottom: 20px;
        justify-content: center;
        /* 移除 flex-direction: column; 以保持左右排列 */
    }
    
    .app-icon {
        margin-right: 15px; /* 保持右側間距 */
        margin-bottom: 0; /* 移除底部間距 */
        /* 移除縮小尺寸的設定，保持原有大小 */
    }
    
    .app-title {
        text-align: left; /* 確保標題文字左對齊 */
    }
    
    h1 {
        font-size: 24px; /* 手機版字體稍小 */
    }
    
    h1:after {
        margin: 8px 0 0; /* 確保下劃線左對齊 */
    }
    
    .qr-section {
        margin-top: 10px;
    }
    
    .download-section {
        flex-direction: column;
    }
    
    .download-card {
        margin-bottom: 20px; /* 增加小螢幕下卡片間距 */
    }
    
    .instruction-content {
        flex-direction: column;
    }
    
    .instruction-item {
        margin-bottom: 10px;
    }
}

/* 平板尺寸下調整QR碼區域 */
@media (max-width: 768px) {
    .qr-section {
        display: none; /* 在平板尺寸下隱藏QR碼區域 */
    }
    
    .app-info {
        flex: 1;
        justify-content: center;
    }
    
    .header {
        justify-content: center;
    }
}

@media (max-width: 400px) {
    /* 移除縮小 app-icon 尺寸的樣式 */
    
    h1 {
        font-size: 22px;
    }
    
    .container {
        padding: 15px;
        /* 保持 margin 不變，不再覆蓋 */
    }
}