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

body {
    font-family: Arial, sans-serif;
    background-color: #121212;
    color: #ffffff;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部导航框 */
.top-nav {
    display: flex;
    align-items: center;
    background-color: #1e1e1e;
    padding: 10px 20px;
    border-bottom: 1px solid #333;
}

.nav-left {
    width: 200px;
}

.nav-center {
    flex: 1;
    text-align: center;
}

.nav-right {
    width: 250px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.top-nav h1 {
    font-size: 18px;
    color: #ffffff;
}

.top-nav .nav-center {
    flex: 1;
    text-align: center;
}

.top-nav .site-name {
    font-size: 18px;
    font-weight: bold;
    color: #ffffff;
    text-align: center;
}

body.light .top-nav .site-name {
    color: #333;
}

.top-nav .language-toggle {
    margin: 0 10px 0 0;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: 1px solid #333;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ffffff;
    position: relative;
}

.top-nav .language-toggle:hover {
    background-color: #333;
}

.top-nav .language-toggle .lang-zh,
.top-nav .language-toggle .lang-en {
    font-size: 12px;
    font-weight: bold;
}

.top-nav .language-toggle .lang-en {
    display: none;
}

.top-nav .language-toggle.language-english .lang-zh {
    display: none;
}

.top-nav .language-toggle.language-english .lang-en {
    display: block;
}

.top-nav .theme-toggle {
    margin: 0;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: 1px solid #333;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ffffff;
    position: relative;
}

.top-nav .theme-toggle:hover {
    background-color: #333;
}

body.light .top-nav .language-toggle {
    border-color: #ddd;
    color: #333;
}

body.light .top-nav .language-toggle:hover {
    background-color: #ddd;
}

body.light .top-nav .theme-toggle {
    border-color: #ddd;
    color: #333;
}

body.light .top-nav .theme-toggle:hover {
    background-color: #ddd;
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    position: absolute;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s ease;
}

/* 默认状态（深色模式）：显示太阳（切换到浅色） */
body.dark .theme-toggle .sun-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

body.dark .theme-toggle .moon-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

/* 浅色模式：显示月亮（切换到深色） */
body.light .theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

body.light .theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧导航栏 */
.sidebar {
    width: 240px;
    background-color: #1e1e1e;
    padding: 20px;
    border-right: 1px solid #333;
}

.sidebar h2 {
    font-size: 18px;
    margin-bottom: 30px;
    color: #ffffff;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: calc(100% - 20px); /* 使用计算宽度，确保在侧边栏内完全显示 */
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar li:hover {
    background-color: #333;
}

.sidebar li.active {
    background-color: #333;
    font-weight: bold;
}

/* 主内容区 */
.main-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    background-color: #121212;
}

.main-content h1 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #ffffff;
    /* 保持原有的流式布局，不设置固定宽度，让文本自然换行 */
}

/* 文本输入区 */
.input-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

#text-input {
    flex: 1;
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 15px;
    color: #ffffff;
    font-size: 16px;
    resize: none;
    margin-bottom: 15px;
}

#text-input::placeholder {
    color: #666;
}

#speak-btn {
    align-self: flex-end;
    background-color: #333;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    min-width: 80px; /* 使用最小宽度，确保中英文切换时大小一致 */
    text-align: center;
    white-space: nowrap; /* 防止文本换行 */
}

#speak-btn:hover {
    background-color: #444;
}

/* 音频控制区 */
.audio-controls {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid #333;
}

/* 状态文本 */
#audio-controls #status,
#audio-controls status,
#status {
    margin-left: 10px;
    color: #666;
    font-size: 14px;
    width: 100px; /* 固定文本宽度，避免影响进度条位置 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 进度条容器 */
.progress-container {
    width: 400px; /* 固定进度条长度 */
    margin-left: 10px;
    flex-shrink: 0; /* 防止进度条被压缩 */
}

/* 进度条样式 */
#progress-bar {
    width: 100%;
    background-color: #333;
    height: 6px;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

/* 进度条滑块样式 */
#progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #555;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: -5px; /* 调整滑块位置，使其垂直居中 */
}

#progress-bar::-webkit-slider-thumb:hover {
    background-color: #666;
}

/* Firefox 进度条样式 */
#progress-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #555;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s;
}

#progress-bar::-moz-range-thumb:hover {
    background-color: #666;
}

