* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    background: #f0f2f5;
    color: #1e293b;
    line-height: 1.5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    background: white;
    padding: 15px 25px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

h1 {
    color: #2563eb;
    font-weight: 600;
    font-size: 1.8rem;
}

.session-control input {
    padding: 10px 15px;
    margin-right: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    font-size: 14px;
    width: 200px;
    outline: none;
    transition: border 0.2s;
}
.session-control input:focus {
    border-color: #2563eb;
}

button {
    padding: 10px 20px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(37,99,235,0.2);
}
button:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37,99,235,0.3);
}
button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

#learning-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* 左侧视频卡片 */
.video-section {
    background: white;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1);
}
.video-section video {
    width: 100%;
    max-height: 300px;
    background: #000;
    border-radius: 16px;
}

.subtitle-area {
    margin-top: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 16px;
    border-left: 4px solid #2563eb;
}
#subtitle-en {
    font-size: 1.2rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
}
#subtitle-zh {
    color: #475569;
    font-size: 1rem;
}

/* 字幕区域样式 */
.subtitle-area {
    position: relative;
    overflow: visible;
    min-height: 100px;
    padding: 20px; /* 减少内边距，优化空间利用 */
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 字幕蒙版层 */
.subtitle-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(241, 245, 249, 0.85); /* 更不透明的蒙版 */
    backdrop-filter: blur(4px); /* 增加模糊程度 */
    z-index: 3; /* 在字幕内容之上 */
    transition: opacity 0.3s ease;
    border-radius: 12px;
}

.subtitle-mask.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 控制按钮区域 */
.control-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 10; /* 确保在蒙版之上 */
}

/* 字幕控制按钮容器 */
.subtitle-control {
    opacity: 1; /* 始终完全显示 */
    transition: all 0.2s ease;
    pointer-events: auto; /* 始终可点击 */
}

.subtitle-control:hover {
    transform: translateY(-1px);
}

/* 字幕控制按钮样式 */
.subtitle-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.3);
    font-weight: 600;
    letter-spacing: 0.5px;
    min-width: 120px;
}

.subtitle-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.subtitle-btn.active {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.3);
}

.subtitle-btn.active:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 5px 15px rgba(239, 68, 68, 0.4);
}

/* 字幕内容样式 */
#subtitle-en, #subtitle-zh {
    margin: 0;
    padding: 0;
    line-height: 1.7;
    font-size: 1.15rem;
    color: #1e293b;
    z-index: 2;
    position: relative;
    word-wrap: break-word;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#subtitle-en {
    margin-bottom: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: linear-gradient(90deg, #1e293b 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: #0f172a;
}

#subtitle-en:empty {
    background: none;
    -webkit-text-fill-color: initial;
}

#subtitle-zh {
    color: #475569;
    font-style: italic;
    font-weight: 500;
    border-left: 3px solid #cbd5e1;
    padding-left: 12px;
    margin-left: 5px;
}

/* 句子信息样式 */
.sentence-info {
    background: #f0f9ff !important;
    padding: 15px !important;
    border-radius: 12px !important;
    margin: 15px 0 !important;
    border: 1px solid #bae6fd !important;
    z-index: 2;
    position: relative;
}
#explain-box, #key-phrases {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

/* 右侧面板 */
.practice-section {
    background: white;
    border-radius: 24px;
    padding: 25px;
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1);
    display: flex;
    flex-direction: column;
    height: fit-content;
}

#step-name {
    color: #2563eb;
    font-weight: 600;
    margin-bottom: 10px;
}

.step-progress {
    display: flex;
    gap: 8px;
    margin: 20px 0;
    justify-content: space-between;
}
.step-indicator {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #475569;
    transition: all 0.2s;
}
.step-indicator.active {
    background: #2563eb;
    color: white;
    box-shadow: 0 4px 8px rgba(37,99,235,0.3);
}

/* 操作栏：录音+按钮 */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 10px 0;
    background: #f8fafc;
    padding: 8px 16px;
    border-radius: 40px;
}

.recording-area {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1; /* 占据剩余空间，让按钮靠右 */
}

.record-btn {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 30px;
    background: #2563eb;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(239,68,68,0.2);
    transition: all 0.2s;
    line-height: 1;
    white-space: nowrap;
    min-width: 25px; /* 保证足够宽度 */
}
.record-btn.recording {
    background: #ef4444;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#submit-btn:hover {
    background: #059669;
}

.nav-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto; /* 新增，使其靠右 */
}
.nav-buttons button {
    padding: 8px 12px;
    font-size: 14px;
    min-width: 80px;
    background: #64748b;
}
.nav-buttons button:hover {
    background: #475569;
}

/* 结果区域 */
.result-area {
    margin-top: 20px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 20px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

#evaluation-content p {
    margin: 10px 0;
}
#evaluation-content strong {
    color: #2563eb;
}

#explanation-content {
    line-height: 1.6;
}
#explanation-content p {
    margin: 12px 0;
}
#explanation-content ul {
    margin: 8px 0 8px 20px;
}
#explanation-content li {
    margin: 4px 0;
}

/* 加载中 */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    backdrop-filter: blur(4px);
    z-index: 1000;
}

#record-status {
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

#audio-preview {
    width: 250px;        /* 固定宽度，足够显示时间 */
    height: 36px;
    border-radius: 18px;
    background: #e9eef2;
}

#submit-btn {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 20px;
    white-space: nowrap;
    background: #10b981;
    color: white;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

.custom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 5px 10px;
    background: #f0f0f0;
    border-radius: 20px;
}

#play-pause-btn {
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-container {
    flex: 1;
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: #2563eb;
    border-radius: 4px;
    width: 0%;
}

#time-display {
    font-size: 14px;
    color: #333;
    min-width: 80px;
    text-align: center;
}

.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 10;
    display: none;
}
.video-section {
    position: relative; /* 使绝对定位相对于此 */
}

#playback-rate {
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 4px;
    font-size: 14px;
    cursor: pointer;
}

.rank-section {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}
.rank-section h3 {
    margin-bottom: 10px;
    color: #2563eb;
}
#rank-list {
    list-style: none;
    padding: 0;
}
#rank-list li {
    padding: 5px 0;
    border-bottom: 1px solid #e2e8f0;
}
.rank-section {
    margin-top: 30px;
}