/* 影视跟读 —— 只做视觉层，DOM 契约与 JS 逻辑不变 */

/* ---------- 资源异常提示 ---------- */
.media-tip {
    display: none;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: var(--r-sm);
    background: var(--danger-soft);
    border: 1px solid var(--danger-border);
    color: var(--danger-text-2);
    font-size: 13px;
    line-height: 1.6;
    text-align: left;
}

/* ---------- 播放器 ---------- */
.player {
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
}

video {
    display: block;
    width: 100%;
    max-height: 260px;
    border-radius: var(--r);
    background: var(--ink-950);
    margin-bottom: 12px;
}

.subtitle-wrapper {
    position: relative;
    display: block;
    width: 100%;
    padding: 14px 14px;
    border-radius: var(--r);
    background: linear-gradient(180deg, var(--player-top) 0%, var(--player-bottom) 100%);
    overflow: hidden;
    min-height: 62px;
}

.subtitle {
    position: relative;
    z-index: 2;
    /* 预留两行高度：中英切换 / 单行双语不再把容器顶高，下方按钮不会跟着跳 */
    min-height: 3em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.5;
    color: #fff;
    text-align: center;
    white-space: pre-wrap;
}

.subtitle-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    /* 用 transform 推进度（走合成层，不触发重排），而不是改 width */
    transform: scaleX(0);
    transform-origin: left center;
    will-change: transform;
    background: linear-gradient(90deg, rgba(99, 102, 241, .55) 0%, rgba(139, 92, 246, .35) 100%);
    z-index: 1;
}

/* 回放播放态：点下去必须有明确反馈（绿色 + 文案变「停止回放」） */
#play-recording.playing,
#play-dub.playing {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #fff !important;
}

.subtitle-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin: 10px 2px 2px;
    font-size: 12px;
    color: var(--text-3);
}

.zh-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-2);
    font-weight: 500;
}

/* ---------- 模式切换（分段控件） ---------- */
.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 16px 0;
    padding: 5px;
    background: var(--surface-3);
    border-radius: var(--r);
}

.mode-selector button {
    min-height: 42px;
    padding: 10px 12px;
    font-size: 14.5px;
    border-radius: 11px;
    background: transparent;
    color: var(--text-2);
    box-shadow: none;
}

.mode-selector button:hover { background: rgba(255, 255, 255, .7); color: var(--text); }

/* 渐进增强：JS 用 style.display 切换区域，这里用 :has() 反推当前模式
   （不支持 :has() 的浏览器只是没有高亮，不影响功能） */
.container:has(#sentence-area[style*="block"]) #mode-sentence,
.container:has(#dub-area[style*="block"]) #mode-dub {
    background: var(--surface);
    color: var(--brand);
    box-shadow: var(--sh-sm);
}

/* ---------- 句子导航 ---------- */
.line-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.nav-btn {
    min-height: 40px;
    padding: 9px 10px;
    font-size: 13.5px;
}

.line-pill {
    padding: 6px 12px;
    border-radius: var(--r-pill);
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

/* ---------- 录音控制 ---------- */
.record-controls {
    display: grid;
    gap: 10px;
}

.record-controls button { width: 100%; }

#record-btn.recording,
#dub-btn.recording {
    background: var(--danger-strong);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, .18);
    animation: talkie-rec-pulse 1.4s ease-in-out infinite;
}

@keyframes talkie-rec-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .35); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.status {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.6;
    min-height: 20px;
}

/* ---------- 评分卡 ---------- */
.score-card { text-align: left; }

.score-total {
    font-size: 40px;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.1;
    margin-bottom: 10px;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.score-item {
    padding: 10px 12px;
    margin: 8px 0;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    border: 1px solid var(--border);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    word-break: break-word;
}

.score-note {
    margin-top: 12px;
    padding: 12px;
    border-radius: var(--r-sm);
    background: var(--brand-soft);
    border: 1px solid var(--brand-chip-border);
    font-size: 12.5px;
    color: var(--text-2);
    line-height: 1.6;
}

.score-tips {
    margin-top: 14px;
    padding: 12px;
    border-radius: var(--r-sm);
    background: var(--warn-soft);
    border: 1px solid var(--warn-border);
    font-size: 12.5px;
    color: var(--warn-text);
    line-height: 1.6;
}

/* ---------- 移动端 ---------- */
@media (max-width: 600px) {
    .player { padding: 10px; }
    video { max-height: 210px; }
    .subtitle { font-size: 16px; }
    .mode-selector button { font-size: 14px; padding: 10px 8px; }
    .line-nav { grid-template-columns: 1fr auto 1fr; }
    .nav-btn { font-size: 13px; padding: 9px 6px; }
    .score-total { font-size: 34px; }
}
