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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    background: #fff;
    padding-bottom: 30px;
}

/* 头部 */
.header {
    padding: 20px 16px 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: #07c160;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo-icon::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-radius: 50%;
}

.logo-icon::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    background: #fff;
    border-radius: 50%;
    top: 8px;
    right: 8px;
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.logo-text p {
    font-size: 13px;
    color: #999;
    margin-top: 2px;
}

/* 输入区域 */
.input-section {
    padding: 0 16px;
}

.input-box {
    position: relative;
    margin-bottom: 12px;
}

.input-box textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px 36px 12px 14px;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    font-size: 14px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    line-height: 1.6;
}

.input-box textarea:focus {
    border-color: #07c160;
}

.input-box textarea::placeholder {
    color: #bbb;
}

.clear-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: #e0e0e0;
    color: #fff;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.clear-btn.show {
    display: flex;
}

/* 输入操作 */
.input-actions {
    margin-bottom: 16px;
}

.auto-download {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #666;
}

/* 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ddd;
    border-radius: 24px;
    transition: 0.3s;
}

.slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.switch input:checked + .slider {
    background: #07c160;
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

/* 按钮组 */
.buttons {
    display: flex;
    gap: 12px;
}

.btn {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    background: #fff;
    color: #333;
}

.btn:hover {
    opacity: 0.9;
}

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

.btn-primary {
    background: #07c160;
    border-color: #07c160;
    color: #fff;
}

.btn-primary:hover {
    background: #06ad56;
}

.btn-outline {
    background: #fff;
    border: 1px solid #ddd;
    color: #333;
}

.btn-outline:hover {
    background: #f5f5f5;
}

.btn-full {
    width: 100%;
}

.btn svg {
    flex-shrink: 0;
}

/* 加载 */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    gap: 16px;
}

.loading.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8e8e8;
    border-top-color: #07c160;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: #666;
    font-size: 14px;
}

/* 结果区域 */
.result-section {
    display: none;
    padding: 0 16px;
}

.result-section.show {
    display: block;
}

/* Tab */
.tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    margin-bottom: 16px;
}

.tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    font-size: 15px;
    color: #666;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab.active {
    color: #07c160;
    font-weight: 600;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: #07c160;
    border-radius: 2px;
}

/* Tab内容 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 视频 */
.video-container {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.video-container video {
    width: 100%;
    display: block;
    max-height: 500px;
}

.video-info {
    padding: 12px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

.video-info .title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.video-info .author {
    color: #999;
}

.download-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 图片网格 */
.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.image-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f0f0f0;
    cursor: pointer;
    aspect-ratio: 1;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-item .check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: #07c160;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-item .check svg {
    width: 14px;
    height: 14px;
    color: #fff;
}

.image-item.selected .check {
    opacity: 1;
}

.image-item .img-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: rgba(0,0,0,0.5);
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-item:hover .img-actions,
.image-item.selected .img-actions {
    opacity: 1;
}

.img-actions button {
    flex: 1;
    padding: 6px 4px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    background: rgba(255,255,255,0.9);
    color: #07c160;
}

.img-actions button:hover {
    background: #fff;
}

/* 图片操作 */
.image-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.select-all-btn {
    flex: 0 0 auto;
    padding: 12px 20px;
    white-space: nowrap;
}

/* 文案 */
.text-content {
    background: #f8f8f8;
    border-radius: 12px;
    padding: 16px;
    font-size: 15px;
    line-height: 1.8;
    color: #333;
    margin-bottom: 12px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 底部 */
.footer {
    padding: 20px 16px;
    margin-top: 20px;
}

.footer-links {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.footer-links a {
    color: #999;
    font-size: 13px;
    text-decoration: none;
}

.footer-links a:hover {
    color: #07c160;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 错误提示 */
.error-box {
    background: #fff2f0;
    border: 1px solid #ffccc7;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    color: #ff4d4f;
    margin: 16px 0;
}

.error-box .retry-btn {
    margin-top: 10px;
    padding: 8px 24px;
    border: none;
    border-radius: 20px;
    background: #ff4d4f;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}

/* 响应式 */
@media (max-width: 400px) {
    .buttons {
        flex-direction: column;
    }
    
    .image-grid {
        gap: 8px;
    }
    
    .image-actions {
        flex-direction: column;
    }
    
    .select-all-btn {
        width: 100%;
    }
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}
