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

:root {
    --background: #09090b;
    --foreground: #fafafa;
    --card: #18181b;
    --card-foreground: #fafafa;
    --popover: #18181b;
    --popover-foreground: #fafafa;
    --primary: #fafafa;
    --primary-foreground: #18181b;
    --secondary: #27272a;
    --secondary-foreground: #fafafa;
    --muted: #27272a;
    --muted-foreground: #d4d4d8;
    --accent: #27272a;
    --accent-foreground: #fafafa;
    --destructive: #ef4444;
    --destructive-foreground: #fafafa;
    --border: #3f3f46;
    --input: #27272a;
    --ring: #fafafa;
    --radius: 0.5rem;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    padding: 12px 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.top-tabs {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin: 0;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(39, 39, 42, 0.72);
    backdrop-filter: blur(10px);
    position: static;
    z-index: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.top-tabs-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.top-tab {
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted-foreground);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-icon {
    display: none;
}

.top-tab:hover {
    color: var(--foreground);
    background: rgba(255,255,255,0.045);
}

.top-tab.active {
    color: var(--foreground);
    background: rgba(9, 9, 11, 0.96);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.top-tab-secondary {
    color: var(--foreground);
    background: rgba(255,255,255,0.04);
    border-color: var(--border);
}

.mobile-feature-tabs {
    display: none;
}

.settings-panel {
    display: none;
    position: fixed;
    top: 76px;
    right: 20px;
    background: var(--card);
    padding: 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    z-index: 1000;
    min-width: 380px;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.settings-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-panel-body {
    padding: 20px;
}

.settings-panel-close {
    background: none;
    border: none;
    color: #71717a;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    min-height: calc(100vh - 24px);
}

.app-shell-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 auto 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(24, 24, 27, 0.94) 0%, rgba(9, 9, 11, 0.94) 100%);
    position: sticky;
    top: 10px;
    z-index: 24;
    backdrop-filter: blur(12px);
    flex-wrap: nowrap;
}

.app-brand {
    min-width: 0;
    flex: 1 1 auto;
}

.app-brand-copy {
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    white-space: nowrap;
}

.app-brand-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    color: var(--foreground);
    font-weight: 600;
    flex: 0 0 auto;
}

.app-brand-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--muted-foreground);
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 模型内存状态 pill - header 右侧 */
.header-mem-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    padding: 4px 8px;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    background: rgba(39, 39, 42, 0.72);
    height: 30px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.header-mem-pill.is-loaded {
    border-color: rgba(34, 197, 94, 0.4);
}

.mem-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.mem-dot.idle {
    background: #52525b;
}

.mem-dot.loaded {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.mem-dot.busy {
    background: #f59e0b;
    animation: mem-pulse 1.2s ease-in-out infinite;
}

@keyframes mem-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.mem-label {
    font-size: 11px;
    color: #71717a;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1;
}

.header-mem-pill.is-loaded .mem-label {
    color: #a1a1aa;
}

.mem-unload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: transparent;
    border: 1px solid #52525b;
    border-radius: 4px;
    color: #71717a;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.mem-unload-btn:hover:not(:disabled) {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.6);
    background: rgba(248, 113, 113, 0.08);
}

.mem-unload-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.mem-unload-btn svg.spin {
    animation: icon-spin 0.8s linear infinite;
}

@keyframes icon-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.header {
    margin-bottom: 20px;
    margin-top: 0px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: var(--card) !important;
    min-height: 50px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* Debug: Make header text visible */
.header * {
    visibility: visible !important;
    opacity: 1 !important;
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #fafafa !important;
    display: inline;
}

.header p {
    color: #71717a;
    font-size: 13px;
    margin: 0;
    display: inline;
    margin-left: 8px;
}

.main-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 28px;
    padding-bottom: 80px;
    align-items: start;
}

@media (max-width: 1400px) {
    .main-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .top-tabs {
        align-items: stretch;
    }

    .top-tabs-group {
        width: 100%;
    }

    .top-tab {
        flex: 1 1 auto;
    }

    .settings-panel {
        left: 16px;
        right: 16px;
        min-width: auto;
        max-width: none;
    }

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

.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: auto;
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-content > .btn-primary {
    margin-top: 8px;
}

.card h2 {
    color: var(--card-foreground);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card h2 .title-with-icon {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card h2 .card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-generate {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fafafa 0%, #e4e4e7 100%);
    border: none;
    color: #09090b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(250, 250, 250, 0.15);
}

.btn-generate:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(250, 250, 250, 0.25);
}

.btn-generate:active {
    transform: scale(0.95);
}

.btn-generate:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    animation: pulse 1.5s ease-in-out infinite;
}

.btn-generate.loading svg {
    display: none;
}

.btn-generate.loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid rgba(9, 9, 11, 0.3);
    border-top-color: #09090b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: block;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.btn-generate svg {
    width: 18px;
    height: 18px;
}

