/* ==========================================================================
   DocuCast Pro - Claude 风格配色系统
   核心目标：温暖的米白背景 + 深黑文字 + 橙红强调色
   ========================================================================== */

:root {
    /* 主色调 - 温暖的橙红色系 */
    --color-primary: #D97736;
    --color-primary-hover: #C46A30;
    --color-primary-light: #F5A623;
    
    /* 背景色 - 温暖的米白色 */
    --color-bg-primary: #FAF8F5;
    --color-bg-secondary: #FFFFFF;
    --color-bg-tertiary: #F5F0EA;
    
    /* 文字颜色 */
    --color-text-primary: #1A1A1A;
    --color-text-secondary: #4A4A4A;
    --color-text-tertiary: #6B6B6B;
    --color-text-muted: #9A9A9A;
    
    /* 边框与分隔线 */
    --color-border: #E5E0D8;
    --color-border-light: #F0EBE5;
    --color-divider: #EDE8E2;
    
    /* 按钮颜色 */
    --btn-primary-bg: #1A1A1A;
    --btn-primary-text: #FFFFFF;
    --btn-secondary-bg: transparent;
    --btn-secondary-border: #D9D3CC;
    --btn-secondary-text: #1A1A1A;
    
    /* 间距系统 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-4xl: 96px;
    
    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
    
    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-hover: 0 12px 32px rgba(0,0,0,0.15);
    
    /* 字体 */
    --font-serif: 'Georgia', 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Fira Code', 'Monaco', 'Consolas', monospace;

    /* 保留旧变量名兼容 */
    --morandi-pink: #E5C7C7;
    --morandi-blue: #7A9EB1;
    --morandi-green: #8AA98A;
    --morandi-yellow: #E5D8B8;
    --morandi-purple: #C9B5C9;
    --morandi-gray: #C0C0C0;
    --morandi-dark: #6B6B6B;
    --bg-light: var(--color-bg-primary);
    --text-dark: var(--color-text-primary);
    --text-light: var(--color-text-tertiary);
    --white: var(--color-bg-secondary);
    --shadow: var(--shadow-md);
    --shadow-hover: var(--shadow-hover);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 95%;
    min-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ==========================================================================
   头部区域 - 应用标题
   ========================================================================== */

.app-header {
    text-align: center;
    margin-bottom: 40px;
}

.app-header h1 {
    font-family: var(--font-serif);
    font-size: 3rem;
    font-weight: 400;
    color: var(--color-text-primary);
    margin-bottom: 12px;
    line-height: 1.2;
}

.app-header p {
    font-size: 1.125rem;
    color: var(--color-text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ==========================================================================
   上传区域
   ========================================================================== */

.upload-section {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid var(--color-border-light);
}

.upload-box {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 14px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--color-bg-primary);
}

.upload-box:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.upload-icon {
    font-size: 36px;
    margin-bottom: 10px;
    opacity: 0.8;
}

.upload-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 8px;
}

.upload-hint {
    color: var(--color-text-tertiary);
    font-size: 0.9375rem;
}

.upload-status {
    margin-top: 20px;
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    padding: 12px 16px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    display: none;
}

.upload-status.show {
    display: inline-block;
}

/* ==========================================================================
   讲师设定面板
   ========================================================================== */

.persona-config-panel {
    margin-top: 10px;
    padding: 10px;
    background: var(--color-bg-primary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border-light);
    text-align: left;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn { 
    from { opacity: 0; transform: translateY(-10px); } 
    to { opacity: 1; transform: translateY(0); } 
}

.chat-bubble {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    padding: 12px 20px;
    border-radius: var(--radius-xl);
    border-bottom-left-radius: var(--radius-sm);
    display: inline-block;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.chat-bubble.ai {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.preset-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10 px;
}

.preset-btn {
    padding: 10px 18px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}

.preset-btn:hover { 
    border-color: var(--color-primary); 
    color: var(--color-primary); 
    background: var(--color-bg-tertiary);
}

.preset-btn.active { 
    background: var(--btn-primary-bg); 
    color: var(--btn-primary-text); 
    border-color: var(--btn-primary-bg); 
}

.custom-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

.persona-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    outline: none;
    font-size: 0.9375rem;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    transition: all 0.2s;
}

.persona-input:focus { 
    border-color: var(--color-primary); 
    box-shadow: 0 0 0 3px rgba(217, 119, 54, 0.1); 
}

.persona-input::placeholder {
    color: var(--color-text-muted);
}

#startTaskBtn {
    margin-top: 8px;
    width: 100%;
    background: var(--btn-primary-bg) !important;
    color: var(--btn-primary-text) !important;
    padding: 14px !important;
    font-size: 1rem !important;
    border-radius: var(--radius-md) !important;
    border: none !important;
    cursor: pointer !important;
    font-weight: 500 !important;
    transition: all 0.2s !important;
}

#startTaskBtn:hover {
    background: var(--btn-primary-hover) !important;
    transform: translateY(-1px) !important;
    box-shadow: var(--shadow-md) !important;
}

