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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #0f172a;
    background: #f5f7fb;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 32px;
    color: #0f172a;
}

.header h1 {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

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

.main {
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.input-section {
    margin-bottom: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

textarea, input, select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
}

textarea:focus, input:focus, select:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.text-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 14px;
    color: #666;
}

.separator {
    margin: 0 10px;
}

.config-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin: 30px 0;
}

.config-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.3rem;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

input[type="range"] {
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #111827;
    border-radius: 50%;
    cursor: pointer;
}

.action-section {
    text-align: center;
    margin: 30px 0;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.generate-btn {
    background: #111827;
    color: white;
    border: 1px solid #0b1220;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 200px;
    position: relative;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(17, 24, 39, 0.15);
}

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

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

.result-section, .error-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin-top: 30px;
}

.result-section h3 {
    color: #28a745;
    margin-bottom: 20px;
}

.result-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.info-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.info-item .label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.audio-player {
    margin: 20px 0;
}

.download-section {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
}

.download-btn, .retry-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.download-btn:hover, .retry-btn:hover {
    background: #218838;
}

.subtitle-preview {
    margin-top: 20px;
}

.subtitle-preview h4 {
    margin-bottom: 10px;
    color: #333;
}

.subtitle-preview pre {
    background: white;
    padding: 15px;
    border-radius: 8px;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.4;
}

.error-section {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.error-message h3 {
    color: #721c24;
    margin-bottom: 10px;
}

.error-message p {
    color: #721c24;
    margin-bottom: 15px;
}

.retry-btn {
    background: #dc3545;
}

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

.footer {
    text-align: center;
    margin-top: 40px;
    color: #6b7280;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .main {
        padding: 20px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

    .download-section {
        flex-direction: column;
        align-items: center;
    }

    .result-info {
        grid-template-columns: 1fr;
    }
}

/* 分段处理相关样式 */
.help-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

.segments-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: #f9f9f9;
}

.segment-item {
    margin-bottom: 15px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.segment-header {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.segment-number {
    background: #667eea;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    margin-right: 10px;
    flex-shrink: 0;
}

.segment-text {
    flex: 1;
    font-weight: 500;
}

.segment-info {
    font-size: 0.85rem;
    color: #666;
    margin-left: 34px;
}

.processing-hint {
    margin-top: 20px;
    padding: 20px;
    background: #e8f4fd;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
}

.processing-hint h4 {
    color: #1976d2;
    margin-bottom: 10px;
}

.processing-hint ul {
    margin: 10px 0;
    padding-left: 20px;
}

.processing-hint li {
    margin-bottom: 5px;
}

.processing-hint code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

/* 客户端处理相关样式 */
.processing-progress {
    margin-top: 20px;
    padding: 20px;
    background: #fff3cd;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.processing-progress h4 {
    color: #856404;
    margin-bottom: 15px;
}

.progress-bar-container {
    background: #e9ecef;
    border-radius: 10px;
    height: 20px;
    margin: 10px 0;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #28a745, #20c997);
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

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

#processing-status {
    font-size: 14px;
    color: #856404;
    margin-top: 10px;
}

.segment-status {
    margin-left: 10px;
    font-weight: bold;
}

.subtitle-preview-content {
    margin-top: 20px;
    padding: 20px;
    background: #d1ecf1;
    border-radius: 8px;
    border-left: 4px solid #17a2b8;
}

.subtitle-preview-content h4 {
    color: #0c5460;
    margin-bottom: 15px;
}

.subtitle-preview-content pre {
    background: white;
    padding: 15px;
    border-radius: 8px;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #bee5eb;
    white-space: pre-wrap;
}

/* 无字幕提示样式 */
.no-subtitle-hint {
    padding: 20px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #dee2e6;
}

/* 转换警告样式 */
.conversion-warning {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff3cd;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
}

.warning-message {
    color: #856404;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 处理提示样式优化 */
.processing-hint {
    padding: 20px;
    text-align: center;
    color: #0c5460;
    background: #d1ecf1;
    border-radius: 8px;
    border-left: 4px solid #17a2b8;
    font-size: 14px;
}

/* 字幕预览区域滚动条样式 */
.subtitle-preview pre::-webkit-scrollbar {
    width: 8px;
}

.subtitle-preview pre::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.subtitle-preview pre::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.subtitle-preview pre::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 可搜索下拉框样式 */
.searchable-select {
    position: relative;
}

.searchable-select input {
    cursor: pointer;
}

.options-container {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e1e5e9;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.options-container.visible {
    display: block;
}

.option-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.option-item:hover, .option-item.highlighted {
    background-color: #f0f0f0;
}