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

.theme-day {
    --bg-body: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --bg-input: #f8fafc;
    --border-light: #e2e8f0;
    --card-bg: #ffffff;
    --card-shadow: 0 20px 35px -8px rgba(0,0,0,0.1);
    --btn-primary: #3b82f6;
    --btn-primary-hover: #2563eb;
    --btn-secondary: #94a3b8;
    --btn-secondary-hover: #64748b;
    --accent: #3b82f6;
    --footer-bg: #f8fafc;
    --footer-text: #64748b;
    --progress-bg: #e2e8f0;
    --progress-fill: #3b82f6;
}
.theme-night {
    --bg-body: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --bg-input: #1e293b;
    --border-light: #334155;
    --card-bg: #1e293b;
    --card-shadow: 0 20px 35px -8px rgba(0,0,0,0.5);
    --btn-primary: #6366f1;
    --btn-primary-hover: #818cf8;
    --btn-secondary: #475569;
    --btn-secondary-hover: #64748b;
    --accent: #818cf8;
    --footer-bg: #1e293b;
    --footer-text: #94a3b8;
    --progress-bg: #334155;
    --progress-fill: #818cf8;
}
.theme-spring {
    --bg-body: #fff1f0;
    --text-primary: #7f1d1d;
    --text-secondary: #991b1b;
    --bg-input: #fee2e2;
    --border-light: #fecaca;
    --card-bg: #ffffff;
    --card-shadow: 0 20px 35px -8px rgba(239,68,68,0.15);
    --btn-primary: #ef4444;
    --btn-primary-hover: #dc2626;
    --btn-secondary: #f97316;
    --btn-secondary-hover: #ea580c;
    --accent: #f59e0b;
    --footer-bg: #fee2e2;
    --footer-text: #b91c1c;
    --progress-bg: #fecaca;
    --progress-fill: #ef4444;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 16px;
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
}

.app {
    width: 100%;
    max-width: 700px;
}

header {
    margin-bottom: 24px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.mode-btn, .theme-btn {
    position: absolute;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.mode-btn { left: 0; }
.theme-btn { right: 0; }

.mode-btn:hover, .theme-btn:hover {
    background: var(--btn-primary);
    color: white;
    border-color: var(--btn-primary);
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    word-break: break-word;
    text-align: center;
    max-width: calc(100% - 100px);
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-align: center;
    word-break: break-word;
}

.input-group {
    display: flex;
    background: var(--bg-input);
    border-radius: 60px;
    padding: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 24px;
    border: 1px solid var(--border-light);
}

.input-group input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px 18px;
    font-size: 1rem;
    outline: none;
    color: var(--text-primary);
    min-width: 0;
    width: 100%;
}

.input-group input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

.input-group button {
    background: var(--btn-primary);
    border: none;
    color: white;
    padding: 0 24px;
    border-radius: 60px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 4px 8px rgba(59,130,246,0.3);
    white-space: nowrap;
    flex-shrink: 0;
}

.input-group button:hover {
    background: var(--btn-primary-hover);
}

/* 进度条 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    margin: 20px 0;
}

.loading.hidden {
    display: none;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--progress-bg);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-fill {
    width: 30%;
    height: 100%;
    background: var(--progress-fill);
    border-radius: 20px;
    animation: progress 1.2s ease-in-out infinite;
}

@keyframes progress {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0%); }
    100% { transform: translateX(100%); }
}

.result {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-light);
    transition: all 0.2s;
    overflow-x: hidden;
    word-break: break-word;
}

.result.hidden {
    display: none;
}

/* 视频模块 (保留原有) */
.video-section h2, .image-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    flex-wrap: wrap;
}

.video-player {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    margin-bottom: 16px;
}

.video-player video {
    width: 100%;
    max-height: 400px;
    display: block;
}

.quality-slider {
    margin: 16px 0 14px;
}

.quality-slider label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.quality-slider input[type=range] {
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, var(--btn-primary), var(--accent));
    border-radius: 10px;
    -webkit-appearance: none;
}

.quality-slider input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid var(--btn-primary);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    cursor: pointer;
}

.quality-value {
    font-weight: 600;
    color: var(--btn-primary);
    margin-left: 6px;
}

.download-btn {
    background: var(--btn-primary);
    border: none;
    color: white;
    padding: 10px 22px;
    border-radius: 40px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(59,130,246,0.3);
    border: 1px solid transparent;
    white-space: nowrap;
    max-width: 100%;
}

.download-btn:hover {
    background: var(--btn-primary-hover);
}

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

.ytdlp-btn {
    background: var(--btn-secondary);
    margin-left: 10px;
}

.ytdlp-btn:hover {
    background: var(--btn-secondary-hover);
}

/* 彻底移除焦点轮廓 */
*:focus, *:focus-visible, *:focus-within {
    outline: none !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent !important;
}
button, a, input, textarea, select {
    -webkit-tap-highlight-color: transparent;
}

/* 图片网格 (保留) */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin: 12px 0 16px;
}

.image-item {
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    transition: transform 0.2s, box-shadow 0.2s;
}

.image-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

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

.image-info {
    padding: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    flex-wrap: wrap;
    gap: 4px;
}

.image-info span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    word-break: break-word;
}

.image-info button {
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
    white-space: nowrap;
}

.image-info button:hover {
    background: var(--btn-primary);
    color: white;
    border-color: var(--btn-primary);
}

.download-all {
    text-align: center;
    margin-top: 8px;
}

/* 小说模块样式 */
.novel-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.novel-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: var(--bg-input);
    border-radius: 16px;
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}

.novel-item:hover {
    background: var(--border-light);
    transform: translateY(-2px);
}

.novel-cover {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    background: var(--border-light);
}

.novel-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.novel-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.novel-author {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.novel-source {
    font-size: 0.8rem;
    color: var(--accent);
}

.chapter-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    margin: 16px 0;
}

.chapter-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background 0.1s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chapter-item:hover {
    background: var(--bg-input);
}

.chapter-title {
    font-size: 0.95rem;
}

.chapter-index {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.novel-content {
    background: var(--bg-input);
    padding: 20px;
    border-radius: 16px;
    white-space: pre-wrap;
    font-size: 1rem;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    margin: 16px 0;
}

.novel-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.back-btn {
    background: var(--btn-secondary);
    border: none;
    color: white;
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.back-btn:hover {
    background: var(--btn-secondary-hover);
}

footer {
    text-align: center;
    margin-top: 24px;
    color: var(--footer-text);
    font-size: 0.8rem;
    background: var(--footer-bg);
    padding: 8px 16px;
    border-radius: 40px;
    display: inline-block;
    border: 1px solid var(--border-light);
    max-width: 100%;
    word-break: break-word;
}