.card-status {
    margin-bottom: 12px;
}

.card h2 .icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: var(--foreground);
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #fafafa;
    font-weight: 500;
    font-size: 16px;
    letter-spacing: 0.01em;
}

.form-group textarea,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    transition: all 0.15s ease;
    background: #0f0f11;
    color: #fafafa;
    outline: none;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

.form-group textarea:focus,
.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="password"]:focus,
.form-group select:focus {
    border-color: #fafafa;
    box-shadow: 0 0 0 2px rgba(250, 250, 250, 0.2);
}

.form-group textarea::placeholder,
.form-group input[type="text"]::placeholder,
.form-group input[type="number"]::placeholder,
.form-group input[type="password"]::placeholder {
    color: #71717a;
}

.hint-panel {
    padding: 12px;
    background: #111114;
    border: 1px solid #303036;
    border-radius: var(--radius);
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--foreground);
    font-size: 14px;
    font-weight: 500;
}

.toggle-switch input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #fafafa;
}

.form-hint {
    margin-top: 8px;
    color: #a1a1aa;
    font-size: 13px;
    line-height: 1.5;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.control-field label {
    margin-bottom: 6px;
    font-size: 13px;
    color: #d4d4d8;
}

.compact-number-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #0f0f11;
    color: #fafafa;
    font-size: 14px;
}

.compact-number-input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 700px) {
    .control-grid {
        grid-template-columns: 1fr;
    }
}

.form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
    -webkit-appearance: none;
}

.form-group textarea {
    resize: none;
    min-height: 100px;
    max-height: 140px;
    font-family: inherit;
    line-height: 1.6;
}

/* shadcn ui 风格的暗色滚动条 */
.form-group textarea::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.form-group textarea::-webkit-scrollbar-track {
    background: #0f0f11;
    border-radius: 4px;
}

.form-group textarea::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 4px;
    border: 2px solid #0f0f11;
}

.form-group textarea::-webkit-scrollbar-thumb:hover {
    background: #52525b;
}

.form-group textarea::-webkit-scrollbar-corner {
    background: #0f0f11;
}

.form-group select option {
    background: #0f0f11;
    color: #fafafa;
    padding: 10px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    min-height: 100vh;
    padding: 12px 16px;
    line-height: 1.5;
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card h2 {
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.02em;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.card h2 .icon {
    font-size: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 3px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 12px;
}


.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.asr-advanced-row {
    align-items: end;
}

.asr-toggle-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.asr-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 16px;
    min-height: 42px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
}

.asr-switch-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.asr-switch-title {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
}

.asr-switch-description {
    margin-top: 2px;
    color: var(--muted-foreground);
    font-size: 12px;
    line-height: 1.3;
}

.asr-switch {
    position: relative;
    display: inline-flex;
    width: 36px;
    height: 20px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    cursor: pointer;
}

.asr-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.asr-switch-track {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 999px;
    background: var(--input);
    border: 1px solid var(--border);
    transition: background 0.2s ease, border-color 0.2s ease;
}

.asr-switch-thumb {
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: var(--foreground);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.32);
    transition: transform 0.2s ease, background 0.2s ease;
}

.asr-switch input:checked + .asr-switch-track {
    background: var(--success);
    border-color: var(--success);
}

.asr-switch input:checked + .asr-switch-track .asr-switch-thumb {
    transform: translateX(16px);
    background: #ffffff;
}

.asr-switch input:focus-visible + .asr-switch-track {
    box-shadow: 0 0 0 2px rgba(250, 250, 250, 0.18);
}

@media (max-width: 760px) {
    .asr-switch-row {
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    /* 设置弹窗移动端适配 */
    #configPanel {
        min-width: auto;
        max-width: none;
        width: calc(100vw - 32px);
        right: 16px;
        left: 16px;
        top: 60px;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }

    /* 生成历史弹窗移动端适配 - 宽度为屏幕4/5 */
    .history-drawer {
        width: 80% !important;
        right: -80% !important;
    }

    .history-drawer.open {
        right: 0 !important;
    }

    .drawer-toolbar {
        padding: 12px;
    }

    .drawer-filters {
        flex-direction: column;
    }

    .drawer-filters select,
    .drawer-filters input[type="date"] {
        width: 100%;
    }

    .drawer-content {
        padding: 8px;
    }
}