/* ==========================================================================
   任务列表区域
   ========================================================================== */

.tasks-section {
    background: var(--color-bg-secondary);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border-light);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.refresh-btn {
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}

.refresh-btn:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.table-container {
    overflow-x: auto;
}

.tasks-table {
    width: 100%;
    border-collapse: collapse;
}

.tasks-table th, .tasks-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

.tasks-table th {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tasks-table td {
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
}

.tasks-table tr:hover td {
    background: var(--color-bg-tertiary);
}

.status-badge {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 500;
    display: inline-block;
}

.status-completed { 
    background: var(--badge-completed-bg); 
    color: var(--badge-completed-text); 
}
.status-pending { 
    background: var(--badge-pending-bg); 
    color: var(--badge-pending-text); 
}
.status-failed { 
    background: var(--badge-failed-bg); 
    color: var(--badge-failed-text); 
}
.status-blocked { 
    background: var(--badge-blocked-bg); 
    color: var(--badge-blocked-text); 
}
.status-running { 
    background: var(--badge-running-bg); 
    color: var(--badge-running-text);
}

/* ==========================================================================
   状态列固定宽度 - 解决列表宽度跳动问题
   ========================================================================== */

/* 状态列固定宽度（第2列） */
.tasks-table th:nth-child(2),
.tasks-table td:nth-child(2) {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    text-align: center;
    white-space: nowrap;
}

/* 状态文本超出时显示省略号 */
.tasks-table td:nth-child(2) .status-badge,
.tasks-table td:nth-child(2) span:not(.status-badge) {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}

.progress-bar {
    width: 120px;
    height: 8px;
    background: var(--color-border-light);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 6px;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    transition: width 0.3s ease;
    border-radius: var(--radius-full);
}

.action-btn {
    padding: 8px 14px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.8125rem;
    margin-right: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.action-btn.play { 
    background: var(--btn-primary-bg); 
    color: var(--btn-primary-text);
}
.action-btn.play:hover {
    background: var(--btn-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.action-btn.delete { 
    background: transparent; 
    color: var(--color-danger);
    border: 1px solid var(--color-border);
}
.action-btn.delete:hover {
    background: var(--color-danger-bg);
    border-color: var(--color-danger);
}

.action-btn.retry { 
    background: transparent; 
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}
.action-btn.retry:hover {
    background: var(--color-bg-tertiary);
    border-color: var(--color-text-secondary);
}

.pagination {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.pagination button {
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    transition: all 0.2s;
    min-width: 36px;
}

.pagination button:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-bg-tertiary);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: var(--color-border-light);
}

.pagination button.active {
    background: var(--color-text-primary);
    color: var(--color-bg-secondary);
    border-color: var(--color-text-primary);
}

/* ==========================================================================
   ⭐ 播放器模态框 - 保持原始样式（禁止修改区域）
   ========================================================================== */

.streaming-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(10, 10, 15, 0.15);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.streaming-modal.show { display: flex; opacity: 1; }

.streaming-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 75vh;
    background: #000;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.close-video-btn {
    position: absolute;
    top: 15px; right: 20px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px; height: 36px;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    transition: background 0.3s;
}
.close-video-btn:hover { background: #E5C7C7; }

/* 舞台区 */
.stage-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
}

.image-viewport {
    position: relative;
    overflow: hidden;
    background-color: #08090d;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 沉浸式字幕 */
.subtitle-overlay {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 80%;
    background: rgba(10, 10, 15, 0.85);
    padding: 12px 25px;
    border-left: 4px solid #8AA98A;
    border-radius: 4px;
    font-size: 1.3rem;
    font-weight: 500;
    color: #fff;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    text-align: center;
}

/* 控制台（方案D 双层轨道：11px页轨 + 3px间隙 + 38px句轨） */
.control-console {
    height: 72px;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 15px;
    border-top: 1px solid #333;
}

.ctrl-btn {
    background: #8AA98A;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.ctrl-btn:hover { filter: brightness(1.1); }

/* ===== 方案D 双层时间轴容器（详细规则见文件末尾方案D区块） ===== */
.timeline-container {
    flex: 1;
    height: 54px;
    position: relative;
    margin: 0 15px;
    min-width: 0;
}

.page-indicator {
    color: #999;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

#stageImage {
    width: 100%; 
    height: 100%;
    object-fit: contain;
    transition: filter 0.6s ease;
}

/* 坐标画笔动画 */
.coordinate-box {
    position: absolute;
    box-sizing: border-box;
    pointer-events: none;
    display: none;
    z-index: 20;
}

.coordinate-box.active {
    display: block;
}

.brush-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.brush-path {
    fill: none;
    stroke: #ff2d55;
    stroke-width: 4.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.95;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.coordinate-box.active .brush-path {
    animation: 
        draw-stroke 0.5s cubic-bezier(0.1, 0.8, 0.25, 1) forwards,
        fade-out-brush 0.3s cubic-bezier(0.25, 1, 0.5, 1) 0.5s forwards;
}

@keyframes draw-stroke {
    to { stroke-dashoffset: 0; }
}

@keyframes fade-out-brush {
    to { 
        opacity: 0; 
        transform: scale(1.03); 
        transform-origin: center;
    }
}

/* ==========================================================================
   持久化相框层 #bboxFrame（手工拖拽调整红圈 bbox 坐标）
   ---------------------------------------------------------------------------
   与 #animBox（瞬时红圈, pointer-events:none, z-index:20）解耦：
     - .bbox-frame 用 z-index:15；animBox 虽然 z-index 更高，但 pointer-events:none
       会让鼠标穿透到下方的 bbox-frame，因此两层不冲突。
     - 引导浮标/气泡用 z-index:30（最上层）。
   主色 #ff2d55（玫红）与红圈同色系；透明度针对暗底 #08090d 校准可辨度。
   ========================================================================== */

/* === 1. .bbox-frame 基础 + 三态（浏览/编辑/hover） === */
.bbox-frame {
    position: absolute;
    box-sizing: border-box;
    z-index: 15;
    pointer-events: auto;
    border-radius: 4px;
    display: none;
    transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease,
                border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

/* 由 JS 控制 display */
.bbox-frame.show {
    display: block;
}

/* 浏览态：虚线半透，暗底可辨 */
.bbox-frame.mode-browse {
    cursor: pointer;
    border: 1.5px dashed rgba(255, 45, 85, 0.05);
    background: rgba(255, 45, 85, 0.01);
}

/* 浏览态 hover 高亮 */
.bbox-frame.mode-browse:hover {
    border-color: rgba(255, 45, 85, 0.8);
    background: rgba(255, 45, 85, 0.07);
    box-shadow: 0 0 0 1px rgba(255, 45, 85, 0.3);
}

/* 编辑态：实线高亮 + 双层阴影；覆写 transition，去掉位移过渡避免拖拽跟手延迟 */
.bbox-frame.mode-edit {
    cursor: move;
    border: 1.5px solid rgba(255, 45, 85, 0.9);
    background: rgba(255, 45, 85, 0.08);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 4px 16px rgba(255, 45, 85, 0.25);
    transition: border-color .2s, background .2s, box-shadow .2s;
    touch-action: none;
}

/* === 2. 8 个缩放手柄 .bbox-handle === */
.bbox-handle {
    display: none;
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 2px solid #ff2d55;
    border-radius: 2px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    touch-action: none;
}

/* 命中区域扩张（不可见，仅扩大点击容差） */
.bbox-handle::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 4px;
}

/* 编辑态显示手柄 */
.bbox-frame.mode-edit .bbox-handle {
    display: block;
}

/* 8 方位定位 + 方向 cursor（n/s/e/w 保留 translate） */
.bbox-handle[data-handle="nw"] { top: -6px; left: -6px; cursor: nwse-resize; }
.bbox-handle[data-handle="n"]  { top: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.bbox-handle[data-handle="ne"] { top: -6px; right: -6px; cursor: nesw-resize; }
.bbox-handle[data-handle="e"]  { top: 50%; right: -6px; transform: translateY(-50%); cursor: ew-resize; }
.bbox-handle[data-handle="se"] { bottom: -6px; right: -6px; cursor: nwse-resize; }
.bbox-handle[data-handle="s"]  { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.bbox-handle[data-handle="sw"] { bottom: -6px; left: -6px; cursor: nesw-resize; }
.bbox-handle[data-handle="w"]  { top: 50%; left: -6px; transform: translateY(-50%); cursor: ew-resize; }

/* === 3. hover 微型浮标 .hint-pill（仅浏览态显示，文案由 JS 注入 textContent） === */
.hint-pill {
    position: absolute;
    top: -26px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 8px;
    background: rgba(10, 10, 15, 0.9);
    color: #fff;
    font-size: 11px;
    line-height: 1.4;
    border-radius: 9999px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}

.bbox-frame.mode-browse:hover .hint-pill {
    opacity: 1;
}

/* === 4. 首次引导气泡 .coach-bubble（挂在 .image-viewport 上, z-index:30；top/left 由 JS inline 写入） === */
.coach-bubble {
    position: absolute;
    z-index: 30;
    max-width: 220px;
    padding: 10px 12px;
    background: #fff;
    color: #222;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    font-size: 12px;
    line-height: 1.5;
    animation: bubble-in .3s ease-out;
}

/* 小三角（底部居中） */
.coach-bubble::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: #fff;
    border-right: 1px solid rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

/* 关闭按钮（文案/符号由 JS 注入） */
.coach-bubble .close {
    position: absolute;
    top: 4px;
    right: 6px;
    border: none;
    background: none;
    cursor: pointer;
    color: #999;
    font-size: 14px;
    line-height: 1;
}

@keyframes bubble-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === 5. 首次脉冲 .bbox-frame.pulse（首次出现吸引注意） === */
@keyframes bbox-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 45, 85, 0.45); }
    70% { box-shadow: 0 0 0 10px rgba(255, 45, 85, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 45, 85, 0); }
}

.bbox-frame.pulse {
    animation: bbox-pulse 1.2s ease-out 2;
}

/* === 6. 动效降级（无障碍） === */
@media (prefers-reduced-motion: reduce) {
    .bbox-frame.pulse { animation: none; }
    .coach-bubble { animation: none; }
}

/* ==========================================================================
   隐藏进度文本 DIV（测试用）
   ========================================================================== */

/* 隐藏所有进度文本 DIV */
div[id^="text-prog-"] {
    display: none !important;
}

/* 或者使用类选择器隐藏 */
.trae-browser-inspect-draggable {
    display: none !important;
}

/* ==========================================================================
   ⭐ 文档名悬浮提示词卡片 + 复制反馈 Toast（方案一·懒加载）
   ========================================================================== */

/* 文档名单元格：保留可点指针 */
.doc-filename-cell {
    position: relative;
}

/* 悬浮提示卡片：fixed 挂 body，避免被 .table-container{overflow} 裁剪 */
.docucast-tooltip {
    position: fixed;
    z-index: 7000;
    display: none;
    min-width: 240px;
    max-width: 340px;
    padding: 12px 14px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--color-text-secondary);
    pointer-events: none;
    animation: dcTipIn .14s ease;
}
@keyframes dcTipIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.docucast-tooltip .dc-tip-id {
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px dashed var(--color-border);
}
.docucast-tooltip .dc-tip-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
    align-items: flex-start;
}
.docucast-tooltip .dc-tip-k {
    flex: 0 0 auto;
    color: var(--color-text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}
.docucast-tooltip .dc-tip-v {
    flex: 1 1 auto;
    color: var(--color-text-primary);
    word-break: break-word;
}
.docucast-tooltip .dc-tip-mono {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-primary);
}
.docucast-tooltip .dc-tip-empty {
    color: var(--color-text-muted);
    font-style: italic;
    padding: 2px 0;
}
.docucast-tooltip .dc-tip-hint {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.6875rem;
    text-align: center;
}

/* 复制反馈 Toast */
.docucast-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translate(-50%, -16px);
    z-index: 8000;
    padding: 10px 20px;
    background: var(--color-text-primary);
    color: var(--color-bg-secondary);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
.docucast-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}
.docucast-toast.error {
    background: var(--color-danger);
    color: #fff;
}

/* ==========================================================================
   播放器域名水印（纯CSS，主站 index.html + 分享页 share.html 播放器共用）
   - 挂在 .image-viewport（position:relative; overflow:hidden 已具备）
   - z-index:1 高于图片，低于 bbox-frame(15)/animBox(20)/coach-bubble(30)
   - pointer-events:none 事件穿透，不影响 bbox 拖拽 / 截图 / 字幕
   - SVG 内联，浏览器一次性合成，零网络请求、零 JS、零后端开销
   - 调密度改 background-size；调颜色/透明度改 SVG 里 fill；换域名改 SVG 文本
   ========================================================================== */
.image-viewport::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-repeat: repeat;
    background-size: 400px 280px; /* 每个 tile：两行域名斜排；越小越密 */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='280'><g transform='rotate(30 200 140)' font-family='Arial,sans-serif' font-size='14' fill='rgba(190,190,190,0.25)'><text x='20' y='100'>国际版 ai2035.online   万片云析</text><text x='150' y='120'>国内版 ai2035.xyz   万片云析</text></g></svg>");
}

