* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0e1116;
  color: #e6edf3;
  font-size: 14px;
}

header {
  padding: 10px 16px;
  border-bottom: 1px solid #30363d;
  background: #161b22;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
header h1 { margin: 0; font-size: 17px; font-weight: 600; }
.header-controls {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.header-controls label {
  display: flex; gap: 6px; align-items: center;
  color: #8b949e;
}
.header-controls select, .header-controls input[type="text"] {
  background: #0d1117; color: #e6edf3;
  border: 1px solid #30363d; border-radius: 4px;
  padding: 4px 8px; font-size: 13px;
}
#ep-status { color: #58a6ff; font-size: 12px; }

.progress-wrap {
  display: flex; gap: 12px; align-items: center;
  margin-top: 4px;
}
.progress-track {
  flex: 1; height: 14px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 7px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1f6feb 0%, #3fb950 100%);
  color: white;
  font-size: 10px;
  text-align: center;
  line-height: 14px;
  transition: width 0.3s ease;
  white-space: nowrap;
}
#progress-text { color: #8b949e; font-size: 12px; font-family: ui-monospace, monospace; min-width: 100px; }

main {
  max-width: 1400px; margin: 0 auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 16px;
}

.campaign-warning {
  padding: 10px 14px;
  border: 1px solid #9e6a03;
  border-radius: 6px;
  background: #2d2308;
  color: #e3b341;
  font-size: 12px;
}
.strict-rule {
  padding: 8px 12px;
  border-left: 3px solid #58a6ff;
  background: #111a28;
  color: #c9d1d9;
  font-size: 12px;
}

#task-info-panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px 16px;
}
#task-info-panel .lang {
  font-size: 15px; font-weight: 500;
  color: #d2a8ff; margin-bottom: 6px;
}
.representative-info {
  color: #8b949e;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
#task-info-panel details summary {
  cursor: pointer; color: #8b949e;
}
#task-info-panel ol { margin: 6px 0 0; padding-left: 20px; color: #c9d1d9; }