.speaker-option {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.speaker-option .desc {
    font-size: 12px;
    color: #888;
    font-weight: normal;
}

.language-tag {
    display: inline-block;
    padding: 3px 10px;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-radius: 6px;
    font-size: 11px;
    margin-left: 8px;
    font-weight: 700;
    letter-spacing: 0.025em;
    border: 1px solid rgba(30, 64, 175, 0.1);
}

.file-upload {
    border: 2px dashed #3f3f46;
    border-radius: var(--radius);
    padding: 10px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #18181b;
    color: #a1a1aa;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.file-upload:hover {
    border-color: #52525b;
    background: #1f1f23;
    color: #d4d4d8;
}

.file-upload:active {
    transform: scale(0.99);
}

.file-upload input[type="file"] {
    display: none;
}

.file-upload .upload-icon {
    display: flex;
    justify-content: center;
    align-items: center;
}

.file-upload .upload-icon svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.file-upload .file-name {
    color: var(--foreground);
    font-weight: 500;
    font-size: 13px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: #fafafa;
    color: #09090b;
    width: 100%;
    margin-top: auto;
    font-weight: 600;
    font-size: 16px;
}

.btn-primary:hover {
    background: #e4e4e7;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-success {
    background: #22c55e;
    color: #fafafa;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-secondary {
    background: #27272a;
    color: #fafafa;
    border: 1px solid #3f3f46;
}

.btn-secondary:hover {
    background: #3f3f46;
    border-color: #52525b;
}

.result-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    animation: slideUp 0.3s ease;
}

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

.result-section h3 {
    color: #fafafa;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
}

/* 自定义音频播放器 - shadcn ui 风格 */
.custom-audio-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #0f0f11;
    border: 1px solid #27272a;
    border-radius: var(--radius);
    width: 100%;
}

.custom-audio-player .play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fafafa;
    border: none;
    color: #09090b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.custom-audio-player .play-btn:hover {
    background: #e4e4e7;
    transform: scale(1.05);
}

.custom-audio-player .play-btn svg {
    width: 16px;
    height: 16px;
}

.custom-audio-player .progress-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.custom-audio-player .time-display {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #a1a1aa;
    font-variant-numeric: tabular-nums;
}

.custom-audio-player .progress-bar {
    width: 100%;
    height: 4px;
    background: #27272a;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.custom-audio-player .progress-fill {
    height: 100%;
    background: #fafafa;
    border-radius: 2px;
    transition: width 0.1s linear;
    position: relative;
}

.custom-audio-player .progress-fill::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #fafafa;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.custom-audio-player .progress-bar:hover .progress-fill::after {
    opacity: 1;
}

.custom-audio-player .volume-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #a1a1aa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    position: relative;
}

.custom-audio-player .volume-btn:hover {
    color: #fafafa;
    background: #27272a;
}

.custom-audio-player .volume-slider {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 8px;
    background: #18181b;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 100;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

.custom-audio-player .volume-btn:hover .volume-slider,
.custom-audio-player .volume-slider:hover {
    display: flex;
}

.custom-audio-player .volume-slider input[type="range"] {
    writing-mode: bt-lr; /* IE */
    -webkit-appearance: slider-vertical; /* WebKit */
    width: 4px;
    height: 80px;
    background: #27272a;
    border-radius: 2px;
    outline: none;
}

.custom-audio-player .volume-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #fafafa;
    border-radius: 50%;
    cursor: pointer;
}

.custom-audio-player .more-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #a1a1aa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    position: relative;
}

.custom-audio-player .more-btn:hover {
    color: #fafafa;
    background: #27272a;
}

.custom-audio-player .more-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #18181b;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    padding: 4px;
    min-width: 140px;
    display: none;
    flex-direction: column;
    z-index: 100;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

.custom-audio-player .more-btn.active .more-menu,
.custom-audio-player .more-menu:hover {
    display: flex;
}

.custom-audio-player .more-menu-item {
    padding: 8px 12px;
    font-size: 13px;
    color: #d4d4d8;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease;
}

.custom-audio-player .more-menu-item:hover {
    background: #27272a;
    color: #fafafa;
}

.custom-audio-player .more-menu-item svg {
    width: 14px;
    height: 14px;
}

.audio-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.audio-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
}

.status {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-weight: 500;
    font-size: 14px;
    animation: slideDown 0.2s ease;
    display: none;
    border: 1px solid;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status.success {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.2);
    display: block;
}

.status.error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
    display: block;
}

