
:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --card: #ffffff;
  --border: #e8e8ed;
  --text: #1d1d1f;
  --text-dim: #6e6e73;
  --accent: #0071e3;
  --confirm: #34c759;
  --pending: #ffa726;
  --reject: #ef5350;
  --btn-bg: #f5f5f7;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
}

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

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text);
  height: 100vh; display: flex; flex-direction: column; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#vh-header {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; background: rgba(255,255,255,.85);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.back-link { color: var(--accent); text-decoration: none; font-size: 13px; }
.back-link:hover { opacity: .8; }
#vh-header nav a:hover { opacity: .7; }
.brand-subtitle { font-size:11px; color:var(--text-dim); margin-left:8px; padding-left:8px; border-left:1.5px solid var(--border); font-weight:400; white-space:nowrap; }
#vh-search, #vh-sort {
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 5px 10px; font-size: 12px;
}
#vh-sort { cursor: pointer; }

#vh-main { display: flex; flex: 1; overflow: hidden; }

#vh-sidebar {
  width: 320px; background: var(--panel);
  border-right: 1px solid var(--border); flex-shrink: 0;
  display: flex; flex-direction: column; overflow-y: auto;
}

.vh-item {
  padding: 12px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.vh-item:hover { background: var(--card); }
.vh-item.active { background: var(--card); border-left: 3px solid var(--accent); }
.vh-item-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.vh-item-meta { font-size: 11px; color: var(--text-dim); display: flex; gap: 12px; }
.vh-item-tag {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  font-size: 10px; background: var(--btn-bg); color: var(--text-dim);
}

#vh-player-area {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: var(--bg); overflow: hidden; position: relative;
}
#vh-empty { color: var(--text-dim); font-size: 18px; }
#vh-player { width: 100%; height: 100%; display: flex; flex-direction: column; }

#vh-video {
  width: 100%; max-height: 60vh; background: #000;
  border-bottom: 1px solid var(--border);
}

#vh-meta { padding: 16px 24px; }
#vh-meta h3 { font-size: 18px; margin-bottom: 12px; }
.vh-meta-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.vh-meta-grid div { font-size: 12px; }
.vh-meta-grid div span:first-child {
  color: var(--text-dim); margin-right: 6px;
}

#vh-actions {
  display: flex; gap: 8px; padding: 0 24px 16px;
}
#vh-actions a, #vh-actions button {
  padding: 6px 16px; border-radius: 6px; font-size: 13px;
  text-decoration: none; cursor: pointer;
}
#vh-download { background: var(--accent); color: var(--bg); }
#vh-download:hover { opacity: .85; }
#vh-reedit { background: var(--accent); color: #fff; border: none; }
#vh-reedit:hover { opacity: .85; }
#vh-delete { background: var(--reject); color: #fff; border: none; }
#vh-delete:hover { opacity: .85; }

/* ====== Edit Panel ====== */
#vh-edit-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  background: var(--panel);
  border-top: 1px solid transparent;
  padding: 0 24px;
  flex-shrink: 0;
}
#vh-edit-panel.expanded {
  max-height: 2000px;
  border-top-color: var(--border);
  padding: 20px 24px;
  overflow-y: auto;
}

.vep-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.vep-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.vep-btn-icon {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: inherit;
}
.vep-btn-icon:hover {
  background: var(--btn-bg);
  color: var(--text);
}

.vep-section {
  margin-bottom: 18px;
}
.vep-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.vep-section-count {
  font-size: 10px;
  font-weight: 500;
  background: var(--btn-bg);
  color: var(--text-dim);
  padding: 1px 7px;
  border-radius: 10px;
}

.vep-idea {
  font-size: 13px;
  color: var(--text);
  background: var(--btn-bg);
  padding: 10px 14px;
  border-radius: 8px;
  line-height: 1.6;
}

/* Character items */
.vep-char-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.vep-char-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.vep-char-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}
.vep-char-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.vep-char-info {
  flex: 1;
  min-width: 0;
}
.vep-char-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.vep-char-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}
.vep-char-chevron {
  font-size: 10px;
  color: var(--text-dim);
  transition: transform 0.2s;
}
.vep-char-item.expanded .vep-char-chevron {
  transform: rotate(90deg);
}

/* Character edit form */
.vep-char-edit {
  display: none;
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}
.vep-char-item.expanded .vep-char-edit {
  display: block;
}
.vep-edit-field {
  margin-bottom: 8px;
}
.vep-edit-field label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 3px;
  font-weight: 500;
}
.vep-edit-field input,
.vep-edit-field select {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.vep-edit-field input:focus,
.vep-edit-field select:focus {
  border-color: var(--accent);
}
.vep-edit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* Scene cards */
.vep-scene-card {
  background: var(--btn-bg);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-left: 3px solid transparent;
}
.vep-scene-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.vep-scene-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Generate area */
.vep-generate-area {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.vep-progress {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}
.vep-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
}
.vep-status {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Panel buttons */
.vep-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 18px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.vep-btn-primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}
.vep-btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}
.vep-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 18px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  background: var(--btn-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.vep-btn-secondary:hover {
  background: var(--border);
}
.vep-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 18px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.vep-btn-outline:hover {
  background: var(--accent);
  color: #fff;
}
.vep-result-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.vep-empty {
  font-size: 11px;
  color: var(--text-dim);
  padding: 12px 0;
  text-align: center;
}

/* Player scrollable when editing */
#vh-player {
  overflow-y: auto;
}
