/* ================================================================
   OneAD AI宇宙航行計畫 - 主樣式表
   ================================================================ */

/* ================================================================
   0. 選擇統計樣式 / Choice Statistics Styles
   ================================================================ */

.choice-stats {
    margin-bottom: 2rem;
}

.choice-stats-container {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.choice-stat-group {
    flex: 1;
    min-width: 300px;
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.choice-stat-group h4 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chart-wrapper canvas {
    max-height: 300px;
    max-width: 300px;
}

/* 桌機版本的選擇統計樣式 */
@media (min-width: 1024px) {
    .choice-stat-group {
        background: rgba(0, 0, 0, 0.8);
        backdrop-filter: blur(10px);
    }
    
    .choice-stat-group h4 {
        color: white;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    }
}

/* ================================================================
   1. 全域設定 / Global Styles
   ================================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: black;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* 桌機使用黑色背景 */
@media (min-width: 1024px) {
    body {
        background: black;
    }
    
    .container {
        background: none;
    }
    
    .page {
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(10px);
    }
    
    h2, p, h3 {
        color: white;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    }
    
    .upload-area {
        border-color: white;
        background: rgba(0, 0, 0, 0.3);
    }
    
    .upload-area h3,
    .upload-area p {
        color: white;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    }
}

/* ================================================================
   2. 動畫 / Animations
   ================================================================ */

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

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

/* ================================================================
   3. 版面配置 / Layout
   ================================================================ */

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-size: cover;
    background-attachment: fixed;
}

.page {
    background: url('images/back.jpg') center center no-repeat;
    background-size: cover;
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 100%;
    max-width: 600px;
    animation: fadeIn 0.6s ease-out;
    border: 1px solid rgba(64, 136, 242, 0.1);
}

/* result.html 專用的頁面背景 */
body[data-page="result"] .page {
    background: url('images/resultBox.png') center center no-repeat;
    background-size: cover;
}

/* ================================================================
   4. 字體排版 / Typography
   ================================================================ */

h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #333;
    font-weight: 700;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: white;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

p {
    font-size: 1.1rem;
    color: white;
    margin-bottom: 2rem;
    line-height: 1.7;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

/* ================================================================
   5. 按鈕樣式 / Button Styles
   ================================================================ */

.btn {
    display: inline-block;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    margin: 0.5rem;
    min-width: 200px;
}

.btn-primary {
    background: linear-gradient(135deg, #4088F2 0%, #2C6FDB 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(64, 136, 242, 0.4);
}

.btn-secondary {
    background: #F09436;
    color: white;
    border: 2px solid #F09436;
}

.btn-secondary:hover {
    background: #E8842F;
    border-color: #E8842F;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(240, 148, 54, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 小型按鈕 */
.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
    flex: 1;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.btn-preview {
    background-color: #667eea;
    color: white;
}

.btn-preview:hover {
    background-color: #5a67d8;
}

.btn-download {
    background-color: #48bb78;
    color: white;
}

.btn-download:hover {
    background-color: #38a169;
}

/* ================================================================
   6. 表單元素 / Form Elements
   ================================================================ */

.input-section,
.style-selector,
.honor-selector {
    margin: 2rem 0;
    text-align: center;
}

.input-section h3,
.style-selector h3,
.honor-selector h3 {
    font-size: 1.3rem;
    color: white;
    margin-bottom: 1rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.name-input,
.style-select {
    width: 100%;
    max-width: 300px;
    padding: 12px 16px;
    font-size: 1.1rem;
    border: 2px solid #4088F2;
    border-radius: 10px;
    background: white;
    color: #333;
    transition: all 0.3s ease;
}

.name-input {
    text-align: center;
}

.style-select {
    cursor: pointer;
}

.name-input:hover,
.style-select:hover {
    border-color: #F09436;
    box-shadow: 0 5px 15px rgba(240, 148, 54, 0.2);
}

.name-input:focus,
.style-select:focus {
    outline: none;
    border-color: #F09436;
    box-shadow: 0 0 0 3px rgba(240, 148, 54, 0.1);
}

.style-select option {
    padding: 8px;
    font-size: 1rem;
}

.file-input {
    display: none;
}

/* ================================================================
   7. 上傳區域 / Upload Area
   ================================================================ */

.upload-area {
    border: 3px dashed #ffffff;
    border-radius: 15px;
    padding: 3rem;
    margin: 2rem 0;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.upload-area:hover {
    border-color: #2C6FDB;
    background: rgba(64, 136, 242, 0.1);
}

.upload-area.drag-over {
    border-color: #F09436;
    background: rgba(240, 148, 54, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    color: #4088F2;
    margin-bottom: 1rem;
}

.image-preview {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    margin: 1rem 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ================================================================
   8. 結果顯示 / Result Display
   ================================================================ */

.result-container {
    display: flex;
    justify-content: center;
    margin: 2rem 0;
    align-items: center;
}

.result-item {
    text-align: center;
}

.result-item h3 {
    margin-bottom: 1rem;
    color: white;
    font-size: 1.3rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.avatar-canvas {
    border-radius: 10px;
    transition: transform 0.3s ease;
    max-width: 100%;
    height: auto;
}

.avatar-canvas:hover {
    transform: scale(1.05);
}

/* ================================================================
   9. 備份檔案列表 / Backup List
   ================================================================ */

.backup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 2rem;
}

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

.backup-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.backup-image {
    width: 100%;
    height: 240px;
    object-fit: contain;
    object-position: center;
    border-radius: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    background-color: #f8f9fa;
}

.backup-info {
    margin-bottom: 15px;
}

.backup-filename {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    word-break: break-word;
}

.backup-details {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.4;
}

.backup-actions {
    display: flex;
    gap: 10px;
}

/* 統計區域 */
.stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    text-align: center;
}

.stats h3 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.stat-item {
    text-align: center;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 8px;
    word-break: break-word;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.95rem;
    opacity: 0.95;
    line-height: 1.3;
}

/* ================================================================
   10. 狀態訊息 / Status Messages
   ================================================================ */

.loading {
    text-align: center;
    padding: 40px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* 載入中轉圈動畫 */
.loading.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    background: url('images/loading.gif') center center no-repeat;
    background-size: contain;
    margin: 1rem;
    padding: 0;
}

/* 載入中整體區域 - Modal 樣式 */
#loadingSection {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#loadingSection .loading-content {
    background: rgba(0, 0, 0, 0.85);
    border-radius: 20px;
    padding: 3rem 2rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#loadingSection .loading {
    width: 80px;
    height: 80px;
    background: url('images/loading.gif') center center no-repeat;
    background-size: contain;
    margin: 1rem auto;
    display: block;
}

#loadingSection .loading-content p {
    font-size: 1.1rem;
    color: white;
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state h3 {
    color: #333;
    margin-bottom: 10px;
}

.status {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
}
/* 
.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status.info {
    background: #cce7ff;
    color: #004085;
    border: 1px solid #b8daff;
} */

/* ================================================================
   11. 導航 / Navigation
   ================================================================ */

.nav {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 100;
}

.nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.nav a:hover {
    opacity: 1;
}

/* 隱藏返回首頁連結 */
.nav {
    visibility: hidden;
}

/* ================================================================
   12. 彈出視窗 / Modal
   ================================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    max-height: 90vh;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

/* ================================================================
   Status Message Modal / 狀態訊息彈窗
   ================================================================ */

#statusMessage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9998;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#statusMessage .status-content {
    background: rgba(0, 0, 0, 0.85);
    border-radius: 20px;
    padding: 3rem 2rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 90%;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#statusMessage .status-content #statusText {
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

#statusMessage .status-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

#statusMessage .status-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

/* ================================================================
   13. 預覽區域樣式 / Preview Section Styles
   ================================================================ */

#previewSection h3 {
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

/* ================================================================
   14. 首頁專用樣式 / Index Page Styles
   ================================================================ */

/* 首頁文字樣式 */
.intro-text {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 1rem;
    line-height: 1.6;
    font-weight: 500;
}

.intro-sub {
    font-size: 1rem;
    color: #666;
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

/* 主要操作區域 */
.action-section {
    margin: 2.5rem 0;
    text-align: center;
}

.main-cta {
    font-size: 1.25rem;
    padding: 20px 40px;
    margin-bottom: 3rem;
    display: inline-block;
    background: linear-gradient(135deg, #4088F2 0%, #2C6FDB 100%);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(64, 136, 242, 0.3);
    letter-spacing: 0.5px;
}

.main-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(64, 136, 242, 0.4);
}

/* 功能特色網格 */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.8rem;
    margin-top: 2.5rem;
}

.feature-item {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 2rem 1.5rem;
    text-align: center;
    border: 1px solid rgba(64, 136, 242, 0.15);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.feature-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

.feature-item h3 {
    font-size: 1.2rem;
    color: #2C6FDB;
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.feature-item p {
    font-size: 0.95rem;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* 提示區域 */
.tips-section {
    margin-top: 2.5rem;
    padding: 1.5rem;
    background: rgba(240, 148, 54, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(240, 148, 54, 0.2);
}

.tip-text {
    font-size: 0.95rem;
    color: #666;
    margin: 0;
    line-height: 1.6;
    text-align: center;
}

/* ================================================================
   14. 響應式設計 / Responsive Design
   ================================================================ */

/* 平板尺寸優化 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        min-height: 100vh;
    }
    
    .page {
        padding: 1.5rem;
        margin: 0.5rem;
        border-radius: 15px;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 0.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .btn {
        min-width: auto;
        padding: 14px 24px;
        font-size: 1rem;
        border-radius: 12px;
    }
    
    .upload-area {
        padding: 1.5rem;
        margin: 1.5rem 0;
    }
    
    .nav {
        position: static;
        text-align: center;
        margin-bottom: 1rem;
    }
}

/* 手機尺寸優化 */
@media (max-width: 640px) {
    /* 首頁手機優化 */
    .intro-text {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
        line-height: 1.5;
    }
    
    .intro-sub {
        font-size: 0.95rem;
        margin-bottom: 2rem;
        line-height: 1.6;
    }
    
    .action-section {
        margin: 2rem 0;
    }
    
    .main-cta {
        width: 100%;
        font-size: 1.1rem;
        padding: 16px 24px;
        margin-bottom: 2rem;
        border-radius: 10px;
        box-sizing: border-box;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1.5rem;
    }
    
    .feature-item {
        padding: 1.2rem;
        border-radius: 12px;
    }
    
    .feature-item h3 {
        font-size: 1.05rem;
        margin-bottom: 0.6rem;
    }
    
    .feature-item p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    .tips-section {
        margin-top: 2rem;
        padding: 1.2rem;
        border-radius: 10px;
    }
    
    .tip-text {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    body {
        font-size: 16px; /* 防止 iOS 縮放 */
    }
    
    .container {
        padding: 0.5rem;
        justify-content: flex-start;
        padding-top: 1rem;
    }
    
    .page {
        padding: 1.2rem;
        margin: 0.3rem;
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    }
    
    h1 {
        font-size: 1.6rem;
        margin-bottom: 0.5rem;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 1.4rem;
        margin-bottom: 0.8rem;
        line-height: 1.3;
    }
    
    p {
        font-size: 0.95rem;
        margin-bottom: 1.2rem;
        line-height: 1.5;
    }
    
    /* 表單元素手機優化 */
    .input-section,
    .style-selector,
    .honor-selector {
        margin: 1.5rem 0;
    }
    
    .input-section h3,
    .style-selector h3,
    .honor-selector h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
        text-align: left;
    }
    
    .name-input,
    .style-select {
        width: 100%;
        max-width: 100%;
        padding: 16px 14px; /* 增加觸控區域 */
        font-size: 16px; /* 防止 iOS 縮放 */
        border-radius: 8px;
        border: 2px solid #4088F2;
        margin-bottom: 0.5rem;
    }
    
    .name-input {
        text-align: left;
    }
    
    /* 按鈕手機優化 */
    .btn {
        width: 100%;
        padding: 16px 20px;
        margin: 0.5rem 0;
        font-size: 1.1rem;
        font-weight: 600;
        border-radius: 10px;
        min-height: 50px; /* 確保觸控區域足夠大 */
    }
    
    /* 上傳區域手機優化 */
    .upload-area {
        padding: 1.2rem;
        margin: 1.2rem 0;
        border-radius: 10px;
        border-width: 2px;
        min-height: 120px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .upload-area h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
        color: white;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    }
    
    .upload-area p {
        font-size: 0.9rem;
        margin-bottom: 0;
        color: white;
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    }
    
    /* 圖片預覽手機優化 */
    .image-preview {
        max-width: 100%;
        max-height: 200px;
        margin: 0.8rem 0;
    }
    
    /* 載入狀態手機優化 */
    #loadingSection .loading-content {
        padding: 2rem 1.5rem;
        border-radius: 15px;
        max-width: 350px;
    }
    
    #loadingSection .loading-content p {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .loading {
        margin: 1rem auto;
        width: 60px;
        height: 60px;
        background: url('images/loading.gif') center center no-repeat;
        background-size: contain;
    }
    
    /* 狀態訊息手機優化 */
    #statusMessage .status-content {
        padding: 2rem 1.5rem;
        border-radius: 15px;
        max-width: 350px;
    }
    
    #statusMessage .status-close {
        top: 10px;
        right: 15px;
        font-size: 1.3rem;
    }
    
    /* 備份頁面手機優化 */
    .backup-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-top: 1rem;
    }
    
    .backup-item {
        padding: 15px;
        border-radius: 10px;
    }
    
    .backup-image {
        height: 180px;
        margin-bottom: 10px;
    }
    
    .backup-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-small {
        padding: 12px 16px;
        font-size: 0.9rem;
        min-height: 44px;
    }
    
    /* 統計區域手機優化 */
    .stats {
        padding: 15px;
        margin-bottom: 20px;
        border-radius: 10px;
    }
    
    .stats h3 {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-top: 15px;
    }
    
    .stat-item {
        min-height: 50px;
        padding: 10px;
    }
    
    .stat-number {
        font-size: 1.3rem;
        margin-bottom: 5px;
    }
    
    .stat-label {
        font-size: 0.9rem;
    }
    
    /* 結果頁面手機優化 */
    .result-container {
        flex-direction: column;
        margin: 1rem 0;
        gap: 1rem;
    }
    
    .result-item {
        width: 100%;
    }
    
    .result-item h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }
    
    .avatar-canvas {
        max-width: 100%;
        height: auto;
        border-radius: 10px;
    }
}

/* 超小手機尺寸優化 */
@media (max-width: 480px) {
    .container {
        padding: 0.3rem;
    }
    
    .page {
        padding: 1rem;
        margin: 0.2rem;
    }
    
    h1 {
        font-size: 1.4rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    .name-input,
    .style-select {
        padding: 14px 12px;
    }
    
    .btn {
        padding: 14px 16px;
        font-size: 1rem;
    }
    
    .upload-area {
        padding: 1rem;
        min-height: 100px;
    }
}

/* 觸控設備優化 */
@media (hover: none) and (pointer: coarse) {
    /* 移除桌面版的 hover 效果 */
    .btn:hover,
    .name-input:hover,
    .style-select:hover,
    .upload-area:hover,
    .backup-item:hover,
    .avatar-canvas:hover,
    .main-cta:hover,
    .feature-item:hover {
        transform: none;
        box-shadow: none;
    }
    
    /* 加入觸控反饋 */
    .btn:active,
    .main-cta:active {
        transform: scale(0.97);
        opacity: 0.8;
        transition: all 0.1s ease;
    }
    
    .upload-area:active {
        transform: scale(0.98);
        opacity: 0.9;
        transition: all 0.1s ease;
    }
    
    .name-input:focus,
    .style-select:focus {
        transform: scale(1.02);
        transition: all 0.2s ease;
    }
    
    /* 增加觸控目標大小 */
    .btn,
    .name-input,
    .style-select {
        min-height: 48px; /* iOS Human Interface Guidelines */
    }
    
    /* 優化選擇框的觸控體驗 */
    .style-select {
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23666' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
        background-position: right 12px center;
        background-repeat: no-repeat;
        background-size: 16px;
        padding-right: 40px;
    }
}