/* --- 全局与布局 --- */
body, html {
    margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    height: 100vh; overflow: hidden; background-color: #f0f2f5; color: #333;
}
h1, h3 { margin: 0; font-weight: 600; }
* { box-sizing: border-box; }

.main-header {
    display: flex; justify-content: space-between; align-items: center;
    background-color: #fff; padding: 12px 25px; border-bottom: 1px solid #ddd;
}
.main-header h1 { font-size: 1.5em; }
.header-controls { display: flex; align-items: center; gap: 20px; }

.autosave-control { display: flex; align-items: center; gap: 8px; font-size: 0.9em; }
#autosave-interval { width: 60px; padding: 4px; border: 1px solid #ccc; border-radius: 4px; }
#autosave-status { font-size: 0.8em; color: #666; min-width: 80px; }

.project-buttons button {
    padding: 8px 16px; border: none; background-color: #007aff; color: white;
    border-radius: 5px; cursor: pointer; margin-left: 10px; font-size: 14px;
}
.project-buttons button:hover { background-color: #005ecb; }

.workbench-container { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; height: calc(100vh - 59px); gap: 1px; background-color: #ddd; }
.panel { background-color: #fff; display: flex; flex-direction: column; overflow: hidden; }
.panel-header { padding: 10px 15px; border-bottom: 1px solid #eee; background-color: #f9f9f9; }
.panel-header h3 { font-size: 1.1em; }

/* 1. 视频区 */
.video-panel { padding: 15px; }
.video-container { position: relative; width: 100%; height: 100%; background-color: #eaf2ff; border-radius: 8px; display: flex; justify-content: center; align-items: center; border: 2px dashed #a9c7ff; transition: border-color 0.3s; }
.video-container.drag-over { border-color: #007aff; }
#main-video { width: 100%; height: 100%; display: none; background-color: #000; }
.placeholder-text { color: #555; font-size: 1.3em; cursor: pointer; padding: 20px; border-radius: 10px; }
.placeholder-text:hover { background-color: rgba(0, 122, 255, 0.1); }

/* 2. 重构区 */
.restructure-panel { padding: 0; }
.restructure-content { padding: 15px; display: flex; flex-direction: column; height: 100%; }
.restructure-content label { font-weight: 600; margin-bottom: 5px; font-size: 0.9em; }
.suspense-input { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; margin-bottom: 15px; }
.tag-buttons { display: flex; gap: 10px; margin-bottom: 15px; }
.tag { padding: 6px 12px; border-radius: 5px; color: #fff; font-size: 0.9em; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; border: 2px solid transparent; }
.tag.drag-enter { transform: scale(1.1); box-shadow: 0 0 10px rgba(0,0,0,0.3); border-color: #fff; }
.tag.conflict { background-color: #dc3545; }
.tag.reversal { background-color: #28a745; }
.tag.climax { background-color: #007aff; }
.drama-editor { flex-grow: 1; border: 1px solid #eee; border-radius: 4px; padding: 10px; overflow-y: auto; background-color: #fdfdfd; }
.drama-item { position: relative; display: flex; align-items: flex-start; padding: 8px; border-radius: 4px; margin-bottom: 5px; cursor: move; }
.drama-item.dragging { opacity: 0.5; background: #cce5ff; }
.drama-item:hover .delete-btn { opacity: 1; }
.delete-btn { position: absolute; top: 5px; right: 5px; width: 18px; height: 18px; background: #666; color: #fff; border: none; border-radius: 50%; cursor: pointer; display: flex; justify-content: center; align-items: center; font-size: 12px; line-height: 18px; opacity: 0; transition: opacity 0.2s; }
.delete-btn:hover { background: #dc3545; }
.bg-conflict { background-color: #fbebee; border-left: 3px solid #dc3545; }
.bg-reversal { background-color: #eaf6ec; border-left: 3px solid #28a745; }
.bg-climax { background-color: #eaf2ff; border-left: 3px solid #007aff; }

/* 3 & 4. 编辑区 */
.editor-content { flex-grow: 1; overflow-y: auto; padding: 10px 15px; font-size: 16px; line-height: 1.8; outline: none; }
.line { display: flex; align-items: flex-start; padding: 4px 0; border-radius: 4px; }
.plot-panel .line { cursor: grab; }
.plot-panel .line:active { cursor: grabbing; }
.timestamp { background-color: #eef2f8; color: #007aff; padding: 2px 8px; border-radius: 4px; margin-right: 12px; font-family: 'Menlo', monospace; font-size: 0.85em; cursor: pointer; user-select: none; -webkit-user-select: none; }
.text-content { flex: 1; outline: none; padding-top: 1px; }

/* --- 交互样式 --- */
.script-panel .line.active-line { background-color: #eaf2ff; }
.script-panel .line.active-line .timestamp { background-color: #007aff; color: #fff; }
.timestamp.copied { background-color: #28a745 !important; color: #fff !important; transition: all 0.2s; }