body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: relative;
    overflow-x: hidden;
}

/* 动态背景装饰 */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: float 6s ease-in-out infinite;
}

.shape-1 {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 120px;
    height: 120px;
    top: 60%;
    right: 15%;
    animation-delay: 2s;
}

.shape-3 {
    width: 60px;
    height: 60px;
    bottom: 20%;
    left: 20%;
    animation-delay: 4s;
}

.shape-4 {
    width: 100px;
    height: 100px;
    top: 10%;
    right: 25%;
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.5;
    }
    50% {
        transform: translateY(-20px) rotate(180deg);
        opacity: 0.8;
    }
}

.card {
    border: none;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.95);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(31, 38, 135, 0.5);
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom: none;
    border-radius: 20px 20px 0 0 !important;
    padding: 2rem 1.5rem;
    position: relative;
    overflow: hidden;
}

.card-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

.card-header h2 {
    color: #ffffff;
    margin: 0;
    font-weight: 600;
    font-size: 1.5rem;
    position: relative;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

.card-body {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 0 0 20px 20px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.history-container {
    max-height: 700px;
    overflow-y: auto;
    padding: 0.5rem;
}

.history-container::-webkit-scrollbar {
    width: 8px;
}

.history-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 4px;
}

.history-container::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 4px;
}

.history-container::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.3);
}

.history-item {
    border-radius: 15px;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    padding: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.1);
}

.history-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
    background: rgba(255, 255, 255, 0.95);
}

.btn-group .btn {
    margin-left: 5px;
}

footer {
    padding: 2rem;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 3rem;
}

