* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #1f2937;
  background: #f3f4f6;
}

.topbar {
  height: 56px;
  padding: 0 16px;
  background: #111827;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  font-size: 18px;
  margin: 0;
}

.admin-link {
  color: #93c5fd;
  text-decoration: none;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 12px;
  padding: 12px;
  height: calc(100vh - 56px);
}

.sidebar {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  overflow: auto;
}

.sidebar-title {
  font-weight: 700;
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.tree-root {
  padding: 8px 10px 16px;
}

.tree-category {
  margin: 4px 0;
}

.tree-category-header {
  cursor: pointer;
  user-select: none;
  padding: 6px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.tree-category-header:hover {
  background: #eff6ff;
}

.tree-children {
  margin-left: 14px;
  border-left: 1px dashed #d1d5db;
  padding-left: 10px;
}

.tree-category.collapsed > .tree-children {
  display: none;
}

.tree-video {
  padding: 6px 8px;
  margin: 4px 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.tree-video:hover {
  background: #f3f4f6;
}

.tree-video.active {
  background: #dbeafe;
  color: #1e3a8a;
}

.player-pane {
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  padding: 12px;
  overflow: auto;
}

#player-container {
  width: 100%;
  max-width: 1200px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  display: none;
}

.empty-state {
  color: #6b7280;
  padding: 20px 0;
}

.video-title {
  margin-top: 12px;
  font-size: 20px;
  font-weight: 700;
}

.admin-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
}

.card h2 {
  margin-top: 0;
  font-size: 18px;
}

.row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.row input {
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

button {
  border: 0;
  background: #2563eb;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

button.danger {
  background: #dc2626;
}

.preview,
.json-output {
  width: 100%;
  min-height: 180px;
  background: #0f172a;
  color: #cbd5e1;
  border-radius: 6px;
  padding: 10px;
  overflow: auto;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
}

.json-output {
  min-height: 240px;
  border: 0;
  resize: vertical;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }
}