.status.loading {
    background: rgba(250, 250, 250, 0.05);
    color: #d4d4d8;
    border: 1px solid rgba(250, 250, 250, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #3f3f46;
    border-top-color: #fafafa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

.history-section {
    margin-top: 40px;
}

.history-section h2 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.history-list {
    background: #18181b;
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    transition: all 0.15s ease;
    border-radius: var(--radius);
    margin-bottom: 8px;
    background: var(--card);
}

.history-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.history-item:hover {
    border-color: var(--foreground);
}

.history-item .info {
    flex: 1;
    min-width: 0;
}

.history-item .info .text {
    font-weight: 500;
    color: var(--card-foreground);
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.history-item .info .meta {
    font-size: 14px;
    color: #d4d4d8;
}

.history-item .info .meta .type-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #27272a;
    color: #fafafa;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 10px;
    border: 1px solid #3f3f46;
}

.history-item .info .meta .speaker {
    color: #fafafa;
    font-weight: 500;
    margin-right: 10px;
}

.history-item .info .meta .type-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 8px;
}

.history-item .info .meta .speaker {
    color: var(--muted-foreground);
    font-weight: 500;
    margin-right: 8px;
}

.history-item .actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.history-item .actions .btn {
    padding: 4px 8px;
    font-size: 11px;
    min-width: auto;
    height: auto;
    border-radius: 4px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #a1a1aa;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.history-toolbar {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.history-search {
    flex: 1;
    min-width: 200px;
}

.history-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

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

.history-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.history-filters select,
.history-batch-toolbar {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 12px;
    padding: 12px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    animation: slideDown 0.3s ease;
}

.batch-select-all {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #92400e;
    cursor: pointer;
}

.batch-count {
    flex: 1;
    font-size: 14px;
    color: #92400e;
    font-weight: 500;
}

.btn-danger {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.btn-danger:hover {
    opacity: 0.9;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    transition: all 0.15s ease;
    border-radius: var(--radius);
    margin-bottom: 10px;
    background: #18181b;
}

.history-item:hover {
    border-color: #52525b;
    background: #1f1f23;
}

.history-item.selected {
    border-color: var(--primary);
    background: var(--accent);
}

.history-item-new {
    background: hsl(217 91% 60% / 0.1) !important;
    border-left: 3px solid hsl(217 91% 60%) !important;
}

.history-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.history-item .info {
    flex: 1;
    min-width: 0;
}

.history-item .actions {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: center;
}

.history-item .btn-icon-sm {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item .actions .btn {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.history-item .actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.history-item .actions .btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.history-item .actions .btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border: 1px solid var(--border);
}

.history-item .actions .btn-secondary:hover {
    background: var(--accent);
    border-color: var(--foreground);
}

.history-item .actions .btn-success {
    background: var(--success);
    color: white;
}

.history-item .actions .btn-success:hover {
    opacity: 0.9;
}

.history-item .actions .btn-primary {
    background: var(--foreground);
    color: var(--background);
}

.history-item .actions .btn-primary:hover {
    opacity: 0.9;
}

.history-item .actions .btn-danger {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

.history-item .actions .btn-danger:hover {
    opacity: 0.9;
}

.history-meta {
    font-size: 14px;
    color: #a1a1aa;
    margin-top: 6px;
}

.history-text {
    font-weight: 600;
    color: #fafafa;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
}

.service-status {
    display: none;
}

.settings-float {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    z-index: 1000;
    color: var(--card-foreground);
}

.settings-float:hover {
    transform: scale(1.05);
    border-color: var(--foreground);
}

.settings-float .status-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--card);
}

.settings-float .status-indicator.online {
    background: var(--success);
}

.settings-float .status-indicator.offline {
    background: var(--error);
}

.settings-float .status-indicator.auth-required {
    background: #f59e0b;
}

/* 设置面板标签页 */
.settings-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: #71717a;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 2px solid transparent;
}

.settings-tab:hover {
    color: #a1a1aa;
    background: rgba(255,255,255,0.05);
}

.settings-tab.active {
    color: #fafafa;
    border-bottom-color: #fafafa;
}

.model-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(15, 15, 17, 0.65);
}

.model-group + .model-group {
    margin-top: 12px;
}

.model-group-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.model-group-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--foreground);
}

.model-group-desc {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted-foreground);
}

