/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* 容器 */
.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 头部 */
header {
    background: linear-gradient(to right, #4a6fa5, #3a5f8a);
    color: white;
    padding: 0.5rem;
    text-align: center;
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主要内容 */
.main-content {
    padding: 2.5rem;
}

/* 文本输入 */
.text-input {
    margin-bottom: 2rem;
}

.text-input label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #4a6fa5;
    font-size: 1.1rem;
}

#textInput {
    width: 100%;
    min-height: 200px;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1.8;
    resize: vertical;
    transition: all 0.3s;
    font-family: inherit;
}

#textInput:focus {
    outline: none;
    border-color: #4a6fa5;
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.2);
}

.text-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    color: #666;
    font-size: 0.9rem;
}

/* 控制区域 */
.controls {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #4a6fa5;
    font-size: 1rem;
}

/* 下拉选择框 */
select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

select:focus {
    outline: none;
    border-color: #4a6fa5;
}

/* 滑块 */
input[type="range"] {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: #4a6fa5;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.speed-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 0.9rem;
    color: #666;
}

/* 播放控制 */
.playback-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.btn-primary, .btn-secondary {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(to right, #4a6fa5, #3a5f8a);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(74, 111, 165, 0.3);
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-primary:disabled, .btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.status {
    margin-left: auto;
    padding: 10px 15px;
    background: white;
    border-radius: 8px;
    font-weight: 500;
    color: #4a6fa5;
    border: 1px solid #e0e0e0;
    min-width: 150px;
    text-align: center;
}

/* 音频播放器 */
.audio-player {
    margin: 2rem 0;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

audio {
    width: 100%;
    border-radius: 8px;
}

/* 提示区域 */
.tips {
    background: #e8f4f8;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 5px solid #4a6fa5;
}

.tips h3 {
    color: #4a6fa5;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tips ul {
    padding-left: 20px;
}

.tips li {
    margin-bottom: 8px;
    color: #555;
}

/* 页脚 */
footer {
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    color: #666;
}

.help-link a {
    color: #4a6fa5;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.help-link a:hover {
    text-decoration: underline;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal h2 {
    color: #4a6fa5;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal ol {
    padding-left: 25px;
    margin: 1.5rem 0;
}

.modal li {
    margin-bottom: 12px;
    line-height: 1.6;
}

.modal pre {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Consolas', monospace;
    margin: 1.5rem 0;
    border: 1px solid #e0e0e0;
}

.modal a {
    color: #4a6fa5;
    text-decoration: none;
    font-weight: 500;
}

.modal a:hover {
    text-decoration: underline;
}

/* 响应式设计 - 移动端优化 */
@media (max-width: 768px) {
    body {
        padding: 0;
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .container {
        border-radius: 0;
        min-height: 100vh;
        box-shadow: none;
    }
    
    header {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.3rem;
        flex-direction: row;
        gap: 8px;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    /* 文本输入区域优化 */
    .text-input {
        margin-bottom: 1.5rem;
    }
    
    .text-input label {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    #textInput {
        min-height: 150px;
        padding: 12px;
        font-size: 16px; /* 防止iOS缩放 */
        line-height: 1.6;
    }
    
    .text-stats {
        font-size: 0.85rem;
        margin-top: 8px;
    }
    
    /* 控制区域优化 */
    .controls {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .control-group {
        margin-bottom: 1.2rem;
    }
    
    .control-group label {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    
    /* 下拉选择框优化 */
    select {
        padding: 10px 12px;
        font-size: 16px; /* 防止iOS缩放 */
        min-height: 44px; /* 触摸友好 */
    }
    
    /* 滑块优化 */
    input[type="range"] {
        height: 6px;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    
    .speed-labels {
        font-size: 0.8rem;
    }
    
    /* 播放控制按钮优化 */
    .playback-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 1rem;
    }
    
    .btn-primary, .btn-secondary {
        padding: 12px 20px;
        font-size: 1rem;
        min-height: 48px; /* 触摸友好 */
        flex: 1;
        min-width: 80px;
        justify-content: center;
    }
    
    .btn-primary i, .btn-secondary i {
        font-size: 1.1rem;
    }
    
    .status {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
        min-width: auto;
        padding: 8px 12px;
        font-size: 0.9rem;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 音频播放器优化 */
    .audio-player {
        margin: 1.5rem 0;
    }
    
    audio {
        height: 40px;
    }
    
    /* 页脚优化 */
    footer {
        padding: 1rem;
        font-size: 0.8rem;
    }
    
    /* 模态框优化 */
    .modal-content {
        padding: 1.2rem;
        margin: 20px;
        width: calc(100% - 40px);
        max-height: 85vh;
    }
    
    .modal h2 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    /* 加载动画优化 */
    .loading-content {
        padding: 1.5rem;
        margin: 20px;
        max-width: 280px;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
        border-width: 3px;
    }
    
    .loading-text {
        font-size: 1.1rem;
    }
    
    .loading-subtext {
        font-size: 0.9rem;
    }
}

/* 超小屏幕优化 */
@media (max-width: 375px) {
    header h1 {
        font-size: 1.1rem;
    }
    
    .btn-primary, .btn-secondary {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    #textInput {
        min-height: 120px;
    }
}

/* 大屏手机优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 95%;
        margin: 10px auto;
    }
    
    .main-content {
        padding: 2rem;
    }
}

/* 加载动画 */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 1.5s infinite;
    color: #4a6fa5;
}

/* 全屏加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-content {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: loadingPop 0.3s ease-out;
}

@keyframes loadingPop {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    border: 4px solid #e0e0e0;
    border-top-color: #4a6fa5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: #4a6fa5;
    margin-bottom: 0.5rem;
}

.loading-subtext {
    font-size: 1rem;
    color: #888;
}

/* 配置模态框样式 */
.service-config {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.service-config h3 {
    color: #4a6fa5;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-config h3 i.fa-bolt {
    color: #ff9800;
}

.service-config h3 i.fa-cloud {
    color: #2196f3;
}

.service-config p strong {
    color: #555;
}

.config-tips {
    background: #e8f4f8;
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1.5rem 0;
    border-left: 5px solid #4caf50;
}

.config-tips h4 {
    color: #4caf50;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-tips ul {
    padding-left: 20px;
    margin: 10px 0;
}

.config-tips li {
    margin-bottom: 8px;
    color: #555;
}