footer a {
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s ease;
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

/* 音频播放器样式已在下方重新定义 */

.form-control {
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
}

.form-control:hover {
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(255, 255, 255, 0.95);
}

.btn {
    transition: all 0.3s ease;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border: none;
    position: relative;
    overflow: hidden;
    text-transform: none;
    letter-spacing: 0.5px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-info {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.4);
}

.btn-info:hover {
    background: linear-gradient(135deg, #68a9ef 0%, #0770c1 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(116, 185, 255, 0.6);
}

.btn-success {
    background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

.btn-success:hover {
    background: linear-gradient(135deg, #00a085 0%, #008f73 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.6);
}

.alert {
    border-radius: 10px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#loading {
    color: #6366f1;
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

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

.btn-warning {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    box-shadow: 0 4px 15px rgba(253, 203, 110, 0.4);
    color: #2d3436;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(253, 203, 110, 0.6);
    color: white;
}

/* 添加按钮点击反馈效果 */
.btn:active {
    transform: scale(0.98);
}

/* 改进标签样式 */
label {
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

/* 改进小提示文本 */
.form-text {
    font-size: 0.8rem;
    color: #636e72;
    margin-top: 0.25rem;
}

/* 改进音频播放器样式 */
#audio {
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.2);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* 改进容器样式 */
.container-fluid {
    padding: 2rem 1rem;
}

/* 添加悬浮提示框样式 */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1050;
    max-width: 300px;
}

.toast {
    min-width: 200px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    opacity: 0;
}

.toast.show {
    opacity: 1;
}

.toast-body {
    padding: 1rem;
    color: #fff;
    border-radius: 10px;
}

.toast-danger {
    background: linear-gradient(145deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff !important;
}

.toast-warning {
    background: linear-gradient(145deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff !important;
}

.toast-info {
    background: linear-gradient(145deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff !important;
}

.toast-success {
    background-color: #d4edda;
    color: #ffffff !important;
    background: linear-gradient(145deg, #10b981 0%, #059669 100%);
}

.toast-loading {
    background-color: #fff;
    color: #ffffff !important;
    background: linear-gradient(145deg, #6366f1 0%, #4f46e5 100%);
    border: 1px solid #e5e7eb;
}

/* Loading overlay */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
#loadingOverlay .spinner-border {
    width: 3rem;
    height: 3rem;
    color: #6366f1;
}

/* 自定义API管理相关样式 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 350px;
}

.toast {
    opacity: 0;
    transition: opacity 0.3s ease;
    margin-bottom: 10px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
}

.toast.show {
    opacity: 1;
}

.toast-body {
    padding: 0.75rem 1.25rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.toast-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.toast-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.toast-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.toast-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.toast-loading {
    background-color: #fff;
    color: #212529;
    border: 1px solid #dee2e6;
}

/* 改进历史记录项目样式 */
.history-item {
    transition: all 0.3s ease;
    cursor: pointer;
}

.history-item:hover {
    background-color: #f8f9fa;
}

/* 进度条样式 */
.progress {
    height: 8px;
    margin-top: 10px;
}

.progress-bar {
    transition: width 0.3s ease;
    background-color: #007bff;
}

/* API 管理模态框改进 */
#apiManagerModal .modal-dialog {
    max-width: 700px;
}

#savedApisList .list-group-item {
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

#savedApisList .list-group-item:hover {
    border-left-color: #007bff;
    background-color: #f8f9fa;
}

.api-selection-tools {
    background-color: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* 改进表单元素样式 */
.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* 按钮悬停动画 */
.btn {
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

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

/* 添加加载动画 */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.btn:disabled {
    animation: pulse 2s infinite;
    opacity: 0.6;
}

/* 添加渐入动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeInUp 0.6s ease-out;
}

.card:nth-child(2) {
    animation-delay: 0.2s;
}

/* 改进选择框样式 */
select.form-control {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* 去掉“选择API(#api)”和“选择语音(#speaker)”下拉框的自定义箭头与特效，避免双箭头并提升可读性 */
#api.form-control,
#speaker.form-control {
    background-image: none;
    padding-right: 1rem;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    height: 48px;
    min-height: 48px;
    font-size: 1.05rem;
    line-height: 1.6;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    appearance: auto;
    transition: none;
    box-shadow: none;
}

#api.form-control:hover,
#speaker.form-control:hover,
#api.form-control:focus,
#speaker.form-control:focus {
    box-shadow: none;
    transform: none;
}

/* 让“管理API”齿轮按钮与下拉框等高对齐 */
#manageApiBtn.btn {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
}

/* 去掉特定下拉框的特效并加大尺寸，以保证兼容性和可读性 */
#audioFormat.form-control,
#apiFormat.form-control {
    background-image: none;
    padding-right: 1rem;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    height: 48px;
    min-height: 48px;
    font-size: 1.05rem;
    line-height: 1.6;
    -webkit-appearance: auto;
    -moz-appearance: auto;
    appearance: auto;
    transition: none;
    box-shadow: none;
}

#audioFormat.form-control:hover,
#audioFormat.form-control:focus,
#apiFormat.form-control:hover,
#apiFormat.form-control:focus {
    box-shadow: none;
    transform: none;
}

/* 改进范围输入样式 */
.form-control-range {
    background: transparent;
    border: none;
    outline: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.form-control-range::-webkit-slider-thumb {
    appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    border: 2px solid #667eea;
}

.form-control-range::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    border: 2px solid #667eea;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

/* 响应式改进 */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    #savedApisList .list-group-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #savedApisList .list-group-item .btn-group {
        margin-top: 10px;
        align-self: flex-end;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .container-fluid {
        padding: 1rem 0.5rem;
    }
}

/* 强制音频播放器在小屏幕上换行，让进度条更易于操作 */
@media (max-width: 576px) {
    audio {
        height: 80px; /* 增加高度以容纳两行控件 */
    }

    /* 针对 WebKit 内核浏览器 (Chrome, Safari on iOS) */
    audio::-webkit-media-controls-panel {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
    }

    audio::-webkit-media-controls-timeline {
        order: -1; /* 将时间轴移动到最前面 */
        flex-basis: 100%; /* 确保它占据一整行 */
    }
}