.model-group-count {
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(39, 39, 42, 0.9);
    color: var(--foreground);
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.model-group-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-float {
    position: fixed;
    right: 14px;
    bottom: 24px;
    width: 44px;
    height: 44px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.15s ease;
    z-index: 1000;
    color: var(--card-foreground);
}

.history-float:hover {
    transform: scale(1.05);
    border-color: var(--foreground);
}

.history-float .badge {
    position: absolute;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 9999px;
    min-width: 18px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-float .badge-running {
    top: -4px;
    left: -4px;
    background: #22c55e;
    color: white;
}

.history-float .badge-history {
    top: -4px;
    right: -4px;
    background: #3b82f6;
    color: white;
}

.instruct-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.instruct-hint {
    padding: 8px 16px;
    background: #27272a;
    border-radius: var(--radius);
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
    color: #d4d4d8;
    border: 1px solid #3f3f46;
}

.instruct-hint:hover {
    background: #3f3f46;
    color: #fafafa;
    border-color: #52525b;
}

.instruct-hint:active {
    transform: scale(0.98);
}

.instruct-hint.custom-hint {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: #d4d4d8;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.instruct-hint.custom-hint:hover {
    background: #3f3f46;
    border-color: #52525b;
    color: #fafafa;
}

.instruct-hint.custom-hint .hint-text {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.instruct-hint.custom-hint svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.instruct-hint.emotion-hint {
    background: #27272a;
    color: #d4d4d8;
    border-color: #3f3f46;
}

.instruct-hint.emotion-hint:hover {
    background: #3f3f46;
    border-color: #52525b;
    color: #fafafa;
}

.instruct-hint.design-hint {
    background: #27272a;
    color: #d4d4d8;
    border-color: #3f3f46;
}

.instruct-hint.design-hint:hover {
    background: #3f3f46;
    border-color: #52525b;
    color: #fafafa;
}

.delete-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    padding: 2px;
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s ease;
    color: #a1a1aa;
}

.instruct-hint.custom-hint:hover .delete-hint {
    opacity: 1;
}

.delete-hint:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* 管理模式样式 */
.instruct-hint.custom-hint.manage-mode {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
    cursor: default;
}

.instruct-hint.custom-hint.manage-mode .delete-hint {
    opacity: 1;
    color: #f87171;
}

.instruct-hint.custom-hint.manage-mode:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

.custom-select-container {
    position: relative;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #09090b;
    border: 1px solid #27272a;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 14px;
    color: #fafafa;
}

.custom-select-trigger:hover {
    border-color: #3f3f46;
}

.custom-select-trigger.active {
    border-color: #fafafa;
}

.select-arrow {
    transition: transform 0.2s ease;
    color: #71717a;
}

.custom-select-trigger.active .select-arrow {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #18181b;
    border: 1px solid #3f3f46;
    border-radius: var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.custom-select-options.show {
    display: block;
}

.custom-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #27272a;
}

.custom-option:last-child {
    border-bottom: none;
}

.custom-option:hover {
    background: #27272a;
}

.option-text {
    flex: 1;
    font-size: 14px;
    color: #fafafa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.option-delete {
    padding: 4px;
    margin-left: 8px;
    color: #71717a;
    border-radius: 4px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #18181b;
    border-radius: var(--radius);
    border: 1px solid #3f3f46;
}

.speed-control input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    outline: none;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s;
}

.speed-control input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.speed-control input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}

.audio-preview-compact {
    margin-top: 8px;
    padding: 12px;
    background: #18181b;
    border-radius: var(--radius);
    border: 1px solid #3f3f46;
    animation: slideDown 0.3s ease;
}

.audio-player-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-play-mini {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #fafafa;
    color: #09090b;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-play-mini:hover {
    background: #e4e4e7;
    transform: scale(1.1);
}

.audio-progress-mini {
    flex: 1;
    height: 32px;
    background: #0f0f11;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid #3f3f46;
    position: relative;
    cursor: pointer;
}

.audio-progress-mini canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.progress-overlay {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(250, 250, 250, 0.2);
    width: 0%;
    pointer-events: none;
    transition: width 0.1s linear;
}

.audio-time {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    min-width: 40px;
    text-align: right;
}

.tool-btn {
    padding: 8px 14px;
    font-size: 14px;
    border: 1px solid #3f3f46;
    border-radius: var(--radius);
    background: #27272a;
    color: #d4d4d8;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
}

.tool-btn:hover {
    background: #3f3f46;
    color: #fafafa;
    border-color: #52525b;
}

.tool-btn.active {
    background: var(--foreground);
    color: var(--background);
    border-color: var(--foreground);
}

.audio-meta {
    font-size: 11px;
    color: #71717a;
    margin-left: 4px;
}

.btn-trim-toggle, .btn-save-ref {
    width: 28px;
    height: 28px;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    background: #27272a;
    color: #a1a1aa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.btn-trim-toggle:hover, .btn-save-ref:hover {
    background: #3f3f46;
    color: #fafafa;
    border-color: #52525b;
}

.btn-trim-toggle.active {
    background: var(--foreground);
    color: var(--background);
    border-color: var(--foreground);
}

.trim-panel-inline {
    margin-top: 10px;
    padding: 10px 12px;
    background: #0f0f11;
    border: 1px solid #3f3f46;
    border-radius: var(--radius);
    animation: slideDown 0.2s ease;
}

.trim-range-compact {
    position: relative;
    height: 20px;
    margin-bottom: 10px;
}

.trim-range-compact input[type="range"] {
    position: absolute;
    width: 100%;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #27272a;
    border-radius: 2px;
    top: 50%;
    transform: translateY(-50%);
}

.trim-range-compact input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: #27272a;
    border-radius: 2px;
}