/* ==========================================================================
   TTS 语音合成设置区域
   ========================================================================== */

.tts-config-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--color-border);
}

.tts-config-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 12px;
}

.tts-config-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.tts-config-item {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 120px;
    gap: 6px;
}

.tts-config-item label {
    font-size: 0.75rem;
    color: var(--color-text-tertiary);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.tts-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%236B6B6B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.tts-select:hover {
    border-color: var(--color-primary);
}

.tts-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(217, 119, 54, 0.1);
}

.tts-preview-btn {
    width: 100%;
    padding: 10px 16px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tts-preview-btn:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.tts-preview-btn:active {
    transform: translateY(0);
}

.tts-preview-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==========================================================================
   TTS 音色试听弹窗
   ========================================================================== */

.tts-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tts-preview-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    cursor: pointer;
}

.tts-preview-dialog {
    position: relative;
    width: 400px;
    max-width: 92vw;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: ttsModalIn 0.25s ease-out;
}

@keyframes ttsModalIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.tts-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.tts-preview-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--color-text-tertiary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    line-height: 1;
    transition: all 0.2s;
}

.tts-preview-close:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-tertiary);
}

.tts-preview-body {
    padding: 20px;
}

/* 移动端适配 */
@media (max-width: 640px) {
    .tts-config-row {
        gap: 10px;
    }
    .tts-config-item {
        min-width: 100%;
    }
}

