/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    color: #ff6b6b;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* 主要内容 */
.main {
    flex: 1;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

/* 输入区域 */
.input-section {
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #555;
}

.input-group label i {
    color: #667eea;
}

#url-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    font-size: 16px;
    resize: vertical;
    transition: all 0.3s ease;
    font-family: inherit;
}

#url-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 选项区域 */
.options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #555;
}

.option-group label i {
    color: #667eea;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.checkbox-label:hover {
    background-color: #f8f9fa;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background-color: #667eea;
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

#image-index {
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

#image-index:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 下载按钮 */
.download-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.download-btn:active {
    transform: translateY(0);
}

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

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #667eea;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* 结果区域 */
.result-section {
    margin-top: 30px;
    border: none !important;
    border-radius: 12px;
    overflow: hidden;
    max-width: 1200px;
    box-shadow: none !important;
    outline: none !important;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: none;
}

.result-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #28a745;
    margin: 0;
}

.clear-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background-color 0.3s ease;
}

.clear-btn:hover {
    background: #c82333;
}

.result-content {
    padding: 20px;
}

.result-item {
    margin-bottom: 20px;
    padding: 15px;
    border: none !important;
    border-radius: 8px;
    background: #f8f9fa;
    box-shadow: none !important;
    outline: none !important;
}

.result-item h4 {
    color: #333;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-item p {
    margin: 5px 0;
    color: #666;
}

.download-links {
    margin-top: 15px;
}

.download-link {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    margin: 5px;
    transition: background-color 0.3s ease;
}

.download-link:hover {
    background: #5a6fd8;
}

/* 错误消息 */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

/* 底部 */
.footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

.footer p {
    margin: 5px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer a {
    color: #ff6b6b;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* 工具类 */
.hidden {
    display: none !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .main {
        padding: 20px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .options {
        grid-template-columns: 1fr;
    }
    
    .download-btn {
        padding: 15px;
        font-size: 16px;
    }
}

/* 预览容器样式 */
.preview-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 恢复桌面端为3列 */
    gap: 20px;
    margin-top: 15px;
}

.preview-item {
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.preview-content {
    position: relative;
    background: #f8f9fa;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-image {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.preview-image:hover {
    transform: scale(1.05);
}

.preview-video {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    background: #000;
}

.unknown-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #666;
    padding: 40px 20px;
}

.unknown-file i {
    font-size: 3rem;
    color: #ddd;
}

.preview-actions {
    padding: 15px;
    background: white;
    border-top: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-info {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.preview-actions .download-link {
    background: #667eea;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.preview-actions .download-link:hover {
    background: #5a6fd8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .preview-container {
        grid-template-columns: repeat(2, 1fr); /* 移动端2列 */
    }
    
    .preview-content {
        min-height: 150px;
    }
    
    .preview-image,
    .preview-video {
        max-height: 200px;
    }
}

/* 加载状态 */
.preview-content.loading {
    position: relative;
}

.preview-content.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 错误状态 */
.preview-content.error {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc3545;
    font-size: 14px;
}

.preview-content.error::before {
    content: '⚠️';
    margin-right: 8px;
    font-size: 18px;
}

/* 更细致的移动端适配 */
@media (max-width: 480px) {
    .container {
        padding: 4px;
        max-width: 100vw;
    }
    .main {
        padding: 8px;
        border-radius: 10px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }
    .logo h1 {
        font-size: 1.2rem;
    }
    .header {
        margin-bottom: 16px;
    }
    .download-btn {
        padding: 10px;
        font-size: 15px;
        border-radius: 8px;
        min-height: 40px;
    }
    #url-input, #image-index {
        padding: 8px;
        font-size: 14px;
        border-radius: 8px;
    }
    .result-section {
        margin-top: 12px;
        border-radius: 8px;
    }
    .result-header, .result-content, .result-item {
        padding: 8px !important;
        border-radius: 6px;
    }
    .result-header h3 {
        font-size: 1rem;
        gap: 4px;
    }
    .clear-btn {
        padding: 4px 8px;
        font-size: 13px;
        border-radius: 4px;
    }
    .preview-container {
        gap: 8px;
        margin-top: 8px;
    }
    .preview-item {
        border-radius: 8px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    }
    .preview-content {
        min-height: 80px;
    }
    .preview-image, .preview-video {
        max-height: 100px;
        border-radius: 6px;
    }
    .unknown-file {
        padding: 16px 4px;
        font-size: 12px;
    }
    .preview-actions {
        padding: 6px;
        font-size: 12px;
    }
    .file-info {
        font-size: 12px;
    }
    .download-link, .preview-actions .download-link {
        display: inline-block;
        margin: 5px;
        transition: background-color 0.3s ease;
        text-decoration: none;
    }
    .download-link:hover, .preview-actions .download-link:hover {
        text-decoration: none;
    }
    .error-message {
        padding: 8px;
        font-size: 13px;
        border-radius: 6px;
    }
    .footer {
        margin-top: 16px;
        font-size: 12px;
        padding: 8px 2px;
    }
    .footer p {
        gap: 4px;
    }
    /* 进度条百分比适配 */
    #progress-bar-percent {
        font-size: 10px !important;
        right: 4px !important;
    }
    .big-download-btn {
        height: 40px !important;
        min-height: 40px !important;
        font-size: 0.95rem !important;
        border-radius: 0.8em !important;
        padding: 0 0.5em !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.4em !important;
        text-align: center !important;
    }
    .big-download-btn i {
        font-size: 1.1em !important;
        margin: 0 !important;
        display: inline-block;
        vertical-align: middle;
    }
}

/* 进一步优化超小屏幕下的布局 */
@media (max-width: 375px) {
    .main, .result-section, .result-header, .result-content, .result-item {
        padding-left: 2px !important;
        padding-right: 2px !important;
    }
    .download-btn {
        font-size: 13px;
        padding: 8px;
    }
    #url-input, #image-index {
        font-size: 12px;
        padding: 6px;
    }
    .preview-image, .preview-video {
        max-height: 70px;
    }
    .big-download-btn {
        height: 36px !important;
        min-height: 36px !important;
        font-size: 0.9rem !important;
        border-radius: 0.7em !important;
        padding: 0 0.3em !important;
        gap: 0.3em !important;
    }
    .big-download-btn i {
        font-size: 1em !important;
    }
}