.trim-range-compact input[type="range"]::-webkit-slider-thumb {
    pointer-events: auto;
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #fafafa;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #3f3f46;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    margin-top: -5px;
    transition: transform 0.15s ease;
}

.trim-range-compact input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.trim-controls-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-start;
}

.trim-controls-compact input {
    width: 56px;
    padding: 5px 6px;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
    font-weight: 500;
    background: #18181b;
    color: #fafafa;
    transition: all 0.15s ease;
}

.trim-controls-compact input:focus {
    border-color: #fafafa;
    outline: none;
}

.trim-separator {
    color: #71717a;
    font-size: 12px;
    font-weight: 500;
}

.btn-apply-trim-compact {
    padding: 5px 12px;
    font-size: 12px;
    border: none;
    border-radius: 6px;
    background: #fafafa;
    color: #09090b;
    cursor: pointer;
    font-weight: 600;
    margin-left: 8px;
    transition: all 0.15s ease;
}

.btn-apply-trim-compact:hover {
    background: #e4e4e7;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.speed-control .speed-value {
    min-width: 48px;
    text-align: center;
    font-weight: 600;
    color: #fafafa;
    font-size: 14px;
    background: #27272a;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #3f3f46;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal {
    background: #18181b;
    border: 1px solid #3f3f46;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #27272a;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fafafa;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

/* 模型管理列表样式 */
.model-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: #0f0f11;
    border: 1px solid #27272a;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.model-item:hover {
    border-color: #3f3f46;
    background: #141416;
}

.model-info {
    flex: 1;
}

.model-name {
    font-weight: 500;
    font-size: 14px;
    color: #fafafa;
    margin-bottom: 4px;
}

.model-desc {
    font-size: 12px;
    color: #71717a;
}

.model-size {
    font-size: 11px;
    color: #52525b;
    margin-top: 4px;
}

.model-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
}

.model-status.available {
    color: #22c55e;
}

.model-status.cloud {
    color: #3b82f6;
}

.model-actions {
    display: flex;
    gap: 8px;
    margin-left: 16px;
}

.model-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.model-btn.download {
    background: #3b82f6;
    color: white;
}

.model-btn.download:hover {
    background: #2563eb;
}

.model-btn.download:disabled {
    background: #1e3a5f;
    color: #60a5fa;
    cursor: not-allowed;
}

.model-btn.delete {
    background: #27272a;
    color: #ef4444;
    border: 1px solid #3f3f46;
}

.model-btn.delete:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.download-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 120px;
}

.download-progress .progress-bar {
    flex: 1;
    height: 4px;
    background: #27272a;
    border-radius: 2px;
    overflow: hidden;
}

.download-progress .progress-fill {
    height: 100%;
    background: #3b82f6;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.download-progress .progress-text {
    font-size: 11px;
    color: #71717a;
    min-width: 30px;
    text-align: right;
}

.model-status.downloading {
    color: #3b82f6;
}

/* 侧边弹窗样式 */
.history-drawer {
    position: fixed;
    top: 0;
    right: -40%;
    width: 40%;
    height: 100vh;
    background: #09090b;
    border-left: 1px solid var(--border);
    z-index: 2000;
    transition: right 0.2s ease;
    display: flex;
    flex-direction: column;
}

.history-drawer.open {
    right: 0;
}

.history-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.history-drawer-overlay.show {
    opacity: 1;
    visibility: visible;
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    background: #18181b;
}

.drawer-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #fafafa;
}

.drawer-close {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted-foreground);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.drawer-close:hover {
    background: var(--accent);
    color: var(--accent-foreground);
    border-color: var(--foreground);
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.drawer-toolbar {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #18181b;
}

.drawer-search {
    position: relative;
}

.drawer-search input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    transition: all 0.15s ease;
    background: #0f0f11;
    color: #fafafa;
    outline: none;
}

.drawer-search input:focus {
    border-color: var(--foreground);
    box-shadow: 0 0 0 1px var(--foreground);
}

.drawer-search::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23a8a29e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    background-size: contain;
}

.drawer-filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.drawer-filters select {
    padding: 10px 12px;
    border: 1px solid #3f3f46;
    border-radius: var(--radius);
    font-size: 14px;
    background: #0f0f11;
    color: #fafafa;
    flex: 1;
    min-width: 120px;
}

.drawer-filters input[type="date"] {
    padding: 10px 12px;
    border: 1px solid #3f3f46;
    border-radius: var(--radius);
    font-size: 14px;
    background: #0f0f11;
    color: #fafafa;
    cursor: pointer;
}

.drawer-filters input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(0.8);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.drawer-filters input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