/* 进度条轨道样式 */
#progress-bar::-moz-range-track {
    background-color: #333;
    height: 6px;
    border-radius: 3px;
}

#progress-bar::-webkit-slider-runnable-track {
    background-color: #333;
    height: 6px;
    border-radius: 3px;
}

#audio-controls button {
    background-color: #333;
    color: #ffffff;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

#audio-controls button:hover {
    background-color: #444;
}

#status {
    margin-left: 10px;
    color: #666;
    font-size: 14px;
}

/* 右侧控制区 */
.controls {
    width: 250px;
    background-color: #1e1e1e;
    padding: 20px;
    border-left: 1px solid #333;
}

.controls h3 {
    font-size: 16px;
    margin-bottom: 20px;
    color: #ffffff;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: #ffffff;
    font-size: 14px;
}

.control-group select {
    width: 100%;
    background-color: #333;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px;
    color: #ffffff;
    font-size: 14px;
}

.control-group select option {
    background-color: #333;
    color: #ffffff;
}

/* 按钮样式 */
button {
    background-color: #333;
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

/* 播放按钮样式，确保图标大小一致 */
#audio-controls button,
#play-btn,
#download-btn {
    width: 40px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 16px;
}

/* 下载按钮样式 - 极简风 */
.download-btn {
    margin-left: 10px;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    width: 40px; /* 固定宽度，确保中英文切换时大小一致 */
    height: 32px; /* 固定高度，确保中英文切换时大小一致 */
}

.download-btn::before {
    content: '↓';
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
}

/* 音频控制区布局调整 */
.audio-controls {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid #333;
    justify-content: space-between;
}

.audio-controls > div {
    flex: 1;
    margin: 0 10px;
}

button:hover {
    background-color: #444;
}

button:disabled {
    background-color: #222;
    color: #666;
    cursor: not-allowed;
}

/* 主题切换按钮 */
/* 隐藏多余的主题切换样式，改用顶部导航样式 */
.theme-toggle {
    overflow: hidden;
}

/* 浅色主题样式 */
body.light {
    background-color: #f5f5f5;
    color: #333;
}

body.light .container {
    background-color: #f5f5f5;
}

body.light .sidebar {
    background-color: #ffffff;
    border-right: 1px solid #ddd;
}

body.light .sidebar h2 {
    color: #333;
}

body.light .sidebar li {
    color: #333;
}

body.light .sidebar li:hover {
    background-color: #f0f0f0;
}

body.light .sidebar li.active {
    background-color: #f0f0f0;
    color: #333;
}

body.light .main-content {
    background-color: #f5f5f5;
}

body.light .main-content h1 {
    color: #333;
}

body.light textarea {
    background-color: #ffffff !important;
    border: 1px solid #ddd !important;
    color: #333 !important;
}

body.light textarea::placeholder {
    color: #999 !important;
}

body.light button {
    background-color: #e0e0e0 !important;
    color: #333 !important;
}

body.light button:hover {
    background-color: #d0d0d0 !important;
}

body.light .audio-controls {
    border-top: 1px solid #ddd;
}

body.light #status {
    color: #666;
}

body.light .progress-container input[type="range"] {
    background-color: #ddd;
}

body.light .progress-container input[type="range"]::-webkit-slider-thumb {
    background-color: #666;
}

body.light .progress-container input[type="range"]::-webkit-slider-thumb:hover {
    background-color: #555;
}

body.light .progress-container input[type="range"]::-moz-range-thumb {
    background-color: #666;
}

body.light .progress-container input[type="range"]::-moz-range-thumb:hover {
    background-color: #555;
}

body.light .progress-container input[type="range"]::-moz-range-track {
    background-color: #ddd;
}

body.light .progress-container input[type="range"]::-webkit-slider-runnable-track {
    background-color: #ddd;
}

body.light .controls {
    background-color: #ffffff;
    border-left: 1px solid #ddd;
}

body.light .controls h3 {
    color: #333;
}

body.light .control-group label {
    color: #333;
}

body.light .control-group select {
    background-color: #ffffff;
    border: 1px solid #ddd;
    color: #333;
}

body.light .control-group select option {
    background-color: #ffffff;
    color: #333;
}

/* 移除旧的重复样式 */

body.light .top-nav {
    background-color: #ffffff;
    border-bottom: 1px solid #ddd;
}

body.light .top-nav h1, body.light .top-nav h2, body.light .top-nav h3 {
    color: #333;
}