/* ==========================================================================
   方案D 双层时间轴（timeline-d.js 配套）：上轨橙页码分块 + 下轨Canvas句轨
   预览弹窗 bottom 锚定向上弹出（播放器模态容器 overflow:hidden，向下会被裁剪）
   ========================================================================== */
.d-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
    height: 100%;
    position: relative;
}

.d-page-track {
    position: relative;
    height: 11px;
    display: flex;
    gap: 1px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.d-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(217, 119, 54, 0) 0%, rgba(226, 145, 88, 0.30) 100%);
    z-index: 2;
    pointer-events: none;
}

.d-seg {
    height: 100%;
    cursor: pointer;
    border-radius: 1px;
    background: #d97736;
    opacity: 0.35;
    transition: opacity 0.15s ease;
}

.d-seg:hover { opacity: 1; }
.d-seg.played { opacity: 0.6; }
.d-seg.active {
    opacity: 1;
    box-shadow: 0 0 8px rgba(217, 119, 54, 0.8);
}
.d-seg.skeleton {
    background: #333;
    opacity: 0.5;
    cursor: not-allowed;
}

#canvasD {
    width: 100%;
    height: 38px;
    display: block;
    border-radius: 4px;
    cursor: crosshair;
    background: rgba(255, 255, 255, 0.05);
}