:root {
    --text-primary: var(--foreground);
    --text-secondary: var(--muted-foreground);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.container {
    max-width: 1600px;
}

.app-tab-section {
    display: none !important;
    animation: section-fade 0.2s ease;
}

.app-tab-section.active {
    display: block !important;
}

.app-tab-section[hidden] {
    display: none !important;
}

@keyframes section-fade {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.single-column-layout {
    display: grid;
    grid-template-columns: minmax(0, 960px);
    justify-content: center;
    padding-bottom: 80px;
}

.history-page-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
    gap: 16px;
    align-items: start;
    padding-bottom: 80px;
}

.history-toolbar-static {
    padding: 0 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    background: transparent;
}

#tab-history .card,
#tab-settings .card,
#tab-asr .card,
#tab-longcat .card,
#tab-voxcpm .card {
    min-height: 0;
}

#tab-history .history-list {
    max-height: none;
}

#tab-history .queue-list {
    border-radius: var(--radius);
}

#tab-settings .settings-panel-body {
    max-height: none !important;
    overflow: visible !important;
}

#tab-settings .settings-tab {
    background: transparent;
}

#tab-settings .settings-tab.active {
    background: rgba(255, 255, 255, 0.06);
}

.top-tabs .badge-history {
    min-width: 28px;
    justify-content: center;
}

@media (max-width: 1100px) {
    .history-page-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    body {
        padding: 8px 10px calc(92px + env(safe-area-inset-bottom));
    }

    .app-shell-header {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        margin-bottom: 12px;
        padding: 10px 12px;
        border-radius: 14px;
        top: 8px;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .app-brand-copy {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
        white-space: normal;
    }

    .app-brand-title {
        font-size: 16px;
    }

    .app-brand-subtitle {
        font-size: 12px;
        line-height: 1.25;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        white-space: normal;
    }

    .header-mem-pill {
        align-self: center;
        height: 28px;
        max-width: 118px;
        padding: 4px 7px;
    }

    .mem-label {
        max-width: 76px;
    }

    .single-column-layout {
        grid-template-columns: 1fr;
        padding-bottom: calc(104px + env(safe-area-inset-bottom));
    }

    .mobile-feature-tabs {
        position: sticky;
        top: 82px;
        z-index: 23;
        display: grid;
        grid-template-columns: repeat(var(--mobile-feature-count, 3), minmax(0, 1fr));
        gap: 4px;
        margin: 0 0 10px;
        padding: 4px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        background: rgba(24, 24, 27, 0.96);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }

    #tab-longcat .mobile-feature-tabs,
    #tab-voxcpm .mobile-feature-tabs,
    #tab-history .mobile-feature-tabs {
        --mobile-feature-count: 2;
    }

    .mobile-feature-tab {
        min-width: 0;
        min-height: 38px;
        padding: 8px 6px;
        border: 1px solid transparent;
        border-radius: 9px;
        background: transparent;
        color: var(--muted-foreground);
        font: inherit;
        font-size: 13px;
        font-weight: 600;
        line-height: 1.15;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        cursor: pointer;
        transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-feature-tab.active {
        color: var(--foreground);
        background: rgba(250, 250, 250, 0.1);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .mobile-feature-grid {
        grid-template-columns: 1fr !important;
        margin-top: 0;
    }

    .mobile-feature-panel {
        display: none;
    }

    .mobile-feature-panel.active {
        display: flex;
    }

    .top-tabs {
        position: fixed;
        left: max(10px, env(safe-area-inset-left));
        right: max(10px, env(safe-area-inset-right));
        bottom: max(10px, env(safe-area-inset-bottom));
        z-index: 1200;
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        align-items: center;
        justify-content: stretch;
        gap: 2px;
        width: auto;
        margin: 0;
        padding: 6px;
        border-radius: 18px;
        overflow: hidden;
        overscroll-behavior: contain;
        background: rgba(24, 24, 27, 0.96);
        border-color: rgba(255, 255, 255, 0.12);
        box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    .top-tab {
        position: relative;
        flex: none;
        min-width: 0;
        min-height: 54px;
        padding: 7px 2px 6px;
        flex-direction: column;
        gap: 4px;
        border-radius: 13px;
        font-size: 10px;
        line-height: 1.1;
        white-space: normal;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .top-tab:hover {
        background: transparent;
    }

    .top-tab.active {
        background: rgba(250, 250, 250, 0.1);
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    }

    .tab-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
        color: currentColor;
    }

    .tab-icon svg {
        width: 20px;
        height: 20px;
    }

    .tab-label {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .top-tabs .badge-history {
        position: absolute;
        top: 4px;
        right: 7px;
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        margin-left: 0 !important;
        border-radius: 999px;
        font-size: 10px;
        line-height: 16px;
        background: #ef4444;
        color: #ffffff;
    }

    .top-tabs .status-indicator {
        position: absolute;
        top: 7px;
        right: 11px;
        margin-left: 0 !important;
        width: 8px;
        height: 8px;
        border-radius: 999px;
        box-shadow: 0 0 0 2px rgba(24, 24, 27, 0.96);
    }

    .main-grid,
    .history-page-layout {
        padding-bottom: calc(104px + env(safe-area-inset-bottom));
    }

    #tab-history .history-page-layout {
        grid-template-columns: 1fr;
        gap: 0;
        margin-top: 0;
        padding-bottom: calc(128px + env(safe-area-inset-bottom));
    }

    #tab-history .card {
        padding: 12px;
    }

    #tab-history .card h2 {
        margin-bottom: 10px;
        font-size: 15px;
    }

    #tab-history .queue-section {
        border-bottom: 0 !important;
    }

    #tab-history .queue-header {
        padding: 10px 12px !important;
        border: 1px solid var(--border);
        border-radius: 10px 10px 0 0;
    }

    #tab-history .queue-header h4 {
        min-width: 0;
        font-size: 13px !important;
    }

    #tab-history .queue-list {
        max-height: calc(100vh - 250px) !important;
        border: 1px solid var(--border);
        border-top: 0;
        border-radius: 0 0 10px 10px;
    }

    #tab-history .history-toolbar-static {
        margin: 0 0 10px;
        padding: 0 0 10px;
    }

    #tab-history .drawer-toolbar {
        gap: 8px;
    }

    #tab-history .drawer-search input {
        height: 40px;
        padding: 9px 12px 9px 38px;
        font-size: 14px;
    }

    #tab-history .drawer-search::before {
        left: 12px;
        width: 15px;
        height: 15px;
    }

    #tab-history .drawer-filters {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    #tab-history .drawer-filters select,
    #tab-history .drawer-filters input[type="date"],
    #tab-history .drawer-filters .tool-btn {
        width: 100%;
        min-width: 0;
        min-height: 38px;
        padding: 8px 10px;
        font-size: 13px;
    }

    #tab-history .history-batch-toolbar {
        align-items: stretch;
        gap: 8px;
        padding: 10px;
        margin-bottom: 10px;
        border-radius: 10px;
        flex-wrap: wrap;
    }

    #tab-history .batch-count {
        flex: 1 1 100%;
        font-size: 13px;
    }

    #tab-history .history-list {
        padding: 8px;
        border-radius: 10px;
        margin-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    #tab-history .history-item {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        align-items: start;
        padding: 12px;
        margin-bottom: 8px;
    }

    #tab-history .history-text,
    #tab-history .history-item .info .text {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        white-space: normal;
        font-size: 13px;
        line-height: 1.45;
    }

    #tab-history .history-meta,
    #tab-history .history-item .info .meta {
        display: flex;
        flex-wrap: wrap;
        gap: 5px 7px;
        margin-top: 6px;
        font-size: 11px;
        line-height: 1.35;
    }

    #tab-history .history-item .info .meta .type-tag,
    #tab-history .history-item .info .meta .speaker {
        margin-right: 0;
    }

    #tab-history .history-item .actions {
        flex-direction: column;
        gap: 6px;
    }

    #tab-history .history-item .actions .btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        padding: 0;
        font-size: 13px;
    }
}

