:root {
  --primary-color: #4a90e2;
  --success-color: #52c41a;
  --danger-color: #ff4d4f;
  --text-color: #2c3e50;
  --bg-color: #f5f7fa;
  --border-color: #dcdfe6;
  --card-bg: #ffffff;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 24px;
  color: var(--text-color);
}

.header-actions {
  display: flex;
  gap: 10px;
}

.main-content {
  flex: 1;
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 20px;
  overflow: hidden;
}

.left-panel, .right-panel {
  overflow-y: auto;
  padding-right: 5px;
}

.section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.section h2 {
  font-size: 18px;
  margin-bottom: 15px;
  color: var(--text-color);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
}

.note {
  background: #e6f7ff;
  border: 1px solid #91d5ff;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 15px;
  font-size: 14px;
}

.note p {
  margin: 0;
  color: #1890ff;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.scene-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

#scene-counter {
  font-weight: bold;
  min-width: 60px;
  text-align: center;
}

.drop-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 15px;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary-color);
  background: rgba(74, 144, 226, 0.05);
}

.drop-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 10px;
}

.drop-hint {
  font-size: 12px;
  color: #999;
  margin-top: 5px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  background: var(--bg-color);
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.file-preview {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  background: #eee;
}

.file-name {
  flex: 1;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-actions {
  display: flex;
  gap: 5px;
}

.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-color);
}

.form-control {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
}

.textarea-large {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

.sidebar-hint {
  font-size: 12px;
  color: #999;
  margin: 0 0 12px 0;
  padding: 6px;
  background: #f5f5f5;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.scene-list {
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 14px;
}

.scene-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.scene-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.15);
  transform: translateY(-2px);
}

.scene-item.active {
  border-color: var(--primary-color);
  background: rgba(74, 144, 226, 0.05);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.2);
}

.scene-item.dragging {
  opacity: 0.4;
  border: 2px dashed var(--primary-color);
  transform: scale(0.98);
}

.scene-item.drag-over {
  border-top: 3px solid var(--primary-color);
  margin-top: -3px;
  background: rgba(74, 144, 226, 0.08);
}

.scene-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  padding-left: 20px;
}

.scene-item-index {
  font-weight: bold;
  color: var(--primary-color);
  font-size: 14px;
}

.scene-item-speaker {
  font-size: 12px;
  color: var(--text-color);
  margin-bottom: 4px;
}

.scene-item-type {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 500;
}

.scene-item-type.male {
  background: #e6f7ff;
  color: #1890ff;
}

.scene-item-type.female {
  background: #fff0f6;
  color: #eb2f96;
}

.scene-item-type.none {
  background: #f0f0f0;
  color: #666;
}

.scene-item-preview {
  font-size: 12px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #fafafa;
  padding: 6px;
  border-radius: 4px;
}

.drag-handle {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #ccc;
  cursor: grab;
  padding: 4px;
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.scene-item:hover .drag-handle {
  opacity: 1;
}

.drag-handle:hover {
  color: var(--primary-color);
}

.drag-handle:active {
  cursor: grabbing;
  color: var(--primary-color);
}

.radio-group {
  display: flex;
  gap: 20px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: normal;
  cursor: pointer;
}

.radio-group input[type="radio"] {
  cursor: pointer;
}

.editor-tools {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.btn-tool {
  padding: 6px 12px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}

.btn-tool:hover {
  background: var(--primary-color);
  color: white;
}

.preview-box {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 15px;
  min-height: 60px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.preview-box .muted {
  color: #999;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: normal;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  cursor: pointer;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 900px;
  width: auto;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  margin: 0;
}

.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.btn-close:hover {
  background: #f5f5f5;
  color: var(--text-color);
}

.modal-body {
  padding: 20px;
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#preview-frame {
  width: 393px;
  height: auto;
  min-height: 600px;
  max-height: 90vh;
  border: none;
  border-radius: 4px;
  background: #000;
  margin: 0 auto;
  display: block;
  overflow: auto;
}

.progress-container {
  margin: 20px 0;
}

.progress-bar {
  height: 8px;
  background: var(--bg-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 14px;
  color: var(--text-color);
  text-align: center;
}

.footer {
  margin-top: 20px;
  text-align: center;
  color: #999;
  font-size: 14px;
}

@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .left-panel, .right-panel {
    overflow: visible;
  }

  .container {
    height: auto;
  }

  .scene-list {
    max-height: 400px;
  }
}

@media (max-width: 640px) {
  .header {
    flex-direction: column;
    gap: 10px;
  }

  .header h1 {
    font-size: 20px;
  }

  .scene-nav {
    flex-direction: column;
  }

  .form-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .scene-list {
    max-height: 300px;
  }
}