.page-preview {
    position: absolute;
    bottom: 14px;
    width: 190px;
    background: #0f1214;
    border: 1px solid #3a424b;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
    z-index: 60;
    pointer-events: none;
    overflow: hidden;
    animation: pvIn 0.12s ease-out;
}

@keyframes pvIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

.page-preview .pv-head {
    padding: 6px 10px;
    font-size: 11px;
    color: #8a939b;
    border-bottom: 1px solid #23282e;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.page-preview .pv-thumb {
    margin: 8px 10px 10px;
    background: #f4f5f6;
    border-radius: 3px;
    padding: 10px 10px 8px;
}

.pv-real { display: none; }
.page-preview.has-real .pv-real { display: block; }
.page-preview.has-real .pv-fake { display: none; }
.pv-real img {
    display: block;
    width: 100%;
    border-radius: 2px;
    background: #e8eaec;
}

.pv-title {
    height: 7px;
    width: 62%;
    background: #3d4349;
    border-radius: 2px;
    margin-bottom: 7px;
}

.pv-line {
    height: 4px;
    border-radius: 1px;
    background: #c9cdd1;
    margin-top: 4px;
}

.pv-accent {
    height: 4px;
    width: 34%;
    background: #d97736;
    border-radius: 1px;
    margin-top: 5px;
    opacity: 0.85;
}