@media (max-width: 900px) and (max-height: 520px) {
    #tab-history .mobile-feature-tabs {
        top: 72px;
    }

    #tab-history .card {
        padding: 10px;
    }

    #tab-history .drawer-filters {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 380px) {
    .top-tabs {
        left: max(6px, env(safe-area-inset-left));
        right: max(6px, env(safe-area-inset-right));
        padding: 5px;
    }

    .top-tab {
        min-height: 50px;
        font-size: 9px;
    }

    .tab-icon,
    .tab-icon svg {
        width: 18px;
        height: 18px;
    }
}


/* ===== FFmpeg Tab Styles ===== */
.ffmpeg-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px 16px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    color: #71717a;
    font-size: 14px;
    text-align: center;
    min-height: 96px;
    user-select: none;
}
.ffmpeg-drop-zone:hover {
    border-color: #3b82f6;
    background: rgba(59,130,246,0.05);
    color: #93c5fd;
}

.ffmpeg-file-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ffmpeg-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #18181b;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}
.ffmpeg-file-idx {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #27272a;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    color: #a1a1aa;
}
.ffmpeg-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #e4e4e7;
}
.ffmpeg-file-size {
    flex-shrink: 0;
    font-size: 11px;
    color: #71717a;
}
.ffmpeg-file-actions {
    flex-shrink: 0;
    display: flex;
    gap: 2px;
}
.ffmpeg-file-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: #71717a;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
}
.ffmpeg-file-actions button:hover {
    background: #27272a;
    color: #e4e4e7;
}