/* 预览区download按钮专属美化 */
.download-btn-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0.2em 0 0.6em 0;
}
/* big-download-btn 统一样式（彻底生效） */
.big-download-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.04rem;
    font-weight: 600;
    padding: 0.55em 1.2em;
    border-radius: 12px;
    background: linear-gradient(90deg, #ff6a88 0%, #ff99ac 100%);
    color: #fff !important;
    box-shadow: 0 2px 8px 0 rgba(255, 106, 136, 0.10);
    margin: 0 auto !important;
    text-decoration: none;
    transition: background 0.18s, box-shadow 0.18s, transform 0.13s, filter 0.18s;
    border: none;
    outline: none;
    cursor: pointer;
    min-width: 92px;
    max-width: 90vw;
    height: 36px;
    min-height: 36px;
    gap: 0.42em;
    line-height: 1.1 !important;
    text-align: center !important;
    font-family: 'Segoe UI', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    letter-spacing: 0.01em;
    filter: brightness(1);
}
.big-download-btn:hover, .big-download-btn:active {
    background: linear-gradient(90deg, #ff99ac 0%, #ff6a88 100%);
    box-shadow: 0 6px 18px 0 rgba(255, 106, 136, 0.18);
    color: #fff;
    transform: scale(1.045);
    filter: brightness(1.08);
    text-decoration: none;
}
.big-download-btn i {
    font-size: 1.13em !important;
    margin: 0 0.32em 0 0 !important;
    display: inline-block;
    vertical-align: middle;
}
@media (max-width: 640px) {
  .big-download-btn {
    border-radius: 9px !important;
    min-width: 74px;
    max-width: 96vw;
    height: 30px;
    min-height: 30px;
    font-size: 0.95rem !important;
    padding: 0 0.6em !important;
    gap: 0.28em !important;
  }
  .big-download-btn i {
    font-size: 1em !important;
    margin-right: 0.22em !important;
  }
}
@media (max-width: 480px) {
  .big-download-btn {
    border-radius: 7px !important;
    min-width: 58px;
    max-width: 98vw;
    height: 26px;
    min-height: 26px;
    font-size: 0.89rem !important;
    padding: 0 0.3em !important;
    gap: 0.13em !important;
  }
}
@media (max-width: 375px) {
  .big-download-btn {
    min-width: 48px;
    height: 22px;
    min-height: 22px;
    font-size: 0.82rem !important;
    padding: 0 0.15em !important;
    gap: 0.08em !important;
  }
}

.download-link.big-download-btn, .preview-actions .download-link.big-download-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: linear-gradient(90deg, #ff6a88 0%, #ff99ac 100%) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px 0 rgba(255, 106, 136, 0.10) !important;
    border-radius: 12px !important;
    font-size: 1.04rem !important;
    font-weight: 600 !important;
    padding: 0.55em 1.2em !important;
    margin: 0 auto !important;
    min-width: 92px !important;
    max-width: 90vw !important;
    height: 36px !important;
    min-height: 36px !important;
    gap: 0.42em !important;
    line-height: 1.1 !important;
    text-align: center !important;
    font-family: 'Segoe UI', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif !important;
    letter-spacing: 0.01em !important;
    filter: brightness(1) !important;
    transition: background 0.18s, box-shadow 0.18s, transform 0.13s, filter 0.18s !important;
    border: none !important;
    outline: none !important;
    cursor: pointer !important;
}
.download-link.big-download-btn:hover, .preview-actions .download-link.big-download-btn:hover {
    background: linear-gradient(90deg, #ff99ac 0%, #ff6a88 100%) !important;
    box-shadow: 0 6px 18px 0 rgba(255, 106, 136, 0.18) !important;
    color: #fff !important;
    transform: scale(1.045) !important;
    filter: brightness(1.08) !important;
    text-decoration: none !important;
}
.download-link.big-download-btn i, .preview-actions .download-link.big-download-btn i {
    font-size: 1.13em !important;
    margin: 0 0.32em 0 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
}
@media (max-width: 768px) {
  .result-section {
    max-width: 98vw;
  }
  .preview-container {
    grid-template-columns: repeat(2, 1fr);
  }
  .big-download-btn {
    width: auto !important;
    max-width: 90%;
    min-width: 64px;
    padding-left: 1em !important;
    padding-right: 1em !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: flex !important;
    justify-content: center !important;
  }
  .big-download-btn i {
    font-size: 1.1rem !important;
    min-width: 1.1em;
    min-height: 1.1em;
    line-height: 1 !important;
    margin-right: 0.18em !important;
  }
}
@media (max-width: 480px) {
  .big-download-btn {
    max-width: 95%;
    padding-left: 0.7em !important;
    padding-right: 0.7em !important;
  }
  .big-download-btn i {
    font-size: 1rem !important;
    min-width: 1em;
    min-height: 1em;
  }
}
@media (max-width: 375px) {
  .big-download-btn i {
    font-size: 0.9rem !important;
    min-width: 0.9em;
    min-height: 0.9em;
  }
}
@media (max-width: 375px) {
  .preview-container {
    grid-template-columns: 1fr;
  }
}
/* ===== Download 图标统一样式（仅保留这一组） ===== */
.big-download-btn i.fas.fa-download {
  font-size: 1.2rem !important;
  min-width: 1.2em !important;
  min-height: 1.2em !important;
  line-height: 1 !important;
  vertical-align: middle !important;
}
@media (max-width: 600px) {
  .big-download-btn i.fas.fa-download {
    font-size: 0.9rem !important;
    min-width: 0.9em !important;
    min-height: 0.9em !important;
  }
}
@media (max-width: 400px) {
  .big-download-btn i.fas.fa-download {
    font-size: 0.7rem !important;
    min-width: 0.7em !important;
    min-height: 0.7em !important;
  }
}
.big-download-btn i.fas.fa-download {
    font-size: 1.2rem !important;
    min-width: 1.2em !important;
    min-height: 1.2em !important;
    line-height: 1 !important;
    vertical-align: middle !important;
    color: #fff !important;
    /* 终极加权 */
    all: unset;
    font-family: "Font Awesome 5 Free", "Font Awesome 6 Free", "FontAwesome", Arial, sans-serif !important;
    font-weight: 900 !important;
    display: inline-block !important;
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
  }
  @media (max-width: 600px) {
    .big-download-btn i.fas.fa-download {
      font-size: 0.9rem !important;
      min-width: 0.9em !important;
      min-height: 0.9em !important;
    }
  }
  @media (max-width: 400px) {
    .big-download-btn i.fas.fa-download {
      font-size: 0.7rem !important;
      min-width: 0.7em !important;
      min-height: 0.7em !important;
    }
  }