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

body {
  background: #0d1117;
  color: #e6edf3;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 14px;
  overflow: hidden;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Toolbar ─── */

#toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}

#toolbar h1 {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

button {
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

button:hover {
  background: #30363d;
  border-color: #8b949e;
}

button:active {
  background: #161b22;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select {
  background: #21262d;
  color: #e6edf3;
  border: 1px solid #30363d;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.status-text {
  color: #8b949e;
  font-size: 12px;
}

/* ─── Main layout ─── */

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

/* ─── Canvas ─── */

#canvas-container {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  cursor: crosshair;
}

#pano-canvas {
  display: block;
  height: 100%;
}

.overlay-message {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #8b949e;
  font-size: 16px;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

/* ─── Sidebar ─── */

#sidebar {
  width: 280px;
  min-width: 280px;
  background: #161b22;
  border-left: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#sidebar h2 {
  font-size: 14px;
  font-weight: 600;
  padding: 12px 16px 8px;
  border-bottom: 1px solid #30363d;
}

#waypoint-list {
  flex: 1;
  overflow-y: auto;
}

.waypoint-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid #21262d;
  cursor: pointer;
}

.waypoint-item:hover {
  background: #21262d;
}

.waypoint-item.selected {
  background: #1f3a5f;
  border-left: 3px solid #58a6ff;
  padding-left: 13px;
}

.wp-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #58a6ff;
  color: #0d1117;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.wp-info {
  flex: 1;
  min-width: 0;
}

.wp-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wp-detail {
  font-size: 11px;
  color: #8b949e;
}

.help-text {
  padding: 16px;
  color: #8b949e;
  font-size: 12px;
  line-height: 1.5;
}

/* ─── Modal ─── */

#modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#modal {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 24px;
  width: 360px;
  max-width: 90vw;
}

#modal h3 {
  margin-bottom: 16px;
  font-size: 16px;
}

.modal-field {
  margin-bottom: 12px;
}

.modal-field label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: #8b949e;
}

.modal-field input[type="text"],
.modal-field input[type="number"] {
  width: 100%;
  background: #0d1117;
  color: #e6edf3;
  border: 1px solid #30363d;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
}

.modal-field input:focus {
  outline: none;
  border-color: #58a6ff;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.slider-row input[type="range"] {
  flex: 1;
  accent-color: #58a6ff;
}

.slider-row span {
  min-width: 40px;
  text-align: right;
  font-size: 13px;
  font-family: monospace;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.modal-actions button:first-child {
  background: #238636;
  border-color: #2ea043;
}

.modal-actions button:first-child:hover {
  background: #2ea043;
}