#planned-seq-wrap { margin-top: 10px; }
.planned-seq-title {
  font-size: 11px; color: #8b949e;
  text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 500; margin-bottom: 6px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.planned-seq-hint { color: #6e7681; text-transform: none; letter-spacing: 0; font-size: 11px; font-weight: 400; }
.planned-btn {
  background: #21262d; color: #c9d1d9;
  border: 1px solid #30363d; border-radius: 4px;
  padding: 2px 8px; font-size: 11px; cursor: pointer;
}
.planned-btn:hover { background: #30363d; }
.planned-add-wrap { display: flex; gap: 4px; align-items: center; margin-left: auto; }
#planned-add-select {
  background: #0d1117; color: #e6edf3;
  border: 1px solid #30363d; border-radius: 4px;
  padding: 2px 6px; font-size: 11px; min-width: 180px;
}
.planned-seq {
  display: flex; flex-wrap: wrap; gap: 4px;
  min-height: 38px;
  border: 1px dashed #30363d;
  border-radius: 4px;
  padding: 4px;
}
.planned-node {
  background: #0d1117; border: 1px solid #30363d;
  border-radius: 4px; padding: 4px 8px; min-width: 110px;
  display: flex; flex-direction: column; gap: 1px;
  cursor: grab; user-select: none;
  position: relative;
}
.planned-node:hover { border-color: #58a6ff; }
.planned-node.dragging { opacity: 0.4; cursor: grabbing; }
.planned-node.drop-before { border-left: 2px solid #58a6ff; }
.planned-node.drop-after { border-right: 2px solid #58a6ff; }
.planned-node-num { font-size: 9px; color: #8b949e; }
.planned-node-label { font-size: 11px; color: #e6edf3; padding-right: 14px; }
.planned-node-id { font-size: 9px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.planned-node-remove {
  position: absolute; top: 2px; right: 4px;
  background: transparent; border: none; color: #8b949e;
  font-size: 13px; cursor: pointer; padding: 0; line-height: 1;
}
.planned-node-remove:hover { color: #f85149; }

#video-panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px;
}
.video-stage { position: relative; }
.video-overlay {
  position: absolute; top: 8px; left: 8px; max-width: calc(100% - 16px);
  padding: 4px 9px; border-radius: 4px; pointer-events: none;
  background: rgba(13, 17, 23, 0.78); border: 1px solid rgba(48, 54, 61, 0.9);
  color: #e6edf3; font: 13px ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.video-overlay:empty { display: none; }
.video-overlay .seg-idx { color: #8b949e; margin-right: 6px; }
.video-overlay .unlabeled { color: #d29922; }
#vid {
  width: 100%; max-height: 360px;
  background: #000;
  border-radius: 4px;
  display: block;
}
.video-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin: 6px 0 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: #8b949e;
}
.controls-hint { font-size: 11px; }

#timeline-wrap {
  position: relative;
  margin: 6px 0;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 6px;
}
#timeline {
  display: block;
  width: 100%;
  cursor: crosshair;
}

.frame-controls {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 8px;
  align-items: center;
}
.frame-controls-right {
  margin-left: auto;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.frame-controls-right .mark-complete {
  font-size: 12px; color: #8b949e;
  display: flex; gap: 4px; align-items: center;
}

button {
  background: #21262d; color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}
button:hover { background: #30363d; }
button.primary {
  background: #238636; color: white; border-color: #2ea043;
}
button.primary:hover { background: #2ea043; }
button.danger {
  background: #5a1818; color: #ffa198; border-color: #6e2026;
}

#segments-panel, #pool-panel {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px 16px;
}
h2 { margin: 0 0 8px; font-size: 15px; color: #8b949e; }

#segments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
#segments-table th, #segments-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #21262d;
  text-align: left;
}
#segments-table th { color: #8b949e; font-weight: 500; font-size: 12px; }
/* row whose frame range contains the playhead */
#segments-table tr.current-seg td { box-shadow: inset 0 2px 0 rgba(248, 81, 73, 0.55), inset 0 -2px 0 rgba(248, 81, 73, 0.55); background: rgba(248, 81, 73, 0.06); }
#segments-table tr.current-seg td:first-child { box-shadow: inset 2px 2px 0 rgba(248, 81, 73, 0.55), inset 0 -2px 0 rgba(248, 81, 73, 0.55); }
#segments-table tr.current-seg td:last-child { box-shadow: inset -2px 2px 0 rgba(248, 81, 73, 0.55), inset 0 -2px 0 rgba(248, 81, 73, 0.55); }
#segments-table input[type="number"] {
  width: 80px;
  background: #0d1117; color: #e6edf3;
  border: 1px solid #30363d; border-radius: 4px;
  padding: 2px 6px;
}
#segments-table select {
  background: #0d1117; color: #e6edf3;
  border: 1px solid #30363d; border-radius: 4px;
  padding: 2px 6px; min-width: 240px;
}
#segments-table input[type="text"] {
  width: 100%;
  background: #0d1117; color: #e6edf3;
  border: 1px solid #30363d; border-radius: 4px;
  padding: 2px 6px;
}

.segments-footer {
  margin-top: 10px;
  display: flex; gap: 12px; align-items: center;
}
#save-status { color: #58a6ff; font-size: 12px; }

#pool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
}
.pool-card {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
}
.pool-card .pool-id { color: #58a6ff; font-family: ui-monospace, monospace; }
.pool-card .pool-verb {
  display: inline-block; padding: 1px 6px; margin-right: 6px;
  border-radius: 8px;
  background: #1f6feb; color: white; font-size: 10px;
  text-transform: uppercase;
}
.pool-card .pool-meta { color: #8b949e; margin-top: 3px; }
.pool-card.non-coverage { border-color: #9e6a03; }

.pool-note { color: #8b949e; font-size: 12px; margin-top: 8px; }
